From b219559763498c4bd10c730cd3d2c62b1eed45db Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 22 Oct 2019 09:08:38 +0300 Subject: [PATCH] Indices are stored as mcIdType type instead of int to support switch to 64bits indexing --- MEDCouplingConfig.cmake.in | 1 + src/INTERP_KERNEL/BBTree.txx | 18 +- src/INTERP_KERNEL/BBTreeDst.txx | 34 +- src/INTERP_KERNEL/BBTreePts.txx | 12 +- .../Barycentric3DIntersectorP1P1.txx | 6 +- .../Bases/InterpKernelHashTable.hxx | 26 +- src/INTERP_KERNEL/CMakeLists.txt | 4 + src/INTERP_KERNEL/CellModel.cxx | 74 +- src/INTERP_KERNEL/CellModel.hxx | 23 +- src/INTERP_KERNEL/ConvexIntersector.txx | 10 +- src/INTERP_KERNEL/CurveIntersector.hxx | 2 +- src/INTERP_KERNEL/CurveIntersector.txx | 26 +- src/INTERP_KERNEL/CurveIntersectorP0P0.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP0P0.txx | 10 +- src/INTERP_KERNEL/CurveIntersectorP0P1.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP0P1.txx | 10 +- src/INTERP_KERNEL/CurveIntersectorP1P0.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P0.txx | 12 +- src/INTERP_KERNEL/CurveIntersectorP1P1.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1.txx | 12 +- src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx | 4 +- src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx | 4 +- src/INTERP_KERNEL/DiameterCalculator.cxx | 186 +- src/INTERP_KERNEL/DiameterCalculator.hxx | 219 +- src/INTERP_KERNEL/DirectedBoundingBox.cxx | 6 +- .../ExprEval/InterpKernelAsmX86.cxx | 4 +- .../ExprEval/InterpKernelUnit.cxx | 9 +- .../GaussPoints/InterpKernelGaussCoords.cxx | 18 +- .../GaussPoints/InterpKernelGaussCoords.hxx | 11 +- .../InterpKernelGeo2DAbstractEdge.cxx | 4 +- .../InterpKernelGeo2DComposedEdge.cxx | 2 +- .../Geometric2D/InterpKernelGeo2DEdge.cxx | 52 +- .../Geometric2D/InterpKernelGeo2DEdge.hxx | 17 +- .../InterpKernelGeo2DEdgeArcCircle.cxx | 8 +- .../InterpKernelGeo2DEdgeArcCircle.hxx | 3 +- .../InterpKernelGeo2DElementaryEdge.cxx | 10 +- .../InterpKernelGeo2DElementaryEdge.hxx | 8 +- .../Geometric2D/InterpKernelGeo2DNode.cxx | 14 +- .../Geometric2D/InterpKernelGeo2DNode.hxx | 9 +- .../InterpKernelGeo2DQuadraticPolygon.cxx | 138 +- .../InterpKernelGeo2DQuadraticPolygon.hxx | 34 +- src/INTERP_KERNEL/Geometric2DIntersector.txx | 20 +- .../IntegralUniformIntersector.hxx | 8 +- .../IntegralUniformIntersector.txx | 20 +- .../InterpKernelCellSimplify.cxx | 208 +- .../InterpKernelCellSimplify.hxx | 29 +- src/INTERP_KERNEL/InterpKernelMatrixTools.cxx | 56 +- src/INTERP_KERNEL/InterpKernelMatrixTools.hxx | 7 +- src/INTERP_KERNEL/InterpKernelUtilities.hxx | 3 + src/INTERP_KERNEL/Interpolation.hxx | 8 +- src/INTERP_KERNEL/Interpolation.txx | 13 +- src/INTERP_KERNEL/Interpolation1D0D.cxx | 4 +- src/INTERP_KERNEL/Interpolation1D0D.hxx | 2 +- src/INTERP_KERNEL/Interpolation1D0D.txx | 14 +- src/INTERP_KERNEL/Interpolation2D1D.hxx | 4 +- src/INTERP_KERNEL/Interpolation2D1D.txx | 16 +- src/INTERP_KERNEL/Interpolation2D3D.hxx | 5 +- src/INTERP_KERNEL/Interpolation2D3D.txx | 26 +- src/INTERP_KERNEL/Interpolation3D.hxx | 86 +- src/INTERP_KERNEL/Interpolation3D.txx | 34 +- src/INTERP_KERNEL/Interpolation3D1D.cxx | 4 +- src/INTERP_KERNEL/Interpolation3D1D.hxx | 90 +- src/INTERP_KERNEL/Interpolation3D1D.txx | 26 +- src/INTERP_KERNEL/InterpolationCC.hxx | 2 +- src/INTERP_KERNEL/InterpolationCC.txx | 62 +- src/INTERP_KERNEL/InterpolationCU.hxx | 5 +- src/INTERP_KERNEL/InterpolationCU.txx | 39 +- src/INTERP_KERNEL/InterpolationCurve.hxx | 88 +- src/INTERP_KERNEL/InterpolationCurve.txx | 16 +- src/INTERP_KERNEL/InterpolationOptions.cxx | 4 +- src/INTERP_KERNEL/InterpolationOptions.hxx | 4 +- src/INTERP_KERNEL/InterpolationPlanar.hxx | 118 +- src/INTERP_KERNEL/InterpolationPlanar.txx | 22 +- src/INTERP_KERNEL/InterpolationUtils.hxx | 22 +- src/INTERP_KERNEL/Intersector3D.txx | 6 +- src/INTERP_KERNEL/Intersector3DP0P0.hxx | 4 +- src/INTERP_KERNEL/Intersector3DP0P0.txx | 4 +- src/INTERP_KERNEL/Intersector3DP0P1.hxx | 4 +- src/INTERP_KERNEL/Intersector3DP0P1.txx | 4 +- src/INTERP_KERNEL/Intersector3DP1P0.hxx | 4 +- src/INTERP_KERNEL/Intersector3DP1P0.txx | 4 +- src/INTERP_KERNEL/Intersector3DP1P0Bary.hxx | 4 +- src/INTERP_KERNEL/Intersector3DP1P0Bary.txx | 4 +- src/INTERP_KERNEL/Intersector3DP1P1.hxx | 4 +- src/INTERP_KERNEL/Intersector3DP1P1.txx | 4 +- src/INTERP_KERNEL/IntersectorCU.hxx | 6 +- src/INTERP_KERNEL/IntersectorCU.txx | 11 +- src/INTERP_KERNEL/IntersectorCU3D.txx | 26 +- src/INTERP_KERNEL/MCIdType.hxx | 48 + .../MappedBarycentric2DIntersectorP1P1.hxx | 4 +- .../MappedBarycentric2DIntersectorP1P1.txx | 12 +- .../MappedBarycentric3DIntersectorP1P1.hxx | 1 + .../MappedBarycentric3DIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/MeshElement.txx | 2 +- src/INTERP_KERNEL/OrientationInverter.cxx | 26 +- src/INTERP_KERNEL/OrientationInverter.hxx | 33 +- .../Planar2D1DIntersectorP0P0.hxx | 4 +- .../Planar2D1DIntersectorP0P0.txx | 12 +- src/INTERP_KERNEL/PlanarIntersector.hxx | 10 +- src/INTERP_KERNEL/PlanarIntersector.txx | 38 +- src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP0P0.txx | 10 +- src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx | 5 +- src/INTERP_KERNEL/PlanarIntersectorP0P1.txx | 14 +- .../PlanarIntersectorP0P1Bary.hxx | 4 +- .../PlanarIntersectorP0P1Bary.txx | 12 +- src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx | 12 +- src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P0.txx | 14 +- .../PlanarIntersectorP1P0Bary.hxx | 4 +- .../PlanarIntersectorP1P0Bary.txx | 12 +- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx | 6 +- src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P1.txx | 20 +- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx | 4 +- src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx | 8 +- .../PointLocator2DIntersector.txx | 4 +- .../PointLocator3DIntersectorP0P0.hxx | 1 + .../PointLocator3DIntersectorP0P0.txx | 4 +- .../PointLocator3DIntersectorP0P1.hxx | 1 + .../PointLocator3DIntersectorP0P1.txx | 6 +- .../PointLocator3DIntersectorP1P0.hxx | 1 + .../PointLocator3DIntersectorP1P0.txx | 4 +- .../PointLocator3DIntersectorP1P1.hxx | 1 + .../PointLocator3DIntersectorP1P1.txx | 6 +- src/INTERP_KERNEL/PointLocatorAlgos.txx | 36 +- src/INTERP_KERNEL/PolygonAlgorithms.txx | 4 +- .../Polyhedron3D2DIntersectorP0P0.hxx | 2 +- .../Polyhedron3D2DIntersectorP0P0.txx | 14 +- .../PolyhedronIntersectorP0P1.txx | 2 +- .../PolyhedronIntersectorP1P0.txx | 2 +- .../PolyhedronIntersectorP1P0Bary.txx | 6 +- .../PolyhedronIntersectorP1P1.txx | 12 +- src/INTERP_KERNEL/SplitterTetra.cxx | 46 +- src/INTERP_KERNEL/SplitterTetra.hxx | 58 +- src/INTERP_KERNEL/SplitterTetra.txx | 87 +- src/INTERP_KERNEL/TargetIntersector.hxx | 4 +- src/INTERP_KERNEL/TransformedTriangleMath.cxx | 4 +- .../TriangulationIntersector.txx | 16 +- src/INTERP_KERNEL/VolSurfFormulae.hxx | 69 +- src/INTERP_KERNEL/VolSurfUser.cxx | 2 +- src/INTERP_KERNEL/VolSurfUser.hxx | 11 +- src/INTERP_KERNEL/VolSurfUser.txx | 86 +- .../InterpolationPlanarTestSuite.hxx | 16 +- src/INTERP_KERNELTest/MeshTestToolkit.hxx | 2 +- src/INTERP_KERNELTest/MeshTestToolkit.txx | 24 +- src/INTERP_KERNELTest/PerfTest.cxx | 2 +- .../ThreeDSurfProjectionTest.cxx | 3 +- .../UnitTetra3D2DIntersectionTest.cxx | 11 +- .../UnitTetraIntersectionBaryTest.cxx | 5 +- src/MEDCoupling/CMakeLists.txt | 4 + src/MEDCoupling/MCType.hxx | 25 +- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 1230 ++--- src/MEDCoupling/MEDCoupling1GTUMesh.hxx | 168 +- src/MEDCoupling/MEDCoupling1GTUMesh.txx | 14 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 218 +- src/MEDCoupling/MEDCouplingAMRAttribute.hxx | 74 +- src/MEDCoupling/MEDCouplingCMesh.cxx | 101 +- src/MEDCoupling/MEDCouplingCMesh.hxx | 26 +- .../MEDCouplingCartesianAMRMesh.cxx | 537 +-- .../MEDCouplingCartesianAMRMesh.hxx | 162 +- .../MEDCouplingCurveLinearMesh.cxx | 206 +- .../MEDCouplingCurveLinearMesh.hxx | 34 +- src/MEDCoupling/MEDCouplingDefinitionTime.cxx | 4 +- src/MEDCoupling/MEDCouplingField.cxx | 40 +- src/MEDCoupling/MEDCouplingField.hxx | 26 +- .../MEDCouplingFieldDiscretization.cxx | 958 ++-- .../MEDCouplingFieldDiscretization.hxx | 278 +- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 165 +- src/MEDCoupling/MEDCouplingFieldDouble.hxx | 26 +- src/MEDCoupling/MEDCouplingFieldFloat.cxx | 1 + src/MEDCoupling/MEDCouplingFieldInt.cxx | 1 + src/MEDCoupling/MEDCouplingFieldT.hxx | 22 +- src/MEDCoupling/MEDCouplingFieldT.txx | 80 +- src/MEDCoupling/MEDCouplingFieldTemplate.cxx | 18 +- src/MEDCoupling/MEDCouplingFieldTemplate.hxx | 8 +- .../MEDCouplingGaussLocalization.cxx | 26 +- .../MEDCouplingGaussLocalization.hxx | 6 +- src/MEDCoupling/MEDCouplingIMesh.cxx | 421 +- src/MEDCoupling/MEDCouplingIMesh.hxx | 50 +- src/MEDCoupling/MEDCouplingMap.cxx | 2 +- src/MEDCoupling/MEDCouplingMap.hxx | 13 +- src/MEDCoupling/MEDCouplingMap.txx | 16 +- .../MEDCouplingMappedExtrudedMesh.cxx | 287 +- .../MEDCouplingMappedExtrudedMesh.hxx | 80 +- src/MEDCoupling/MEDCouplingMatrix.cxx | 27 +- src/MEDCoupling/MEDCouplingMatrix.hxx | 28 +- src/MEDCoupling/MEDCouplingMemArray.cxx | 4184 ++-------------- src/MEDCoupling/MEDCouplingMemArray.hxx | 654 +-- src/MEDCoupling/MEDCouplingMemArray.txx | 4200 +++++++++++++++-- src/MEDCoupling/MEDCouplingMemArrayChar.cxx | 185 +- src/MEDCoupling/MEDCouplingMemArrayFloat.cxx | 21 +- src/MEDCoupling/MEDCouplingMesh.cxx | 46 +- src/MEDCoupling/MEDCouplingMesh.hxx | 68 +- src/MEDCoupling/MEDCouplingMultiFields.cxx | 70 +- src/MEDCoupling/MEDCouplingMultiFields.hxx | 5 +- .../MEDCouplingNormalizedCartesianMesh.hxx | 6 +- .../MEDCouplingNormalizedCartesianMesh.txx | 4 +- .../MEDCouplingNormalizedUnstructuredMesh.hxx | 19 +- .../MEDCouplingNormalizedUnstructuredMesh.txx | 56 +- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 84 +- src/MEDCoupling/MEDCouplingPartDefinition.hxx | 38 +- src/MEDCoupling/MEDCouplingPointSet.cxx | 248 +- src/MEDCoupling/MEDCouplingPointSet.hxx | 104 +- src/MEDCoupling/MEDCouplingRemapper.cxx | 216 +- src/MEDCoupling/MEDCouplingRemapper.hxx | 30 +- src/MEDCoupling/MEDCouplingSkyLineArray.cxx | 284 +- src/MEDCoupling/MEDCouplingSkyLineArray.hxx | 58 +- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 776 +-- src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 138 +- .../MEDCouplingTimeDiscretization.cxx | 113 +- .../MEDCouplingTimeDiscretization.hxx | 74 +- .../MEDCouplingTimeDiscretization.txx | 24 +- src/MEDCoupling/MEDCouplingTraits.hxx | 12 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 2431 +++++----- src/MEDCoupling/MEDCouplingUMesh.hxx | 414 +- src/MEDCoupling/MEDCouplingUMesh.txx | 12 +- src/MEDCoupling/MEDCouplingUMesh_internal.cxx | 792 ++-- src/MEDCoupling/MEDCouplingUMesh_internal.hxx | 144 +- .../MEDCouplingUMesh_intersection.cxx | 1090 ++--- src/MEDCoupling/MEDCouplingVoronoi.cxx | 160 +- .../Test/MEDCouplingBasicsTest.hxx | 5 +- .../Test/MEDCouplingBasicsTest0.cxx | 116 +- .../Test/MEDCouplingBasicsTest1.cxx | 527 +-- .../Test/MEDCouplingBasicsTest2.cxx | 177 +- .../Test/MEDCouplingBasicsTest3.cxx | 497 +- .../Test/MEDCouplingBasicsTest4.cxx | 624 +-- .../Test/MEDCouplingBasicsTest5.cxx | 679 +-- .../Test/MEDCouplingBasicsTestData1.hxx | 10 +- .../Test/MEDCouplingBasicsTestInterp.cxx | 184 +- .../Test/MEDCouplingExamplesTest.cxx | 331 +- .../Test/MEDCouplingRemapperTest.cxx | 36 +- src/MEDCoupling_Swig/CMakeLists.txt | 12 + src/MEDCoupling_Swig/DataArrayInt.i | 2613 ++++++++++ src/MEDCoupling_Swig/MEDCoupling.i | 77 +- .../MEDCouplingBasicsTest2.py | 4 +- .../MEDCouplingBasicsTest3.py | 2 +- .../MEDCouplingBasicsTest4.py | 2 +- .../MEDCouplingBasicsTest5.py | 22 +- .../MEDCouplingBasicsTest7.py | 724 +++ src/MEDCoupling_Swig/MEDCouplingCommon.i | 1660 +++---- .../MEDCouplingDataArrayTraits.hxx | 97 +- .../MEDCouplingDataArrayTypemaps.i | 752 +-- .../MEDCouplingFieldDiscretization.i | 174 +- src/MEDCoupling_Swig/MEDCouplingFinalize.i | 151 +- src/MEDCoupling_Swig/MEDCouplingMemArray.i | 3825 +++------------ src/MEDCoupling_Swig/MEDCouplingNumPyTest.py | 58 +- src/MEDCoupling_Swig/MEDCouplingPickleTest.py | 2 +- .../MEDCouplingRefCountObject.i | 9 + src/MEDCoupling_Swig/MEDCouplingRemapper.i | 77 +- .../MEDCouplingRemapperCommon.i | 21 +- .../MEDCouplingRemapperTest.py | 6 +- .../MEDCouplingTimeDiscretization.i | 4 +- src/MEDCoupling_Swig/MEDCouplingTypemaps.i | 84 +- .../UsersGuideExamplesTest_numpy.py | 4 +- src/MEDCoupling_Swig/tests.set | 1 + src/MEDLoader/CMakeLists.txt | 4 + src/MEDLoader/MEDFileBasis.hxx | 112 + src/MEDLoader/MEDFileBlowStrEltUp.cxx | 59 +- src/MEDLoader/MEDFileData.cxx | 12 +- src/MEDLoader/MEDFileEquivalence.cxx | 27 +- src/MEDLoader/MEDFileField.cxx | 68 +- src/MEDLoader/MEDFileField.hxx | 4 +- src/MEDLoader/MEDFileField.txx | 46 +- src/MEDLoader/MEDFileField1TS.cxx | 200 +- src/MEDLoader/MEDFileField1TS.hxx | 70 +- src/MEDLoader/MEDFileFieldGlobs.cxx | 131 +- src/MEDLoader/MEDFileFieldGlobs.hxx | 22 +- src/MEDLoader/MEDFileFieldInternal.cxx | 653 +-- src/MEDLoader/MEDFileFieldInternal.hxx | 162 +- src/MEDLoader/MEDFileFieldMultiTS.cxx | 56 +- src/MEDLoader/MEDFileFieldMultiTS.hxx | 28 +- src/MEDLoader/MEDFileFieldOverView.cxx | 530 +-- src/MEDLoader/MEDFileFieldOverView.hxx | 116 +- src/MEDLoader/MEDFileJoint.cxx | 57 +- src/MEDLoader/MEDFileJoint.hxx | 12 +- src/MEDLoader/MEDFileMesh.cxx | 1357 +++--- src/MEDLoader/MEDFileMesh.hxx | 292 +- src/MEDLoader/MEDFileMeshElt.cxx | 197 +- src/MEDLoader/MEDFileMeshElt.hxx | 28 +- src/MEDLoader/MEDFileMeshLL.cxx | 396 +- src/MEDLoader/MEDFileMeshLL.hxx | 118 +- src/MEDLoader/MEDFileMeshSupport.cxx | 8 +- src/MEDLoader/MEDFileMeshSupport.hxx | 2 +- src/MEDLoader/MEDFileParameter.cxx | 43 +- src/MEDLoader/MEDFileStructureElement.cxx | 30 +- src/MEDLoader/MEDFileStructureElement.hxx | 2 +- src/MEDLoader/MEDFileUtilities.cxx | 7 +- src/MEDLoader/MEDLoader.cxx | 100 +- src/MEDLoader/MEDLoader.hxx | 3 +- src/MEDLoader/MEDLoaderBase.cxx | 4 +- src/MEDLoader/MEDLoaderBase.hxx | 2 +- src/MEDLoader/MEDLoaderNS.hxx | 4 +- src/MEDLoader/SauvMedConvertor.cxx | 172 +- src/MEDLoader/SauvMedConvertor.hxx | 16 +- src/MEDLoader/SauvReader.cxx | 10 +- src/MEDLoader/SauvWriter.cxx | 114 +- src/MEDLoader/SauvWriter.hxx | 8 +- src/MEDLoader/Swig/CMakeLists.txt | 3 + src/MEDLoader/Swig/MEDLoader.i | 77 +- src/MEDLoader/Swig/MEDLoaderCommon.i | 379 +- src/MEDLoader/Swig/MEDLoaderTest3.py | 44 +- src/MEDLoader/Swig/MEDLoaderTypemaps.i | 75 +- src/MEDLoader/Test/MEDLoaderTest.cxx | 112 +- src/MEDLoader/Test/SauvLoaderTest.cxx | 28 +- src/MEDPartitioner/CMakeLists.txt | 4 + .../MEDPARTITIONER_ConnectZone.cxx | 102 +- .../MEDPARTITIONER_ConnectZone.hxx | 49 +- src/MEDPartitioner/MEDPARTITIONER_Graph.cxx | 12 +- src/MEDPartitioner/MEDPARTITIONER_Graph.hxx | 7 +- .../MEDPARTITIONER_JointFinder.cxx | 38 +- .../MEDPARTITIONER_JointFinder.hxx | 9 +- .../MEDPARTITIONER_MeshCollection.cxx | 418 +- .../MEDPARTITIONER_MeshCollection.hxx | 44 +- .../MEDPARTITIONER_MeshCollectionDriver.cxx | 20 +- ...RTITIONER_MeshCollectionMedAsciiDriver.cxx | 22 +- ...PARTITIONER_MeshCollectionMedXmlDriver.cxx | 2 +- .../MEDPARTITIONER_MetisGraph.cxx | 15 +- .../MEDPARTITIONER_PTScotchGraph.cxx | 16 +- .../MEDPARTITIONER_ParMetisGraph.cxx | 17 +- .../MEDPARTITIONER_ParaDomainSelector.cxx | 131 +- .../MEDPARTITIONER_ParaDomainSelector.hxx | 31 +- .../MEDPARTITIONER_ParallelTopology.cxx | 211 +- .../MEDPARTITIONER_ParallelTopology.hxx | 110 +- .../MEDPARTITIONER_ScotchGraph.cxx | 15 +- .../MEDPARTITIONER_Topology.hxx | 69 +- .../MEDPARTITIONER_UserGraph.cxx | 6 +- .../MEDPARTITIONER_UserGraph.hxx | 2 +- src/MEDPartitioner/MEDPARTITIONER_Utils.cxx | 63 +- src/MEDPartitioner/MEDPARTITIONER_Utils.hxx | 43 +- .../MEDPARTITIONER_UtilsPara.cxx | 49 +- .../Test/MEDPARTITIONERTest.cxx | 142 +- src/MEDPartitioner_Swig/CMakeLists.txt | 4 + src/ParaMEDLoader/CMakeLists.txt | 4 + src/ParaMEDLoader/ParaMEDFileMesh.cxx | 7 +- src/ParaMEDLoader/ParaMEDLoader.cxx | 4 +- src/ParaMEDMEM/BlockTopology.cxx | 110 +- src/ParaMEDMEM/BlockTopology.hxx | 20 +- src/ParaMEDMEM/CMakeLists.txt | 4 + src/ParaMEDMEM/CommInterface.hxx | 3 + src/ParaMEDMEM/ComponentTopology.hxx | 2 +- src/ParaMEDMEM/DisjointDEC.cxx | 14 +- src/ParaMEDMEM/ElementLocator.cxx | 208 +- src/ParaMEDMEM/ElementLocator.hxx | 24 +- src/ParaMEDMEM/ExplicitCoincidentDEC.cxx | 60 +- src/ParaMEDMEM/ExplicitMapping.cxx | 22 +- src/ParaMEDMEM/ExplicitMapping.hxx | 16 +- src/ParaMEDMEM/ExplicitTopology.cxx | 28 +- src/ParaMEDMEM/ExplicitTopology.hxx | 32 +- src/ParaMEDMEM/InterpKernelDEC.cxx | 4 +- src/ParaMEDMEM/InterpolationMatrix.cxx | 204 +- src/ParaMEDMEM/InterpolationMatrix.hxx | 36 +- src/ParaMEDMEM/MPIAccess.cxx | 16 +- src/ParaMEDMEM/MPIAccess.hxx | 7 +- src/ParaMEDMEM/MPIAccessDEC.cxx | 24 +- src/ParaMEDMEM/MPIProcessorGroup.cxx | 2 +- src/ParaMEDMEM/MxN_Mapping.cxx | 22 +- src/ParaMEDMEM/MxN_Mapping.hxx | 8 +- src/ParaMEDMEM/OverlapDEC.cxx | 10 +- src/ParaMEDMEM/OverlapElementLocator.cxx | 58 +- src/ParaMEDMEM/OverlapElementLocator.hxx | 10 +- src/ParaMEDMEM/OverlapInterpolationMatrix.cxx | 16 +- src/ParaMEDMEM/OverlapInterpolationMatrix.hxx | 10 +- src/ParaMEDMEM/OverlapMapping.cxx | 209 +- src/ParaMEDMEM/OverlapMapping.hxx | 32 +- src/ParaMEDMEM/ParaFIELD.cxx | 6 +- src/ParaMEDMEM/ParaFIELD.hxx | 5 +- src/ParaMEDMEM/ParaIdType.hxx | 31 + src/ParaMEDMEM/ParaMESH.cxx | 20 +- src/ParaMEDMEM/ParaMESH.hxx | 28 +- src/ParaMEDMEM/ProcessorGroup.hxx | 2 +- src/ParaMEDMEM/StructuredCoincidentDEC.cxx | 58 +- src/ParaMEDMEM/Topology.hxx | 6 +- src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx | 2 +- src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx | 2 +- .../ParaMEDMEMTest_BlockTopology.cxx | 12 +- .../ParaMEDMEMTest_FabienAPI.cxx | 8 +- .../ParaMEDMEMTest_Gauthier1.cxx | 16 +- src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx | 5 +- .../ParaMEDMEMTest_InterpKernelDEC.cxx | 58 +- .../ParaMEDMEMTest_OverlapDEC.cxx | 16 +- ...ParaMEDMEMTest_StructuredCoincidentDEC.cxx | 2 +- .../test_MPI_Access_ISend_IRecv_Length_1.cxx | 4 +- src/ParaMEDMEM_Swig/CMakeLists.txt | 7 + src/ParaMEDMEM_Swig/ParaMEDMEM.i | 71 +- src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i | 18 +- src/PyWrapping/CMakeLists.txt | 3 + src/PyWrapping/medcoupling.i | 77 +- src/RENUMBER/CMakeLists.txt | 4 + src/RENUMBER/RENUMBER_BOOSTRenumbering.cxx | 14 +- src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx | 2 +- src/RENUMBER/RENUMBER_METISRenumbering.cxx | 29 +- src/RENUMBER/RENUMBER_METISRenumbering.hxx | 2 +- src/RENUMBER/RENUMBER_Renumbering.hxx | 4 +- src/RENUMBER/renumbering.cxx | 26 +- src/RENUMBER_Swig/CMakeLists.txt | 7 + src/RENUMBER_Swig/MEDRenumber.i | 168 +- src/RENUMBER_Swig/MEDRenumberImpl.i | 8 +- 400 files changed, 25300 insertions(+), 23110 deletions(-) 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/InterpolationPlanar.hxx mode change 100644 => 100755 src/INTERP_KERNEL/InterpolationPlanar.txx create mode 100644 src/INTERP_KERNEL/MCIdType.hxx 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/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 create mode 100644 src/MEDCoupling_Swig/DataArrayInt.i create mode 100644 src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py create mode 100644 src/ParaMEDMEM/ParaIdType.hxx diff --git a/MEDCouplingConfig.cmake.in b/MEDCouplingConfig.cmake.in index f691656a1..42f18a4fe 100644 --- a/MEDCouplingConfig.cmake.in +++ b/MEDCouplingConfig.cmake.in @@ -54,6 +54,7 @@ SET(MEDCOUPLING_USE_MPI @MEDCOUPLING_USE_MPI@) SET(MEDCOUPLING_BUILD_DOC @MEDCOUPLING_BUILD_DOC@) SET(MEDCOUPLING_BUILD_TESTS @MEDCOUPLING_BUILD_TESTS@) SET(MEDCOUPLING_BUILD_GUI @MEDCOUPLING_BUILD_GUI@) +SET(MEDCOUPLING_USE_64BIT_IDS @MEDCOUPLING_USE_64BIT_IDS@) # Advanced options diff --git a/src/INTERP_KERNEL/BBTree.txx b/src/INTERP_KERNEL/BBTree.txx index b49c93268..c312a646b 100644 --- a/src/INTERP_KERNEL/BBTree.txx +++ b/src/INTERP_KERNEL/BBTree.txx @@ -101,9 +101,9 @@ public: new_elems_right.reserve(nbelems/2+1); double max_left = -std::numeric_limits::max(); double min_right= std::numeric_limits::max(); - for (int i=0; isize()+_right->size(); diff --git a/src/INTERP_KERNEL/BBTreeDst.txx b/src/INTERP_KERNEL/BBTreeDst.txx old mode 100644 new mode 100755 index 70753ded3..3862e1b4b --- a/src/INTERP_KERNEL/BBTreeDst.txx +++ b/src/INTERP_KERNEL/BBTreeDst.txx @@ -38,20 +38,20 @@ private: double _max_left; double _min_right; const double *_bb; - std::vector _elems; + std::vector _elems; double *_terminal; - int _nbelems; + mcIdType _nbelems; static const int MIN_NB_ELEMS=15; static const int MAX_LEVEL=20; public: - BBTreeDst(const double* bbs, int* elems, int level, int nbelems): + BBTreeDst(const double* bbs, mcIdType* elems, int level, mcIdType 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]; _elems.resize(nbelems); - for (int i=0; i(nodes, nodes+nbelems/2, nodes+nbelems); double median = *(nodes+nbelems/2); delete [] nodes; - std::vector new_elems_left; - std::vector new_elems_right; + std::vector new_elems_left; + std::vector new_elems_right; new_elems_left.reserve(nbelems/2+1); new_elems_right.reserve(nbelems/2+1); double max_left = -std::numeric_limits::max(); double min_right= std::numeric_limits::max(); - for(int i=0; i& elems) const + void getElemsWhoseMinDistanceToPtSmallerThan(const double *pt, double minOfMaxDstsSq, std::vector& elems) const { if(_terminal) { - for(int i=0; i<_nbelems; i++) + for(mcIdType i=0; i<_nbelems; i++) { if(GetMinDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt)minOfMaxDstsSq)//min it is not a bug return ; - for(int i=0; i<_nbelems; i++) + for(mcIdType i=0; i<_nbelems; i++) { minOfMaxDstsSq=std::min(minOfMaxDstsSq,GetMaxDistanceFromBBoxToPt(_bb+_elems[i]*2*dim,pt)); } @@ -168,7 +168,7 @@ public: _terminal[2*j]=std::numeric_limits::max(); _terminal[2*j+1]=-std::numeric_limits::max(); } - for(int i=0;i<_nbelems;i++) + for(mcIdType i=0;i<_nbelems;i++) { for(int j=0;j((( (0.::max(); double min_right= std::numeric_limits::max(); - for(int i=0;igetElementsAroundPoint2(xx,threshold,elem); if(xx[_level%dim]-s>_max_left) return _right->getElementsAroundPoint2(xx,threshold,elem); - int eleml,elemr; + ConnType eleml,elemr; double retl=_left->getElementsAroundPoint2(xx,threshold,eleml); double retr=_right->getElementsAroundPoint2(xx,threshold,elemr); if(retlgetElementsAroundPoint(xx,elems); } - int size() const + ConnType size() const { if(_terminal) return _nbelems; diff --git a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx index 6b0bdf5cf..e8d227ed4 100644 --- a/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/Barycentric3DIntersectorP1P1.txx @@ -56,9 +56,9 @@ namespace INTERP_KERNEL std::vector CoordsT; const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if(!resRow.empty()) @@ -72,7 +72,7 @@ namespace INTERP_KERNEL // std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx index 72938a4ef..860dd3f9a 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelHashTable.hxx @@ -195,22 +195,22 @@ namespace INTERP_KERNEL // Note: assumes long is at least 32 bits. enum { _S_num_primes = 28 }; - static const unsigned long __stl_prime_list[_S_num_primes] = + static const unsigned long long __stl_prime_list[_S_num_primes] = { - 53ul, 97ul, 193ul, 389ul, 769ul, - 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, - 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, - 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, - 1610612741ul, 3221225473ul, 4294967291ul + 53ull, 97ull, 193ull, 389ull, 769ull, + 1543ull, 3079ull, 6151ull, 12289ull, 24593ull, + 49157ull, 98317ull, 196613ull, 393241ull, 786433ull, + 1572869ull, 3145739ull, 6291469ull, 12582917ull, 25165843ull, + 50331653ull, 100663319ull, 201326611ull, 402653189ull, 805306457ull, + 1610612741ull, 3221225473ull, 4294967291ull }; - inline unsigned long - __stl_next_prime(unsigned long __n) + inline unsigned long long + __stl_next_prime(unsigned long long __n) { - const unsigned long* __first = __stl_prime_list; - const unsigned long* __last = __stl_prime_list + (int)_S_num_primes; - const unsigned long* pos = std::lower_bound(__first, __last, __n); + const unsigned long long* __first = __stl_prime_list; + const unsigned long long* __last = __stl_prime_list + (int)_S_num_primes; + const unsigned long long* pos = std::lower_bound(__first, __last, __n); return pos == __last ? *(__last - 1) : *pos; } @@ -497,7 +497,7 @@ namespace INTERP_KERNEL void clear(); private: - size_type _M_next_size(size_type __n) const { return __stl_next_prime(__n); } + size_type _M_next_size(size_type __n) const { return static_cast(__stl_next_prime(__n)); } void _M_initialize_buckets(size_type __n) { diff --git a/src/INTERP_KERNEL/CMakeLists.txt b/src/INTERP_KERNEL/CMakeLists.txt index 4b70eceba..6cf3b22ba 100644 --- a/src/INTERP_KERNEL/CMakeLists.txt +++ b/src/INTERP_KERNEL/CMakeLists.txt @@ -72,6 +72,10 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/GaussPoints ) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET(PLATFORM_MMAP) IF(NOT WIN32) SET(PLATFORM_MMAP "-D_POSIX_MAPPED_FILES") diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 585675205..cf71d3a61 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -449,29 +449,29 @@ namespace INTERP_KERNEL /*! * Equivalent to getNumberOfSons except that this method deals with dynamic type. */ - unsigned CellModel::getNumberOfSons2(const int *conn, int lgth) const + unsigned CellModel::getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfSons(); if(_dim==2) { if(_type==NORM_POLYGON) - return lgth; + return FromIdType(lgth); else - return lgth/2; + return FromIdType(lgth/2); } else if(_dim==1) - return lgth;//NORM_POLYL + return FromIdType(lgth);//NORM_POLYL else - return std::count(conn,conn+lgth,-1)+1; + return (unsigned)std::count(conn,conn+lgth,-1)+1; } - unsigned CellModel::getNumberOfEdgesIn3D(const int *conn, int lgth) const + unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return _nb_of_little_sons; else//polyhedron - return (lgth-std::count(conn,conn+lgth,-1))/2; + return FromIdType(lgth-ToIdType(std::count(conn,conn+lgth,-1)/2)); } /*! @@ -549,7 +549,7 @@ namespace INTERP_KERNEL /*! * \b WARNING this method do not manage correctly types that return true at the call of isDynamic. Use fillSonCellNodalConnectivity2 instead. */ - unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const + unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const { unsigned nbOfTurnLoop=_nb_of_sons_con[sonId]; const unsigned *sonConn=_sons_con[sonId]; @@ -558,7 +558,7 @@ namespace INTERP_KERNEL return nbOfTurnLoop; } - unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { typeOfSon=getSonType2(sonId); if(!isDynamic()) @@ -583,15 +583,15 @@ namespace INTERP_KERNEL } else if(_dim==3) {//polyedron - const int *where=nodalConn; + const mcIdType *where=nodalConn; for(int i=0;iHEXA27 */ - unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(_type==NORM_HEXA8) { @@ -612,7 +612,7 @@ namespace INTERP_KERNEL return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); } - unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(!isDynamic()) { @@ -639,7 +639,7 @@ namespace INTERP_KERNEL /*! * \sa getNumberOfMicroEdges */ - unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(isQuadratic()) { @@ -680,20 +680,20 @@ namespace INTERP_KERNEL } } - void CellModel::changeOrientationOf2D(int *nodalConn, unsigned int sz) const + void CellModel::changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const { if(sz<1) return ; if(!isQuadratic()) { - std::vector tmp(sz-1); + std::vector tmp(sz-1); std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); std::copy(tmp.begin(),tmp.end(),nodalConn+1); } else { unsigned int sz2(sz/2); - std::vector tmp0(sz2-1),tmp1(sz2); + std::vector tmp0(sz2-1),tmp1(sz2); std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin()); std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin()); std::copy(tmp0.begin(),tmp0.end(),nodalConn+1); @@ -701,7 +701,7 @@ namespace INTERP_KERNEL } } - void CellModel::changeOrientationOf1D(int *nodalConn, unsigned int sz) const + void CellModel::changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const { if(!isDynamic()) { @@ -720,7 +720,7 @@ namespace INTERP_KERNEL } else { - std::vector tmp(sz-1); + std::vector tmp(sz-1); std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); std::copy(tmp.begin(),tmp.end(),nodalConn+1); } @@ -732,7 +732,7 @@ namespace INTERP_KERNEL */ //================================================================================ - unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const + unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfNodesConstituentTheSon(sonId); @@ -746,14 +746,14 @@ namespace INTERP_KERNEL } else if(_dim==3) {//polyedron - const int *where=nodalConn; + const mcIdType *where=nodalConn; for(unsigned int i=0;i tmp(2*lgth); - std::vector::iterator it=std::copy(conn1,conn1+lgth,tmp.begin()); + std::vector tmp(2*lgth); + 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; - std::vector::reverse_iterator 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 !"); @@ -788,11 +788,11 @@ namespace INTERP_KERNEL { if(_dim!=1) { - std::vector tmp(lgth); - std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); + std::vector tmp(lgth); + 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); - int 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()); @@ -800,17 +800,17 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.end()) return false; - int d2=std::distance(tmp.begin(),it); + std::size_t d2=std::distance(tmp.begin(),it); return d==d2; } else { - int p=(lgth+1)/2; - std::vector tmp(2*p); - std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); + mcIdType p=(lgth+1)/2; + std::vector tmp(2*p); + 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); - int 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); @@ -819,7 +819,7 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); if(it==tmp.end()) return false; - int 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 4300b4327..369791950 100644 --- a/src/INTERP_KERNEL/CellModel.hxx +++ b/src/INTERP_KERNEL/CellModel.hxx @@ -24,6 +24,7 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "MCIdType.hxx" #include @@ -57,14 +58,14 @@ namespace INTERP_KERNEL //! sonId is in C format. INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sons_con[sonId]; } INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheLittleSon(unsigned littleSonId) const { return _little_sons_con[littleSonId]; } - INTERPKERNEL_EXPORT bool getOrientationStatus(unsigned lgth, const int *conn1, const int *conn2) const; + INTERPKERNEL_EXPORT bool getOrientationStatus(mcIdType lgth, const mcIdType *conn1, const mcIdType *conn2) const; INTERPKERNEL_EXPORT unsigned getNumberOfNodes() const { return _nb_of_pts; } INTERPKERNEL_EXPORT unsigned getNumberOfSons() const { return _nb_of_sons; } - INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const int *conn, int lgth) const; - INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const int *conn, int lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const; INTERPKERNEL_EXPORT unsigned getNumberOfMicroEdges() const; INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; } - INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const; + INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const; INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; } INTERPKERNEL_EXPORT NormalizedCellType getCorrespondingPolyType() const; INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; } @@ -73,13 +74,13 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT NormalizedCellType getQuadraticType2() const { return _quadratic_type2; } INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; } INTERPKERNEL_EXPORT NormalizedCellType getSonType2(unsigned sonId) const; - INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const; - INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const; - INTERPKERNEL_EXPORT void changeOrientationOf2D(int *nodalConn, unsigned int sz) const; - INTERPKERNEL_EXPORT void changeOrientationOf1D(int *nodalConn, unsigned int sz) const; + INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const; + INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT unsigned fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT void changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const; + INTERPKERNEL_EXPORT void changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const; INTERPKERNEL_EXPORT DiameterCalculator *buildInstanceOfDiameterCalulator(int spaceDim) const; INTERPKERNEL_EXPORT OrientationInverter *buildOrientationInverter() const; private: diff --git a/src/INTERP_KERNEL/ConvexIntersector.txx b/src/INTERP_KERNEL/ConvexIntersector.txx index 98e30ec7a..3331675a3 100644 --- a/src/INTERP_KERNEL/ConvexIntersector.txx +++ b/src/INTERP_KERNEL/ConvexIntersector.txx @@ -68,7 +68,7 @@ namespace INTERP_KERNEL /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&CoordsT[0], &CoordsS[0], - CoordsT.size()/SPACEDIM, CoordsS.size()/SPACEDIM); + int(CoordsT.size())/SPACEDIM, int(CoordsS.size())/SPACEDIM); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(quadrangle, &sourceCoords[0], - 4, nbOfNodesS); + 4, nbOfNodesS); double area[SPACEDIM]; int nb_inter =((int)inter.size())/SPACEDIM; for(int i = 1; i& sourceCoords) { double result = 0; - int nbOfNodesS=sourceCoords.size()/SPACEDIM; - int nbOfNodesT=targetCoords.size()/SPACEDIM; + int nbOfNodesS=int(sourceCoords.size())/SPACEDIM; + int nbOfNodesT=int(targetCoords.size())/SPACEDIM; /*** Compute the intersection area ***/ INTERP_KERNEL::PolygonAlgorithms P(_epsilon, PlanarIntersector::_precision); std::deque inter = P.intersectConvexPolygons(&targetCoords[0], &sourceCoords[0], diff --git a/src/INTERP_KERNEL/CurveIntersector.hxx b/src/INTERP_KERNEL/CurveIntersector.hxx index dfa03a4b9..339343820 100644 --- a/src/INTERP_KERNEL/CurveIntersector.hxx +++ b/src/INTERP_KERNEL/CurveIntersector.hxx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL struct TDualSegment { std::vector _coords; - int _nodeId; // in mesh mode + ConnType _nodeId; // in mesh mode }; static void getDualSegments(ConnType icell, const MyMeshType& mesh, diff --git a/src/INTERP_KERNEL/CurveIntersector.txx b/src/INTERP_KERNEL/CurveIntersector.txx index 81d54f386..50df7a994 100644 --- a/src/INTERP_KERNEL/CurveIntersector.txx +++ b/src/INTERP_KERNEL/CurveIntersector.txx @@ -77,7 +77,7 @@ namespace INTERP_KERNEL int ibox=0; for(long icell=0; icell::max(); } //updating the bounding box with each node of the element - for (int j=0; j @@ -159,8 +159,8 @@ namespace INTERP_KERNEL void CurveIntersector::adjustBoundingBoxes (std::vector& bbox, double adjustmentEpsAbs) { - long size = bbox.size()/(2*SPACEDIM); - for (int i=0; i bool CurveIntersector::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) const { - int nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); + ConnType nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iT=0; iT typename MyMeshType::MyConnType CurveIntersector::getNodeIdOfTargetCellAt(ConnType icellT, ConnType nodeIdInCellT) const { - int nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); + ConnType nbNodesT(_connIndexT[OTT::ind2C(icellT)+1] - _connIndexT[OTT::ind2C(icellT)]); if(nodeIdInCellT>=0 && nodeIdInCellT::coo2C(_connectT[OTT::conn2C(_connIndexT[OTT::ind2C(icellT)]+nodeIdInCellT)]); else @@ -218,7 +218,7 @@ namespace INTERP_KERNEL template bool CurveIntersector::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) const { - int nbNodesS = _connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS = _connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for(ConnType iS=0; iS typename MyMeshType::MyConnType CurveIntersector::getNodeIdOfSourceCellAt(ConnType icellS, ConnType nodeIdInCellS) const { - int nbNodesS(_connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]); + ConnType nbNodesS(_connIndexS[OTT::ind2C(icellS)+1] - _connIndexS[OTT::ind2C(icellS)]); if(nodeIdInCellS>=0 && nodeIdInCellS::coo2C(_connectS[OTT::conn2C(_connIndexS[OTT::ind2C(icellS)]+nodeIdInCellS)]); else @@ -259,9 +259,9 @@ namespace INTERP_KERNEL std::vector& segments) { // get coordinates of cell nodes - int nbNodes; - std::vector ncoords; - std::vector nodeIds; + ConnType nbNodes; + std::vector ncoords; + std::vector nodeIds; { const ConnType *connect = mesh.getConnectivityPtr(); const ConnType *connIndex = mesh.getConnectivityIndexPtr(); @@ -272,7 +272,7 @@ namespace INTERP_KERNEL ncoords.resize(SPACEDIM*nbNodes); nodeIds.resize(nbNodes); - for(int i=0; i::conn2C(connIndex[OTT::ind2C(icell)]+i)]; @@ -289,7 +289,7 @@ namespace INTERP_KERNEL // fill segments segments.clear(); segments.reserve( 2*nbNodes ); - for(int i=0; i& icellsS, MyMatrix& res); }; diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P0.txx b/src/INTERP_KERNEL/CurveIntersectorP0P0.txx index 54cdc5b5c..45d5522ea 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P0.txx @@ -37,14 +37,14 @@ namespace INTERP_KERNEL } template - int CurveIntersectorP0P0 + typename MyMeshType::MyConnType CurveIntersectorP0P0 ::getNumberOfRowsOfResMatrix() const { return BASE_INTERSECTOR::_meshT.getNumberOfElements(); } template - int CurveIntersectorP0P0 + typename MyMeshType::MyConnType CurveIntersectorP0P0 ::getNumberOfColsOfResMatrix() const { return BASE_INTERSECTOR::_meshS.getNumberOfElements(); @@ -56,14 +56,14 @@ namespace INTERP_KERNEL { typename MyMatrix::value_type& resRow = res[icellT]; std::vector coordsT; - int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT); + ConnType t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT); for ( t = 0; t < nbSegT; ++t ) for(typename std::vector::const_iterator iter=icellsS.begin(); iter!=icellsS.end(); iter++) { - int iS = *iter; + ConnType iS = *iter; std::vector coordsS; - int s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS); + ConnType s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS); for ( s = 0; s < nbSegS; ++s ) { double surf = BASE_INTERSECTOR::intersectSegments(&coordsT[0] + t*SPACEDIM, diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx b/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx index 0f3145cb9..e2f88f726 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P1.hxx @@ -40,8 +40,8 @@ namespace INTERP_KERNEL public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/CurveIntersectorP0P1.txx b/src/INTERP_KERNEL/CurveIntersectorP0P1.txx index 7173c55e6..51960280e 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP0P1.txx @@ -37,14 +37,14 @@ namespace INTERP_KERNEL } template - int CurveIntersectorP0P1 + typename MyMeshType::MyConnType CurveIntersectorP0P1 ::getNumberOfRowsOfResMatrix() const { return BASE_INTERSECTOR::_meshT.getNumberOfNodes(); } template - int CurveIntersectorP0P1 + typename MyMeshType::MyConnType CurveIntersectorP0P1 ::getNumberOfColsOfResMatrix() const { return BASE_INTERSECTOR::_meshS.getNumberOfElements(); @@ -62,15 +62,15 @@ namespace INTERP_KERNEL { std::vector segmentsT; BASE_INTERSECTOR::getDualSegments( icellT, BASE_INTERSECTOR::_meshT, segmentsT); - for ( int t = 0; t < (int)segmentsT.size(); ++t ) + for ( ConnType t = 0; t < (ConnType)segmentsT.size(); ++t ) { typename MyMatrix::value_type& resRow = res[ OTT::ind2C( segmentsT[t]._nodeId )]; for(typename std::vector::const_iterator iter=icellsS.begin(); iter!=icellsS.end(); iter++) { - int iS = *iter; + ConnType iS = *iter; std::vector coordsS; - int s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS); + ConnType s, nbSegS = 1 + BASE_INTERSECTOR::getRealSourceCoordinates(iS,coordsS); for ( s = 0; s < nbSegS; ++s ) { double surf = BASE_INTERSECTOR::intersectSegments(&segmentsT[t]._coords[0], diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx index 76844461f..d52eec2dd 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P0.hxx @@ -38,8 +38,8 @@ namespace INTERP_KERNEL double precision, double tolerance, double medianLine, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P0.txx b/src/INTERP_KERNEL/CurveIntersectorP1P0.txx index 831d80718..a5bfe0fcb 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P0.txx @@ -37,14 +37,14 @@ namespace INTERP_KERNEL } template - int CurveIntersectorP1P0 + typename MyMeshType::MyConnType CurveIntersectorP1P0 ::getNumberOfRowsOfResMatrix() const { return BASE_INTERSECTOR::_meshT.getNumberOfElements(); } template - int CurveIntersectorP1P0 + typename MyMeshType::MyConnType CurveIntersectorP1P0 ::getNumberOfColsOfResMatrix() const { return BASE_INTERSECTOR::_meshS.getNumberOfNodes(); @@ -63,21 +63,21 @@ namespace INTERP_KERNEL typename MyMatrix::value_type& resRow = res[ icellT ]; std::vector segmentsS; std::vector coordsT; - int t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT); + ConnType t, nbSegT = 1 + BASE_INTERSECTOR::getRealTargetCoordinates(icellT,coordsT); for ( t = 0; t < nbSegT; ++t ) for(typename std::vector::const_iterator iter=icellsS.begin(); iter!=icellsS.end(); iter++) { - int iS = *iter; + ConnType iS = *iter; BASE_INTERSECTOR::getDualSegments( OTT::ind2C(iS), BASE_INTERSECTOR::_meshS, segmentsS); - for ( int s = 0; s < (int)segmentsS.size(); ++s ) + for ( ConnType s = 0; s < (ConnType)segmentsS.size(); ++s ) { double surf = BASE_INTERSECTOR::intersectSegments(&segmentsS[s]._coords[0], &coordsT[0] + t*SPACEDIM); if(surf!=0.) { - int nS = segmentsS[s]._nodeId; + ConnType nS = segmentsS[s]._nodeId; typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS); if(iterRes==resRow.end()) resRow.insert(std::make_pair(nS,surf)); diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx index de086bb4d..106d85297 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1.hxx @@ -40,8 +40,8 @@ namespace INTERP_KERNEL public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1.txx b/src/INTERP_KERNEL/CurveIntersectorP1P1.txx index d63d34aae..dd91ee5f2 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1.txx @@ -37,14 +37,14 @@ namespace INTERP_KERNEL } template - int CurveIntersectorP1P1 + typename MyMeshType::MyConnType CurveIntersectorP1P1 ::getNumberOfRowsOfResMatrix() const { return BASE_INTERSECTOR::_meshT.getNumberOfNodes(); } template - int CurveIntersectorP1P1 + typename MyMeshType::MyConnType CurveIntersectorP1P1 ::getNumberOfColsOfResMatrix() const { return BASE_INTERSECTOR::_meshS.getNumberOfNodes(); @@ -56,22 +56,22 @@ namespace INTERP_KERNEL { std::vector segmentsT, segmentsS; BASE_INTERSECTOR::getDualSegments( icellT, BASE_INTERSECTOR::_meshT, segmentsT); - for ( int t = 0; t < (int)segmentsT.size(); ++t ) + for ( ConnType t = 0; t < (ConnType)segmentsT.size(); ++t ) { typename MyMatrix::value_type& resRow = res[ OTT::ind2C( segmentsT[t]._nodeId )]; for(typename std::vector::const_iterator iter=icellsS.begin(); iter!=icellsS.end(); iter++) { - int iS = *iter; + ConnType iS = *iter; BASE_INTERSECTOR::getDualSegments( OTT::ind2C(iS), BASE_INTERSECTOR::_meshS, segmentsS); - for ( int s = 0; s < (int)segmentsS.size(); ++s ) + for ( ConnType s = 0; s < (ConnType)segmentsS.size(); ++s ) { double surf = BASE_INTERSECTOR::intersectSegments(&segmentsT[t]._coords[0], &segmentsS[s]._coords[0]); if(surf!=0.) { - int nS = segmentsS[s]._nodeId; + ConnType nS = segmentsS[s]._nodeId; typename MyMatrix::value_type::const_iterator iterRes=resRow.find(nS); if(iterRes==resRow.end()) resRow.insert(std::make_pair(nS,surf)); diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx index 16104ab5e..a3fb45ea0 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.hxx @@ -39,8 +39,8 @@ namespace INTERP_KERNEL double medianLine, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; private: static void AppendValueInMatrix(MyMatrix& res, ConnType nodeIdT, ConnType nodeIdS0, double val0, ConnType nodeIdS1, double val1); static void AppendValueInMatrix2(typename MyMatrix::value_type& resRow, ConnType nodeIdS0, double val0); diff --git a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx index 60bdd97e6..e9bd3e5c2 100644 --- a/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/CurveIntersectorP1P1PL.txx @@ -34,13 +34,13 @@ namespace INTERP_KERNEL } template - int CurveIntersectorP1P1PL::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType CurveIntersectorP1P1PL::getNumberOfRowsOfResMatrix() const { return CurveIntersector::_meshT.getNumberOfNodes(); } template - int CurveIntersectorP1P1PL::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType CurveIntersectorP1P1PL::getNumberOfColsOfResMatrix() const { return CurveIntersector::_meshS.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/DiameterCalculator.cxx b/src/INTERP_KERNEL/DiameterCalculator.cxx index 09eb07ce8..1ea15692c 100644 --- a/src/INTERP_KERNEL/DiameterCalculator.cxx +++ b/src/INTERP_KERNEL/DiameterCalculator.cxx @@ -94,14 +94,14 @@ inline void DiffV3(const double a[3], const double b[3], double c[3]) } template -void ComputeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) +void ComputeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; NormalizedCellType ct(Evaluator::TYPE); int cti((int) ct); - for(const int *it=bgIds;it!=endIds;it++) + for(const mcIdType *it=bgIds;it!=endIds;it++) { - int offset(indPtr[*it]); + mcIdType offset(indPtr[*it]); if(connPtr[offset]==cti) resPtr[*it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr); else @@ -113,14 +113,14 @@ void ComputeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const } template -void ComputeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) +void ComputeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; NormalizedCellType ct(Evaluator::TYPE); int cti((int) ct); - for(int it=bgId;it -void ComputeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) +void ComputeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) { Evaluator evtor; NormalizedCellType ct(Evaluator::TYPE); const CellModel& cm(CellModel::GetCellModel(ct)); unsigned nbNodes(cm.getNumberOfNodes()); - const int *ptr(connPtr); - for(int i=0;i(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI3S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI3S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI3S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI3S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==3) { @@ -196,24 +196,24 @@ double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTRI3S2::ComputeForOneCellInternal : input connectivity must be of size 3 !"); } -void DiameterCalulatorTRI3S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI3S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI3S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI3S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI3S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI3S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==6) return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr); @@ -221,24 +221,24 @@ double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTRI6S2::ComputeForOneCellInternal : input connectivity must be of size 6 !"); } -void DiameterCalulatorTRI6S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI6S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI6S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==6) return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr); @@ -246,24 +246,24 @@ double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTRI6S3::ComputeForOneCellInternal : input connectivity must be of size 6 !"); } -void DiameterCalulatorTRI6S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI6S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI6S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI6S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==7) return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr); @@ -271,24 +271,24 @@ double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTRI7S2::ComputeForOneCellInternal : input connectivity must be of size 7 !"); } -void DiameterCalulatorTRI7S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI7S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI7S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==7) return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr); @@ -296,24 +296,24 @@ double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTRI7S3::ComputeForOneCellInternal : input connectivity must be of size 7 !"); } -void DiameterCalulatorTRI7S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI7S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTRI7S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTRI7S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -327,24 +327,24 @@ double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD4S2::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } -void DiameterCalulatorQUAD4S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD4S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD4S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -358,24 +358,24 @@ double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD4S3::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } -void DiameterCalulatorQUAD4S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD4S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD4S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD4S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==8) return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr); @@ -383,24 +383,24 @@ double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD8S2::ComputeForOneCellInternal : input connectivity must be of size 8 !"); } -void DiameterCalulatorQUAD8S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD8S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD8S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==8) return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr); @@ -408,24 +408,24 @@ double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 8 !"); } -void DiameterCalulatorQUAD8S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD8S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD8S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD8S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==9) return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr); @@ -433,24 +433,24 @@ double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD9S2::ComputeForOneCellInternal : input connectivity must be of size 9 !"); } -void DiameterCalulatorQUAD9S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S2::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD9S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S2::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD9S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S2::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==9) return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr); @@ -458,24 +458,24 @@ double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 9 !"); } -void DiameterCalulatorQUAD9S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S3::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD9S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S3::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorQUAD9S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorQUAD9S3::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -495,24 +495,24 @@ double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorTETRA4::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } -void DiameterCalulatorTETRA4::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA4::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTETRA4::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA4::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTETRA4::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA4::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==10) return DiameterCalulatorTETRA4::ComputeForOneCellInternal(bg,bg+4,coordsPtr); @@ -520,24 +520,24 @@ double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorTETRA10::ComputeForOneCellInternal : input connectivity must be of size 10 !"); } -void DiameterCalulatorTETRA10::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA10::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTETRA10::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA10::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorTETRA10::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorTETRA10::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==8) { @@ -555,24 +555,24 @@ double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const int *bg, const in throw Exception("DiameterCalulatorHEXA8::ComputeForOneCellInternal : input connectivity must be of size 8 !"); } -void DiameterCalulatorHEXA8::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA8::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA8::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA8::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA8::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA8::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==20) return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr); @@ -580,24 +580,24 @@ double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorHEXA20::ComputeForOneCellInternal : input connectivity must be of size 20 !"); } -void DiameterCalulatorHEXA20::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA20::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA20::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA20::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA20::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA20::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==27) return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr); @@ -605,24 +605,24 @@ double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorHEXA27::ComputeForOneCellInternal : input connectivity must be of size 27 !"); } -void DiameterCalulatorHEXA27::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA27::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA27::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA27::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorHEXA27::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorHEXA27::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==6) { @@ -642,24 +642,24 @@ double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorPENTA6::ComputeForOneCellInternal : input connectivity must be of size 6 !"); } -void DiameterCalulatorPENTA6::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA6::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPENTA6::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA6::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPENTA6::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA6::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==15) return DiameterCalulatorPENTA6::ComputeForOneCellInternal(bg,bg+6,coordsPtr); @@ -667,24 +667,24 @@ double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const int *bg, const throw Exception("DiameterCalulatorPENTA15::ComputeForOneCellInternal : input connectivity must be of size 15 !"); } -void DiameterCalulatorPENTA15::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA15::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPENTA15::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA15::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPENTA15::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPENTA15::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==5) { @@ -704,24 +704,24 @@ double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const int *bg, const in throw Exception("DiameterCalulatorPYRA5::ComputeForOneCellInternal : input connectivity must be of size 5 !"); } -void DiameterCalulatorPYRA5::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA5::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPYRA5::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA5::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPYRA5::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA5::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } //================================================================= -double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) { if(std::distance(bg,endd)==13) return DiameterCalulatorPYRA5::ComputeForOneCellInternal(bg,bg+5,coordsPtr); @@ -729,17 +729,17 @@ double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const int *bg, const i throw Exception("DiameterCalulatorPYRA13::ComputeForOneCellInternal : input connectivity must be of size 13 !"); } -void DiameterCalulatorPYRA13::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA13::computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPYRA13::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA13::computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); } -void DiameterCalulatorPYRA13::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +void DiameterCalulatorPYRA13::computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } diff --git a/src/INTERP_KERNEL/DiameterCalculator.hxx b/src/INTERP_KERNEL/DiameterCalculator.hxx index 939e85f8b..1c08dbd19 100644 --- a/src/INTERP_KERNEL/DiameterCalculator.hxx +++ b/src/INTERP_KERNEL/DiameterCalculator.hxx @@ -24,6 +24,7 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedGeometricTypes" +#include "MCIdType.hxx" namespace INTERP_KERNEL { @@ -32,21 +33,21 @@ namespace INTERP_KERNEL public: INTERPKERNEL_EXPORT virtual ~DiameterCalculator() { } INTERPKERNEL_EXPORT virtual NormalizedCellType getType() const = 0; - INTERPKERNEL_EXPORT virtual double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const = 0; - INTERPKERNEL_EXPORT virtual void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0; - INTERPKERNEL_EXPORT virtual void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0; - INTERPKERNEL_EXPORT virtual void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const = 0; + INTERPKERNEL_EXPORT virtual double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const = 0; + INTERPKERNEL_EXPORT virtual void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0; + INTERPKERNEL_EXPORT virtual void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0; + INTERPKERNEL_EXPORT virtual void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const = 0; }; class DiameterCalulatorTRI3S2 : public DiameterCalculator { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -55,11 +56,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -68,11 +69,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -81,11 +82,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -94,11 +95,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -107,11 +108,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -120,11 +121,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -133,11 +134,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -146,11 +147,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -159,11 +160,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -172,11 +173,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -185,11 +186,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -198,11 +199,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -211,11 +212,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -224,11 +225,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -237,11 +238,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -250,11 +251,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -263,11 +264,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -276,11 +277,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -289,11 +290,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; @@ -302,11 +303,11 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } - static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); - void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; - void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + double computeForOneCell(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const mcIdType *bg, const mcIdType *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const mcIdType *bgIds, const mcIdType *endIds, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(mcIdType bgId, mcIdType endId, const mcIdType *indPtr, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(mcIdType nbOfCells, const mcIdType *connPtr, const double *coordsPtr, double *resPtr) const; public: static NormalizedCellType TYPE; }; diff --git a/src/INTERP_KERNEL/DirectedBoundingBox.cxx b/src/INTERP_KERNEL/DirectedBoundingBox.cxx index 8c06642f9..3fdf8ce06 100644 --- a/src/INTERP_KERNEL/DirectedBoundingBox.cxx +++ b/src/INTERP_KERNEL/DirectedBoundingBox.cxx @@ -617,7 +617,7 @@ namespace INTERP_KERNEL getCorners( corners, &cornerBox->_minmax[0] ); double globCorner[3]; - for ( int iC = 0, nC = corners.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = corners.size()/_dim; iC < nC; ++iC) { cornerBox->fromLocalCS( &corners[iC*_dim], globCorner ); mmBox.addPointToBox( globCorner ); @@ -649,7 +649,7 @@ namespace INTERP_KERNEL getCorners( cornersOther, box ); DirectedBoundingBox mmBox((double*)0,0,_dim); //!< empty box with CS == this->_axes mmBox._axes = this->_axes; - for ( int iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = cornersOther.size()/_dim; iC < nC; ++iC) mmBox.addPointToBox( &cornersOther[iC*_dim] ); if ( isMinMaxOut( &mmBox._minmax[0], &this->_minmax[0], _dim )) @@ -662,7 +662,7 @@ namespace INTERP_KERNEL getCorners( cornersThis, &_minmax[0] ); DirectedBoundingBox mmBox((double*)0,0,_dim); //!< initailized _minmax double globCorner[3]; - for ( int iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC) + for ( std::size_t iC = 0, nC = cornersThis.size()/_dim; iC < nC; ++iC) { fromLocalCS( &cornersThis[iC*_dim], globCorner ); for ( int i = 0; i < (int)_dim; ++i ) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx index d040be703..794c664db 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelAsmX86.cxx @@ -45,7 +45,7 @@ std::vector INTERP_KERNEL::AsmX86::convertIntoMachineLangage(const std::ve char *INTERP_KERNEL::AsmX86::copyToExecMemZone(const std::vector& ml, unsigned& offset) const { char *ret=0; - int lgth=ml.size(); + 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); @@ -492,7 +492,7 @@ void INTERP_KERNEL::AsmX86::appendAddress(const std::string& addr, int nbOfByte, for(int k=0;k>=8; } diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx index ab5e989d9..ab5a4a79b 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx @@ -233,7 +233,8 @@ void DecompositionInUnitBase::tryToConvertInUnit(double val) DecompositionInUnitBase &DecompositionInUnitBase::operator*(const DecompositionInUnitBase& other) { - _value[0]+=other._value[0]; _value[1]+=other._value[1]; _value[2]+=other._value[2]; _value[3]+=other._value[3]; _value[4]+=other._value[4]; + // += causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]' + _value[0]=(short)(_value[0]+other._value[0]); _value[1]=(short)(_value[1]+other._value[1]); _value[2]=(short)(_value[2]+other._value[2]); _value[3]=(short)(_value[3]+other._value[3]); _value[4]=(short)(_value[4]+other._value[4]); _mult_fact_to_base*=other._mult_fact_to_base; _add_to_base=0.; return *this; @@ -241,7 +242,8 @@ DecompositionInUnitBase &DecompositionInUnitBase::operator*(const DecompositionI DecompositionInUnitBase &DecompositionInUnitBase::operator/(const DecompositionInUnitBase& other) { - _value[0]-=other._value[0]; _value[1]-=other._value[1]; _value[2]-=other._value[2]; _value[3]-=other._value[3]; _value[4]-=other._value[4]; + // -= causes ' conversion to 'short int' from 'int' may alter its value [-Wconversion]' + _value[0]=(short)(_value[0]-other._value[0]); _value[1]=(short)(_value[1]-other._value[1]); _value[2]=(short)(_value[2]-other._value[2]); _value[3]=(short)(_value[3]-other._value[3]); _value[4]=(short)(_value[4]-other._value[4]); _mult_fact_to_base/=other._mult_fact_to_base; _add_to_base=0.; return *this; @@ -252,7 +254,8 @@ DecompositionInUnitBase &DecompositionInUnitBase::operator^(const DecompositionI if(!other.isAdimensional()) throw INTERP_KERNEL::Exception("Trying to execute operator ^ with a second member not adimensionnal"); int exp=couldItBeConsideredAsInt(other._mult_fact_to_base); - _value[0]*=exp; _value[1]*=exp; _value[2]*=exp; _value[3]*=exp; _value[4]*=exp; + // *= 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); _add_to_base=0.; return *this; diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx index 2f3ad3ff3..42adbc54c 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx @@ -172,7 +172,7 @@ int GaussInfo::getGaussCoordDim() const { if( _my_nb_gauss ) { - return _my_gauss_coord.size()/_my_nb_gauss; + return (int)_my_gauss_coord.size()/_my_nb_gauss; } else { @@ -187,7 +187,7 @@ int GaussInfo::getReferenceCoordDim() const { if( _my_nb_ref ) { - return _my_reference_coord.size()/_my_nb_ref; + return (int)(_my_reference_coord.size()/_my_nb_ref); } else { @@ -2945,9 +2945,9 @@ GaussCoords::~GaussCoords() void GaussCoords::addGaussInfo( NormalizedCellType theGeometry, int coordDim, const double* theGaussCoord, - int theNbGauss, + mcIdType theNbGauss, const double* theReferenceCoord, - int theNbRef) + mcIdType theNbRef) { GaussInfoVector::iterator it = _my_gauss_info.begin(); for( ; it != _my_gauss_info.end(); it++ ) @@ -2967,7 +2967,7 @@ void GaussCoords::addGaussInfo( NormalizedCellType theGeometry, aReferenceCoord.push_back(theReferenceCoord[i]); - GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, theNbGauss, aReferenceCoord, theNbRef); + GaussInfo* info = new GaussInfo( theGeometry, aGaussCoord, FromIdType(theNbGauss), aReferenceCoord, FromIdType(theNbRef)); info->initLocalInfo(); //If info with cell type doesn't exist add it @@ -2979,7 +2979,7 @@ void GaussCoords::addGaussInfo( NormalizedCellType theGeometry, } else { - int index = std::distance(_my_gauss_info.begin(),it); + std::size_t index = std::distance(_my_gauss_info.begin(),it); delete (*it); _my_gauss_info[index] = info; } @@ -2992,7 +2992,7 @@ void GaussCoords::addGaussInfo( NormalizedCellType theGeometry, double* GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, - const int *theIndex) + const mcIdType *theIndex) { const GaussInfo *info = getInfoGivenCellType(theGeometry); int nbCoords = theSpaceDim * info->getNbGauss(); @@ -3002,13 +3002,13 @@ double* GaussCoords::calculateCoords( NormalizedCellType theGeometry, } -void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const int *theIndex, double *result) +void GaussCoords::calculateCoords( NormalizedCellType theGeometry, const double *theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result) { const GaussInfo *info = getInfoGivenCellType(theGeometry); calculateCoordsAlg(info,theNodeCoords,theSpaceDim,theIndex,result); } -void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, double *result) +void GaussCoords::calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result) { int aConn = info->getNbRef(); diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx index a263134e8..70195f701 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx @@ -23,6 +23,7 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" +#include "MCIdType.hxx" #include @@ -200,23 +201,23 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT void addGaussInfo( NormalizedCellType theGeometry, int coordDim, const double* theGaussCoord, - int theNbGauss, + mcIdType theNbGauss, const double* theReferenceCoord, - int theNbRef); + mcIdType theNbRef); INTERPKERNEL_EXPORT double* calculateCoords( NormalizedCellType theGeometry, const double* theNodeCoords, const int theSpaceDim, - const int* theIndex); + const mcIdType* theIndex); INTERPKERNEL_EXPORT void calculateCoords( NormalizedCellType theGeometry, const double* theNodeCoords, const int theSpaceDim, - const int* theIndex, + const mcIdType* theIndex, double *result); private: const GaussInfo *getInfoGivenCellType(NormalizedCellType cellType); - void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const int *theIndex, + void calculateCoordsAlg(const GaussInfo *info, const double* theNodeCoords, const int theSpaceDim, const mcIdType *theIndex, double *result); private: typedef std::vector GaussInfoVector; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx index 2c5551988..bd12d34fd 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DAbstractEdge.cxx @@ -107,11 +107,11 @@ void IteratorOnComposedEdge::insertElemEdges(ComposedEdge *elems, bool changeMyS *_deep_it=*iter; _deep_it++; iter++; - int sizeOfMyList=myListToInsert->size(); + std::size_t sizeOfMyList=myListToInsert->size(); _list_handle->insert(_deep_it,iter,myListToInsert->end()); if(!changeMySelf) { - for(int i=0;i& nodes std::vector radialDistrib3(radialDistrib.size()); std::transform(radialDistrib2.begin(),radialDistrib2.end(),radialDistrib.begin(),radialDistrib3.begin(),std::minus()); std::vector::iterator iter3=max_element(radialDistrib3.begin(),radialDistrib3.end()); - int i=iter3-radialDistrib3.begin(); + std::size_t i=iter3-radialDistrib3.begin(); // ok for e1 - Let's go. EdgeInfLin *e1=new EdgeInfLin(nodeToTest,radialDistrib[i]+radialDistrib3[i]/2.); double ref=e1->getCharactValue(*nodeToTest); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index 074fd5b8f..a3220bf61 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -166,13 +166,13 @@ unsigned MergePoints::getNumberOfAssociations() const return ret; } -void MergePoints::PushInMap(int key, int value, std::map& mergedNodes) +void MergePoints::PushInMap(mcIdType key, mcIdType value, std::map& mergedNodes) { if(key!=-1 && value!=-1) mergedNodes[key]=value; } -void MergePoints::updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map& mergedNodes) +void MergePoints::updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map& mergedNodes) { unsigned subTot(_ass1Start1+_ass1End1+_ass1Start2+_ass1End2); if(subTot!=0) @@ -684,17 +684,17 @@ bool Edge::IntersectOverlapped(const Edge *f1, const Edge *f2, EdgeIntersector * */ void Edge::Interpolate1DLin(const std::vector& distrib1, const std::vector& distrib2, std::map >& result) { - int nbOfV1=distrib1.size()-1; - int 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(int i=0;i::const_iterator iter=find_if(distrib2.begin()+1,distrib2.end(),bind2nd(std::greater_equal(),distrib1[i])); if(iter!=distrib2.end()) { - for(int j=(iter-1)-distrib2.begin();j& subNodes) +bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) { Bounds b; b.prepareForAggregation(); @@ -998,8 +998,8 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) // std::size_t sz(subNodes.size()),i(0); std::vector< std::pair > an2(sz); - std::map m; - for(std::vector::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++) + std::map m; + for(std::vector::const_iterator it=subNodes.begin();it!=subNodes.end();it++,i++) { Node *n(new Node(coo[2*(*it)],coo[2*(*it)+1])); n->applySimilarity(xBary,yBary,dimChar); @@ -1011,12 +1011,12 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) bool ret(false); for(i=0;i::const_iterator it2=m.begin();it2!=m.end();it2++) + for(std::map::const_iterator it2=m.begin();it2!=m.end();it2++) (*it2).first->decrRef(); return ret; } @@ -1024,11 +1024,11 @@ bool Edge::sortSubNodesAbs(const double *coo, std::vector& subNodes) /** * Sort nodes so that they all lie consecutively on the edge that has been cut. */ -void Edge::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, - const std::map& mapp2, std::vector& edgesThis) +void Edge::sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, + const std::map& mapp2, std::vector& edgesThis) { - int startId=(*mapp1.find(_start)).second; - int 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); @@ -1052,30 +1052,30 @@ void Edge::sortIdsAbs(const std::vector& addNodes, const for(std::size_t i=0;i(getCharactValueBtw0And1(*addNodes[i]),addNodes[i]); std::sort(an2.begin(),an2.end()); - std::vector tmpp; + std::vector tmpp; for(std::vector< std::pair >::const_iterator it=an2.begin();it!=an2.end();it++) { - int idd=(*mapp2.find((*it).second)).second; + mcIdType idd=(*mapp2.find((*it).second)).second; tmpp.push_back(idd); } - std::vector tmpp2(tmpp.size()+2); + std::vector tmpp2(tmpp.size()+2); tmpp2[0]=startId; std::copy(tmpp.begin(),tmpp.end(),tmpp2.begin()+1); tmpp2[tmpp.size()+1]=endId; - std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); + std::vector::iterator itt=std::unique(tmpp2.begin(),tmpp2.end()); tmpp2.resize(std::distance(tmpp2.begin(),itt)); - int nbOfEdges=tmpp2.size()-1; - for(int i=0;i& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const +void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const { - int tmp[2]; + mcIdType tmp[2]; _start->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp); _end->fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,tmp+1); if(direction) @@ -1090,9 +1090,9 @@ void Edge::fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, +void Edge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { if (skipStartOrEnd != -1) // see meaning in splitAbs() _start->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,edgesOther); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx index 1b4438e1d..32ee76a10 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx @@ -25,6 +25,7 @@ #include "InterpKernelException.hxx" #include "InterpKernelGeo2DBounds.hxx" #include "InterpKernelGeo2DNode.hxx" +#include "MCIdType.hxx" #include #include @@ -82,9 +83,9 @@ namespace INTERP_KERNEL bool isEnd2(unsigned rk) const; void clear(); unsigned getNumberOfAssociations() const; - void updateMergedNodes(int e1Start, int e1End, int e2Start, int e2End, std::map& mergedNodes); + void updateMergedNodes(mcIdType e1Start, mcIdType e1End, mcIdType e2Start, mcIdType e2End, std::map& mergedNodes); private: - static void PushInMap(int key, int value, std::map& mergedNodes); + static void PushInMap(mcIdType key, mcIdType value, std::map& mergedNodes); private: unsigned _ass1Start1 : 1; unsigned _ass1End1 : 1; @@ -281,14 +282,14 @@ namespace INTERP_KERNEL void dumpToCout(const std::map& mapp, int index) const; bool isEqual(const Edge& other) const; public: - bool sortSubNodesAbs(const double *coo, std::vector& subNodes); - void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); + bool sortSubNodesAbs(const double *coo, std::vector& subNodes); + void sortIdsAbs(const std::vector& addNodes, const std::map& mapp1, const std::map& mapp2, std::vector& edgesThis); virtual Edge *buildEdgeLyingOnMe(Node *start, Node *end, bool direction=true) const = 0; - void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; - void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + void fillGlobalInfoAbs(bool direction, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; + void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; protected: Edge():_cnt(1),_loc(FULL_UNKNOWN),_start(0),_end(0) { } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx index f73b9e154..d54a41f48 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx @@ -495,8 +495,8 @@ EdgeArcCircle::EdgeArcCircle(double sX, double sY, double mX, double mY, double * @param angle0 in ]-Pi;Pi[ * @param deltaAngle in ]-2.*Pi;2.*Pi[ */ -EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle(deltaAngle), - _angle0(angle0),_radius(radius) +EdgeArcCircle::EdgeArcCircle(Node *start, Node *end, const double *center, double radius, double angle0, double deltaAngle, bool direction):Edge(start,end,direction),_angle0(angle0),_angle(deltaAngle), + _radius(radius) { _center[0]=center[0]; _center[1]=center[1]; @@ -546,7 +546,7 @@ void EdgeArcCircle::unApplySimilarity(double xBary, double yBary, double dimChar * 'conn' is of size 3. conn[0] is start id, conn[1] is end id and conn[2] is middle id. * 'offset' is typically the number of nodes already existing in global 2D curve mesh. Additional coords 'addCoo' ids will be put after the already existing. */ -void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vector& newConn, std::vector& addCoo) const +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 nbOfSubDiv=(int)(fabs(_angle)/eps); @@ -556,7 +556,7 @@ void EdgeArcCircle::tesselate(const int *conn, int offset, double eps, std::vect return ; } double signOfAngle=_angle>0.?1.:-1.; - int offset2=offset+((int)addCoo.size())/2; + mcIdType offset2=offset+(ToIdType(addCoo.size()))/2; newConn.push_back(conn[0]); for(int i=1;i& newConn, std::vector& addCoo) const; + void tesselate(const mcIdType *conn, mcIdType offset, double eps, std::vector& newConn, std::vector& addCoo) const; static EdgeArcCircle *BuildFromNodes(Node *start, Node *middle, Node *end); static double GetAbsoluteAngle(const double *vect, double& normVect); static double GetAbsoluteAngleOfNormalizedVect(double ux, double uy); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx index 857821515..f0237a7ab 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx @@ -219,8 +219,8 @@ bool ElementaryEdge::isEqual(const ElementaryEdge& other) const /*! * Called by QuadraticPolygon::splitAbs method. */ -void ElementaryEdge::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const +void ElementaryEdge::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const { _ptr->fillGlobalInfoAbs(_direction,mapThis,mapOther,offset1,offset2,fact,baryX,baryY,edgesThis,addCoo,mapAddCoo); } @@ -229,12 +229,12 @@ void ElementaryEdge::fillGlobalInfoAbs(const std::map * Called by QuadraticPolygon::splitAbs method. Close to ElementaryEdge::fillGlobalInfoAbs method expect that here edgesOther (that replace edgesThis) is here an in/out parameter that only contains nodes * unsorted because the "other" mesh is not subdivided yet. */ -void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, +void ElementaryEdge::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const { if (!_direction) - skipStartOrEnd *= -1; // invert value - see QuadraticPolygon::splitAbs() + skipStartOrEnd = (short)(-skipStartOrEnd); // invert value - see QuadraticPolygon::splitAbs() _ptr->fillGlobalInfoAbs2(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,skipStartOrEnd,edgesOther,addCoo,mapAddCoo); } diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx index 3446b70ff..55b90d455 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.hxx @@ -70,11 +70,11 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT bool intresincEqCoarse(const Edge *other) const; INTERPKERNEL_EXPORT bool isEqual(const ElementaryEdge& other) const; public: - INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; - INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, + INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& edgesThis, std::vector& addCoo, std::map mapAddCoo) const; + INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, short skipStartOrEnd, - std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; + std::vector& edgesOther, std::vector& addCoo, std::map& mapAddCoo) const; INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromStartEndDir(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end); private: bool _direction; diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx index c48d783f9..31f762236 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx @@ -148,10 +148,10 @@ void Node::unApplySimilarity(double xBary, double yBary, double dimChar) /*! * Called by QuadraticPolygon::splitAbs method. */ -void Node::fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const +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 { - std::map::const_iterator 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; @@ -179,10 +179,10 @@ void Node::fillGlobalInfoAbs(const std::map& mapThis, /*! * Called by QuadraticPolygon::splitAbs method. */ -void Node::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const +void Node::fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const { - int tmp; + mcIdType tmp; std::size_t sz1=addCoo.size(); fillGlobalInfoAbs(mapThis,mapOther,offset1,offset2,fact,baryX,baryY,addCoo,mapAddCoo,&tmp); if(sz1!=addCoo.size() // newly created point @@ -192,7 +192,7 @@ void Node::fillGlobalInfoAbs2(const std::map& mapThis pointsOther.push_back(tmp); return ; } - std::vector::const_iterator 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/InterpKernelGeo2DNode.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx index be9ba0d58..b6ac1863e 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.hxx @@ -23,6 +23,7 @@ #include "InterpKernelGeo2DPrecision.hxx" #include "INTERPKERNELDefines.hxx" +#include "MCIdType.hxx" #include #include @@ -96,10 +97,10 @@ namespace INTERP_KERNEL static double distanceBtw2Pt(const double *a, const double *b) { return sqrt((a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1])); } static double distanceBtw2PtSq(const double *a, const double *b) { return (a[0]-b[0])*(a[0]-b[0])+(a[1]-b[1])*(a[1]-b[1]); } // - void fillGlobalInfoAbs(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, int *nodeId) const; - void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, double fact, double baryX, double baryY, - std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const; + void 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; + void fillGlobalInfoAbs2(const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, double fact, double baryX, double baryY, + std::vector& addCoo, std::map& mapAddCoo, std::vector& pointsOther) const; protected: ~Node(); protected: diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 3e4c6c10d..7494e5328 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -284,12 +284,12 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other) * the cell id in global other mesh. */ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, - const std::map& mapThis, const std::map& mapOther, - int offset1, int offset2 , - const std::vector& otherEdgeIds, - std::vector& edgesThis, int cellIdThis, - std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, - std::vector& addCoo, std::map& mergedNodes) + const std::map& mapThis, const std::map& mapOther, + mcIdType offset1, mcIdType offset2 , + const std::vector& otherEdgeIds, + std::vector& edgesThis, mcIdType cellIdThis, + std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, + std::vector& addCoo, std::map& mergedNodes) { double xBaryBB, yBaryBB; double fact=normalizeExt(&other, xBaryBB, yBaryBB); @@ -300,7 +300,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, ComposedEdge *cThis=new ComposedEdge; ComposedEdge *cOther=new ComposedEdge; int i=0; - std::map mapAddCoo; + std::map mapAddCoo; for(itOther.first();!itOther.finished();itOther.next(),i++) { // For each edge of 'other', proceed with intersections: the edge might split into sub-edges, 'otherTmp' will hold the final split result. @@ -322,9 +322,9 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, ElementaryEdge* curThis=itThis.current(); merge.clear(); // - std::map::const_iterator 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())); - int thisStart2(thisStart==mapThis.end()?-1:(*thisStart).second), thisEnd2(thisEnd==mapThis.end()?-1:(*thisEnd).second), + 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); // if(curThis->getPtr()->intersectWith(curOtherTmp->getPtr(),merge,*cThis,*cOther)) @@ -362,7 +362,7 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, // Converting back to integer connectivity: if(otherTmp._sub_edges.size()>1) // only if a new point has been added (i.e. an actual intersection was done) { - int jj = 0, sz(otherTmp._sub_edges.size()); + 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 skipStartOrEnd = jj == 0 ? -1 : (jj == sz-1 ? 1 : 0); // -1 means START, 1 means END, 0 other @@ -386,8 +386,8 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, * orientation of edge (see buildDescendingConnectivity2() method). * See appendEdgeFromCrudeDataArray() for params description. */ -void QuadraticPolygon::buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges) +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 nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i& mapp, bool isQuad, - const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges) +void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map& mapp, bool isQuad, + const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges) { if(!isQuad) { bool direct=descBg[edgePos]>0; - int edgeId=abs(descBg[edgePos])-1; // back to C indexing mode - const std::vector& subEdge=intersectEdges[edgeId]; + mcIdType edgeId=std::abs(descBg[edgePos])-1; // back to C indexing mode + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; for(std::size_t j=0;j0; - int edgeId=abs(descBg[edgePos])-1; - const std::vector& subEdge=intersectEdges[edgeId]; + mcIdType edgeId=std::abs(descBg[edgePos])-1; + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; if(colinearity) { @@ -445,7 +445,7 @@ void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const s } } -void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector& 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 nbOfSubEdges=subEdge.size()/2; if(!baseEdge) @@ -469,17 +469,17 @@ void QuadraticPolygon::appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size * This method builds from descending conn of a quadratic polygon stored in crude mode (MEDCoupling). Descending conn is in FORTRAN relative mode in order to give the * orientation of edge. */ -void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector >& intersectEdges2, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, - const std::vector< std::vector >& colinear1, - std::map >& alreadyExistingIn2) +void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges2, + const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1, + std::map >& alreadyExistingIn2) { std::size_t nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - int edgeId=abs(descBg[i])-1;//current edge id of pol2 - std::map >::const_iterator it1=alreadyExistingIn2.find(descBg[i]),it2=alreadyExistingIn2.find(-descBg[i]); + 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 sameDir=(it1!=alreadyExistingIn2.end()); @@ -503,21 +503,21 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map > > idIns1; - int offset1=0; + std::vector > > idIns1; + mcIdType offset1=0; if(!directos) {// if the current edge of pol2 has one or more colinear edges part into pol1 - const std::vector& c=colinear1[edgeId]; + const std::vector& c=colinear1[edgeId]; 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 + idIns1.push_back(std::pair >(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 //std::pair0; } - offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 + offset1+=ToIdType(intersectEdges1[edgeId1].size()/2);//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 } directos=idIns1.empty(); } @@ -534,25 +534,25 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map& subEdge=intersectEdges2[edgeId]; + const std::vector& subEdge=intersectEdges2[edgeId]; 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 offset2; + mcIdType nbOfSubEdges1; + for(std::vector > >::const_iterator it=idIns1.begin();it!=idIns1.end() && !found;it++) { - int 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]; - nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2; + const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2); offset2=0; - for(std::size_t k=0;k reuse Edge instance of pol1 - ElementaryEdge *e=pol1[offset1+(direct1?offset2:nbOfSubEdges1-offset2-1)]; + ElementaryEdge *e=pol1[FromIdType(offset1+(direct1?offset2:nbOfSubEdges1-offset2-1))]; Edge *ee=e->getPtr(); ee->incrRef(); ElementaryEdge *e2=new ElementaryEdge(ee,!(direct1^direction11)); @@ -589,39 +589,39 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map >& intersectEdges, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, - const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const +void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, + 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 nbOfSeg=std::distance(descBg,descEnd); for(std::size_t i=0;i0; - int edgeId=abs(descBg[i])-1;//current edge id of pol2 - const std::vector& c=colinear1[edgeId]; + 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]; + const std::vector& subEdge=intersectEdges[edgeId]; std::size_t nbOfSubEdges=subEdge.size()/2; // std::size_t nbOfEdgesIn1=std::distance(descBg1,descEnd1); - int offset1=0; + mcIdType offset1=0; for(std::size_t j=0;j0; - const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; - std::size_t nbOfSubEdges1=subEdge1PossiblyAlreadyIn1.size()/2; - int offset2=0; + const std::vector& subEdge1PossiblyAlreadyIn1=intersectEdges1[idIn1]; + mcIdType nbOfSubEdges1=ToIdType(subEdge1PossiblyAlreadyIn1.size()/2); + mcIdType offset2=0; bool found=false; - for(std::size_t kk=0;kkgetPtr()->declareOn(); } } } - offset1+=intersectEdges1[edgeId1].size()/2;//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 + offset1+=ToIdType(intersectEdges1[edgeId1].size()/2);//offset1 is used to find the INTERP_KERNEL::Edge * instance into pol1 that will be part of edge into pol2 } } } -void QuadraticPolygon::appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, int offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const +void QuadraticPolygon::appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const { int nbOfNodesInPg=0; bool presenceOfQuadratic=presenceOfQuadraticEdge(); @@ -648,14 +648,14 @@ void QuadraticPolygon::appendCrudeData(const std::map { Node *tmp=0; tmp=(*it)->getStartNode(); - std::map::const_iterator it1=mapp.find(tmp); + std::map::const_iterator it1=mapp.find(tmp); conn.push_back((*it1).second); nbOfNodesInPg++; } if(presenceOfQuadratic) { int j=0; - int off=offset+((int)addCoordsQuadratic.size())/2; + 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(); @@ -676,9 +676,9 @@ void QuadraticPolygon::appendCrudeData(const std::map * @param [in,out] edgesBoundaryOther, parameter that stores all edges in result of intersection that are not */ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, - const std::map& mapp, int idThis, int idOther, int offset, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, - std::vector& nbThis, std::vector& nbOther) + const std::map& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, + std::vector& nbThis, std::vector& nbOther) { double xBaryBB, yBaryBB; double fact=normalizeExt(&other, xBaryBB, yBaryBB); @@ -1244,9 +1244,9 @@ std::list::iterator QuadraticPolygon::CheckInList(Node *n, s * intersecting cells */ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, - const std::map& mapp, int offset, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, - std::vector& connI, std::vector& nb1, std::vector& nb2) + const std::map& mapp, mcIdType offset, mcIdType idThis, + std::vector& addCoordsQuadratic, std::vector& conn, + std::vector& connI, std::vector& nb1, std::vector& nb2) { // Initialise locations on pol1. Remember that edges found in 'notUsedInPol1' are also part of the edges forming pol1. pol1.initLocations(); diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx index 4814be460..478b10ad2 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx @@ -66,21 +66,21 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT double intersectWithAbs1D(QuadraticPolygon& other, bool& isColinear); //! Before intersecting as intersectWith a normalization is done. INTERPKERNEL_EXPORT double intersectWithAbs(QuadraticPolygon& other, double* barycenter); - INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, int offset1, int offset2, const std::vector& otherEdgeIds, - std::vector& edgesThis, int cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo, std::map& mergedNodes); - INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges); - INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, const int *descBg, const int *descEnd, const std::vector >& intersectEdges, - const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, - const std::vector< std::vector >& colinear1, - std::map >& alreadyExistingIn2); - INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const; - INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map& mapp, bool isQuad, const int *nodalBg, const double *coords, - const int *descBg, const int *descEnd, const std::vector >& intersectEdges); - INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, int edgeId, const std::vector& subEdge, const std::map& mapp); - INTERPKERNEL_EXPORT void appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, int offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const; - INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, const std::map& mapp, int idThis, int idOther, int offset, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); + INTERPKERNEL_EXPORT void splitAbs(QuadraticPolygon& other, const std::map& mapThis, const std::map& mapOther, mcIdType offset1, mcIdType offset2, const std::vector& otherEdgeIds, + std::vector& edgesThis, mcIdType cellIdThis, std::vector< std::vector >& edgesInOtherColinearWithThis, std::vector< std::vector >& subDivOther, std::vector& addCoo, std::map& mergedNodes); + INTERPKERNEL_EXPORT void buildFromCrudeDataArray(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges); + INTERPKERNEL_EXPORT void buildFromCrudeDataArray2(const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, + const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, + const std::vector< std::vector >& colinear1, + std::map >& alreadyExistingIn2); + INTERPKERNEL_EXPORT void updateLocOfEdgeFromCrudeDataArray2(const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const mcIdType *descBg1, const mcIdType *descEnd1, const std::vector >& intersectEdges1, const std::vector< std::vector >& colinear1) const; + INTERPKERNEL_EXPORT void appendEdgeFromCrudeDataArray(std::size_t edgeId, const std::map& mapp, bool isQuad, const mcIdType *nodalBg, const double *coords, + const mcIdType *descBg, const mcIdType *descEnd, const std::vector >& intersectEdges); + INTERPKERNEL_EXPORT void appendSubEdgeFromCrudeDataArray(Edge *baseEdge, std::size_t j, bool direct, mcIdType edgeId, const std::vector& subEdge, const std::map& mapp); + INTERPKERNEL_EXPORT void appendCrudeData(const std::map& mapp, double xBary, double yBary, double fact, mcIdType offset, std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI) const; + INTERPKERNEL_EXPORT void buildPartitionsAbs(QuadraticPolygon& other, std::set& edgesThis, std::set& edgesBoundaryOther, const std::map& mapp, mcIdType idThis, mcIdType idOther, mcIdType offset, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); // INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other) const; INTERPKERNEL_EXPORT double intersectWith(const QuadraticPolygon& other, double* barycenter) const; @@ -95,8 +95,8 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT std::vector buildIntersectionPolygons(const QuadraticPolygon& pol1, const QuadraticPolygon& pol2) const; INTERPKERNEL_EXPORT bool haveIAChanceToBeCompletedBy(const QuadraticPolygon& pol1NotSplitted, const QuadraticPolygon& pol2Splitted, bool& direction, bool& needCleaning) const; - INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, int offset, int idThis, - std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); + INTERPKERNEL_EXPORT static void ComputeResidual(const QuadraticPolygon& pol1, const std::set& notUsedInPol1, const std::set& edgesInPol2OnBoundary, const std::map& mapp, mcIdType offset, mcIdType idThis, + std::vector& addCoordsQuadratic, std::vector& conn, std::vector& connI, std::vector& nb1, std::vector& nb2); INTERPKERNEL_EXPORT void cleanDegeneratedConsecutiveEdges(); protected: std::list zipConsecutiveInSegments() const; diff --git a/src/INTERP_KERNEL/Geometric2DIntersector.txx b/src/INTERP_KERNEL/Geometric2DIntersector.txx index d929824c8..1fbbb27a1 100644 --- a/src/INTERP_KERNEL/Geometric2DIntersector.txx +++ b/src/INTERP_KERNEL/Geometric2DIntersector.txx @@ -94,9 +94,9 @@ namespace INTERP_KERNEL nodes[1]=new Node(quadrangle[SPACEDIM],quadrangle[SPACEDIM+1]); nodes[2]=new Node(quadrangle[2*SPACEDIM],quadrangle[2*SPACEDIM+1]); nodes[3]=new Node(quadrangle[3*SPACEDIM],quadrangle[3*SPACEDIM+1]); - int nbOfSourceNodes=sourceCoords.size()/SPACEDIM; + std::size_t nbOfSourceNodes=sourceCoords.size()/SPACEDIM; std::vector nodes2(nbOfSourceNodes); - for(int i=0;i& targetCoords, const std::vector& sourceCoords) { - int nbOfTargetNodes=targetCoords.size()/SPACEDIM; + std::size_t nbOfTargetNodes=targetCoords.size()/SPACEDIM; std::vector nodes(nbOfTargetNodes); - for(int i=0;i nodes2(nbOfSourceNodes); - for(int i=0;i nodes2(nbOfTargetNodes); - for(int i=0;i& coords, NormalizedCellType type) { - int nbNodes=coords.size()/SPACEDIM; + std::size_t nbNodes=coords.size()/SPACEDIM; std::vector nodes(nbNodes); - for(int i=0;i& srcCells, MyMatrix& res); }; @@ -63,8 +63,8 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; public: IntegralUniformIntersectorP1(const MyMeshType& mesh, bool isAbs); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; void intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res); }; } diff --git a/src/INTERP_KERNEL/IntegralUniformIntersector.txx b/src/INTERP_KERNEL/IntegralUniformIntersector.txx old mode 100644 new mode 100755 index e5b84ea2f..d328faa6a --- a/src/INTERP_KERNEL/IntegralUniformIntersector.txx +++ b/src/INTERP_KERNEL/IntegralUniformIntersector.txx @@ -69,7 +69,7 @@ namespace INTERP_KERNEL } template - int IntegralUniformIntersectorP0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType IntegralUniformIntersectorP0::getNumberOfRowsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return 1; @@ -78,7 +78,7 @@ namespace INTERP_KERNEL } template - int IntegralUniformIntersectorP0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType IntegralUniformIntersectorP0::getNumberOfColsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return IntegralUniformIntersector::_mesh.getNumberOfElements(); @@ -91,11 +91,11 @@ namespace INTERP_KERNEL { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); - unsigned long nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); + ConnType nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); - for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); double val=computeVolSurfOfCell(t,conn+OTT::ind2C(connIndx[i]),connIndx[i+1]-connIndx[i],coords); @@ -109,7 +109,7 @@ namespace INTERP_KERNEL } template - int IntegralUniformIntersectorP1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType IntegralUniformIntersectorP1::getNumberOfRowsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return 1; @@ -118,7 +118,7 @@ namespace INTERP_KERNEL } template - int IntegralUniformIntersectorP1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType IntegralUniformIntersectorP1::getNumberOfColsOfResMatrix() const { if(IntegralUniformIntersector::_from_to) return IntegralUniformIntersector::_mesh.getNumberOfNodes(); @@ -131,14 +131,14 @@ namespace INTERP_KERNEL { static const NumberingPolicy numPol=MyMeshType::My_numPol; res.resize(getNumberOfRowsOfResMatrix()); - unsigned long nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); + ConnType nbelem=IntegralUniformIntersector::_mesh.getNumberOfElements(); const ConnType *connIndx=IntegralUniformIntersector::_mesh.getConnectivityIndexPtr(); const ConnType *conn=IntegralUniformIntersector::_mesh.getConnectivityPtr(); const double *coords=IntegralUniformIntersector::_mesh.getCoordinatesPtr(); - for(unsigned long i=0;i::_mesh.getTypeOfElement(OTT::indFC(i)); - int lgth=connIndx[i+1]-connIndx[i]; + ConnType lgth=connIndx[i+1]-connIndx[i]; const ConnType *locConn=conn+OTT::ind2C(connIndx[i]); double val=computeVolSurfOfCell(t,locConn,lgth,coords); if(t==NORM_TRI3) @@ -147,7 +147,7 @@ namespace INTERP_KERNEL val/=4.; else throw INTERP_KERNEL::Exception("Invalid cell type detected : must be TRI3 or TETRA4 ! "); - for(int j=0;j::putValueIn(OTT::coo2C(locConn[j]),val,res); } } diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx index f295fd416..028f61b5a 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx @@ -39,16 +39,16 @@ using namespace INTERP_KERNEL; * It retrieves the same cell with a potentially different type (in return) whose connectivity is defined by (retConn,retLgth) * \b WARNING for optimization reason the arrays 'retConn' and 'conn' can overlapped ! */ -INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - std::set c(conn,conn+lgth); + std::set c(conn,conn+lgth); c.erase(-1); - bool isObviousNonDegeneratedCell=((int)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; - int *tmp=new int[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) { - int *tmp=new int[lgth]; + mcIdType *tmp=new mcIdType[lgth]; int newPos=0; if(!cm.isQuadratic()) { @@ -66,8 +66,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K } else { - int quadOff = lgth/2; - int *tmpQuad = new int[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) { @@ -85,8 +85,8 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K } if(cm.getDimension()==3) { - int nbOfFaces,lgthOfPolyhConn; - int *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn); + mcIdType nbOfFaces,lgthOfPolyhConn; + mcIdType *zipFullReprOfPolyh=getFullPolyh3DCell(type,conn,lgth,nbOfFaces,lgthOfPolyhConn); INTERP_KERNEL::NormalizedCellType ret=tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,retConn,retLgth); delete [] zipFullReprOfPolyh; return ret; @@ -99,7 +99,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::simplifyDegeneratedCell(INTERP_K * This static method tries to unpolygonize a cell whose connectivity is given by 'conn' and 'lgth'. * Contrary to INTERP_KERNEL::CellSimplify::simplifyDegeneratedCell method 'conn' and 'retConn' do not overlap. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const int *conn, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { retLgth=lgth; std::copy(conn,conn+lgth,retConn); @@ -135,22 +135,22 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly2D(bool isQuad, const * The format of output array is the following : * 1,2,3,-1,3,4,2,-1,3,4,1,-1,1,2,4,NORM_TRI3,NORM_TRI3,NORM_TRI3 (faces type at the end of classical polyhedron nodal description) */ -int *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, - int& retNbOfFaces, int& retLgth) +mcIdType *CellSimplify::getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, + mcIdType& retNbOfFaces, mcIdType& retLgth) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); unsigned nbOfFaces=cm.getNumberOfSons2(conn,lgth); - int *tmp=new int[nbOfFaces*(lgth+1)]; - int *work=tmp; - std::vector faces; + mcIdType *tmp=new mcIdType[nbOfFaces*(lgth+1)]; + mcIdType *work=tmp; + std::vector faces; for(unsigned j=0;j nodes(conn,conn+lgth); + std::set nodes(conn,conn+lgth); nodes.erase(-1); - int nbOfNodes=(int)nodes.size(); - int magicNumber=100*nbOfNodes+nbOfFaces; + std::size_t nbOfNodes=nodes.size(); + std::size_t magicNumber=100*nbOfNodes+nbOfFaces; switch(magicNumber) { case 806: @@ -202,48 +202,48 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPoly3D(const int *conn, i } } -bool CellSimplify::orientOppositeFace(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace) +bool CellSimplify::orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace) { - std::vector tmp2; - 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)); + std::vector tmp2; + 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; - std::vector< std::pair > baseEdges(lgthBaseFace); - std::vector< std::pair > oppEdges(lgthBaseFace); - std::vector< std::pair > sideEdges(4); - for(int i=0;i > baseEdges(lgthBaseFace); + std::vector< std::pair > oppEdges(lgthBaseFace); + std::vector< std::pair > sideEdges(4); + for(mcIdType i=0;i(baseFace[i],baseFace[(i+1)%lgthBaseFace]); - oppEdges[i]=std::pair(retConn[i],retConn[(i+1)%lgthBaseFace]); + baseEdges[i]=std::pair(baseFace[i],baseFace[(i+1)%lgthBaseFace]); + oppEdges[i]=std::pair(retConn[i],retConn[(i+1)%lgthBaseFace]); } 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 > 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)); + sideEdges[i]=std::pair(sideFace[i],sideFace[(i+1)%4]); + std::vector< std::pair > tmp; + 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 p=sideEdges[i]; - std::pair 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 > 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)); + 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; } if(tmp.size()!=1) return false; bool found=false; - std::pair pInOpp; + std::pair pInOpp; for(int i=0;i<4 && !found;i++) {//finding the pair(edge) in sideFace that do not include any node of tmp[0] edge found=(tmp[0].first!=sideEdges[i].first && tmp[0].first!=sideEdges[i].second && @@ -257,15 +257,15 @@ bool CellSimplify::orientOppositeFace(const int *baseFace, int *retConn, const i if(!found) return false; 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); + 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; - int pos2=(int)std::distance(oppEdges.begin(),it); - int offset=pos-pos2; + mcIdType pos2=ToIdType(std::distance(oppEdges.begin(),it)); + mcIdType offset=pos-pos2; if(offset<0) offset+=lgthBaseFace; //this is the end copy the result - int *tmp3=new int[lgthBaseFace]; + mcIdType *tmp3=new mcIdType[lgthBaseFace]; for(int i=0;i(),(int)INTERP_KERNEL::NORM_QUAD4))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),ToIdType(INTERP_KERNEL::NORM_QUAD4)))==conn+lgth+nbOfFaces) {//6 faces are QUAD4. int oppositeFace=-1; - std::set conn1(conn,conn+4); + std::set conn1(conn,conn+4); for(int i=1;i<6 && oppositeFace<0;i++) { - std::vector tmp; - 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)); + std::vector tmp; + 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; } if(oppositeFace>=1) {//oppositeFace of face#0 found. - int tmp2[4]; + mcIdType tmp2[4]; if(tryToArrangeOppositeFace(conn,lgth,4,conn,conn+5*oppositeFace,6,tmp2)) { std::copy(conn,conn+4,retConn); @@ -343,31 +343,31 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHex8(const int *conn, return INTERP_KERNEL::NORM_POLYHED; } -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfHexagon=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON); - std::size_t nbOfQuad=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)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 int *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON); + const mcIdType *hexag0=std::find(conn+lgth,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); std::size_t hexg0Id=std::distance(conn+lgth,hexag0); - const int *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_POLYGON); + const mcIdType *hexag1=std::find(hexag0+1,conn+lgth+nbOfFaces,ToIdType(INTERP_KERNEL::NORM_POLYGON)); std::size_t hexg1Id=std::distance(conn+lgth,hexag1); - const int *connHexag0=conn+5*hexg0Id; + const mcIdType *connHexag0=conn+5*hexg0Id; std::size_t lgthH0=std::distance(connHexag0,std::find(connHexag0,conn+lgth,-1)); if(lgthH0==6) { - const int *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5; + const mcIdType *connHexag1=conn+5*hexg0Id+7+(hexg1Id-hexg0Id-1)*5; std::size_t lgthH1=std::distance(connHexag1,std::find(connHexag1,conn+lgth,-1)); if(lgthH1==6) { - std::vector tmp; - 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)); + std::vector tmp; + 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()) { - int tmp2[6]; + mcIdType tmp2[6]; if(tryToArrangeOppositeFace(conn,lgth,6,connHexag0,connHexag1,8,tmp2)) { std::copy(connHexag0,connHexag0+6,retConn); @@ -388,16 +388,16 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyHexp12(const int *con * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PENTA6 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3); - std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)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 tri3_0=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3)); - std::size_t tri3_1=std::distance(conn+lgth,std::find(conn+lgth+tri3_0+1,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3)); - const int *tri_0=0,*tri_1=0; - const int *w=conn; + 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++) { if(i==tri3_0) @@ -407,13 +407,13 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *con w=std::find(w,conn+lgth,-1); w++; } - std::vector tmp; - 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)); + std::vector tmp; + 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()) { - int tmp2[3]; + mcIdType tmp2[3]; if(tryToArrangeOppositeFace(conn,lgth,3,tri_0,tri_1,5,tmp2)) { std::copy(tri_0,tri_0+3,retConn); @@ -432,15 +432,15 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPenta6(const int *con * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_PYRA5 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - std::size_t nbOfTriFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_TRI3); - std::size_t nbOfQuadFace=std::count(conn+lgth,conn+lgth+nbOfFaces,(int)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 quad4_pos=std::distance(conn+lgth,std::find(conn+lgth,conn+lgth+nbOfFaces,(int)INTERP_KERNEL::NORM_QUAD4)); - const int *quad4=0; - const int *w=conn; + 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==0;i++) { if(i==quad4_pos) @@ -448,20 +448,20 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn w=std::find(w,conn+lgth,-1); w++; } - std::set quad4S(quad4,quad4+4); + std::set quad4S(quad4,quad4+4); w=conn; bool ok=true; - int point=-1; + mcIdType point=-1; for(std::size_t i=0;i<5 && ok;i++) { if(i!=quad4_pos) { - std::vector tmp; - std::set conn2(w,w+3); - std::set_intersection(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); + std::vector tmp; + 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(); - std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); + std::set_difference(conn2.begin(),conn2.end(),quad4S.begin(),quad4S.end(),std::back_insert_iterator< std::vector >(tmp)); ok=ok && tmp.size()==1; if(ok) { @@ -491,21 +491,21 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyPyra5(const int *conn * Cell with 'conn' connectivity has been detected as a good candidate. Full check of this. If yes NORM_TETRA4 is returned. * If fails a POLYHED is returned. */ -INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth) +INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth) { - if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),(int)INTERP_KERNEL::NORM_TRI3))==conn+lgth+nbOfFaces) + if(std::find_if(conn+lgth,conn+lgth+nbOfFaces,std::bind2nd(std::not_equal_to(),ToIdType(INTERP_KERNEL::NORM_TRI3)))==conn+lgth+nbOfFaces) { - std::set tribase(conn,conn+3); - int point=-1; + 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 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)); + std::vector tmp; + 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(); - std::set_difference(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector >(tmp)); + std::set_difference(conn2.begin(),conn2.end(),tribase.begin(),tribase.end(),std::back_insert_iterator< std::vector >(tmp)); ok=ok && tmp.size()==1; if(ok) { @@ -534,7 +534,7 @@ INTERP_KERNEL::NormalizedCellType CellSimplify::tryToUnPolyTetra4(const int *con * - fully degenerated polygons (polygon with 1 point, or 2 if quadratic) * - quad polygon with 2 points and two identical quad points */ -bool CellSimplify::isFlatCell(const int* conn, int pos, int lgth, NormalizedCellType type) +bool CellSimplify::isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if ( lgth <= 2 ) // a polygon with a single, or two points has been returned. This check also captures degenerated quadratics diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx index ba2168374..1246a2722 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.hxx @@ -24,26 +24,27 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpKernelException.hxx" +#include "MCIdType.hxx" namespace INTERP_KERNEL { class INTERPKERNEL_EXPORT CellSimplify { public: - static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, int *retConn, int& retLgth); - static int *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const int *conn, int lgth, - int& retNbOfFaces, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const int *conn, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const int *conn, int nbOfFaces, int lgth, int *retConn, int& retLgth); - static bool tryToArrangeOppositeFace(const int *conn, int lgth, int lgthBaseFace, const int *baseFace, const int *oppFaceId, int nbOfFaces, int *retConnOfOppFace); - static bool isWellOriented(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace); - static bool orientOppositeFace(const int *baseFace, int *retConn, const int *sideFace, int lgthBaseFace); - static bool isFlatCell(const int* conn, int pos, int lgth, NormalizedCellType type); + static INTERP_KERNEL::NormalizedCellType simplifyDegeneratedCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static mcIdType *getFullPolyh3DCell(INTERP_KERNEL::NormalizedCellType type, const mcIdType *conn, mcIdType lgth, + mcIdType& retNbOfFaces, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPoly2D(bool isQuad, const mcIdType *conn, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPoly3D(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyHex8(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyHexp12(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyPenta6(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyPyra5(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static INTERP_KERNEL::NormalizedCellType tryToUnPolyTetra4(const mcIdType *conn, mcIdType nbOfFaces, mcIdType lgth, mcIdType *retConn, mcIdType& retLgth); + static bool tryToArrangeOppositeFace(const mcIdType *conn, mcIdType lgth, mcIdType lgthBaseFace, const mcIdType *baseFace, const mcIdType *oppFaceId, mcIdType nbOfFaces, mcIdType *retConnOfOppFace); + static bool isWellOriented(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace); + static bool orientOppositeFace(const mcIdType *baseFace, mcIdType *retConn, const mcIdType *sideFace, mcIdType lgthBaseFace); + static bool isFlatCell(const mcIdType* conn, mcIdType pos, mcIdType lgth, NormalizedCellType type); }; } diff --git a/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx b/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx index ee2f3e531..3b8de967a 100644 --- a/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx +++ b/src/INTERP_KERNEL/InterpKernelMatrixTools.cxx @@ -52,10 +52,10 @@ namespace INTERP_KERNEL * \param [in] incy the increment between successive entries in \a dy. * \return the sum of the product of the corresponding entries of \a dx and \a dy. */ - double ddot(int n, const double *dx, int incx, const double *dy, int incy) + double ddot(mcIdType n, const double *dx, mcIdType incx, const double *dy, mcIdType incy) { double dtemp=0.0; - int i,ix,iy,m; + mcIdType i,ix,iy,m; if(n<=0) return dtemp; // Code for unequal increments or equal increments not equal to 1. @@ -86,9 +86,9 @@ namespace INTERP_KERNEL } - void dscal(int n, double sa, double *x, int incx) + void dscal(mcIdType n, double sa, double *x, mcIdType incx) { - int i,ix,m; + mcIdType i,ix,m; if(n<=0) { } else if(incx==1) @@ -118,9 +118,9 @@ namespace INTERP_KERNEL } } - void daxpy(int n, double da, const double *dx, int incx, double *dy, int incy) + void daxpy(mcIdType n, double da, const double *dx, mcIdType incx, double *dy, mcIdType incy) { - int i,ix,iy,m; + mcIdType i,ix,iy,m; if (n<=0) return; if (da==0.0) @@ -165,9 +165,9 @@ namespace INTERP_KERNEL return -x; } - void dswap(int n, double *x, int incx, double *y, int incy) + void dswap(mcIdType n, double *x, mcIdType incx, double *y, mcIdType incy) { - int i,ix,iy,m; + mcIdType i,ix,iy,m; double temp; if(n<=0) { } @@ -222,10 +222,10 @@ namespace INTERP_KERNEL * \param [in] incx the increment between successive entries of SX. * \return the index of the element of maximum absolute value (in C convention). */ - int idamax(int n, const double *dx, int incx) + mcIdType idamax(mcIdType n, const double *dx, mcIdType incx) { double dmax; - int i,ix,value; + mcIdType i,ix,value; value=-1; if ( n < 1 || incx <= 0 ) return value; @@ -292,13 +292,13 @@ namespace INTERP_KERNEL * - K, if U(K-1,K-1) == 0. This is not an error condition for this subroutine, * but it does indicate that DGESL or DGEDI will divide by zero if called. */ - int dgefa(double *a, int lda, int n, int *ipvt) + mcIdType dgefa(double *a, mcIdType lda, mcIdType n, mcIdType *ipvt) { - int info=0; - int l; + mcIdType info=0; + mcIdType l; double t; // Gaussian elimination with partial pivoting. - for(int k=0;k=0;k--) + for(mcIdType k=n-2;k>=0;k--) { - for(int i=k+1;i ipvt=new int[n]; + INTERP_KERNEL::AutoPtr ipvt=new mcIdType[n]; INTERP_KERNEL::AutoPtr work=new double[n*n]; std::copy(A,A+n*n,iA); dgefa(iA,n,n,ipvt); diff --git a/src/INTERP_KERNEL/InterpKernelMatrixTools.hxx b/src/INTERP_KERNEL/InterpKernelMatrixTools.hxx index 231e97ac9..beb155a6d 100644 --- a/src/INTERP_KERNEL/InterpKernelMatrixTools.hxx +++ b/src/INTERP_KERNEL/InterpKernelMatrixTools.hxx @@ -22,12 +22,13 @@ #define __INTERPKERNELMATRIXTOOLS_HXX__ #include "INTERPKERNELDefines.hxx" +#include "MCIdType.hxx" namespace INTERP_KERNEL { - void INTERPKERNEL_EXPORT matrixProduct(const double *A, int n1, int p1, const double *B, int n2, int p2, double *C); - void INTERPKERNEL_EXPORT inverseMatrix(const double *A, int n, double *iA); - void INTERPKERNEL_EXPORT daxpy(int n, double da, const double *dx, int incx, double *dy, int incy); + void INTERPKERNEL_EXPORT matrixProduct(const double *A, mcIdType n1, mcIdType p1, const double *B, mcIdType n2, mcIdType p2, double *C); + void INTERPKERNEL_EXPORT inverseMatrix(const double *A, mcIdType n, double *iA); + void INTERPKERNEL_EXPORT daxpy(mcIdType n, double da, const double *dx, mcIdType incx, double *dy, mcIdType incy); } #endif diff --git a/src/INTERP_KERNEL/InterpKernelUtilities.hxx b/src/INTERP_KERNEL/InterpKernelUtilities.hxx index cb7064abd..cbf11572d 100644 --- a/src/INTERP_KERNEL/InterpKernelUtilities.hxx +++ b/src/INTERP_KERNEL/InterpKernelUtilities.hxx @@ -35,4 +35,7 @@ #define LOCALIZED(message) static_cast (message) , __FILE__ , __LINE__ +// conversion to mesh connection type +#define ToConnType(x) static_cast(x) + #endif diff --git a/src/INTERP_KERNEL/Interpolation.hxx b/src/INTERP_KERNEL/Interpolation.hxx index 4baba86f4..f8fa6a146 100644 --- a/src/INTERP_KERNEL/Interpolation.hxx +++ b/src/INTERP_KERNEL/Interpolation.hxx @@ -37,17 +37,17 @@ namespace INTERP_KERNEL Interpolation(const InterpolationOptions& io) :InterpolationOptions(io){} //interpolation of two triangular meshes. template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result) + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result) { return asLeaf().interpolateMeshes(meshS,meshT,result); } template - int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); } + typename MyMeshType::MyConnType fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); } template - int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); } + typename MyMeshType::MyConnType toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); } template static double CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel); protected: template - int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method); + typename MyMeshType::MyConnType fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method); protected: TrueMainInterpolator& asLeaf() { return static_cast(*this); } }; diff --git a/src/INTERP_KERNEL/Interpolation.txx b/src/INTERP_KERNEL/Interpolation.txx old mode 100644 new mode 100755 index a9d02ee12..5187a59ac --- a/src/INTERP_KERNEL/Interpolation.txx +++ b/src/INTERP_KERNEL/Interpolation.txx @@ -29,10 +29,10 @@ namespace INTERP_KERNEL { template template - int Interpolation::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; - int ret=-1; + ConnType ret=-1; if(method=="P0") { IntegralUniformIntersectorP0 intersector(mesh,InterpolationOptions::getMeasureAbsStatus()); @@ -59,9 +59,10 @@ namespace INTERP_KERNEL double Interpolation::CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; + typedef typename MyMeshType::MyConnType ConnType; - long nbMailleS=myMeshS.getNumberOfElements(); - long nbMailleT=myMeshT.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleT=myMeshT.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ @@ -73,13 +74,13 @@ namespace INTERP_KERNEL if(nbMailleS!=0) { diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); - dimCaracteristicS=diagonalS/nbMailleS; + dimCaracteristicS=diagonalS/(double)nbMailleS; } double diagonalT,dimCaracteristicT=std::numeric_limits::max(); if(nbMailleT!=0) { diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); - dimCaracteristicT=diagonalT/nbMailleT; + dimCaracteristicT=diagonalT/(double)nbMailleT; } if (printLevel>=1) { diff --git a/src/INTERP_KERNEL/Interpolation1D0D.cxx b/src/INTERP_KERNEL/Interpolation1D0D.cxx index b1a1dd03c..65ab1c0aa 100644 --- a/src/INTERP_KERNEL/Interpolation1D0D.cxx +++ b/src/INTERP_KERNEL/Interpolation1D0D.cxx @@ -44,8 +44,8 @@ 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 - long size = bbox.size()/(2*SPACE_DIM); - for (int i=0; i - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); private: void adjustBoundingBoxes(std::vector& bbox); }; diff --git a/src/INTERP_KERNEL/Interpolation1D0D.txx b/src/INTERP_KERNEL/Interpolation1D0D.txx old mode 100644 new mode 100755 index da9fe59b8..9bce3507b --- a/src/INTERP_KERNEL/Interpolation1D0D.txx +++ b/src/INTERP_KERNEL/Interpolation1D0D.txx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL * adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB() **/ template - int Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation1D0D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { constexpr int SPACEDIM=MyMeshType::MY_SPACEDIM; using ConnType=typename MyMeshType::MyConnType; @@ -56,7 +56,7 @@ namespace INTERP_KERNEL const double epsilon(getPrecision()); // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems(srcMesh.getNumberOfElements()), numTargetElems(targetMesh.getNumberOfElements()); + const ConnType numSrcElems(srcMesh.getNumberOfElements()), numTargetElems(targetMesh.getNumberOfElements()); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); @@ -64,7 +64,7 @@ namespace INTERP_KERNEL std::map*, int> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); // create empty maps for all source elements @@ -73,8 +73,8 @@ namespace INTERP_KERNEL // create BBTree structure // - get bounding boxes std::vector bboxes(2*SPACEDIM*numSrcElems); - int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + ConnType* srcElemIdx = new ConnType[numSrcElems]; + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order srcElems[i]->getBoundingBox()->toCompactData(bboxes.data()+6*i); @@ -89,7 +89,7 @@ namespace INTERP_KERNEL const ConnType *trgConnPtr(targetMesh.getConnectivityPtr()),*trgConnIPtr(targetMesh.getConnectivityIndexPtr()); const ConnType *srcConnPtr(srcMesh.getConnectivityPtr()),*srcConnIPtr(srcMesh.getConnectivityIndexPtr()); const double *trgCooPtr(targetMesh.getCoordinatesPtr()),*srcCooPtr(srcMesh.getCoordinatesPtr()); - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { IKAssert(trgConnIPtr[i+1]==i+1 && trgConnIPtr[i]==i); std::vector srcSegCondidates; @@ -110,7 +110,7 @@ namespace INTERP_KERNEL } } delete [] srcElemIdx; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) delete srcElems[i]; return srcMesh.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/Interpolation2D1D.hxx b/src/INTERP_KERNEL/Interpolation2D1D.hxx index 9d0ce99d6..a2c2f601d 100644 --- a/src/INTERP_KERNEL/Interpolation2D1D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D1D.hxx @@ -40,7 +40,7 @@ namespace INTERP_KERNEL class Interpolation2D1D : public Interpolation { public: - typedef std::map > DuplicateFacesType; + typedef std::map > DuplicateFacesType; Interpolation2D1D() { setOrientation(2); } Interpolation2D1D(const InterpolationOptions& io):Interpolation(io) { } @@ -48,7 +48,7 @@ namespace INTERP_KERNEL // Main function to interpolate triangular and quadratic meshes template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; diff --git a/src/INTERP_KERNEL/Interpolation2D1D.txx b/src/INTERP_KERNEL/Interpolation2D1D.txx old mode 100644 new mode 100755 index 1e644d781..7cc6ca443 --- a/src/INTERP_KERNEL/Interpolation2D1D.txx +++ b/src/INTERP_KERNEL/Interpolation2D1D.txx @@ -46,19 +46,19 @@ namespace INTERP_KERNEL * */ template - int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; long global_start =clock(); - int counter=0; + std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ /***********************************************************/ - long nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ @@ -114,12 +114,12 @@ namespace INTERP_KERNEL /* Loop on the target cells - core of the algorithm */ /****************************************************/ long start_intersection=clock(); - long nbelem_type=myMeshT.getNumberOfElements(); + ConnType nbelem_type=myMeshT.getNumberOfElements(); const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); - for(int iT=0; iT intersecting_elems; + ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT]; + std::vector intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); @@ -127,7 +127,7 @@ namespace INTERP_KERNEL counter+=intersecting_elems.size(); intersecting_elems.clear(); } - int ret=intersector->getNumberOfColsOfResMatrix(); + ConnType ret=intersector->getNumberOfColsOfResMatrix(); const DuplicateFacesType& intersectFaces = *intersector->getIntersectFaces(); DuplicateFacesType::const_iterator iter; diff --git a/src/INTERP_KERNEL/Interpolation2D3D.hxx b/src/INTERP_KERNEL/Interpolation2D3D.hxx index ddfaf93dc..0a624c9af 100644 --- a/src/INTERP_KERNEL/Interpolation2D3D.hxx +++ b/src/INTERP_KERNEL/Interpolation2D3D.hxx @@ -27,6 +27,7 @@ #include "Interpolation.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "InterpolationOptions.hxx" +#include "MCIdType.hxx" namespace INTERP_KERNEL { @@ -42,12 +43,12 @@ namespace INTERP_KERNEL class Interpolation2D3D : public Interpolation { public: - typedef std::map > DuplicateFacesType; + typedef std::map > DuplicateFacesType; INTERPKERNEL_EXPORT Interpolation2D3D(); INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io); template - int interpolateMeshes(const MyMeshType& srcMesh, + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MyMatrixType& matrix, const std::string& method); diff --git a/src/INTERP_KERNEL/Interpolation2D3D.txx b/src/INTERP_KERNEL/Interpolation2D3D.txx old mode 100644 new mode 100755 index a9b725243..4e7fac898 --- a/src/INTERP_KERNEL/Interpolation2D3D.txx +++ b/src/INTERP_KERNEL/Interpolation2D3D.txx @@ -60,28 +60,28 @@ namespace INTERP_KERNEL * */ template - int Interpolation2D3D::interpolateMeshes(const MyMeshType& srcMesh, + typename MyMeshType::MyConnType Interpolation2D3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MyMatrixType& matrix, const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); std::vector*> srcElems(numSrcElems); std::vector*> targetElems(numTargetElems); - std::map*, int> indices; + std::map*, ConnType> indices; DuplicateFacesType intersectFaces; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -111,8 +111,8 @@ namespace INTERP_KERNEL // create BBTree structure // - get bounding boxes double* bboxes = new double[6 * numSrcElems]; - int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + ConnType* srcElemIdx = new ConnType[numSrcElems]; + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -131,10 +131,10 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); - const int targetIdx = targetElems[i]->getIndex(); + const ConnType targetIdx = targetElems[i]->getIndex(); // get target bbox in right order double targetBox[6]; @@ -167,15 +167,15 @@ namespace INTERP_KERNEL } // free allocated memory - int ret=intersector->getNumberOfColsOfResMatrix(); + ConnType ret=intersector->getNumberOfColsOfResMatrix(); delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/Interpolation3D.hxx b/src/INTERP_KERNEL/Interpolation3D.hxx old mode 100644 new mode 100755 index 19e2ee9d1..fca0a763f --- a/src/INTERP_KERNEL/Interpolation3D.hxx +++ b/src/INTERP_KERNEL/Interpolation3D.hxx @@ -1,43 +1,43 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATION3D_HXX__ -#define __INTERPOLATION3D_HXX__ - -#include "INTERPKERNELDefines.hxx" -#include "Interpolation.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation - { - public: - Interpolation3D(); - Interpolation3D(const InterpolationOptions& io); - template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); - private: - SplittingPolicy _splitting_policy; - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATION3D_HXX__ +#define __INTERPOLATION3D_HXX__ + +#include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + class INTERPKERNEL_EXPORT Interpolation3D : public Interpolation + { + public: + Interpolation3D(); + Interpolation3D(const InterpolationOptions& io); + template + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + private: + SplittingPolicy _splitting_policy; + }; +} + +#endif diff --git a/src/INTERP_KERNEL/Interpolation3D.txx b/src/INTERP_KERNEL/Interpolation3D.txx old mode 100644 new mode 100755 index 46b7f7d7e..e0872c2e1 --- a/src/INTERP_KERNEL/Interpolation3D.txx +++ b/src/INTERP_KERNEL/Interpolation3D.txx @@ -75,24 +75,24 @@ namespace INTERP_KERNEL * */ template - int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); std::vector*> srcElems(numSrcElems); std::vector*> targetElems(numTargetElems); - std::map*, int> indices; + std::map*, ConnType> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -186,14 +186,14 @@ namespace INTERP_KERNEL MeshRegion& srcRegion = firstNode->getSrcRegion(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { srcRegion.addElement(srcElems[i], srcMesh); } MeshRegion& targetRegion = firstNode->getTargetRegion(); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { if(!srcRegion.isDisjointWithElementBoundingBox( *(targetElems[i]) )) { @@ -252,8 +252,8 @@ namespace INTERP_KERNEL // add source elements of current node that overlap the target regions of the new nodes LOG(5, " -- Adding source elements"); - int numLeftElements = 0; - int numRightElements = 0; + ConnType numLeftElements = 0; + ConnType numRightElements = 0; for(typename std::vector*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ; iter != currNode->getSrcRegion().getEndElements() ; ++iter) { @@ -307,8 +307,8 @@ namespace INTERP_KERNEL // create BBTree structure // - get bounding boxes double* bboxes = new double[6 * numSrcElems]; - int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + ConnType* srcElemIdx = new ConnType[numSrcElems]; + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -327,10 +327,10 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); - const int targetIdx = targetElems[i]->getIndex(); + const ConnType targetIdx = targetElems[i]->getIndex(); // get target bbox in right order double targetBox[6]; @@ -354,15 +354,15 @@ namespace INTERP_KERNEL #endif // free allocated memory - int ret=intersector->getNumberOfColsOfResMatrix(); + ConnType ret=intersector->getNumberOfColsOfResMatrix(); delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/Interpolation3D1D.cxx b/src/INTERP_KERNEL/Interpolation3D1D.cxx index da03d8775..faa65ec42 100644 --- a/src/INTERP_KERNEL/Interpolation3D1D.cxx +++ b/src/INTERP_KERNEL/Interpolation3D1D.cxx @@ -45,8 +45,8 @@ namespace INTERP_KERNEL const double adj = getBoundingBoxAdjustmentAbs(); const double adjRel = getBoundingBoxAdjustment(); - long size = bbox.size()/(2*SPACE_DIM); - for (int i=0; i::max(); for(int idim=0; idim - -namespace INTERP_KERNEL -{ - class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation - { - public: - Interpolation3D1D(); - Interpolation3D1D(const InterpolationOptions& io); - template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); - private: - void adjustBoundingBoxes(std::vector& bbox); - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : A Bruneton (CEA/DEN) + +#ifndef __INTERPOLATION3D1D_HXX__ +#define __INTERPOLATION3D1D_HXX__ + +#include "INTERPKERNELDefines.hxx" +#include "Interpolation.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +#include + +namespace INTERP_KERNEL +{ + class INTERPKERNEL_EXPORT Interpolation3D1D : public Interpolation + { + public: + Interpolation3D1D(); + Interpolation3D1D(const InterpolationOptions& io); + template + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method); + private: + void adjustBoundingBoxes(std::vector& bbox); + }; +} + +#endif diff --git a/src/INTERP_KERNEL/Interpolation3D1D.txx b/src/INTERP_KERNEL/Interpolation3D1D.txx old mode 100644 new mode 100755 index 15d100d10..9bc67b338 --- a/src/INTERP_KERNEL/Interpolation3D1D.txx +++ b/src/INTERP_KERNEL/Interpolation3D1D.txx @@ -39,27 +39,27 @@ namespace INTERP_KERNEL * adjusted in a similar fashion as in InterpolationPlanar::performAdjustmentOfBB() **/ template - int Interpolation3D1D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType Interpolation3D1D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method) { if(InterpolationOptions::getIntersectionType() != PointLocator) INTERP_KERNEL::Exception("Invalid 3D/1D intersection type specified : must be PointLocator."); typedef typename MyMeshType::MyConnType ConnType; // create MeshElement objects corresponding to each element of the two meshes - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - const unsigned long numTargetElems = targetMesh.getNumberOfElements(); + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + const ConnType numTargetElems = targetMesh.getNumberOfElements(); LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements "); std::vector*> srcElems(numSrcElems); std::vector*> targetElems(numTargetElems); - std::map*, int> indices; + std::map*, ConnType> indices; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) srcElems[i] = new MeshElement(i, srcMesh); - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) targetElems[i] = new MeshElement(i, targetMesh); Intersector3D* intersector=0; @@ -84,8 +84,8 @@ namespace INTERP_KERNEL // create BBTree structure // - get bounding boxes std::vector bboxes(6*numSrcElems); - int* srcElemIdx = new int[numSrcElems]; - for(unsigned long i = 0; i < numSrcElems ; ++i) + ConnType* srcElemIdx = new ConnType[numSrcElems]; + for(ConnType i = 0; i < numSrcElems ; ++i) { // get source bboxes in right order const BoundingBox* box = srcElems[i]->getBoundingBox(); @@ -107,10 +107,10 @@ namespace INTERP_KERNEL // for each target element, get source elements with which to calculate intersection // - calculate intersection by calling intersectCells - for(unsigned long i = 0; i < numTargetElems; ++i) + for(ConnType i = 0; i < numTargetElems; ++i) { const BoundingBox* box = targetElems[i]->getBoundingBox(); - const int targetIdx = targetElems[i]->getIndex(); + const ConnType targetIdx = targetElems[i]->getIndex(); // get target bbox in right order double targetBox[6]; @@ -132,15 +132,15 @@ namespace INTERP_KERNEL // free allocated memory delete [] srcElemIdx; - int ret=intersector->getNumberOfColsOfResMatrix(); + ConnType ret=intersector->getNumberOfColsOfResMatrix(); delete intersector; - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + for(ConnType i = 0 ; i < numSrcElems ; ++i) { delete srcElems[i]; } - for(unsigned long i = 0 ; i < numTargetElems ; ++i) + for(ConnType i = 0 ; i < numTargetElems ; ++i) { delete targetElems[i]; } diff --git a/src/INTERP_KERNEL/InterpolationCC.hxx b/src/INTERP_KERNEL/InterpolationCC.hxx index 00a22098a..d1b434f99 100644 --- a/src/INTERP_KERNEL/InterpolationCC.hxx +++ b/src/INTERP_KERNEL/InterpolationCC.hxx @@ -41,7 +41,7 @@ namespace INTERP_KERNEL InterpolationCC(); InterpolationCC(const InterpolationOptions& io); template - int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method); + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method); private: }; diff --git a/src/INTERP_KERNEL/InterpolationCC.txx b/src/INTERP_KERNEL/InterpolationCC.txx index ecbd29210..7a3363bca 100644 --- a/src/INTERP_KERNEL/InterpolationCC.txx +++ b/src/INTERP_KERNEL/InterpolationCC.txx @@ -74,15 +74,15 @@ namespace INTERP_KERNEL */ //================================================================================ - template + template void fillMatrix(const std::list< Interference > inter_of_axis[dim], MatrixType& result, - const int src_nb_cells[dim], - const int tgt_nb_cells[dim], - const int src_i_cell = 0, - const int tgt_i_cell = 0, - const int src_prev_area = 1, - const int tgt_prev_area = 1, + const ConnType src_nb_cells[dim], + const ConnType tgt_nb_cells[dim], + const ConnType src_i_cell = 0, + const ConnType tgt_i_cell = 0, + const ConnType src_prev_area = 1, + const ConnType tgt_prev_area = 1, const int axis = 0, const double prev_value = 1.0) { @@ -92,29 +92,29 @@ namespace INTERP_KERNEL { for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; result[ tgt_i ].insert( std::make_pair( _TMI( src_i ), value )); } } else { - int src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; - int tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; + ConnType src_prev_area_next = src_prev_area * src_nb_cells[ axis ]; + ConnType tgt_prev_area_next = tgt_prev_area * tgt_nb_cells[ axis ]; for ( TIntIterator i = inter_of_axis[axis].begin(); i != inter_of_axis[axis].end(); ++i ) { - double value = i->_length * prev_value; - int src_i = i->_src_index * src_prev_area + src_i_cell; - int tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; + double value = i->_length * prev_value; + ConnType src_i = i->_src_index * src_prev_area + src_i_cell; + ConnType tgt_i = i->_tgt_index * tgt_prev_area + tgt_i_cell; // call for the next axis - fillMatrix(inter_of_axis, result, - src_nb_cells, tgt_nb_cells, src_i, tgt_i, - src_prev_area_next, tgt_prev_area_next, - axis+1, value ); + fillMatrix(inter_of_axis, result, + src_nb_cells, tgt_nb_cells, src_i, tgt_i, + src_prev_area_next, tgt_prev_area_next, + axis+1, value ); } } } @@ -141,7 +141,7 @@ namespace INTERP_KERNEL //================================================================================ template - int InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, + typename MyMeshType::MyConnType InterpolationCC::interpolateMeshes(const MyMeshType& src_mesh, const MyMeshType& tgt_mesh, MatrixType& result, const char * method) @@ -152,7 +152,8 @@ namespace INTERP_KERNEL // create empty maps for all target elements result.resize( tgt_mesh.getNumberOfElements() ); - const int ret = src_mesh.getNumberOfElements(); + typedef typename MyMeshType::MyConnType ConnType; + const ConnType ret = src_mesh.getNumberOfElements(); const double eps = getPrecision(); const int dim = MyMeshType::MY_MESHDIM; @@ -160,14 +161,15 @@ namespace INTERP_KERNEL const double* src_coords[ dim ]; const double* tgt_coords[ dim ]; - int src_nb_cells[ dim ]; - int tgt_nb_cells[ dim ]; + ConnType src_nb_cells[ dim ]; + ConnType tgt_nb_cells[ dim ]; for ( int j = 0; j < dim; ++j ) { - src_coords[ j ] = src_mesh.getCoordsAlongAxis( _TMI( j )); - tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( _TMI( j )); - src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( _TMI( j )); - tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( _TMI( j )); + int axis = static_cast( _TMI( j )); + src_coords[ j ] = src_mesh.getCoordsAlongAxis( axis ); + tgt_coords[ j ] = tgt_mesh.getCoordsAlongAxis( axis ); + src_nb_cells[ j ] = src_mesh.nbCellsAlongAxis( axis ); + tgt_nb_cells[ j ] = tgt_mesh.nbCellsAlongAxis( axis ); } // ============================================ @@ -235,15 +237,15 @@ namespace INTERP_KERNEL switch ( dim ) { case 3: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 2: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; case 1: - fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); + fillMatrix( interferences, result, src_nb_cells,tgt_nb_cells ); break; } diff --git a/src/INTERP_KERNEL/InterpolationCU.hxx b/src/INTERP_KERNEL/InterpolationCU.hxx index 3d74d4ddd..31c95329c 100644 --- a/src/INTERP_KERNEL/InterpolationCU.hxx +++ b/src/INTERP_KERNEL/InterpolationCU.hxx @@ -26,6 +26,7 @@ #include "Interpolation.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { @@ -36,10 +37,10 @@ namespace INTERP_KERNEL InterpolationCU(const InterpolationOptions & io); template - int interpolateMeshes(const MyCMeshType& meshS, const MyUMeshType& meshT, MatrixType& result, const char *method); + typename MyCMeshType::MyConnType interpolateMeshes(const MyCMeshType& meshS, const MyUMeshType& meshT, MatrixType& result, const char *method); template - int interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method); + typename MyUMeshType::MyConnType interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method); }; } diff --git a/src/INTERP_KERNEL/InterpolationCU.txx b/src/INTERP_KERNEL/InterpolationCU.txx index a202ec305..e43d80cc8 100644 --- a/src/INTERP_KERNEL/InterpolationCU.txx +++ b/src/INTERP_KERNEL/InterpolationCU.txx @@ -92,12 +92,13 @@ namespace INTERP_KERNEL //================================================================================ template - int InterpolationCU::interpolateMeshes(const MyCMeshType& src_mesh, + typename MyCMeshType::MyConnType InterpolationCU::interpolateMeshes(const MyCMeshType& src_mesh, const MyUMeshType& tgt_mesh, MatrixType& result, const char * method) { typedef typename MyCMeshType::MyConnType CConnType; + typedef typename MyUMeshType::MyConnType UConnType; if ( std::string("P0P0") != method ) throw Exception("Only P0P0 method is implemented so far"); @@ -117,27 +118,28 @@ namespace INTERP_KERNEL } // create empty maps for all target elements result.resize( intersector->getNumberOfRowsOfResMatrix() ); - const int ret = intersector->getNumberOfColsOfResMatrix(); + const CConnType ret = intersector->getNumberOfColsOfResMatrix(); const double* src_coords[ dim ]; - int src_nb_coords[ dim ]; - std::map< double, int> src_coord_to_index[ dim ]; + CConnType src_nb_coords[ dim ]; + std::map< double, CConnType> src_coord_to_index[ dim ]; for ( int j = 0; j < dim; ++j ) { - src_coords [j] = src_mesh.getCoordsAlongAxis( _TMIC( j )); - src_nb_coords[j] = src_mesh.nbCellsAlongAxis ( _TMIC( j )) + 1; - for (int i = 0; i < src_nb_coords[j]; ++i ) + int axis = static_cast( _TMIC( j )); + src_coords [j] = src_mesh.getCoordsAlongAxis( axis ); + src_nb_coords[j] = static_cast(src_mesh.nbCellsAlongAxis( axis )) + 1; + for (CConnType i = 0; i < src_nb_coords[j]; ++i ) src_coord_to_index[j].insert( std::make_pair( src_coords[j][i], i )); } - const unsigned long tgtu_nb_cells = tgt_mesh.getNumberOfElements(); + const UConnType tgtu_nb_cells = tgt_mesh.getNumberOfElements(); IntersectorCU bbHelper(src_mesh, tgt_mesh); double bb[2*dim]; // loop on unstructured tgt cells - for(unsigned int iT=0; iT > structIndices(1); - std::map< double, int>::iterator coo_ind; + typename std::map< double, CConnType>::iterator coo_ind; for ( int j = 0; j < dim; ++j ) { coo_ind = src_coord_to_index[j].lower_bound( bb[2*j+1] - eps ); if ( coo_ind == src_coord_to_index[j].end() ) --coo_ind; - int max_i = coo_ind->second; + CConnType max_i = coo_ind->second; coo_ind = src_coord_to_index[j].upper_bound( bb[2*j ] + eps ); if ( coo_ind != src_coord_to_index[j].begin() ) --coo_ind; - int min_i = coo_ind->second; + CConnType min_i = coo_ind->second; std::vector< std::vector< CConnType > > newStructIndices; for ( unsigned int iInd = 0; iInd < structIndices.size(); ++iInd ) { - for ( int i = min_i; i < max_i; ++i ) + for ( CConnType i = min_i; i < max_i; ++i ) { std::vector< CConnType > index = structIndices[iInd]; index.push_back( i ); @@ -214,14 +216,17 @@ namespace INTERP_KERNEL //================================================================================ template - int InterpolationCU::interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method) + typename MyUMeshType::MyConnType InterpolationCU::interpolateMeshesRev(const MyUMeshType& meshS, const MyCMeshType& meshT, MatrixType& result, const char *method) { + typedef typename MyCMeshType::MyConnType CConnType; + typedef typename MyUMeshType::MyConnType UConnType; + MatrixType revResult; - int sizeT = interpolateMeshes( meshT, meshS, revResult, method ); - int sizeS = revResult.size(); + CConnType sizeT = interpolateMeshes( meshT, meshS, revResult, method ); + UConnType sizeS = revResult.size(); result.resize( sizeT ); - for ( int iS = 0; iS < sizeS; ++iS ) + for ( CConnType iS = 0; iS < sizeS; ++iS ) { typename MatrixType::value_type & row = revResult[iS]; typename MatrixType::value_type::iterator iT_surf = row.begin(); diff --git a/src/INTERP_KERNEL/InterpolationCurve.hxx b/src/INTERP_KERNEL/InterpolationCurve.hxx old mode 100644 new mode 100755 index 25f81e057..af9332319 --- a/src/INTERP_KERNEL/InterpolationCurve.hxx +++ b/src/INTERP_KERNEL/InterpolationCurve.hxx @@ -1,44 +1,44 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATIONCURVE_HXX__ -#define __INTERPOLATIONCURVE_HXX__ - -#include "Interpolation.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - template - class InterpolationCurve : public Interpolation< InterpolationCurve > - { - public: - InterpolationCurve(); - InterpolationCurve(const InterpolationOptions & io); - - // Main function to interpolate - template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, - MatrixType& result, const std::string& method); - - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATIONCURVE_HXX__ +#define __INTERPOLATIONCURVE_HXX__ + +#include "Interpolation.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + template + class InterpolationCurve : public Interpolation< InterpolationCurve > + { + public: + InterpolationCurve(); + InterpolationCurve(const InterpolationOptions & io); + + // Main function to interpolate + template + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, + MatrixType& result, const std::string& method); + + }; +} + +#endif diff --git a/src/INTERP_KERNEL/InterpolationCurve.txx b/src/INTERP_KERNEL/InterpolationCurve.txx old mode 100644 new mode 100755 index 097f8d04e..972aa5f91 --- a/src/INTERP_KERNEL/InterpolationCurve.txx +++ b/src/INTERP_KERNEL/InterpolationCurve.txx @@ -73,7 +73,7 @@ namespace INTERP_KERNEL */ template template - int InterpolationCurve::interpolateMeshes (const MyMeshType& myMeshS, + typename MyMeshType::MyConnType InterpolationCurve::interpolateMeshes (const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) @@ -83,10 +83,10 @@ namespace INTERP_KERNEL static const NumberingPolicy numPol = MyMeshType::My_numPol; long global_start = clock(); - int counter=0; + std::size_t counter=0; - long nbMailleS = myMeshS.getNumberOfElements(); - long nbMailleT = myMeshT.getNumberOfElements(); + ConnType nbMailleS = myMeshS.getNumberOfElements(); + ConnType nbMailleT = myMeshT.getNumberOfElements(); CurveIntersector* intersector=0; if(method=="P0P0") @@ -187,17 +187,17 @@ namespace INTERP_KERNEL /****************************************************/ long start_intersection = clock(); const ConnType *connIndxT = myMeshT.getConnectivityIndexPtr(); - for(int iT=0; iT intersecting_elems; + ConnType nb_nodesT = connIndxT[iT+1] - connIndxT[iT]; + std::vector intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); intersector->intersectCells(iT,intersecting_elems,result); counter += intersecting_elems.size(); } - int ret = intersector->getNumberOfColsOfResMatrix(); + ConnType ret = intersector->getNumberOfColsOfResMatrix(); delete intersector; if (InterpolationOptions::getPrintLevel() >= 1) diff --git a/src/INTERP_KERNEL/InterpolationOptions.cxx b/src/INTERP_KERNEL/InterpolationOptions.cxx index 63998d933..0d70a7d0a 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.cxx +++ b/src/INTERP_KERNEL/InterpolationOptions.cxx @@ -255,7 +255,7 @@ std::string INTERP_KERNEL::InterpolationOptions::filterInterpolationMethod(const return std::string(meth); } -bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_level, +bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(int print_level, std::string intersection_type, double precision, double median_plane, @@ -263,7 +263,7 @@ bool INTERP_KERNEL::InterpolationOptions::setInterpolationOptions(long print_lev double bounding_box_adjustment, double bounding_box_adjustment_abs, double max_distance_for_3Dsurf_intersect, - long orientation, + int orientation, bool measure_abs, std::string splitting_policy) { diff --git a/src/INTERP_KERNEL/InterpolationOptions.hxx b/src/INTERP_KERNEL/InterpolationOptions.hxx index d06c50964..f4fd8984d 100644 --- a/src/INTERP_KERNEL/InterpolationOptions.hxx +++ b/src/INTERP_KERNEL/InterpolationOptions.hxx @@ -98,7 +98,7 @@ namespace INTERP_KERNEL void init(); - bool setInterpolationOptions(long print_level, + bool setInterpolationOptions(int print_level, std::string intersection_type, double precision, double median_plane, @@ -106,7 +106,7 @@ namespace INTERP_KERNEL double bounding_box_adjustment, double bounding_box_adjustment_abs, double max_distance_for_3Dsurf_intersect, - long orientation, + int orientation, bool measure_abs, std::string splitting_policy); void copyOptions(const InterpolationOptions & other) { *this = other; } diff --git a/src/INTERP_KERNEL/InterpolationPlanar.hxx b/src/INTERP_KERNEL/InterpolationPlanar.hxx old mode 100644 new mode 100755 index 040348741..76b52f86f --- a/src/INTERP_KERNEL/InterpolationPlanar.hxx +++ b/src/INTERP_KERNEL/InterpolationPlanar.hxx @@ -1,59 +1,59 @@ -// Copyright (C) 2007-2019 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : Anthony Geay (CEA/DEN) - -#ifndef __INTERPOLATIONPLANAR_HXX__ -#define __INTERPOLATIONPLANAR_HXX__ - -#include "Interpolation.hxx" -#include "PlanarIntersector.hxx" -#include "NormalizedUnstructuredMesh.hxx" -#include "InterpolationOptions.hxx" - -namespace INTERP_KERNEL -{ - template - class InterpolationPlanar : public Interpolation< InterpolationPlanar > - { - private: - double _dim_caracteristic; - public: - InterpolationPlanar(); - InterpolationPlanar(const InterpolationOptions & io); - - // geometric precision, debug print level, choice of the median plane, intersection etc ... - void setOptions(double precision, int printLevel, - IntersectionType intersectionType, int orientation=0); - - // Main function to interpolate triangular and quadratic meshes - template - int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); - public: - bool doRotate() const { return asLeafInterpPlanar().doRotate(); } - double medianPlane() const { return asLeafInterpPlanar().medianPlane(); } - template - void performAdjustmentOfBB(PlanarIntersector* intersector, std::vector& bbox) const - { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); } - protected: - RealPlanar& asLeafInterpPlanar() { return static_cast(*this); } - const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); } - }; -} - -#endif +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (CEA/DEN) + +#ifndef __INTERPOLATIONPLANAR_HXX__ +#define __INTERPOLATIONPLANAR_HXX__ + +#include "Interpolation.hxx" +#include "PlanarIntersector.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "InterpolationOptions.hxx" + +namespace INTERP_KERNEL +{ + template + class InterpolationPlanar : public Interpolation< InterpolationPlanar > + { + private: + double _dim_caracteristic; + public: + InterpolationPlanar(); + InterpolationPlanar(const InterpolationOptions & io); + + // geometric precision, debug print level, choice of the median plane, intersection etc ... + void setOptions(double precision, int printLevel, + IntersectionType intersectionType, int orientation=0); + + // Main function to interpolate triangular and quadratic meshes + template + typename MyMeshType::MyConnType interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method); + public: + bool doRotate() const { return asLeafInterpPlanar().doRotate(); } + double medianPlane() const { return asLeafInterpPlanar().medianPlane(); } + template + void performAdjustmentOfBB(PlanarIntersector* intersector, std::vector& bbox) const + { return asLeafInterpPlanar().performAdjustmentOfBB(intersector,bbox); } + protected: + RealPlanar& asLeafInterpPlanar() { return static_cast(*this); } + const RealPlanar& asLeafInterpPlanar() const { return static_cast< const RealPlanar& >(*this); } + }; +} + +#endif diff --git a/src/INTERP_KERNEL/InterpolationPlanar.txx b/src/INTERP_KERNEL/InterpolationPlanar.txx old mode 100644 new mode 100755 index eb969ea3b..bf9481f87 --- a/src/INTERP_KERNEL/InterpolationPlanar.txx +++ b/src/INTERP_KERNEL/InterpolationPlanar.txx @@ -114,20 +114,20 @@ namespace INTERP_KERNEL */ template template - int InterpolationPlanar::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) + typename MyMeshType::MyConnType InterpolationPlanar::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method) { static const int SPACEDIM=MyMeshType::MY_SPACEDIM; typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; long global_start =clock(); - int counter=0; + std::size_t counter=0; /***********************************************************/ /* Check both meshes are made of triangles and quadrangles */ /***********************************************************/ - long nbMailleS=myMeshS.getNumberOfElements(); - long nbMailleT=myMeshT.getNumberOfElements(); + ConnType nbMailleS=myMeshS.getNumberOfElements(); + ConnType nbMailleT=myMeshT.getNumberOfElements(); /**************************************************/ /* Search the characteristic size of the meshes */ @@ -139,13 +139,13 @@ namespace INTERP_KERNEL if(nbMailleS!=0) { diagonalS=getDistanceBtw2Pts(BoxS+SPACEDIM,BoxS); - dimCaracteristicS=diagonalS/nbMailleS; + dimCaracteristicS=diagonalS/(double)(nbMailleS); } double diagonalT,dimCaracteristicT=std::numeric_limits::max(); if(nbMailleT!=0) { diagonalT=getDistanceBtw2Pts(BoxT+SPACEDIM,BoxT); - dimCaracteristicT=diagonalT/nbMailleT; + dimCaracteristicT=diagonalT/(double)(nbMailleT); } _dim_caracteristic=std::min(dimCaracteristicS, dimCaracteristicT); @@ -397,12 +397,12 @@ namespace INTERP_KERNEL /* Loop on the target cells - core of the algorithm */ /****************************************************/ long start_intersection=clock(); - long nbelem_type=myMeshT.getNumberOfElements(); + ConnType nbelem_type=myMeshT.getNumberOfElements(); const ConnType *connIndxT=myMeshT.getConnectivityIndexPtr(); - for(int iT=0; iT intersecting_elems; + ConnType nb_nodesT=connIndxT[iT+1]-connIndxT[iT]; + std::vector intersecting_elems; double bb[2*SPACEDIM]; intersector->getElemBB(bb,myMeshT,OTT::indFC(iT),nb_nodesT); my_tree.getIntersectingElems(bb, intersecting_elems); @@ -410,7 +410,7 @@ namespace INTERP_KERNEL counter+=intersecting_elems.size(); intersecting_elems.clear(); } - int ret=intersector->getNumberOfColsOfResMatrix(); + ConnType ret=intersector->getNumberOfColsOfResMatrix(); delete intersector; if (InterpolationOptions::getPrintLevel() >=1) diff --git a/src/INTERP_KERNEL/InterpolationUtils.hxx b/src/INTERP_KERNEL/InterpolationUtils.hxx index f40bd3351..abf55b698 100644 --- a/src/INTERP_KERNEL/InterpolationUtils.hxx +++ b/src/INTERP_KERNEL/InterpolationUtils.hxx @@ -170,7 +170,7 @@ namespace INTERP_KERNEL * @param quadOut is a 8 doubles array filled after the following call. */ template - inline void fillDualCellOfPolyg(const double *polygIn, int nPtsPolygonIn, double *polygOut) + inline void fillDualCellOfPolyg(const double *polygIn, mcIdType nPtsPolygonIn, double *polygOut) { //1st point std::copy(polygIn,polygIn+SPACEDIM,polygOut); @@ -179,7 +179,7 @@ namespace INTERP_KERNEL std::transform(polygOut+SPACEDIM,polygOut+2*SPACEDIM,polygOut+SPACEDIM,std::bind2nd(std::multiplies(),0.5)); double tmp[SPACEDIM]; // - for(int i=0;i()); std::transform(tmp,tmp+SPACEDIM,polygOut+(2*i+3)*SPACEDIM,std::bind2nd(std::multiplies(),0.5)); @@ -197,17 +197,17 @@ namespace INTERP_KERNEL inline std::vector bary_poly(const std::vector& V) { std::vector Bary; - long taille=V.size(); + std::size_t taille=V.size(); double x=0; double y=0; - for(long i=0;i(taille)); + double B=2*y/(static_cast(taille)); Bary.push_back(A);//taille vecteur=2*nb de points. Bary.push_back(B); @@ -801,9 +801,9 @@ namespace INTERP_KERNEL inline void verif_point_dans_vect(const double* P, std::vector& V, double absolute_precision ) { - long taille=V.size(); + std::size_t taille=V.size(); bool isPresent=false; - for(long i=0;i& V) { - long taille=V.size(); + std::size_t taille=V.size(); int A=0; - for(long i=0;i - inline void getElemBB(double* bb, const double *coordsOfMesh, int iP, int nb_nodes) + inline void getElemBB(double* bb, const double *coordsOfMesh, mcIdType iP, int nb_nodes) { bb[0]=std::numeric_limits::max(); bb[1]=-std::numeric_limits::max(); diff --git a/src/INTERP_KERNEL/Intersector3D.txx b/src/INTERP_KERNEL/Intersector3D.txx index 7cd83329b..47bec7ebf 100644 --- a/src/INTERP_KERNEL/Intersector3D.txx +++ b/src/INTERP_KERNEL/Intersector3D.txx @@ -37,7 +37,7 @@ namespace INTERP_KERNEL template void Intersector3D::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) const { - int nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT); + ConnType nbNodesT=_target_mesh.getNumberOfNodesOfElement(icellT); coordsT.resize(SPACEDIM*nbNodesT); std::vector::iterator iter=coordsT.begin(); for (ConnType iT=0; iT void Intersector3D::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) const { - int nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS); + ConnType nbNodesS=_src_mesh.getNumberOfNodesOfElement(icellS); coordsS.resize(SPACEDIM*nbNodesS); std::vector::iterator iter=coordsS.begin(); for (ConnType iS=0; iS::ind2C(icellS)]; ConnType end=myConIndexS[OTT::ind2C(icellS)+1]; - int nbNodesS=end-start; + ConnType nbNodesS=end-start; res.resize(nbNodesS); std::copy(myConectS+OTT::conn2C(start),myConectS+OTT::conn2C(end),res.begin()); } diff --git a/src/INTERP_KERNEL/Intersector3DP0P0.hxx b/src/INTERP_KERNEL/Intersector3DP0P0.hxx index ccb8ed349..987fd7f29 100644 --- a/src/INTERP_KERNEL/Intersector3DP0P0.hxx +++ b/src/INTERP_KERNEL/Intersector3DP0P0.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL { public: Intersector3DP0P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/Intersector3DP0P0.txx b/src/INTERP_KERNEL/Intersector3DP0P0.txx index 7b3db0bc5..86fed9bac 100644 --- a/src/INTERP_KERNEL/Intersector3DP0P0.txx +++ b/src/INTERP_KERNEL/Intersector3DP0P0.txx @@ -31,13 +31,13 @@ namespace INTERP_KERNEL } template - int Intersector3DP0P0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP0P0::getNumberOfRowsOfResMatrix() const { return Intersector3D::_target_mesh.getNumberOfElements(); } template - int Intersector3DP0P0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP0P0::getNumberOfColsOfResMatrix() const { return Intersector3D::_src_mesh.getNumberOfElements(); } diff --git a/src/INTERP_KERNEL/Intersector3DP0P1.hxx b/src/INTERP_KERNEL/Intersector3DP0P1.hxx index 0c599f04f..7032d1e11 100644 --- a/src/INTERP_KERNEL/Intersector3DP0P1.hxx +++ b/src/INTERP_KERNEL/Intersector3DP0P1.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL { public: Intersector3DP0P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/Intersector3DP0P1.txx b/src/INTERP_KERNEL/Intersector3DP0P1.txx index 62a632cae..f9e067da2 100644 --- a/src/INTERP_KERNEL/Intersector3DP0P1.txx +++ b/src/INTERP_KERNEL/Intersector3DP0P1.txx @@ -31,13 +31,13 @@ namespace INTERP_KERNEL } template - int Intersector3DP0P1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP0P1::getNumberOfRowsOfResMatrix() const { return Intersector3D::_target_mesh.getNumberOfNodes(); } template - int Intersector3DP0P1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP0P1::getNumberOfColsOfResMatrix() const { return Intersector3D::_src_mesh.getNumberOfElements(); } diff --git a/src/INTERP_KERNEL/Intersector3DP1P0.hxx b/src/INTERP_KERNEL/Intersector3DP1P0.hxx index fbaac7a69..3a310c801 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P0.hxx +++ b/src/INTERP_KERNEL/Intersector3DP1P0.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL { public: Intersector3DP1P0(const MyMeshType& targetMesh, const MyMeshType& srcMesh); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/Intersector3DP1P0.txx b/src/INTERP_KERNEL/Intersector3DP1P0.txx index 792607101..235babdfc 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P0.txx +++ b/src/INTERP_KERNEL/Intersector3DP1P0.txx @@ -31,13 +31,13 @@ namespace INTERP_KERNEL } template - int Intersector3DP1P0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P0::getNumberOfRowsOfResMatrix() const { return Intersector3D::_target_mesh.getNumberOfElements(); } template - int Intersector3DP1P0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P0::getNumberOfColsOfResMatrix() const { return Intersector3D::_src_mesh.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/Intersector3DP1P0Bary.hxx b/src/INTERP_KERNEL/Intersector3DP1P0Bary.hxx index 4871adf48..79532b6ea 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P0Bary.hxx +++ b/src/INTERP_KERNEL/Intersector3DP1P0Bary.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL { public: Intersector3DP1P0Bary(const MyMeshType& targetMesh, const MyMeshType& srcMesh); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/Intersector3DP1P0Bary.txx b/src/INTERP_KERNEL/Intersector3DP1P0Bary.txx index 4c8498e7a..40a20eee0 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P0Bary.txx +++ b/src/INTERP_KERNEL/Intersector3DP1P0Bary.txx @@ -31,13 +31,13 @@ namespace INTERP_KERNEL } template - int Intersector3DP1P0Bary::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P0Bary::getNumberOfRowsOfResMatrix() const { return Intersector3D::_target_mesh.getNumberOfElements(); } template - int Intersector3DP1P0Bary::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P0Bary::getNumberOfColsOfResMatrix() const { return Intersector3D::_src_mesh.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/Intersector3DP1P1.hxx b/src/INTERP_KERNEL/Intersector3DP1P1.hxx index e337bf471..b5c1374e7 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P1.hxx +++ b/src/INTERP_KERNEL/Intersector3DP1P1.hxx @@ -30,8 +30,8 @@ namespace INTERP_KERNEL { public: Intersector3DP1P1(const MyMeshType& targetMesh, const MyMeshType& srcMesh); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfRowsOfResMatrix() const; + typename MyMeshType::MyConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/Intersector3DP1P1.txx b/src/INTERP_KERNEL/Intersector3DP1P1.txx index 73bdbecb6..5e8947916 100644 --- a/src/INTERP_KERNEL/Intersector3DP1P1.txx +++ b/src/INTERP_KERNEL/Intersector3DP1P1.txx @@ -31,13 +31,13 @@ namespace INTERP_KERNEL } template - int Intersector3DP1P1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P1::getNumberOfRowsOfResMatrix() const { return Intersector3D::_target_mesh.getNumberOfNodes(); } template - int Intersector3DP1P1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Intersector3DP1P1::getNumberOfColsOfResMatrix() const { return Intersector3D::_src_mesh.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/IntersectorCU.hxx b/src/INTERP_KERNEL/IntersectorCU.hxx index e0b632964..32c3b888c 100644 --- a/src/INTERP_KERNEL/IntersectorCU.hxx +++ b/src/INTERP_KERNEL/IntersectorCU.hxx @@ -47,8 +47,8 @@ namespace INTERP_KERNEL void getUElemBB(double* bb, UConnType iP); void getUCoordinates(UConnType icell, std::vector& coords); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + CConnType getNumberOfRowsOfResMatrix() const; + CConnType getNumberOfColsOfResMatrix() const; void intersectCells(CConnType icellU, const std::vector& icellC, MyMatrix& res); double intersectGeometry(CConnType icellT, const std::vector& icellC) { return asLeaf().intersectGeometry(icellT,icellC); } protected: @@ -61,7 +61,7 @@ namespace INTERP_KERNEL const MyUMeshType& _meshU; const double * _coordsC[SPACEDIM]; - int _nbCellsC[SPACEDIM]; + CConnType _nbCellsC[SPACEDIM]; const MyCMeshType& _meshC; }; diff --git a/src/INTERP_KERNEL/IntersectorCU.txx b/src/INTERP_KERNEL/IntersectorCU.txx index fe9789b60..de1a4cd48 100644 --- a/src/INTERP_KERNEL/IntersectorCU.txx +++ b/src/INTERP_KERNEL/IntersectorCU.txx @@ -60,8 +60,9 @@ namespace INTERP_KERNEL for ( int j = 0; j < SPACEDIM; ++j ) { - _coordsC [ j ] = _meshC.getCoordsAlongAxis( _TMIC( j )); - _nbCellsC[ j ] = _meshC.nbCellsAlongAxis ( _TMIC( j )); + int axis = static_cast( _TMIC( j )); + _coordsC [ j ] = _meshC.getCoordsAlongAxis( axis ); + _nbCellsC[ j ] = static_cast(_meshC.nbCellsAlongAxis( axis )); } } @@ -123,14 +124,14 @@ namespace INTERP_KERNEL } _CU_TEMPLATE - int _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const + typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfRowsOfResMatrix() const { return _meshU.getNumberOfElements(); } _CU_TEMPLATE - int _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const + typename MyCMeshType::MyConnType _INTERSECTOR_CU_::getNumberOfColsOfResMatrix() const { - return _meshC.getNumberOfElements(); + return static_cast(_meshC.getNumberOfElements()); } //================================================================================ diff --git a/src/INTERP_KERNEL/IntersectorCU3D.txx b/src/INTERP_KERNEL/IntersectorCU3D.txx index 6b128dd29..7db6905bb 100644 --- a/src/INTERP_KERNEL/IntersectorCU3D.txx +++ b/src/INTERP_KERNEL/IntersectorCU3D.txx @@ -45,30 +45,30 @@ namespace INTERP_KERNEL public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=3; - typedef int MyConnType; + typedef mcIdType MyConnType; static const NumberingPolicy My_numPol=ALL_C_MODE; _Cartesian3D2UnstructHexMesh(const double * coords[3]): _coordsC(coords) {} - void setHexa(int I, int J, int K) // indices in C mode + void setHexa(mcIdType I, mcIdType J, mcIdType K) // indices in C mode { double* pCoord = _coordsU; - for ( int k = K; k < K+2; ++k ) - for ( int j = J; j < J+2; ++j ) - for ( int i = I; i < I+2; ++i ) + for ( mcIdType k = K; k < K+2; ++k ) + for ( mcIdType j = J; j < J+2; ++j ) + for ( mcIdType i = I; i < I+2; ++i ) { *pCoord++ = _coordsC[0][i]; *pCoord++ = _coordsC[1][j]; *pCoord++ = _coordsC[2][k]; } } - const int *getConnectivityPtr() const + const mcIdType *getConnectivityPtr() const { - static int conn[] = { 1,0,2,3,5,4,6,7 }; + static mcIdType conn[] = { 1,0,2,3,5,4,6,7 }; return conn; } - const int *getConnectivityIndexPtr() const + const mcIdType *getConnectivityIndexPtr() const { - static int conInd[] = { 0,8 }; + static mcIdType conInd[] = { 0,8 }; return conInd; } void getBoundingBox(double *boundingBox) const @@ -80,10 +80,10 @@ namespace INTERP_KERNEL boundingBox[BoundingBox::ZMIN] = _coordsU[2]; boundingBox[BoundingBox::ZMAX] = _coordsU[2+4*MY_SPACEDIM]; } - NormalizedCellType getTypeOfElement(int eltId) const { return NORM_HEXA8; } - unsigned char getNumberOfNodesOfElement(int eltId) const { return 8; } - unsigned long getNumberOfElements() const { return 1; } - unsigned long getNumberOfNodes() 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; } void releaseTempArrays() {} private: diff --git a/src/INTERP_KERNEL/MCIdType.hxx b/src/INTERP_KERNEL/MCIdType.hxx new file mode 100644 index 000000000..6accd369b --- /dev/null +++ b/src/INTERP_KERNEL/MCIdType.hxx @@ -0,0 +1,48 @@ +// Copyright (C) 2017-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +#ifndef __IK_MCIDTYPE_HXX__ +#define __IK_MCIDTYPE_HXX__ + +#include +#include +#include + +#ifndef MEDCOUPLING_USE_64BIT_IDS + +typedef std::int32_t mcIdType; + +#else + +typedef std::int64_t mcIdType; + +#endif + +template inline mcIdType ToIdType(T val) +{ + return static_cast(val); +} +template inline T FromIdType(mcIdType val) +{ + return static_cast(val); +} + + +#endif diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx index b9d525f8a..cef886d51 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.hxx @@ -36,8 +36,8 @@ namespace INTERP_KERNEL public: MappedBarycentric2DIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx index f399844d6..4939806e9 100644 --- a/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric2DIntersectorP1P1.txx @@ -43,7 +43,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -53,9 +53,9 @@ namespace INTERP_KERNEL PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT); + PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if( PointLocatorAlgos::isElementContainsPointAlg2D(&CoordsTTmp[nodeIdT*SPACEDIM],&CoordsS[0],4,PlanarIntersector::_precision) ) @@ -74,7 +74,7 @@ namespace INTERP_KERNEL resLoc[3] = mco[0] * (1.-mco[1]); const ConnType *startOfCellNodeConnS=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[*iter]); - for(int nodeIdS=0;nodeIdS<4;nodeIdS++) + for(ConnType nodeIdS=0;nodeIdS<4;nodeIdS++) { if(fabs(resLoc[nodeIdS])>PlanarIntersector::_precision) { @@ -96,13 +96,13 @@ namespace INTERP_KERNEL } template - int MappedBarycentric2DIntersectorP1P1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType MappedBarycentric2DIntersectorP1P1::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int MappedBarycentric2DIntersectorP1P1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType MappedBarycentric2DIntersectorP1P1::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx index 58011c946..da0488528 100644 --- a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx index 1835f3150..7015c26fa 100644 --- a/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/MappedBarycentric3DIntersectorP1P1.txx @@ -56,9 +56,9 @@ namespace INTERP_KERNEL std::vector CoordsT; const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; if(!resRow.empty()) @@ -72,7 +72,7 @@ namespace INTERP_KERNEL // std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double mco[3]; // mapped coordinates in the hexa8 std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/MeshElement.txx b/src/INTERP_KERNEL/MeshElement.txx old mode 100644 new mode 100755 index def308775..b3ab35764 --- a/src/INTERP_KERNEL/MeshElement.txx +++ b/src/INTERP_KERNEL/MeshElement.txx @@ -39,7 +39,7 @@ namespace INTERP_KERNEL template template MeshElement::MeshElement(const ConnType index, const MyMeshType& mesh) - : _index(index), _number(mesh.getNumberOfNodesOfElement(OTT::indFC(index))), _box(0) + : _index(index), _number((unsigned char)mesh.getNumberOfNodesOfElement(OTT::indFC(index))), _box(0) { const double**vertices = new const double*[_number]; diff --git a/src/INTERP_KERNEL/OrientationInverter.cxx b/src/INTERP_KERNEL/OrientationInverter.cxx index c23a75b90..e61f3af12 100644 --- a/src/INTERP_KERNEL/OrientationInverter.cxx +++ b/src/INTERP_KERNEL/OrientationInverter.cxx @@ -72,7 +72,7 @@ OrientationInverter *OrientationInverter::BuildInstanceFrom(NormalizedCellType g } } -void OrientationInverterChecker::check(int *beginPt, int *endPt) const +void OrientationInverterChecker::check(mcIdType *beginPt, mcIdType *endPt) const { if(std::distance(beginPt,endPt)!=getNbNodes()) { @@ -81,72 +81,72 @@ void OrientationInverterChecker::check(int *beginPt, int *endPt) const } } -void OrientationInverterSEG2::operateAndShutUp(int *beginPt) const +void OrientationInverterSEG2::operateAndShutUp(mcIdType *beginPt) const { std::swap(beginPt[0],beginPt[1]); } -void OrientationInverterSEG3::operateAndShutUp(int *beginPt) const +void OrientationInverterSEG3::operateAndShutUp(mcIdType *beginPt) const { std::swap(beginPt[0],beginPt[2]); } -void OrientationInverter2DLinear::operateAndShutUp(int *beginPt) const +void OrientationInverter2DLinear::operateAndShutUp(mcIdType *beginPt) const { std::reverse(beginPt+1,beginPt+getNbNodes()); } -void OrientationInverter2DQuadratic::operateAndShutUp(int *beginPt) const +void OrientationInverter2DQuadratic::operateAndShutUp(mcIdType *beginPt) const { int nbNodes(getNbNodes()); std::reverse(beginPt+1,beginPt+nbNodes/2); std::reverse(beginPt+nbNodes/2,beginPt+nbNodes); } -void OrientationInverterPolygon::operate(int *beginPt, int *endPt) const +void OrientationInverterPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const { std::reverse(beginPt+1,endPt); } -void OrientationInverterQPolygon::operate(int *beginPt, int *endPt) const +void OrientationInverterQPolygon::operate(mcIdType *beginPt, mcIdType *endPt) const { std::size_t sz(std::distance(beginPt,endPt)); std::reverse(beginPt+1,beginPt+sz/2); std::reverse(beginPt+sz/2,endPt); } -void OrientationInverterTetra4::operateAndShutUp(int *beginPt) const +void OrientationInverterTetra4::operateAndShutUp(mcIdType *beginPt) const { std::swap(beginPt[1],beginPt[2]); } -void OrientationInverterTetra10::operateAndShutUp(int *beginPt) const +void OrientationInverterTetra10::operateAndShutUp(mcIdType *beginPt) const { std::swap(beginPt[1],beginPt[2]); std::swap(beginPt[4],beginPt[6]); std::swap(beginPt[8],beginPt[9]); } -void OrientationInverterPyra5::operateAndShutUp(int *beginPt) const +void OrientationInverterPyra5::operateAndShutUp(mcIdType *beginPt) const { std::reverse(beginPt+1,beginPt+4); } -void OrientationInverterPyra13::operateAndShutUp(int *beginPt) const +void OrientationInverterPyra13::operateAndShutUp(mcIdType *beginPt) const { std::reverse(beginPt+1,beginPt+4); std::reverse(beginPt+5,beginPt+9); std::swap(beginPt[10],beginPt[12]); } -void OrientationInverter3DExtrusionLinear::operateAndShutUp(int *beginPt) const +void OrientationInverter3DExtrusionLinear::operateAndShutUp(mcIdType *beginPt) const { int nbNodes(getNbNodes()); std::reverse(beginPt+1,beginPt+nbNodes/2); std::reverse(beginPt+nbNodes/2+1,beginPt+nbNodes); } -void OrientationInverter3DExtrusionQuadratic::operateAndShutUp(int *beginPt) const +void OrientationInverter3DExtrusionQuadratic::operateAndShutUp(mcIdType *beginPt) const { int nbNodes(getNbNodes()),nbNodesLinearBase(nbNodes/5); std::reverse(beginPt+1,beginPt+nbNodesLinearBase); diff --git a/src/INTERP_KERNEL/OrientationInverter.hxx b/src/INTERP_KERNEL/OrientationInverter.hxx index 06653e419..5ab0ee629 100644 --- a/src/INTERP_KERNEL/OrientationInverter.hxx +++ b/src/INTERP_KERNEL/OrientationInverter.hxx @@ -23,6 +23,7 @@ #include "INTERPKERNELDefines.hxx" #include "NormalizedGeometricTypes" +#include "MCIdType.hxx" namespace INTERP_KERNEL { @@ -31,19 +32,19 @@ namespace INTERP_KERNEL public: INTERPKERNEL_EXPORT static OrientationInverter *BuildInstanceFrom(NormalizedCellType gt); INTERPKERNEL_EXPORT virtual ~OrientationInverter() { } - INTERPKERNEL_EXPORT virtual void operate(int *beginPt, int *endPt) const = 0; + INTERPKERNEL_EXPORT virtual void operate(mcIdType *beginPt, mcIdType *endPt) const = 0; }; class OrientationInverterChecker : public OrientationInverter { public: OrientationInverterChecker(unsigned nbNodes):_nb_nodes(nbNodes) { } - void operate(int *beginPt, int *endPt) const { check(beginPt,endPt); operateAndShutUp(beginPt); } - virtual void operateAndShutUp(int *beginPt) const = 0; + 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; } private: - void check(int *beginPt, int *endPt) const; + void check(mcIdType *beginPt, mcIdType *endPt) const; private: unsigned _nb_nodes; }; @@ -52,82 +53,82 @@ namespace INTERP_KERNEL { public: OrientationInverterSEG2():OrientationInverterChecker(2u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterSEG3 : public OrientationInverterChecker { public: OrientationInverterSEG3():OrientationInverterChecker(3u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter2DLinear : public OrientationInverterChecker { public: OrientationInverter2DLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter2DQuadratic : public OrientationInverterChecker { public: OrientationInverter2DQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPolygon : public OrientationInverter { public: - void operate(int *beginPt, int *endPt) const; + void operate(mcIdType *beginPt, mcIdType *endPt) const; }; class OrientationInverterQPolygon : public OrientationInverter { public: - void operate(int *beginPt, int *endPt) const; + void operate(mcIdType *beginPt, mcIdType *endPt) const; }; class OrientationInverterTetra4 : public OrientationInverterChecker { public: OrientationInverterTetra4():OrientationInverterChecker(4u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterTetra10 : public OrientationInverterChecker { public: OrientationInverterTetra10():OrientationInverterChecker(10u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPyra5 : public OrientationInverterChecker { public: OrientationInverterPyra5():OrientationInverterChecker(5u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverterPyra13 : public OrientationInverterChecker { public: OrientationInverterPyra13():OrientationInverterChecker(13u) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter3DExtrusionLinear : public OrientationInverterChecker { public: OrientationInverter3DExtrusionLinear(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; class OrientationInverter3DExtrusionQuadratic : public OrientationInverterChecker { public: OrientationInverter3DExtrusionQuadratic(unsigned nbNodes):OrientationInverterChecker(nbNodes) { } - void operateAndShutUp(int *beginPt) const; + void operateAndShutUp(mcIdType *beginPt) const; }; } diff --git a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx index 8f125a974..b59a9bb55 100644 --- a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.hxx @@ -37,8 +37,8 @@ namespace INTERP_KERNEL Planar2D1DIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; const typename PlanarIntersector::DuplicateFacesType* getIntersectFaces() const { return &_intersect_faces; diff --git a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx index ecc8c1e4c..5c85b45e7 100644 --- a/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/Planar2D1DIntersectorP0P0.txx @@ -33,13 +33,13 @@ namespace INTERP_KERNEL } template - int Planar2D1DIntersectorP0P0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType Planar2D1DIntersectorP0P0::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } template - int Planar2D1DIntersectorP0P0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType Planar2D1DIntersectorP0P0::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } @@ -47,12 +47,12 @@ namespace INTERP_KERNEL template void Planar2D1DIntersectorP0P0::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { - int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; + ConnType nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; typename MyMatrix::value_type& resRow=res[icellT]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType iS=*iter; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; bool isColinear = false; double surf=intersectGeometry1D(OTT::indFC(icellT),OTT::indFC(iS), nbNodesT,nbNodesS, isColinear); @@ -69,7 +69,7 @@ namespace INTERP_KERNEL } else { - std::set targetCellSet; + std::set targetCellSet; targetCellSet.insert(icellT); _intersect_faces.insert(std::make_pair(iS, targetCellSet)); } diff --git a/src/INTERP_KERNEL/PlanarIntersector.hxx b/src/INTERP_KERNEL/PlanarIntersector.hxx index ef35bbde9..f648c7533 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.hxx +++ b/src/INTERP_KERNEL/PlanarIntersector.hxx @@ -39,7 +39,7 @@ namespace INTERP_KERNEL static const int MESHDIM=MyMeshType::MY_MESHDIM; typedef typename MyMeshType::MyConnType ConnType; static const NumberingPolicy numPol=MyMeshType::My_numPol; - typedef typename std::map > DuplicateFacesType; + typedef typename std::map > DuplicateFacesType; public: PlanarIntersector(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); virtual ~PlanarIntersector(); @@ -47,17 +47,17 @@ namespace INTERP_KERNEL void adjustBoundingBoxes(std::vector& bbox, double surf3DAdjustmentEps, double surf3DAdjustmentEpsAbs); inline void getElemBB(double* bb, const MyMeshType& mesh, ConnType iP, ConnType nb_nodes); static int Projection(double *Coords_A, double *Coords_B, - int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate); + ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate); virtual const DuplicateFacesType* getIntersectFaces() const { return NULL; } protected : - int projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB); + int projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB); void getRealTargetCoordinates(ConnType icellT, std::vector& coordsT); void getRealSourceCoordinates(ConnType icellS, std::vector& coordsS); - void getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector& coordsT); - void getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector& coordsS); + void getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector& coordsT); + void getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector& coordsS); void getRealCoordinates(ConnType icellT, ConnType icellS, ConnType nbNodesT, ConnType nbNodesS, std::vector& coordsT, std::vector& coordsS, int& orientation); double getValueRegardingOption(double val) const; static void Rotate3DTriangle( double* PP1, double*PP2, double*PP3, diff --git a/src/INTERP_KERNEL/PlanarIntersector.txx b/src/INTERP_KERNEL/PlanarIntersector.txx index 22ac30f91..f5a9ae729 100644 --- a/src/INTERP_KERNEL/PlanarIntersector.txx +++ b/src/INTERP_KERNEL/PlanarIntersector.txx @@ -70,7 +70,7 @@ namespace INTERP_KERNEL int ibox=0; for(long icell=0; icell::max(); } //updating the bounding box with each node of the element - for (int j=0; j::coo2C(conn[OTT::conn2C(conn_index[icell]+j)]); for(int idim=0; idim::max(); for(int idim=0; idim void PlanarIntersector::getRealTargetCoordinates(ConnType icellT, std::vector& coordsT) { - int nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; + ConnType nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iT=0; iT void PlanarIntersector::getRealSourceCoordinates(ConnType icellS, std::vector& coordsS) { - int nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for (ConnType iS=0; iS - void PlanarIntersector::getRealTargetCoordinatesPermute(ConnType icellT, int offset, std::vector& coordsT) + void PlanarIntersector::getRealTargetCoordinatesPermute(ConnType icellT, ConnType offset, std::vector& coordsT) { - int nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; + ConnType nbNodesT=_connIndexT[OTT::ind2C(icellT)+1]-_connIndexT[OTT::ind2C(icellT)]; coordsT.resize(SPACEDIM*nbNodesT); for (ConnType iTTmp=0; iTTmp - void PlanarIntersector::getRealSourceCoordinatesPermute(ConnType icellS, int offset, std::vector& coordsS) + void PlanarIntersector::getRealSourceCoordinatesPermute(ConnType icellS, ConnType offset, std::vector& coordsS) { - int nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; + ConnType nbNodesS=_connIndexS[OTT::ind2C(icellS)+1]-_connIndexS[OTT::ind2C(icellS)]; coordsS.resize(SPACEDIM*nbNodesS); for (ConnType iSTmp=0; iSTmp - int PlanarIntersector::projectionThis(double *Coords_A, double *Coords_B, int nb_NodesA, int nb_NodesB) + int PlanarIntersector::projectionThis(double *Coords_A, double *Coords_B, ConnType nb_NodesA, ConnType nb_NodesB) { return Projection(Coords_A,Coords_B,nb_NodesA,nb_NodesB,_dim_caracteristic*_precision,_max_distance_3Dsurf_intersect,_min_dot_btw_3Dsurf_intersect,_median_plane,_do_rotate); } template int PlanarIntersector::Projection(double *Coords_A, double *Coords_B, - int nb_NodesA, int nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate) + ConnType nb_NodesA, ConnType nb_NodesB, double epsilon, double md3DSurf, double minDot3DSurf, double median_plane, bool do_rotate) { double normal_A[3]={0,0,0}; double normal_B[3]={0,0,0}; @@ -289,10 +289,10 @@ namespace INTERP_KERNEL bool same_orientation; //Find the normal to cells A and B - int i_A1(1); + ConnType i_A1(1); while(i_A1(Coords_A,&Coords_A[SPACEDIM*i_A1])< epsilon) i_A1++; - int i_A2(i_A1+1); + ConnType i_A2(i_A1+1); crossprod(Coords_A, &Coords_A[SPACEDIM*i_A1], &Coords_A[SPACEDIM*i_A2],normal_A); double normA(sqrt(dotprod(normal_A,normal_A))); while(i_A2(normal_A,normal_A)); } - int i_B1(1); + ConnType i_B1(1); while(i_B1(Coords_B,Coords_B+SPACEDIM*i_B1)< epsilon) i_B1++; - int i_B2(i_B1+1); + ConnType i_B2(i_B1+1); crossprod(Coords_B, Coords_B+SPACEDIM*i_B1, Coords_B+SPACEDIM*i_B2,normal_B); double normB(sqrt(dotprod(normal_B,normal_B))); while(i_B2(&Coords_A[SPACEDIM*i_A],linear_comb); for(int idim =0; idim< SPACEDIM; idim++) Coords_A[SPACEDIM*i_A+idim] -= proj*linear_comb[idim]; } - for(int i_B=0; i_B(Coords_B+SPACEDIM*i_B,linear_comb); for(int idim =0; idim< SPACEDIM; idim++) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx index 5b23d1862..9beb3c2db 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P0.hxx @@ -36,8 +36,8 @@ namespace INTERP_KERNEL protected: PlanarIntersectorP0P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); /*! * Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType. diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx index 478ff1c15..02d38c4df 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P0.txx @@ -33,13 +33,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP0P0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P0::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } template - int PlanarIntersectorP0P0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P0::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } @@ -47,12 +47,12 @@ namespace INTERP_KERNEL template void PlanarIntersectorP0P0::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { - int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; + ConnType nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; typename MyMatrix::value_type& resRow=res[icellT]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType iS=*iter; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; double surf=intersectGeometry(OTT::indFC(icellT),OTT::indFC(iS),nbNodesT,nbNodesS); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx index 15b897290..2095c2ce6 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1.hxx @@ -22,6 +22,7 @@ #define __PLANARINTERSECTORP0P1_HXX__ #include "PlanarIntersector.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { @@ -37,8 +38,8 @@ namespace INTERP_KERNEL PlanarIntersectorP0P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; /*! * Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType. */ diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx index 67d7f7913..25a38bb9a 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1.txx @@ -35,13 +35,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP0P1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int PlanarIntersectorP0P1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } @@ -52,13 +52,13 @@ namespace INTERP_KERNEL template void PlanarIntersectorP0P1::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { - int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; + ConnType nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; double triangle[9]; double quadrangle[12]; std::vector sourceCellCoords; int orientation=1; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); - for(int nodeIdT=0;nodeIdT::coo2C(startOfCellNodeConn[nodeIdT]); std::copy(PlanarIntersector::_coordsT+curNodeTInCmode*SPACEDIM, @@ -66,9 +66,9 @@ namespace INTERP_KERNEL typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; + ConnType iS=*iter; PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),sourceCellCoords); - for(int subTriT=1;subTriT<=nbNodesT-2;subTriT++) + for(ConnType subTriT=1;subTriT<=nbNodesT-2;subTriT++) { std::copy(PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM, PlanarIntersector::_coordsT+OTT::coo2C(startOfCellNodeConn[(nodeIdT+subTriT)%nbNodesT])*SPACEDIM+SPACEDIM, @@ -79,7 +79,7 @@ namespace INTERP_KERNEL fillDualCellOfTri(triangle,quadrangle); std::vector sourceCellCoordsTmp(sourceCellCoords); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&sourceCellCoordsTmp[0],quadrangle,sourceCellCoords.size()/SPACEDIM,4); + orientation=PlanarIntersector::projectionThis(&sourceCellCoordsTmp[0],quadrangle,ToConnType(sourceCellCoords.size())/SPACEDIM,4); NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(iS)); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,sourceCellCoordsTmp,CellModel::GetCellModel(tS).isQuadratic()); surf=PlanarIntersector::getValueRegardingOption(surf); diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx index 14a0ce60b..214cb98ff 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.hxx @@ -37,8 +37,8 @@ namespace INTERP_KERNEL PlanarIntersectorP0P1Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; /*! * Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType. */ diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx old mode 100644 new mode 100755 index 444e09670..63d735fff --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1Bary.txx @@ -42,20 +42,20 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numTrgElems = meshT.getNumberOfElements(); - for(unsigned long i = 0 ; i < numTrgElems ; ++i) + const ConnType numTrgElems = meshT.getNumberOfElements(); + for(ConnType i = 0 ; i < numTrgElems ; ++i) if ( meshT.getTypeOfElement( OTT::indFC( i )) != NORM_TRI3 ) throw INTERP_KERNEL::Exception("P0P1 barycentric algorithm works only with triangular target meshes"); } template - int PlanarIntersectorP0P1Bary::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1Bary::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int PlanarIntersectorP0P1Bary::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1Bary::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } @@ -76,12 +76,12 @@ namespace INTERP_KERNEL for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { std::vector srcCellCoords,srcCellCoordsTmp,nodeCeffs; - int iS=*iter; + ConnType iS=*iter; NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(iS)); bool isSourceQuad=CellModel::GetCellModel(tS).isQuadratic(); PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),srcCellCoords); std::vector *srcCoords(&srcCellCoords); - int srcNbNodes = srcCellCoords.size()/SPACEDIM; + ConnType srcNbNodes = ToConnType(srcCellCoords.size())/SPACEDIM; if(SPACEDIM==3) { srcCellCoordsTmp=srcCellCoords; diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx index c0b91f5d7..790982344 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.hxx @@ -36,8 +36,8 @@ namespace INTERP_KERNEL public: PlanarIntersectorP0P1PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx index 94631a14c..25de970a8 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP0P1PL.txx @@ -46,17 +46,17 @@ namespace INTERP_KERNEL const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); std::vector coordsTarget; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),coordsTarget); - int nbNodesT=coordsTarget.size()/SPACEDIM; + ConnType nbNodesT=ToConnType(coordsTarget.size())/SPACEDIM; ii=0; for(typename std::vector::const_iterator iter2=icellsS.begin();iter2!=icellsS.end();iter2++,ii++) { std::vector tmpSource(coordsOfSources[ii]); std::vector tmpTarget(coordsTarget); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&tmpSource[0],&tmpTarget[0],tmpSource.size()/SPACEDIM,nbNodesT); - for(int nodeIdT=0;nodeIdT::projectionThis(&tmpSource[0],&tmpTarget[0],ToConnType(tmpSource.size())/SPACEDIM,nbNodesT); + for(ConnType nodeIdT=0;nodeIdT::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],tmpSource.size()/SPACEDIM,PlanarIntersector::_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg2D(&tmpTarget[0]+nodeIdT*SPACEDIM,&tmpSource[0],ToConnType(tmpSource.size())/SPACEDIM,PlanarIntersector::_precision)) { ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConnT[nodeIdT]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; @@ -69,13 +69,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP0P1PL::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1PL::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int PlanarIntersectorP0P1PL::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP0P1PL::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfElements(); } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx index cbc7f7163..94630f709 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.hxx @@ -37,8 +37,8 @@ namespace INTERP_KERNEL PlanarIntersectorP1P0(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; /*! * Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType. */ diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx index 865435cce..48ec63802 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0.txx @@ -34,13 +34,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP1P0::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P0::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } template - int PlanarIntersectorP1P0::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P0::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } @@ -61,15 +61,15 @@ namespace INTERP_KERNEL typename MyMatrix::value_type& resRow=res[icellT]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType iS=*iter; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[iS]); - for(int nodeIdS=0;nodeIdS::coo2C(startOfCellNodeConn[nodeIdS]); std::copy(PlanarIntersector::_coordsS+curNodeSInCmode*SPACEDIM, PlanarIntersector::_coordsS+curNodeSInCmode*SPACEDIM+SPACEDIM,triangle); - for(int subTriS=1;subTriS<=nbNodesS-2;subTriS++) + for(ConnType subTriS=1;subTriS<=nbNodesS-2;subTriS++) { std::copy(PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM, PlanarIntersector::_coordsS+OTT::coo2C(startOfCellNodeConn[(nodeIdS+subTriS)%nbNodesS])*SPACEDIM+SPACEDIM, @@ -80,7 +80,7 @@ namespace INTERP_KERNEL fillDualCellOfTri(triangle,quadrangle); std::vector targetCellCoordsTmp(targetCellCoords); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,targetCellCoords.size()/SPACEDIM,4); + orientation=PlanarIntersector::projectionThis(&targetCellCoordsTmp[0],quadrangle,ToConnType(targetCellCoords.size())/SPACEDIM,4); double surf=orientation*intersectGeometryWithQuadrangle(quadrangle,targetCellCoordsTmp,isTargetQuad); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx index 60a3f7af6..25d149d42 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.hxx @@ -37,8 +37,8 @@ namespace INTERP_KERNEL PlanarIntersectorP1P0Bary(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; /*! * Contrary to intersectCells method here icellS and icellT are \b not in \b C mode but in mode of MyMeshType. */ diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index b63d9f50b..442177dd4 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0Bary.txx @@ -44,20 +44,20 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = meshS.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = meshS.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( meshS.getTypeOfElement( OTT::indFC( i )) != NORM_TRI3 ) throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with triangular source meshes"); } PLAN_INTER_TEMPLATE - int PLAN_INTERSECTOR::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PLAN_INTERSECTOR::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } PLAN_INTER_TEMPLATE - int PLAN_INTERSECTOR::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PLAN_INTERSECTOR::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } @@ -76,7 +76,7 @@ namespace INTERP_KERNEL // target cell data PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),tgtCellCoords); std::vector * tgtCoords = & tgtCellCoords; - int tgtNbNodes = tgtCellCoords.size()/SPACEDIM; + ConnType tgtNbNodes = ToConnType(tgtCellCoords.size())/SPACEDIM; NormalizedCellType tT=PlanarIntersector::_meshT.getTypeOfElement(OTT::indFC(icellT)); bool isTargetQuad=CellModel::GetCellModel(tT).isQuadratic(); @@ -85,7 +85,7 @@ namespace INTERP_KERNEL // treat each source triangle for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; + ConnType iS=*iter; PlanarIntersector::getRealSourceCoordinates(OTT::indFC(iS),srcTriaCoords); const ConnType *startOfCellNodeConn=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[iS]); if(SPACEDIM==3) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx index 8a14b069d..a01a10026 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.hxx @@ -36,8 +36,8 @@ namespace INTERP_KERNEL public: PlanarIntersectorP1P0PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx index 2989168f2..6cf35469b 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P0PL.txx @@ -46,7 +46,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); double baryT[SPACEDIM]; double baryTTmp[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT); for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -93,13 +93,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP1P0PL::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P0PL::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfElements(); } template - int PlanarIntersectorP1P0PL::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P0PL::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx index b4873ffd0..430771522 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.hxx @@ -37,8 +37,8 @@ namespace INTERP_KERNEL PlanarIntersectorP1P1(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double precision, double md3DSurf, double minDot3DSurf, double medianPlane, bool doRotate, int orientation, int printLevel); public: void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; double intersectGeometryGeneral(const std::vector& targetCoords, const std::vector& sourceCoords) { return asLeaf().intersectGeometryGeneral(targetCoords,sourceCoords); } protected: diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx index 14dfe0620..86791ab8b 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1.txx @@ -35,13 +35,13 @@ namespace INTERP_KERNEL } template - int PlanarIntersectorP1P1::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P1::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int PlanarIntersectorP1P1::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P1::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } @@ -52,33 +52,33 @@ namespace INTERP_KERNEL template void PlanarIntersectorP1P1::intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res) { - int nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; + ConnType nbNodesT=PlanarIntersector::_connIndexT[icellT+1]-PlanarIntersector::_connIndexT[icellT]; int orientation=1; const ConnType *startOfCellNodeConn=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); std::vector polygT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),polygT); - for(int nodeIdT=0;nodeIdT::coo2C(startOfCellNodeConn[nodeIdT]); PlanarIntersector::getRealTargetCoordinatesPermute(OTT::indFC(icellT),nodeIdT,polygT); std::vector polygDualT(SPACEDIM*2*(nbNodesT-1)); - fillDualCellOfPolyg(&polygT[0],polygT.size()/SPACEDIM,&polygDualT[0]); + fillDualCellOfPolyg(&polygT[0],ToConnType(polygT.size())/SPACEDIM,&polygDualT[0]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { - int iS=*iter; - int nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; + ConnType iS=*iter; + ConnType nbNodesS=PlanarIntersector::_connIndexS[iS+1]-PlanarIntersector::_connIndexS[iS]; const ConnType *startOfCellNodeConnS=PlanarIntersector::_connectS+OTT::conn2C(PlanarIntersector::_connIndexS[iS]); - for(int nodeIdS=0;nodeIdS::coo2C(startOfCellNodeConnS[nodeIdS]); std::vector polygS; PlanarIntersector::getRealSourceCoordinatesPermute(OTT::indFC(iS),nodeIdS,polygS); std::vector polygDualS(SPACEDIM*2*(nbNodesS-1)); - fillDualCellOfPolyg(&polygS[0],polygS.size()/SPACEDIM,&polygDualS[0]); + fillDualCellOfPolyg(&polygS[0],ToConnType(polygS.size())/SPACEDIM,&polygDualS[0]); std::vector polygDualTTmp(polygDualT); if(SPACEDIM==3) - orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],polygDualS.size()/SPACEDIM,polygDualT.size()/SPACEDIM); + orientation=PlanarIntersector::projectionThis(&polygDualS[0],&polygDualTTmp[0],ToConnType(polygDualS.size())/SPACEDIM,ToConnType(polygDualT.size())/SPACEDIM); double surf=orientation*intersectGeometryGeneral(polygDualTTmp,polygDualS); surf=PlanarIntersector::getValueRegardingOption(surf); if(surf!=0.) diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx index e85c337d8..724d7433b 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.hxx @@ -36,8 +36,8 @@ namespace INTERP_KERNEL public: PlanarIntersectorP1P1PL(const MyMeshType& meshT, const MyMeshType& meshS, double dimCaracteristic, double md3DSurf, double minDot3DSurf, double medianPlane, double precision, int orientation); void intersectCells(ConnType icellT, const std::vector& icellsS, MyMatrix& res); - int getNumberOfRowsOfResMatrix() const; - int getNumberOfColsOfResMatrix() const; + ConnType getNumberOfRowsOfResMatrix() const; + ConnType getNumberOfColsOfResMatrix() const; }; } diff --git a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx index a7235b54e..ed82199f6 100644 --- a/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx +++ b/src/INTERP_KERNEL/PlanarIntersectorP1P1PL.txx @@ -42,7 +42,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; PlanarIntersector::getRealTargetCoordinates(OTT::indFC(icellT),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + ConnType nbOfNodesT=ToConnType(CoordsT.size())/SPACEDIM; for(typename std::vector::const_iterator iter=icellsS.begin();iter!=icellsS.end();iter++) { NormalizedCellType tS=PlanarIntersector::_meshS.getTypeOfElement(OTT::indFC(*iter)); @@ -52,7 +52,7 @@ namespace INTERP_KERNEL PlanarIntersector::getRealSourceCoordinates(OTT::indFC(*iter),CoordsS); std::vector CoordsTTmp(CoordsT); if(SPACEDIM==3) - PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],CoordsS.size()/SPACEDIM,nbOfNodesT); + PlanarIntersector::projectionThis(&CoordsS[0],&CoordsTTmp[0],ToConnType(CoordsS.size())/SPACEDIM,nbOfNodesT); const ConnType *startOfCellNodeConnT=PlanarIntersector::_connectT+OTT::conn2C(PlanarIntersector::_connIndexT[icellT]); for(int nodeIdT=0;nodeIdT - int PlanarIntersectorP1P1PL::getNumberOfRowsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P1PL::getNumberOfRowsOfResMatrix() const { return PlanarIntersector::_meshT.getNumberOfNodes(); } template - int PlanarIntersectorP1P1PL::getNumberOfColsOfResMatrix() const + typename MyMeshType::MyConnType PlanarIntersectorP1P1PL::getNumberOfColsOfResMatrix() const { return PlanarIntersector::_meshS.getNumberOfNodes(); } diff --git a/src/INTERP_KERNEL/PointLocator2DIntersector.txx b/src/INTERP_KERNEL/PointLocator2DIntersector.txx index 54344d856..2202206ff 100644 --- a/src/INTERP_KERNEL/PointLocator2DIntersector.txx +++ b/src/INTERP_KERNEL/PointLocator2DIntersector.txx @@ -125,9 +125,9 @@ namespace INTERP_KERNEL INTERSECTOR_TEMPLATE QuadraticPolygon *PTLOC2D_INTERSECTOR::buildPolygonFrom(const std::vector& coords, NormalizedCellType type) { - int nbNodes=coords.size()/SPACEDIM; + std::size_t nbNodes=coords.size()/SPACEDIM; std::vector nodes(nbNodes); - for(int i=0;i CoordsT; Intersector3DP0P0::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); double bary[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,bary); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,bary); typename MyMatrix::value_type& resRow=res[targetCell]; const double *coordsS=Intersector3DP0P0::_src_mesh.getCoordinatesPtr(); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) @@ -67,7 +67,7 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP0P0::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if(PointLocatorAlgos::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg3D(bary,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision)) { resRow.insert(std::make_pair(OTT::indFC(*iterCellS),1)); } diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx index 66acfa483..731241310 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP0P1.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx index f96e28852..7acdefec9 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP0P1.txx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL { std::vector coordsTarget; Intersector3DP0P1::getRealTargetCoordinates(OTT::indFC(targetCell),coordsTarget); - int nbNodesT=coordsTarget.size()/SPACEDIM; + std::size_t nbNodesT=coordsTarget.size()/SPACEDIM; const double *coordsS=Intersector3DP0P1::_src_mesh.getCoordinatesPtr(); const ConnType *startOfCellNodeConnT=Intersector3DP0P1::getStartConnOfTargetCell(targetCell); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) @@ -63,9 +63,9 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP0P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - for(int nodeIdT=0;nodeIdT::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision)) + if(PointLocatorAlgos::isElementContainsPointAlg3D(&coordsTarget[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision)) { ConnType curNodeTInCmode=OTT::coo2C(startOfCellNodeConnT[nodeIdT]); typename MyMatrix::value_type& resRow=res[curNodeTInCmode]; diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx index b7826bd4f..439100f2c 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP1P0.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx index 44956c078..d85f6894d 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P0.txx @@ -57,7 +57,7 @@ namespace INTERP_KERNEL const double *coordsS=Intersector3DP1P0::_src_mesh.getCoordinatesPtr(); Intersector3DP1P0::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); double baryT[SPACEDIM]; - calculateBarycenterDyn2(&CoordsT[0],CoordsT.size()/SPACEDIM,baryT); + calculateBarycenterDyn2(&CoordsT[0],ToConnType(CoordsT.size())/SPACEDIM,baryT); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { NormalizedCellType tS=Intersector3DP1P0::_src_mesh.getTypeOfElement(OTT::indFC(*iterCellS)); @@ -66,7 +66,7 @@ namespace INTERP_KERNEL const CellModel& cmTypeS=CellModel::GetCellModel(tS); std::vector connOfCurCellS; Intersector3DP1P0::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(baryT,&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector srcCell; diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx index efea68659..4734af56e 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.hxx @@ -23,6 +23,7 @@ #include "Intersector3DP1P1.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "InterpKernelUtilities.hxx" namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx index c587e0102..5d7336bcc 100644 --- a/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PointLocator3DIntersectorP1P1.txx @@ -54,7 +54,7 @@ namespace INTERP_KERNEL { std::vector CoordsT; Intersector3DP1P1::getRealTargetCoordinates(OTT::indFC(targetCell),CoordsT); - int nbOfNodesT=CoordsT.size()/SPACEDIM; + std::size_t nbOfNodesT=CoordsT.size()/SPACEDIM; const double *coordsS=Intersector3DP1P1::_src_mesh.getCoordinatesPtr(); for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { @@ -63,12 +63,12 @@ namespace INTERP_KERNEL throw INTERP_KERNEL::Exception("Invalid source cell detected for meshdim==3. Only TETRA4 supported !"); const CellModel& cmTypeS=CellModel::GetCellModel(tS); const ConnType *startOfCellNodeConnT=Intersector3DP1P1::getStartConnOfTargetCell(targetCell); - for(int nodeIdT=0;nodeIdT::ind2C(startOfCellNodeConnT[nodeIdT])]; std::vector connOfCurCellS; Intersector3DP1P1::getConnOfSourceCell(OTT::indFC(*iterCellS),connOfCurCellS); - if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],connOfCurCellS.size(),coordsS,cmTypeS,_precision) ) + if( PointLocatorAlgos::isElementContainsPointAlg3D(&CoordsT[nodeIdT*SPACEDIM],&connOfCurCellS[0],ToConnType(connOfCurCellS.size()),coordsS,cmTypeS,_precision) ) { double resLoc[4]; std::vector localCoordsS; diff --git a/src/INTERP_KERNEL/PointLocatorAlgos.txx b/src/INTERP_KERNEL/PointLocatorAlgos.txx index 6a0498e72..1cf302acb 100644 --- a/src/INTERP_KERNEL/PointLocatorAlgos.txx +++ b/src/INTERP_KERNEL/PointLocatorAlgos.txx @@ -34,7 +34,7 @@ namespace INTERP_KERNEL { public: virtual ~GenericPointLocatorAlgos() { } - virtual std::list locates(const double* x, double eps) = 0; + virtual std::list locates(const double* x, double eps) = 0; }; template @@ -50,19 +50,19 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; const int SPACEDIM=MyMeshType::MY_SPACEDIM; const NumberingPolicy numPol=MyMeshType::My_numPol; - int nelem = _mesh.getNumberOfElements(); + ConnType nelem = _mesh.getNumberOfElements(); _bb = new double[SPACEDIM*2*nelem]; const ConnType* conn = _mesh.getConnectivityPtr(); const ConnType* conn_index = _mesh.getConnectivityIndexPtr(); const double* coords=_mesh.getCoordinatesPtr(); - for (int i=0; i::max(); _bb[2*(i*SPACEDIM+idim)+1]=-std::numeric_limits::max(); } - for (int index= conn_index[i]; index < conn_index[i+1];index++) + for (ConnType index= conn_index[i]; index < conn_index[i+1];index++) { //coordelem points to the coordinates of the current node of the i-th element const double* coordelem = coords+OTT::ind2C(conn[OTT::ind2C(index)])*SPACEDIM; @@ -95,14 +95,14 @@ namespace INTERP_KERNEL std::list retlist; for(unsigned int i=0; i< candidates.size(); i++) { - int ielem=candidates[i]; + ConnType ielem=candidates[i]; if (elementContainsPoint(ielem,x,eps)) retlist.push_back(OTT::indFC(ielem)); } return retlist; } - static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, int nbEdges, double eps) + static bool isElementContainsPointAlg2D(const double *ptToTest, const double *cellPts, mcIdType nbEdges, double eps) { /* with dimension 2, it suffices to check all the edges and see if the sign of double products from the point @@ -116,7 +116,7 @@ namespace INTERP_KERNEL here XA^XC and XC^XB have different signs*/ const int SPACEDIM=MyMeshType::MY_SPACEDIM; int* sign = new int[nbEdges]; - for (int iedge=0; iedge locates(const double* x, double eps) + virtual std::list locates(const double* x, double eps) { typedef typename MyMeshType::MyConnType ConnType; const NumberingPolicy numPol=MyMeshType::My_numPol; - std::list simplexNodes; - std::list candidates = PointLocatorAlgos::locates(x,eps); - std::list::iterator eIt = candidates.begin(); + std::list simplexNodes; + std::list candidates = PointLocatorAlgos::locates(x,eps); + typename std::list::iterator eIt = candidates.begin(); for ( ; eIt != candidates.end(); ++eIt ) { - const int i = OTT::ind2C( *eIt ); + const ConnType i = OTT::ind2C( *eIt ); const double* coords= _mesh.getCoordinatesPtr(); const ConnType* conn=_mesh.getConnectivityPtr(); const ConnType* conn_index= _mesh.getConnectivityIndexPtr(); @@ -279,14 +279,14 @@ namespace INTERP_KERNEL else { NormalizedCellType simlexType = cell.getDimension()==3 ? NORM_TETRA4 : NORM_TRI3; - std::vector sonNodes; + std::vector sonNodes; NormalizedCellType sonType; const unsigned nbSons = cell.getNumberOfSons2( conn_elem, conn_elem_sz ); for ( unsigned s = 0; s < nbSons; ++s ) { sonNodes.resize( cell.getNumberOfNodesConstituentTheSon2( s, conn_elem, conn_elem_sz )); cell.fillSonCellNodalConnectivity2( s, conn_elem, conn_elem_sz, &sonNodes[0], sonType ); - std::set sonNodesSet( sonNodes.begin(), sonNodes.end() ); + std::set sonNodesSet( sonNodes.begin(), sonNodes.end() ); std::set< std::set< ConnType > > checkedSonSimplex; for ( unsigned sn = 0; sn < sonNodes.size(); ++sn ) diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index 3bde89a9b..2eef9bdae 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -430,7 +430,7 @@ namespace INTERP_KERNEL while( !four_neighbours) { i_glob=(* mi1).second;//global index of vertex i - nb_prev = _Status.count(i_glob);//counts the number of segments ending at i + nb_prev = static_cast(_Status.count(i_glob));//counts the number of segments ending at i //std::cout<< "nb_prev= "<< nb_prev << " i_glob= " << i_glob << std::endl; switch (nb_prev) @@ -667,7 +667,7 @@ namespace INTERP_KERNEL } mi1++; i_glob=(* mi1).second;//global index of vertex i - nb_prev = _Status.count(i_glob); + nb_prev = static_cast(_Status.count(i_glob)); } } return _Inter; diff --git a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx index 73a536cc4..9f878479c 100644 --- a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx +++ b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.hxx @@ -36,7 +36,7 @@ namespace INTERP_KERNEL template class Polyhedron3D2DIntersectorP0P0 : public Intersector3DP0P0 { - typedef typename std::map > DuplicateFacesType; + typedef typename std::map > DuplicateFacesType; public: static const int SPACEDIM=MyMeshType::MY_SPACEDIM; diff --git a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx index ecc0ddb8d..a2ae9b7c4 100644 --- a/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx +++ b/src/INTERP_KERNEL/Polyhedron3D2DIntersectorP0P0.txx @@ -87,7 +87,7 @@ namespace INTERP_KERNEL const std::vector& srcCells, MyMatrixType& matrix) { - int nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)); + ConnType nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)); releaseArrays(); _split.splitTargetCell(targetCell,nbOfNodesT,_tetra); @@ -99,18 +99,18 @@ namespace INTERP_KERNEL // calculate the coordinates of the nodes typename MyMeshType::MyConnType cellSrc = *iterCellS; - int cellSrcIdx = OTT::indFC(cellSrc); + ConnType cellSrcIdx = OTT::indFC(cellSrc); NormalizedCellType normCellType=Intersector3D::_src_mesh.getTypeOfElement(cellSrcIdx); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); const MyMeshType& src_mesh = Intersector3D::_src_mesh; - unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes(); - int *polyNodes=new int[nbOfNodes4Type]; + ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? src_mesh.getNumberOfNodesOfElement(cellSrcIdx) : cellModelCell.getNumberOfNodes(); + 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 - const int globalNodeNum = getGlobalNumberOfNode(i, OTT::indFC(*iterCellS), src_mesh); - polyNodes[i] = globalNodeNum; + const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT::indFC(*iterCellS), src_mesh); + polyNodes[i] = ToIdType( globalNodeNum ); polyCoords[i] = const_cast(src_mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*globalNodeNum); } @@ -153,7 +153,7 @@ namespace INTERP_KERNEL } else { - std::set targetCellSet; + std::set targetCellSet; targetCellSet.insert(targetCell); _intersect_faces.insert(std::make_pair(cellSrcIdx, targetCellSet)); } diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx index eac117c24..baa5a50ef 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP0P1.txx @@ -91,7 +91,7 @@ namespace INTERP_KERNEL double volume = tmp->intersectSourceCell(*iterCellS); if(volume!=0.) { - int targetNodeId(tmp->getId(0)); + ConnType targetNodeId(tmp->getId(0)); if(targetNodeId<0) { std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" << targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !"; diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx index 85b4b58ae..b56f5f5ef 100644 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0.txx @@ -85,7 +85,7 @@ namespace INTERP_KERNEL for(typename std::vector::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++) { releaseArrays(); - int nbOfNodesS=Intersector3D::_src_mesh.getNumberOfNodesOfElement(OTT::indFC(*iterCellS)); + ConnType nbOfNodesS=Intersector3D::_src_mesh.getNumberOfNodesOfElement(OTT::indFC(*iterCellS)); _split.splitTargetCell(*iterCellS,nbOfNodesS,_tetra); for(typename std::vector*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter) { diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx old mode 100644 new mode 100755 index 87813b6ad..7084fd980 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P0Bary.txx @@ -55,8 +55,8 @@ namespace INTERP_KERNEL // Check types of source elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( srcMesh.getTypeOfElement( OTT::indFC(i) ) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P0 barycentric algorithm works only with tetrahedral source meshes"); } @@ -97,7 +97,7 @@ namespace INTERP_KERNEL { typename MyMatrix::value_type& resRow=res[tgtCell]; - int nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(tgtCell)); + ConnType nbOfNodesT=Intersector3D::_target_mesh.getNumberOfNodesOfElement(OTT::indFC(tgtCell)); releaseArrays(); _split.splitTargetCell(tgtCell,nbOfNodesT,_tetra); diff --git a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx old mode 100644 new mode 100755 index 38634d4ce..79731b9d3 --- a/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx +++ b/src/INTERP_KERNEL/PolyhedronIntersectorP1P1.txx @@ -46,13 +46,13 @@ namespace INTERP_KERNEL // Check types of elements here rather than in intersectCells() since a wrong type can be // found late after a long time of calculation. - const unsigned long numSrcElems = srcMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numSrcElems ; ++i) + const ConnType numSrcElems = srcMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numSrcElems ; ++i) if ( srcMesh.getTypeOfElement( OTT::indFC( i )) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes"); - const unsigned long numTgtElems = targetMesh.getNumberOfElements(); - for(unsigned long i = 0 ; i < numTgtElems ; ++i) + const ConnType numTgtElems = targetMesh.getNumberOfElements(); + for(ConnType i = 0 ; i < numTgtElems ; ++i) if ( targetMesh.getTypeOfElement( OTT::indFC( i )) != NORM_TETRA4 ) throw INTERP_KERNEL::Exception("P1P1 3D algorithm works only with tetrahedral meshes"); } @@ -79,8 +79,8 @@ namespace INTERP_KERNEL UnitTetraIntersectionBary b; b.init(); #endif // split the targetCell into dual cells - std::pair< int, std::vector > subTetraNodes[24]; // a node of sub tetra and its coordinates - const double* nodes[4]; int conn[4]; + std::pair< ConnType, std::vector > subTetraNodes[24]; // a node of sub tetra and its coordinates + const double* nodes[4]; ConnType conn[4]; for(int node = 0; node < 4 ; ++node) nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell), Intersector3D::_target_mesh,conn[node]); diff --git a/src/INTERP_KERNEL/SplitterTetra.cxx b/src/INTERP_KERNEL/SplitterTetra.cxx index 67eb81537..c906545d3 100644 --- a/src/INTERP_KERNEL/SplitterTetra.cxx +++ b/src/INTERP_KERNEL/SplitterTetra.cxx @@ -23,8 +23,8 @@ namespace INTERP_KERNEL { - void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords) + void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords) { if(std::distance(nodalConnBg,nodalConnEnd)!=8) throw INTERP_KERNEL::Exception("SplitHexa8IntoTetras : input hexa do not have 8 nodes !"); @@ -33,7 +33,7 @@ namespace INTERP_KERNEL case PLANAR_FACE_5: { tetrasNodalConn.resize(20); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[SPLIT_NODES_5_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_5_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_5_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_5_WO[3]]; conn[4]=nodalConnBg[SPLIT_NODES_5_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_5_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_5_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_5_WO[7]]; conn[8]=nodalConnBg[SPLIT_NODES_5_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_5_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_5_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_5_WO[11]]; @@ -44,7 +44,7 @@ namespace INTERP_KERNEL case PLANAR_FACE_6: { tetrasNodalConn.resize(24); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[SPLIT_NODES_6_WO[0]]; conn[1]=nodalConnBg[SPLIT_NODES_6_WO[1]]; conn[2]=nodalConnBg[SPLIT_NODES_6_WO[2]]; conn[3]=nodalConnBg[SPLIT_NODES_6_WO[3]]; conn[4]=nodalConnBg[SPLIT_NODES_6_WO[4]]; conn[5]=nodalConnBg[SPLIT_NODES_6_WO[5]]; conn[6]=nodalConnBg[SPLIT_NODES_6_WO[6]]; conn[7]=nodalConnBg[SPLIT_NODES_6_WO[7]]; conn[8]=nodalConnBg[SPLIT_NODES_6_WO[8]]; conn[9]=nodalConnBg[SPLIT_NODES_6_WO[9]]; conn[10]=nodalConnBg[SPLIT_NODES_6_WO[10]]; conn[11]=nodalConnBg[SPLIT_NODES_6_WO[11]]; @@ -57,7 +57,7 @@ namespace INTERP_KERNEL { addCoords.resize(7*3); tetrasNodalConn.resize(24*4); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); double *tmp(&addCoords[18]); tmp[0]=0.; tmp[1]=0.; tmp[2]=0.; double *tmp2(&addCoords[0]); @@ -66,7 +66,7 @@ namespace INTERP_KERNEL tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.; for(int j=0;j<4;j++,conn+=4) { - int 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]; @@ -97,13 +97,13 @@ namespace INTERP_KERNEL tmp2[1]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+1]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+1])/2.; tmp2[2]=(tmp[3*(GENERAL_48_SUB_NODES[2*i+24]-8)+2]+tmp[3*(GENERAL_48_SUB_NODES[2*i+25]-8)+2])/2.; } - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); std::vector dummy; for(int i=0;i<8;i++) { - std::vector c; + std::vector c; SplitHexa8IntoTetras(PLANAR_FACE_6,GENERAL_48_SUBZONES_2+i*8,GENERAL_48_SUBZONES_2+(i+1)*8,coords,c,dummy); - int *conn2(&c[0]); + mcIdType *conn2(&c[0]); for(int j=0;j<6;j++,conn+=4,conn2+=4) { conn[0]=conn2[0]>=0?nodalConnBg[conn2[0]]:conn2[0]; @@ -119,8 +119,8 @@ namespace INTERP_KERNEL } } - void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords) + void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords) { switch(gt) { @@ -143,7 +143,7 @@ namespace INTERP_KERNEL if(sz!=5) throw INTERP_KERNEL::Exception("SplitIntoTetras : input pyra5 do not have 5 nodes !"); tetrasNodalConn.resize(8); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[4]; conn[4]=nodalConnBg[0]; conn[5]=nodalConnBg[2]; conn[6]=nodalConnBg[3]; conn[7]=nodalConnBg[4]; return ; @@ -154,7 +154,7 @@ namespace INTERP_KERNEL if(sz!=6) throw INTERP_KERNEL::Exception("SplitIntoTetras : input penta6 do not have 6 nodes !"); tetrasNodalConn.resize(12); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[2]; conn[3]=nodalConnBg[3]; conn[4]=nodalConnBg[3]; conn[5]=nodalConnBg[5]; conn[6]=nodalConnBg[4]; conn[7]=nodalConnBg[2]; conn[8]=nodalConnBg[4]; conn[9]=nodalConnBg[2]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[3]; @@ -166,7 +166,7 @@ namespace INTERP_KERNEL if(sz!=12) throw INTERP_KERNEL::Exception("SplitIntoTetras : input octa12 (hexagone prism) do not have 12 nodes !"); tetrasNodalConn.resize(48); - int *conn(&tetrasNodalConn[0]); + mcIdType *conn(&tetrasNodalConn[0]); conn[0]=nodalConnBg[0]; conn[1]=nodalConnBg[1]; conn[2]=nodalConnBg[5]; conn[3]=nodalConnBg[6]; conn[4]=nodalConnBg[6]; conn[5]=nodalConnBg[11]; conn[6]=nodalConnBg[7]; conn[7]=nodalConnBg[5]; conn[8]=nodalConnBg[7]; conn[9]=nodalConnBg[5]; conn[10]=nodalConnBg[1]; conn[11]=nodalConnBg[6]; @@ -186,28 +186,30 @@ namespace INTERP_KERNEL } case NORM_POLYHED: { - std::size_t nbOfFaces(std::count(nodalConnBg,nodalConnEnd,-1)+1); - std::size_t nbOfTetra(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1); + mcIdType nbOfFaces(ToIdType(std::count(nodalConnBg,nodalConnEnd,-1)+1)); + mcIdType nbOfTetra(ToIdType(std::distance(nodalConnBg,nodalConnEnd)-nbOfFaces+1)); addCoords.resize((nbOfFaces+1)*3); tetrasNodalConn.resize(nbOfTetra*4); - int *conn(&tetrasNodalConn[0]); - const int *work(nodalConnBg); + mcIdType *conn(&tetrasNodalConn[0]); + const mcIdType *work(nodalConnBg); double *tmp(&addCoords[0]),*tmp2(&addCoords[3*nbOfFaces]); tmp2[0]=0.; tmp2[1]=0.; tmp2[2]=0.; - for(std::size_t i=0;i #include @@ -188,7 +189,7 @@ namespace INTERP_KERNEL 26,23,18,25,24,15,6,19 }; - static const int GENERAL_48_SUBZONES_2[64] = + static const mcIdType GENERAL_48_SUBZONES_2[64] = { 0,-1,-14,-5,-2,-13,-19,-15, -1,1,-6,-14,-13,-3,-16,-19, @@ -199,11 +200,11 @@ namespace INTERP_KERNEL -15,-19,-18,-10,-7,-17,-12,7, -19,-16,-11,-18,-17,-8,6,-12}; - void SplitHexa8IntoTetras(SplittingPolicy policy, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords); + void SplitHexa8IntoTetras(SplittingPolicy policy, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords); - INTERPKERNEL_EXPORT void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const int *nodalConnBg, const int *nodalConnEnd, const double *coords, - std::vector& tetrasNodalConn, std::vector& addCoords); + INTERPKERNEL_EXPORT void SplitIntoTetras(SplittingPolicy policy, NormalizedCellType gt, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, const double *coords, + std::vector& tetrasNodalConn, std::vector& addCoords); /** * \brief Class representing a triangular face, used as key in caching hash map in SplitterTetra. @@ -222,7 +223,7 @@ namespace INTERP_KERNEL * @param node2 global number of the second node of the face * @param node3 global number of the third node of the face */ - TriangleFaceKey(int node1, int node2, int node3) + TriangleFaceKey(mcIdType node1, mcIdType node2, mcIdType node3) { Sort3Ints(_nodes, node1, node2, node3); _hashVal = ( _nodes[0] + _nodes[1] + _nodes[2] ) % 29; @@ -268,30 +269,30 @@ namespace INTERP_KERNEL * * @return a hash value for the object */ - int hashVal() const + mcIdType hashVal() const { return _hashVal; } - inline static void Sort3Ints(int* sorted, int node1, int node2, int node3); + inline static void Sort3Ints(mcIdType* sorted, mcIdType node1, mcIdType node2, mcIdType node3); private: /// global numbers of the three nodes, sorted in ascending order - int _nodes[3]; + mcIdType _nodes[3]; /// hash value for the object, calculated in the constructor - int _hashVal; + mcIdType _hashVal; }; /** * Method to sort three integers in ascending order * - * @param sorted int[3] array in which to store the result + * @param sorted mcIdType[3] array in which to store the result * @param x1 first integer * @param x2 second integer * @param x3 third integer */ - inline void TriangleFaceKey::Sort3Ints(int* sorted, int x1, int x2, int x3) + inline void TriangleFaceKey::Sort3Ints(mcIdType* sorted, mcIdType x1, mcIdType x2, mcIdType x3) { if(x1 < x2) { @@ -343,7 +344,7 @@ namespace INTERP_KERNEL * @param key a TriangleFaceKey object * @return an integer hash value for key */ - int operator()(const INTERP_KERNEL::TriangleFaceKey& key) const + mcIdType operator()(const INTERP_KERNEL::TriangleFaceKey& key) const { return key.hashVal(); } @@ -360,18 +361,19 @@ namespace INTERP_KERNEL template class SplitterTetra { - public: + public: + typedef typename MyMeshType::MyConnType ConnType; SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId); - SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn = 0); + SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const ConnType *conn = 0); ~SplitterTetra(); double intersectSourceCell(typename MyMeshType::MyConnType srcCell, double* baryCentre=0); double intersectSourceFace(const NormalizedCellType polyType, - const int polyNodesNbr, - const int *const polyNodes, + const ConnType polyNodesNbr, + const ConnType *const polyNodes, const double *const *const polyCoords, const double dimCaracteristic, const double precision, @@ -380,19 +382,19 @@ namespace INTERP_KERNEL double intersectTetra(const double** tetraCorners); - typename MyMeshType::MyConnType getId(int id) { return _conn[id]; } + ConnType getId(mcIdType id) { return _conn[id]; } void splitIntoDualCells(SplitterTetra **output); - void splitMySelfForDual(double* output, int i, typename MyMeshType::MyConnType& nodeId); + void splitMySelfForDual(double* output, int i, ConnType& nodeId); void clearVolumesCache(); private: inline static void CheckIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL); inline static void CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL); - inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum); - inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node); + inline void calculateNode(ConnType globalNodeNum); + inline void calculateNode2(ConnType globalNodeNum, const double* node); inline void calculateVolume(TransformedTriangle& tri, const TriangleFaceKey& key); inline void calculateSurface(TransformedTriangle& tri, const TriangleFaceKey& key); @@ -415,7 +417,7 @@ namespace INTERP_KERNEL TetraAffineTransform* _t; /// HashMap relating node numbers to transformed nodes, used for caching - HashMap< int , double* > _nodes; + HashMap< ConnType , double* > _nodes; /// HashMap relating triangular faces to calculated volume contributions, used for caching HashMap< TriangleFaceKey, double > _volumes; @@ -424,7 +426,7 @@ namespace INTERP_KERNEL const MyMeshType& _src_mesh; // node id of the first node in target mesh in C mode. - typename MyMeshType::MyConnType _conn[4]; + ConnType _conn[4]; double _coords[12]; @@ -556,7 +558,7 @@ namespace INTERP_KERNEL inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node);//to suppress inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress //template - inline void calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts);//to suppress + inline void calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts);//to suppress private: const MyMeshTypeT& _target_mesh; const MyMeshTypeS& _src_mesh; @@ -576,7 +578,7 @@ namespace INTERP_KERNEL */ template //template - inline void SplitterTetra2::calcBarycenter(int n, double* barycenter, const typename MyMeshTypeT::MyConnType* pts) + inline void SplitterTetra2::calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts) { barycenter[0] = barycenter[1] = barycenter[2] = 0.0; for(int i = 0; i < n ; ++i) @@ -587,9 +589,9 @@ namespace INTERP_KERNEL barycenter[2] += pt[2]; } - barycenter[0] /= n; - barycenter[1] /= n; - barycenter[2] /= n; + barycenter[0] /= (double)n; + barycenter[1] /= (double)n; + barycenter[2] /= (double)n; } /** diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 83b2628f9..ce0136d99 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -99,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 int *conn): _t(0),_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; } @@ -121,7 +121,7 @@ namespace INTERP_KERNEL SplitterTetra::~SplitterTetra() { delete _t; - for(HashMap< int, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter) + for(typename HashMap< ConnType, double* >::iterator iter = _nodes.begin(); iter != _nodes.end() ; ++iter) delete[] iter->second; } @@ -191,17 +191,17 @@ namespace INTERP_KERNEL // get type of cell NormalizedCellType normCellType=_src_mesh.getTypeOfElement(OTT::indFC(element)); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); - unsigned nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT::indFC(element)) : cellModelCell.getNumberOfNodes(); + ConnType nbOfNodes4Type=cellModelCell.isDynamic() ? _src_mesh.getNumberOfNodesOfElement(OTT::indFC(element)) : cellModelCell.getNumberOfNodes(); // halfspace filtering bool isOutside[8] = {true, true, true, true, true, true, true, true}; bool isTargetOutside = false; // calculate the coordinates of the nodes - int *cellNodes=new int[nbOfNodes4Type]; - for(int i = 0;i<(int)nbOfNodes4Type;++i) + ConnType *cellNodes=new ConnType[nbOfNodes4Type]; + for(ConnType i = 0;i global numbers too, but not sure it is worth it - const int globalNodeNum = getGlobalNumberOfNode(i, OTT::indFC(element), _src_mesh); + const ConnType globalNodeNum = getGlobalNumberOfNode(i, OTT::indFC(element), _src_mesh); cellNodes[i]=globalNodeNum; if(_nodes.find(globalNodeNum) == _nodes.end()) { @@ -232,19 +232,19 @@ namespace INTERP_KERNEL // get nb of sons of a cell const ConnType* rawCellConn = _src_mesh.getConnectivityPtr() + OTT::conn2C( _src_mesh.getConnectivityIndexPtr()[ element ]); - const int rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ]; + const ConnType rawNbCellNodes = _src_mesh.getConnectivityIndexPtr()[ element+1 ] - _src_mesh.getConnectivityIndexPtr()[ element ]; unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes); for(unsigned ii = 0 ; ii < nbOfSons; ++ii) { // get sons connectivity NormalizedCellType faceType; - int *faceNodes, nbFaceNodes=-1; + ConnType *faceNodes, nbFaceNodes=-1; if ( cellModelCell.isDynamic() ) { - faceNodes=new int[nbOfNodes4Type]; + faceNodes=new ConnType[nbOfNodes4Type]; nbFaceNodes = cellModelCell.fillSonCellNodalConnectivity2(ii,rawCellConn,rawNbCellNodes,faceNodes,faceType); - for ( int i = 0; i < nbFaceNodes; ++i ) + for ( ConnType i = 0; i < nbFaceNodes; ++i ) faceNodes[i] = OTT::coo2C(faceNodes[i]); } else @@ -253,7 +253,7 @@ namespace INTERP_KERNEL const CellModel& faceModel=CellModel::GetCellModel(faceType); assert(faceModel.getDimension() == 2); nbFaceNodes = cellModelCell.getNumberOfNodesConstituentTheSon(ii); - faceNodes = new int[nbFaceNodes]; + faceNodes = new ConnType[nbFaceNodes]; cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes); } // intersect a son with the unit tetra @@ -326,8 +326,8 @@ namespace INTERP_KERNEL case NORM_POLYGON: { - int nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles - for ( int iTri = 0; iTri < nbTria; ++iTri ) + ConnType nbTria = nbFaceNodes - 2; // split polygon into nbTria triangles + for ( ConnType iTri = 0; iTri < nbTria; ++iTri ) { TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1+iTri], faceNodes[2+iTri]); if(_volumes.find(key) == _volumes.end()) @@ -589,8 +589,8 @@ namespace INTERP_KERNEL */ template double SplitterTetra::intersectSourceFace(const NormalizedCellType polyType, - const int polyNodesNbr, - const int *const polyNodes, + const ConnType polyNodesNbr, + const ConnType *const polyNodes, const double *const *const polyCoords, const double dimCaracteristic, const double precision, @@ -614,9 +614,9 @@ namespace INTERP_KERNEL bool isTargetOutside = false; // calculate the coordinates of the nodes - for(int i = 0;i<(int)polyNodesNbr;++i) + for(ConnType i = 0;i::releaseArrays() { // free potential sub-mesh nodes that have been allocated - typename MyMeshTypeT::MyConnType nbOfNodesT = _node_ids.size();// Issue 0020634. - if((int)_nodes.size()>=/*8*/nbOfNodesT) + if(_nodes.size()>=/*8*/_node_ids.size()) { + typename MyMeshTypeT::MyConnType nbOfNodesT = static_cast(_node_ids.size()); std::vector::iterator iter = _nodes.begin() + /*8*/nbOfNodesT; while(iter != _nodes.end()) { @@ -929,21 +929,22 @@ namespace INTERP_KERNEL template void SplitterTetra2::splitTargetCell2(typename MyMeshTypeT::MyConnType targetCell, typename std::vector< SplitterTetra* >& tetra) { - const int *refConn(_target_mesh.getConnectivityPtr()); - const int *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]); + typedef typename MyMeshTypeT::MyConnType TConnType; + const TConnType *refConn(_target_mesh.getConnectivityPtr()); + const TConnType *cellConn(refConn+_target_mesh.getConnectivityIndexPtr()[targetCell]); INTERP_KERNEL::NormalizedCellType gt(_target_mesh.getTypeOfElement(targetCell)); - std::vector tetrasNodalConn; + std::vector tetrasNodalConn; std::vector addCoords; const double *coords(_target_mesh.getCoordinatesPtr()); SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords); std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras); double tmp[12]; - int tmp2[4]; + typename MyMeshTypeS::MyConnType tmp2[4]; for(std::size_t i=0;i=0) { @@ -980,7 +981,7 @@ namespace INTERP_KERNEL _node_ids.resize(8); tetra.reserve(1); const double *nodes[4]; - int conn[4]; + ConnType conn[4]; for(int node = 0; node < 4 ; ++node) { nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell),_target_mesh,conn[node]); @@ -1061,7 +1062,7 @@ namespace INTERP_KERNEL for(int i = 0; i < 5; ++i) { const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int j = 0; j < 4; ++j) { conn[j] = subZone[ SPLIT_NODES_5[4*i+j] ]; @@ -1085,7 +1086,7 @@ namespace INTERP_KERNEL for(int i = 0; i < 6; ++i) { const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int j = 0; j < 4; ++j) { conn[j] = subZone[SPLIT_NODES_6[4*i+j]]; @@ -1112,7 +1113,7 @@ namespace INTERP_KERNEL // nodes to use for tetrahedron const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; // get the cell center conn[0] = 14; nodes[0] = getCoordsOfSubNode(conn[0]); @@ -1172,7 +1173,7 @@ namespace INTERP_KERNEL // create tetrahedra const double* nodes[4]; - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; for(int i = 0; i < 2; ++i) { for(int j = 0; j < 4; ++j) @@ -1198,24 +1199,24 @@ namespace INTERP_KERNEL // get type of cell and nb of cell nodes NormalizedCellType normCellType=_target_mesh.getTypeOfElement(OTT::indFC(targetCell)); const CellModel& cellModelCell=CellModel::GetCellModel(normCellType); - unsigned nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)) : cellModelCell.getNumberOfNodes(); + ConnType nbOfCellNodes=cellModelCell.isDynamic() ? _target_mesh.getNumberOfNodesOfElement(OTT::indFC(targetCell)) : cellModelCell.getNumberOfNodes(); // get nb of cell sons (faces) const ConnType* rawCellConn = _target_mesh.getConnectivityPtr() + OTT::conn2C( _target_mesh.getConnectivityIndexPtr()[ targetCell ]); - const int rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ]; + const ConnType rawNbCellNodes = _target_mesh.getConnectivityIndexPtr()[ targetCell+1 ] - _target_mesh.getConnectivityIndexPtr()[ targetCell ]; unsigned nbOfSons = cellModelCell.getNumberOfSons2(rawCellConn, rawNbCellNodes); // indices of nodes of a son - static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 - while ( allNodeIndices.size() < nbOfCellNodes ) - allNodeIndices.push_back( allNodeIndices.size() ); - std::vector classicFaceNodes(4); + static std::vector allNodeIndices; // == 0,1,2,...,nbOfCellNodes-1 + while ( allNodeIndices.size() < (std::size_t)nbOfCellNodes ) + allNodeIndices.push_back( static_cast(allNodeIndices.size()) ); + std::vector classicFaceNodes(4); if(cellModelCell.isQuadratic()) throw INTERP_KERNEL::Exception("SplitterTetra2::splitConvex : quadratic 3D cells are not implemented yet !"); - int* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0]; + ConnType* faceNodes = cellModelCell.isDynamic() ? &allNodeIndices[0] : &classicFaceNodes[0]; // nodes of tetrahedron - int conn[4]; + typename MyMeshTypeS::MyConnType conn[4]; const double* nodes[4]; nodes[3] = getCoordsOfSubNode2( nbOfCellNodes,conn[3]); // barycenter @@ -1260,7 +1261,7 @@ namespace INTERP_KERNEL { // retrieve real mesh nodes - typename MyMeshTypeT::MyConnType nbOfNodesT = _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 diff --git a/src/INTERP_KERNEL/TargetIntersector.hxx b/src/INTERP_KERNEL/TargetIntersector.hxx index 55fba1d65..aefeed0b5 100644 --- a/src/INTERP_KERNEL/TargetIntersector.hxx +++ b/src/INTERP_KERNEL/TargetIntersector.hxx @@ -46,8 +46,8 @@ namespace INTERP_KERNEL */ virtual void intersectCells(ConnType targetCell, const std::vector& srcCells, MyMatrix& res) = 0; - virtual int getNumberOfRowsOfResMatrix() const = 0; - virtual int getNumberOfColsOfResMatrix() const = 0; + virtual ConnType getNumberOfRowsOfResMatrix() const = 0; + virtual ConnType getNumberOfColsOfResMatrix() const = 0; virtual ~TargetIntersector() { } }; } diff --git a/src/INTERP_KERNEL/TransformedTriangleMath.cxx b/src/INTERP_KERNEL/TransformedTriangleMath.cxx index 6f896d28d..d55c994c9 100644 --- a/src/INTERP_KERNEL/TransformedTriangleMath.cxx +++ b/src/INTERP_KERNEL/TransformedTriangleMath.cxx @@ -146,7 +146,7 @@ namespace INTERP_KERNEL const long double delta = MULT_PREC_F * ( std::fabs(term1) + std::fabs(term2) ); - if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, THRESHOLD_F * delta)) + if( epsilonEqual(_doubleProducts[8*seg + dp], 0.0, (double)(THRESHOLD_F * delta))) { // debug output #if LOG_LEVEL >= 5 @@ -485,7 +485,7 @@ namespace INTERP_KERNEL const long double delta = MULT_PREC_F * (std::fabs(p_term) + std::fabs(q_term) + std::fabs(r_term)); #endif - if( epsilonEqual( p_term + q_term + r_term, 0.0, THRESHOLD_F * delta) ) + if( epsilonEqual( p_term + q_term + r_term, 0.0, (double)(THRESHOLD_F * delta)) ) { LOG(4, "Reset imprecise triple product for corner " << corner << " to zero" ); return 0.0; diff --git a/src/INTERP_KERNEL/TriangulationIntersector.txx b/src/INTERP_KERNEL/TriangulationIntersector.txx index 5efe430ff..365cda2cd 100644 --- a/src/INTERP_KERNEL/TriangulationIntersector.txx +++ b/src/INTERP_KERNEL/TriangulationIntersector.txx @@ -73,7 +73,7 @@ namespace INTERP_KERNEL &CoordsS[0],&CoordsS[SPACEDIM*iS],&CoordsS[SPACEDIM*(iS+1)], inter, PlanarIntersector::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i& sourceCoords) { double result = 0.; - ConnType nbNodesS=sourceCoords.size()/SPACEDIM; - ConnType nbNodesT=targetCoords.size()/SPACEDIM; + ConnType nbNodesS=ToConnType(sourceCoords.size())/SPACEDIM; + ConnType nbNodesT=ToConnType(targetCoords.size())/SPACEDIM; //Compute the intersection area double area[SPACEDIM]; for(ConnType iT = 1; iT::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i inter; @@ -202,7 +202,7 @@ namespace INTERP_KERNEL sourceCell[0], sourceCell[1], sourceCell[2], inter, PlanarIntersector::_dim_caracteristic, PlanarIntersector::_precision); - ConnType nb_inter=((ConnType)inter.size())/2; + ConnType nb_inter=ToConnType(inter.size())/2; if(nb_inter >3) inter=reconstruct_polygon(inter); for(ConnType i = 1; i #include namespace INTERP_KERNEL { - inline void calculateBarycenterDyn(const double **pts, int nbPts, + inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts, int dim, double *bary); - inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim); - inline double calculateAreaForQPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForQPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim); inline double calculateLgthForSeg2(const double *p1, const double *p2, int spaceDim) @@ -168,7 +169,7 @@ namespace INTERP_KERNEL // =================================== // Calculate Normal Vector for Polygon // =================================== - inline void calculateNormalForPolyg(const double **coords, int nbOfPtsInPolygs, + inline void calculateNormalForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, double *normal) { double coordOfBary[3]; @@ -203,14 +204,14 @@ namespace INTERP_KERNEL // ========================== // Calculate Area for Polygon // ========================== - inline double calculateAreaForPolyg(const double **coords, int nbOfPtsInPolygs, + inline double calculateAreaForPolyg(const double **coords, mcIdType nbOfPtsInPolygs, int spaceDim) { double ret=0.; double coordOfBary[3]; calculateBarycenterDyn(coords,nbOfPtsInPolygs,spaceDim,coordOfBary); - for ( int i=0; i nodes(nbOfPtsInPolygs); - for(int i=0;igetArea(); @@ -465,14 +466,14 @@ namespace INTERP_KERNEL * polyhedron */ template - inline double calculateVolumeForPolyh2(const ConnType *connec, int lgth, const double *coords) + inline double calculateVolumeForPolyh2(const ConnType *connec, mcIdType lgth, const double *coords) { std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1; double volume=0.; - const int *work=connec; + const ConnType *work=connec; for(std::size_t iFace=0;iFace - inline void areaVectorOfPolygon(const ConnType *connec, int lgth, const double *coords, double *res) + inline void areaVectorOfPolygon(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { res[0]=0.; res[1]=0.; res[2]=0.; - for(int ptId=0;ptId::coo2C(connec[ptId]); const double *pti1=coords+3*OTT::coo2C(connec[(ptId+1)%lgth]); @@ -510,7 +511,7 @@ namespace INTERP_KERNEL } template - inline void computePolygonBarycenter3D(const ConnType *connec, int lgth, const double *coords, double *res) + inline void computePolygonBarycenter3D(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { double area[3]; areaVectorOfPolygon(connec,lgth,coords,area); @@ -519,7 +520,7 @@ namespace INTERP_KERNEL { area[0]/=norm; area[1]/=norm; area[2]/=norm; res[0]=0.; res[1]=0.; res[2]=0.; - for(int i=1;i::coo2C(connec[(i+1)%lgth])]-coords[3*OTT::coo2C(connec[i])]; v[1]=coords[3*OTT::coo2C(connec[(i+1)%lgth])+1]-coords[3*OTT::coo2C(connec[i])+1]; @@ -569,13 +570,13 @@ namespace INTERP_KERNEL else { res[0]=0.; res[1]=0.; res[2]=0.; - for(int i=0;i::coo2C(connec[i])]; res[1]+=coords[3*OTT::coo2C(connec[i])+1]; res[2]+=coords[3*OTT::coo2C(connec[i])+2]; } - res[0]/=lgth; res[1]/=lgth; res[2]/=lgth; + res[0]/=FromIdType(lgth); res[1]/=FromIdType(lgth); res[2]/=FromIdType(lgth); return; } } @@ -588,14 +589,14 @@ namespace INTERP_KERNEL } template - inline void barycenterOfPolyhedron(const ConnType *connec, int lgth, const double *coords, double *res) + inline void barycenterOfPolyhedron(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { std::size_t nbOfFaces=std::count(connec,connec+lgth,-1)+1; res[0]=0.; res[1]=0.; res[2]=0.; - const int *work=connec; + const ConnType *work=connec; for(std::size_t i=0;i(work,nbOfNodesOfCurFace,coords,normal); @@ -755,39 +756,39 @@ namespace INTERP_KERNEL { } - inline void calculateBarycenterDyn(const double **pts, int nbPts, + inline void calculateBarycenterDyn(const double **pts, mcIdType nbPts, int dim, double *bary) { for(int i=0;i(nbPts); } } template - inline void calculateBarycenterDyn2(const double *pts, int nbPts, double *bary) + inline void calculateBarycenterDyn2(const double *pts, mcIdType nbPts, double *bary) { for(int i=0;i(nbPts); } } - inline void computePolygonBarycenter2DEngine(double **coords, int lgth, double *res) + inline void computePolygonBarycenter2DEngine(double **coords, mcIdType lgth, double *res) { double area=0.; res[0]=0.; res[1]=0.; - for(int i=0;i - inline void computePolygonBarycenter2D(const ConnType *connec, int lgth, const double *coords, double *res) + inline void computePolygonBarycenter2D(const ConnType *connec, mcIdType lgth, const double *coords, double *res) { double **coords2=new double *[lgth]; - for(int i=0;i(coords+2*OTT::coo2C(connec[i])); computePolygonBarycenter2DEngine(coords2,lgth,res); delete [] coords2; } - inline void computeQPolygonBarycenter2D(double **coords, int nbOfPtsInPolygs, int spaceDim, double *res) + inline void computeQPolygonBarycenter2D(double **coords, mcIdType nbOfPtsInPolygs, int spaceDim, double *res) { if(nbOfPtsInPolygs%2==0) { if(spaceDim==2) { std::vector nodes(nbOfPtsInPolygs); - for(int i=0;igetBarycenter(res); diff --git a/src/INTERP_KERNEL/VolSurfUser.cxx b/src/INTERP_KERNEL/VolSurfUser.cxx index 853e3226d..c8b01fd08 100644 --- a/src/INTERP_KERNEL/VolSurfUser.cxx +++ b/src/INTERP_KERNEL/VolSurfUser.cxx @@ -212,7 +212,7 @@ namespace INTERP_KERNEL return sqrt(sDist); } - double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords) + double DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords) { std::size_t nbOfEdges=std::distance(connOfPolygonBg,connOfPolygonEnd); if(nbOfEdges<3) diff --git a/src/INTERP_KERNEL/VolSurfUser.hxx b/src/INTERP_KERNEL/VolSurfUser.hxx index 03562790e..e37550344 100644 --- a/src/INTERP_KERNEL/VolSurfUser.hxx +++ b/src/INTERP_KERNEL/VolSurfUser.hxx @@ -24,20 +24,21 @@ #include "INTERPKERNELDefines.hxx" #include "InterpKernelException.hxx" #include "NormalizedUnstructuredMesh.hxx" +#include "MCIdType.hxx" namespace INTERP_KERNEL { template - double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords); + double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords); template - double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim); + double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim); template - void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res); + void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res); template - void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res); + void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res); double INTERPKERNEL_EXPORT OrthoDistanceFromPtToPlaneInSpaceDim3(const double *p, const double *p1, const double *p2, const double *p3); @@ -45,7 +46,7 @@ namespace INTERP_KERNEL double INTERPKERNEL_EXPORT DistanceFromPtToTriInSpaceDim3(const double *pt, const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3); - double INTERPKERNEL_EXPORT DistanceFromPtToPolygonInSpaceDim3(const double *pt, const int *connOfPolygonBg, const int *connOfPolygonEnd, const double *coords); + double INTERPKERNEL_EXPORT DistanceFromPtToPolygonInSpaceDim3(const double *pt, const mcIdType *connOfPolygonBg, const mcIdType *connOfPolygonEnd, const double *coords); bool ComputeRotTranslationMatrixToPut3PointsOnOXY(const double *pt0Tri3, const double *pt1Tri3, const double *pt2Tri3, double *matrix); } diff --git a/src/INTERP_KERNEL/VolSurfUser.txx b/src/INTERP_KERNEL/VolSurfUser.txx index cdcc00c1c..6e1512603 100644 --- a/src/INTERP_KERNEL/VolSurfUser.txx +++ b/src/INTERP_KERNEL/VolSurfUser.txx @@ -29,29 +29,29 @@ namespace INTERP_KERNEL { template - double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords) + double computeVolSurfOfCell(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords) { switch(type) { case INTERP_KERNEL::NORM_SEG2 : case INTERP_KERNEL::NORM_SEG4 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); return INTERP_KERNEL::calculateLgthForSeg2(coords+(SPACEDIM*N1),coords+(SPACEDIM*N2),SPACEDIM); } case INTERP_KERNEL::NORM_SEG3 : { - int beginNode = OTT::coo2C(connec[0]); - int endNode = OTT::coo2C(connec[1]); - int middleNode = OTT::coo2C(connec[2]); + ConnType beginNode = OTT::coo2C(connec[0]); + ConnType endNode = OTT::coo2C(connec[1]); + ConnType middleNode = OTT::coo2C(connec[2]); return INTERP_KERNEL::calculateLgthForSeg3(coords+(SPACEDIM*beginNode),coords+(SPACEDIM*endNode),coords+(SPACEDIM*middleNode),SPACEDIM); } case INTERP_KERNEL::NORM_TRI3 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); return INTERP_KERNEL::calculateAreaForTria(coords+(SPACEDIM*N1), coords+(SPACEDIM*N2), @@ -75,10 +75,10 @@ namespace INTERP_KERNEL break; case INTERP_KERNEL::NORM_QUAD4 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); - int N4 = OTT::coo2C(connec[3]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); + ConnType N4 = OTT::coo2C(connec[3]); return INTERP_KERNEL::calculateAreaForQuad(coords+SPACEDIM*N1, coords+SPACEDIM*N2, @@ -125,10 +125,10 @@ namespace INTERP_KERNEL case INTERP_KERNEL::NORM_TETRA4 : case INTERP_KERNEL::NORM_TETRA10 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); - int N4 = OTT::coo2C(connec[3]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); + ConnType N4 = OTT::coo2C(connec[3]); return INTERP_KERNEL::calculateVolumeForTetra(coords+SPACEDIM*N1, coords+SPACEDIM*N2, @@ -140,11 +140,11 @@ namespace INTERP_KERNEL case INTERP_KERNEL::NORM_PYRA5 : case INTERP_KERNEL::NORM_PYRA13 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); - int N4 = OTT::coo2C(connec[3]); - int N5 = OTT::coo2C(connec[4]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); + ConnType N4 = OTT::coo2C(connec[3]); + ConnType N5 = OTT::coo2C(connec[4]); return INTERP_KERNEL::calculateVolumeForPyra(coords+SPACEDIM*N1, coords+SPACEDIM*N2, @@ -158,12 +158,12 @@ namespace INTERP_KERNEL case INTERP_KERNEL::NORM_PENTA15 : case INTERP_KERNEL::NORM_PENTA18 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); - int N4 = OTT::coo2C(connec[3]); - int N5 = OTT::coo2C(connec[4]); - int N6 = OTT::coo2C(connec[5]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); + ConnType N4 = OTT::coo2C(connec[3]); + ConnType N5 = OTT::coo2C(connec[4]); + ConnType N6 = OTT::coo2C(connec[5]); return INTERP_KERNEL::calculateVolumeForPenta(coords+SPACEDIM*N1, coords+SPACEDIM*N2, @@ -178,14 +178,14 @@ namespace INTERP_KERNEL case INTERP_KERNEL::NORM_HEXA20 : case INTERP_KERNEL::NORM_HEXA27 : { - int N1 = OTT::coo2C(connec[0]); - int N2 = OTT::coo2C(connec[1]); - int N3 = OTT::coo2C(connec[2]); - int N4 = OTT::coo2C(connec[3]); - int N5 = OTT::coo2C(connec[4]); - int N6 = OTT::coo2C(connec[5]); - int N7 = OTT::coo2C(connec[6]); - int N8 = OTT::coo2C(connec[7]); + ConnType N1 = OTT::coo2C(connec[0]); + ConnType N2 = OTT::coo2C(connec[1]); + ConnType N3 = OTT::coo2C(connec[2]); + ConnType N4 = OTT::coo2C(connec[3]); + ConnType N5 = OTT::coo2C(connec[4]); + ConnType N6 = OTT::coo2C(connec[5]); + ConnType N7 = OTT::coo2C(connec[6]); + ConnType N8 = OTT::coo2C(connec[7]); return INTERP_KERNEL::calculateVolumeForHexa(coords+SPACEDIM*N1, coords+SPACEDIM*N2, @@ -199,7 +199,7 @@ namespace INTERP_KERNEL break; case INTERP_KERNEL::NORM_HEXGP12: { - const int connecHexa12[43]={ + const ConnType connecHexa12[43]={ OTT::coo2C(connec[0]),OTT::coo2C(connec[1]),OTT::coo2C(connec[2]),OTT::coo2C(connec[3]),OTT::coo2C(connec[4]),OTT::coo2C(connec[5]),-1, OTT::coo2C(connec[6]),OTT::coo2C(connec[11]),OTT::coo2C(connec[10]),OTT::coo2C(connec[9]),OTT::coo2C(connec[8]),OTT::coo2C(connec[7]),-1, OTT::coo2C(connec[0]),OTT::coo2C(connec[6]),OTT::coo2C(connec[7]),OTT::coo2C(connec[1]),-1, @@ -221,7 +221,7 @@ namespace INTERP_KERNEL } template - double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim) + double computeVolSurfOfCell2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim) { if(spaceDim==3) return computeVolSurfOfCell(type,connec,lgth,coords); @@ -234,7 +234,7 @@ namespace INTERP_KERNEL template - void computeBarycenter(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, double *res) + void computeBarycenter(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, double *res) { switch(type) { @@ -376,7 +376,7 @@ namespace INTERP_KERNEL } case NORM_HEXA8: { - const int conn[29]={ + const ConnType conn[29]={ OTT::coo2C(connec[0]),OTT::coo2C(connec[1]),OTT::coo2C(connec[2]),OTT::coo2C(connec[3]),-1, OTT::coo2C(connec[4]),OTT::coo2C(connec[7]),OTT::coo2C(connec[6]),OTT::coo2C(connec[5]),-1, OTT::coo2C(connec[0]),OTT::coo2C(connec[3]),OTT::coo2C(connec[7]),OTT::coo2C(connec[4]),-1, @@ -389,7 +389,7 @@ namespace INTERP_KERNEL } case NORM_PENTA6: { - const int conn[22]={ + const ConnType conn[22]={ OTT::coo2C(connec[0]),OTT::coo2C(connec[1]),OTT::coo2C(connec[2]),-1, OTT::coo2C(connec[3]),OTT::coo2C(connec[5]),OTT::coo2C(connec[4]),-1, OTT::coo2C(connec[0]),OTT::coo2C(connec[2]),OTT::coo2C(connec[5]),OTT::coo2C(connec[3]),-1, @@ -401,7 +401,7 @@ namespace INTERP_KERNEL } case INTERP_KERNEL::NORM_HEXGP12: { - const int connecHexa12[43]={ + const ConnType connecHexa12[43]={ OTT::coo2C(connec[0]),OTT::coo2C(connec[1]),OTT::coo2C(connec[2]),OTT::coo2C(connec[3]),OTT::coo2C(connec[4]),OTT::coo2C(connec[5]),-1, OTT::coo2C(connec[6]),OTT::coo2C(connec[11]),OTT::coo2C(connec[10]),OTT::coo2C(connec[9]),OTT::coo2C(connec[8]),OTT::coo2C(connec[7]),-1, OTT::coo2C(connec[0]),OTT::coo2C(connec[6]),OTT::coo2C(connec[7]),OTT::coo2C(connec[1]),-1, @@ -424,7 +424,7 @@ namespace INTERP_KERNEL } template - void computeBarycenter2(NormalizedCellType type, const ConnType *connec, int lgth, const double *coords, int spaceDim, double *res) + void computeBarycenter2(NormalizedCellType type, const ConnType *connec, mcIdType lgth, const double *coords, int spaceDim, double *res) { if(spaceDim==3) return computeBarycenter(type,connec,lgth,coords,res); diff --git a/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx b/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx index 0c57c80ba..1e7966b95 100644 --- a/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx +++ b/src/INTERP_KERNELTest/InterpolationPlanarTestSuite.hxx @@ -59,12 +59,12 @@ namespace INTERP_TEST bool checkDequesEqual(std::deque< double > deque1, std::deque< double > deque2, double epsilon) { - int size1 = deque1.size(); - int size2 = deque2.size(); + std::size_t size1 = deque1.size(); + std::size_t size2 = deque2.size(); bool are_equal = size1 == size2; if(are_equal) - for(int i = 0; i < size1 && are_equal; i++) + for(std::size_t i = 0; i < size1 && are_equal; i++) are_equal = fabs(deque1[i] - deque2[i]) < epsilon; return are_equal; @@ -72,19 +72,19 @@ namespace INTERP_TEST bool checkVectorsEqual(std::vector< double > vect1, std::vector< double > vect2, double epsilon) { - int size1 = vect1.size(); - int size2 = vect2.size(); + std::size_t size1 = vect1.size(); + std::size_t size2 = vect2.size(); bool are_equal = size1 == size2; if(are_equal) - for(int i = 0; i < size1 && are_equal; i++) + for(std::size_t i = 0; i < size1 && are_equal; i++) are_equal = fabs(vect1[i] - vect2[i]) < epsilon; return are_equal; } void dequePrintOut(std::deque< double > deque1) { - for(int i = 0; i< (int)deque1.size(); i++) + for(std::size_t i = 0; i< deque1.size(); i++) { std::cerr << deque1[i] << " "; } @@ -92,7 +92,7 @@ namespace INTERP_TEST } void vectPrintOut(std::vector< double > vect) { - for(int i = 0; i< (int)vect.size(); i++) + for(std::size_t i = 0; i< vect.size(); i++) { std::cerr << vect[i] << " "; } diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.hxx b/src/INTERP_KERNELTest/MeshTestToolkit.hxx index 39ab79a98..ff4cc7be2 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.hxx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.hxx @@ -29,7 +29,7 @@ #define ERR_TOL 1.0e-8 -typedef std::vector > IntersectionMatrix; +typedef std::vector > IntersectionMatrix; namespace INTERP_KERNEL { diff --git a/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/INTERP_KERNELTest/MeshTestToolkit.txx index b2e695a72..f934c1e8a 100644 --- a/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -70,7 +70,7 @@ namespace INTERP_TEST { if(iter->count(i) != 0.0) { - std::map::const_iterator iter2 = iter->find(i); + std::map::const_iterator iter2 = iter->find(i); vol += fabs(iter2->second); } } @@ -89,8 +89,8 @@ namespace INTERP_TEST double MeshTestToolkit::sumCol(const IntersectionMatrix& m, int i) const { double vol = 0.0; - const std::map& col = m[i]; - for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) + const std::map& col = m[i]; + for(std::map::const_iterator iter = col.begin() ; iter != col.end() ; ++iter) { vol += fabs(iter->second); } @@ -123,7 +123,7 @@ namespace INTERP_TEST std::vector volumes; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { volumes.push_back(fabs(iter2->second)); } @@ -203,9 +203,9 @@ namespace INTERP_TEST int i = 0; for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; if(m2.at(j).count(i) == 0) { if(!epsilonEqual(iter2->second, 0.0, _precision)) @@ -245,13 +245,13 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m1.begin() ; iter != m1.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; const double v1 = fabs(iter2->second); //if(m2[j - 1].count(i+1) > 0) // { - std::map theMap = m2.at(j); + std::map theMap = m2.at(j); const double v2 = fabs(theMap[i]); if(v1 != v2) { @@ -287,9 +287,9 @@ namespace INTERP_TEST bool isDiagonal = true; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - int j = iter2->first; + mcIdType j = iter2->first; const double vol = iter2->second; if(vol != 0.0 && (i != j)) { @@ -322,7 +322,7 @@ namespace INTERP_TEST std::cout << "Intersection matrix is " << std::endl; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl; } diff --git a/src/INTERP_KERNELTest/PerfTest.cxx b/src/INTERP_KERNELTest/PerfTest.cxx index 1d78aaf91..2b76b4eaf 100644 --- a/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/INTERP_KERNELTest/PerfTest.cxx @@ -106,7 +106,7 @@ namespace INTERP_TEST for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { numElems += iter->size(); - for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) + for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { if(!INTERP_KERNEL::epsilonEqual(iter2->second, 0.0, VOL_PREC)) { diff --git a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx index 2b0443eb2..c647bf1f7 100644 --- a/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx +++ b/src/INTERP_KERNELTest/ThreeDSurfProjectionTest.cxx @@ -19,6 +19,7 @@ #include "ThreeDSurfProjectionTest.hxx" #include "PlanarIntersector.txx" +#include "MCIdType.hxx" class MyMeshType { @@ -26,7 +27,7 @@ public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=3; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; - typedef int MyConnType; + typedef mcIdType MyConnType; }; class MyMatrixType diff --git a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx index 98bd5e21a..c58578451 100644 --- a/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetra3D2DIntersectionTest.cxx @@ -22,6 +22,7 @@ #include "TetraAffineTransform.hxx" #include "InterpolationUtils.hxx" #include "SplitterTetra.txx" +#include "MCIdType.hxx" #include @@ -31,13 +32,13 @@ namespace INTERP_TEST { struct __MESH_DUMMY { - typedef int MyConnType; + typedef mcIdType MyConnType; static const int MY_SPACEDIM=3; }; static SplitterTetra<__MESH_DUMMY>* buildSplitterTetra() { - const int conn[4] = { 0,1,2,3 }; + const mcIdType conn[4] = { 0,1,2,3 }; const double targetCoords[] = { -20., 0.,10., -20.,10.,10., @@ -53,7 +54,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_1() { - const int conn[4] = { 0,1,2 }; + const mcIdType conn[4] = { 0,1,2 }; const double sourceCoords[] = { -20., 0., 10., -12., 0., 10., @@ -98,7 +99,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_2() { - const int conn[4] = { 0,1,2,3 }; + const mcIdType conn[4] = { 0,1,2,3 }; const double sourceCoords[] = { -20., 0., 10., -12., 0., 10., @@ -144,7 +145,7 @@ namespace INTERP_TEST void UnitTetra3D2DIntersectionTest::test_UnitTetra3D2DIntersection_3() { - const int conn[4] = { 0,1,2 }; + const mcIdType conn[4] = { 0,1,2 }; const double sourceCoords[] = { -20., 0., 16., -18., 0., 16., diff --git a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx index 0b1df04a0..e1afe231e 100644 --- a/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx +++ b/src/INTERP_KERNELTest/UnitTetraIntersectionBaryTest.cxx @@ -27,6 +27,7 @@ #include "TetraAffineTransform.hxx" #include "InterpolationUtils.hxx" #include "SplitterTetra.txx" +#include "MCIdType.hxx" #include @@ -271,7 +272,7 @@ namespace INTERP_TEST struct __MESH_DUMMY { - typedef int MyConnType; + typedef mcIdType MyConnType; }; void UnitTetraIntersectionBaryTest::test_UnitTetraIntersectionBary_13() @@ -288,7 +289,7 @@ namespace INTERP_TEST 75,150,75, 100,100,100}; - int 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 }; diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index 04e0b5b3e..a2253b266 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -25,6 +25,10 @@ ENDIF(MEDCOUPLING_BUILD_TESTS) ### KILLER WARNINGS TO HELP INT64 MANAGEMENT #ADD_DEFINITIONS(-Wextra -Wsynth -Wno-unused-parameter -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreturn-type -Wno-endif-labels -Wsign-compare -Wmissing-format-attribute -Wno-multichar -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wlong-long -Wdisabled-optimization -Wunknown-pragmas -Wundef -Wreorder) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/../.. ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/MEDCoupling/MCType.hxx b/src/MEDCoupling/MCType.hxx index abc049dd1..32a82b709 100644 --- a/src/MEDCoupling/MCType.hxx +++ b/src/MEDCoupling/MCType.hxx @@ -21,25 +21,38 @@ #ifndef __MEDCOUPLING_MCTYPE_HXX__ #define __MEDCOUPLING_MCTYPE_HXX__ +#include "MCIdType.hxx" + #include #include #include namespace MEDCoupling { + using mcIdType = ::mcIdType; using Int64 = std::int64_t; using Int32 = std::int32_t; + + class DataArrayInt32; + class DataArrayInt32Iterator; + class DataArrayInt32Tuple; + class DataArrayInt64; + class DataArrayInt64Tuple; + #ifndef MEDCOUPLING_USE_64BIT_IDS - using mcIdType = std::int32_t; + +#define DataArrayIdType DataArrayInt32 +#define DataArrayIdTypeTuple DataArrayInt32Tuple + #else - using mcIdType = std::int64_t; + +#define DataArrayIdType DataArrayInt64 +#define DataArrayIdTypeTuple DataArrayInt64Tuple + #endif - inline mcIdType ToIdType(std::size_t val) { return mcIdType(val); } -} #define DataArrayInt DataArrayInt32 -#define DataArrayIdType DataArrayInt32 - #define DataArrayIntIterator DataArrayInt32Iterator +} #endif diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 074ec7987..80eb49f99 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -94,9 +94,9 @@ int MEDCoupling1GTUMesh::getMeshDimension() const * \param [in] type the geometric type * \return cell ids in this having geometric type \a type. */ -DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +DataArrayIdType *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); if(type==getCellModelEnum()) ret->alloc(getNumberOfCells(),1); else @@ -108,7 +108,7 @@ DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCe /*! * Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type. */ -std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { return type==getCellModelEnum()?getNumberOfCells():0; } @@ -119,7 +119,7 @@ std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::Normali * \return INTERP_KERNEL::NormalizedCellType - enumeration item describing the cell type. * \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ). */ -INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(std::size_t cellId) const +INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(mcIdType cellId) const { if(cellId MEDCoupling1GTUMesh::getAllGeoTypes( * For every k in [0,n] ret[3*k+2]==-1 because it has no sense here. * This parameter is kept only for compatibility with other method listed above. */ -std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const +std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const { - std::vector ret(3); - ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=-1; + std::vector ret(3); + ret[0]=ToIdType(getCellModelEnum()); ret[1]=getNumberOfCells(); ret[2]=-1; return ret; } @@ -178,28 +178,28 @@ std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile is NULL !"); if(profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::splitProfilePerType : input profile should have exactly one component !"); - int nbTuples(profile->getNumberOfTuples()),nbOfCells(getNumberOfCells()); + mcIdType nbTuples=profile->getNumberOfTuples(),nbOfCells=getNumberOfCells(); code.resize(3); idsInPflPerType.resize(1); - code[0]=(int)getCellModelEnum(); code[1]=nbTuples; + code[0]=ToIdType(getCellModelEnum()); code[1]=nbTuples; idsInPflPerType.resize(1); if(smartPflKiller && profile->isIota(nbOfCells)) { code[2]=-1; - idsInPflPerType[0]=const_cast(profile); idsInPflPerType[0]->incrRef(); + idsInPflPerType[0]=const_cast(profile); idsInPflPerType[0]->incrRef(); idsPerType.clear(); return ; } code[2]=0; profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); - idsPerType[0]=const_cast(profile); idsPerType[0]->incrRef(); - idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1); + idsPerType[0]=const_cast(profile); idsPerType[0]->incrRef(); + idsInPflPerType[0]=DataArrayIdType::Range(0,nbTuples,1); } /*! @@ -208,12 +208,12 @@ void MEDCoupling1GTUMesh::splitProfilePerType(const DataArrayInt *profile, std:: * * \sa MEDCouplingUMesh::checkTypeConsistencyAndContig */ -DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - int 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]!=(int)getCellModelEnum()) + if(code[0]!=ToIdType(getCellModelEnum())) { std::ostringstream oss; oss << "MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : Mismatch of geometric type ! Asking for " << code[0] << " whereas the geometric type is \a this is " << getCellModelEnum() << " (" << _cm->getRepr() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -231,15 +231,15 @@ DataArrayInt *MEDCoupling1GTUMesh::checkTypeConsistencyAndContig(const std::vect if(code[2]!=0) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : single geo type mesh ! 0 or -1 is expected at pos #2 of input code !"); if(idsPerType.size()!=1) - throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input code points to DataArrayInt #0 whereas the size of idsPerType is not equal to 1 !"); - const DataArrayInt *pfl=idsPerType[0]; + throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input code points to DataArrayIdType #0 whereas the size of idsPerType is not equal to 1 !"); + const DataArrayIdType *pfl=idsPerType[0]; if(!pfl) - throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayInt at rank 0 !"); + throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayIdType at rank 0 !"); if(pfl->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::checkTypeConsistencyAndContig : input profile should have exactly one component !"); pfl->checkAllIdsInRange(0,nbOfCells); pfl->incrRef(); - return const_cast(pfl); + return const_cast(pfl); } void MEDCoupling1GTUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const @@ -328,7 +328,7 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::getMeasureFieldOnNode(bool isAbs) c /*! * to improve perf ! */ -int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const +mcIdType MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) const { MCAuto m(buildUnstructured()); return m->getCellContainingPoint(pos,eps); @@ -337,7 +337,7 @@ int MEDCoupling1GTUMesh::getCellContainingPoint(const double *pos, double eps) c /*! * to improve perf ! */ -void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCoupling1GTUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { MCAuto m(buildUnstructured()); return m->getCellsContainingPoint(pos,eps,elts); @@ -351,25 +351,25 @@ MEDCouplingFieldDouble *MEDCoupling1GTUMesh::buildOrthogonalField() const return ret.retn(); } -DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const +DataArrayIdType *MEDCoupling1GTUMesh::getCellsInBoundingBox(const double *bbox, double eps) const { MCAuto m=buildUnstructured(); return m->getCellsInBoundingBox(bbox,eps); } -DataArrayInt *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) +DataArrayIdType *MEDCoupling1GTUMesh::getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) { MCAuto m=buildUnstructured(); return m->getCellsInBoundingBox(bbox,eps); } -MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const +MEDCouplingPointSet *MEDCoupling1GTUMesh::buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const { MCAuto m=buildUnstructured(); return m->buildFacePartOfMySelfNode(start,end,fullyIn); } -DataArrayInt *MEDCoupling1GTUMesh::findBoundaryNodes() const +DataArrayIdType *MEDCoupling1GTUMesh::findBoundaryNodes() const { MCAuto m=buildUnstructured(); return m->findBoundaryNodes(); @@ -381,15 +381,15 @@ MEDCouplingPointSet *MEDCoupling1GTUMesh::buildBoundaryMesh(bool keepCoords) con return m->buildBoundaryMesh(keepCoords); } -void MEDCoupling1GTUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const +void MEDCoupling1GTUMesh::findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const { MCAuto m=buildUnstructured(); m->findCommonCells(compType,startCellId,commonCellsArr,commonCellsIArr); } -std::size_t MEDCoupling1GTUMesh::getNodalConnectivityLength() const +mcIdType MEDCoupling1GTUMesh::getNodalConnectivityLength() const { - const DataArrayInt *c1(getNodalConnectivity()); + const DataArrayIdType *c1(getNodalConnectivity()); if(!c1) throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::getNodalConnectivityLength : no connectivity set !"); if(c1->getNumberOfComponents()!=1) @@ -423,7 +423,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v int meshDim(firstPart->getMeshDimension()); MCAuto ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription()); ret->setCoords(coords); - int nbOfCells(0),connSize(0); + mcIdType nbOfCells(0),connSize(0); for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) { if(!(*it)) @@ -435,19 +435,19 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v nbOfCells+=(*it)->getNumberOfCells(); connSize+=(*it)->getNodalConnectivityLength(); } - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); connI->alloc(nbOfCells+1,1); conn->alloc(connSize+nbOfCells,1); - int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; + mcIdType *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++) { - int curNbCells((*it)->getNumberOfCells()); - int geoType((int)(*it)->getCellModelEnum()); - const int *cinPtr((*it)->getNodalConnectivity()->begin()); + 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) { - int nNodesPerCell(ps->getNumberOfNodesPerCell()); + mcIdType nNodesPerCell(ps->getNumberOfNodesPerCell()); for(int i=0;igetNodalConnectivityIndex()->begin()); + const mcIdType *ciinPtr(pd->getNodalConnectivityIndex()->begin()); for(int i=0;ideepCopy(); } @@ -517,15 +517,15 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m) std::set gts(m->getAllGeoTypes()); if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !"); - int geoType((int)*gts.begin()); + mcIdType geoType(ToIdType(*gts.begin())); MCAuto ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - int nbCells(m->getNumberOfCells()); - int nbOfNodesPerCell(ret->getNumberOfNodesPerCell()); - MCAuto conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1); - int *c(conn->getPointer()); - const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); - for(int i=0;igetNumberOfCells(); + 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()); + for(mcIdType i=0;i ret(clone(false)); - MCAuto c(_conn->deepCopy()); + MCAuto c(_conn->deepCopy()); ret->setNodalConnectivity(c); return ret.retn(); } @@ -584,7 +584,7 @@ void MEDCoupling1SGTUMesh::shallowCopyConnectivityFrom(const MEDCouplingPointSet void MEDCoupling1SGTUMesh::updateTime() const { MEDCoupling1GTUMesh::updateTime(); - const DataArrayInt *c(_conn); + const DataArrayIdType *c(_conn); if(c) updateTimeWith(*c); } @@ -597,7 +597,7 @@ std::size_t MEDCoupling1SGTUMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDCoupling1SGTUMesh::getDirectChildrenWithNull() const { std::vector ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull()); - ret.push_back((const DataArrayInt *)_conn); + ret.push_back((const DataArrayIdType *)_conn); return ret; } @@ -619,7 +619,7 @@ bool MEDCoupling1SGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!MEDCoupling1GTUMesh::isEqualIfNotWhy(other,prec,reason)) return false; - const DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1==c2) return true; if(!c1 || !c2) @@ -629,7 +629,7 @@ bool MEDCoupling1SGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!c1->isEqualIfNotWhy(*c2,reason)) { - reason.insert(0,"Nodal connectivity DataArrayInt differ : "); + reason.insert(0,"Nodal connectivity DataArrayIdType differ : "); return false; } return true; @@ -644,7 +644,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o return false; if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec)) return false; - const DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1==c2) return true; if(!c1 || !c2) @@ -656,7 +656,7 @@ bool MEDCoupling1SGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o void MEDCoupling1SGTUMesh::checkConsistencyOfConnectivity() const { - const DataArrayInt *c1(_conn); + const DataArrayIdType *c1(_conn); if(c1) { if(c1->getNumberOfComponents()!=1) @@ -678,18 +678,18 @@ void MEDCoupling1SGTUMesh::checkConsistencyLight() const void MEDCoupling1SGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); - const DataArrayInt *c1(_conn); - int nbOfTuples=c1->getNumberOfTuples(); - int nbOfNodesPerCell=(int)_cm->getNumberOfNodes(); + const DataArrayIdType *c1(_conn); + 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()); } - int nbOfNodes=getNumberOfNodes(); - int nbOfCells=nbOfTuples/nbOfNodesPerCell; - const int *w(c1->begin()); - for(int i=0;ibegin()); + for(mcIdType i=0;i=nbOfNodes) @@ -700,10 +700,10 @@ void MEDCoupling1SGTUMesh::checkConsistency(double eps) const } } -std::size_t MEDCoupling1SGTUMesh::getNumberOfCells() const +mcIdType MEDCoupling1SGTUMesh::getNumberOfCells() const { - std::size_t nbOfTuples(getNodalConnectivityLength()); - int nbOfNodesPerCell(getNumberOfNodesPerCell()); + mcIdType nbOfTuples(getNodalConnectivityLength()); + mcIdType nbOfNodesPerCell(getNumberOfNodesPerCell()); if(nbOfTuples%nbOfNodesPerCell!=0) { std::ostringstream oss; oss << "MEDCoupling1SGTUMesh:getNumberOfCells: : the nb of tuples in conn is " << nbOfTuples << " and number of nodes per cell is " << nbOfNodesPerCell << ". But " << nbOfTuples << "%" << nbOfNodesPerCell << " !=0 !"; @@ -712,55 +712,55 @@ std::size_t MEDCoupling1SGTUMesh::getNumberOfCells() const return nbOfTuples/nbOfNodesPerCell; } -int MEDCoupling1SGTUMesh::getNumberOfNodesInCell(int cellId) const +mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const { return getNumberOfNodesPerCell(); } -int MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const +mcIdType MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const { checkNonDynamicGeoType(); - return (int)_cm->getNumberOfNodes(); + return _cm->getNumberOfNodes(); } -DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCoupling1SGTUMesh::computeNbOfNodesPerCell() const { checkNonDynamicGeoType(); - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(getNumberOfCells(),1); - ret->fillWithValue((int)_cm->getNumberOfNodes()); + ret->fillWithValue(_cm->getNumberOfNodes()); return ret.retn(); } -DataArrayInt *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCoupling1SGTUMesh::computeNbOfFacesPerCell() const { checkNonDynamicGeoType(); - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(getNumberOfCells(),1); - ret->fillWithValue((int)_cm->getNumberOfSons()); + ret->fillWithValue(ToIdType(_cm->getNumberOfSons())); return ret.retn(); } -DataArrayInt *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const +DataArrayIdType *MEDCoupling1SGTUMesh::computeEffectiveNbOfNodesPerCell() const { checkNonDynamicGeoType(); - MCAuto ret=DataArrayInt::New(); - int nbCells(getNumberOfCells()); + MCAuto ret=DataArrayIdType::New(); + mcIdType nbCells=getNumberOfCells(); ret->alloc(nbCells,1); - int *retPtr(ret->getPointer()); - int nbNodesPerCell(getNumberOfNodesPerCell()); - const int *conn(_conn->begin()); - for(int i=0;igetPointer()); + mcIdType nbNodesPerCell(getNumberOfNodesPerCell()); + const mcIdType *conn(_conn->begin()); + for(mcIdType i=0;i s(conn,conn+nbNodesPerCell); - *retPtr=(int)s.size(); + std::set s(conn,conn+nbNodesPerCell); + *retPtr=ToIdType(s.size()); } return ret.retn(); } -void MEDCoupling1SGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCoupling1SGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - int sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); conn.resize(sz); if(cellIdbegin()+cellId*sz,_conn->begin()+(cellId+1)*sz,conn.begin()); @@ -804,7 +804,7 @@ std::string MEDCoupling1SGTUMesh::simpleRepr() const else ret << msg0 << "\n"; ret << "Number of cells : "; - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) { if(_conn->isAllocated()) { @@ -833,19 +833,19 @@ std::string MEDCoupling1SGTUMesh::advancedRepr() const ret << "No array set !\n"; ret << "\n\nConnectivity array : \n____________________\n\n"; // - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) { if(_conn->isAllocated()) { if(_conn->getNumberOfComponents()==1) { - int nbOfCells=getNumberOfCells(); - int sz=getNumberOfNodesPerCell(); - const int *connPtr=_conn->begin(); - for(int i=0;ibegin(); + for(mcIdType i=0;i(ret," ")); + std::copy(connPtr,connPtr+sz,std::ostream_iterator(ret," ")); ret << "\n"; } } @@ -864,18 +864,18 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons { MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight() - int nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); const double *coor=_coords->begin(); - const int *nodal=_conn->begin(); - int sz=getNumberOfNodesPerCell(); - double coeff=1./(double)sz; - for(int i=0;ibegin(); + mcIdType sz=getNumberOfNodesPerCell(); + double coeff=1./FromIdType(sz); + for(mcIdType i=0;i=0 && *nodal()); else @@ -888,26 +888,26 @@ DataArrayDouble *MEDCoupling1SGTUMesh::computeIsoBarycenterOfNodesPerCell() cons return ret.retn(); } -void MEDCoupling1SGTUMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCoupling1SGTUMesh::renumberCells(const mcIdType *old2NewBg, bool check) { - int nbCells=getNumberOfCells(); - MCAuto o2n=DataArrayInt::New(); + mcIdType nbCells=getNumberOfCells(); + MCAuto o2n=DataArrayIdType::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) o2n=o2n->checkAndPreparePermutation(); // - const int *conn=_conn->begin(); - MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); - const int *n2oPtr=n2o->begin(); - MCAuto newConn=DataArrayInt::New(); + const mcIdType *conn=_conn->begin(); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); + const mcIdType *n2oPtr=n2o->begin(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConn->copyStringInfoFrom(*_conn); - int sz=getNumberOfNodesPerCell(); + mcIdType sz=getNumberOfNodesPerCell(); // - int *newC=newConn->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;i cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); - int tmp=-1; - int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; + mcIdType nbOfCells=getNumberOfCells(); + MCAuto cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); + mcIdType tmp=-1; + mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workbegin(); - int nbNodesPerCell=getNumberOfNodesPerCell(); - for(int i=0;ibegin(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType i=0;i=0) { ref++; @@ -964,18 +964,18 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const { MCAuto ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); - const int *nodalConn=_conn->begin(); - int nbCells=getNumberOfCells(); - int nbNodesPerCell=getNumberOfNodesPerCell(); - int geoType=(int)getCellModelEnum(); - MCAuto c=DataArrayInt::New(); c->alloc(nbCells*(nbNodesPerCell+1),1); - int *cPtr=c->getPointer(); - for(int i=0;ibegin(); + 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 cI=DataArrayInt::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); + MCAuto cI=DataArrayIdType::Range(0,(nbCells+1)*(nbNodesPerCell+1),nbNodesPerCell+1); ret->setConnectivity(c,cI,true); try { ret->copyTinyInfoFrom(this); } @@ -983,7 +983,7 @@ MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const return ret.retn(); } -DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy) +DataArrayIdType *MEDCoupling1SGTUMesh::simplexize(int policy) { switch(policy) { @@ -991,9 +991,9 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy) return simplexizePol0(); case 1: return simplexizePol1(); - case (int) INTERP_KERNEL::PLANAR_FACE_5: + case INTERP_KERNEL::PLANAR_FACE_5: return simplexizePlanarFace5(); - case (int) INTERP_KERNEL::PLANAR_FACE_6: + case INTERP_KERNEL::PLANAR_FACE_6: return simplexizePlanarFace6(); default: throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::simplexize : unrecognized policy ! Must be :\n - 0 or 1 (only available for meshdim=2) \n - PLANAR_FACE_5, PLANAR_FACE_6 (only for meshdim=3)"); @@ -1005,8 +1005,8 @@ DataArrayInt *MEDCoupling1SGTUMesh::simplexize(int policy) struct MEDCouplingAccVisit { MEDCouplingAccVisit():_new_nb_of_nodes(0) { } - int operator()(int val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; } - int _new_nb_of_nodes; + mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; } + mcIdType _new_nb_of_nodes; }; /// @endcond @@ -1014,21 +1014,21 @@ struct MEDCouplingAccVisit /*! * This method returns all node ids used in \b this. The data array returned has to be dealt by the caller. * The returned node ids are sortes ascendingly. This method is closed to MEDCoupling1SGTUMesh::getNodeIdsInUse except - * the format of returned DataArrayInt instance. + * the format of returned DataArrayIdType instance. * - * \return a newly allocated DataArrayInt sorted ascendingly of fetched node ids. + * \return a newly allocated DataArrayIdType sorted ascendingly of fetched node ids. * \sa MEDCoupling1SGTUMesh::getNodeIdsInUse, areAllNodesFetched */ -DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const +DataArrayIdType *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const { checkConsistencyOfConnectivity(); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - int *retPtr(ret->getPointer()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(sz,1); + mcIdType *retPtr(ret->getPointer()); + for(mcIdType i=0;igetNumberOfNodes(). It holds for each node of \a this mesh either -1 * if the node is unused or a new id else. The caller is to delete this * array using decrRef() as it is no more needed. @@ -1048,18 +1048,18 @@ DataArrayInt *MEDCoupling1SGTUMesh::computeFetchedNodeIds() const * \throw If the nodal connectivity includes an invalid id. * \sa MEDCoupling1SGTUMesh::computeFetchedNodeIds, areAllNodesFetched */ -DataArrayInt *MEDCoupling1SGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const +DataArrayIdType *MEDCoupling1SGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; - int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells(); - MCAuto ret(DataArrayInt::New()); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1); - int *traducer=ret->getPointer(); + mcIdType *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); - const int *conn=_conn->begin(); - int nbNodesPerCell=getNumberOfNodesPerCell(); - for(int i=0;ibegin(); + mcIdType nbNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType i=0;i=0 && *connapplyLin(1,offset); @@ -1089,23 +1089,23 @@ void MEDCoupling1SGTUMesh::renumberNodesWithOffsetInConn(int offset) } /*! - * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead + * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead * of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction * of a big mesh. */ -void MEDCoupling1SGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) +void MEDCoupling1SGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); } /*! - * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead + * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead * of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction * of a big mesh. */ -void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) +void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -1118,7 +1118,7 @@ void MEDCoupling1SGTUMesh::renumberNodesInConn(const std::map& newNodeN * See \ref numbering for more info on renumbering modes. * \throw If the nodal connectivity of cells is not defined. */ -void MEDCoupling1SGTUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) +void MEDCoupling1SGTUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N) { getNumberOfCells();//only to check that all is well defined. _conn->transformWithIndArr(newNodeNumbersO2N,newNodeNumbersO2N+getNumberOfNodes()); @@ -1149,15 +1149,15 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshes(std::vector > bb(sz); std::vector< const MEDCoupling1SGTUMesh * > aa(sz); - int spaceDim=-3; - for(std::size_t i=0;igetCoords(); if(coo) spaceDim=coo->getNumberOfComponents(); } - if(spaceDim==-3) + if(spaceDim==spaceDimUndef) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshes : no spaceDim specified ! unable to perform merge !"); for(std::size_t i=0;i::const_iterator it=a.begin(); if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords : null instance in the first element of input vector !"); - std::vector ncs(a.size()); + std::vector ncs(a.size()); (*it)->getNumberOfCells();//to check that all is OK const DataArrayDouble *coords=(*it)->getCoords(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); @@ -1197,7 +1197,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesOnSameCoords(std::ve } MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(coords); - ret->_conn=DataArrayInt::Aggregate(ncs); + ret->_conn=DataArrayIdType::Aggregate(ncs); return ret.retn(); } @@ -1209,9 +1209,9 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector::const_iterator it=a.begin(); - int nbOfCells=(*it)->getNumberOfCells(); + mcIdType nbOfCells=(*it)->getNumberOfCells(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); - int nbNodesPerCell=(*it)->getNumberOfNodesPerCell(); + mcIdType nbNodesPerCell=(*it)->getNumberOfNodesPerCell(); it++; for(;it!=a.end();it++) { @@ -1224,15 +1224,15 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector pts=MergeNodesArray(aps); MCAuto ret(new MEDCoupling1SGTUMesh("merge",*cm)); ret->setCoords(pts); - MCAuto c=DataArrayInt::New(); + MCAuto c=DataArrayIdType::New(); c->alloc(nbOfCells*nbNodesPerCell,1); - int *cPtr=c->getPointer(); - int offset=0; + mcIdType *cPtr=c->getPointer(); + mcIdType offset=0; for(it=a.begin();it!=a.end();it++) { - int curConnLgth=(*it)->getNodalConnectivityLength(); - const int *curC=(*it)->_conn->begin(); - cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus(),offset)); + mcIdType curConnLgth=(*it)->getNodalConnectivityLength(); + const mcIdType *curC=(*it)->_conn->begin(); + cPtr=std::transform(curC,curC+curConnLgth,cPtr,std::bind2nd(std::plus(),offset)); offset+=(*it)->getNumberOfNodes(); } // @@ -1240,17 +1240,17 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); - const int *inConn=_conn->getConstPointer(); - int sz=getNumberOfNodesPerCell(); - MCAuto connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); - int *connPtr=connRet->getPointer(); - for(const int *work=begin;work!=end;work++,connPtr+=sz) + const mcIdType *inConn=_conn->getConstPointer(); + 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) { if(*work>=0 && *work ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - const int *inConn=_conn->getConstPointer(); - int sz=getNumberOfNodesPerCell(); - MCAuto connRet=DataArrayInt::New(); connRet->alloc((int)nbOfElemsRet*sz,1); - int *connPtr=connRet->getPointer(); - int curId=start; - for(int i=0;igetConstPointer(); + mcIdType sz=getNumberOfNodesPerCell(); + MCAuto connRet=DataArrayIdType::New(); connRet->alloc(nbOfElemsRet*sz,1); + mcIdType *connPtr=connRet->getPointer(); + mcIdType curId=start; + for(mcIdType i=0;i=0 && curId& nodeIdsInUse) const { - int sz((int)nodeIdsInUse.size()); - for(const int *conn=_conn->begin();conn!=_conn->end();conn++) + mcIdType sz(ToIdType(nodeIdsInUse.size())); + for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++) { if(*conn>=0 && *conn& nodeIdsInUse) co } } -MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const +MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const { MCAuto ret(new MEDCoupling1SGTUMesh(getName(),*_cm)); - MCAuto tmp1; - const DataArrayInt *nodalConn(_conn); + MCAuto tmp1; + const DataArrayIdType *nodalConn(_conn); if(!nodalConn) { - tmp1=DataArrayInt::New(); tmp1->alloc(0,1); + tmp1=DataArrayIdType::New(); tmp1->alloc(0,1); } else tmp1=_conn; @@ -1328,16 +1328,16 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDi return ret.retn(); } -DataArrayInt *MEDCoupling1SGTUMesh::simplexizePol0() +DataArrayIdType *MEDCoupling1SGTUMesh::simplexizePol0() { - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); if(getCellModelEnum()!=INTERP_KERNEL::NORM_QUAD4) - return DataArrayInt::Range(0,nbOfCells,1); - MCAuto newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MCAuto ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); - const int *c(_conn->begin()); - int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); - for(int i=0;i newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(2*nbOfCells,1); + const mcIdType *c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); + for(mcIdType i=0;i newConn=DataArrayInt::New(); newConn->alloc(2*3*nbOfCells,1); - MCAuto ret=DataArrayInt::New(); ret->alloc(2*nbOfCells,1); - const int *c(_conn->begin()); - int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); - for(int i=0;i newConn=DataArrayIdType::New(); newConn->alloc(2*3*nbOfCells,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(2*nbOfCells,1); + const mcIdType *c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); + for(mcIdType i=0;i newConn=DataArrayInt::New(); newConn->alloc(5*4*nbOfCells,1); - MCAuto ret=DataArrayInt::New(); ret->alloc(5*nbOfCells,1); - const int *c(_conn->begin()); - int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); - for(int i=0;i newConn=DataArrayIdType::New(); newConn->alloc(5*4*nbOfCells,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(5*nbOfCells,1); + const mcIdType *c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); + for(mcIdType i=0;i newConn=DataArrayInt::New(); newConn->alloc(6*4*nbOfCells,1); - MCAuto ret=DataArrayInt::New(); ret->alloc(6*nbOfCells,1); - const int *c(_conn->begin()); - int *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); - for(int i=0;i newConn=DataArrayIdType::New(); newConn->alloc(6*4*nbOfCells,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(6*nbOfCells,1); + const mcIdType *c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()),*newConnPtr(newConn->getPointer()); + for(mcIdType i=0;igetNumberOfComponents() << "." << std::endl; stream << "Number of nodes : " << _coords->getNumberOfTuples() << "."; - if(!(const DataArrayInt *)_conn) + if(!(const DataArrayIdType *)_conn) { stream << std::endl << "Nodal connectivity NOT set !"; return ; } if(_conn->isAllocated()) { @@ -1433,19 +1433,19 @@ void MEDCoupling1SGTUMesh::reprQuickOverview(std::ostream& stream) const void MEDCoupling1SGTUMesh::checkFullyDefined() const { - if(!((const DataArrayInt *)_conn) || !((const DataArrayDouble *)_coords)) + if(!((const DataArrayIdType *)_conn) || !((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::checkFullyDefined : part of this is not fully defined."); } /*! * 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 !"); } -void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -1458,21 +1458,21 @@ void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& std::vector littleStrings2,littleStrings3; if((const DataArrayDouble *)_coords) _coords->getTinySerializationStrInformation(littleStrings2); - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) _conn->getTinySerializationStrInformation(littleStrings3); - int sz0((int)littleStrings2.size()),sz1((int)littleStrings3.size()); + mcIdType sz0(ToIdType(littleStrings2.size())),sz1(ToIdType(littleStrings3.size())); littleStrings.insert(littleStrings.end(),littleStrings2.begin(),littleStrings2.end()); littleStrings.insert(littleStrings.end(),littleStrings3.begin(),littleStrings3.end()); // tinyInfo.push_back(getCellModelEnum()); tinyInfo.push_back(it); tinyInfo.push_back(order); - std::vector tinyInfo2,tinyInfo3; + std::vector tinyInfo2,tinyInfo3; if((const DataArrayDouble *)_coords) _coords->getTinySerializationIntInformation(tinyInfo2); - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) _conn->getTinySerializationIntInformation(tinyInfo3); - int sz2((int)tinyInfo2.size()),sz3((int)tinyInfo3.size()); + mcIdType sz2(ToIdType(tinyInfo2.size())),sz3(ToIdType(tinyInfo3.size())); tinyInfo.push_back(sz0); tinyInfo.push_back(sz1); tinyInfo.push_back(sz2); tinyInfo.push_back(sz3); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); tinyInfo.insert(tinyInfo.end(),tinyInfo3.begin(),tinyInfo3.end()); @@ -1480,23 +1480,23 @@ void MEDCoupling1SGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCoupling1SGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - 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]); + 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); } -void MEDCoupling1SGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCoupling1SGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { - int sz(0); - if((const DataArrayInt *)_conn) + mcIdType sz(0); + if((const DataArrayIdType *)_conn) if(_conn->isAllocated()) sz=_conn->getNbOfElems(); - a1=DataArrayInt::New(); + a1=DataArrayIdType::New(); a1->alloc(sz,1); - if(sz!=0 && (const DataArrayInt *)_conn) + if(sz!=0 && (const DataArrayIdType *)_conn) std::copy(_conn->begin(),_conn->end(),a1->getPointer()); sz=0; if((const DataArrayDouble *)_coords) @@ -1508,7 +1508,7 @@ void MEDCoupling1SGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co std::copy(_coords->begin(),_coords->end(),a2->getPointer()); } -void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); @@ -1516,15 +1516,15 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector& tinyInfoD, setName(littleStrings[0]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); - setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]); - int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[1]),FromIdType(tinyInfo[2])); + mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]); // _coords=DataArrayDouble::New(); - std::vector 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=DataArrayInt::New(); - std::vector tinyInfo3(tinyInfo.begin()+7+sz2,tinyInfo.begin()+7+sz2+sz3); + _conn=DataArrayIdType::New(); + 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 littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); @@ -1549,7 +1549,7 @@ void MEDCoupling1SGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do 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 DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1==c2) return; if(!c1 || !c2) @@ -1575,18 +1575,18 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::mergeMyselfWithOnSameCoords(const MED return Merge1SGTUMeshesOnSameCoords(ms); } -void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { checkFullyDefined(); - int nbOfNodes=getNumberOfNodes(); - int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int)); + 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 int *conn=_conn->begin(); - int nbOfCells=getNumberOfCells(); - int nbOfEltsInRevNodal=0; - int nbOfNodesPerCell=getNumberOfNodesPerCell(); - for(int eltId=0;eltIdbegin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfEltsInRevNodal=0; + mcIdType nbOfNodesPerCell=getNumberOfNodesPerCell(); + for(mcIdType eltId=0;eltId()); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); conn=_conn->begin(); - int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int)); + mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); - for(int eltId=0;eltId(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*conn],revNodalPtr+revNodalIndxPtr[*conn+1],std::bind2nd(std::equal_to(),-1))=eltId; } } } @@ -1619,7 +1619,7 @@ void MEDCoupling1SGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, D /*! * Use \a nodalConn array as nodal connectivity of \a this. The input \a nodalConn pointer can be null. */ -void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn) +void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayIdType *nodalConn) { if(nodalConn) nodalConn->incrRef(); @@ -1628,12 +1628,12 @@ void MEDCoupling1SGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn) } /*! - * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it. + * \return DataArrayIdType * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it. */ -DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const +DataArrayIdType *MEDCoupling1SGTUMesh::getNodalConnectivity() const { - const DataArrayInt *ret(_conn); - return const_cast(ret); + const DataArrayIdType *ret(_conn); + return const_cast(ret); } /*! @@ -1643,11 +1643,11 @@ DataArrayInt *MEDCoupling1SGTUMesh::getNodalConnectivity() const * * \param [in] nbOfCells - estimation of the number of cell \a this mesh will contain. */ -void MEDCoupling1SGTUMesh::allocateCells(int nbOfCells) +void MEDCoupling1SGTUMesh::allocateCells(mcIdType nbOfCells) { if(nbOfCells<0) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::allocateCells : the input number of cells should be >= 0 !"); - _conn=DataArrayInt::New(); + _conn=DataArrayIdType::New(); _conn->reserve(getNumberOfNodesPerCell()*nbOfCells); declareAsNew(); } @@ -1661,13 +1661,13 @@ void MEDCoupling1SGTUMesh::allocateCells(int nbOfCells) * attached to \a this. * \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before). */ -void MEDCoupling1SGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd) +void MEDCoupling1SGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) { - int sz=(int)std::distance(nodalConnOfCellBg,nodalConnOfCellEnd); - int ref=getNumberOfNodesPerCell(); + mcIdType sz=ToIdType(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd)); + mcIdType ref=getNumberOfNodesPerCell(); if(sz==ref) { - DataArrayInt *c(_conn); + DataArrayIdType *c(_conn); if(c) c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd); else @@ -1717,12 +1717,12 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4() const const INTERP_KERNEL::CellModel& cm(getCellModel()); if(cm.getEnum()!=INTERP_KERNEL::NORM_HEXA8) throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !"); - int nbHexa8(getNumberOfCells()); - const int *inConnPtr(getNodalConnectivity()->begin()); + mcIdType nbHexa8=getNumberOfCells(); + const mcIdType *inConnPtr(getNodalConnectivity()->begin()); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4)); - MCAuto c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1); - int *cPtr(c->getPointer()); - for(int i=0;i c(DataArrayIdType::New()); c->alloc(nbHexa8*6*4,1); + mcIdType *cPtr(c->getPointer()); + for(mcIdType i=0;igetNumberOfNodes() * \return MEDCouplingCMesh * - a newly allocated mesh that is the result of the structurization of \a this. */ -MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, DataArrayInt *& nodePerm, double eps) const +MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayIdType *& cellPerm, DataArrayIdType *& nodePerm, double eps) const { checkConsistencyLight(); - int spaceDim(getSpaceDimension()),meshDim(getMeshDimension()),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 tmp(1,i); + std::vector tmp(1,i); MCAuto elt(static_cast(getCoords()->keepSelectedComponents(tmp))); elt=elt->getDifferentValues(eps); elt->sort(true); @@ -1771,7 +1771,7 @@ MEDCouplingCMesh *MEDCoupling1SGTUMesh::structurizeMe(DataArrayInt *& cellPerm, /// @cond INTERNAL -bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighSide, int *allFacesNodalConn, int *myNeighbours) +bool UpdateHexa8Cell(int validAxis, mcIdType neighId, const mcIdType *validConnQuad4NeighSide, mcIdType *allFacesNodalConn, mcIdType *myNeighbours) { static const int TAB[48]={ 0,1,2,3,4,5,6,7,//0 @@ -1784,11 +1784,11 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS static const int TAB2[6]={0,0,3,3,3,3}; if(myNeighbours[validAxis]==neighId && allFacesNodalConn[4*validAxis+0]==validConnQuad4NeighSide[TAB2[validAxis]]) return true; - int oldAxis((int)std::distance(myNeighbours,std::find(myNeighbours,myNeighbours+6,neighId))); + 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 oldAxisOpp(MEDCoupling1SGTUMesh::HEXA8_FACE_PAIRS[2*pos0+(pos1+1)%2]); - int oldConn[8],myConn2[8]={-1,-1,-1,-1,-1,-1,-1,-1},myConn[8],edgeConn[2],allFacesTmp[24],neighTmp[6]; + 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]; const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(INTERP_KERNEL::NORM_HEXA8)); @@ -1796,7 +1796,7 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS myConn2[i]=validConnQuad4NeighSide[(4-i+TAB2[validAxis])%4]; for(int i=0;i<4;i++) { - int 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++) @@ -1820,11 +1820,11 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS for(int i=0;i<6;i++) { cm.fillSonCellNodalConnectivity(i,myConn,allFacesTmp+4*i); - std::set 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 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]; @@ -1845,42 +1845,44 @@ bool UpdateHexa8Cell(int validAxis, int neighId, const int *validConnQuad4NeighS * This method expects the \a this contains NORM_HEXA8 cells only. This method will sort each cells in \a this so that their numbering was * homogeneous. If it succeeds the result of MEDCouplingUMesh::tetrahedrize will return a conform mesh. * - * \return DataArrayInt * - a newly allocated array (to be managed by the caller) containing renumbered cell ids. + * \return DataArrayIdType * - a newly allocated array (to be managed by the caller) containing renumbered cell ids. * * \throw If \a this is not a mesh containing only NORM_HEXA8 cells. * \throw If \a this is not properly allocated. * \sa MEDCouplingUMesh::tetrahedrize, MEDCouplingUMesh::simplexize. */ -DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() +DataArrayIdType *MEDCoupling1SGTUMesh::sortHexa8EachOther() { MCAuto quads(explodeEachHexa8To6Quad4());//checks that only hexa8 - int nbHexa8(getNumberOfCells()),*cQuads(quads->getNodalConnectivity()->getPointer()); - MCAuto neighOfQuads(DataArrayInt::New()); neighOfQuads->alloc(nbHexa8*6,1); neighOfQuads->fillWithValue(-1); - int *ptNeigh(neighOfQuads->getPointer()); + 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; - DataArrayInt *cc(0),*cci(0); + MCAuto ccSafe,cciSafe; + DataArrayIdType *cc(0),*cci(0); quadsTmp->findCommonCells(3,0,cc,cci); ccSafe=cc; cciSafe=cci; - const int *ccPtr(ccSafe->begin()),nbOfPair(cci->getNumberOfTuples()-1); - for(int i=0;ibegin()); + mcIdType nbOfPair=cci->getNumberOfTuples()-1; + for(mcIdType i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); std::vector fetched(nbHexa8,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 { - int cellId((int)std::distance(fetched.begin(),it));//it is the seed of the connected zone. - std::set s; s.insert(cellId);//s contains already organized. + 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(std::set::const_iterator it0=s.begin();it0!=s.end();it0++) + std::set sNext; + for(std::set::const_iterator it0=s.begin();it0!=s.end();it0++) { fetched[*it0]=true; - int *myNeighb(ptNeigh+6*(*it0)); + mcIdType *myNeighb(ptNeigh+6*(*it0)); for(int i=0;i<6;i++) { if(myNeighb[i]!=-1 && !fetched[myNeighb[i]]) @@ -1900,10 +1902,10 @@ DataArrayInt *MEDCoupling1SGTUMesh::sortHexa8EachOther() } if(!ret->empty()) { - int *conn(getNodalConnectivity()->getPointer()); - for(const int *pt=ret->begin();pt!=ret->end();pt++) + mcIdType *conn(getNodalConnectivity()->getPointer()); + for(const mcIdType *pt=ret->begin();pt!=ret->end();pt++) { - int cellId(*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]; } @@ -1931,26 +1933,28 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh3D : only TETRA4 supported !"); checkFullyDefined(); MCAuto thisu(buildUnstructured()); - MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); - const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MCAuto d1Arr(DataArrayInt::New()),di1Arr(DataArrayInt::New()),rd1Arr(DataArrayInt::New()),rdi1Arr(DataArrayInt::New()); + const mcIdType *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); + MCAuto d1Arr(DataArrayIdType::New()),di1Arr(DataArrayIdType::New()),rd1Arr(DataArrayIdType::New()),rdi1Arr(DataArrayIdType::New()); MCAuto edges(thisu->explode3DMeshTo1D(d1Arr,di1Arr,rd1Arr,rdi1Arr)); - const int *d1(d1Arr->begin()); - MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + 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=0; - const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); + const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),facesBaryArr(faces->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); - const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+faces->getNumberOfCells()),offset1(offset0+edges->getNumberOfCells()); + const mcIdType nbOfNodes(getNumberOfNodes()); + const mcIdType offset0=nbOfNodes+faces->getNumberOfCells(); + const mcIdType offset1=offset0+edges->getNumberOfCells(); 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=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(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); - for(int i=0;i 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); - int tmp[14]; + mcIdType tmp[14]; // tmp[0]=d1[6*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+0]-4]+offset0; tmp[1]=d2[4*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+1]]+nbOfNodes; tmp[2]=curCellId+offset1; tmp[3]=d2[4*curCellId+DUAL_TETRA_0[nodePosInCurCell*9+2]]+nbOfNodes; @@ -1978,10 +1982,10 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const { if(FACEID_NOT_SH_NODE[nodePosInCurCell]!=k) { - const int *faceId(d2+4*curCellId+k); + const mcIdType *faceId(d2+4*curCellId+k); if(rdi2[*faceId+1]-rdi2[*faceId]==1) { - int tmp2[5]; tmp2[0]=-1; tmp2[1]=i; + mcIdType tmp2[5]; tmp2[0]=-1; tmp2[1]=i; tmp2[2]=d1[6*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+0]-8]+offset0; tmp2[3]=d2[4*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+1]-4]+nbOfNodes; tmp2[4]=d1[6*curCellId+DUAL_TETRA_1[9*nodePosInCurCell+3*kk+2]-8]+offset0; @@ -2006,35 +2010,35 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::computeDualMesh2D : only TRI3 supported !"); checkFullyDefined(); MCAuto thisu(buildUnstructured()); - MCAuto revNodArr(DataArrayInt::New()),revNodIArr(DataArrayInt::New()); + MCAuto revNodArr(DataArrayIdType::New()),revNodIArr(DataArrayIdType::New()); thisu->getReverseNodalConnectivity(revNodArr,revNodIArr); - const int *revNod(revNodArr->begin()),*revNodI(revNodIArr->begin()),*nodal(_conn->begin()); - MCAuto d2Arr(DataArrayInt::New()),di2Arr(DataArrayInt::New()),rd2Arr(DataArrayInt::New()),rdi2Arr(DataArrayInt::New()); + 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=0; - const int *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); + const mcIdType *d2(d2Arr->begin()),*rdi2(rdi2Arr->begin()); MCAuto edgesBaryArr(edges->computeCellCenterOfMass()),baryArr(computeCellCenterOfMass()); - const int nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells()); + const mcIdType nbOfNodes(getNumberOfNodes()),offset0(nbOfNodes+edges->getNumberOfCells()); edges=0; std::vector v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr; 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(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1); - for(int i=0;i 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; + std::vector< std::vector > polyg; for(int j=0;j locV(3); + std::vector 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); int kk(0); @@ -2042,10 +2046,10 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const { if(FACEID_NOT_SH_NODE[nodePosInCurCell]!=k) { - const int *edgeId(d2+3*curCellId+k); + const mcIdType *edgeId(d2+3*curCellId+k); if(rdi2[*edgeId+1]-rdi2[*edgeId]==1) { - std::vector locV2(2); + std::vector locV2(2); int zeLocEdgeIdRel(DUAL_TRI_1[2*nodePosInCurCell+kk]); if(zeLocEdgeIdRel>0) { locV2[0]=d2[3*curCellId+zeLocEdgeIdRel-3]+nbOfNodes; locV2[1]=i; } @@ -2057,7 +2061,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const } } } - std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); + std::vector zePolyg(MEDCoupling1DGTUMesh::BuildAPolygonFromParts(polyg)); cArr->insertAtTheEnd(zePolyg.begin(),zePolyg.end()); ciArr->setIJ(i+1,0,cArr->getNumberOfTuples()); } @@ -2077,22 +2081,22 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const */ DataArrayDouble *MEDCoupling1SGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell()); + mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()),nbOfNodesPerCell(getNumberOfNodesPerCell()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->getConstPointer()); - const int *conn(_conn->getConstPointer()); - for(int i=0;igetConstPointer()); + for(mcIdType i=0;i=0 && nodeId ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); - int nbCells(getNumberOfCells()); + mcIdType nbCells=getNumberOfCells(); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); INTERP_KERNEL::AutoCppPtr dc(_cm->buildInstanceOfDiameterCalulator(getSpaceDimension())); @@ -2141,9 +2145,9 @@ void MEDCoupling1SGTUMesh::invertOrientationOfAllCells() { checkConsistencyOfConnectivity(); INTERP_KERNEL::AutoCppPtr oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - int nbOfNodesPerCell((int)_cm->getNumberOfNodes()),nbCells(getNumberOfCells()); - int *conn(_conn->getPointer()); - for(int i=0;igetNumberOfNodes()),nbCells=getNumberOfCells(); + mcIdType *conn(_conn->getPointer()); + for(mcIdType i=0;ioperate(conn+i*nbOfNodesPerCell,conn+(i+1)*nbOfNodesPerCell); updateTime(); } @@ -2180,7 +2184,7 @@ MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bo { if(recDeepCpy) { - const DataArrayInt *c(other._conn); + const DataArrayIdType *c(other._conn); if(c) _conn=c->deepCopy(); c=other._conn_indx; @@ -2205,7 +2209,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopyConnectivityOnly() const { checkConsistencyLight(); MCAuto ret(clone(false)); - MCAuto c(_conn->deepCopy()),ci(_conn_indx->deepCopy()); + MCAuto c(_conn->deepCopy()),ci(_conn_indx->deepCopy()); ret->setNodalConnectivity(c,ci); return ret.retn(); } @@ -2213,7 +2217,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::deepCopyConnectivityOnly() const void MEDCoupling1DGTUMesh::updateTime() const { MEDCoupling1GTUMesh::updateTime(); - const DataArrayInt *c(_conn); + const DataArrayIdType *c(_conn); if(c) updateTimeWith(*c); c=_conn_indx; @@ -2229,8 +2233,8 @@ std::size_t MEDCoupling1DGTUMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDCoupling1DGTUMesh::getDirectChildrenWithNull() const { std::vector ret(MEDCoupling1GTUMesh::getDirectChildrenWithNull()); - ret.push_back((const DataArrayInt *)_conn); - ret.push_back((const DataArrayInt *)_conn_indx); + ret.push_back((const DataArrayIdType *)_conn); + ret.push_back((const DataArrayIdType *)_conn_indx); return ret; } @@ -2252,7 +2256,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!MEDCoupling1GTUMesh::isEqualIfNotWhy(other,prec,reason)) return false; - const DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1==c2) return true; if(!c1 || !c2) @@ -2262,7 +2266,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!c1->isEqualIfNotWhy(*c2,reason)) { - reason.insert(0,"Nodal connectivity DataArrayInt differs : "); + reason.insert(0,"Nodal connectivity DataArrayIdType differs : "); return false; } c1=_conn_indx; c2=otherC->_conn_indx; @@ -2275,7 +2279,7 @@ bool MEDCoupling1DGTUMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, double } if(!c1->isEqualIfNotWhy(*c2,reason)) { - reason.insert(0,"Nodal connectivity index DataArrayInt differs : "); + reason.insert(0,"Nodal connectivity index DataArrayIdType differs : "); return false; } return true; @@ -2290,7 +2294,7 @@ bool MEDCoupling1DGTUMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *o return false; if(!MEDCoupling1GTUMesh::isEqualWithoutConsideringStr(other,prec)) return false; - const DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1==c2) return true; if(!c1 || !c2) @@ -2324,7 +2328,7 @@ void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do 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 DataArrayInt *c1(_conn),*c2(otherC->_conn); + const DataArrayIdType *c1(_conn),*c2(otherC->_conn); if(c1!=c2) { if(!c1 || !c2) @@ -2352,7 +2356,7 @@ void MEDCoupling1DGTUMesh::checkFastEquivalWith(const MEDCouplingMesh *other, do void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const { - const DataArrayInt *c1(_conn); + const DataArrayIdType *c1(_conn); if(c1) { if(c1->getNumberOfComponents()!=1) @@ -2364,7 +2368,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const else throw INTERP_KERNEL::Exception("Nodal connectivity array not defined !"); // - int sz2=_conn->getNumberOfTuples(); + mcIdType sz2(_conn->getNumberOfTuples()); c1=_conn_indx; if(c1) { @@ -2375,7 +2379,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have a a size of 1 at least !"); if(c1->getInfoOnComponent(0)!="") throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have no info on its single component !"); - int f=c1->front(),ll=c1->back(); + mcIdType f=c1->front(),ll=c1->back(); if(f<0 || (sz2>0 && f>=sz2)) { std::ostringstream oss; oss << "Nodal connectivity index array first value (" << f << ") is expected to be exactly in [0," << sz2 << ") !"; @@ -2394,7 +2398,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const } else throw INTERP_KERNEL::Exception("Nodal connectivity index array not defined !"); - int szOfC1Exp=_conn_indx->back(); + mcIdType szOfC1Exp=_conn_indx->back(); if(sz2getNumberOfTuples() << " !"; @@ -2416,14 +2420,14 @@ void MEDCoupling1DGTUMesh::checkConsistencyLight() const void MEDCoupling1DGTUMesh::checkConsistency(double eps) const { checkConsistencyLight(); - const DataArrayInt *c1(_conn),*c2(_conn_indx); + 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 !"); // - int nbOfTuples=c1->getNumberOfTuples(); - int nbOfNodes=getNumberOfNodes(); - const int *w(c1->begin()); - for(int i=0;igetNumberOfTuples()); + mcIdType nbOfNodes=getNumberOfNodes(); + const mcIdType *w(c1->begin()); + for(mcIdType i=0;i=nbOfNodes) @@ -2434,7 +2438,7 @@ void MEDCoupling1DGTUMesh::checkConsistency(double eps) const } } -std::size_t MEDCoupling1DGTUMesh::getNumberOfCells() const +mcIdType MEDCoupling1DGTUMesh::getNumberOfCells() const { checkConsistencyOfConnectivity();//do not remove return _conn_indx->getNumberOfTuples()-1; @@ -2448,20 +2452,20 @@ std::size_t MEDCoupling1DGTUMesh::getNumberOfCells() const * * \return a newly allocated array */ -DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCoupling1DGTUMesh::computeNbOfNodesPerCell() const { checkConsistencyLight(); _conn_indx->checkMonotonic(true); if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) return _conn_indx->deltaShiftIndex(); // for polyhedrons - int nbOfCells=_conn_indx->getNumberOfTuples()-1; - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;igetPointer(); + const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin(); + for(mcIdType i=0;icheckMonotonic(true); @@ -2479,18 +2483,18 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeNbOfFacesPerCell() const return _conn_indx->deltaShiftIndex(); if(getCellModelEnum()==INTERP_KERNEL::NORM_QPOLYG) { - MCAuto ret=_conn_indx->deltaShiftIndex(); + MCAuto ret=_conn_indx->deltaShiftIndex(); ret->applyDivideBy(2); return ret.retn(); } // for polyhedrons - int nbOfCells=_conn_indx->getNumberOfTuples()-1; - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;igetPointer(); + const mcIdType *ci=_conn_indx->begin(),*c=_conn->begin(); + for(mcIdType i=0;icheckMonotonic(true); - int nbOfCells(_conn_indx->getNumberOfTuples()-1); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=_conn_indx->getNumberOfTuples()-1; + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr(ret->getPointer()); - const int *ci(_conn_indx->begin()),*c(_conn->begin()); + mcIdType *retPtr(ret->getPointer()); + const mcIdType *ci(_conn_indx->begin()),*c(_conn->begin()); if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) { - for(int i=0;i s(c+ci[0],c+ci[1]); - *retPtr=(int)s.size(); + std::set s(c+ci[0],c+ci[1]); + *retPtr=ToIdType(s.size()); } } else { - for(int i=0;i s(c+ci[0],c+ci[1]); s.erase(-1); - *retPtr=(int)s.size(); + std::set s(c+ci[0],c+ci[1]); s.erase(-1); + *retPtr=ToIdType(s.size()); } } return ret.retn(); } -void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCoupling1DGTUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - std::size_t nbOfCells(getNumberOfCells());//performs checks + mcIdType nbOfCells(getNumberOfCells());//performs checks if(cellIdgetIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); - int nbOfNodes=stp-strt; + mcIdType strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); + 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); @@ -2548,14 +2552,14 @@ void MEDCoupling1DGTUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector } } -int MEDCoupling1DGTUMesh::getNumberOfNodesInCell(int cellId) const +mcIdType MEDCoupling1DGTUMesh::getNumberOfNodesInCell(mcIdType cellId) const { - int nbOfCells(getNumberOfCells());//performs checks + mcIdType nbOfCells=getNumberOfCells();//performs checks if(cellId>=0 && cellIdbegin()); - int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); - return stp-strt-std::count(conn+strt,conn+stp,-1); + const mcIdType *conn(_conn->begin()); + mcIdType strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0); + return stp-strt-ToIdType(std::count(conn+strt,conn+stp,-1)); } else { @@ -2622,9 +2626,9 @@ std::string MEDCoupling1DGTUMesh::advancedRepr() const } if(!isOK) return ret.str(); - int nbOfCells=getNumberOfCells(); - const int *ci=_conn_indx->begin(),*c=_conn->begin(); - for(int i=0;ibegin(),*c=_conn->begin(); + for(mcIdType i=0;i(ret," ")); @@ -2637,21 +2641,21 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons { MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight() - int nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight() + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); const double *coor=_coords->begin(); - const int *nodal=_conn->begin(),*nodali=_conn_indx->begin(); + const mcIdType *nodal=_conn->begin(),*nodali=_conn_indx->begin(); nodal+=nodali[0]; if(getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) { - for(int i=0;i= to avoid division by 0. { - for(int j=nodali[0];j=0 && *nodal()); @@ -2660,7 +2664,7 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of nodeId #" << *nodal << " should be in [0," << nbOfNodes << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./(nodali[1]-nodali[0]))); + std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./double(nodali[1]-nodali[0]))); } } else @@ -2672,13 +2676,13 @@ DataArrayDouble *MEDCoupling1DGTUMesh::computeIsoBarycenterOfNodesPerCell() cons } else { - for(int i=0;i= to avoid division by 0. { int nbOfNod=0; - for(int j=nodali[0];j=0 && *nodal o2n=DataArrayInt::New(); + mcIdType nbCells=getNumberOfCells(); + MCAuto o2n=DataArrayIdType::New(); o2n->useArray(old2NewBg,false,DeallocType::C_DEALLOC,nbCells,1); if(check) o2n=o2n->checkAndPreparePermutation(); // - const int *o2nPtr=o2n->getPointer(); - const int *conn=_conn->begin(),*conni=_conn_indx->begin(); - MCAuto newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + const mcIdType *o2nPtr=o2n->getPointer(); + const mcIdType *conn=_conn->begin(),*conni=_conn_indx->begin(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto newConnI=DataArrayIdType::New(); newConn->alloc(_conn->getNumberOfTuples(),1); newConnI->alloc(nbCells,1); newConn->copyStringInfoFrom(*_conn); newConnI->copyStringInfoFrom(*_conn_indx); // - int *newC=newConn->getPointer(),*newCI=newConnI->getPointer(); - for(int i=0;igetPointer(),*newCI=newConnI->getPointer(); + for(mcIdType i=0;i=0) newCI[newPos]=sz; else @@ -2740,9 +2744,9 @@ void MEDCoupling1DGTUMesh::renumberCells(const int *old2NewBg, bool check) } newConnI->computeOffsetsFull(); newCI=newConnI->getPointer(); // - for(int i=0;i ret=MEDCouplingUMesh::New(getName(),getMeshDimension()); ret->setCoords(getCoords()); - const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); - int nbCells=getNumberOfCells();//checkConsistencyLight - int geoType=(int)getCellModelEnum(); - MCAuto c=DataArrayInt::New(); c->alloc(nbCells+_conn->getNumberOfTuples(),1); - MCAuto cI=DataArrayInt::New(); cI->alloc(nbCells+1); - int *cPtr=c->getPointer(),*ciPtr=cI->getPointer(); + const mcIdType *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin(); + 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(int i=0;i=0) { *cPtr++=geoType; @@ -2793,10 +2797,10 @@ MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const /*! * Do nothing for the moment, because there is no policy that allows to split polygons, polyhedrons ... into simplexes */ -DataArrayInt *MEDCoupling1DGTUMesh::simplexize(int policy) +DataArrayIdType *MEDCoupling1DGTUMesh::simplexize(int policy) { - int nbOfCells=getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); ret->iota(0); return ret.retn(); @@ -2845,26 +2849,26 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED return Merge1DGTUMeshesOnSameCoords(ms); } -MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const +MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const { checkConsistencyLight(); MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayInt *c=0,*ci=0; - DataArrayInt::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); - MCAuto cSafe(c),ciSafe(ci); + DataArrayIdType *c=0,*ci=0; + DataArrayIdType::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci); + MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); return ret.retn(); } -MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const +MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { checkConsistencyLight(); MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); ret->setCoords(_coords); - DataArrayInt *c=0,*ci=0; - DataArrayInt::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); - MCAuto cSafe(c),ciSafe(ci); + DataArrayIdType *c=0,*ci=0; + DataArrayIdType::ExtractFromIndexedArraysSlice(start,end,step,_conn,_conn_indx,c,ci); + MCAuto cSafe(c),ciSafe(ci); ret->setNodalConnectivity(c,ci); return ret.retn(); } @@ -2872,8 +2876,8 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoordsSlice(int void MEDCoupling1DGTUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { checkConsistency(); - int sz((int)nodeIdsInUse.size()); - for(const int *conn=_conn->begin();conn!=_conn->end();conn++) + mcIdType sz(ToIdType(nodeIdsInUse.size())); + for(const mcIdType *conn=_conn->begin();conn!=_conn->end();conn++) { if(*conn>=0 && *conn& nodeIdsInUse) co } } -void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +void MEDCoupling1DGTUMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { checkFullyDefined(); - int nbOfNodes=getNumberOfNodes(); - int *revNodalIndxPtr=(int *)malloc((nbOfNodes+1)*sizeof(int)); + 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 int *conn=_conn->begin(),*conni=_conn_indx->begin(); - int nbOfCells=getNumberOfCells(); - int nbOfEltsInRevNodal=0; - for(int eltId=0;eltIdbegin(),*conni=_conn_indx->begin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfEltsInRevNodal=0; + for(mcIdType eltId=0;eltId=0) { - for(int j=0;j=0 && nodeId()); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); conn=_conn->begin(); - int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int)); + mcIdType *revNodalPtr=(mcIdType *)malloc((nbOfEltsInRevNodal)*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); - for(int eltId=0;eltId(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[nodeId],revNodalPtr+revNodalIndxPtr[nodeId+1],std::bind2nd(std::equal_to(),-1))=eltId; } } } void MEDCoupling1DGTUMesh::checkFullyDefined() const { - if(!((const DataArrayInt *)_conn) || !((const DataArrayInt *)_conn_indx) || !((const DataArrayDouble *)_coords)) + if(!((const DataArrayIdType *)_conn) || !((const DataArrayIdType *)_conn_indx) || !((const DataArrayDouble *)_coords)) 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 !"); } -void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -2966,11 +2970,11 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& std::vector littleStrings2,littleStrings3,littleStrings4; if((const DataArrayDouble *)_coords) _coords->getTinySerializationStrInformation(littleStrings2); - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) _conn->getTinySerializationStrInformation(littleStrings3); - if((const DataArrayInt *)_conn_indx) + if((const DataArrayIdType *)_conn_indx) _conn_indx->getTinySerializationStrInformation(littleStrings4); - int sz0((int)littleStrings2.size()),sz1((int)littleStrings3.size()),sz2((int)littleStrings4.size()); + mcIdType sz0(ToIdType(littleStrings2.size())),sz1(ToIdType(littleStrings3.size())),sz2(ToIdType(littleStrings4.size())); littleStrings.insert(littleStrings.end(),littleStrings2.begin(),littleStrings2.end()); littleStrings.insert(littleStrings.end(),littleStrings3.begin(),littleStrings3.end()); littleStrings.insert(littleStrings.end(),littleStrings4.begin(),littleStrings4.end()); @@ -2978,14 +2982,14 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfo.push_back(getCellModelEnum()); tinyInfo.push_back(it); tinyInfo.push_back(order); - std::vector tinyInfo2,tinyInfo3,tinyInfo4; + std::vector tinyInfo2,tinyInfo3,tinyInfo4; if((const DataArrayDouble *)_coords) _coords->getTinySerializationIntInformation(tinyInfo2); - if((const DataArrayInt *)_conn) + if((const DataArrayIdType *)_conn) _conn->getTinySerializationIntInformation(tinyInfo3); - if((const DataArrayInt *)_conn_indx) + if((const DataArrayIdType *)_conn_indx) _conn_indx->getTinySerializationIntInformation(tinyInfo4); - int sz3((int)tinyInfo2.size()),sz4((int)tinyInfo3.size()),sz5((int)tinyInfo4.size()); + mcIdType sz3(ToIdType(tinyInfo2.size())),sz4(ToIdType(tinyInfo3.size())),sz5(ToIdType(tinyInfo4.size())); tinyInfo.push_back(sz0); tinyInfo.push_back(sz1); tinyInfo.push_back(sz2); tinyInfo.push_back(sz3); tinyInfo.push_back(sz4); tinyInfo.push_back(sz5); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); tinyInfo.insert(tinyInfo.end(),tinyInfo3.begin(),tinyInfo3.end()); @@ -2994,34 +2998,34 @@ void MEDCoupling1DGTUMesh::getTinySerializationInformation(std::vector& tinyInfoD.push_back(time); } -void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCoupling1DGTUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { - 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(DataArrayInt::New()); p1->resizeForUnserialization(tinyInfo1); - MCAuto p2(DataArrayInt::New()); p2->resizeForUnserialization(tinyInfo12); - std::vector v(2); v[0]=p1; v[1]=p2; - p2=DataArrayInt::Aggregate(v); + 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; + p2=DataArrayIdType::Aggregate(v); a2->resizeForUnserialization(tinyInfo2); a1->alloc(p2->getNbOfElems(),1); } -void MEDCoupling1DGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCoupling1DGTUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { - int sz(0); - if((const DataArrayInt *)_conn) + mcIdType sz(0); + if((const DataArrayIdType *)_conn) if(_conn->isAllocated()) sz=_conn->getNbOfElems(); - if((const DataArrayInt *)_conn_indx) + if((const DataArrayIdType *)_conn_indx) if(_conn_indx->isAllocated()) sz+=_conn_indx->getNbOfElems(); - a1=DataArrayInt::New(); + a1=DataArrayIdType::New(); a1->alloc(sz,1); - int *work(a1->getPointer()); - if(sz!=0 && (const DataArrayInt *)_conn) + mcIdType *work(a1->getPointer()); + if(sz!=0 && (const DataArrayIdType *)_conn) work=std::copy(_conn->begin(),_conn->end(),a1->getPointer()); - if(sz!=0 && (const DataArrayInt *)_conn_indx) + if(sz!=0 && (const DataArrayIdType *)_conn_indx) std::copy(_conn_indx->begin(),_conn_indx->end(),work); sz=0; if((const DataArrayDouble *)_coords) @@ -3033,7 +3037,7 @@ void MEDCoupling1DGTUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) co std::copy(_coords->begin(),_coords->end(),a2->getPointer()); } -void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, +void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]); @@ -3041,19 +3045,19 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, setName(littleStrings[0]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); - setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]); - int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[1]),FromIdType(tinyInfo[2])); + mcIdType sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]); // _coords=DataArrayDouble::New(); - std::vector 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=DataArrayInt::New(); - std::vector tinyInfo3(tinyInfo.begin()+9+sz3,tinyInfo.begin()+9+sz3+sz4); + _conn=DataArrayIdType::New(); + 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=DataArrayInt::New(); - std::vector tinyInfo4(tinyInfo.begin()+9+sz3+sz4,tinyInfo.begin()+9+sz3+sz4+sz5); + _conn_indx=DataArrayIdType::New(); + 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 littleStrings2(littleStrings.begin()+3,littleStrings.begin()+3+sz0); @@ -3069,7 +3073,7 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, * by excluding the unused nodes, for which the array holds -1. The result array is * a mapping in "Old to New" mode. * \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity. - * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a + * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a * this->getNumberOfNodes(). It holds for each node of \a this mesh either -1 * if the node is unused or a new id else. The caller is to delete this * array using decrRef() as it is no more needed. @@ -3078,16 +3082,16 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector& tinyInfoD, * \throw If the nodal connectivity includes an invalid id. * \sa MEDCoupling1DGTUMesh::getNodeIdsInUse, areAllNodesFetched */ -DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const +DataArrayIdType *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const { checkConsistency(); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); - int sz((int)std::count(fetchedNodes.begin(),fetchedNodes.end(),true)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - int *retPtr(ret->getPointer()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(sz,1); + mcIdType *retPtr(ret->getPointer()); + for(mcIdType i=0;igetNumberOfNodes(). It holds for each node of \a this mesh either -1 * if the node is unused or a new id else. The caller is to delete this * array using decrRef() as it is no more needed. @@ -3107,22 +3111,22 @@ DataArrayInt *MEDCoupling1DGTUMesh::computeFetchedNodeIds() const * \throw If the nodal connectivity includes an invalid id. * \sa MEDCoupling1DGTUMesh::computeFetchedNodeIds, areAllNodesFetched */ -DataArrayInt *MEDCoupling1DGTUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const +DataArrayIdType *MEDCoupling1DGTUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; - int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells();//checkConsistencyLight - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells();//checkConsistencyLight + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfNodes,1); - int *traducer=ret->getPointer(); + mcIdType *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); - const int *conn=_conn->begin(),*conni(_conn_indx->begin()); - for(int i=0;ibegin(),*conni(_conn_indx->begin()); + for(mcIdType i=0;i=0 && nodeIdgetNumberOfTuples()); - int *pt(_conn->getPointer()); - for(int i=0;igetNumberOfTuples()); + mcIdType *pt(_conn->getPointer()); + for(mcIdType i=0;i& newNodeNumbersO2N) +void MEDCoupling1DGTUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); } /*! - * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead + * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead * of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction * of a big mesh. */ -void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) +void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -3191,13 +3195,13 @@ void MEDCoupling1DGTUMesh::renumberNodesInConn(const std::map& newNodeN * See \ref numbering for more info on renumbering modes. * \throw If the nodal connectivity of cells is not defined. */ -void MEDCoupling1DGTUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) +void MEDCoupling1DGTUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N) { getNumberOfCells();//only to check that all is well defined. // - int nbElemsIn(getNumberOfNodes()),nbOfTuples(_conn->getNumberOfTuples()); - int *pt(_conn->getPointer()); - for(int i=0;igetNumberOfTuples()); + mcIdType *pt(_conn->getPointer()); + for(mcIdType i=0;i=0 && *pt cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); - int tmp=-1; - int sz=_conn->getMaxValue(tmp); sz=std::max(sz,0)+1; + mcIdType nbOfCells=getNumberOfCells(); + MCAuto cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); + mcIdType tmp=-1; + mcIdType sz=_conn->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workbegin(),*conni=_conn_indx->begin(); - for(int i=0;ibegin(),*conni=_conn_indx->begin(); + for(mcIdType i=0;i=0) { - for(int j=0;j=0) { ref++; @@ -3262,13 +3266,13 @@ void MEDCoupling1DGTUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const cellIdsKeptArr=cellIdsKept.retn(); } -void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells) +void MEDCoupling1DGTUMesh::allocateCells(mcIdType nbOfCells) { if(nbOfCells<0) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::allocateCells : the input number of cells should be >= 0 !"); - _conn=DataArrayInt::New(); + _conn=DataArrayIdType::New(); _conn->reserve(nbOfCells*3); - _conn_indx=DataArrayInt::New(); + _conn_indx=DataArrayIdType::New(); _conn_indx->reserve(nbOfCells+1); _conn_indx->pushBackSilent(0); declareAsNew(); } @@ -3282,17 +3286,17 @@ void MEDCoupling1DGTUMesh::allocateCells(int nbOfCells) * attached to \a this. * \throw If the nodal connectivity array in \a this is null (call MEDCoupling1SGTUMesh::allocateCells before). */ -void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd) +void MEDCoupling1DGTUMesh::insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) { std::size_t sz(std::distance(nodalConnOfCellBg,nodalConnOfCellEnd)); - DataArrayInt *c(_conn),*c2(_conn_indx); + DataArrayIdType *c(_conn),*c2(_conn_indx); if(c && c2) { - int pos=c2->back(); - if(pos==(int)c->getNumberOfTuples()) + mcIdType pos=c2->back(); + if(pos==c->getNumberOfTuples()) { c->pushBackValsSilent(nodalConnOfCellBg,nodalConnOfCellEnd); - c2->pushBackSilent(pos+sz); + c2->pushBackSilent(pos+ToIdType(sz)); } else { @@ -3304,7 +3308,7 @@ void MEDCoupling1DGTUMesh::insertNextCell(const int *nodalConnOfCellBg, const in throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::insertNextCell : nodal connectivity array is null ! Call MEDCoupling1DGTUMesh::allocateCells before !"); } -void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) +void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex) { if(nodalConn) nodalConn->incrRef(); @@ -3316,21 +3320,21 @@ void MEDCoupling1DGTUMesh::setNodalConnectivity(DataArrayInt *nodalConn, DataArr } /*! - * \return DataArrayInt * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it. + * \return DataArrayIdType * - the internal reference to the nodal connectivity. The caller is not responsible to deallocate it. */ -DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivity() const +DataArrayIdType *MEDCoupling1DGTUMesh::getNodalConnectivity() const { - const DataArrayInt *ret(_conn); - return const_cast(ret); + const DataArrayIdType *ret(_conn); + return const_cast(ret); } /*! - * \return DataArrayInt * - the internal reference to the nodal connectivity index. The caller is not responsible to deallocate it. + * \return DataArrayIdType * - the internal reference to the nodal connectivity index. The caller is not responsible to deallocate it. */ -DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const +DataArrayIdType *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const { - const DataArrayInt *ret(_conn_indx); - return const_cast(ret); + const DataArrayIdType *ret(_conn_indx); + return const_cast(ret); } /*! @@ -3349,9 +3353,9 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const { MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - DataArrayInt *nc=0,*nci=0; + DataArrayIdType *nc=0,*nci=0; isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci); - MCAuto ncs(nc),ncis(nci); + MCAuto ncs(nc),ncis(nci); ret->_conn=ncs; ret->_conn_indx=ncis; ret->setCoords(getCoords()); return ret.retn(); @@ -3378,18 +3382,18 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool * * \throw if \a this does not pass MEDCoupling1DGTUMesh::checkConsistencyLight test */ -bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndx) const +bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const { if(isPacked())//performs the checkConsistencyLight { - const DataArrayInt *c0(_conn),*c1(_conn_indx); - nodalConn=const_cast(c0); nodalConnIndx=const_cast(c1); + const DataArrayIdType *c0(_conn),*c1(_conn_indx); + nodalConn=const_cast(c0); nodalConnIndx=const_cast(c1); nodalConn->incrRef(); nodalConnIndx->incrRef(); return true; } - int bg=_conn_indx->front(),end=_conn_indx->back(); - MCAuto nc(_conn->selectByTupleIdSafeSlice(bg,end,1)); - MCAuto nci(_conn_indx->deepCopy()); + mcIdType bg=_conn_indx->front(),end=_conn_indx->back(); + MCAuto nc(_conn->selectByTupleIdSafeSlice(bg,end,1)); + MCAuto nci(_conn_indx->deepCopy()); nci->applyLin(1,-bg); nodalConn=nc.retn(); nodalConnIndx=nci.retn(); return false; @@ -3406,7 +3410,7 @@ bool MEDCoupling1DGTUMesh::retrievePackedNodalConnectivity(DataArrayInt *&nodalC bool MEDCoupling1DGTUMesh::isPacked() const { checkConsistencyLight(); - return _conn_indx->front()==0 && _conn_indx->back()==(int)_conn->getNumberOfTuples(); + return _conn_indx->front()==0 && _conn_indx->back()==_conn->getNumberOfTuples(); } MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2) @@ -3433,15 +3437,15 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshes(std::vector > bb(sz); std::vector< const MEDCoupling1DGTUMesh * > aa(sz); - int spaceDim=-3; - for(std::size_t i=0;igetCoords(); if(coo) spaceDim=coo->getNumberOfComponents(); } - if(spaceDim==-3) + if(spaceDim==spaceDimUndef) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::Merge1DGTUMeshes : no spaceDim specified ! unable to perform merge !"); for(std::size_t i=0;i > objs(a.size()); - std::vector ncs(a.size()),ncis(a.size()); + std::vector ncs(a.size()),ncis(a.size()); (*it)->getNumberOfCells();//to check that all is OK const DataArrayDouble *coords=(*it)->getCoords(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); @@ -3485,8 +3489,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(std::ve } MCAuto ret(new MEDCoupling1DGTUMesh("merge",*cm)); ret->setCoords(coords); - ret->_conn=DataArrayInt::Aggregate(ncs); - ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis); + ret->_conn=DataArrayIdType::Aggregate(ncs); + ret->_conn_indx=DataArrayIdType::AggregateIndexes(ncis); return ret.retn(); } @@ -3498,15 +3502,15 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector > objs(a.size()); - std::vector ncs(a.size()),ncis(a.size()); + std::vector ncs(a.size()),ncis(a.size()); std::vector::const_iterator it=a.begin(); - std::vector nbNodesPerElt(a.size()); - int nbOfCells=(*it)->getNumberOfCells(); + std::vector nbNodesPerElt(a.size()); + std::size_t nbOfCells=(*it)->getNumberOfCells(); bool tmp; objs[0]=(*it)->copyWithNodalConnectivityPacked(tmp); ncs[0]=objs[0]->getNodalConnectivity(); ncis[0]=objs[0]->getNodalConnectivityIndex(); nbNodesPerElt[0]=0; - int prevNbOfNodes=(*it)->getNumberOfNodes(); + mcIdType prevNbOfNodes=(*it)->getNumberOfNodes(); const INTERP_KERNEL::CellModel *cm=&((*it)->getCellModel()); it++; for(int i=1;it!=a.end();i++,it++) @@ -3525,18 +3529,18 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector ret(new MEDCoupling1DGTUMesh("merge",*cm)); ret->setCoords(pts); ret->_conn=AggregateNodalConnAndShiftNodeIds(ncs,nbNodesPerElt); - ret->_conn_indx=DataArrayInt::AggregateIndexes(ncis); + ret->_conn_indx=DataArrayIdType::AggregateIndexes(ncis); return ret.retn(); } -MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDim) const +MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const { MCAuto ret(new MEDCoupling1DGTUMesh(getName(),*_cm)); - MCAuto tmp1,tmp2; - const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx); + MCAuto tmp1,tmp2; + const DataArrayIdType *nodalConn(_conn),*nodalConnI(_conn_indx); if(!nodalConn) { - tmp1=DataArrayInt::New(); tmp1->alloc(0,1); + tmp1=DataArrayIdType::New(); tmp1->alloc(0,1); } else tmp1=_conn; @@ -3544,7 +3548,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi // if(!nodalConnI) { - tmp2=DataArrayInt::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0); + tmp2=DataArrayIdType::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0); } else tmp2=_conn_indx; @@ -3573,23 +3577,23 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDi DataArrayDouble *MEDCoupling1DGTUMesh::getBoundingBoxForBBTree(double arcDetEps) const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + mcIdType spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->getConstPointer()); - const int *conn(_conn->getConstPointer()),*connI(_conn_indx->getConstPointer()); - for(int i=0;igetConstPointer()),*connI(_conn_indx->getConstPointer()); + for(mcIdType i=0;i=0 && nodeId MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector >& parts) +std::vector MEDCoupling1DGTUMesh::BuildAPolygonFromParts(const std::vector< std::vector >& parts) { - std::vector ret; + std::vector ret; if(parts.empty()) return ret; ret.insert(ret.end(),parts[0].begin(),parts[0].end()); - int ref(ret.back()); + mcIdType ref(ret.back()); std::size_t sz(parts.size()),nbh(1); std::vector b(sz,true); b[0]=false; while(nbh oi(INTERP_KERNEL::OrientationInverter::BuildInstanceFrom(getCellModelEnum())); - int nbCells(getNumberOfCells()); - const int *connI(_conn_indx->begin()); - int *conn(_conn->getPointer()); - for(int i=0;ibegin()); + mcIdType *conn(_conn->getPointer()); + for(mcIdType i=0;ioperate(conn+connI[i],conn+connI[i+1]); updateTime(); } /*! - * This method performs an aggregation of \a nodalConns (as DataArrayInt::Aggregate does) but in addition of that a shift is applied on the + * This method performs an aggregation of \a nodalConns (as DataArrayIdType::Aggregate does) but in addition of that a shift is applied on the * values contained in \a nodalConns using corresponding offset specified in input \a offsetInNodeIdsPerElt. * But it also manage the values -1, that have a semantic in MEDCoupling1DGTUMesh class (separator for polyhedron). * * \param [in] nodalConns - a list of nodal connectivity arrays same size than \a offsetInNodeIdsPerElt. * \param [in] offsetInNodeIdsPerElt - a list of offsets to apply. - * \return DataArrayInt * - A new object (to be managed by the caller) that is the result of the aggregation. + * \return DataArrayIdType * - A new object (to be managed by the caller) that is the result of the aggregation. * \throw If \a nodalConns or \a offsetInNodeIdsPerElt are empty. * \throw If \a nodalConns and \a offsetInNodeIdsPerElt have not the same size. * \throw If presence of null pointer in \a nodalConns. * \throw If presence of not allocated or array with not exactly one component in \a nodalConns. */ -DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt) +DataArrayIdType *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt) { std::size_t sz1(nodalConns.size()),sz2(offsetInNodeIdsPerElt.size()); if(sz1!=sz2) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : input vectors do not have the same size !"); if(sz1==0) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : empty vectors in input !"); - int nbOfTuples=0; - for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) + mcIdType nbOfTuples=0; + for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++) { if(!(*it)) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of null pointer in input vector !"); @@ -3690,15 +3694,15 @@ DataArrayInt *MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(const std: throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds : presence of array with not exactly one component !"); nbOfTuples+=(*it)->getNumberOfTuples(); } - MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); - int *pt=ret->getPointer(); - int i=0; - for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); + mcIdType *pt=ret->getPointer(); + mcIdType i=0; + for(std::vector::const_iterator it=nodalConns.begin();it!=nodalConns.end();it++,i++) { - int curNbt=(*it)->getNumberOfTuples(); - const int *inPt=(*it)->begin(); - int offset=offsetInNodeIdsPerElt[i]; - for(int j=0;jgetNumberOfTuples(); + const mcIdType *inPt=(*it)->begin(); + mcIdType offset=offsetInNodeIdsPerElt[i]; + for(mcIdType j=0;j gts(m->getAllGeoTypes()); if(gts.size()!=1) throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !"); - int geoType((int)*gts.begin()); + mcIdType geoType(ToIdType(*gts.begin())); MCAuto ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin())); ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription()); - int nbCells(m->getNumberOfCells()); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + mcIdType nbCells=m->getNumberOfCells(); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); conn->alloc(m->getNodalConnectivityArrayLen()-nbCells,1); connI->alloc(nbCells+1,1); - int *c(conn->getPointer()),*ci(connI->getPointer()); *ci=0; - const int *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); - for(int i=0;igetPointer()),*ci(connI->getPointer()); *ci=0; + const mcIdType *cin(m->getNodalConnectivity()->begin()),*ciin(m->getNodalConnectivityIndex()->begin()); + for(mcIdType i=0;i getAllGeoTypes() const; - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) 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; - MEDCOUPLING_EXPORT std::size_t getNodalConnectivityLength() const; + MEDCOUPLING_EXPORT mcIdType getNodalConnectivityLength() 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 checkConsistencyLight() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) 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 MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const; - MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const; - MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() 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, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) 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(int nbOfCells=0) = 0; - MEDCOUPLING_EXPORT virtual void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd) = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getNodalConnectivity() const = 0; + MEDCOUPLING_EXPORT virtual void allocateCells(mcIdType nbOfCells=0) = 0; + MEDCOUPLING_EXPORT virtual void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd) = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *getNodalConnectivity() const = 0; MEDCOUPLING_EXPORT virtual void checkConsistencyOfConnectivity() const = 0; protected: MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); @@ -109,60 +109,60 @@ namespace MEDCoupling 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 std::size_t getNumberOfCells() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) 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 int *old2NewBg, bool check=true); + 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 DataArrayInt *simplexize(int policy); + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; // overload of MEDCouplingPointSet MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) 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(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) 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 DataArrayInt *computeFetchedNodeIds() const; - MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const; - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset); - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N); - MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const; - MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) 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); + 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; - MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); - MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd); + MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); + MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd); public://specific - MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayInt *nodalConn); - MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const; - MEDCOUPLING_EXPORT int getNumberOfNodesPerCell() const; + MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn); + 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); MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *Merge1SGTUMeshesOnSameCoords(std::vector& a); - MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const; + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const; MEDCOUPLING_EXPORT MEDCoupling1GTUMesh *computeDualMesh() const; - MEDCOUPLING_EXPORT DataArrayInt *sortHexa8EachOther(); + MEDCOUPLING_EXPORT DataArrayIdType *sortHexa8EachOther(); MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const; - MEDCOUPLING_EXPORT MEDCouplingCMesh *structurizeMe(DataArrayInt *& cellPerm, DataArrayInt *& nodePerm, double eps=1e-12) 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); private: MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); @@ -171,10 +171,10 @@ namespace MEDCoupling private: void checkNonDynamicGeoType() const; static MEDCoupling1SGTUMesh *Merge1SGTUMeshesLL(std::vector& a); - DataArrayInt *simplexizePol0(); - DataArrayInt *simplexizePol1(); - DataArrayInt *simplexizePlanarFace5(); - DataArrayInt *simplexizePlanarFace6(); + DataArrayIdType *simplexizePol0(); + DataArrayIdType *simplexizePol1(); + DataArrayIdType *simplexizePlanarFace5(); + DataArrayIdType *simplexizePlanarFace6(); MEDCoupling1DGTUMesh *computeDualMesh3D() const; MEDCoupling1DGTUMesh *computeDualMesh2D() const; template @@ -208,61 +208,61 @@ namespace MEDCoupling 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 std::size_t getNumberOfCells() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) 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 int *old2NewBg, bool check=true); + 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 DataArrayInt *simplexize(int policy); + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; // overload of MEDCouplingPointSet MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other); MEDCOUPLING_EXPORT MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) 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(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) 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 DataArrayInt *computeFetchedNodeIds() const; - MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const; - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset); - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N); - MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const; - MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) 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); + 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; - MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); - MEDCOUPLING_EXPORT void insertNextCell(const int *nodalConnOfCellBg, const int *nodalConnOfCellEnd); + MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); + MEDCOUPLING_EXPORT void insertNextCell(const mcIdType *nodalConnOfCellBg, const mcIdType *nodalConnOfCellEnd); public://specific - MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex); - MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const; - MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() const; + MEDCOUPLING_EXPORT void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex); + MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() const; MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const; - MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndx) const; + MEDCOUPLING_EXPORT bool retrievePackedNodalConnectivity(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndx) const; MEDCOUPLING_EXPORT bool isPacked() const; MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(const MEDCoupling1DGTUMesh *mesh1, const MEDCoupling1DGTUMesh *mesh2); MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshes(std::vector& a); MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *Merge1DGTUMeshesOnSameCoords(std::vector& a); - MEDCOUPLING_EXPORT static DataArrayInt *AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt); - MEDCOUPLING_EXPORT static std::vector BuildAPolygonFromParts(const std::vector< std::vector >& parts); - MEDCOUPLING_EXPORT MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const; + MEDCOUPLING_EXPORT static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(const std::vector& nodalConns, const std::vector& offsetInNodeIdsPerElt); + 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); private: MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm); diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.txx b/src/MEDCoupling/MEDCoupling1GTUMesh.txx index 99fa524d4..efd0db6b5 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.txx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.txx @@ -27,10 +27,10 @@ template void MEDCoupling::MEDCoupling1SGTUMesh::renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N) { getNumberOfCells();//only to check that all is well defined. - int *begPtr(_conn->getPointer()); - int nbElt(_conn->getNumberOfTuples()); - int *endPtr(begPtr+nbElt); - for(int *it=begPtr;it!=endPtr;it++) + mcIdType *begPtr(_conn->getPointer()); + mcIdType nbElt(_conn->getNumberOfTuples()); + mcIdType *endPtr(begPtr+nbElt); + for(mcIdType *it=begPtr;it!=endPtr;it++) { auto it2(newNodeNumbersO2N.find(*it)); if(it2!=newNodeNumbersO2N.end()) @@ -51,9 +51,9 @@ void MEDCoupling::MEDCoupling1DGTUMesh::renumberNodesInConnT(const MAPCLS& newNo { getNumberOfCells();//only to check that all is well defined. // - int nbOfTuples(_conn->getNumberOfTuples()); - int *pt(_conn->getPointer()); - for(int i=0;igetNumberOfTuples()); + mcIdType *pt(_conn->getPointer()); + for(mcIdType i=0;i=0) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx old mode 100644 new mode 100755 index f20dbba1f..3b123d347 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -43,7 +43,7 @@ DataArrayDoubleCollection *DataArrayDoubleCollection::deepCopy() const return new DataArrayDoubleCollection(*this); } -void DataArrayDoubleCollection::allocTuples(int nbOfTuples) +void DataArrayDoubleCollection::allocTuples(mcIdType nbOfTuples) { std::size_t sz(_arrs.size()); for(std::size_t i=0;i=(int)_arrs.size()) + if(pos<0 || pos>=ToIdType(_arrs.size())) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::at (non const) : pos must be in [0,nbOfFields) !"); return _arrs[pos].first; } -const DataArrayDouble *DataArrayDoubleCollection::at(int pos) const +const DataArrayDouble *DataArrayDoubleCollection::at(mcIdType pos) const { - if(pos<0 || pos>=(int)_arrs.size()) + if(pos<0 || pos>=ToIdType(_arrs.size())) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::at : pos must be in [0,nbOfFields) !"); return _arrs[pos].first; } -int DataArrayDoubleCollection::size() const +mcIdType DataArrayDoubleCollection::size() const { - return (int)_arrs.size(); + return ToIdType(_arrs.size()); } -void DataArrayDoubleCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse) +void DataArrayDoubleCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse) { if(!fine || !coarse) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineToCoarse : the input DataArrayDouble collections must be non NULL !"); @@ -204,7 +204,7 @@ void DataArrayDoubleCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC } } -void DataArrayDoubleCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine) +void DataArrayDoubleCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine) { if(!fine || !coarse) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFine : the input DataArrayDouble collections must be non NULL !"); @@ -218,7 +218,7 @@ void DataArrayDoubleCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC } } -void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine) +void DataArrayDoubleCollection::SynchronizeFineEachOther(mcIdType patchId, mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine) { if(!fatherOfFineMesh) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : father is NULL !"); @@ -229,7 +229,7 @@ void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostL return ; std::size_t nbOfCall(fieldsOnFine[0]->_arrs.size()); for(std::size_t i=0;igetPatchIdFromChildMesh(children[i])!=(int)i) + if(fatherOfFineMesh->getPatchIdFromChildMesh(children[i])!=ToIdType(i)) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeFineEachOther : internal error !"); for(std::size_t i=1;i_arrs.size()) @@ -246,7 +246,7 @@ void DataArrayDoubleCollection::SynchronizeFineEachOther(int patchId, int ghostL /*! * This method updates \a p1dac ghost zone parts using \a p2dac (which is really const). \a p2 is in the neighborhood of \a p1 (which size is defined by \a ghostLev). */ -void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac) +void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac) { if(!p1 || !p1dac || !p2 || !p2dac) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo : input pointer must be not NULL !"); @@ -262,7 +262,7 @@ void DataArrayDoubleCollection::SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, } } -void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine) +void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine) { if(!fine || !coarse) throw INTERP_KERNEL::Exception("DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone : the input DataArrayDouble collections must be non NULL !"); @@ -273,7 +273,7 @@ void DataArrayDoubleCollection::SynchronizeCoarseToFineOnlyInGhostZone(int ghost fatherOfFineMesh->fillCellFieldOnPatchOnlyOnGhostZone(patchId,coarse->_arrs[i].first,fine->_arrs[i].first,ghostLev); } -void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const +void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const { DataArrayDoubleCollection *thisNC(const_cast(this)); std::size_t sz(_arrs.size()); @@ -283,7 +283,7 @@ void DataArrayDoubleCollection::synchronizeMyGhostZoneUsing(int ghostLev, const father->fillCellFieldOnPatchOnlyOnGhostZoneWith(ghostLev,thisp,otherp,thisNC->_arrs[i].first,other._arrs[i].first); } -void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const +void DataArrayDoubleCollection::synchronizeMyGhostZoneUsingExt(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const { DataArrayDoubleCollection *thisNC(const_cast(this)); std::size_t sz(_arrs.size()); @@ -309,7 +309,7 @@ DataArrayDoubleCollection::DataArrayDoubleCollection(const std::vector< std::pai _arrs[i].first=DataArrayDouble::New(); _arrs[i].first->alloc(0,info.second); _arrs[i].first->setName(info.first); - names[i]=info.second; + names[i]=info.first; _arrs[i].second=IntensiveMaximum; } CheckDiscriminantNames(names); @@ -389,11 +389,11 @@ MEDCouplingGridCollection *MEDCouplingGridCollection::deepCopy(const MEDCoupling return new MEDCouplingGridCollection(*this,newGf,oldGf); } -void MEDCouplingGridCollection::alloc(int ghostLev) +void MEDCouplingGridCollection::alloc(mcIdType ghostLev) { for(std::vector< std::pair > >::iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++) { - int nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev)); + mcIdType nbTuples((*it).first->getNumberOfCellsAtCurrentLevelGhost(ghostLev)); DataArrayDoubleCollection *dadc((*it).second); if(dadc) dadc->allocTuples(nbTuples); @@ -446,9 +446,9 @@ std::vector MEDCouplingGridCollection::getNatures() const return elt->getNatures(); } -bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const +bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const { - int ret(0); + mcIdType ret(0); for(std::vector< std::pair > >::const_iterator it=_map_of_dadc.begin();it!=_map_of_dadc.end();it++,ret++) { if((*it).first==m) @@ -460,16 +460,16 @@ bool MEDCouplingGridCollection::presenceOf(const MEDCouplingCartesianAMRMeshGen return false; } -const DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) const +const DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(mcIdType pos) const { - if(pos<0 || pos>(int)_map_of_dadc.size()) + if(pos<0 || pos>ToIdType(_map_of_dadc.size())) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::getFieldsAt : invalid pos given in input ! Must be in [0,size) !"); return *_map_of_dadc[pos].second; } -DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) +DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(mcIdType pos) { - if(pos<0 || pos>(int)_map_of_dadc.size()) + if(pos<0 || pos>ToIdType(_map_of_dadc.size())) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::getFieldsAt (non const) : invalid pos given in input ! Must be in [0,size) !"); return *_map_of_dadc[pos].second; } @@ -479,29 +479,29 @@ DataArrayDoubleCollection& MEDCouplingGridCollection::getFieldsAt(int pos) * part of fields of \a this. The fields are expected to be the same between \a other and \a this. * This methods makes the hypothesis that \a this and \a other share two god father that are compatible each other that is to say with the same cell grid structure. */ -void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other) +void MEDCouplingGridCollection::copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other) { 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 > rgThis((*it).first->positionRelativeToGodFather(deltaThis)); - std::vector thisSt((*it).first->getImageMesh()->getCellGridStructure()); - std::transform(thisSt.begin(),thisSt.end(),thisSt.begin(),std::bind2nd(std::plus(),2*ghostLev)); + std::vector deltaThis,deltaOther; + 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::bind2nd(std::plus(),2*ghostLev)); for(std::vector< std::pair > >::const_iterator it2=other._map_of_dadc.begin();it2!=other._map_of_dadc.end();it2++) { - std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); + std::vector< std::pair > rgOther((*it2).first->positionRelativeToGodFather(deltaOther)); if(MEDCouplingStructuredMesh::AreRangesIntersect(rgThis,rgOther)) { - std::vector< std::pair > isect(MEDCouplingStructuredMesh::IntersectRanges(rgThis,rgOther)); - std::vector< std::pair > pThis,pOther; + 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::bind2nd(std::plus(),2*ghostLev)); - int sz((*it2).second->size()); - for(int i=0;i(),2*ghostLev)); + mcIdType sz((*it2).second->size()); + for(mcIdType i=0;iat(i)); DataArrayDouble *thisArr((*it).second->at(i)); @@ -513,7 +513,7 @@ void MEDCouplingGridCollection::copyOverlappedZoneFrom(int ghostLev, const MEDCo } } -void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse) +void MEDCouplingGridCollection::SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse) { if(!fine || !coarse) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeFineToCoarse : one or more input pointer is NULL !"); @@ -529,7 +529,7 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC if((*it0).first==fatherOfFineMesh) { found=true; - int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); + mcIdType patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); const DataArrayDoubleCollection *coarseDaCol((*it0).second); DataArrayDoubleCollection *coarseModified(const_cast(coarseDaCol));//coarse values in DataArrayDouble will be altered DataArrayDoubleCollection::SynchronizeFineToCoarse(ghostLev,fatherOfFineMesh,patchId,(*it).second,coarseModified); @@ -540,7 +540,7 @@ void MEDCouplingGridCollection::SynchronizeFineToCoarse(int ghostLev, const MEDC } } -void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine) +void MEDCouplingGridCollection::SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine) { if(!fine || !coarse) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::SynchronizeCoarseToFine : one or more input pointer is NULL !"); @@ -556,7 +556,7 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC if((*it0).first==fatherOfFineMesh) { found=true; - int patchId(fatherOfFineMesh->getPatchIdFromChildMesh(fineMesh)); + 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); @@ -572,11 +572,11 @@ void MEDCouplingGridCollection::SynchronizeCoarseToFine(int ghostLev, const MEDC * * \sa synchronizeFineEachOtherExt */ -void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std::vector< std::pair >& ps) const +void MEDCouplingGridCollection::synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair >& ps) const { for(std::vector< std::pair >::const_iterator it=ps.begin();it!=ps.end();it++) { - int p1,p2; + mcIdType p1,p2; if(!presenceOf((*it).first->getMesh(),p1)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOther : internal error #1 !"); if(!presenceOf((*it).second->getMesh(),p2)) @@ -592,11 +592,11 @@ void MEDCouplingGridCollection::synchronizeFineEachOther(int ghostLev, const std * * \sa synchronizeFineEachOther */ -void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair >& ps) const +void MEDCouplingGridCollection::synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair >& ps) const { for(std::vector< std::pair >::const_iterator it=ps.begin();it!=ps.end();it++) { - int p1,p2; + mcIdType p1,p2; if(!presenceOf((*it).first->getMesh(),p1)) throw INTERP_KERNEL::Exception("MEDCouplingGridCollection::synchronizeFineEachOtherExt : internal error #1 !"); if(!presenceOf((*it).second->getMesh(),p2)) @@ -610,7 +610,7 @@ void MEDCouplingGridCollection::synchronizeFineEachOtherExt(int ghostLev, const /*! * The pairs returned share the same direct father. The number of returned elements must be even. */ -std::vector< std::pair > MEDCouplingGridCollection::findNeighbors(int ghostLev) const +std::vector< std::pair > MEDCouplingGridCollection::findNeighbors(mcIdType ghostLev) const { std::vector< std::pair > ret; std::map > m; @@ -624,10 +624,10 @@ std::vector< std::pair::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) { - int patchId((*it0).first->getPatchIdFromChildMesh(*it1)); - std::vector 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(std::vector::const_iterator it2=neighs.begin();it2!=neighs.end();it2++) + for(std::vector::const_iterator it2=neighs.begin();it2!=neighs.end();it2++) { const MEDCouplingCartesianAMRPatch *pLoc((*it0).first->getPatch(*it2)); ret.push_back(std::pair(pRef,pLoc)); @@ -639,7 +639,7 @@ std::vector< std::pairgetPatchIdFromChildMesh(fineMesh)); + 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); @@ -696,7 +696,7 @@ MEDCouplingGridCollection::MEDCouplingGridCollection(const MEDCouplingGridCollec std::size_t sz(other._map_of_dadc.size()); for(std::size_t i=0;i 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) @@ -783,12 +783,12 @@ MEDCouplingDataForGodFather::MEDCouplingDataForGodFather(const MEDCouplingDataFo /*! * This method creates, attach to a main AMR mesh \a gf ( called god father :-) ) and returns a data linked to \a gf ready for the computation. */ -MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev) +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev) { return new MEDCouplingAMRAttribute(gf,fieldNames,ghostLev); } -MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, int ghostLev) +MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, mcIdType ghostLev) { std::size_t sz(fieldNames.size()); std::vector< std::pair > fieldNames2(sz); @@ -842,10 +842,10 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::deepCpyWithoutGodFather() cons * Returns the number of levels by \b only \b considering \a this (god father instance is considered only to see if it has not changed still last update of \a this). * */ -int MEDCouplingAMRAttribute::getNumberOfLevels() const +mcIdType MEDCouplingAMRAttribute::getNumberOfLevels() const { checkGodFatherFrozen(); - return (int)_levs.size(); + return ToIdType(_levs.size()); } /*! @@ -859,7 +859,7 @@ std::vector MEDCouplingAMRAttribute::retrieveFieldsOn(MEDCoup { for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -876,7 +876,7 @@ const DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianA { for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -890,7 +890,7 @@ DataArrayDouble *MEDCouplingAMRAttribute::getFieldOn(MEDCouplingCartesianAMRMesh { for(std::vector< MCAuto >::iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -912,7 +912,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnRecurseWithoutO std::size_t lev(0); for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++,lev++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -942,7 +942,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithGhost(MEDCo const DataArrayDouble *arr(0); for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -972,7 +972,7 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME const DataArrayDouble *arr(0); for(std::vector< MCAuto >::const_iterator it=_levs.begin();it!=_levs.end();it++) { - int tmp(-1); + mcIdType tmp(-1); if((*it)->presenceOf(mesh,tmp)) { const DataArrayDoubleCollection& ddc((*it)->getFieldsAt(tmp)); @@ -983,12 +983,12 @@ MEDCouplingFieldDouble *MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost(ME throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::buildCellFieldOnWithoutGhost : the mesh specified is not in the progeny of this !"); // MCAuto im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); - std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); + 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)); + std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); + std::vector fakeFactors(mesh->getImageMesh()->getSpaceDimension(),1); MEDCouplingIMesh::SpreadCoarseToFine(arr,cgsWG,arr2,cgs2,fakeFactors); arr2->copyStringInfoFrom(*arr); // @@ -1017,17 +1017,17 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons const MEDCouplingIMesh *gfm(gf->getImageMesh()); std::vector orig(gfm->getOrigin()); std::vector spacing(gfm->getDXYZ()); - int dim((int)orig.size()); + mcIdType dim(ToIdType(orig.size())); std::copy(orig.begin(),orig.end(),std::ostream_iterator(ofs," ")); ofs << "\" grid_description=\""; - for(int i=0;i\n"; // - int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()),kk(0); - for(int i=0;igetMaxNumberOfLevelsRelativeToThis()),kk(0); + for(mcIdType i=0;i patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); @@ -1041,8 +1041,8 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons ofs << "\">\n"; if(i!=maxLev-1) { - std::vector factors(patches[0]->getMesh()->getFactors()); - for(int k=0;k factors(patches[0]->getMesh()->getFactors()); + for(mcIdType k=0;kgetMesh()); if(patchCast) { - const std::vector< std::pair >& bltr(patchCast->getBLTRRangeRelativeToGF()); - for(int pp=0;pp >& bltr(patchCast->getBLTRRangeRelativeToGF()); + for(mcIdType pp=0;ppgetMesh()->getImageMesh()); - std::vector cgs(im->getCellGridStructure()); - for(int pp=0;pp cgs(im->getCellGridStructure()); + for(mcIdType pp=0;pppresenceOf((*it)->getMesh(),tmp)) { const DataArrayDoubleCollection& ddc(_levs[i]->getFieldsAt(tmp)); @@ -1080,12 +1080,12 @@ std::string MEDCouplingAMRAttribute::writeVTHB(const std::string& fileName) cons for(std::size_t pp=0;pp im(mesh->getImageMesh()->buildWithGhost(_ghost_lev)); - std::vector cgs(mesh->getImageMesh()->getCellGridStructure()),cgsWG(im->getCellGridStructure()); + 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)); + std::vector< std::pair > cgs2(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(cgs)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(cgs2,_ghost_lev); - std::vector 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]); // @@ -1134,7 +1134,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian MCAuto ret(MEDCouplingAMRAttribute::New(targetGF,fieldNames,_ghost_lev)); ret->spillNatures(lev0->getNatures()); ret->alloc(); - int 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 @@ -1144,7 +1144,7 @@ MEDCouplingAMRAttribute *MEDCouplingAMRAttribute::projectTo(MEDCouplingCartesian DataArrayDoubleCollection& colTarget(ret->_levs[0]->getFieldsAt(0)); colTarget.copyFrom(col); // then go deeper and deeper - for(int i=1;isynchronizeCoarseToFineByOneLevel(i-1); MEDCouplingGridCollection *targetCol(ret->_levs[i]); @@ -1174,7 +1174,7 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarse() while(sz>1) { sz--; - synchronizeFineToCoarseByOneLevel((int)sz); + synchronizeFineToCoarseByOneLevel(ToIdType(sz)); } } @@ -1188,16 +1188,16 @@ void MEDCouplingAMRAttribute::synchronizeFineToCoarse() * \param [in] toLev - an existing level considered as the target level to reach. * */ -void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(int fromLev, int toLev) +void MEDCouplingAMRAttribute::synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) { - int 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) return ;//nothing to do if(fromLevtoLev;i--) + for(mcIdType i=fromLev;i>toLev;i--) synchronizeFineToCoarseByOneLevel(i); } @@ -1213,7 +1213,7 @@ void MEDCouplingAMRAttribute::synchronizeCoarseToFine() 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) return ;//nothing to do if(fromLev>toLev) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeCoarseToFineBetween : the fromLev level is greater than toLev level ! Call synchronizeFineToCoarseBetween instead !"); - for(int i=fromLev;isynchronizeFineEachOtherExt(_ghost_lev,_cross_lev_neighbors[i]); @@ -1296,7 +1296,7 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const ME { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : input mesh is NULL !"); - int level(mesh->getAbsoluteLevelRelativeTo(_gf)),sz(getNumberOfLevels()); + mcIdType level(mesh->getAbsoluteLevelRelativeTo(_gf)),sz(getNumberOfLevels()); if(level<0 || level>=sz-1) throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf : the specified level does not exist ! Must be in [0,nbOfLevelsOfThis-1) !"); const std::vector< std::pair >& itemsToFilter(_neighbors[level+1]); @@ -1316,9 +1316,9 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesOfDirectChidrenOf(const ME * This method updates \b all the patches at level \a level each other without consideration of their father. * So this method is more time consuming than synchronizeAllGhostZonesOfDirectChidrenOf. */ -void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(int level) +void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) { - int 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) @@ -1338,9 +1338,9 @@ void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevel(int leve * This method updates ghost zones of patches at level \a level whatever their father \b using \b father \b patches \b ONLY (at level \b level - 1). * This method is useful to propagate to the ghost zone of childhood the modification. */ -void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level) +void MEDCouplingAMRAttribute::synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) { - int 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]); @@ -1408,12 +1408,12 @@ void MEDCouplingAMRAttribute::updateTime() const {//tony } -MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev) +MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev):MEDCouplingDataForGodFather(gf),_ghost_lev(ghostLev) { //gf non empty, checked by constructor - int maxLev(gf->getMaxNumberOfLevelsRelativeToThis()); + mcIdType maxLev(gf->getMaxNumberOfLevelsRelativeToThis()); _levs.resize(maxLev); - for(int i=0;i patches(gf->retrieveGridsAt(i)); std::size_t sz(patches.size()); @@ -1477,7 +1477,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t j=0;j pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); neigh3[j].first=_gf->getPatchAtPosition(pp1); neigh3[j].second=_gf->getPatchAtPosition(pp2); } @@ -1487,7 +1487,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t i=0;i pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); _mixed_lev_neighbors[i].first=_gf->getPatchAtPosition(pp1); _mixed_lev_neighbors[i].second=_gf->getPatchAtPosition(pp2); } @@ -1501,7 +1501,7 @@ MEDCouplingAMRAttribute::MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& for(std::size_t j=0;j pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); + std::vector pp1(p1->getMesh()->getPositionRelativeTo(other._gf)),pp2(p2->getMesh()->getPositionRelativeTo(other._gf)); neigh3[j].first=_gf->getPatchAtPosition(pp1); neigh3[j].second=_gf->getPatchAtPosition(pp2); } @@ -1515,7 +1515,7 @@ const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttached const MEDCouplingGridCollection *elt(*it); if(elt) { - int tmp(-1); + mcIdType tmp(-1); if(elt->presenceOf(m,tmp)) { return elt->getFieldsAt(tmp); @@ -1525,18 +1525,18 @@ const DataArrayDoubleCollection& MEDCouplingAMRAttribute::findCollectionAttached throw INTERP_KERNEL::Exception("MEDCouplingAMRAttribute::findCollectionAttachedTo : unable to find such part of mesh in this !"); } -void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(int level) +void MEDCouplingAMRAttribute::synchronizeFineToCoarseByOneLevel(mcIdType level) { - int 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]); MEDCouplingGridCollection::SynchronizeFineToCoarse(_ghost_lev,fine,coarse); } -void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(int level) +void MEDCouplingAMRAttribute::synchronizeCoarseToFineByOneLevel(mcIdType level) { - int 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 4e818db7e..22497d538 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.hxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.hxx @@ -33,7 +33,7 @@ namespace MEDCoupling public: static DataArrayDoubleCollection *New(const std::vector< std::pair >& fieldNames); DataArrayDoubleCollection *deepCopy() const; - void allocTuples(int nbOfTuples); + void allocTuples(mcIdType nbOfTuples); void dellocTuples(); void copyFrom(const DataArrayDoubleCollection& other); void spillInfoOnComponents(const std::vector< std::vector >& compNames); @@ -43,16 +43,16 @@ namespace MEDCoupling std::vector retrieveFields() const; const DataArrayDouble *getFieldWithName(const std::string& name) const; DataArrayDouble *getFieldWithName(const std::string& name); - DataArrayDouble *at(int pos); - const DataArrayDouble *at(int pos) const; - int size() const; - static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse); - static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine); - static void SynchronizeFineEachOther(int patchId, int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine); - static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, int patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine); - static void SynchronizeGhostZoneOfOneUsingTwo(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac); - void synchronizeMyGhostZoneUsing(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const; - void synchronizeMyGhostZoneUsingExt(int ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const; + DataArrayDouble *at(mcIdType pos); + const DataArrayDouble *at(mcIdType pos) const; + mcIdType size() const; + static void SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *fine, DataArrayDoubleCollection *coarse); + static void SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine); + static void SynchronizeFineEachOther(mcIdType patchId, mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, const std::vector& children, const std::vector& fieldsOnFine); + static void SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingCartesianAMRMeshGen *fatherOfFineMesh, mcIdType patchId, const DataArrayDoubleCollection *coarse, DataArrayDoubleCollection *fine); + static void SynchronizeGhostZoneOfOneUsingTwo(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const DataArrayDoubleCollection *p1dac, const MEDCouplingCartesianAMRPatch *p2, const DataArrayDoubleCollection *p2dac); + void synchronizeMyGhostZoneUsing(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp, const MEDCouplingCartesianAMRMeshGen *father) const; + void synchronizeMyGhostZoneUsingExt(mcIdType ghostLev, const DataArrayDoubleCollection& other, const MEDCouplingCartesianAMRPatch *thisp, const MEDCouplingCartesianAMRPatch *otherp) const; private: DataArrayDoubleCollection(const std::vector< std::pair >& fieldNames); DataArrayDoubleCollection(const DataArrayDoubleCollection& other); @@ -72,22 +72,22 @@ namespace MEDCoupling public: static MEDCouplingGridCollection *New(const std::vector& ms, const std::vector< std::pair >& fieldNames); MEDCouplingGridCollection *deepCopy(const MEDCouplingCartesianAMRMeshGen *newGf, const MEDCouplingCartesianAMRMeshGen *oldGf) const; - void alloc(int ghostLev); + void alloc(mcIdType ghostLev); void dealloc(); void spillInfoOnComponents(const std::vector< std::vector >& compNames); void spillNatures(const std::vector& nfs); std::vector< std::pair > > getInfoOnComponents() const; std::vector getNatures() const; - bool presenceOf(const MEDCouplingCartesianAMRMeshGen *m, int& pos) const; - const DataArrayDoubleCollection& getFieldsAt(int pos) const; - DataArrayDoubleCollection& getFieldsAt(int pos); - void copyOverlappedZoneFrom(int ghostLev, const MEDCouplingGridCollection& other); - static void SynchronizeFineToCoarse(int ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse); - static void SynchronizeCoarseToFine(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); - void synchronizeFineEachOther(int ghostLev, const std::vector< std::pair >& ps) const; - void synchronizeFineEachOtherExt(int ghostLev, const std::vector< std::pair >& ps) const; - std::vector< std::pair > findNeighbors(int ghostLev) const; - static void SynchronizeCoarseToFineOnlyInGhostZone(int ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); + bool presenceOf(const MEDCouplingCartesianAMRMeshGen *m, mcIdType& pos) const; + const DataArrayDoubleCollection& getFieldsAt(mcIdType pos) const; + DataArrayDoubleCollection& getFieldsAt(mcIdType pos); + void copyOverlappedZoneFrom(mcIdType ghostLev, const MEDCouplingGridCollection& other); + static void SynchronizeFineToCoarse(mcIdType ghostLev, const MEDCouplingGridCollection *fine, const MEDCouplingGridCollection *coarse); + static void SynchronizeCoarseToFine(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); + void synchronizeFineEachOther(mcIdType ghostLev, const std::vector< std::pair >& ps) const; + void synchronizeFineEachOtherExt(mcIdType ghostLev, const std::vector< std::pair >& ps) const; + std::vector< std::pair > findNeighbors(mcIdType ghostLev) const; + static void SynchronizeCoarseToFineOnlyInGhostZone(mcIdType ghostLev, const MEDCouplingGridCollection *coarse, const MEDCouplingGridCollection *fine); void fillIfInTheProgenyOf(const std::string& fieldName, const MEDCouplingCartesianAMRMeshGen *head, std::vector& recurseArrs) const; private: MEDCouplingGridCollection(const std::vector& ms, const std::vector< std::pair >& fieldNames); @@ -108,13 +108,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingCartesianAMRMesh *getMyGodFather(); MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMesh *getMyGodFather() const; MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarse() = 0; - MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev) = 0; + MEDCOUPLING_EXPORT virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev) = 0; MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFine() = 0; - MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev) = 0; + MEDCOUPLING_EXPORT virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev) = 0; MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZones() = 0; MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh) = 0; - MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level) = 0; - MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level) = 0; + MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level) = 0; + MEDCOUPLING_EXPORT virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level) = 0; MEDCOUPLING_EXPORT virtual void alloc() = 0; MEDCOUPLING_EXPORT virtual void dealloc() = 0; protected: @@ -131,13 +131,13 @@ namespace MEDCoupling class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel { public: - MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev); - MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, int ghostLev); + MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev); + MEDCOUPLING_EXPORT static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair > >& fieldNames, mcIdType ghostLev); MEDCOUPLING_EXPORT void spillInfoOnComponents(const std::vector< std::vector >& compNames); MEDCOUPLING_EXPORT void spillNatures(const std::vector& nfs); MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCopy() const; MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const; - MEDCOUPLING_EXPORT int getNumberOfLevels() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfLevels() const; MEDCOUPLING_EXPORT std::vector retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const; MEDCOUPLING_EXPORT const DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; MEDCOUPLING_EXPORT DataArrayDouble *getFieldOn(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName); @@ -149,13 +149,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingAMRAttribute *projectTo(MEDCouplingCartesianAMRMesh *targetGF) const; // MEDCOUPLING_EXPORT void synchronizeFineToCoarse(); - MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(int fromLev, int toLev); + MEDCOUPLING_EXPORT void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev); MEDCOUPLING_EXPORT void synchronizeCoarseToFine(); - MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(int fromLev, int toLev); + MEDCOUPLING_EXPORT void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev); MEDCOUPLING_EXPORT void synchronizeAllGhostZones(); MEDCOUPLING_EXPORT void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh); - MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(int level); - MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level); + MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level); + MEDCOUPLING_EXPORT void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level); // MEDCOUPLING_EXPORT void alloc(); MEDCOUPLING_EXPORT void dealloc(); @@ -165,13 +165,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; private: - MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, int ghostLev); + MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, const std::vector< std::pair >& fieldNames, mcIdType ghostLev); MEDCouplingAMRAttribute(const MEDCouplingAMRAttribute& other, bool deepCpyGF); const DataArrayDoubleCollection& findCollectionAttachedTo(const MEDCouplingCartesianAMRMeshGen *m) const; - void synchronizeFineToCoarseByOneLevel(int level); - void synchronizeCoarseToFineByOneLevel(int level); + void synchronizeFineToCoarseByOneLevel(mcIdType level); + void synchronizeCoarseToFineByOneLevel(mcIdType level); private: - int _ghost_lev; + mcIdType _ghost_lev; std::vector< MCAuto > _levs; std::vector< std::vector< std::pair > > _neighbors; std::vector< std::pair > _mixed_lev_neighbors; diff --git a/src/MEDCoupling/MEDCouplingCMesh.cxx b/src/MEDCoupling/MEDCouplingCMesh.cxx old mode 100644 new mode 100755 index bad815c4f..100e21341 --- a/src/MEDCoupling/MEDCouplingCMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCMesh.cxx @@ -107,10 +107,10 @@ const DataArrayDouble *MEDCouplingCMesh::getDirectAccessOfCoordsArrIfInStructure MEDCouplingCurveLinearMesh *MEDCouplingCMesh::buildCurveLinear() const { checkConsistencyLight(); - int dim(getSpaceDimension()); + std::size_t dim(getSpaceDimension()); MCAuto ret(MEDCouplingCurveLinearMesh::New()); ret->MEDCouplingStructuredMesh::operator=(*this); - INTERP_KERNEL::AutoPtr ngs(new int[dim]); + INTERP_KERNEL::AutoPtr ngs(new mcIdType[dim]); getNodeGridStructure(ngs); ret->setNodeGridStructure(ngs,ngs+dim); MCAuto coo(getCoordinatesAndOwner()); @@ -213,7 +213,7 @@ bool MEDCouplingCMesh::isEqualWithoutConsideringStr(const MEDCouplingMesh *other } void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalWith : Meshes are not the same !"); @@ -224,7 +224,7 @@ void MEDCouplingCMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int ce * 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, - DataArrayInt *&cellCor) const + DataArrayIdType *&cellCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); @@ -288,16 +288,16 @@ void MEDCouplingCMesh::checkConsistency(double eps) const _z_array->checkMonotonic(true, eps); } -void MEDCouplingCMesh::getNodeGridStructure(int *res) const +void MEDCouplingCMesh::getNodeGridStructure(mcIdType *res) const { - std::vector ret(getNodeGridStructure()); + std::vector ret(getNodeGridStructure()); std::copy(ret.begin(),ret.end(),res); } -std::vector MEDCouplingCMesh::getNodeGridStructure() const +std::vector MEDCouplingCMesh::getNodeGridStructure() const { static const char MSG[]="MEDCouplingCMesh::getNodeGridStructure : mesh is invalid ! null vectors (X, Y or Z) must be put contiguously at the end !"; - std::vector ret; + std::vector ret; bool isOK(true); if(_x_array) { @@ -328,11 +328,11 @@ std::vector MEDCouplingCMesh::getNodeGridStructure() const return ret; } -MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); int dim(getSpaceDimension()); - if(dim!=(int)cellPart.size()) + if(dim!=ToIdType(cellPart.size())) { std::ostringstream oss; oss << "MEDCouplingCMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -355,13 +355,13 @@ int MEDCouplingCMesh::getSpaceDimension() const return (int)getNodeGridStructure().size(); } -void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingCMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { - int tmp[3]; + mcIdType tmp[3]; int spaceDim=getSpaceDimension(); getSplitNodeValues(tmp); const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)}; - int tmp2[3]; + mcIdType tmp2[3]; GetPosFromId(nodeId,spaceDim,tmp,tmp2); for(int j=0;jgetConstPointer(); - int nb=c->getNbOfElems(); + mcIdType nb=ToIdType(c->getNbOfElems()); bbox[2*j]=coords[0]; bbox[2*j+1]=coords[nb-1]; j++; @@ -565,7 +565,7 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem=getNumberOfCells(); + mcIdType nbelem=ToIdType(getNumberOfCells()); MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); DataArrayDouble* array=DataArrayDouble::New(); @@ -575,16 +575,16 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const array->decrRef(); field->setMesh(const_cast(this)); field->synchronizeTimeWithMesh(); - int tmp[3]; + mcIdType tmp[3]; getSplitCellValues(tmp); 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(); - for(int icell=0;icellgetConstPointer(); - int nbOfNodes=getCoordsAt(i)->getNbOfElems(); + mcIdType nbOfNodes=getCoordsAt(i)->getNbOfElems(); double ref=pos[i]; const double *w=std::find_if(d,d+nbOfNodes,std::bind2nd(std::greater_equal(),ref)); - int w2=(int)std::distance(d,w); + mcIdType w2=ToIdType(std::distance(d,w)); if(w2& elts) const +void MEDCouplingCMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -665,7 +665,7 @@ void MEDCouplingCMesh::translate(const double *vector) /*! * Applies scaling transformation to all nodes of \a this mesh. - * \param [in] point - coordinates of a scaling center. This array is to be of + * \param [in] postd::size_t - coordinates of a scaling center. This array is to be of * size \a this->getSpaceDimension() at least. * \param [in] factor - a scale factor. */ @@ -677,7 +677,7 @@ void MEDCouplingCMesh::scale(const double *point, double factor) if(c) { double *coords=c->getPointer(); - int lgth=c->getNbOfElems(); + mcIdType lgth=ToIdType(c->getNbOfElems()); std::transform(coords,coords+lgth,coords,std::bind2nd(std::minus(),point[i])); std::transform(coords,coords+lgth,coords,std::bind2nd(std::multiplies(),factor)); std::transform(coords,coords+lgth,coords,std::bind2nd(std::plus(),point[i])); @@ -703,20 +703,21 @@ MEDCouplingMesh *MEDCouplingCMesh::mergeMyselfWith(const MEDCouplingMesh *other) DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const { MCAuto ret(DataArrayDouble::New()); - int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()); + mcIdType nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); - int tmp[3]; + mcIdType tmp[3]; getSplitNodeValues(tmp); const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)}; const double *tabsPtr[3]; - for(int j=0;jgetConstPointer(); ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0)); } - int tmp2[3]; - for(int i=0;ialloc(nbCells,spaceDim); double *pt=ret->getPointer(); - int tmp[3]; + mcIdType tmp[3]; getSplitCellValues(tmp); const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)}; 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); std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus()); std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),tabsPtr[j].begin(),std::bind2nd(std::multiplies(),0.5)); } - int tmp2[3]; + mcIdType tmp2[3]; for(int i=0;i& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -786,7 +787,7 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; for(int i=0;i<3;i++) { - int val=-1; + mcIdType val=-1; std::string st; if(thisArr[i]) { @@ -801,22 +802,22 @@ void MEDCouplingCMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.push_back(time); } -void MEDCouplingCMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *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); - int sum=0; + mcIdType sum=0; for(int i=0;i<3;i++) if(tinyInfo[i]!=-1) sum+=tinyInfo[i]; a2->alloc(sum,1); } -void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCouplingCMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { - a1=DataArrayInt::New(); + a1=DataArrayIdType::New(); a1->alloc(0,1); const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; - int sz=0; + mcIdType sz=0; for(int i=0;i<3;i++) { if(thisArr[i]) @@ -830,7 +831,7 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const 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 DataArrayInt *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]); @@ -849,7 +850,7 @@ void MEDCouplingCMesh::unserialization(const std::vector& tinyInfoD, con data+=tinyInfo[i]; } } - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } void MEDCouplingCMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const @@ -892,22 +893,22 @@ void MEDCouplingCMesh::reprQuickOverview(std::ostream& stream) const const DataArrayDouble *thisArr[3]={_x_array,_y_array,_z_array}; std::ostringstream stream2[3]; bool isDef[3]; - int nbOfCells=1,nbOfNodes=1; + mcIdType nbOfCells=1,nbOfNodes=1; for(int i=0;i<3;i++) { isDef[i]=thisArr[i]!=0; if(isDef[i]) { - char tmp='X'+i; + char tmp=(char)((int)('X')+i); stream2[i] << tmp << " positions array "; if(!thisArr[i]->isAllocated()) stream2[i] << "set but not allocated."; else { - int nbCompo=thisArr[i]->getNumberOfComponents(); + std::size_t nbCompo=thisArr[i]->getNumberOfComponents(); if(nbCompo==1) { - int 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 e97618ed6..ae68dffb8 100644 --- a/src/MEDCoupling/MEDCouplingCMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCMesh.hxx @@ -45,13 +45,13 @@ namespace MEDCoupling 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, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; + 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(int nodeId, std::vector& coo) 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; @@ -64,8 +64,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void getBoundingBox(double *bbox) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) 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); @@ -73,16 +73,16 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const; - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx old mode 100644 new mode 100755 index c4ea2728f..ef0ed1bfc --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.cxx @@ -33,17 +33,17 @@ using namespace MEDCoupling; /// @cond INTERNAL -int MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithOverlap() const +mcIdType MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithOverlap() const { return _mesh->getNumberOfCellsRecursiveWithOverlap(); } -int MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithoutOverlap() const +mcIdType MEDCouplingCartesianAMRPatchGen::getNumberOfCellsRecursiveWithoutOverlap() const { return _mesh->getNumberOfCellsRecursiveWithoutOverlap(); } -int MEDCouplingCartesianAMRPatchGen::getMaxNumberOfLevelsRelativeToThis() const +mcIdType MEDCouplingCartesianAMRPatchGen::getMaxNumberOfLevelsRelativeToThis() const { return _mesh->getMaxNumberOfLevelsRelativeToThis(); } @@ -90,9 +90,9 @@ std::vector MEDCouplingCartesianAMRPatchGen::getDirectC * \param [in] bottomLeftTopRight a vector equal to the space dimension of \a mesh that specifies for each dimension, the included cell start of the range for the first element of the pair, * a the end cell (\b excluded) of the range for the second element of the pair. */ -MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight):MEDCouplingCartesianAMRPatchGen(mesh),_bl_tr(bottomLeftTopRight) +MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight):MEDCouplingCartesianAMRPatchGen(mesh),_bl_tr(bottomLeftTopRight) { - int dim((int)bottomLeftTopRight.size()),dimExp(_mesh->getSpaceDimension()); + std::size_t dim(bottomLeftTopRight.size()),dimExp(_mesh->getSpaceDimension()); if(dim!=dimExp) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch constructor : space dimension of father and input bottomLeft/topRight size mismatches !"); } @@ -102,12 +102,12 @@ MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRPatch::deepCopy(MEDCoupling return new MEDCouplingCartesianAMRPatch(*this,father); } -void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) +void MEDCouplingCartesianAMRPatch::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) { return getMeshSafe()->addPatch(bottomLeftTopRight,factors); } -int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const +mcIdType MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const { return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(_bl_tr); } @@ -126,14 +126,14 @@ int MEDCouplingCartesianAMRPatch::getNumberOfOverlapedCellsForFather() const * * \sa isInMyNeighborhoodExt */ -bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const +bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the size of the neighborhood must be >= 0 !"); if(!other) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhood : the input patch is NULL !"); - const std::vector< std::pair >& thisp(getBLTRRange()); - const std::vector< std::pair >& otherp(other->getBLTRRange()); + const std::vector< std::pair >& thisp(getBLTRRange()); + const std::vector< std::pair >& otherp(other->getBLTRRange()); return IsInMyNeighborhood(ghostLev==0?0:1,thisp,otherp);//make hypothesis that nb this->_mesh->getFather->getFactors() is >= ghostLev } @@ -152,19 +152,19 @@ bool MEDCouplingCartesianAMRPatch::isInMyNeighborhood(const MEDCouplingCartesian * * \sa isInMyNeighborhood, isInMyNeighborhoodDiffLev */ -bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const +bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt : the size of the neighborhood must be >= 0 !"); if(!other) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt : the input patch is NULL !"); - int lev; + mcIdType lev; const MEDCouplingCartesianAMRMeshGen *com(FindCommonAncestor(this,other,lev));//check that factors are OK if(lev==0) return isInMyNeighborhood(other,ghostLev); - std::vector offset(ComputeOffsetFromTwoToOne(com,lev,this,other)); - const std::vector< std::pair >& thisp(getBLTRRange()); - std::vector< std::pair > otherp(other->getBLTRRange()); + 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); return IsInMyNeighborhood(ghostLev,thisp,otherp); } @@ -184,24 +184,24 @@ bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodExt(const MEDCouplingCartes * * \sa isInMyNeighborhoodExt */ -bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const +bool MEDCouplingCartesianAMRPatch::isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const { - std::vector< std::pair > thispp,otherpp; - std::vector factors; + std::vector< std::pair > thispp,otherpp; + std::vector factors; ComputeZonesOfTwoRelativeToOneDiffLev(ghostLev,this,other,thispp,otherpp,factors); return IsInMyNeighborhood(ghostLev>0?1:0,thispp,otherpp);//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 } -std::vector< std::pair > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const +std::vector< std::pair > MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF() const { - std::vector< std::pair > ret(_bl_tr); + std::vector< std::pair > ret(_bl_tr); const MEDCouplingCartesianAMRMeshGen *mesh(getMesh()); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid !"); const MEDCouplingCartesianAMRMeshGen *fath(mesh->getFather()); if(!fath) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::getBLTRRangeRelativeToGF : not valid 2 !"); - std::vector factors(fath->getFactors()); + std::vector factors(fath->getFactors()); std::size_t sz(ret.size()); for(std::size_t ii=0;ii > MEDCouplingCartesianAMRPatch::getBLTRRangeRela fath=oldFather->getFather(); while(fath) { - int 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()); + 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::getBLTRRangeRela return ret; } -std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const +std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const { const MEDCouplingCartesianAMRMeshGen *m(getMesh()); if(!m) @@ -237,22 +237,22 @@ std::vector MEDCouplingCartesianAMRPatch::computeCellGridSt() const const MEDCouplingCartesianAMRMeshGen *father(m->getFather()); if(!father) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::computeCellGridSt : no father help by underlying mesh !"); - const std::vector< std::pair >& bltr(getBLTRRange()); - const std::vector& factors(father->getFactors()); - std::vector ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr)); - std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies()); + const std::vector< std::pair >& bltr(getBLTRRange()); + const std::vector& factors(father->getFactors()); + std::vector ret(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(bltr)); + std::transform(ret.begin(),ret.end(),factors.begin(),ret.begin(),std::multiplies()); return ret; } -bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(int ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2) +bool MEDCouplingCartesianAMRPatch::IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2) { 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& thispp(p1[i]); - const std::pair& otherpp(p2[i]); + const std::pair& thispp(p1[i]); + const std::pair& otherpp(p2[i]); if(thispp.second > > MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) +std::vector< std::vector< std::pair > > MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2) { if(!p1 || !p2) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOfSameLev : the input pointers must be not NULL !"); @@ -310,7 +310,7 @@ std::vector< std::vector< std::pair >& ret) +void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret) { if(!p1 || !p2) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf : the input pointers must be not NULL !"); @@ -334,10 +334,10 @@ void MEDCouplingCartesianAMRPatch::FindNeighborsOfSubPatchesOf(int ghostLev, con * * \saUpdateNeighborsOfOneWithTwoExt */ -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) +void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) { - const std::vector< std::pair >& p1BLTR(p1->getBLTRRange()); - const std::vector< std::pair >& p2BLTR(p2->getBLTRRange()); + const std::vector< std::pair >& p1BLTR(p1->getBLTRRange()); + const std::vector< std::pair >& p2BLTR(p2->getBLTRRange()); UpdateNeighborsOfOneWithTwoInternal(ghostLev,factors,p1BLTR,p2BLTR,dataOnP1,dataOnP2); } @@ -346,13 +346,13 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(int ghostLev, con * * \sa UpdateNeighborsOfOneWithTwo */ -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) +void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) { - const std::vector< std::pair >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)] - std::vector< std::pair > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)] - int lev(0); + const std::vector< std::pair >& p1BLTR(p1->getBLTRRange());//p1BLTR=[(10,12),(5,8)] + std::vector< std::pair > p2BLTR(p2->getBLTRRange());//p2BLTR=[(0,1),(0,5)] + mcIdType lev(0); const MEDCouplingCartesianAMRMeshGen *ca(FindCommonAncestor(p1,p2,lev)); - std::vector 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); } @@ -360,23 +360,23 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoExt(int ghostLev, /*! * \a p1 is expected to be more refined than \a p2. \a p1 and \a p2 have to share a common ancestor. Compared to UpdateNeighborsOfOneWithTwoExt here \a p1 and \a p2 are \b not at the same level ! */ -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative) +void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative) { - std::vector< std::pair > p1pp,p2pp; - std::vector factors; + std::vector< std::pair > p1pp,p2pp; + std::vector factors; ComputeZonesOfTwoRelativeToOneDiffLev(ghostLev,p1,p2,p1pp,p2pp,factors); // - 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 > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); - std::vector dimsP2RefinedGhost(dimsP2Refined.size()); - std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); + 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 > p2RefinedAbs(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsP2NotRefined)); + std::vector dimsP2RefinedGhost(dimsP2Refined.size()); + std::transform(dimsP2Refined.begin(),dimsP2Refined.end(),dimsP2RefinedGhost.begin(),std::bind2nd(std::plus(),2*ghostLev)); MCAuto fineP2(DataArrayDouble::New()); fineP2->alloc(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(dimsP2RefinedGhost),dataOnP2->getNumberOfComponents()); MEDCouplingIMesh::SpreadCoarseToFineGhost(dataOnP2,dimsP2NotRefined,fineP2,p2RefinedAbs,factors,ghostLev); if(isConservative) { - int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors)); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(factors)); std::transform(fineP2->begin(),fineP2->end(),fineP2->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); } // @@ -388,7 +388,7 @@ void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoMixedLev(int ghost * 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(int 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(0); @@ -424,24 +424,24 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int gho throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev : this method is not called correctly !"); // const MEDCouplingCartesianAMRMeshGen *comAncestor(ancestorsOfThis[levThis]); - int idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2)); + mcIdType idThis(comAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-1])),idOther(comAncestor->getPatchIdFromChildMesh(work2)); const MEDCouplingCartesianAMRPatch *thisp(comAncestor->getPatch(idThis)),*otherp(comAncestor->getPatch(idOther)); - std::vector offset(ComputeOffsetFromTwoToOne(comAncestor,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 nbOfTurn(levThis-levOther); for(std::size_t i=0;i > tmp0; + std::vector< std::pair > tmp0; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(p1Zone,p2Zone,tmp0,false); p2Zone=tmp0; const MEDCouplingCartesianAMRMeshGen *curAncestor(ancestorsOfThis[levThis-i]); ApplyFactorsOnCompactFrmt(p2Zone,curAncestor->getFactors()); curAncestor=ancestorsOfThis[levThis-1-i]; - const std::vector& factors(curAncestor->getFactors()); - std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies()); - int tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); + const std::vector& factors(curAncestor->getFactors()); + std::transform(factToApplyOn2.begin(),factToApplyOn2.end(),factors.begin(),factToApplyOn2.begin(),std::multiplies()); + mcIdType tmpId(curAncestor->getPatchIdFromChildMesh(ancestorsOfThis[levThis-2-i])); p1Zone=curAncestor->getPatch(tmpId)->getBLTRRange(); } } @@ -449,11 +449,11 @@ void MEDCouplingCartesianAMRPatch::ComputeZonesOfTwoRelativeToOneDiffLev(int gho std::size_t MEDCouplingCartesianAMRPatch::getHeapMemorySizeWithoutChildren() const { std::size_t ret(sizeof(MEDCouplingCartesianAMRPatch)); - ret+=_bl_tr.capacity()*sizeof(std::pair); + ret+=_bl_tr.capacity()*sizeof(std::pair); return ret; } -const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, int& lev) +const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, mcIdType& lev) { const MEDCouplingCartesianAMRMeshGen *f1(p1->_mesh),*f2(p2->_mesh); lev=0; @@ -469,33 +469,33 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRPatch::FindCommonAn return f1; } -std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int 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 !"); - int zeLev(lev-1); - int 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< int > ret(dim,0); - for(int i=0;i ret(dim,0); + for(mcIdType i=0;i_mesh),*f2(p2->_mesh); const MEDCouplingCartesianAMRPatch *p1h(0),*p2h(0); - for(int j=0;jgetFather()),*f2tmp(f2->getFather()); - int pid1(f1tmp->getPatchIdFromChildMesh(f1)),pid2(f2tmp->getPatchIdFromChildMesh(f2)); + mcIdType pid1(f1tmp->getPatchIdFromChildMesh(f1)),pid2(f2tmp->getPatchIdFromChildMesh(f2)); p1h=f1tmp->getPatch(pid1); p2h=f2tmp->getPatch(pid2); f1=f1tmp; f2=f2tmp; } - std::vector< std::pair > p2c(p2h->getBLTRRange()); - for(int k=0;k > p2c(p2h->getBLTRRange()); + for(mcIdType k=0;kgetBLTRRange()[k].first; ret[k]*=f1->getFactors()[k]; @@ -504,25 +504,25 @@ std::vector MEDCouplingCartesianAMRPatch::ComputeOffsetFromTwoToOne(const M return ret; } -void MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2) +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)] - int dim((int)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::bind2nd(std::plus(),2*ghostLev));//[14,10] - std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] - std::vector fakeFactors(dim,1); + 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::bind2nd(std::plus(),2*ghostLev));//[14,10] + std::vector< std::pair > rangeCoarse(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dimsCoarse));//[(0,14),(0,10)] + std::vector fakeFactors(dim,1); // - std::vector< std::pair > tmp0,tmp1,tmp2; + 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 > 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)] // - std::vector< std::pair > dimsFine(p2); + std::vector< std::pair > dimsFine(p2); ApplyFactorsOnCompactFrmt(dimsFine,factors); ApplyAllGhostOnCompactFrmt(dimsFine,ghostLev); // @@ -538,7 +538,7 @@ MEDCouplingCartesianAMRPatch::MEDCouplingCartesianAMRPatch(const MEDCouplingCart * \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in refined reference. * \param [in] factors - the factors per axis. */ -void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors) +void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors) { std::size_t sz(factors.size()); if(sz!=partBeforeFact.size()) @@ -556,7 +556,7 @@ void MEDCouplingCartesianAMRPatch::ApplyFactorsOnCompactFrmt(std::vector< std::p * \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in ghost reference. * \param [in] ghostSize - the ghost size of zone for all axis. */ -void MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize) +void MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRPatch::ApplyAllGhostOnCompactFrmt : ghost size must be >= 0 !"); @@ -593,9 +593,9 @@ int MEDCouplingCartesianAMRMeshGen::getSpaceDimension() const return _mesh->getSpaceDimension(); } -void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFactors) +void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFactors) { - if(getSpaceDimension()!=(int)newFactors.size()) + if(getSpaceDimension()!=ToIdType(newFactors.size())) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::setFactors : size of input factors is not equal to the space dimension !"); if(_factors.empty()) { @@ -610,9 +610,9 @@ void MEDCouplingCartesianAMRMeshGen::setFactors(const std::vector& newFacto declareAsNew(); } -int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const +mcIdType MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const { - int ret(1); + mcIdType ret(1); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) ret=std::max(ret,(*it)->getMaxNumberOfLevelsRelativeToThis()+1); return ret; @@ -623,7 +623,7 @@ int MEDCouplingCartesianAMRMeshGen::getMaxNumberOfLevelsRelativeToThis() const * The patches in \a this are ignored here. * \sa getNumberOfCellsAtCurrentLevelGhost, getNumberOfCellsRecursiveWithOverlap */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const { return _mesh->getNumberOfCells(); } @@ -635,7 +635,7 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevel() const * * \sa getNumberOfCellsAtCurrentLevel */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const { MCAuto tmp(_mesh->buildWithGhost(ghostLev)); return tmp->getNumberOfCells(); @@ -645,9 +645,9 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsAtCurrentLevelGhost(int ghos * This method returns the number of cells including the current level but \b also \b including recursively all cells of other levels * starting from this. The set of cells which size is returned here are generally overlapping each other. */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const { - int ret(_mesh->getNumberOfCells()); + mcIdType ret=_mesh->getNumberOfCells(); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret+=(*it)->getNumberOfCellsRecursiveWithOverlap(); @@ -662,9 +662,9 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithOverlap() const * * \sa buildUnstructured */ -int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() const { - int ret(_mesh->getNumberOfCells()); + mcIdType ret=_mesh->getNumberOfCells(); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++) { ret-=(*it)->getNumberOfOverlapedCellsForFather(); @@ -679,11 +679,11 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfCellsRecursiveWithoutOverlap() co * * \sa getPatchAtPosition */ -std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const +std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const { if(!ref) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo : input pointer is NULL !"); - std::vector ret; + std::vector ret; getPositionRelativeToInternal(ref,ret); std::reverse(ret.begin(),ret.end()); return ret; @@ -692,27 +692,27 @@ std::vector MEDCouplingCartesianAMRMeshGen::getPositionRelativeTo(const MED /*! * \sa getPositionRelativeTo, getMeshAtPosition */ -const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector& pos) const +const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatchAtPosition(const std::vector& pos) const { std::size_t sz(pos.size()); if(sz==0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : empty input -> no patch by definition !"); - int 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 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 +const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtPosition(const std::vector& pos) const { std::size_t sz(pos.size()); if(sz==0) return this; - int patchId(pos[0]); + mcIdType patchId(pos[0]); const MEDCouplingCartesianAMRPatch *elt(getPatch(patchId)); if(sz==1) { @@ -722,7 +722,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtP } if(!elt || !elt->getMesh()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::getPatchAtPosition : NULL element found during walk !"); - std::vector pos2(pos.begin()+1,pos.end()); + std::vector pos2(pos.begin()+1,pos.end()); return elt->getMesh()->getMeshAtPosition(pos2); } @@ -731,7 +731,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshGen::getMeshAtP * * \return std::vector - objects in vector are to be managed (decrRef) by the caller. */ -std::vector MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(int absoluteLev) const +std::vector MEDCouplingCartesianAMRMeshGen::retrieveGridsAt(mcIdType absoluteLev) const { if(absoluteLev<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::retrieveGridsAt : absolute level must be >=0 !"); @@ -743,7 +743,7 @@ std::vector MEDCouplingCartesianAMRMeshGen::r * a the end cell (\b excluded) of the range for the second element of the pair. * \param [in] factors The factor of refinement per axis (different from 0). */ -void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors) { checkFactorsAndIfNotSetAssign(factors); MCAuto mesh(static_cast(_mesh->buildStructuredSubPart(bottomLeftTopRight))); @@ -760,38 +760,38 @@ class InternalPatch : public RefCountObjectOnly { public: InternalPatch():_nb_of_true(0) { } - int getDimension() const { return (int)_part.size(); } + mcIdType getDimension() const { return ToIdType(_part.size()); } double getEfficiency() const { return (double)_nb_of_true/(double)_crit.size(); } - int getNumberOfCells() const { return (int)_crit.size(); } - void setNumberOfTrue(int nboft) { _nb_of_true=nboft; } + mcIdType getNumberOfCells() const { return ToIdType(_crit.size()); } + void setNumberOfTrue(mcIdType nboft) { _nb_of_true=nboft; } std::vector& getCriterion() { return _crit; } const std::vector& getConstCriterion() const { return _crit; } - void setPart(const std::vector< std::pair >& part) { _part=part; } - std::vector< std::pair >& getPart() { return _part; } - const std::vector< std::pair >& getConstPart() const { return _part; } + void setPart(const std::vector< std::pair >& part) { _part=part; } + std::vector< std::pair >& getPart() { return _part; } + const std::vector< std::pair >& getConstPart() const { return _part; } bool presenceOfTrue() const { return _nb_of_true>0; } - std::vector computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); } - std::vector< std::vector > computeSignature() const { return MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(computeCGS(),getConstCriterion()); } - double getEfficiencyPerAxis(int axisId) const { return (double)_nb_of_true/((double)(_part[axisId].second-_part[axisId].first)); } - void zipToFitOnCriterion(int minPatchLgth); + std::vector computeCGS() const { return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(_part); } + std::vector< std::vector > computeSignature() const { return MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(computeCGS(),getConstCriterion()); } + double getEfficiencyPerAxis(mcIdType axisId) const { return (double)_nb_of_true/((double)(_part[axisId].second-_part[axisId].first)); } + void zipToFitOnCriterion(mcIdType minPatchLgth); void updateNumberOfTrue() const; - MCAuto extractPart(const std::vector< std::pair >&partInGlobal) const; + MCAuto extractPart(const std::vector< std::pair >&partInGlobal) const; MCAuto deepCopy() const; protected: ~InternalPatch() { } private: - mutable int _nb_of_true; + mutable mcIdType _nb_of_true; std::vector _crit; //! _part is global - std::vector< std::pair > _part; + std::vector< std::pair > _part; }; -void InternalPatch::zipToFitOnCriterion(int minPatchLgth) +void InternalPatch::zipToFitOnCriterion(mcIdType minPatchLgth) { - std::vector cgs(computeCGS()); + std::vector cgs(computeCGS()); std::vector newCrit; - std::vector< std::pair > newPart,newPart2; - int newNbOfTrue(MEDCouplingStructuredMesh::FindMinimalPartOf(minPatchLgth,cgs,_crit,newCrit,newPart)); + std::vector< std::pair > newPart,newPart2; + 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 !"); @@ -800,14 +800,14 @@ void InternalPatch::zipToFitOnCriterion(int minPatchLgth) void InternalPatch::updateNumberOfTrue() const { - _nb_of_true=(int)std::count(_crit.begin(),_crit.end(),true); + _nb_of_true=ToIdType(std::count(_crit.begin(),_crit.end(),true)); } -MCAuto InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const +MCAuto InternalPatch::extractPart(const std::vector< std::pair >&partInGlobal) const { MCAuto ret(new InternalPatch); - std::vector cgs(computeCGS()); - std::vector< std::pair > newPart; + std::vector cgs(computeCGS()); + std::vector< std::pair > newPart; MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(_part,partInGlobal,newPart); MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(cgs,_crit,newPart,ret->getCriterion()); ret->setPart(partInGlobal); @@ -822,19 +822,19 @@ MCAuto InternalPatch::deepCopy() const return ret; } -void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int largestLength, int& cutPlace) +void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType largestLength, mcIdType& cutPlace) { - int minimumPatchLength(bso.getMinimumPatchLength()); + mcIdType minimumPatchLength(bso.getMinimumPatchLength()); std::vector ratio(largestLength-minimumPatchLength,std::numeric_limits::max()); - int index_min = -1; + mcIdType index_min = -1; double minSemiEfficiencyRatio(std::numeric_limits::max()); double efficiencyPerAxis[2]; - for(int i=minimumPatchLength-1;i > rectH(patchToBeSplit->getConstPart()); + std::vector< std::pair > rectH(patchToBeSplit->getConstPart()); if(h==0) rectH[axisId].second=patchToBeSplit->getConstPart()[axisId].first+i; else @@ -857,26 +857,26 @@ void DissectBigPatch(const INTERP_KERNEL::BoxSplittingOptions& bso, const Intern cutPlace=index_min+patchToBeSplit->getConstPart()[axisId].first; } -bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int& cutPlace) +bool FindHole(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType& cutPlace) { cutPlace=-1; - int minimumPatchLength(bso.getMinimumPatchLength()); - const int dim(patchToBeSplit->getDimension()); - std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); - for(int id=0;idgetDimension()); + std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); + for(mcIdType id=0;id& signature(signatures[id]); - std::vector hole; + const std::vector& signature(signatures[id]); + std::vector hole; std::vector distance; - int len((int)signature.size()); - for(int i=minimumPatchLength-1;i >& part(patchToBeSplit->getConstPart()); - int sign,minimumPatchLength(bso.getMinimumPatchLength()); - const int dim(patchToBeSplit->getDimension()); - - std::vector zeroCrossDims(dim,-1); - std::vector zeroCrossVals(dim,-1); - std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); - for (int id=0;id >& part(patchToBeSplit->getConstPart()); + mcIdType sign,minimumPatchLength(bso.getMinimumPatchLength()); + const mcIdType dim(patchToBeSplit->getDimension()); + + std::vector zeroCrossDims(dim,-1); + std::vector zeroCrossVals(dim,-1); + std::vector< std::vector > signatures(patchToBeSplit->computeSignature()); + for (mcIdType id=0;id& signature(signatures[id]); + const std::vector& signature(signatures[id]); - std::vector derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ; + std::vector derivate_second_order,gradient_absolute,zero_cross,edge,max_cross_list ; std::vector distance ; for(std::size_t i=1;i= (std::size_t)minimumPatchLength-2 && i <= signature.size()-minimumPatchLength-2 ) { - zero_cross.push_back(i) ; + zero_cross.push_back(ToIdType(i)) ; edge.push_back(gradient_absolute[i]) ; } } if ( zero_cross.size() > 0 ) { - int max_cross=*max_element(edge.begin(),edge.end()) ; - for (unsigned int i=0;i(signature.size())/2.0); + for (std::size_t i=0;i(max_cross_list[i])+1-center)); double distance_min=*min_element(distance.begin(),distance.end()) ; - int pos_distance_min=find(distance.begin(),distance.end(),distance_min)-distance.begin(); - int best_place = max_cross_list[pos_distance_min] + part[id].first ; + 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 ; @@ -963,27 +963,27 @@ bool FindInflection(const INTERP_KERNEL::BoxSplittingOptions& bso, const Interna if ( zeroCrossDims[0]!=-1 || zeroCrossDims[1]!=-1 ) { - int max_cross_dims = *max_element(zeroCrossVals.begin(),zeroCrossVals.end()) ; + mcIdType max_cross_dims = *max_element(zeroCrossVals.begin(),zeroCrossVals.end()) ; if (zeroCrossVals[0]==max_cross_dims && zeroCrossVals[1]==max_cross_dims ) { - int nl_left(part[0].second-part[0].first); - int 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 max_cross_dims = 1 ; } else - max_cross_dims=std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin(); + max_cross_dims=ToIdType(std::find(zeroCrossVals.begin(),zeroCrossVals.end(),max_cross_dims)-zeroCrossVals.begin()); cutFound=true; cutPlace=zeroCrossDims[max_cross_dims]; - axisId=max_cross_dims ; + axisId=FromIdType(max_cross_dims); } return cutFound; } -bool TryAction4(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, int axisId, int rangeOfAxisId, int& cutPlace) +bool TryAction4(const INTERP_KERNEL::BoxSplittingOptions& bso, const InternalPatch *patchToBeSplit, mcIdType axisId, mcIdType rangeOfAxisId, mcIdType& cutPlace) { if(patchToBeSplit->getEfficiency()<=bso.getEfficiencyGoal()) { @@ -1013,16 +1013,16 @@ MCAuto DealWithNoCut(const InternalPatch *patch) return ret; } -void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, int cutPlace, std::vector >& listOfPatches) +void DealWithCut(double minPatchLgth, const InternalPatch *patchToBeSplit, int axisId, mcIdType cutPlace, std::vector >& listOfPatches) { MCAuto leftPart,rightPart; - std::vector< std::pair > rect(patchToBeSplit->getConstPart()); - std::vector< std::pair > leftRect(rect),rightRect(rect); + 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; leftPart=patchToBeSplit->extractPart(leftRect); rightPart=patchToBeSplit->extractPart(rightRect); - leftPart->zipToFitOnCriterion(minPatchLgth); rightPart->zipToFitOnCriterion(minPatchLgth); + leftPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); rightPart->zipToFitOnCriterion(ToIdType(minPatchLgth)); listOfPatches.push_back(leftPart); listOfPatches.push_back(rightPart); } @@ -1035,12 +1035,12 @@ void MEDCouplingCartesianAMRMeshGen::removeAllPatches() declareAsNew(); } -void MEDCouplingCartesianAMRMeshGen::removePatch(int patchId) +void MEDCouplingCartesianAMRMeshGen::removePatch(mcIdType patchId) { checkPatchId(patchId); - int sz((int)_patches.size()),j(0); + mcIdType sz(ToIdType(_patches.size())),j(0); std::vector< MCAuto > patches(sz-1); - for(int i=0;i(_patches[patchId]->getMesh()))->detachFromFather(); @@ -1048,9 +1048,9 @@ void MEDCouplingCartesianAMRMeshGen::removePatch(int patchId) declareAsNew(); } -int MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const +mcIdType MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const { - return (int)_patches.size(); + return ToIdType(_patches.size()); } /*! @@ -1070,13 +1070,13 @@ int MEDCouplingCartesianAMRMeshGen::getNumberOfPatches() const * for more information. * */ -void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors) { - int nbCells(getNumberOfCellsAtCurrentLevel()); - if(nbCells!=(int)criterion.size()) + 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 cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > listOfPatches,listOfPatchesOK; // MCAuto p(new InternalPatch); @@ -1089,7 +1089,8 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER for(std::vector< MCAuto >::iterator it=listOfPatches.begin();it!=listOfPatches.end();it++) { // - int axisId,largestLength,cutPlace; + int axisId; + mcIdType largestLength,cutPlace; MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt((*it)->getConstPart(),axisId,largestLength); if((*it)->getEfficiency()>=bso.getEfficiencyThreshold() && ((*it)->getNumberOfCells()>bso.getMaximumNbOfCellsInPatch() || largestLength>bso.getMaximumPatchLength())) { @@ -1117,7 +1118,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER * This method creates patches in \a this (by destroying the patches if any). This method uses \a criterion array as a field on cells on this level. * This method only create patches at level 0 relative to \a this. */ -void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors) { if(!criterion || !criterion->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : the criterion DataArrayByte instance must be allocated and not NULL !"); @@ -1126,7 +1127,7 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER declareAsNew(); } -void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps) +void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps) { if(!criterion) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion : null criterion pointer !"); @@ -1134,9 +1135,9 @@ void MEDCouplingCartesianAMRMeshGen::createPatchesFromCriterion(const INTERP_KER createPatchesFromCriterion(bso,inp,factors); } -int MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const +mcIdType MEDCouplingCartesianAMRMeshGen::getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const { - int ret(0); + mcIdType ret(0); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ret++) { if((*it)->getMesh()==mesh) @@ -1154,7 +1155,7 @@ std::vector< const MEDCouplingCartesianAMRPatch *> MEDCouplingCartesianAMRMeshGe return ret; } -const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(int patchId) const +const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(mcIdType patchId) const { checkPatchId(patchId); return _patches[patchId]; @@ -1164,7 +1165,7 @@ const MEDCouplingCartesianAMRPatch *MEDCouplingCartesianAMRMeshGen::getPatch(int * This method states if patch2 (with id \a patchId2) is in the neighborhood of patch1 (with id \a patchId1). * The neighborhood size is defined by \a ghostLev in the reference of \a this ( \b not in the reference of patches !). */ -bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const +bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const { const MEDCouplingCartesianAMRPatch *p1(getPatch(patchId1)),*p2(getPatch(patchId2)); return p1->isInMyNeighborhood(p2,ghostLev); @@ -1183,7 +1184,7 @@ bool MEDCouplingCartesianAMRMeshGen::isPatchInNeighborhoodOf(int patchId1, int p * \throw if \a cellFieldOnThis is NULL or not allocated * \sa fillCellFieldOnPatch, MEDCouplingIMesh::SpreadCoarseToFine */ -DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const +DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const { if(!cellFieldOnThis || !cellFieldOnThis->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatch : the input cell field array is NULL or not allocated !"); @@ -1205,7 +1206,7 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::createCellFieldOnPatch(int patc * * \sa createCellFieldOnPatch, fillCellFieldComingFromPatch */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative) const { if(!cellFieldOnThis || !cellFieldOnThis->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatch : the input cell field array is NULL or not allocated !"); @@ -1213,7 +1214,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const Dat MEDCouplingIMesh::SpreadCoarseToFine(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors()); if(isConservative) { - int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); } } @@ -1229,7 +1230,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatch(int patchId, const Dat * * \sa fillCellFieldOnPatch, fillCellFieldOnPatchGhostAdv */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative) const { if(!cellFieldOnThis || !cellFieldOnThis->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createCellFieldOnPatchGhost : the input cell field array is NULL or not allocated !"); @@ -1237,7 +1238,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, cons MEDCouplingIMesh::SpreadCoarseToFineGhost(cellFieldOnThis,_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),ghostLev); if(isConservative) { - int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); std::transform(cellFieldOnPatch->begin(),cellFieldOnPatch->end(),cellFieldOnPatch->getPointer(),std::bind2nd(std::multiplies(),1./((double)fact))); } } @@ -1251,7 +1252,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhost(int patchId, cons * \param [in,out] cellFieldOnPatch - The array of the cell field on the requested patch to be filled \b only \b in \b the \b ghost \b zone. * \param [in] ghostLev - The size of the ghost zone (must be >=0 !) */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const { if(!cellFieldOnThis || !cellFieldOnThis->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldOnPatchOnlyOnGhostZone : the input cell field array is NULL or not allocated !"); @@ -1271,10 +1272,10 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZone(int pat * * \sa fillCellFieldOnPatchOnlyGhostAdv */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector& arrsOnPatches, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector& arrsOnPatches, bool isConservative) const { - int nbp(getNumberOfPatches()); - if(nbp!=(int)arrsOnPatches.size()) + 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()); @@ -1291,25 +1292,25 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchGhostAdv(int patchId, c * * \sa getPatchIdsInTheNeighborhoodOf */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& arrsOnPatches) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector& arrsOnPatches) const { - int nbp(getNumberOfPatches()); - if(nbp!=(int)arrsOnPatches.size()) + 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)); DataArrayDouble *theFieldToFill(const_cast(arrsOnPatches[patchId])); - std::vector ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); - for(std::vector::const_iterator it=ids.begin();it!=ids.end();it++) + std::vector ids(getPatchIdsInTheNeighborhoodOf(patchId,ghostLev)); + for(std::vector::const_iterator it=ids.begin();it!=ids.end();it++) { const MEDCouplingCartesianAMRPatch *otherP(getPatch(*it)); MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,refP,otherP,theFieldToFill,arrsOnPatches[*it]); } } -void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const { MEDCouplingCartesianAMRPatch::UpdateNeighborsOfOneWithTwo(ghostLev,_factors,patchToBeModified,neighborPatch,cellFieldOnPatch,cellFieldNeighbor); } @@ -1326,7 +1327,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldOnPatchOnlyOnGhostZoneWith(int * \throw if \a cellFieldOnPatch is NULL or not allocated * \sa createCellFieldOnPatch, MEDCouplingIMesh::CondenseFineToCoarse,fillCellFieldComingFromPatchGhost */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative) const { if(!cellFieldOnPatch || !cellFieldOnPatch->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldComingFromPatch : the input cell field array is NULL or not allocated !"); @@ -1334,7 +1335,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, c MEDCouplingIMesh::CondenseFineToCoarse(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis); if(!isConservative) { - int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); MEDCouplingStructuredMesh::MultiplyPartOf(_mesh->getCellGridStructure(),patch->getBLTRRange(),1./((double)fact),cellFieldOnThis); } } @@ -1353,7 +1354,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatch(int patchId, c * \throw if \a cellFieldOnPatch is NULL or not allocated * \sa fillCellFieldComingFromPatch */ -void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative) const +void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative) const { if(!cellFieldOnPatch || !cellFieldOnPatch->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::fillCellFieldComingFromPatchGhost : the input cell field array is NULL or not allocated !"); @@ -1361,7 +1362,7 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patch MEDCouplingIMesh::CondenseFineToCoarseGhost(_mesh->getCellGridStructure(),cellFieldOnPatch,patch->getBLTRRange(),getFactors(),cellFieldOnThis,ghostLev); if(!isConservative) { - int fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); + mcIdType fact(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(getFactors())); MEDCouplingStructuredMesh::MultiplyPartOfByGhost(_mesh->getCellGridStructure(),patch->getBLTRRange(),ghostLev,1./((double)fact),cellFieldOnThis); } } @@ -1372,13 +1373,13 @@ void MEDCouplingCartesianAMRMeshGen::fillCellFieldComingFromPatchGhost(int patch * * \param [in] patchId - the id of the considered patch. * \param [in] ghostLev - the size of the neighborhood. - * \return DataArrayInt * - the newly allocated array containing the list of patches in the neighborhood of the considered patch. This array is to be deallocated by the caller. + * \return DataArrayIdType * - the newly allocated array containing the list of patches in the neighborhood of the considered patch. This array is to be deallocated by the caller. */ -DataArrayInt *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const +DataArrayIdType *MEDCouplingCartesianAMRMeshGen::findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const { - int nbp(getNumberOfPatches()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + for(mcIdType i=0;i part(_mesh->buildUnstructured()); std::vector bs(_mesh->getNumberOfCells(),false); - std::vector cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) @@ -1399,7 +1400,7 @@ MEDCouplingUMesh *MEDCouplingCartesianAMRMeshGen::buildUnstructured() const MEDCouplingStructuredMesh::SwitchOnIdsFrom(cgs,(*it)->getBLTRRange(),bs); msSafe[ii+1]=(*it)->getMesh()->buildUnstructured(); } - MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs)); msSafe[0]=static_cast(part->buildPartOfMySelf(eltsOff->begin(),eltsOff->end(),false)); std::vector< const MEDCouplingUMesh * > ms(msSafe.size()); for(std::size_t i=0;i& recurseArrs) const +MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector& recurseArrs) const { if(recurseArrs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseWithoutOverlapWithoutGhost : array is empty ! Should never happen !"); // std::vector bs(_mesh->getNumberOfCells(),false); - std::vector cgs(_mesh->getCellGridStructure()); + std::vector cgs(_mesh->getCellGridStructure()); std::vector< MCAuto > msSafe(_patches.size()+1); std::size_t ii(0); for(std::vector< MCAuto >::const_iterator it=_patches.begin();it!=_patches.end();it++,ii++) @@ -1466,7 +1467,7 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW std::vector tmpArrs(extractSubTreeFromGlobalFlatten((*it)->getMesh(),recurseArrs)); msSafe[ii+1]=(*it)->getMesh()->buildCellFieldOnRecurseWithoutOverlapWithoutGhost(ghostSz,tmpArrs); } - MCAuto eltsOff(DataArrayInt::BuildListOfSwitchedOff(bs)); + MCAuto eltsOff(DataArrayIdType::BuildListOfSwitchedOff(bs)); // MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS)); MCAuto arr2(extractGhostFrom(ghostSz,recurseArrs[0])); @@ -1489,11 +1490,11 @@ MEDCouplingFieldDouble *MEDCouplingCartesianAMRMeshGen::buildCellFieldOnRecurseW * This method extracts from \arr arr the part inside \a arr by cutting the \a ghostSz external part. * \arr is expected to be an array having a number of tuples equal to \c getImageMesh()->buildWithGhost(ghostSz). */ -DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const +DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const { - std::vector st(_mesh->getCellGridStructure()); - std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); - std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); + std::vector st(_mesh->getCellGridStructure()); + std::vector< std::pair > p(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st)); + std::transform(st.begin(),st.end(),st.begin(),std::bind2nd(std::plus(),2*ghostSz)); MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(p,ghostSz); MCAuto ret(MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,arr,p)); return ret.retn(); @@ -1504,12 +1505,12 @@ DataArrayDouble *MEDCouplingCartesianAMRMeshGen::extractGhostFrom(int ghostSz, c * * \sa fillCellFieldOnPatchOnlyGhostAdv */ -std::vector MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const +std::vector MEDCouplingCartesianAMRMeshGen::getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const { - std::vector ret; - int nbp(getNumberOfPatches()); + std::vector ret; + mcIdType nbp(getNumberOfPatches()); // - for(int i=0;igetName() << "\"," << getSpaceDimension() << ",["; - std::vector ngs(getImageMesh()->getNodeGridStructure()); + std::vector ngs(getImageMesh()->getNodeGridStructure()); std::vector orig(getImageMesh()->getOrigin()),dxyz(getImageMesh()->getDXYZ()); - std::copy(ngs.begin(),ngs.end(),std::ostream_iterator(oss,",")); + std::copy(ngs.begin(),ngs.end(),std::ostream_iterator(oss,",")); oss << "],["; std::copy(orig.begin(),orig.end(),std::ostream_iterator(oss,",")); oss << "],["; @@ -1553,7 +1554,7 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const MEDCoupling } } -MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, +MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop) { _mesh=MEDCouplingIMesh::New(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop); @@ -1567,9 +1568,9 @@ MEDCouplingCartesianAMRMeshGen::MEDCouplingCartesianAMRMeshGen(MEDCouplingIMesh _mesh=mesh; _mesh->incrRef(); } -void MEDCouplingCartesianAMRMeshGen::checkPatchId(int patchId) const +void MEDCouplingCartesianAMRMeshGen::checkPatchId(mcIdType patchId) const { - int sz(getNumberOfPatches()); + mcIdType sz(getNumberOfPatches()); if(patchId<0 || patchId>=sz) { std::ostringstream oss; oss << "MEDCouplingCartesianAMRMeshGen::checkPatchId : invalid patchId (" << patchId << ") ! Must be in [0," << sz << ") !"; @@ -1577,9 +1578,9 @@ void MEDCouplingCartesianAMRMeshGen::checkPatchId(int patchId) const } } -void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector& factors) +void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::vector& factors) { - if(getSpaceDimension()!=(int)factors.size()) + if(getSpaceDimension()!=ToIdType(factors.size())) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign : invalid size of factors ! size must be equal to the spaceDimension !"); if(_factors.empty()) { @@ -1592,7 +1593,7 @@ void MEDCouplingCartesianAMRMeshGen::checkFactorsAndIfNotSetAssign(const std::ve } } -void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const +void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto >& grids) const { if(lev==0) { @@ -1623,13 +1624,13 @@ void MEDCouplingCartesianAMRMeshGen::retrieveGridsAtInternal(int lev, std::vecto } } -int MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(int ghostLev, const std::vector& factors) +mcIdType MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector& factors) { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::GetGhostLevelInFineRef : the ghost size must be >=0 !"); if(factors.empty()) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::GetGhostLevelInFineRef : no factors defined !"); - int ghostLevInPatchRef; + mcIdType ghostLevInPatchRef; if(ghostLev==0) ghostLevInPatchRef=0; else @@ -1647,11 +1648,11 @@ int MEDCouplingCartesianAMRMeshGen::GetGhostLevelInFineRef(int ghostLev, const s */ std::vector MEDCouplingCartesianAMRMeshGen::extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const { - int maxLev(getMaxNumberOfLevelsRelativeToThis()); + mcIdType maxLev(getMaxNumberOfLevelsRelativeToThis()); std::vector ret; std::vector meshes(1,this); std::size_t kk(0); - for(int i=0;i meshesTmp; for(std::vector::const_iterator it=meshes.begin();it!=meshes.end();it++) @@ -1682,7 +1683,7 @@ void MEDCouplingCartesianAMRMeshGen::dumpPatchesOf(const std::string& varName, s if(patch) { std::ostringstream oss2; oss2 << varName << ".addPatch(["; - const std::vector< std::pair >& bltr(patch->getBLTRRange()); + const std::vector< std::pair >& bltr(patch->getBLTRRange()); std::size_t sz(bltr.size()); for(std::size_t i=0;i(oss2,",")); + std::copy(_factors.begin(),_factors.end(),std::ostream_iterator(oss2,",")); oss2 << "])\n"; oss << oss2.str(); std::ostringstream oss3; oss3 << varName << "[" << j++ << "]"; @@ -1750,7 +1751,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMeshSub::getGodFath /*! * This method returns the level of \a this. 0 for god father. 1 for children of god father ... */ -int MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel() const +mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel() const { if(!_father) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getAbsoluteLevel : Impossible to find a god father because there is a hole in chain !"); @@ -1763,34 +1764,34 @@ void MEDCouplingCartesianAMRMeshSub::detachFromFather() declareAsNew(); } -std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector& st) const +std::vector< std::pair > MEDCouplingCartesianAMRMeshSub::positionRelativeToGodFather(std::vector& st) const { st=_father->getFactors(); std::size_t dim(st.size()); - std::vector prev(st); - int id(_father->getPatchIdFromChildMesh(this)); + std::vector prev(st); + 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); - std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies()); + std::vector< std::pair > ret(p->getBLTRRange()); + std::vector delta(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(ret)),start(dim); + std::transform(delta.begin(),delta.end(),prev.begin(),delta.begin(),std::multiplies()); for(std::size_t i=0;i()); + std::transform(start.begin(),start.end(),prev.begin(),start.begin(),std::multiplies()); const MEDCouplingCartesianAMRMeshGen *it(_father); while(!dynamic_cast(it)) { const MEDCouplingCartesianAMRMeshSub *itc(static_cast(it)); - int id2(itc->_father->getPatchIdFromChildMesh(itc)); + 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); + const std::vector< std::pair >& start2(p2->getBLTRRange()); + std::vector tmp(dim); for(std::size_t i=0;i_father->getFactors(); - std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies()); - std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies()); - std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus()); + std::transform(st.begin(),st.end(),prev.begin(),st.begin(),std::multiplies()); + std::transform(st.begin(),st.end(),tmp.begin(),tmp.begin(),std::multiplies()); + std::transform(start.begin(),start.end(),tmp.begin(),start.begin(),std::plus()); it=itc->_father; } for(std::size_t i=0;i > MEDCouplingCartesianAMRMeshSub::positionRelati return ret; } -int MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const +mcIdType MEDCouplingCartesianAMRMeshSub::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const { if(this==ref) return 0; @@ -1823,18 +1824,18 @@ MEDCouplingCartesianAMRMeshSub *MEDCouplingCartesianAMRMeshSub::deepCopy(MEDCoup /*! * \sa getPositionRelativeTo */ -void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const +void MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const { if(this==ref) return ; if(!_father) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMeshSub::getPositionRelativeToInternal : ref is not in the progeny of this !"); - int myId(_father->getPatchIdFromChildMesh(this)); + mcIdType myId(_father->getPatchIdFromChildMesh(this)); ret.push_back(myId); _father->getPositionRelativeToInternal(ref,ret); } -MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, +MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop) { return new MEDCouplingCartesianAMRMesh(meshName,spaceDim,nodeStrctStart,nodeStrctStop,originStart,originStop,dxyzStart,dxyzStop); @@ -1856,7 +1857,7 @@ const MEDCouplingCartesianAMRMeshGen *MEDCouplingCartesianAMRMesh::getGodFather( return this; } -int MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const +mcIdType MEDCouplingCartesianAMRMesh::getAbsoluteLevel() const { return 0; } @@ -1865,20 +1866,20 @@ void MEDCouplingCartesianAMRMesh::detachFromFather() {//not a bug - do nothing } -std::vector< std::pair > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector& st) const +std::vector< std::pair > MEDCouplingCartesianAMRMesh::positionRelativeToGodFather(std::vector& st) const { st=_mesh->getCellGridStructure(); return MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(st); } -int MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const +mcIdType MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const { if(this==ref) return 0; throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::getAbsoluteLevelRelativeTo : ref is not in the progeny of this !"); } -std::vector MEDCouplingCartesianAMRMesh::retrieveGridsAt(int absoluteLev) const +std::vector MEDCouplingCartesianAMRMesh::retrieveGridsAt(mcIdType absoluteLev) const { std::vector< MCAuto > rets; retrieveGridsAtInternal(absoluteLev,rets); @@ -1909,7 +1910,7 @@ MEDCouplingCartesianAMRMesh *MEDCouplingCartesianAMRMesh::deepCopy(MEDCouplingCa * * \sa createPatchesFromCriterion */ -void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps) +void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector& bso, const DataArrayDouble *criterion, const std::vector< std::vector >& factors, double eps) { std::size_t nbOfLevs(bso.size()); if(nbOfLevs!=factors.size()) @@ -1924,7 +1925,7 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector if(!bso[i]) throw INTERP_KERNEL::Exception("MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML : presence of a NULL BoxSplittingOptions in input vector !"); // - std::vector elts(retrieveGridsAt((int)(i))); + std::vector elts(retrieveGridsAt(ToIdType((i)))); std::size_t sz(elts.size()); std::vector< MCAuto > elts2(sz); std::vector< MCAuto > elts3(sz); @@ -1949,7 +1950,7 @@ void MEDCouplingCartesianAMRMesh::createPatchesFromCriterionML(const std::vector } } -void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const +void MEDCouplingCartesianAMRMesh::getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const { } @@ -1958,7 +1959,7 @@ MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const MEDCouplingCartes { } -MEDCouplingCartesianAMRMesh::MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, +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) { } diff --git a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx index ad4e74aa9..cfe7aa4ab 100644 --- a/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCartesianAMRMesh.hxx @@ -34,7 +34,7 @@ namespace MEDCoupling { class MEDCouplingIMesh; class MEDCouplingUMesh; - class DataArrayInt; + class DataArrayIdType; class DataArrayByte; class DataArrayDouble; class MEDCoupling1SGTUMesh; @@ -51,9 +51,9 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRPatchGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0; - MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const; - MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const; - MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithOverlap() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithoutOverlap() const; + MEDCOUPLING_EXPORT mcIdType getMaxNumberOfLevelsRelativeToThis() const; MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMesh() const { return _mesh; } protected: MEDCouplingCartesianAMRPatchGen(const MEDCouplingCartesianAMRPatchGen& other, MEDCouplingCartesianAMRMeshGen *father); @@ -72,41 +72,41 @@ namespace MEDCoupling class MEDCouplingCartesianAMRPatch : public MEDCouplingCartesianAMRPatchGen { public: - MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); + MEDCouplingCartesianAMRPatch(MEDCouplingCartesianAMRMeshGen *mesh, const std::vector< std::pair >& bottomLeftTopRight); MEDCouplingCartesianAMRPatch *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const; // direct forward to _mesh - MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); + MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); // end of direct forward to _mesh - MEDCOUPLING_EXPORT int getNumberOfOverlapedCellsForFather() const; - MEDCOUPLING_EXPORT bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const; - MEDCOUPLING_EXPORT bool isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const; - MEDCOUPLING_EXPORT bool isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfOverlapedCellsForFather() const; + MEDCOUPLING_EXPORT bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const; + MEDCOUPLING_EXPORT bool isInMyNeighborhoodExt(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const; + MEDCOUPLING_EXPORT bool isInMyNeighborhoodDiffLev(const MEDCouplingCartesianAMRPatch *other, mcIdType ghostLev) const; // basic set/get - MEDCOUPLING_EXPORT const std::vector< std::pair >& getBLTRRange() const { return _bl_tr; } - MEDCOUPLING_EXPORT std::vector< std::pair > getBLTRRangeRelativeToGF() const; - MEDCOUPLING_EXPORT std::vector computeCellGridSt() const; - MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(int ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2); + MEDCOUPLING_EXPORT const std::vector< std::pair >& getBLTRRange() const { return _bl_tr; } + MEDCOUPLING_EXPORT std::vector< std::pair > getBLTRRangeRelativeToGF() const; + MEDCOUPLING_EXPORT std::vector computeCellGridSt() const; + MEDCOUPLING_EXPORT static bool IsInMyNeighborhood(mcIdType ghostLev, const std::vector< std::pair >& p1, const std::vector< std::pair >& p2); // - static std::vector< std::vector< std::pair > > FindNeighborsOfSubPatchesOfSameLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); - static void FindNeighborsOfSubPatchesOf(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret); - static void UpdateNeighborsOfOneWithTwo(int ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); - static void UpdateNeighborsOfOneWithTwoExt(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); - static void UpdateNeighborsOfOneWithTwoMixedLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative); + static std::vector< std::vector< std::pair > > FindNeighborsOfSubPatchesOfSameLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); + static void FindNeighborsOfSubPatchesOf(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& ret); + static void UpdateNeighborsOfOneWithTwo(mcIdType ghostLev, const std::vector& factors, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); + static void UpdateNeighborsOfOneWithTwoExt(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); + static void UpdateNeighborsOfOneWithTwoMixedLev(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2, bool isConservative); private: - static void ComputeZonesOfTwoRelativeToOneDiffLev(int ghostLev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, std::vector< std::pair >& p1Zone, std::vector< std::pair >& p2Zone, std::vector& factToApplyOn2); + 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; - static const MEDCouplingCartesianAMRMeshGen *FindCommonAncestor(const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2, int& lev); - static std::vector ComputeOffsetFromTwoToOne(const MEDCouplingCartesianAMRMeshGen *comAncestor, int lev, const MEDCouplingCartesianAMRPatch *p1, const MEDCouplingCartesianAMRPatch *p2); - static void UpdateNeighborsOfOneWithTwoInternal(int ghostLev, const std::vector& factors, const std::vector< std::pair >&p1 ,const std::vector< std::pair >&p2, DataArrayDouble *dataOnP1, const DataArrayDouble *dataOnP2); + 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); public: - static void ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors); - static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize); + static void ApplyFactorsOnCompactFrmt(std::vector< std::pair >& partBeforeFact, const std::vector& factors); + static void ApplyAllGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize); private: MEDCouplingCartesianAMRPatch(const MEDCouplingCartesianAMRPatch& other, MEDCouplingCartesianAMRMeshGen *father); private: //! bottom left/top right cell range relative to \a _father - std::vector< std::pair > _bl_tr; + std::vector< std::pair > _bl_tr; }; /*! @@ -135,72 +135,72 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT virtual MEDCouplingCartesianAMRMeshGen *deepCopy(MEDCouplingCartesianAMRMeshGen *father) const = 0; MEDCOUPLING_EXPORT int getSpaceDimension() const; - MEDCOUPLING_EXPORT const std::vector& getFactors() const { return _factors; } - MEDCOUPLING_EXPORT void setFactors(const std::vector& newFactors); - MEDCOUPLING_EXPORT int getMaxNumberOfLevelsRelativeToThis() const; - MEDCOUPLING_EXPORT int getNumberOfCellsAtCurrentLevel() const; - MEDCOUPLING_EXPORT int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const; - MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithOverlap() const; - MEDCOUPLING_EXPORT int getNumberOfCellsRecursiveWithoutOverlap() const; + MEDCOUPLING_EXPORT const std::vector& getFactors() const { return _factors; } + MEDCOUPLING_EXPORT void setFactors(const std::vector& newFactors); + MEDCOUPLING_EXPORT mcIdType getMaxNumberOfLevelsRelativeToThis() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsAtCurrentLevel() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithOverlap() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsRecursiveWithoutOverlap() const; MEDCOUPLING_EXPORT const MEDCouplingIMesh *getImageMesh() const { return _mesh; } // MEDCOUPLING_EXPORT virtual const MEDCouplingCartesianAMRMeshGen *getFather() const = 0; MEDCOUPLING_EXPORT virtual const MEDCouplingCartesianAMRMeshGen *getGodFather() const = 0; - MEDCOUPLING_EXPORT virtual int getAbsoluteLevel() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getAbsoluteLevel() const = 0; MEDCOUPLING_EXPORT virtual void detachFromFather() = 0; - MEDCOUPLING_EXPORT virtual std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const = 0; - MEDCOUPLING_EXPORT virtual int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0; - MEDCOUPLING_EXPORT std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const; - MEDCOUPLING_EXPORT virtual std::vector retrieveGridsAt(int absoluteLev) const; - MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); + MEDCOUPLING_EXPORT virtual std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const = 0; + MEDCOUPLING_EXPORT std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const; + MEDCOUPLING_EXPORT virtual std::vector retrieveGridsAt(mcIdType absoluteLev) const; + MEDCOUPLING_EXPORT void addPatch(const std::vector< std::pair >& bottomLeftTopRight, const std::vector& factors); MEDCOUPLING_EXPORT void removeAllPatches(); - MEDCOUPLING_EXPORT void removePatch(int patchId); - MEDCOUPLING_EXPORT int getNumberOfPatches() const; - MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors); - MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); - MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); - MEDCOUPLING_EXPORT int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; + MEDCOUPLING_EXPORT void removePatch(mcIdType patchId); + MEDCOUPLING_EXPORT mcIdType getNumberOfPatches() const; + MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const std::vector& criterion, const std::vector& factors); + MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); + MEDCOUPLING_EXPORT void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); + MEDCOUPLING_EXPORT mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; MEDCOUPLING_EXPORT std::vector< const MEDCouplingCartesianAMRPatch *> getPatches() const; - MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatch(int patchId) const; - MEDCOUPLING_EXPORT bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const; - MEDCOUPLING_EXPORT DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const; + MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const; + MEDCOUPLING_EXPORT bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const; + MEDCOUPLING_EXPORT DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const; // coarse to fine - MEDCOUPLING_EXPORT void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; - MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const; - MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const; // coarse to fine + fine to fine - MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, const std::vector& arrsOnPatches, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, const std::vector& arrsOnPatches, bool isConservative=true) const; // fine to fine - MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, const std::vector& arrsOnPatches) const; - MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, const std::vector& arrsOnPatches) const; + MEDCOUPLING_EXPORT void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; // fine to coarse - MEDCOUPLING_EXPORT void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; - MEDCOUPLING_EXPORT void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; + MEDCOUPLING_EXPORT void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const; // - MEDCOUPLING_EXPORT DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const; + MEDCOUPLING_EXPORT DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; // MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const; MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(int ghostSz, const std::vector& recurseArrs) const; - MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT std::vector getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(mcIdType ghostSz, const std::vector& recurseArrs) const; + MEDCOUPLING_EXPORT DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const; + MEDCOUPLING_EXPORT std::vector getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; MEDCOUPLING_EXPORT std::string buildPythonDumpOfThis() const; protected: MEDCouplingCartesianAMRMeshGen(const MEDCouplingCartesianAMRMeshGen& other); - MEDCouplingCartesianAMRMeshGen(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, + MEDCouplingCartesianAMRMeshGen(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(MEDCouplingIMesh *mesh); - void checkPatchId(int patchId) const; - void checkFactorsAndIfNotSetAssign(const std::vector& factors); - void retrieveGridsAtInternal(int lev, std::vector< MCAuto >& grids) const; - static int GetGhostLevelInFineRef(int ghostLev, const std::vector& factors); + void checkPatchId(mcIdType patchId) const; + void checkFactorsAndIfNotSetAssign(const std::vector& factors); + void retrieveGridsAtInternal(mcIdType lev, std::vector< MCAuto >& grids) const; + static mcIdType GetGhostLevelInFineRef(mcIdType ghostLev, const std::vector& factors); std::vector extractSubTreeFromGlobalFlatten(const MEDCouplingCartesianAMRMeshGen *head, const std::vector& all) const; void dumpPatchesOf(const std::string& varName, std::ostream& oss) const; public: - virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; + virtual void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const = 0; protected: MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -208,7 +208,7 @@ namespace MEDCoupling protected: MCAuto _mesh; std::vector< MCAuto > _patches; - std::vector _factors; + std::vector _factors; }; class MEDCouplingCartesianAMRMeshSub : public MEDCouplingCartesianAMRMeshGen @@ -217,14 +217,14 @@ namespace MEDCoupling MEDCouplingCartesianAMRMeshSub(MEDCouplingCartesianAMRMeshGen *father, MEDCouplingIMesh *mesh); MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const; MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const; - MEDCOUPLING_EXPORT int getAbsoluteLevel() const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const; MEDCOUPLING_EXPORT void detachFromFather(); - MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; - MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + 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; - void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; protected: MEDCouplingCartesianAMRMeshGen *_father; }; @@ -232,22 +232,22 @@ namespace MEDCoupling class MEDCouplingCartesianAMRMesh : public MEDCouplingCartesianAMRMeshGen { public: - MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, + MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop); MEDCOUPLING_EXPORT static MEDCouplingCartesianAMRMesh *New(MEDCouplingIMesh *mesh); MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getFather() const; MEDCOUPLING_EXPORT const MEDCouplingCartesianAMRMeshGen *getGodFather() const; - MEDCOUPLING_EXPORT int getAbsoluteLevel() const; + MEDCOUPLING_EXPORT mcIdType getAbsoluteLevel() const; MEDCOUPLING_EXPORT void detachFromFather(); - MEDCOUPLING_EXPORT std::vector< std::pair > positionRelativeToGodFather(std::vector& st) const; - MEDCOUPLING_EXPORT int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - MEDCOUPLING_EXPORT std::vector retrieveGridsAt(int absoluteLev) const; + 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); + 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; + void getPositionRelativeToInternal(const MEDCouplingCartesianAMRMeshGen *ref, std::vector& ret) const; MEDCouplingCartesianAMRMesh(const MEDCouplingCartesianAMRMesh& other); - MEDCouplingCartesianAMRMesh(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, + 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; diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx old mode 100644 new mode 100755 index 1ca531a99..8b1ad4a07 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx @@ -83,7 +83,7 @@ void MEDCouplingCurveLinearMesh::updateTime() const std::size_t MEDCouplingCurveLinearMesh::getHeapMemorySizeWithoutChildren() const { std::size_t ret(MEDCouplingStructuredMesh::getHeapMemorySizeWithoutChildren()); - ret+=_structure.capacity()*sizeof(int); + ret+=_structure.capacity()*sizeof(mcIdType); return ret; } @@ -159,7 +159,7 @@ bool MEDCouplingCurveLinearMesh::isEqualWithoutConsideringStr(const MEDCouplingM } void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalWith : Meshes are not the same !"); @@ -170,7 +170,7 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalWith(const MEDCouplingMesh *oth * 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, - DataArrayInt *&cellCor) const + DataArrayIdType *&cellCor) const { if(!isEqualWithoutConsideringStr(other,prec)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); @@ -178,10 +178,11 @@ void MEDCouplingCurveLinearMesh::checkDeepEquivalOnSameNodesWith(const MEDCoupli void MEDCouplingCurveLinearMesh::checkConsistencyLight() const { - std::size_t sz=_structure.size(),i=0,nbOfNodes=1; + std::size_t sz=_structure.size(),i=0; + mcIdType nbOfNodes=1; if(sz<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : structure should have a lgth of size 1 at least !"); - for(std::vector::const_iterator 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()); } @@ -193,7 +194,7 @@ void MEDCouplingCurveLinearMesh::checkConsistencyLight() const throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array is not allocated !"); if(_coords->getNumberOfComponents()<1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::checkConsistencyLight : the array should have >= 1 components !"); - if(_coords->getNumberOfTuples()!=(int)nbOfNodes) + if(_coords->getNumberOfTuples()!=nbOfNodes) { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::checkConsistencyLight : structure said that number of nodes should be equal to " << nbOfNodes << " but number of tuples in array is equal to " << _coords->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -205,19 +206,19 @@ void MEDCouplingCurveLinearMesh::checkConsistency(double eps) const checkConsistencyLight(); } -std::size_t MEDCouplingCurveLinearMesh::getNumberOfCells() const +mcIdType MEDCouplingCurveLinearMesh::getNumberOfCells() const { checkConsistencyLight(); return MEDCouplingStructuredMesh::getNumberOfCells(); } -int MEDCouplingCurveLinearMesh::getNumberOfNodes() const +mcIdType MEDCouplingCurveLinearMesh::getNumberOfNodes() const { checkConsistencyLight(); return MEDCouplingStructuredMesh::getNumberOfNodes(); } -void MEDCouplingCurveLinearMesh::getNodeGridStructure(int *res) const +void MEDCouplingCurveLinearMesh::getNodeGridStructure(mcIdType *res) const { std::copy(_structure.begin(),_structure.end(),res); } @@ -232,14 +233,14 @@ int MEDCouplingCurveLinearMesh::getSpaceDimension() const { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getSpaceDimension : no array set ! impossible to deduce a space dimension !"); - return _coords->getNumberOfComponents(); + return int(_coords->getNumberOfComponents()); } -void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { if(!((const DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCoordinatesOfNode : Coordinates not set !"); - int 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 @@ -296,7 +297,7 @@ void MEDCouplingCurveLinearMesh::setCoords(const DataArrayDouble *coords) } } -void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, const int *gridStructEnd) +void MEDCouplingCurveLinearMesh::setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd) { std::size_t sz=std::distance(gridStructBg,gridStructEnd); if(sz>=1 && sz<=3) @@ -311,25 +312,25 @@ void MEDCouplingCurveLinearMesh::setNodeGridStructure(const int *gridStructBg, c } } -std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const +std::vector MEDCouplingCurveLinearMesh::getNodeGridStructure() const { return _structure; } -MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingCurveLinearMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); int dim(getSpaceDimension()); - std::vector dims(getMeshDimension()); - if(dim!=(int)cellPart.size()) + std::vector dims(getMeshDimension()); + if(dim!=ToIdType(cellPart.size())) { std::ostringstream oss; oss << "MEDCouplingCurveLinearMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector< std::pair > nodePartFormat(cellPart); - for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + std::vector< std::pair > nodePartFormat(cellPart); + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); MCAuto ret(dynamic_cast(deepCopy())); const DataArrayDouble *coo(ret->getCoords()); if(coo) @@ -380,7 +381,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs) */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbnodes=getNumberOfNodes(); + mcIdType nbnodes=getNumberOfNodes(); int spaceDim=getSpaceDimension(); MCAuto arr=DataArrayDouble::New(); field->setArray(arr); if(nbnodes==0) @@ -406,7 +407,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim1(bool isAbs, MEDCoupling */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbcells=getNumberOfCells(); + 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 !"); @@ -414,13 +415,13 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling arr->alloc(nbcells,1); double *pt=arr->getPointer(); const double *coords=_coords->begin(); - int nX=_structure[0]-1; - int conn[4]; - for(int i=0;i(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim); + *pt=INTERP_KERNEL::computeVolSurfOfCell2(INTERP_KERNEL::NORM_QUAD4,conn,4,coords,spaceDim); } if(isAbs) arr->abs(); @@ -432,7 +433,7 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim2(bool isAbs, MEDCoupling */ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCouplingFieldDouble *field) const { - int nbcells=getNumberOfCells(); + mcIdType nbcells=getNumberOfCells(); int spaceDim=getSpaceDimension(); if(spaceDim!=3) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3 : with meshDim 3 only space dimension 3 is possible !"); @@ -440,17 +441,17 @@ void MEDCouplingCurveLinearMesh::getMeasureFieldMeshDim3(bool isAbs, MEDCoupling arr->alloc(nbcells,1); double *pt=arr->getPointer(); const double *coords=_coords->begin(); - int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1); - int nY1=_structure[0]*_structure[1]; - int conn[8]; - for(int i=0;i(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3); + *pt=INTERP_KERNEL::computeVolSurfOfCell2(INTERP_KERNEL::NORM_HEXA8,conn,8,coords,3); } if(isAbs) arr->abs(); @@ -470,10 +471,10 @@ 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(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); array->alloc(nbOfCells,3); double *vals=array->getPointer(); - for(int i=0;isetArray(array); array->decrRef(); @@ -491,31 +492,31 @@ namespace MEDCoupling public: static const int MY_SPACEDIM=SPACEDIMM; static const int MY_MESHDIM=8; - typedef int MyConnType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; // begin // useless, but for windows compilation ... const double* getCoordinatesPtr() const { return 0; } - const int* getConnectivityPtr() const { return 0; } - const int* getConnectivityIndexPtr() const { return 0; } - INTERP_KERNEL::NormalizedCellType getTypeOfElement(int) const { return (INTERP_KERNEL::NormalizedCellType)0; } + const mcIdType* getConnectivityPtr() const { return 0; } + const mcIdType* getConnectivityIndexPtr() const { return 0; } + INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType) const { return (INTERP_KERNEL::NormalizedCellType)0; } // end }; } /// @endcond -int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const +mcIdType MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double eps) const { checkConsistencyLight(); int spaceDim=getSpaceDimension(); const double *coords=_coords->getConstPointer(); - int nodeId=-1; + mcIdType nodeId=-1; _coords->distanceToTuple(pos,pos+spaceDim,nodeId); if(nodeId<0) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : internal problem 1 !"); - int conn[8]; - int nbOfNodes=getNumberOfNodes(); + mcIdType conn[8]; + mcIdType nbOfNodes=getNumberOfNodes(); if(nbOfNodes==1) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::getCellContainingPoint : No cells in this !"); switch(getMeshDimension()) @@ -539,7 +540,7 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double case 2: if(spaceDim==2) { - int ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0]; + mcIdType ny=nodeId/_structure[0],nx=nodeId-ny*_structure[0]; if(nx>0 && ny>0) { conn[0]=nx-1+_structure[0]*(ny-1); conn[1]=nx-1+_structure[0]*ny; conn[2]=nx+_structure[0]*ny; conn[3]=nx+_structure[0]*(ny-1); @@ -569,8 +570,8 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double { if(spaceDim==3) { - int nY=_structure[0]*_structure[1]; - int nz=nodeId/_structure[1]; int ny=(nodeId-nz*nY)/_structure[0]; int 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); @@ -634,9 +635,9 @@ int MEDCouplingCurveLinearMesh::getCellContainingPoint(const double *pos, double } } -void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCouplingCurveLinearMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -645,7 +646,7 @@ void MEDCouplingCurveLinearMesh::rotate(const double *center, const double *vect if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::rotate : no coordinates set !"); int spaceDim=getSpaceDimension(); - int nbNodes=_coords->getNumberOfTuples(); + mcIdType nbNodes(_coords->getNumberOfTuples()); double *coords=_coords->getPointer(); if(spaceDim==3) DataArrayDouble::Rotate3DAlg(center,vector,angle,nbNodes,coords,coords); @@ -664,9 +665,9 @@ void MEDCouplingCurveLinearMesh::translate(const double *vector) if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::translate : no coordinates set !"); double *coords=_coords->getPointer(); - int nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); int dim=getSpaceDimension(); - for(int i=0; ideclareAsNew(); @@ -680,9 +681,9 @@ void MEDCouplingCurveLinearMesh::scale(const double *point, double factor) if(!((DataArrayDouble *)_coords)) throw INTERP_KERNEL::Exception("MEDCouplingCurveLinearMesh::scale : no coordinates set !"); double *coords=_coords->getPointer(); - int nbNodes=_coords->getNumberOfTuples(); - int dim=_coords->getNumberOfComponents(); - for(int i=0;igetNumberOfTuples()); + std::size_t dim(_coords->getNumberOfComponents()); + for(mcIdType i=0;i()); std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); @@ -711,7 +712,7 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeCellCenterOfMass() const MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); int meshDim=getMeshDimension(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); switch(meshDim) @@ -738,22 +739,22 @@ DataArrayDouble *MEDCouplingCurveLinearMesh::computeIsoBarycenterOfNodesPerCell( */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble *bary) const { - int 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 !"); - int nX=_structure[0]-1,nY=(_structure[0]-1)*(_structure[1]-1); - int nY1=_structure[0]*_structure[1]; - int conn[8]; - for(int i=0;i(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill); + INTERP_KERNEL::computeBarycenter2(INTERP_KERNEL::NORM_HEXA8,conn,8,coor,3,ptToFill); ptToFill+=3; } } @@ -764,19 +765,19 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim3(DataArrayDouble * */ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim2(DataArrayDouble *bary) const { - int nbcells=getNumberOfCells(); + 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 !"); - int nX=_structure[0]-1; - int conn[4]; - for(int i=0;i(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill); + INTERP_KERNEL::computeBarycenter2(INTERP_KERNEL::NORM_QUAD4,conn,4,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } } @@ -792,12 +793,12 @@ void MEDCouplingCurveLinearMesh::getBarycenterAndOwnerMeshDim1(DataArrayDouble * std::transform(bary->begin(),bary->end(),bary->getPointer(),std::bind2nd(std::multiplies(),0.5)); } -void MEDCouplingCurveLinearMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCouplingCurveLinearMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for CurveLinear Mesh !"); } -void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -815,10 +816,10 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector::const_iterator itt=_structure.begin();itt!=_structure.end();itt++) + tinyInfo.push_back(ToIdType(_structure.size())); + for(std::vector::const_iterator itt=_structure.begin();itt!=_structure.end();itt++) tinyInfo.push_back(*itt); - std::vector tinyInfo2; + std::vector tinyInfo2; if((const DataArrayDouble *)_coords) _coords->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); @@ -826,21 +827,21 @@ void MEDCouplingCurveLinearMesh::getTinySerializationInformation(std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingCurveLinearMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { a1->alloc(tinyInfo[2],1); - std::vector tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end()); + std::vector tinyInfo2(tinyInfo.begin()+3+tinyInfo[2],tinyInfo.end()); a2->resizeForUnserialization(tinyInfo2); } -void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCouplingCurveLinearMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { - a1=DataArrayInt::New(); - a1->alloc((int)_structure.size(),1); - int *ptr=a1->getPointer(); - for(std::vector::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++) + a1=DataArrayIdType::New(); + a1->alloc(_structure.size(),1); + mcIdType *ptr=a1->getPointer(); + for(std::vector::const_iterator it=_structure.begin();it!=_structure.end();it++,ptr++) *ptr=(*it); - int sz=0; + mcIdType sz=0; if((const DataArrayDouble *)_coords) if(_coords->isAllocated()) sz=_coords->getNbOfElems(); @@ -850,21 +851,21 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *& std::copy(_coords->begin(),_coords->end(),a2->getPointer()); } -void MEDCouplingCurveLinearMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *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]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); - setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]); - int sz=tinyInfo[2]; + setTime(tinyInfoD[0],FromIdType(tinyInfo[0]),FromIdType(tinyInfo[1])); + mcIdType sz=tinyInfo[2]; _structure.resize(sz); - for(int i=0;isz+3) + if(ToIdType(tinyInfo.size())>sz+3) { _coords=DataArrayDouble::New(); - std::vector tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end()); + std::vector tinyInfo2(tinyInfo.begin()+3+sz,tinyInfo.end()); _coords->resizeForUnserialization(tinyInfo2); std::copy(a2->begin(),a2->end(),_coords->getPointer()); std::vector littleStrings2(littleStrings.begin()+3,littleStrings.end()); @@ -875,11 +876,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; - int meshDim=(int)_structure.size(); - if(meshDim<=0 || meshDim>3) + 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(int i=0;i<3;i++) - { int val=i\n"; ofs << " \n"; ofs << " \n" << pointData << std::endl; @@ -903,11 +904,12 @@ void MEDCouplingCurveLinearMesh::reprQuickOverview(std::ostream& stream) const { stream << "MEDCouplingCurveLinearMesh C++ instance at " << this << ". Name : \"" << getName() << "\"."; stream << " Nodal structure : ["; - for(std::size_t i=0;i<_structure.size();i++) + std::size_t s_size=_structure.size(); + for(std::size_t i=0;iisAllocated()) { stream << std::endl << "Coordinates set but not allocated !"; return ; } - int nbOfCompo(coo->getNumberOfComponents()); - int nbOfCompoExp(-1); + std::size_t nbOfCompo(coo->getNumberOfComponents()); + std::size_t nbOfCompoExp(-1); try { nbOfCompoExp=getSpaceDimension(); } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { } if(nbOfCompo!=nbOfCompoExp) diff --git a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx index 05d29452a..c99730e36 100644 --- a/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx +++ b/src/MEDCoupling/MEDCouplingCurveLinearMesh.hxx @@ -42,31 +42,31 @@ namespace MEDCoupling 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, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; + DataArrayIdType *&cellCor) const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const; - MEDCOUPLING_EXPORT int getNumberOfNodes() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; MEDCOUPLING_EXPORT int getSpaceDimension() const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) 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 int *gridStructBg, const int *gridStructEnd); - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; - MEDCOUPLING_EXPORT MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + MEDCOUPLING_EXPORT void setNodeGridStructure(const mcIdType *gridStructBg, const mcIdType *gridStructEnd); + 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; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) 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); @@ -74,14 +74,14 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const; + MEDCOUPLING_EXPORT void getNodeGridStructure(mcIdType *res) const; //serialisation-unserialization - MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; @@ -100,7 +100,7 @@ namespace MEDCoupling std::string getVTKDataSetType() const; private: MCAuto _coords; - std::vector _structure; + std::vector _structure; }; } diff --git a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx index 23d4204b4..d6dc441a7 100644 --- a/src/MEDCoupling/MEDCouplingDefinitionTime.cxx +++ b/src/MEDCoupling/MEDCouplingDefinitionTime.cxx @@ -446,11 +446,11 @@ MEDCouplingDefinitionTime::MEDCouplingDefinitionTime(const std::vector& refCoo, +void MEDCouplingField::setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { if(!_mesh) @@ -379,13 +379,13 @@ MEDCouplingGaussLocalization& MEDCouplingField::getGaussLocalization(int locId) /*! * Returns an id of the Gauss localization object corresponding to a given cell type. * \param [in] type - the cell type of interest. - * \return int - the id of the Gauss localization object. + * \return mcIdType - the id of the Gauss localization object. * \throw If \a this field is not on Gauss points. * \throw If the spatial discretization of \a this field is NULL. * \throw If no Gauss localization object found for the given cell \a type. * \throw If more than one Gauss localization object found for the given cell \a type. */ -int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !"); @@ -395,11 +395,11 @@ int MEDCouplingField::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedC /*! * Returns ids of Gauss localization objects corresponding to a given cell type. * \param [in] type - the cell type of interest. - * \return std::set - ids of the Gauss localization object. + * \return std::set - ids of the Gauss localization object. * \throw If \a this field is not on Gauss points. * \throw If the spatial discretization of \a this field is NULL */ -std::set MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const +std::set MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !"); @@ -409,11 +409,11 @@ std::set MEDCouplingField::getGaussLocalizationIdsOfOneType(INTERP_KERNEL:: /*! * Returns number of Gauss localization objects available. Implicitly all ids in * [0,getNbOfGaussLocalization()) are valid Gauss localization ids. - * \return int - the number of available Gauss localization objects. + * \return mcIdType - the number of available Gauss localization objects. * \throw If \a this field is not on Gauss points. * \throw If the spatial discretization of \a this field is NULL. */ -int MEDCouplingField::getNbOfGaussLocalization() const +mcIdType MEDCouplingField::getNbOfGaussLocalization() const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !"); @@ -423,12 +423,12 @@ int MEDCouplingField::getNbOfGaussLocalization() const /*! * Returns an id of the Gauss localization object corresponding to a type of a given cell. * \param [in] cellId - an id of the cell of interest. - * \return int - the id of the Gauss localization object. + * \return mcIdType - the id of the Gauss localization object. * \throw If \a this field is not on Gauss points. * \throw If the spatial discretization of \a this field is NULL. * \throw If no Gauss localization object found for the given cell. */ -int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const +mcIdType MEDCouplingField::getGaussLocalizationIdOfOneCell(mcIdType cellId) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !"); @@ -445,7 +445,7 @@ int MEDCouplingField::getGaussLocalizationIdOfOneCell(int cellId) const * \throw If \a locId is not within the valid range. * \throw If the spatial discretization of \a this field is NULL. */ -void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const +void MEDCouplingField::getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const { cellIds.clear(); if(!((const MEDCouplingFieldDiscretization *)_type)) @@ -506,7 +506,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy) * \param [in] start - an array of cell ids to include to the result mesh. * \param [in] end - specifies the end of the array \a start, so that * the last value of \a start is \a end[ -1 ]. - * \param [out] di - a new instance of DataArrayInt holding the ids of entities (nodes, + * \param [out] di - a new instance of DataArrayIdType holding the ids of entities (nodes, * cells, Gauss points). The caller is to delete this array using decrRef() as it * is no more needed. * \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to @@ -515,7 +515,7 @@ MEDCouplingField::MEDCouplingField(const MEDCouplingField& other, bool deepCopy) * \throw If the mesh is not set. * \sa buildSubMeshDataRange() */ -MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshData method !"); @@ -532,7 +532,7 @@ MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int * * \sa MEDCouplingField::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshDataRange method !"); @@ -541,9 +541,9 @@ MEDCouplingMesh *MEDCouplingField::buildSubMeshDataRange(int begin, int end, int /*! * This method returns tuples ids implied by the mesh selection of the cell ids contained in array defined as an interval [start;end). - * \return a newly allocated DataArrayInt instance containing tuples ids. + * \return a newly allocated DataArrayIdType instance containing tuples ids. */ -DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const +DataArrayIdType *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call computeTupleIdsToSelectFromCellIds method !"); @@ -553,11 +553,11 @@ DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *st /*! * Returns number of tuples expected regarding the spatial discretization of \a this * field and number of entities in the underlying mesh. This method behaves exactly as MEDCouplingFieldDouble::getNumberOfTuples. - * \return int - the number of expected tuples. + * \return mcIdType - the number of expected tuples. * \throw If the spatial discretization of \a this field is NULL. * \throw If the mesh is not set. */ -int MEDCouplingField::getNumberOfTuplesExpected() const +mcIdType MEDCouplingField::getNumberOfTuplesExpected() const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfTuplesExpected method !"); @@ -580,11 +580,11 @@ void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc /*! * Returns number of mesh entities in the underlying mesh of \a this field regarding the * spatial discretization. - * \return int - the number of mesh entities porting the field values. + * \return mcIdType - the number of mesh entities porting the field values. * \throw If the spatial discretization of \a this field is NULL. * \throw If the mesh is not set. */ -int MEDCouplingField::getNumberOfMeshPlacesExpected() const +mcIdType MEDCouplingField::getNumberOfMeshPlacesExpected() const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfMeshPlacesExpected method !"); @@ -623,7 +623,7 @@ void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other) * \throw If input code point to invalid zones in spatial discretization. * \throw If spatial discretization in \a this requires a mesh and those mesh is invalid (null,...) */ -int MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const +mcIdType MEDCouplingField::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { const MEDCouplingFieldDiscretization *t(_type); if(!t) diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index 942d5c6cc..c472db057 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -35,7 +35,7 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; class MEDCouplingMesh; class MEDCouplingFieldDouble; @@ -61,32 +61,32 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void setNature(NatureOfField nat); MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscr() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const; MEDCOUPLING_EXPORT const MEDCouplingFieldDiscretization *getDiscretization() const { return _type; } MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *getDiscretization() { return _type; } MEDCOUPLING_EXPORT void setDiscretization(MEDCouplingFieldDiscretization *newDisc); - MEDCOUPLING_EXPORT int getNumberOfTuplesExpected() const; - MEDCOUPLING_EXPORT int getNumberOfMeshPlacesExpected() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpected() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlacesExpected() const; // Gauss point specific methods MEDCOUPLING_EXPORT void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); - MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector& refCoo, + MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); MEDCOUPLING_EXPORT void clearGaussLocalizations(); MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId); - MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT int getNbOfGaussLocalization() const; - MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneCell(int cellId) const; - MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const; + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const; + 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; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; // for MED file RW - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; protected: MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type); diff --git a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx old mode 100644 new mode 100755 index 419218f6d..d0b3bd4c0 --- a/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDiscretization.cxx @@ -50,7 +50,7 @@ const char MEDCouplingFieldDiscretizationP1::REPR[]="P1"; const TypeOfField MEDCouplingFieldDiscretizationP1::TYPE=ON_NODES; -const int MEDCouplingFieldDiscretizationPerCell::DFT_INVALID_LOCID_VALUE=-1; +const mcIdType MEDCouplingFieldDiscretizationPerCell::DFT_INVALID_LOCID_VALUE=-1; const char MEDCouplingFieldDiscretizationGauss::REPR[]="GAUSS"; @@ -197,7 +197,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 int *startCellIds, const int *endCellIds) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const { return clone(); } @@ -205,7 +205,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(int beginCellIds, int endCellIds, int stepCellIds) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { return clone(); } @@ -235,16 +235,16 @@ std::vector MEDCouplingFieldDiscretization::getDirectCh void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const { MCAuto vol=getMeasureField(mesh,true); - int nbOfCompo=arr->getNumberOfComponents(); - int 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(int i=0;i vol=getMeasureField(mesh,true); - int nbOfCompo=arr->getNumberOfComponents(); - int 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(int i=0;i vol=getMeasureField(mesh,isWAbs); - std::size_t nbOfCompo(arr->getNumberOfComponents()),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(); @@ -298,7 +299,7 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const std::fill(res,res+nbOfCompo,0.); const double *arrPtr(arr->begin()),*volPtr(vol->getArray()->begin()); INTERP_KERNEL::AutoPtr tmp=new double[nbOfCompo]; - for(std::size_t i=0;i(),volPtr[i])); std::transform((double *)tmp,(double *)tmp+nbOfCompo,res,res,std::plus()); @@ -315,13 +316,13 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const * * \sa MEDCouplingFieldDiscretization::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretization::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&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=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto da=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildSubMeshData(mesh,da->begin(),da->end(),di); } -void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayInt *& arr) const +void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayIdType *& arr) const { arr=0; } @@ -329,7 +330,7 @@ void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayInt *& ar /*! * Empty : Not a bug */ -void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldDiscretization::getTinySerializationIntInformation(std::vector& tinyInfo) const { } @@ -340,7 +341,7 @@ void MEDCouplingFieldDiscretization::getTinySerializationDbleInformation(std::ve { } -void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr) +void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) { arr=0; } @@ -348,7 +349,7 @@ void MEDCouplingFieldDiscretization::resizeForUnserialization(const std::vector< /*! * Empty : Not a bug */ -void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr) +void MEDCouplingFieldDiscretization::checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr) { } @@ -363,11 +364,11 @@ void MEDCouplingFieldDiscretization::finishUnserialization(const std::vector& refCoo, +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 !"); @@ -389,57 +390,57 @@ void MEDCouplingFieldDiscretization::clearGaussLocalizations() throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -MEDCouplingGaussLocalization& MEDCouplingFieldDiscretization::getGaussLocalization(int 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(int 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 !"); } -int MEDCouplingFieldDiscretization::getNbOfGaussLocalization() const +mcIdType MEDCouplingFieldDiscretization::getNbOfGaussLocalization() const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -int MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(int cellId) const +mcIdType MEDCouplingFieldDiscretization::getGaussLocalizationIdOfOneCell(mcIdType cellId) const { throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !"); } -int 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(int 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 !"); } -void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg) +void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg) { if(!arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !"); - int oldNbOfElems=arr->getNumberOfTuples(); - int nbOfComp=arr->getNumberOfComponents(); - int 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); double *ptToFill=arr->getPointer(); std::fill(ptToFill,ptToFill+nbOfComp*newNbOfTuples,std::numeric_limits::max()); INTERP_KERNEL::AutoPtr tmp=new double[nbOfComp]; - for(int 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::bind2nd(std::not_equal_to(),std::numeric_limits::max())) @@ -462,16 +463,16 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons } } -void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg) +void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg) { - int 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(int i=0;i& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - int nbOfSplit=(int)idsPerType.size(); - int nbOfTypes=(int)code.size()/3; - int ret=0; - for(int i=0;i=nbOfSplit) @@ -566,8 +567,8 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(con std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *ids(idsPerType[pos]); - if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) + const DataArrayIdType *ids(idsPerType[pos]); + if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -578,39 +579,39 @@ int MEDCouplingFieldDiscretizationP0::getNumberOfTuplesExpectedRegardingCode(con return ret; } -int MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const +mcIdType MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces : NULL input mesh !"); return mesh->getNumberOfCells(); } -DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const +DataArrayIdType *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !"); - int nbOfTuples=mesh->getNumberOfCells(); - DataArrayInt *ret=DataArrayInt::New(); + std::size_t nbOfTuples=mesh->getNumberOfCells(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); ret->iota(0); return ret; } void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const int *old2NewBg, bool check) + const mcIdType *old2NewBg, bool check) { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::renumberArraysForCell : NULL input mesh !"); - const int *array=old2NewBg; + const mcIdType *array=old2NewBg; if(check) - array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); + array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); for(std::vector::const_iterator it=arrays.begin();it!=arrays.end();it++) { if(*it) (*it)->renumberInPlace(array); } if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -620,15 +621,15 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(c return mesh->computeCellCenterOfMass(); } -void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const +void MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MCAuto tmp=DataArrayInt::New(); - tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); + tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); - MCAuto tmp2(tmp->deepCopy()); + MCAuto tmp2(tmp->deepCopy()); cellRestriction=tmp.retn(); trueTupleRestriction=tmp2.retn(); } @@ -666,34 +667,34 @@ void MEDCouplingFieldDiscretizationP0::getValueOn(const DataArrayDouble *arr, co { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOn : NULL input mesh !"); - int 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); } -void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const +void MEDCouplingFieldDiscretizationP0::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const { const MEDCouplingCMesh *meshC=dynamic_cast(mesh); if(!meshC) throw INTERP_KERNEL::Exception("P0::getValueOnPos is only accessible for structured meshes !"); - int id=meshC->getCellIdFromPos(i,j,k); + mcIdType id=meshC->getCellIdFromPos(i,j,k); arr->getTuple(id,res); } -DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const +DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOnMulti : NULL input mesh !"); - MCAuto eltsArr,eltsIndexArr; + MCAuto eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); - const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); + const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); - int nbOfComponents=arr->getNumberOfComponents(); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); - for(int i=0;i=1) arr->getTuple(elts[eltsIndex[i]],ptToFill); else @@ -709,16 +710,16 @@ DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArr /*! * Nothing to do. It's not a bug. */ -void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const +void MEDCouplingFieldDiscretizationP0::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const { } -void MEDCouplingFieldDiscretizationP0::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int 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 int *new2old, int newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const { RenumberEntitiesFromN2OArr(new2old,newSz,arr,"Cell"); } @@ -731,10 +732,10 @@ void MEDCouplingFieldDiscretizationP0::renumberValuesOnCellsR(const MEDCouplingM * \return a newly allocated array containing ids to select into the DataArrayDouble of the field. * */ -DataArrayInt *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const +DataArrayIdType *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const { - MCAuto ret=DataArrayInt::New(); - ret->alloc((int)std::distance(startCellIds,endCellIds),1); + MCAuto ret=DataArrayIdType::New(); + ret->alloc(std::distance(startCellIds,endCellIds),1); std::copy(startCellIds,endCellIds,ret->getPointer()); return ret.retn(); } @@ -746,13 +747,13 @@ DataArrayInt *MEDCouplingFieldDiscretizationP0::computeTupleIdsToSelectFromCellI * * \sa MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshData : NULL input mesh !"); MCAuto ret=mesh->buildPart(start,end); - MCAuto diSafe=DataArrayInt::New(); - diSafe->alloc((int)std::distance(start,end),1); + MCAuto diSafe=DataArrayIdType::New(); + diSafe->alloc(std::distance(start,end),1); std::copy(start,end,diSafe->getPointer()); di=diSafe.retn(); return ret.retn(); @@ -768,7 +769,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCou * * \sa MEDCouplingFieldDiscretizationP0::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshDataRange : NULL input mesh !"); @@ -782,7 +783,7 @@ MCAuto MEDCouplingFieldDiscretizationP0::aggrega return EasyAggregate(fds); } -int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMesh *mesh) const +mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfTuples : NULL input mesh !"); @@ -795,19 +796,19 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMe * If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned. * The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution). */ -int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - int nbOfSplit=(int)idsPerType.size(); - int nbOfTypes=(int)code.size()/3; - int ret=0; - for(int i=0;i=nbOfSplit) @@ -815,8 +816,8 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCod std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *ids(idsPerType[pos]); - if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) + const DataArrayIdType *ids(idsPerType[pos]); + if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -827,7 +828,7 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuplesExpectedRegardingCod return ret; } -int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const +mcIdType MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfMeshPlaces : NULL input mesh !"); @@ -838,16 +839,16 @@ int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCoupli * Nothing to do here. */ void MEDCouplingFieldDiscretizationOnNodes::renumberArraysForCell(const MEDCouplingMesh *, const std::vector& arrays, - const int *old2NewBg, bool check) + const mcIdType *old2NewBg, bool check) { } -DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCouplingMesh *mesh) const +DataArrayIdType *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getOffsetArr : NULL input mesh !"); - int nbOfTuples=mesh->getNumberOfNodes(); - DataArrayInt *ret=DataArrayInt::New(); + mcIdType nbOfTuples=mesh->getNumberOfNodes(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); ret->iota(0); return ret; @@ -860,17 +861,17 @@ DataArrayDouble *MEDCouplingFieldDiscretizationOnNodes::getLocalizationOfDiscVal return mesh->getCoordinatesAndOwner(); } -void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const +void MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MCAuto ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); + MCAuto ret1=mesh->getCellIdsFullyIncludedInNodeIds(tupleIdsBg,tupleIdsEnd); 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)); - MCAuto ret2=meshPart->computeFetchedNodeIds(); + MCAuto ret2=meshPart->computeFetchedNodeIds(); cellRestriction=ret1.retn(); trueTupleRestriction=ret2.retn(); } @@ -879,7 +880,7 @@ void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCoupl { if(!mesh || !da) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh or DataArray !"); - if(mesh->getNumberOfNodes()!=(int)da->getNumberOfTuples()) + if(mesh->getNumberOfNodes()!=da->getNumberOfTuples()) { std::ostringstream message; message << "Field on nodes invalid because there are " << mesh->getNumberOfNodes(); @@ -893,14 +894,14 @@ void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCoupl * @param di is an array returned that specifies entity ids (here nodes ids) in mesh 'mesh' of entity in returned submesh. * Example : The first node id of returned mesh has the (*di)[0] id in 'mesh' */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !"); - DataArrayInt *diTmp=0; + DataArrayIdType *diTmp=0; MCAuto ret=mesh->buildPartAndReduceNodes(start,end,diTmp); - MCAuto diTmpSafe(diTmp); - MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); return ret.retn(); } @@ -915,16 +916,16 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const M * * \sa MEDCouplingFieldDiscretizationNodes::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange : NULL input mesh !"); - DataArrayInt *diTmp=0; + DataArrayIdType *diTmp=0; MCAuto ret=mesh->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,diTmp); if(diTmp) { - MCAuto diTmpSafe(diTmp); - MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); + MCAuto diTmpSafe(diTmp); + MCAuto di2=diTmpSafe->invertArrayO2N2N2O(ret->getNumberOfNodes()); di=di2.retn(); } return ret.retn(); @@ -938,7 +939,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshDataRange(co * \return a newly allocated array containing ids to select into the DataArrayDouble of the field. * */ -DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const +DataArrayIdType *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : NULL input mesh !"); @@ -947,7 +948,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFrom return umesh2->computeFetchedNodeIds(); } -void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVals, const int *old2NewPtr, int newNbOfNodes, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfNodes, DataArrayDouble *arr) const { RenumberEntitiesFromO2NArr(epsOnVals,old2NewPtr,newNbOfNodes,arr,"Node"); } @@ -955,23 +956,23 @@ void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnNodes(double epsOnVa /*! * Nothing to do it's not a bug. */ -void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const { } /*! * Nothing to do it's not a bug. */ -void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationOnNodes::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const { } -void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const +void MEDCouplingFieldDiscretizationOnNodes::getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const { const MEDCouplingCMesh *meshC=dynamic_cast(mesh); if(!meshC) throw INTERP_KERNEL::Exception("OnNodes::getValueOnPos(i,j,k) is only accessible for structured meshes !"); - int id=meshC->getNodeIdFromPos(i,j,k); + mcIdType id=meshC->getNodeIdFromPos(i,j,k); arr->getTuple(id,res); } @@ -1031,7 +1032,7 @@ void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, co { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOn : NULL input mesh !"); - int 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 type=mesh->getTypeOfCell(id); @@ -1044,14 +1045,14 @@ void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, co * This method localizes a point defined by 'loc' in a cell with id 'cellId' into mesh 'mesh'. * The result is put into res expected to be of size at least arr->getNumberOfComponents() */ -void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const +void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, mcIdType cellId, const DataArrayDouble *arr, const double *loc, double *res) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueInCell : NULL input mesh !"); - std::vector conn; + std::vector conn; std::vector coo; mesh->getNodeIdsOfCell(cellId,conn); - for(std::vector::const_iterator iter=conn.begin();iter!=conn.end();iter++) + 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(); @@ -1061,7 +1062,7 @@ void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mes INTERP_KERNEL::AutoPtr tmp=new double[nbOfNodes]; INTERP_KERNEL::NormalizedCellType ct(mesh->getTypeOfCell(cellId)); INTERP_KERNEL::barycentric_coords(ct,vec,loc,tmp); - int 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; + MCAuto eltsArr,eltsIndexArr; mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,eltsArr,eltsIndexArr); - const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); + const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); int spaceDim=mesh->getSpaceDimension(); - int nbOfComponents=arr->getNumberOfComponents(); + std::size_t nbOfComponents=arr->getNumberOfComponents(); MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfPoints,nbOfComponents); double *ptToFill=ret->getPointer(); - for(int i=0;i=1) getValueInCell(mesh,elts[eltsIndex[i]],arr,loc+i*spaceDim,ptToFill+i*nbOfComponents); else @@ -1118,11 +1119,11 @@ MEDCouplingFieldDiscretizationPerCell::~MEDCouplingFieldDiscretizationPerCell() } /*! - * This constructor deep copies MEDCoupling::DataArrayInt instance from other (if any). + * This constructor deep copies MEDCoupling::DataArrayIdType instance from other (if any). */ -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const int *startCellIds, const int *endCellIds):_discr_per_cell(0) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds):_discr_per_cell(0) { - DataArrayInt *arr=other._discr_per_cell; + DataArrayIdType *arr=other._discr_per_cell; if(arr) { if(startCellIds==0 && endCellIds==0) @@ -1132,16 +1133,16 @@ MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(con } } -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, int beginCellIds, int endCellIds, int stepCellIds):_discr_per_cell(0) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):_discr_per_cell(0) { - DataArrayInt *arr=other._discr_per_cell; + DataArrayIdType *arr=other._discr_per_cell; if(arr) { _discr_per_cell=arr->selectByTupleIdSafeSlice(beginCellIds,endCellIds,stepCellIds); } } -MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(DataArrayInt *dpc):_discr_per_cell(dpc) +MEDCouplingFieldDiscretizationPerCell::MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc):_discr_per_cell(dpc) { if(_discr_per_cell) _discr_per_cell->incrRef(); @@ -1172,7 +1173,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(const MEDCoupl throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !"); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh or DataArray !"); - std::size_t 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 !"); } @@ -1196,7 +1197,7 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFie return false; bool ret=_discr_per_cell->isEqualIfNotWhy(*otherC->_discr_per_cell,reason); if(!ret) - reason.insert(0,"Field discretization per cell DataArrayInt given the discid per cell :"); + reason.insert(0,"Field discretization per cell DataArrayIdType given the discid per cell :"); return ret; } @@ -1216,19 +1217,19 @@ bool MEDCouplingFieldDiscretizationPerCell::isEqualWithoutConsideringStr(const M * This method is typically the first step of renumbering. The impact on _discr_per_cell is necessary here. * virtually by this method. */ -void MEDCouplingFieldDiscretizationPerCell::renumberCells(const int *old2NewBg, bool check) +void MEDCouplingFieldDiscretizationPerCell::renumberCells(const mcIdType *old2NewBg, bool check) { - int nbCells=_discr_per_cell->getNumberOfTuples(); - const int *array=old2NewBg; + mcIdType nbCells=_discr_per_cell->getNumberOfTuples(); + const mcIdType *array=old2NewBg; if(check) - array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); + array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); // - DataArrayInt *dpc=_discr_per_cell->renumber(array); + DataArrayIdType *dpc=_discr_per_cell->renumber(array); _discr_per_cell->decrRef(); _discr_per_cell=dpc; // if(check) - free(const_cast(array)); + free(const_cast(array)); } void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh) @@ -1237,10 +1238,10 @@ void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const M throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary : NULL input mesh !"); if(!_discr_per_cell) { - _discr_per_cell=DataArrayInt::New(); - int nbTuples=mesh->getNumberOfCells(); + _discr_per_cell=DataArrayIdType::New(); + mcIdType nbTuples=mesh->getNumberOfCells(); _discr_per_cell->alloc(nbTuples,1); - int *ptr=_discr_per_cell->getPointer(); + mcIdType *ptr=_discr_per_cell->getPointer(); std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE); } } @@ -1249,7 +1250,7 @@ void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : no discretization defined !"); - MCAuto test=_discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE); + MCAuto test( _discr_per_cell->findIdsEqual(DFT_INVALID_LOCID_VALUE)); if(test->getNumberOfTuples()!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells : presence of orphan cells !"); } @@ -1264,25 +1265,25 @@ void MEDCouplingFieldDiscretizationPerCell::checkNoOrphanCells() const * * If no descretization is set in 'this' and exception will be thrown. */ -std::vector MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector& locIds) const +std::vector MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType(std::vector& locIds) const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::splitIntoSingleGaussDicrPerCellType : no descretization set !"); return _discr_per_cell->partitionByDifferentValues(locIds); } -const DataArrayInt *MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds() const +const DataArrayIdType *MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds() const { return _discr_per_cell; } -void MEDCouplingFieldDiscretizationPerCell::setArrayOfDiscIds(const DataArrayInt *adids) +void MEDCouplingFieldDiscretizationPerCell::setArrayOfDiscIds(const DataArrayIdType *adids) { if(adids!=_discr_per_cell) { if(_discr_per_cell) _discr_per_cell->decrRef(); - _discr_per_cell=const_cast(adids); + _discr_per_cell=const_cast(adids); if(_discr_per_cell) _discr_per_cell->incrRef(); declareAsNew(); @@ -1293,11 +1294,11 @@ MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss() { } -MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const int *startCellIds, const int *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc) +MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const mcIdType *startCellIds, const mcIdType *endCellIds):MEDCouplingFieldDiscretizationPerCell(other,startCellIds,endCellIds),_loc(other._loc) { } -MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, int beginCellIds, int endCellIds, int stepCellIds):MEDCouplingFieldDiscretizationPerCell(other,beginCellIds,endCellIds,stepCellIds),_loc(other._loc) +MEDCouplingFieldDiscretizationGauss::MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds):MEDCouplingFieldDiscretizationPerCell(other,beginCellIds,endCellIds,stepCellIds),_loc(other._loc) { } @@ -1363,12 +1364,12 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clone() con return new MEDCouplingFieldDiscretizationGauss(*this); } -MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePart(const int *startCellIds, const int *endCellIds) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePart(const mcIdType *startCellIds, const mcIdType *endCellIds) const { return new MEDCouplingFieldDiscretizationGauss(*this,startCellIds,endCellIds); } -MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const +MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretizationGauss::clonePartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { return new MEDCouplingFieldDiscretizationGauss(*this,beginCellIds,endCellIds,stepCellIds); } @@ -1381,7 +1382,7 @@ std::string MEDCouplingFieldDiscretizationGauss::getStringRepr() const if(_discr_per_cell->isAllocated()) { oss << "Discretization per cell : "; - std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator(oss,", ")); + std::copy(_discr_per_cell->begin(),_discr_per_cell->end(),std::ostream_iterator(oss,", ")); oss << std::endl; } } @@ -1416,21 +1417,21 @@ const char *MEDCouplingFieldDiscretizationGauss::getRepr() const * If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned. * The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution). */ -int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { if(!_discr_per_cell || !_discr_per_cell->isAllocated() || _discr_per_cell->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode"); if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - int nbOfSplit=(int)idsPerType.size(); - int nbOfTypes=(int)code.size()/3; - std::size_t ret(0); - for(int i=0;i=nbOfSplit) @@ -1438,8 +1439,8 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode( std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *ids(idsPerType[pos]); - if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) + const DataArrayIdType *ids(idsPerType[pos]); + if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -1455,15 +1456,15 @@ int MEDCouplingFieldDiscretizationGauss::getNumberOfTuplesExpectedRegardingCode( return getNumberOfTuples(0);//0 is not an error ! It is to be sure that input mesh is not used } -int MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const +mcIdType MEDCouplingFieldDiscretizationGauss::getNumberOfTuples(const MEDCouplingMesh *) const { - int ret=0; + mcIdType ret=0; if (_discr_per_cell == 0) throw INTERP_KERNEL::Exception("Discretization is not initialized!"); - const int *dcPtr=_discr_per_cell->getConstPointer(); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - int maxSz=(int)_loc.size(); - for(const int *w=dcPtr;w!=dcPtr+nbOfTuples;w++) + const mcIdType *dcPtr=_discr_per_cell->getConstPointer(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); + mcIdType maxSz=ToIdType(_loc.size()); + for(const mcIdType *w=dcPtr;w!=dcPtr+nbOfTuples;w++) { if(*w>=0 && *wgetNumberOfCells()); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfTuples=mesh->getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); - int *retPtr(ret->getPointer()); - const int *start(_discr_per_cell->begin()); + 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 !"); - int maxPossible=(int)_loc.size(); + mcIdType maxPossible=ToIdType(_loc.size()); retPtr[0]=0; - for(std::size_t i=0;i=0 && *start& arrays, - const int *old2NewBg, bool check) + const mcIdType *old2NewBg, bool check) { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::renumberArraysForCell : NULL input mesh !"); - const int *array=old2NewBg; + const mcIdType *array=old2NewBg; if(check) - array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - int nbOfCells=_discr_per_cell->getNumberOfTuples(); - int nbOfTuples=getNumberOfTuples(0); - const int *dcPtr=_discr_per_cell->getConstPointer(); - int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. - int *array3=new int[nbOfCells];//store for each cell in present dcp array (already renumbered) the offset needed by each cell in new numbering. + array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); + mcIdType nbOfCells=_discr_per_cell->getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(0); + const mcIdType *dcPtr=_discr_per_cell->getConstPointer(); + 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(int i=1;irenumberInPlace(array2); delete [] array2; if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -1551,20 +1552,20 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValue throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !"); checkNoOrphanCells(); MCAuto umesh=mesh->buildUnstructured();//in general do nothing - int nbOfTuples=getNumberOfTuples(mesh); + mcIdType nbOfTuples=getNumberOfTuples(mesh); MCAuto ret=DataArrayDouble::New(); int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); - std::vector< int > locIds; - std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MCAuto > parts2(parts.size()); + std::vector< mcIdType > locIds; + std::vector parts=splitIntoSingleGaussDicrPerCellType(locIds); + std::vector< MCAuto > parts2(parts.size()); std::copy(parts.begin(),parts.end(),parts2.begin()); - MCAuto offsets=buildNbOfGaussPointPerCellField(); + MCAuto offsets=buildNbOfGaussPointPerCellField(); offsets->computeOffsets(); - const int *ptrOffsets=offsets->getConstPointer(); + const mcIdType *ptrOffsets=offsets->getConstPointer(); const double *coords=umesh->getCoords()->getConstPointer(); - const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); - const int *conn=umesh->getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); + const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer(); double *valsToFill=ret->getPointer(); for(std::size_t i=0;i& wg(cli.getWeights()); calculator.addGaussInfo(typ,INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension(), - &cli.getGaussCoords()[0],(int)wg.size(),&cli.getRefCoords()[0], + &cli.getGaussCoords()[0],ToIdType(wg.size()),&cli.getRefCoords()[0], INTERP_KERNEL::CellModel::GetCellModel(typ).getNumberOfNodes()); // - for(const int *w=parts2[i]->begin();w!=parts2[i]->end();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(); } -void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const +void MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::computeMeshRestrictionFromTupleIds : NULL input mesh !"); - MCAuto tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); + MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField(); nbOfNodesPerCell->computeOffsetsFull(); nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } @@ -1605,13 +1606,13 @@ void MEDCouplingFieldDiscretizationGauss::checkCompatibilityWithNature(NatureOfF { } -void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldDiscretizationGauss::getTinySerializationIntInformation(std::vector& tinyInfo) const { - int val=-1; + mcIdType val=-1; if(_discr_per_cell) val=_discr_per_cell->getNumberOfTuples(); tinyInfo.push_back(val); - tinyInfo.push_back((int)_loc.size()); + tinyInfo.push_back(ToIdType(_loc.size())); if(_loc.empty()) tinyInfo.push_back(-1); else @@ -1626,19 +1627,19 @@ void MEDCouplingFieldDiscretizationGauss::getTinySerializationDbleInformation(st (*iter).pushTinySerializationDblInfo(tinyInfo); } -void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayInt *& arr) const +void MEDCouplingFieldDiscretizationGauss::getSerializationIntArray(DataArrayIdType *& arr) const { arr=0; if(_discr_per_cell) arr=_discr_per_cell; } -void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr) +void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr) { - int val=tinyInfo[0]; + mcIdType val=tinyInfo[0]; if(val>=0) { - _discr_per_cell=DataArrayInt::New(); + _discr_per_cell=DataArrayIdType::New(); _discr_per_cell->alloc(val,1); } else @@ -1647,16 +1648,16 @@ void MEDCouplingFieldDiscretizationGauss::resizeForUnserialization(const std::ve commonUnserialization(tinyInfo); } -void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr) +void MEDCouplingFieldDiscretizationGauss::checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr) { - static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayInt !"; - int val=tinyInfo[0]; + static const char MSG[]="MEDCouplingFieldDiscretizationGauss::checkForUnserialization : expect to have one not null DataArrayIdType !"; + mcIdType val=tinyInfo[0]; if(val>=0) { if(!arr) throw INTERP_KERNEL::Exception(MSG); arr->checkNbOfTuplesAndComp(val,1,MSG); - _discr_per_cell=const_cast(arr); + _discr_per_cell=const_cast(arr); _discr_per_cell->incrRef(); } else @@ -1674,9 +1675,9 @@ void MEDCouplingFieldDiscretizationGauss::finishUnserialization(const std::vecto delete [] tmp; } -double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const +double MEDCouplingFieldDiscretizationGauss::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const { - int offset=getOffsetOfCell(cellId); + mcIdType offset=getOffsetOfCell(cellId); return da->getIJ(offset+nodeIdInCell,compoId); } @@ -1687,10 +1688,10 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da); for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++) (*iter).checkConsistencyLight(); - int nbOfDesc=(int)_loc.size(); - int nbOfCells=mesh->getNumberOfCells(); - const int *dc=_discr_per_cell->getConstPointer(); - for(int i=0;igetNumberOfCells(); + const mcIdType *dc=_discr_per_cell->getConstPointer(); + for(mcIdType i=0;i=nbOfDesc) { @@ -1708,7 +1709,7 @@ void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplin throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - std::size_t nbOfTuples(getNumberOfTuples(mesh)); + mcIdType nbOfTuples(getNumberOfTuples(mesh)); if(nbOfTuples!=da->getNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " having " << da->getNumberOfTuples() << " !"; @@ -1732,28 +1733,28 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGauss::getMeasureField(con throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but with nb of components different from 1 !"); if(_discr_per_cell->getNumberOfTuples()!=vol->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getMeasureField : no discr per cell array defined but mismatch between nb of cells of mesh and size of spatial disr array !"); - MCAuto offset=getOffsetArr(mesh); + MCAuto offset=getOffsetArr(mesh); MCAuto arr=DataArrayDouble::New(); arr->alloc(getNumberOfTuples(mesh),1); ret->setArray(arr); double *arrPtr=arr->getPointer(); - const int *offsetPtr=offset->getConstPointer(); - int maxGaussLoc=(int)_loc.size(); - std::vector locIds; - std::vector ids=splitIntoSingleGaussDicrPerCellType(locIds); - std::vector< MCAuto > ids2(ids.size()); std::copy(ids.begin(),ids.end(),ids2.begin()); + const mcIdType *offsetPtr=offset->getConstPointer(); + 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 weights=new double[nbOfGaussPt]; double sum=std::accumulate(loc.getWeights().begin(),loc.getWeights().end(),0.); std::transform(loc.getWeights().begin(),loc.getWeights().end(),(double *)weights,std::bind2nd(std::multiplies(),1./sum)); - for(const int *cellId=curIds->begin();cellId!=curIds->end();cellId++) - for(int j=0;jbegin();cellId!=curIds->end();cellId++) + for(mcIdType j=0;j diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); @@ -1801,7 +1802,7 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MED * * \sa MEDCouplingFieldDiscretizationGauss::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { if(stepCellIds!=1)//even for stepCellIds==-1 the output will not be a range return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di); @@ -1811,16 +1812,16 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange(cons throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : no discretization array set !"); di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGauss::buildSubMeshDataRange : cell #"; - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - const int *w=_discr_per_cell->begin(); - int nbMaxOfLocId=(int)_loc.size(); - for(int i=0;igetNumberOfTuples(); + const mcIdType *w=_discr_per_cell->begin(); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); + for(mcIdType i=0;i=0 && *w nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer - std::size_t nbOfCells(mesh->getNumberOfCells()); + MCAuto nbOfNodesPerCell=buildNbOfGaussPointPerCellField();//check of _discr_per_cell not NULL pointer + 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(); - MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + MCAuto sel=DataArrayIdType::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,ToIdType(std::distance(startCellIds,endCellIds)),1); return sel->buildExplicitArrByRanges(nbOfNodesPerCell); } /*! * No implementation needed ! */ -void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const +void MEDCouplingFieldDiscretizationGauss::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const { } -void MEDCouplingFieldDiscretizationGauss::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int 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 int *new2old, int 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 !"); } @@ -1879,7 +1880,7 @@ MCAuto MEDCouplingFieldDiscretizationGauss::aggr if(fds.empty()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : input array is empty"); std::vector loc;//store the localizations for the output GaussDiscretization object - std::vector< MCAuto > discPerCells(fds.size()); + std::vector< MCAuto > discPerCells(fds.size()); std::size_t i(0); for(auto it=fds.begin();it!=fds.end();++it,++i) { @@ -1888,7 +1889,7 @@ MCAuto MEDCouplingFieldDiscretizationGauss::aggr throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : same field discretization expected for all input discretizations !"); // std::vector loc2(itc->_loc); - std::vector newLocId(loc2.size()); + std::vector newLocId(loc2.size()); for(std::size_t j=0;j MEDCouplingFieldDiscretizationGauss::aggr { if(loc2[j].isEqual(loc[k],1e-10)) { - newLocId[j]=(int)k; + newLocId[j]=ToIdType(k); break; } } if(k==loc.size())// current loc2[j] { - newLocId[j]=(int)loc.size(); + newLocId[j]=ToIdType(loc.size()); loc.push_back(loc2[j]); } } - const DataArrayInt *dpc(itc->_discr_per_cell); + const DataArrayIdType *dpc(itc->_discr_per_cell); if(!dpc) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::aggregate : Presence of nullptr array of disc per cell !"); - MCAuto dpc2(dpc->deepCopy()); + MCAuto dpc2(dpc->deepCopy()); dpc2->transformWithIndArr(newLocId.data(),newLocId.data()+newLocId.size()); discPerCells[i]=dpc2; } - MCAuto dpc3(DataArrayInt::Aggregate(ToConstVect(discPerCells))); + MCAuto dpc3(DataArrayIdType::Aggregate(ToConstVect(discPerCells))); MCAuto ret(new MEDCouplingFieldDiscretizationGauss(dpc3,loc)); return DynamicCast(ret); } @@ -1924,25 +1925,25 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCo if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : NULL input mesh !"); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - if((int)cm.getDimension()!=mesh->getMeshDimension()) + if(ToIdType(cm.getDimension())!=mesh->getMeshDimension()) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : mismatch of dimensions ! MeshDim==" << mesh->getMeshDimension(); oss << " whereas Type '" << cm.getRepr() << "' has dimension " << cm.getDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } buildDiscrPerCellIfNecessary(mesh); - int id=(int)_loc.size(); + mcIdType id=ToIdType(_loc.size()); MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg); _loc.push_back(elt); - int *ptr=_discr_per_cell->getPointer(); - int nbCells=mesh->getNumberOfCells(); - for(int i=0;igetPointer(); + mcIdType nbCells=mesh->getNumberOfCells(); + for(mcIdType i=0;igetTypeOfCell(i)==type) ptr[i]=id; zipGaussLocalizations(); } -void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector& refCoo, +void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { if(!mesh) @@ -1952,9 +1953,9 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !"); INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(*begin); MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg); - int id=(int)_loc.size(); - int *ptr=_discr_per_cell->getPointer(); - for(const int *w=begin+1;w!=end;w++) + mcIdType id=ToIdType(_loc.size()); + mcIdType *ptr=_discr_per_cell->getPointer(); + for(const mcIdType *w=begin+1;w!=end;w++) { if(mesh->getTypeOfCell(*w)!=type) { @@ -1963,7 +1964,7 @@ void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDC } } // - for(const int *w2=begin;w2!=end;w2++) + for(const mcIdType *w2=begin;w2!=end;w2++) ptr[*w2]=id; // _loc.push_back(elt); @@ -1980,18 +1981,18 @@ void MEDCouplingFieldDiscretizationGauss::clearGaussLocalizations() _loc.clear(); } -void MEDCouplingFieldDiscretizationGauss::setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc) +void MEDCouplingFieldDiscretizationGauss::setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc) { if(locId<0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalization : localization id has to be >=0 !"); - int sz=(int)_loc.size(); + mcIdType sz=ToIdType(_loc.size()); MEDCouplingGaussLocalization gLoc(INTERP_KERNEL::NORM_ERROR); if(locId>=sz) _loc.resize(locId+1,gLoc); _loc[locId]=loc; } -void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(int newSz) +void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(mcIdType newSz) { if(newSz<0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector : new size has to be >=0 !"); @@ -1999,30 +2000,30 @@ void MEDCouplingFieldDiscretizationGauss::resizeLocalizationVector(int newSz) _loc.resize(newSz,gLoc); } -MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(int locId) +MEDCouplingGaussLocalization& MEDCouplingFieldDiscretizationGauss::getGaussLocalization(mcIdType locId) { checkLocalizationId(locId); return _loc[locId]; } -int MEDCouplingFieldDiscretizationGauss::getNbOfGaussLocalization() const +mcIdType MEDCouplingFieldDiscretizationGauss::getNbOfGaussLocalization() const { - return (int)_loc.size(); + return ToIdType(_loc.size()); } -int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(int cellId) const +mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneCell(mcIdType cellId) const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("No Gauss localization still set !"); - int 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; } -int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set 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) @@ -2030,46 +2031,46 @@ int MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdOfOneType(INTERP_ return *ret.begin(); } -std::set MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const +std::set MEDCouplingFieldDiscretizationGauss::getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("No Gauss localization still set !"); - std::set ret; - int id=0; + std::set ret; + mcIdType id=0; for(std::vector::const_iterator iter=_loc.begin();iter!=_loc.end();iter++,id++) if((*iter).getType()==type) ret.insert(id); return ret; } -void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const +void MEDCouplingFieldDiscretizationGauss::getCellIdsHavingGaussLocalization(mcIdType locId, std::vector& cellIds) const { - if(locId<0 || locId>=(int)_loc.size()) + if(locId<0 || locId>=ToIdType(_loc.size())) throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !"); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - const int *ptr=_discr_per_cell->getConstPointer(); - for(int i=0;igetNumberOfTuples(); + const mcIdType *ptr=_discr_per_cell->getConstPointer(); + for(mcIdType i=0;i=(int)_loc.size()) + if(locId<0 || locId>=ToIdType(_loc.size())) throw INTERP_KERNEL::Exception("Invalid locId given : must be in range [0:getNbOfGaussLocalization()) !"); } -int MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(int cellId) const +mcIdType MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(mcIdType cellId) const { - int ret=0; - const int *start=_discr_per_cell->getConstPointer(); - for(const int *w=start;w!=start+cellId;w++) + mcIdType ret=0; + const mcIdType *start=_discr_per_cell->getConstPointer(); + for(const mcIdType *w=start;w!=start+cellId;w++) ret+=_loc[*w].getNumberOfGaussPt(); return ret; } @@ -2080,17 +2081,17 @@ int MEDCouplingFieldDiscretizationGauss::getOffsetOfCell(int cellId) const * This method returns a newly created array with number of tuples equals to '_discr_per_cell->getNumberOfTuples' and number of components equal to 1. * The i_th tuple in returned array is the number of gauss point if the corresponding cell. */ -DataArrayInt *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField() const +DataArrayIdType *MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField() const { if(!_discr_per_cell) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildNbOfGaussPointPerCellField : no discretization array set !"); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - MCAuto ret=DataArrayInt::New(); - const int *w=_discr_per_cell->begin(); + mcIdType nbOfTuples=_discr_per_cell->getNumberOfTuples(); + MCAuto ret=DataArrayIdType::New(); + const mcIdType *w=_discr_per_cell->begin(); ret->alloc(nbOfTuples,1); - int *valsToFill=ret->getPointer(); - int nbMaxOfLocId=(int)_loc.size(); - for(int i=0;igetPointer(); + mcIdType nbMaxOfLocId=ToIdType(_loc.size()); + for(mcIdType i=0;i=0 && *wbegin(); - int nbOfTuples=_discr_per_cell->getNumberOfTuples(); - INTERP_KERNEL::AutoPtr tmp=new int[_loc.size()]; - std::fill((int *)tmp,(int *)tmp+_loc.size(),-2); - for(const int *w=start;w!=start+nbOfTuples;w++) + const mcIdType *start=_discr_per_cell->begin(); + 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++) if(*w>=0) tmp[*w]=1; - int fid=0; - for(int i=0;i<(int)_loc.size();i++) + mcIdType fid=0; + for(mcIdType i=0;igetPointer(); - for(int *w2=start2;w2!=start2+nbOfTuples;w2++) + mcIdType *start2=_discr_per_cell->getPointer(); + for(mcIdType *w2=start2;w2!=start2+nbOfTuples;w2++) if(*w2>=0) *w2=tmp[*w2]; std::vector tmpLoc; - for(int i=0;i<(int)_loc.size();i++) + for(mcIdType i=0;i& tinyInfo) +void MEDCouplingFieldDiscretizationGauss::commonUnserialization(const std::vector& tinyInfo) { - int nbOfLoc=tinyInfo[1]; + mcIdType nbOfLoc=tinyInfo[1]; _loc.clear(); - int dim=tinyInfo[2]; - int delta=-1; + mcIdType dim=tinyInfo[2]; + mcIdType delta=-1; if(nbOfLoc>0) - delta=((int)tinyInfo.size()-3)/nbOfLoc; - for(int i=0;i tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); + std::vector tmp(tinyInfo.begin()+3+i*delta,tinyInfo.begin()+3+(i+1)*delta); MEDCouplingGaussLocalization elt=MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(dim,tmp); _loc.push_back(elt); } @@ -2211,14 +2212,14 @@ bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFie * If an incoherency is detected, an exception will be thrown. If the input code is coherent, the number of tuples expected is returned. * The number of tuples expected is equal to those to have a valid field lying on \a this and having a mesh fitting perfectly the input code (geometric type distribution). */ -int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const +mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const { if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : invalid input code !"); - int nbOfSplit=(int)idsPerType.size(); - int nbOfTypes=(int)code.size()/3; - int ret(0); - for(int i=0;i=nbOfSplit) @@ -2237,25 +2238,25 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCod std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : input code points to pos " << pos << " in typeid " << i << " ! Should be in [0," << nbOfSplit << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *ids(idsPerType[pos]); - if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || (int)ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) + const DataArrayIdType *ids(idsPerType[pos]); + if(!ids || !ids->isAllocated() || ids->getNumberOfComponents()!=1 || ids->getNumberOfTuples()!=nbOfEltInChunk || ids->getMinValueInArray()<0) { std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuplesExpectedRegardingCode : input pfl chunck at pos " << pos << " should have " << i << " tuples and one component and with ids all >=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } - ret+=nbOfEltInChunk*(int)cm.getNumberOfNodes(); + ret+=nbOfEltInChunk*ToIdType(cm.getNumberOfNodes()); } return ret; } -int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMesh *mesh) const +mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !"); - int ret=0; - int nbOfCells=mesh->getNumberOfCells(); - for(int i=0;igetNumberOfCells(); + for(mcIdType i=0;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2266,23 +2267,23 @@ int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMe return ret; } -int MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const +mcIdType MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces : NULL input mesh !"); return mesh->getNumberOfCells(); } -DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const +DataArrayIdType *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !"); - int nbOfTuples=mesh->getNumberOfCells(); - DataArrayInt *ret=DataArrayInt::New(); + mcIdType nbOfTuples=mesh->getNumberOfCells(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfTuples+1,1); - int *retPtr=ret->getPointer(); + mcIdType *retPtr=ret->getPointer(); retPtr[0]=0; - for(int i=0;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2294,30 +2295,30 @@ DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCoupl } void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const int *old2NewBg, bool check) + const mcIdType *old2NewBg, bool check) { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell : NULL input mesh !"); - const int *array=old2NewBg; + const mcIdType *array=old2NewBg; if(check) - array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); - int nbOfCells=mesh->getNumberOfCells(); - int nbOfTuples=getNumberOfTuples(mesh); - int *array2=new int[nbOfTuples];//stores the final conversion array old2New to give to arrays in renumberInPlace. - int *array3=new int[nbOfCells];//store for each cell in after renumbering the offset needed by each cell in new numbering. + array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells()); + 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(int i=1;igetTypeOfCell((int)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(); } - int j=0; - for(int i=0;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - for(int k=0;k<(int)cm.getNumberOfNodes();k++,j++) + for(mcIdType k=0;krenumberInPlace(array2); delete [] array2; if(check) - free(const_cast(array)); + free(const_cast(array)); } DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const @@ -2335,16 +2336,16 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !"); MCAuto ret=DataArrayDouble::New(); MCAuto umesh=mesh->buildUnstructured();//in general do nothing - int nbOfTuples=getNumberOfTuples(umesh); + mcIdType nbOfTuples=getNumberOfTuples(umesh); int spaceDim=mesh->getSpaceDimension(); ret->alloc(nbOfTuples,spaceDim); const double *coords=umesh->getCoords()->begin(); - const int *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); - const int *conn=umesh->getNodalConnectivity()->getConstPointer(); - int nbCells=umesh->getNumberOfCells(); + const mcIdType *connI=umesh->getNodalConnectivityIndex()->getConstPointer(); + const mcIdType *conn=umesh->getNodalConnectivity()->getConstPointer(); + mcIdType nbCells=umesh->getNumberOfCells(); double *retPtr=ret->getPointer(); - for(int i=0;i=0) retPtr=std::copy(coords+(*w)*spaceDim,coords+((*w)+1)*spaceDim,retPtr); return ret.retn(); @@ -2357,12 +2358,12 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh { if(!mesh || !arr) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !"); - int nbOfCompo=arr->getNumberOfComponents(); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::fill(res,res+nbOfCompo,0.); // MCAuto vol=mesh->getMeasureField(isWAbs); std::set types=mesh->getAllGeoTypes(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin(); for(std::set::const_iterator it=types.begin();it!=types.end();it++) @@ -2372,13 +2373,13 @@ void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MCAuto ids=mesh->giveCellsWithType(*it); - MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); - const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); - for(int i=0;i ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + for(mcIdType i=0;i tmp=DataArrayInt::New(); tmp->alloc((int)std::distance(tupleIdsBg,tupleIdsEnd),1); + MCAuto tmp=DataArrayIdType::New(); tmp->alloc(std::distance(tupleIdsBg,tupleIdsEnd),1); std::copy(tupleIdsBg,tupleIdsEnd,tmp->getPointer()); tmp->sort(true); tmp=tmp->buildUnique(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); nbOfNodesPerCell->findIdsRangesInListOfIds(tmp,cellRestriction,trueTupleRestriction); } @@ -2643,12 +2644,12 @@ void MEDCouplingFieldDiscretizationGaussNE::checkCompatibilityWithNature(NatureO { } -double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const +double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getIJK : NULL input mesh !"); - int offset=0; - for(int i=0;igetTypeOfCell(i); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); @@ -2659,7 +2660,7 @@ double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh void MEDCouplingFieldDiscretizationGaussNE::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const { - std::size_t nbOfTuples(getNumberOfTuples(mesh)); + mcIdType nbOfTuples(getNumberOfTuples(mesh)); if(nbOfTuples!=da->getNumberOfTuples()) { std::ostringstream oss; oss << "Invalid number of tuples in the array : expecting " << nbOfTuples << " !"; @@ -2677,8 +2678,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c ret->setMesh(mesh); // std::set types=mesh->getAllGeoTypes(); - MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); - int nbTuples=nbOfNodesPerCell->accumulate(0); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + mcIdType nbTuples=nbOfNodesPerCell->accumulate((std::size_t)0); nbOfNodesPerCell->computeOffsetsFull(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbTuples,1); ret->setArray(arr); @@ -2690,11 +2691,11 @@ MEDCouplingFieldDouble *MEDCouplingFieldDiscretizationGaussNE::getMeasureField(c INTERP_KERNEL::AutoPtr wArr2=new double[wArrSz]; double sum=std::accumulate(wArr,wArr+wArrSz,0.); std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies(),1./sum)); - MCAuto ids=mesh->giveCellsWithType(*it); - MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); - const int *ptIds2=ids2->begin(),*ptIds=ids->begin(); - int nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); - for(int i=0;i ids=mesh->giveCellsWithType(*it); + MCAuto ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell); + const mcIdType *ptIds2=ids2->begin(),*ptIds=ids->begin(); + mcIdType nbOfCellsWithCurGeoType=ids->getNumberOfTuples(); + for(mcIdType i=0;i diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); + MCAuto diSafe=computeTupleIdsToSelectFromCellIds(mesh,start,end); MCAuto ret=mesh->buildPart(start,end); di=diSafe.retn(); return ret.retn(); @@ -2737,22 +2738,22 @@ MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const M * * \sa MEDCouplingFieldDiscretizationGauss::buildSubMeshData */ -MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const +MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { if(stepCellIds!=1)//even for stepCellIds==-1 the output will not be a range return MEDCouplingFieldDiscretization::buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,beginOut,endOut,stepOut,di); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : NULL input mesh !"); - int nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); di=0; beginOut=0; endOut=0; stepOut=stepCellIds; const char msg[]="MEDCouplingFieldDiscretizationGaussNE::buildSubMeshDataRange : cell #"; - for(int i=0;igetTypeOfCell(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()); } - int delta=cm.getNumberOfNodes(); + mcIdType delta=cm.getNumberOfNodes(); if(i nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); + MCAuto nbOfNodesPerCell=mesh->computeNbOfNodesPerCell(); nbOfNodesPerCell->computeOffsetsFull(); - MCAuto sel=DataArrayInt::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1); + MCAuto sel=DataArrayIdType::New(); sel->useArray(startCellIds,false,DeallocType::CPP_DEALLOC,std::distance(startCellIds,endCellIds),1); return sel->buildExplicitArrByRanges(nbOfNodesPerCell); } /*! * No implementation needed ! */ -void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(double , const int *, int newNbOfNodes, DataArrayDouble *) const +void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnNodes(double , const mcIdType *, mcIdType newNbOfNodes, DataArrayDouble *) const { } -void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const +void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } @@ -2798,7 +2799,7 @@ MCAuto MEDCouplingFieldDiscretizationGaussNE::ag return EasyAggregate(fds); } -void MEDCouplingFieldDiscretizationGaussNE::renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int 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 !"); } @@ -2870,21 +2871,22 @@ void MEDCouplingFieldDiscretizationKriging::getValueOn(const DataArrayDouble *ar std::copy(res2->begin(),res2->end(),res); } -DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints) const +DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints) const { if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : input array is null or not allocated !"); - std::size_t 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()); } - int nbCols(-1),nbCompo(arr->getNumberOfComponents()); + mcIdType nbCols(-1); + std::size_t nbCompo=arr->getNumberOfComponents(); MCAuto m(computeEvaluationMatrixOnGivenPts(mesh,loc,nbOfTargetPoints,nbCols)); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTargetPoints,nbCompo); - INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,nbCompo,ret->getPointer()); + INTERP_KERNEL::matrixProduct(m->begin(),nbOfTargetPoints,nbCols,arr->begin(),nbOfRows,ToIdType(nbCompo),ret->getPointer()); return ret.retn(); } @@ -2903,13 +2905,14 @@ MCAuto MEDCouplingFieldDiscretizationKriging::ag * * \return the new result matrix to be deallocated by the caller. */ -DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints, int& nbCols) const +DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const { - int isDrift(-1),nbRows(-1); + mcIdType isDrift(-1),nbRows(-1); MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); // MCAuto coords=getLocalizationOfDiscValues(mesh); - int nbOfPts(coords->getNumberOfTuples()),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; @@ -2921,12 +2924,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO matrix3->alloc(nbOfTargetPoints*nbRows,1); double *work=matrix3->getPointer(); const double *workCst(matrix2->begin()),*workCst2(loc); - for(int i=0;i ret(DataArrayDouble::New()); @@ -2935,7 +2938,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixO MCAuto ret2(DataArrayDouble::New()); ret2->alloc(nbOfTargetPoints*nbOfPts,1); workCst=ret->begin(); work=ret2->getPointer(); - for(int i=0;i matrixWithDrift(computeMatrix(mesh,isDrift,matSz)); MCAuto matrixInv(DataArrayDouble::New()); @@ -2963,12 +2966,12 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeInverseMatrix(con * \return the new result matrix to be deallocated by the caller. * \sa computeInverseMatrix */ -DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const +DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const { if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeMatrix : NULL input mesh !"); MCAuto coords(getLocalizationOfDiscValues(mesh)); - int nbOfPts(coords->getNumberOfTuples()); + mcIdType nbOfPts(coords->getNumberOfTuples()); MCAuto matrix(coords->buildEuclidianDistanceDenseMatrix()); operateOnDenseMatrix(mesh->getSpaceDimension(),nbOfPts*nbOfPts,matrix->getPointer()); // Drift @@ -2987,9 +2990,9 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeMatrix(const MEDC * Whatever the value of \a isDrift the number of tuples of returned DataArrayDouble will be equal to \c arr->getNumberOfTuples() + \a isDrift. * \return a newly allocated array containing coefficients including or not drift coefficient at the end depending the value of \a isDrift parameter. */ -DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const +DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, mcIdType& isDrift) const { - int nbRows(-1); + mcIdType nbRows(-1); MCAuto matrixInv(computeInverseMatrix(mesh,isDrift,nbRows)); MCAuto KnewiK(DataArrayDouble::New()); KnewiK->alloc(nbRows*1,1); @@ -3005,7 +3008,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficie * \param [in] nbOfElems is the result of the product of nb of rows and the nb of columns of matrix \a matrixPtr * \param [in,out] matrixPtr is the dense matrix whose on each values the operation will be applied */ -void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const +void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimension, mcIdType nbOfElems, double *matrixPtr) const { switch(spaceDimension) { @@ -3029,18 +3032,18 @@ void MEDCouplingFieldDiscretizationKriging::operateOnDenseMatrix(int spaceDimens } } -void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(int nbOfElems, double *matrixPtr) +void MEDCouplingFieldDiscretizationKriging::OperateOnDenseMatrixH3(mcIdType nbOfElems, double *matrixPtr) { - for(int i=0;iisAllocated() || matr->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input dense matrix ! Must be allocated not NULL and with exactly one component !"); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftRect : invalid input array of coordiantes ! Must be allocated and not NULL !"); - int spaceDimension(arr->getNumberOfComponents()),nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples()); - delta=spaceDimension+1; - int nbOfCols(nbOfEltInMatrx/nbOfPts); + std::size_t spaceDimension(arr->getNumberOfComponents()); + mcIdType nbOfPts(arr->getNumberOfTuples()),nbOfEltInMatrx(matr->getNumberOfTuples()); + delta=ToIdType(spaceDimension)+1; + 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)); double *retPtr(ret->getPointer()); const double *mPtr(matr->begin()),*aPtr(arr->begin()); - for(int i=0;iisAllocated() || arr->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec : input array must be not NULL allocated and with one component !"); @@ -3107,11 +3111,11 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::PerformDriftOfVec(const * \return a newly allocated matrix bigger than input matrix \a matr. * \sa MEDCouplingFieldDiscretizationKriging::PerformDriftRect */ -DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const +DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const { std::size_t spaceDimension(arr->getNumberOfComponents()); - delta=spaceDimension+1; - std::size_t szOfMatrix(arr->getNumberOfTuples()); + delta=ToIdType(spaceDimension)+1; + mcIdType szOfMatrix(arr->getNumberOfTuples()); if(szOfMatrix*szOfMatrix!=matr->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::performDrift : invalid size"); MCAuto ret=DataArrayDouble::New(); @@ -3119,7 +3123,7 @@ DataArrayDouble *MEDCouplingFieldDiscretizationKriging::performDrift(const DataA const double *srcWork=matr->getConstPointer(); const double *srcWork2=arr->getConstPointer(); double *destWork=ret->getPointer(); - for(std::size_t i=0;i& code, const std::vector& idsPerType) const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuples(const MEDCouplingMesh *mesh) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const = 0; MEDCOUPLING_EXPORT virtual void normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const; MEDCOUPLING_EXPORT virtual void normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const; MEDCOUPLING_EXPORT virtual void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const; MEDCOUPLING_EXPORT virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const = 0; - MEDCOUPLING_EXPORT virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const = 0; + MEDCOUPLING_EXPORT virtual void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const = 0; MEDCOUPLING_EXPORT virtual void checkCompatibilityWithNature(NatureOfField nat) const = 0; - MEDCOUPLING_EXPORT virtual void renumberCells(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT virtual void renumberCells(const mcIdType *old2NewBg, bool check=true); MEDCOUPLING_EXPORT virtual void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector& arrays, - const int *old2NewBg, bool check) = 0; - MEDCOUPLING_EXPORT virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const; + const mcIdType *old2NewBg, bool check) = 0; + MEDCOUPLING_EXPORT virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, mcIdType cellId, mcIdType nodeIdInCell, int compoId) const; MEDCOUPLING_EXPORT virtual void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const = 0; MEDCOUPLING_EXPORT virtual void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const = 0; - MEDCOUPLING_EXPORT virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT virtual void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const = 0; - MEDCOUPLING_EXPORT virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const = 0; - MEDCOUPLING_EXPORT virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const = 0; + MEDCOUPLING_EXPORT virtual void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const mcIdType *startCellIds, const mcIdType *endCellIds) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT virtual void renumberValuesOnNodes(double epsOnVals, const mcIdType *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const = 0; + MEDCOUPLING_EXPORT virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const mcIdType *old2New, mcIdType newSz, DataArrayDouble *arr) const = 0; + MEDCOUPLING_EXPORT virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const mcIdType *new2old, mcIdType newSz, DataArrayDouble *arr) const = 0; MEDCOUPLING_EXPORT virtual MCAuto aggregate(std::vector& fds) const = 0; - MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT virtual void getSerializationIntArray(DataArrayIdType *& arr) const; + MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfo); - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr); - MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr); + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *& arr); + MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfo, const DataArrayIdType *arr); MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); - MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector& refCoo, + MEDCOUPLING_EXPORT virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); MEDCOUPLING_EXPORT virtual void clearGaussLocalizations(); - MEDCOUPLING_EXPORT virtual MEDCouplingGaussLocalization& getGaussLocalization(int locId); - MEDCOUPLING_EXPORT virtual int getNbOfGaussLocalization() const; - MEDCOUPLING_EXPORT virtual int getGaussLocalizationIdOfOneCell(int cellId) const; - MEDCOUPLING_EXPORT virtual int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT virtual std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT virtual void getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const; - MEDCOUPLING_EXPORT virtual const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; + MEDCOUPLING_EXPORT virtual MEDCouplingGaussLocalization& getGaussLocalization(mcIdType locId); + MEDCOUPLING_EXPORT virtual mcIdType getNbOfGaussLocalization() const; + MEDCOUPLING_EXPORT virtual mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT virtual mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT virtual std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + 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 virtual ~MEDCouplingFieldDiscretization(); protected: MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization(); - MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg); - MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg); + MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const mcIdType *old2NewPtr, mcIdType newNbOfEntity, DataArrayDouble *arr, const std::string& msg); + MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const mcIdType *new2OldPtr, mcIdType new2OldSz, DataArrayDouble *arr, const std::string& msg); template static MCAuto EasyAggregate(std::vector& fds); protected: @@ -127,28 +127,28 @@ namespace MEDCoupling 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; - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) 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 int *old2NewBg, bool check); + const mcIdType *old2NewBg, bool check); MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const; - MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + 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; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const; + 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; + 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 int *start, const int *end, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) 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 reprQuickOverview(std::ostream& stream) const; public: static const char REPR[]; @@ -158,24 +158,24 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationOnNodes : public MEDCouplingFieldDiscretization { public: - MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const; + 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 int *old2NewBg, bool check); + const mcIdType *old2NewBg, bool check); MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; MEDCOUPLING_EXPORT void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) 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, int i, int j, int k, double *res) const; + MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k, double *res) const; }; class MEDCouplingFieldDiscretizationP1 : public MEDCouplingFieldDiscretizationOnNodes @@ -189,14 +189,14 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const; + MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT MCAuto aggregate(std::vector& fds) const override; public: static const char REPR[]; static const TypeOfField TYPE; protected: - MEDCOUPLING_EXPORT void getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const; + MEDCOUPLING_EXPORT void getValueInCell(const MEDCouplingMesh *mesh, mcIdType cellId, const DataArrayDouble *arr, const double *loc, double *res) const; }; /*! @@ -206,15 +206,15 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization { public: - MEDCOUPLING_EXPORT const DataArrayInt *getArrayOfDiscIds() const; - MEDCOUPLING_EXPORT void setArrayOfDiscIds(const DataArrayInt *adids); + MEDCOUPLING_EXPORT const DataArrayIdType *getArrayOfDiscIds() const; + MEDCOUPLING_EXPORT void setArrayOfDiscIds(const DataArrayIdType *adids); MEDCOUPLING_EXPORT void checkNoOrphanCells() const; - MEDCOUPLING_EXPORT std::vector splitIntoSingleGaussDicrPerCellType(std::vector< int >& locIds) const; + MEDCOUPLING_EXPORT std::vector splitIntoSingleGaussDicrPerCellType(std::vector< mcIdType >& locIds) const; protected: MEDCouplingFieldDiscretizationPerCell(); - MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const int *startCellIds, const int *endCellIds); - MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, int beginCellIds, int endCellIds, int stepCellIds); - MEDCouplingFieldDiscretizationPerCell(DataArrayInt *dpc); + MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, const mcIdType *startCellIds, const mcIdType *endCellIds); + MEDCouplingFieldDiscretizationPerCell(const MEDCouplingFieldDiscretizationPerCell& other, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds); + MEDCouplingFieldDiscretizationPerCell(DataArrayIdType *dpc); ~MEDCouplingFieldDiscretizationPerCell(); void updateTime() const; std::size_t getHeapMemorySizeWithoutChildren() const; @@ -222,12 +222,12 @@ namespace MEDCoupling void checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArray *da) const; bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const; bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; - void renumberCells(const int *old2NewBg, bool check); + void renumberCells(const mcIdType *old2NewBg, bool check); protected: void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh); protected: DataArrayIdType *_discr_per_cell; - static const int DFT_INVALID_LOCID_VALUE; + static const mcIdType DFT_INVALID_LOCID_VALUE; }; class MEDCouplingFieldDiscretizationGauss : public MEDCouplingFieldDiscretizationPerCell @@ -238,64 +238,64 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const; MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clone() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePart(const int *startCellIds, const int *endCellIds) const; - MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *clonePartRange(int beginCellIds, int endCellIds, int stepCellIds) const; + 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 int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) 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 int *old2NewBg, bool check); + const mcIdType *old2NewBg, bool check); MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + 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(DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *& arr); - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfo, const DataArrayInt *arr); - MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const; + 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; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const; + 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; + 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); - MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector& refCoo, + 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); MEDCOUPLING_EXPORT void clearGaussLocalizations(); - MEDCOUPLING_EXPORT void setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc); - MEDCOUPLING_EXPORT void resizeLocalizationVector(int newSz); - MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId); - MEDCOUPLING_EXPORT int getNbOfGaussLocalization() const; - MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneCell(int cellId) const; - MEDCOUPLING_EXPORT int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const; - MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; - MEDCOUPLING_EXPORT DataArrayInt *buildNbOfGaussPointPerCellField() const; + MEDCOUPLING_EXPORT void setGaussLocalization(mcIdType locId, const MEDCouplingGaussLocalization& loc); + MEDCOUPLING_EXPORT void resizeLocalizationVector(mcIdType newSz); + 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; protected: - MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, const int *startCellIds=0, const int *endCellIds=0); - MEDCouplingFieldDiscretizationGauss(const MEDCouplingFieldDiscretizationGauss& other, int beginCellIds, int endCellIds, int stepCellIds); - MEDCouplingFieldDiscretizationGauss(DataArrayInt *dpc, const std::vector& loc):MEDCouplingFieldDiscretizationPerCell(dpc),_loc(loc) { } + 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(); - int getOffsetOfCell(int cellId) const; - void checkLocalizationId(int locId) const; - void commonUnserialization(const std::vector& tinyInfo); + mcIdType getOffsetOfCell(mcIdType cellId) const; + void checkLocalizationId(mcIdType locId) const; + void commonUnserialization(const std::vector& tinyInfo); public: static const char REPR[]; static const TypeOfField TYPE; @@ -315,29 +315,29 @@ namespace MEDCoupling 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; - MEDCOUPLING_EXPORT int getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT int getNumberOfTuples(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - MEDCOUPLING_EXPORT DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) 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 int *old2NewBg, bool check); + 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 int *tupleIdsBg, const int *tupleIdsEnd, - DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const; + MEDCOUPLING_EXPORT void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const mcIdType *tupleIdsBg, const mcIdType *tupleIdsEnd, + DataArrayIdType *&cellRestriction, DataArrayIdType *&trueTupleRestriction) const; MEDCOUPLING_EXPORT void checkCompatibilityWithNature(NatureOfField nat) const; - MEDCOUPLING_EXPORT double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const; + 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; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; - MEDCOUPLING_EXPORT void getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const; - MEDCOUPLING_EXPORT DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const; - MEDCOUPLING_EXPORT void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const; - MEDCOUPLING_EXPORT void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const; + 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; + 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; MEDCOUPLING_EXPORT static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth); @@ -416,20 +416,20 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(const MEDCouplingMesh *mesh, bool isAbs) const; MEDCOUPLING_EXPORT void getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const; + MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfPoints) const; 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, int nbOfTargetPoints, int& nbCols) const; - MEDCOUPLING_EXPORT DataArrayDouble *computeInverseMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const; - MEDCOUPLING_EXPORT DataArrayDouble *computeMatrix(const MEDCouplingMesh *mesh, int& isDrift, int& matSz) const; - MEDCOUPLING_EXPORT DataArrayDouble *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const; - MEDCOUPLING_EXPORT void operateOnDenseMatrix(int spaceDimension, int nbOfElems, double *matrixPtr) const; - MEDCOUPLING_EXPORT DataArrayDouble *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta) const; - MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH3(int nbOfElems, double *matrixPtr); - MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH2Ln(int nbOfElems, double *matrixPtr); - MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, int& delta); - MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, int isDrift); + MEDCOUPLING_EXPORT DataArrayDouble *computeEvaluationMatrixOnGivenPts(const MEDCouplingMesh *mesh, const double *loc, mcIdType nbOfTargetPoints, mcIdType& nbCols) const; + MEDCOUPLING_EXPORT DataArrayDouble *computeInverseMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const; + MEDCOUPLING_EXPORT DataArrayDouble *computeMatrix(const MEDCouplingMesh *mesh, mcIdType& isDrift, mcIdType& matSz) const; + MEDCOUPLING_EXPORT DataArrayDouble *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, mcIdType& isDrift) const; + MEDCOUPLING_EXPORT void operateOnDenseMatrix(int spaceDimension, mcIdType nbOfElems, double *matrixPtr) const; + MEDCOUPLING_EXPORT DataArrayDouble *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta) const; + MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH3(mcIdType nbOfElems, double *matrixPtr); + MEDCOUPLING_EXPORT static void OperateOnDenseMatrixH2Ln(mcIdType nbOfElems, double *matrixPtr); + MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr, mcIdType& delta); + MEDCOUPLING_EXPORT static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift); public: static const char REPR[]; static const TypeOfField TYPE; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx old mode 100644 new mode 100755 index 3c877f2b4..b65b77a3b --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -212,21 +212,21 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const MCAuto nsp(new MEDCouplingFieldDiscretizationP0); ret->setDiscretization(nsp); const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call - int nbCells(m->getNumberOfCells()); + mcIdType nbCells=ToIdType(m->getNumberOfCells()); std::vector arrs(getArrays()); 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]; double *pt(outArrsSafe[j]->getPointer()); const double *srcPt(arrs[j]->begin()); - for(int i=0;i nodeIds; + std::vector nodeIds; m->getNodeIdsOfCell(i,nodeIds); std::fill(pt,pt+nbCompo,0.); std::size_t nbNodesInCell(nodeIds.size()); @@ -268,9 +268,9 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const MCAuto nsp(new MEDCouplingFieldDiscretizationP1); ret->setDiscretization(nsp); const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkConsistencyLight call - MCAuto rn(DataArrayInt::New()),rni(DataArrayInt::New()); + MCAuto rn(DataArrayIdType::New()),rni(DataArrayIdType::New()); m->getReverseNodalConnectivity(rn,rni); - MCAuto rni2(rni->deltaShiftIndex()); + MCAuto rni2(rni->deltaShiftIndex()); MCAuto rni3(rni2->convertToDblArr()); rni2=0; std::vector arrs(getArrays()); std::size_t sz(arrs.size()); @@ -388,14 +388,14 @@ bool MEDCouplingFieldDouble::areCompatibleForMeld(const MEDCouplingFieldDouble * * \ref py_mcfielddouble_renumberNodes "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps) +void MEDCouplingFieldDouble::renumberNodes(const mcIdType *old2NewBg, double eps) { const MEDCouplingPointSet *meshC=dynamic_cast(_mesh); if(!meshC) throw INTERP_KERNEL::Exception("Invalid mesh to apply renumberNodes on it !"); - int nbOfNodes=meshC->getNumberOfNodes(); + mcIdType nbOfNodes=meshC->getNumberOfNodes(); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); - int 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); @@ -423,7 +423,7 @@ void MEDCouplingFieldDouble::renumberNodes(const int *old2NewBg, double eps) * \throw If the spatial discretization of \a this field is NULL. * \throw If values at merged nodes differ more than \a eps. */ -void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps) +void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const mcIdType *old2NewBg, mcIdType newNbOfNodes, double eps) { if(_type.isNull()) throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !"); @@ -441,13 +441,13 @@ void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int * vmin are not included in the result array. * \param [in] vmax - an upper boundary of the range. Tuples with values more than \a * vmax are not included in the result array. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of selected + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of selected * tuples. The caller is to delete this array using decrRef() as it is no * more needed. * \throw If the data array is not set. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const +DataArrayIdType *MEDCouplingFieldDouble::findIdsInRange(double vmin, double vmax) const { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::findIdsInRange : no default array set !"); @@ -547,7 +547,7 @@ double MEDCouplingFieldDouble::getMaxValue() const if(*iter) { isExistingArr=true; - int loc; + mcIdType loc; ret=std::max(ret,(*iter)->getMaxValue(loc)); } } @@ -559,30 +559,30 @@ double MEDCouplingFieldDouble::getMaxValue() const /*! * Returns the maximal value and all its locations within \a this scalar field. * Only the first of available data arrays is checked. - * \param [out] tupleIds - a new instance of DataArrayInt containing indices of + * \param [out] tupleIds - a new instance of DataArrayIdType containing indices of * tuples holding the maximal value. The caller is to delete it using * decrRef() as it is no more needed. * \return double - the maximal value among all values of the first array of \a this filed. * \throw If \a this->getNumberOfComponents() != 1. * \throw If there is an empty data array in \a this field. */ -double MEDCouplingFieldDouble::getMaxValue2(DataArrayInt*& tupleIds) const +double MEDCouplingFieldDouble::getMaxValue2(DataArrayIdType*& tupleIds) const { std::vector arrays; timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; tupleIds=0; - MCAuto ret1; + MCAuto ret1; for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { if(*iter) { isExistingArr=true; - DataArrayInt *tmp; + DataArrayIdType *tmp; ret=std::max(ret,(*iter)->getMaxValue2(tmp)); - MCAuto tmpSafe(tmp); - if(!((const DataArrayInt *)ret1)) + MCAuto tmpSafe(tmp); + if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } } @@ -611,7 +611,7 @@ double MEDCouplingFieldDouble::getMinValue() const if(*iter) { isExistingArr=true; - int loc; + mcIdType loc; ret=std::min(ret,(*iter)->getMinValue(loc)); } } @@ -623,30 +623,30 @@ double MEDCouplingFieldDouble::getMinValue() const /*! * Returns the minimal value and all its locations within \a this scalar field. * Only the first of available data arrays is checked. - * \param [out] tupleIds - a new instance of DataArrayInt containing indices of + * \param [out] tupleIds - a new instance of DataArrayIdType containing indices of * tuples holding the minimal value. The caller is to delete it using * decrRef() as it is no more needed. * \return double - the minimal value among all values of the first array of \a this filed. * \throw If \a this->getNumberOfComponents() != 1. * \throw If there is an empty data array in \a this field. */ -double MEDCouplingFieldDouble::getMinValue2(DataArrayInt*& tupleIds) const +double MEDCouplingFieldDouble::getMinValue2(DataArrayIdType*& tupleIds) const { std::vector arrays; timeDiscr()->getArrays(arrays); double ret(-std::numeric_limits::max()); bool isExistingArr=false; tupleIds=0; - MCAuto ret1; + MCAuto ret1; for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { if(*iter) { isExistingArr=true; - DataArrayInt *tmp; + DataArrayIdType *tmp; ret=std::max(ret,(*iter)->getMinValue2(tmp)); - MCAuto tmpSafe(tmp); - if(!((const DataArrayInt *)ret1)) + MCAuto tmpSafe(tmp); + if(!((const DataArrayIdType *)ret1)) ret1=tmpSafe; } } @@ -701,11 +701,11 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getWeightedAverageValue : no default array defined !"); MCAuto w=buildMeasureField(isWAbs); - double deno=w->getArray()->accumulate(0); + double deno=w->getArray()->accumulate((std::size_t)0); MCAuto arr=getArray()->deepCopy(); arr->multiplyEqual(w->getArray()); arr->accumulate(res); - int nCompo = getArray()->getNumberOfComponents(); + std::size_t nCompo = getArray()->getNumberOfComponents(); std::transform(res,res+nCompo,res,std::bind2nd(std::multiplies(),1./deno)); } @@ -724,8 +724,8 @@ void MEDCouplingFieldDouble::getWeightedAverageValue(double *res, bool isWAbs) c */ double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) const { - int nbComps=getArray()->getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -752,8 +752,8 @@ 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 !"); - int nbComps=getArray()->getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -799,8 +799,8 @@ 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 !"); - int nbComps=getArray()->getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -843,8 +843,8 @@ double MEDCouplingFieldDouble::normMax(int compId) const { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::normMax : no default array defined !"); - int nbComps=getArray()->getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -891,8 +891,8 @@ 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 !"); - int nbComps=getArray()->getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -945,7 +945,7 @@ void MEDCouplingFieldDouble::integral(bool isWAbs, double *res) const * \ref py_mcfielddouble_getValueOnPos "Here is a Python example". * \endif */ -void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const +void MEDCouplingFieldDouble::getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const { const DataArrayDouble *arr=timeDiscr()->getArray(); if(!_mesh) @@ -997,7 +997,7 @@ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) con * \ref py_mcfielddouble_getValueOnMulti "Here is a Python example". * \endif */ -DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const +DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, mcIdType nbOfPoints) const { const DataArrayDouble *arr=timeDiscr()->getArray(); if(!_mesh) @@ -1034,7 +1034,7 @@ void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, dou std::vector res2; for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++) { - int sz=(int)res2.size(); + std::size_t sz=res2.size(); res2.resize(sz+(*iter)->getNumberOfComponents()); _type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]); } @@ -1077,7 +1077,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 = !"); - int nbOfTuple=_type->getNumberOfTuples(_mesh); + mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh); timeDiscr()->setOrCreateUniformValueOnAllComponents(nbOfTuple,value); return *this; } @@ -1288,7 +1288,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 !"); - int nbOfTuple=_type->getNumberOfTuples(_mesh); + mcIdType nbOfTuple=_type->getNumberOfTuples(_mesh); timeDiscr()->setUniformValue(nbOfTuple,nbOfComp,val); } @@ -1497,7 +1497,7 @@ std::size_t MEDCouplingFieldDouble::getNumberOfComponents() const * \throw If the spatial discretization is not fully defined. * \sa MEDCouplingField::getNumberOfTuplesExpected */ -std::size_t MEDCouplingFieldDouble::getNumberOfTuples() const +mcIdType MEDCouplingFieldDouble::getNumberOfTuples() const { if(!_mesh) throw INTERP_KERNEL::Exception("Impossible to retrieve number of tuples because no mesh specified !"); @@ -1513,7 +1513,7 @@ std::size_t MEDCouplingFieldDouble::getNumberOfTuples() const * data array. * \throw If the data array is not set. */ -std::size_t MEDCouplingFieldDouble::getNumberOfValues() const +mcIdType MEDCouplingFieldDouble::getNumberOfValues() const { if(getArray()==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::getNumberOfValues : No array specified !"); @@ -1561,7 +1561,7 @@ std::vector MEDCouplingFieldDouble::getDirectChildrenWi * \ref MEDCoupling::ON_GAUSS_PT "ON_GAUSS_PT" or * \ref MEDCoupling::ON_GAUSS_NE "ON_GAUSS_NE". */ -double MEDCouplingFieldDouble::getIJK(int cellId, int nodeIdInCell, int compoId) const +double MEDCouplingFieldDouble::getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getIJK !"); @@ -1627,9 +1627,9 @@ void MEDCouplingFieldDouble::changeUnderlyingMesh(const MEDCouplingMesh *other, { if(_mesh==0 || other==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::changeUnderlyingMesh : is expected to operate on not null meshes !"); - DataArrayInt *cellCor=0,*nodeCor=0; + DataArrayIdType *cellCor=0,*nodeCor=0; other->checkGeoEquivalWith(_mesh,levOfCheck,precOnMesh,cellCor,nodeCor); - MCAuto cellCor2(cellCor),nodeCor2(nodeCor); + MCAuto cellCor2(cellCor),nodeCor2(nodeCor); if(cellCor) renumberCellsWithoutMesh(cellCor->getConstPointer(),false); if(nodeCor) @@ -1708,8 +1708,8 @@ bool MEDCouplingFieldDouble::mergeNodes(double eps, double epsOnVals) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; - int ret2; - MCAuto arr=meshC2->mergeNodes(eps,ret,ret2); + mcIdType ret2; + MCAuto arr=meshC2->mergeNodes(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -1747,8 +1747,8 @@ bool MEDCouplingFieldDouble::mergeNodesCenter(double eps, double epsOnVals) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodesCenter !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); bool ret; - int ret2; - MCAuto arr=meshC2->mergeNodesCenter(eps,ret,ret2); + mcIdType ret2; + MCAuto arr=meshC2->mergeNodesCenter(eps,ret,ret2); if(!ret)//no nodes have been merged. return ret; std::vector arrays; @@ -1783,8 +1783,8 @@ bool MEDCouplingFieldDouble::zipCoords(double epsOnVals) if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !"); MCAuto meshC2((MEDCouplingPointSet *)meshC->deepCopy()); - int oldNbOfNodes=meshC2->getNumberOfNodes(); - MCAuto arr=meshC2->zipCoordsTraducer(); + mcIdType oldNbOfNodes=meshC2->getNumberOfNodes(); + MCAuto arr=meshC2->zipCoordsTraducer(); if(meshC2->getNumberOfNodes()!=oldNbOfNodes) { std::vector arrays; @@ -1824,15 +1824,15 @@ bool MEDCouplingFieldDouble::zipConnectivity(int compType, double epsOnVals) if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !"); MCAuto meshC2((MEDCouplingUMesh *)meshC->deepCopy()); - std::size_t oldNbOfCells(meshC2->getNumberOfCells()); - MCAuto arr=meshC2->zipConnectivityTraducer(compType); + mcIdType oldNbOfCells(meshC2->getNumberOfCells()); + MCAuto arr=meshC2->zipConnectivityTraducer(compType); if(meshC2->getNumberOfCells()!=oldNbOfCells) { std::vector arrays; timeDiscr()->getArrays(arrays); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) if(*iter) - _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),meshC2->getNumberOfCells(),*iter); + _type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),ToIdType(meshC2->getNumberOfCells()),*iter); setMesh(meshC2); return true; } @@ -1855,11 +1855,11 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::extractSlice3D(const double *ori const MCAuto umesh(mesh->buildUnstructured()); MCAuto ret(clone(false)); ret->setMesh(umesh); - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MCAuto mesh2=umesh->buildSlice3D(origin,vec,eps,cellIds); - MCAuto cellIds2=cellIds; + MCAuto cellIds2=cellIds; ret->setMesh(mesh2); - MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); + MCAuto tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end()); std::vector arrays; timeDiscr()->getArrays(arrays); int i=0; @@ -1898,17 +1898,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 !"); - int oldNbOfCells=_mesh->getNumberOfCells(); + std::size_t oldNbOfCells=_mesh->getNumberOfCells(); MCAuto meshC2(_mesh->deepCopy()); - MCAuto arr=meshC2->simplexize(policy); - int newNbOfCells=meshC2->getNumberOfCells(); + MCAuto arr=meshC2->simplexize(policy); + std::size_t newNbOfCells=meshC2->getNumberOfCells(); if(oldNbOfCells==newNbOfCells) return false; std::vector arrays; timeDiscr()->getArrays(arrays); for(std::vector::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) if(*iter) - _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),arr->getNbOfElems(),*iter); + _type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),ToIdType(arr->getNbOfElems()),*iter); setMesh(meshC2); return true; } @@ -1922,7 +1922,7 @@ MCAuto MEDCouplingFieldDouble::voronoize(double eps) con checkConsistencyLight(); const MEDCouplingMesh *mesh(getMesh()); INTERP_KERNEL::AutoCppPtr vor; - int meshDim(mesh->getMeshDimension()),spaceDim(mesh->getSpaceDimension()); + std::size_t meshDim(mesh->getMeshDimension()),spaceDim(mesh->getSpaceDimension()); if(meshDim==1 && (spaceDim==1 || spaceDim==2 || spaceDim==3)) vor=new Voronizer1D; else if(meshDim==2 && (spaceDim==2 || spaceDim==3)) @@ -1950,8 +1950,8 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi MCAuto umesh(mesh->buildUnstructured()); umesh=umesh->clone(false); umesh->convertQuadraticCellsToLinear(); - MCAuto o2n(umesh->zipCoordsTraducer()); - MCAuto n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes())); + MCAuto o2n(umesh->zipCoordsTraducer()); + MCAuto n2o(o2n->invertArrayO2N2N2O(umesh->getNumberOfNodes())); MCAuto arr(getArray()->selectByTupleIdSafe(n2o->begin(),n2o->end())); MCAuto ret(MEDCouplingFieldDouble::New(ON_NODES)); ret->setArray(arr); @@ -1988,17 +1988,17 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi if(!disc2) throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field"); std::set gt2(umesh->getAllGeoTypes()); - std::vector< MCAuto > cellIdsV; + std::vector< MCAuto > cellIdsV; std::vector< MCAuto > meshesV; std::vector< MEDCouplingGaussLocalization > glV; bool isZipReq(false); 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)); + MCAuto cellIds(umesh->giveCellsWithType(*it)); cellIdsV.push_back(cellIds); MCAuto part(umesh->buildPartOfMySelf(cellIds->begin(),cellIds->end())); - int id(disc2->getGaussLocalizationIdOfOneType(*it)); + mcIdType id(disc2->getGaussLocalizationIdOfOneType(*it)); const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(id)); if(!cm.isQuadratic()) { @@ -2019,8 +2019,8 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi { std::vector< const MEDCouplingUMesh * > meshesPtr(VecAutoToVecOfCstPt(meshesV)); umesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshesPtr); - std::vector< const DataArrayInt * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV)); - MCAuto zeIds(DataArrayInt::Aggregate(zeCellIds)); + std::vector< const DataArrayIdType * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV)); + MCAuto zeIds(DataArrayIdType::Aggregate(zeCellIds)); umesh->renumberCells(zeIds->begin()); umesh->setName(mesh->getName()); } @@ -2284,7 +2284,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const * \param [in] dftValue - value assigned to new values added to \a this field. * \throw If \a this is not allocated. */ -void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftValue) +void MEDCouplingFieldDouble::changeNbOfComponents(std::size_t newNbOfComp, double dftValue) { timeDiscr()->changeNbOfComponents(newNbOfComp,dftValue); } @@ -2301,7 +2301,7 @@ void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftVal * \throw If a component index (\a i) is not valid: * \a i < 0 || \a i >= \a this->getNumberOfComponents(). */ -MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector& compoIds) const +MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector& compoIds) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !"); @@ -2313,7 +2313,6 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std return ret.retn(); } - /*! * Copy all components in a specified order from another field. * The number of tuples in \a this and the other field can be different. @@ -2325,7 +2324,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std * \throw If \a compoIds.size() != \a a->getNumberOfComponents(). * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents(). */ -void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds) +void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds) { timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds); } @@ -2402,7 +2401,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vectorareCompatibleForMerge(*it)) throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MergeFields on them! Check support mesh, field nature, and spatial and time discretisation."); - for(int i=0;i<(int)a.size();i++) + for(std::size_t i=0;i MEDCouplingFieldDouble::voronoizeGen(const Voroni inpMeshBase=fieldToWO->getMesh(); inpMesh=inpMeshBase->buildUnstructured(); } - int nbCells(inpMesh->getNumberOfCells()); + mcIdType nbCells(inpMesh->getNumberOfCells()); const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization()); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize2D : Not a ON_GAUSS_PT field"); - int nbLocs(disc2->getNbOfGaussLocalization()); + mcIdType nbLocs(disc2->getNbOfGaussLocalization()); std::vector< MCAuto > cells(nbCells); - for(int i=0;igetGaussLocalization(i)); if(gl.getDimension()!=vor->getDimension()) @@ -2935,15 +2934,15 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto coo3(MEDCouplingUMesh::Build0DMeshFromCoords(coo2)); // MCAuto vorCellsForCurDisc(vor->doIt(mesh,coo2,eps)); - std::vector ids; + std::vector ids; MCAuto ptsInReal; disc2->getCellIdsHavingGaussLocalization(i,ids); { MCAuto subMesh(inpMesh->buildPartOfMySelf(&ids[0],&ids[0]+ids.size())); ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh); } - int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); - for(std::size_t j=0;jgetNumberOfNodes()); + for(mcIdType j=0;j elt(vorCellsForCurDisc->clone(false)); MCAuto coo4(ptsInReal->selectByTupleIdSafeSlice(j*nbPtsPerCell,(j+1)*nbPtsPerCell,1)); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index 1ed1a122f..ee88df0b4 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -41,9 +41,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const; MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT bool areCompatibleForMeld(const MEDCouplingFieldDouble *other) const; - MEDCOUPLING_EXPORT void renumberNodes(const int *old2NewBg, double eps=1e-15); - MEDCOUPLING_EXPORT void renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps=1e-15); - MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(double vmin, double vmax) 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; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const; @@ -51,13 +51,13 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const; MEDCOUPLING_EXPORT MEDCouplingFieldInt *convertToIntField() const; MEDCOUPLING_EXPORT MEDCouplingFieldFloat *convertToFloatField() const; - MEDCOUPLING_EXPORT double getIJK(int cellId, int nodeIdInCell, int compoId) const; + MEDCOUPLING_EXPORT double getIJK(mcIdType cellId, int nodeIdInCell, int compoId) const; MEDCOUPLING_EXPORT double accumulate(int compId) const; MEDCOUPLING_EXPORT void accumulate(double *res) const; MEDCOUPLING_EXPORT double getMaxValue() const; - MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt*& tupleIds) const; + MEDCOUPLING_EXPORT double getMaxValue2(DataArrayIdType*& tupleIds) const; MEDCOUPLING_EXPORT double getMinValue() const; - MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt*& tupleIds) const; + MEDCOUPLING_EXPORT double getMinValue2(DataArrayIdType*& tupleIds) const; MEDCOUPLING_EXPORT double getAverageValue() const; MEDCOUPLING_EXPORT double norm2() const; MEDCOUPLING_EXPORT void getWeightedAverageValue(double *res, bool isWAbs=true) const; @@ -70,10 +70,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void normMax(double *res) const; MEDCOUPLING_EXPORT double integral(int compId, bool isWAbs) const; MEDCOUPLING_EXPORT void integral(bool isWAbs, double *res) const; - MEDCOUPLING_EXPORT void getValueOnPos(int i, int j, int k, double *res) const; + MEDCOUPLING_EXPORT void getValueOnPos(mcIdType i, mcIdType j, mcIdType k, double *res) const; MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double *res) const; MEDCOUPLING_EXPORT void getValueOn(const double *spaceLoc, double time, double *res) const; - MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, int nbOfPoints) const; + MEDCOUPLING_EXPORT DataArrayDouble *getValueOnMulti(const double *spaceLoc, mcIdType nbOfPoints) const; MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId); MEDCOUPLING_EXPORT void applyLin(double a, double b); MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value); @@ -90,8 +90,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const; - MEDCOUPLING_EXPORT std::size_t getNumberOfTuples() const; - MEDCOUPLING_EXPORT std::size_t getNumberOfValues() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfValues() const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -116,9 +116,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *deviator() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *magnitude() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *maxPerTuple() const; - MEDCOUPLING_EXPORT void changeNbOfComponents(int newNbOfComp, double dftValue=0.); - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector& compoIds) const; - MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds); + MEDCOUPLING_EXPORT void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.); + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *keepSelectedComponents(const std::vector& compoIds) const; + MEDCOUPLING_EXPORT void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector& compoIds); MEDCOUPLING_EXPORT void sortPerTuple(bool asc); MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *MergeFields(const std::vector& a); diff --git a/src/MEDCoupling/MEDCouplingFieldFloat.cxx b/src/MEDCoupling/MEDCouplingFieldFloat.cxx index 8fbc9ef69..7fbbce57f 100644 --- a/src/MEDCoupling/MEDCouplingFieldFloat.cxx +++ b/src/MEDCoupling/MEDCouplingFieldFloat.cxx @@ -23,6 +23,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingFieldInt.cxx b/src/MEDCoupling/MEDCouplingFieldInt.cxx index 42aa53538..66637f2e3 100644 --- a/src/MEDCoupling/MEDCouplingFieldInt.cxx +++ b/src/MEDCoupling/MEDCouplingFieldInt.cxx @@ -23,6 +23,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingFieldTemplate.hxx" #include "MEDCouplingMesh.hxx" +#include "MEDCouplingMemArray.txx" using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingFieldT.hxx b/src/MEDCoupling/MEDCouplingFieldT.hxx index b1635504b..f9b22d3de 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.hxx +++ b/src/MEDCoupling/MEDCouplingFieldT.hxx @@ -46,9 +46,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual typename Traits::FieldType *clone(bool recDeepCpy) const = 0; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT typename Traits::FieldType *cloneWithMesh(bool recDeepCpy) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const DataArrayInt *part) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPartRange(int begin, int end, int step) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const DataArrayIdType *part) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const; + MEDCOUPLING_EXPORT typename Traits::FieldType *buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const; MEDCOUPLING_EXPORT void setArray(typename Traits::ArrayType *array) { _time_discr->setArray(array,this); } MEDCOUPLING_EXPORT void setEndArray(typename Traits::ArrayType *array) { _time_discr->setEndArray(array,this); } MEDCOUPLING_EXPORT const typename Traits::ArrayType *getArray() const { return _time_discr->getArray(); } @@ -74,7 +74,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { return _time_discr->getTime(iteration,order); } MEDCOUPLING_EXPORT double getStartTime(int& iteration, int& order) const { return _time_discr->getStartTime(iteration,order); } MEDCOUPLING_EXPORT double getEndTime(int& iteration, int& order) const { return _time_discr->getEndTime(iteration,order); } - MEDCOUPLING_EXPORT T getIJ(int tupleId, int compoId) const { return getArray()->getIJ(tupleId,compoId); } + MEDCOUPLING_EXPORT T getIJ(mcIdType tupleId, std::size_t compoId) const { return getArray()->getIJ(tupleId,compoId); } 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; @@ -88,16 +88,16 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool areCompatibleForDiv(const MEDCouplingField *other) const; MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldT *other); MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldT *other); - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); - MEDCOUPLING_EXPORT void renumberCellsWithoutMesh(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT void renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check=true); // - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + 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, DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const DataArrayInt *dataInt, const std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT void checkForUnserialization(const std::vector& tinyInfoI, const DataArrayIdType *dataInt, const std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) const; MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretizationTemplate *timeDiscrSafe() const; protected: MEDCouplingTimeDiscretizationTemplate *timeDiscrSafe(); diff --git a/src/MEDCoupling/MEDCouplingFieldT.txx b/src/MEDCoupling/MEDCouplingFieldT.txx index 7b8e53c4d..c59c5c069 100644 --- a/src/MEDCoupling/MEDCouplingFieldT.txx +++ b/src/MEDCoupling/MEDCouplingFieldT.txx @@ -228,7 +228,7 @@ namespace MEDCoupling * \endif */ template - void MEDCouplingFieldT::renumberCells(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCells(const mcIdType *old2NewBg, bool check) { renumberCellsWithoutMesh(old2NewBg,check); MCAuto m(_mesh->deepCopy()); @@ -259,7 +259,7 @@ namespace MEDCoupling * \throw If mesh nature does not allow renumbering (e.g. structured mesh). */ template - void MEDCouplingFieldT::renumberCellsWithoutMesh(const int *old2NewBg, bool check) + void MEDCouplingFieldT::renumberCellsWithoutMesh(const mcIdType *old2NewBg, bool check) { if(!_mesh) throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !"); @@ -368,10 +368,10 @@ namespace MEDCoupling { if(getArray()->isAllocated()) { - int nbOfCompo=getArray()->getNumberOfComponents(); + std::size_t nbOfCompo=getArray()->getNumberOfComponents(); ret << Traits::FieldTypeName << " default array has " << nbOfCompo << " components and " << getArray()->getNumberOfTuples() << " tuples.\n"; ret << Traits::FieldTypeName << " default array has following info on components : "; - for(int i=0;igetInfoOnComponent(i) << "\" "; ret << "\n"; } @@ -397,7 +397,7 @@ namespace MEDCoupling nat=MEDCouplingNatureOfField::GetRepr(_nature); stream << "Nature of field : " << nat << ".\n"; } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { } const MEDCouplingFieldDiscretization *fd(_type); if(!fd) @@ -474,13 +474,13 @@ namespace MEDCoupling * \sa MEDCoupling::MEDCouplingFieldDouble::buildSubPart(const DataArrayInt *) const, MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const int *partBg, const int *partEnd) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const mcIdType *partBg, const mcIdType *partEnd) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : Expecting a not NULL spatial discretization !"); - DataArrayInt *arrSelect; + DataArrayIdType *arrSelect; MCAuto m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -490,8 +490,8 @@ namespace MEDCoupling timeDiscrSafe()->getArrays(arrays); std::vector::ArrayType *> arrs; std::vector< MCAuto< typename Traits::ArrayType > > arrsSafe; - const int *arrSelBg=arrSelect->begin(); - const int *arrSelEnd=arrSelect->end(); + const mcIdType *arrSelBg=arrSelect->begin(); + const mcIdType *arrSelEnd=arrSelect->end(); for(typename std::vector::ArrayType *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++) { typename Traits::ArrayType *arr(0); @@ -534,7 +534,7 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPartRange */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayInt *part) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPart(const DataArrayIdType *part) const { if(part==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldT::buildSubPart : not empty array must be passed to this method !"); @@ -548,14 +548,14 @@ namespace MEDCoupling * \sa MEDCouplingFieldDouble::buildSubPart */ template - typename Traits::FieldType *MEDCouplingFieldT::buildSubPartRange(int begin, int end, int step) const + typename Traits::FieldType *MEDCouplingFieldT::buildSubPartRange(mcIdType begin, mcIdType end, mcIdType step) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !"); - DataArrayInt *arrSelect; - int beginOut,endOut,stepOut; + DataArrayIdType *arrSelect; + mcIdType beginOut,endOut,stepOut; MCAuto m(_type->buildSubMeshDataRange(_mesh,begin,end,step,beginOut,endOut,stepOut,arrSelect)); - MCAuto arrSelect2(arrSelect); + MCAuto arrSelect2(arrSelect); MCAuto< typename Traits::FieldType > ret(clone(false));//quick shallow copy. const MEDCouplingFieldDiscretization *disc=getDiscretization(); if(disc) @@ -572,8 +572,8 @@ namespace MEDCoupling { if(arrSelect) { - const int *arrSelBg=arrSelect->begin(); - const int *arrSelEnd=arrSelect->end(); + const mcIdType *arrSelBg=arrSelect->begin(); + const mcIdType *arrSelEnd=arrSelect->end(); arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd); } else @@ -619,19 +619,19 @@ namespace MEDCoupling * @param tinyInfo out parameter resized correctly after the call. The length of this vector is tiny. */ template - void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& tinyInfo) const + void MEDCouplingFieldT::getTinySerializationIntInformation(std::vector& tinyInfo) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !"); tinyInfo.clear(); - tinyInfo.push_back((int)_type->getEnum()); - tinyInfo.push_back((int)timeDiscrSafe()->getEnum()); - tinyInfo.push_back((int)_nature); + tinyInfo.push_back(ToIdType(_type->getEnum())); + tinyInfo.push_back(ToIdType(timeDiscrSafe()->getEnum())); + tinyInfo.push_back(ToIdType(_nature)); timeDiscrSafe()->getTinySerializationIntInformation(tinyInfo); - std::vector tinyInfo2; + std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back((int)tinyInfo2.size()); + tinyInfo.push_back(ToIdType(tinyInfo2.size())); } /*! @@ -660,18 +660,18 @@ namespace MEDCoupling * \sa checkForUnserialization */ template - void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); dataInt=0; - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->resizeForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->resizeForUnserialization(tinyInfoITmp3,dataInt); } @@ -681,29 +681,29 @@ namespace MEDCoupling * \sa resizeForUnserialization */ template - void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayInt *dataInt, const std::vector::ArrayType *>& arrays) + void MEDCouplingFieldT::checkForUnserialization(const std::vector& tinyInfoI, const DataArrayIdType *dataInt, const std::vector::ArrayType *>& arrays) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); - std::vector tinyInfoITmp(tinyInfoI); - int sz=tinyInfoITmp.back(); + std::vector tinyInfoITmp(tinyInfoI); + mcIdType sz=tinyInfoITmp.back(); tinyInfoITmp.pop_back(); - std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); - std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); + std::vector tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz); + std::vector tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end()); timeDiscrSafe()->checkForUnserialization(tinyInfoI2,arrays); - std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); + std::vector tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end()); _type->checkForUnserialization(tinyInfoITmp3,dataInt); } template - void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) + void MEDCouplingFieldT::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !"); - std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); + std::vector tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end()); // std::vector tmp(tinyInfoD); - int sz=(int)tinyInfoD.back();//very bad, lack of time to improve it + mcIdType sz=ToIdType(tinyInfoD.back());//very bad, lack of time to improve it tmp.pop_back(); std::vector tmp1(tmp.begin(),tmp.end()-sz); std::vector tmp2(tmp.end()-sz,tmp.end()); @@ -711,7 +711,7 @@ namespace MEDCoupling timeDiscrSafe()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS); _nature=(NatureOfField)tinyInfoI[2]; _type->finishUnserialization(tmp2); - int nbOfElemS=(int)tinyInfoS.size(); + std::size_t nbOfElemS=tinyInfoS.size(); _name=tinyInfoS[nbOfElemS-3]; _desc=tinyInfoS[nbOfElemS-2]; setTimeUnit(tinyInfoS[nbOfElemS-1]); @@ -722,7 +722,7 @@ namespace MEDCoupling * The values returned must be consulted only in readonly mode. */ template - void MEDCouplingFieldT::serialize(DataArrayInt *&dataInt, std::vector::ArrayType *>& arrays) const + void MEDCouplingFieldT::serialize(DataArrayIdType *&dataInt, std::vector::ArrayType *>& arrays) const { if(_type.isNull()) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !"); diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx index 423593f40..55b23cf0d 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.cxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.cxx @@ -140,17 +140,17 @@ std::string MEDCouplingFieldTemplate::advancedRepr() const return simpleRepr(); } -void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !"); tinyInfo.clear(); - tinyInfo.push_back((int)_type->getEnum()); - tinyInfo.push_back((int)_nature); - std::vector tinyInfo2; + tinyInfo.push_back(ToIdType(_type->getEnum())); + tinyInfo.push_back(ToIdType(_nature)); + std::vector tinyInfo2; _type->getTinySerializationIntInformation(tinyInfo2); tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); - tinyInfo.push_back((int)tinyInfo2.size()); + tinyInfo.push_back(ToIdType(tinyInfo2.size())); } void MEDCouplingFieldTemplate::getTinySerializationDbleInformation(std::vector& tinyInfo) const @@ -168,16 +168,16 @@ void MEDCouplingFieldTemplate::getTinySerializationStrInformation(std::vector& tinyInfoI, DataArrayInt *&dataInt) +void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt) { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !"); dataInt=0; - std::vector tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); + std::vector tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end()); _type->resizeForUnserialization(tinyInfoITmp,dataInt); } -void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { if(!((const MEDCouplingFieldDiscretization *)_type)) throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !"); @@ -187,7 +187,7 @@ void MEDCouplingFieldTemplate::finishUnserialization(const std::vector& tin _desc=tinyInfoS[1]; } -void MEDCouplingFieldTemplate::serialize(DataArrayInt *&dataInt) const +void MEDCouplingFieldTemplate::serialize(DataArrayIdType *&dataInt) const { _type->getSerializationIntArray(dataInt); } diff --git a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx index c5c0986f5..082dcc36a 100644 --- a/src/MEDCoupling/MEDCouplingFieldTemplate.hxx +++ b/src/MEDCoupling/MEDCouplingFieldTemplate.hxx @@ -56,12 +56,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT MCAuto clone(bool recDeepCpy) const; // - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + 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, DataArrayInt *&dataInt); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&dataInt) const; + MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfoI, DataArrayIdType *&dataInt); + 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; private: diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index f5af4895b..5572831ac 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -71,7 +71,7 @@ void MEDCouplingGaussLocalization::checkConsistencyLight() const int dim=cm.getDimension(); if(!cm.isDynamic()) { - if((int)_ref_coord.size()!=nbNodes*dim) + if(ToIdType(_ref_coord.size())!=nbNodes*dim) { std::ostringstream oss; oss << "Invalid size of refCoo : expecting to be : " << nbNodes << " (nbNodePerCell) * " << dim << " (dim) !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -160,9 +160,9 @@ double MEDCouplingGaussLocalization::getWeight(int gaussPtIdInCell, double newVa * push at the end of tinyInfo its basic serialization info. The size of pushed data is always the same. * @param tinyInfo inout parameter. */ -void MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector& tinyInfo) const +void MEDCouplingGaussLocalization::pushTinySerializationIntInfo(std::vector& tinyInfo) const { - tinyInfo.push_back((int)_type); + tinyInfo.push_back(ToIdType(_type)); tinyInfo.push_back(getNumberOfPtsInRefCell()); tinyInfo.push_back(getNumberOfGaussPt()); } @@ -212,23 +212,23 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach ptsInRefCoo->checkAllocated(); mesh->checkConsistencyLight(); // - int nbCells(mesh->getNumberOfCells()); + mcIdType nbCells=mesh->getNumberOfCells(); const double *coords(mesh->getCoords()->begin()); - const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin()); + const mcIdType *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin()); // - int nbPts(ptsInRefCoo->getNumberOfTuples()); + 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); double *retPtr(ret->getPointer()); - if(dim!=(int)ptsInRefCoo->getNumberOfComponents()) + if(dim!=ToIdType(ptsInRefCoo->getNumberOfComponents())) throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !"); const std::vector& wg(getWeights()); INTERP_KERNEL::GaussCoords calculator; calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell()); // - for(int i=0;i MEDCouplingGaussLocalization::buildRefCell() const { MCAuto coo(DataArrayDouble::New()); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getType())); - if(getDimension()!=(int)cm.getDimension()) + if(getDimension()!=ToIdType(cm.getDimension())) throw INTERP_KERNEL::Exception("BuildRefCell : dimension mistmatch !"); coo->alloc(cm.getNumberOfNodes(),getDimension()); std::copy(_ref_coord.begin(),_ref_coord.end(),coo->getPointer()); MCAuto ret(MEDCoupling1SGTUMesh::New("",getType())); ret->setCoords(coo); - MCAuto conn(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(cm.getNumberOfNodes(),1); conn->iota(); ret->setNodalConnectivity(conn); @@ -299,17 +299,17 @@ void MEDCouplingGaussLocalization::setWeights(const std::vector& w) /*! * The format of 'tinyData' parameter is the same than pushed in method MEDCouplingGaussLocalization::pushTinySerializationIntInfo. */ -MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(int dim, const std::vector& tinyData) +MEDCouplingGaussLocalization MEDCouplingGaussLocalization::BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector& tinyData) { std::vector v1(dim*tinyData[1]),v2(dim*tinyData[2]),v3(tinyData[2]); return MEDCouplingGaussLocalization((INTERP_KERNEL::NormalizedCellType)tinyData[0],v1,v2,v3); } -int MEDCouplingGaussLocalization::checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const +int MEDCouplingGaussLocalization::checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_type); int dim=cm.getDimension(); - int nbGsPts=getNumberOfGaussPt(); + 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) diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx index 6cd859599..b88702df6 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.hxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.hxx @@ -48,7 +48,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::size_t getMemorySize() const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT bool isEqual(const MEDCouplingGaussLocalization& other, double eps) const; - MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void pushTinySerializationIntInfo(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void pushTinySerializationDblInfo(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT const double *fillWithValues(const double *vals); // @@ -68,10 +68,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setGaussCoords(const std::vector& gsCoo); MEDCOUPLING_EXPORT void setWeights(const std::vector& w); // - MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(int dim, const std::vector& tinyData); + MEDCOUPLING_EXPORT static MEDCouplingGaussLocalization BuildNewInstanceFromTinyInfo(mcIdType dim, const std::vector& tinyData); MEDCOUPLING_EXPORT static bool AreAlmostEqual(const std::vector& v1, const std::vector& v2, double eps); private: - int checkCoherencyOfRequest(int gaussPtIdInCell, int comp) const; + int checkCoherencyOfRequest(mcIdType gaussPtIdInCell, int comp) const; private: INTERP_KERNEL::NormalizedCellType _type; std::vector _ref_coord; diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx old mode 100644 new mode 100755 index 73017d575..00d77cfa5 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -53,7 +53,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New() return new MEDCouplingIMesh; } -MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, +MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop) { MCAuto ret(new MEDCouplingIMesh); @@ -88,17 +88,17 @@ const DataArrayDouble *MEDCouplingIMesh::getDirectAccessOfCoordsArrIfInStructure * \return MEDCouplingIMesh * - a newly alloacted object to be managed by the caller. * \throw if \a ghostLev < 0. */ -MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const +MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(mcIdType ghostLev) const { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !"); checkConsistencyLight(); int spaceDim(getSpaceDimension()); double origin[3],dxyz[3]; - int structure[3]; + mcIdType structure[3]; for(int i=0;i(ghostLev)*_dxyz[i]; dxyz[i]=_dxyz[i]; structure[i]=_structure[i]+2*ghostLev; } @@ -107,26 +107,26 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const return ret.retn(); } -void MEDCouplingIMesh::setNodeStruct(const int *nodeStrctStart, const int *nodeStrctStop) +void MEDCouplingIMesh::setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop) { checkSpaceDimension(); - int sz((int)std::distance(nodeStrctStart,nodeStrctStop)); + mcIdType sz((mcIdType)std::distance(nodeStrctStart,nodeStrctStop)); if(sz!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::setNodeStruct : input vector of node structure has not the right size ! Or change space dimension before calling it !"); std::copy(nodeStrctStart,nodeStrctStop,_structure); declareAsNew(); } -std::vector MEDCouplingIMesh::getNodeStruct() const +std::vector MEDCouplingIMesh::getNodeStruct() const { checkSpaceDimension(); - return std::vector(_structure,_structure+_space_dim); + return std::vector(_structure,_structure+_space_dim); } void MEDCouplingIMesh::setOrigin(const double *originStart, const double *originStop) { checkSpaceDimension(); - int sz((int)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); @@ -142,7 +142,7 @@ std::vector MEDCouplingIMesh::getOrigin() const void MEDCouplingIMesh::setDXYZ(const double *dxyzStart, const double *dxyzStop) { checkSpaceDimension(); - int sz((int)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); @@ -214,12 +214,12 @@ MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const * The origin of \a this will be not touched only spacing and node structure will be changed. * This method can be useful for AMR users. */ -void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) +void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) { - if((int)factors.size()!=_space_dim) + if(ToIdType(factors.size())!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !"); checkConsistencyLight(); - std::vector structure(_structure,_structure+3); + std::vector structure(_structure,_structure+3); std::vector dxyz(_dxyz,_dxyz+3); for(int i=0;i<_space_dim;i++) { @@ -228,7 +228,7 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& 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()); } - int factAbs(std::abs(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]; @@ -248,14 +248,14 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const { checkConsistencyLight(); - int spaceDim(getSpaceDimension()),nodeSt[3]; + mcIdType spaceDim(getSpaceDimension()),nodeSt[3]; double dxyz[3]; for(int i=0;i=2) { nodeSt[i]=2; - dxyz[i]=(_structure[i]-1)*_dxyz[i]; + dxyz[i]=double(_structure[i]-1)*_dxyz[i]; } else { @@ -281,24 +281,25 @@ MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const * * \sa CondenseFineToCoarseGhost,SpreadCoarseToFine */ -void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) +void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) { if(coarseSt.size()!=fineLocInCoarse.size() || coarseSt.size()!=facts.size()) 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 !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + 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!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarse : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbTuplesFine(fineDA->getNumberOfTuples()); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()); if(nbOfTuplesInFineExp==0) { if(nbTuplesFine==0) @@ -308,7 +309,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } if(nbTuplesFine%nbOfTuplesInFineExp!=0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarse : Invalid nb of tuples in fine DataArray regarding its structure !"); - int 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 << "!"; @@ -318,16 +319,16 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co double *outPtr(coarseDA->getPointer()); const double *inPtr(fineDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); switch(meshDim) { case 1: { - int offset(fineLocInCoarse[0].first),fact0(facts[0]); + mcIdType offset(fineLocInCoarse[0].first),fact0(facts[0]); for(int i=0;i()); @@ -339,15 +340,15 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } case 2: { - int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact1(facts[1]),fact0(facts[0]); + mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first),fact1(facts[1]),fact0(facts[0]); for(int j=0;j()); @@ -362,19 +363,19 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co } case 3: { - int kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]); + mcIdType kk(fineLocInCoarse[0].first+coarseSt[0]*fineLocInCoarse[1].first+coarseSt[0]*coarseSt[1]*fineLocInCoarse[2].first),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]); for(int k=0;k()); @@ -408,7 +409,7 @@ void MEDCouplingIMesh::CondenseFineToCoarse(const std::vector& coarseSt, co * * \sa CondenseFineToCoarse,SpreadCoarseToFineGhost */ -void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize) +void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : ghost level has to be >= 0 !"); @@ -416,12 +417,13 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : All input vectors (dimension) must have the same size !"); 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::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + 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!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::CondenseFineToCoarseGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { @@ -429,10 +431,10 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::CondenseFineToCoarseGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -442,17 +444,17 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS double *outPtr(coarseDA->getPointer()); const double *inPtr(fineDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); switch(meshDim) { case 1: { - int offset(fineLocInCoarse[0].first+ghostSize),fact0(facts[0]); + mcIdType offset(fineLocInCoarse[0].first+ghostSize),fact0(facts[0]); inPtr+=ghostSize*nbCompo; for(int i=0;i()); @@ -464,18 +466,18 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS } case 2: { - int nxwg(coarseSt[0]+2*ghostSize); - int kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)),fact1(facts[1]),fact0(facts[0]); + 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()); @@ -491,24 +493,24 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS } case 3: { - int nxwg(coarseSt[0]+2*ghostSize),nxywg((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)); - int kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)+nxywg*(fineLocInCoarse[2].first+ghostSize)),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]); + mcIdType nxwg(coarseSt[0]+2*ghostSize),nxywg((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)); + mcIdType kk(fineLocInCoarse[0].first+ghostSize+nxwg*(fineLocInCoarse[1].first+ghostSize)+nxywg*(fineLocInCoarse[2].first+ghostSize)),fact2(facts[2]),fact1(facts[1]),fact0(facts[0]); inPtr+=(dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)*ghostSize*nbCompo; for(int k=0;k()); @@ -540,27 +542,28 @@ void MEDCouplingIMesh::CondenseFineToCoarseGhost(const std::vector& coarseS * \param [in] facts The refinement coefficient per axis. * \sa SpreadCoarseToFineGhost, CondenseFineToCoarse */ -void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts) +void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts) { if(coarseSt.size()!=fineLocInCoarse.size() || coarseSt.size()!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : All input vectors (dimension) must have the same size !"); if(!coarseDA || !coarseDA->isAllocated() || !fineDA || !fineDA->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the parameters 1 or 3 are NULL or not allocated !"); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::size_t meshDim(coarseSt.size()); + mcIdType nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseSt)),nbOfTuplesInFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(fineLocInCoarse)); + 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!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFine : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFine : Expecting " << nbOfTuplesInCoarseExp << " tuples having " << coarseDA->getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int 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 !"); - int 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 << "!"; @@ -570,31 +573,31 @@ void MEDCouplingIMesh::SpreadCoarseToFine(const DataArrayDouble *coarseDA, const double *outPtr(fineDA->getPointer()); const double *inPtr(coarseDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); switch(meshDim) { case 1: { - int offset(fineLocInCoarse[0].first),fact0(facts[0]); + mcIdType offset(fineLocInCoarse[0].first),fact0(facts[0]); for(int i=0;i& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : ghost level has to be >= 0 !"); @@ -651,12 +654,13 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : All input vectors (dimension) must have the same size !"); 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::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + 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!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhost : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { @@ -664,10 +668,10 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhost : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -681,19 +685,19 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, { case 1: { - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - int offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 ! - for(int i=0;i dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + mcIdType offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - int fact0(facts[0]),fact1(facts[1]),fact2(facts[2]); - int nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)); - int offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 ! - for(int i=0;i dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + mcIdType fact0(facts[0]),fact1(facts[1]),fact2(facts[2]); + mcIdType nxyWgCoarse((coarseSt[0]+2*ghostSize)*(coarseSt[1]+2*ghostSize)),nxyWgFine((dims[0]*fact0+2*ghostSize)*(dims[1]*fact1+2*ghostSize)); + mcIdType offset((fineLocInCoarse[2].first+ghostSize-1)*nxyWgCoarse);//offset is always >=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : ghost level has to be >= 0 !"); @@ -743,12 +747,13 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : All input vectors (dimension) must have the same size !"); 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::bind2nd(std::plus(),2*ghostSize)); - int meshDim((int)coarseSt.size()),nbOfTuplesInCoarseExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(coarseStG)); - int nbCompo(fineDA->getNumberOfComponents()); - if((int)coarseDA->getNumberOfComponents()!=nbCompo) + std::vector coarseStG(coarseSt.size()); std::transform(coarseSt.begin(),coarseSt.end(),coarseStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + 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!=(int)fineLocInCoarse.size() || meshDim!=(int)facts.size()) + if(meshDim!=fineLocInCoarse.size() || meshDim!=facts.size()) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::SpreadCoarseToFineGhostZone : the size of fineLocInCoarse (4th param) and facts (5th param) must be equal to the sier of coarseSt (2nd param) !"); if(coarseDA->getNumberOfTuples()!=nbOfTuplesInCoarseExp) { @@ -756,10 +761,10 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse throw INTERP_KERNEL::Exception(oss.str().c_str()); } // - std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); - std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); - int nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); + std::vector fineStG(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::transform(fineStG.begin(),fineStG.end(),facts.begin(),fineStG.begin(),std::multiplies()); + std::transform(fineStG.begin(),fineStG.end(),fineStG.begin(),std::bind2nd(std::plus(),2*ghostSize)); + mcIdType nbTuplesFine(fineDA->getNumberOfTuples()),nbTuplesFineExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(fineStG)); if(fineDA->getNumberOfTuples()!=nbTuplesFineExp) { std::ostringstream oss; oss << "MEDCouplingIMesh::SpreadCoarseToFineGhostZone : Expecting " << nbTuplesFineExp << " tuples in fine DataArray having " << nbTuplesFine << " !"; @@ -769,38 +774,38 @@ void MEDCouplingIMesh::SpreadCoarseToFineGhostZone(const DataArrayDouble *coarse double *outPtr(fineDA->getPointer()); const double *inPtr(coarseDA->begin()); // - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); switch(meshDim) { case 1: { - int offset(fineLocInCoarse[0].first+ghostSize-1),fact0(facts[0]);//offset is always >=0 thanks to the fact that ghostSize>=1 ! - for(int i=0;i=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i=0 thanks to the fact that ghostSize>=1 ! - for(int i=0;i=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType i=0;i MEDCouplingIMesh::getNodeGridStructure() const +std::vector MEDCouplingIMesh::getNodeGridStructure() const { checkSpaceDimension(); - std::vector ret(_structure,_structure+_space_dim); + std::vector ret(_structure,_structure+_space_dim); return ret; } -MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const +MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { checkConsistencyLight(); int dim(getSpaceDimension()); - if(dim!=(int)cellPart.size()) + if(dim!=ToIdType(cellPart.size())) { std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : the space dimension is " << dim << " and cell part size is " << cellPart.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } double retOrigin[3]={0.,0.,0.}; - int retStruct[3]={0,0,0}; + mcIdType retStruct[3]={0,0,0}; MCAuto ret(dynamic_cast(deepCopy())); 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] << ") !"; @@ -993,7 +998,7 @@ MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::v std::ostringstream oss; oss << "MEDCouplingIMesh::buildStructuredSubPart : Along dimension #" << i << " the number of nodes is " << _structure[i] << ", and you are requesting for " << myDelta << " nodes wide range !" << std::endl; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - retOrigin[i]=_origin[i]+startNode*_dxyz[i]; + retOrigin[i]=_origin[i]+FromIdType(startNode)*_dxyz[i]; retStruct[i]=myDelta; } ret->setNodeStruct(retStruct,retStruct+dim); @@ -1010,15 +1015,15 @@ int MEDCouplingIMesh::getSpaceDimension() const return _space_dim; } -void MEDCouplingIMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingIMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { - int tmp[3]; + mcIdType tmp[3]; int spaceDim(getSpaceDimension()); getSplitNodeValues(tmp); - int tmp2[3]; + mcIdType tmp2[3]; GetPosFromId(nodeId,spaceDim,tmp,tmp2); for(int j=0;j(tmp2[j])); } std::string MEDCouplingIMesh::simpleRepr() const @@ -1054,7 +1059,7 @@ void MEDCouplingIMesh::getBoundingBox(double *bbox) const for(int idim=0; idim1) coeff=_structure[idim]-1; - bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*coeff; + bbox[2*idim+1]=_origin[idim]+_dxyz[idim]*FromIdType(coeff); } } @@ -1082,7 +1087,7 @@ MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const checkConsistencyLight(); std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem(getNumberOfCells()); + std::size_t nbelem=getNumberOfCells(); MEDCouplingFieldDouble *field(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); field->setName(name); DataArrayDouble* array(DataArrayDouble::New()); @@ -1104,14 +1109,14 @@ MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureFieldOnNode(bool isAbs) cons //return 0; } -int MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const +mcIdType MEDCouplingIMesh::getCellContainingPoint(const double *pos, double eps) const { - int dim(getSpaceDimension()),ret(0),coeff(1); - for(int i=0;i=0 && tmp& elts) const +void MEDCouplingIMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - int ret(getCellContainingPoint(pos,eps)); + mcIdType ret(getCellContainingPoint(pos,eps)); elts.push_back(ret); } @@ -1182,17 +1187,18 @@ DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const { checkConsistencyLight(); MCAuto ret(DataArrayDouble::New()); - int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()); + mcIdType nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); ret->setInfoOnComponents(buildInfoOnComponents()); - int tmp2[3],tmp[3]; + mcIdType tmp2[3],tmp[3]; getSplitNodeValues(tmp); - for(int i=0;i(tmp2[j])+_origin[j]; } return ret.retn(); } @@ -1209,18 +1215,19 @@ DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { checkConsistencyLight(); MCAuto ret(DataArrayDouble::New()); - int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3]; + int spaceDim(getSpaceDimension()); + mcIdType nbCells(ToIdType(getNumberOfCells())),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; std::transform(_dxyz,_dxyz+spaceDim,shiftOrigin,std::bind2nd(std::multiplies(),0.5)); std::transform(_origin,_origin+spaceDim,shiftOrigin,shiftOrigin,std::plus()); getSplitCellValues(tmp); ret->setInfoOnComponents(buildInfoOnComponents()); - for(int i=0;i(tmp2[j])+shiftOrigin[j]; } return ret.retn(); } @@ -1230,12 +1237,12 @@ DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const return MEDCouplingIMesh::computeCellCenterOfMass(); } -void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCouplingIMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cell not available for IMesh !"); } -void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time(getTime(it,order)); @@ -1255,29 +1262,29 @@ void MEDCouplingIMesh::getTinySerializationInformation(std::vector& tiny tinyInfoD.insert(tinyInfoD.end(),_origin,_origin+3); } -void MEDCouplingIMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *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); } -void MEDCouplingIMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCouplingIMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { - a1=DataArrayInt::New(); + a1=DataArrayIdType::New(); a1->alloc(0,1); a2=DataArrayDouble::New(); a2->alloc(0,1); } -void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *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]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); setAxisUnit(littleStrings[3]); - setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]); - _space_dim=tinyInfo[2]; + setTime(tinyInfoD[0],FromIdType(tinyInfo[0]),FromIdType(tinyInfo[1])); + _space_dim=FromIdType(tinyInfo[2]); _structure[0]=tinyInfo[3]; _structure[1]=tinyInfo[4]; _structure[2]=tinyInfo[5]; _dxyz[0]=tinyInfoD[1]; _dxyz[1]=tinyInfoD[2]; _dxyz[2]=tinyInfoD[3]; _origin[0]=tinyInfoD[4]; _origin[1]=tinyInfoD[5]; _origin[2]=tinyInfoD[6]; @@ -1314,12 +1321,12 @@ void MEDCouplingIMesh::reprQuickOverview(std::ostream& stream) const return ; stream << "\n"; std::ostringstream stream0,stream1; - int nbNodes(1),nbCells(0); + mcIdType nbNodes(1),nbCells(0); bool isPb(false); for(int i=0;i<_space_dim;i++) { - char tmp('X'+i); - int 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; @@ -1358,7 +1365,7 @@ std::vector MEDCouplingIMesh::buildInfoOnComponents() const for(int i=0;i& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { double *outPtrWork(outPtr); - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - int nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]); - int kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 ! - for(int jg=0;jg dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + mcIdType nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]); + mcIdType kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType jg=0;jg= ghostlev - for(int i=0;i= ghostlev + for(mcIdType i=0;i& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize) +void MEDCouplingIMesh::SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { double *outPtr2(outPtr); - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); - int nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]); - int kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 ! - for(int jg=0;jg dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(fineLocInCoarse)); + mcIdType nxwg(coarseSt[0]+2*ghostSize),fact0(facts[0]),fact1(facts[1]); + mcIdType kk(fineLocInCoarse[0].first+ghostSize-1+nxwg*(fineLocInCoarse[1].first+ghostSize-1));//kk is always >=0 thanks to the fact that ghostSize>=1 ! + for(mcIdType jg=0;jg= ghostlev + mcIdType kk0(kk+1+dims[0]);//1 not ghost. We make the hypothesis that factors is >= ghostlev outPtr2+=fact0*nbCompo*dims[0]; - for(int ig=0;ig getNodeStruct() const; + MEDCOUPLING_EXPORT void setNodeStruct(const mcIdType *nodeStrctStart, const mcIdType *nodeStrctStop); + MEDCOUPLING_EXPORT std::vector getNodeStruct() const; MEDCOUPLING_EXPORT void setOrigin(const double *originStart, const double *originStop); MEDCOUPLING_EXPORT std::vector getOrigin() const; MEDCOUPLING_EXPORT void setDXYZ(const double *dxyzStart, const double *dxyzStop); @@ -46,18 +46,18 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getAxisUnit() const; MEDCOUPLING_EXPORT double getMeasureOfAnyCell() const; MEDCOUPLING_EXPORT MEDCouplingCMesh *convertToCartesian() const; - MEDCOUPLING_EXPORT void refineWithFactor(const std::vector& factors); + MEDCOUPLING_EXPORT void refineWithFactor(const std::vector& factors); MEDCOUPLING_EXPORT MEDCouplingIMesh *asSingleCell() const; - MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA); - MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize); - MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts); - MEDCOUPLING_EXPORT static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int 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, int ghostSize); + MEDCOUPLING_EXPORT static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA); + MEDCOUPLING_EXPORT static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize); + MEDCOUPLING_EXPORT static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts); + 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; MEDCOUPLING_EXPORT MEDCouplingIMesh *clone(bool recDeepCpy) const; MEDCOUPLING_EXPORT const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const; - MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(int ghostLev) const; + MEDCOUPLING_EXPORT MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const; MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -66,21 +66,21 @@ namespace MEDCoupling 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, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; + 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(int nodeId, std::vector& coo) 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; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) 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); @@ -88,16 +88,16 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); + MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true); //some useful methods - MEDCOUPLING_EXPORT void getNodeGridStructure(int *res) const; - MEDCOUPLING_EXPORT std::vector getNodeGridStructure() const; - MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const; + 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; @@ -112,8 +112,8 @@ namespace MEDCoupling void checkSpaceDimension() const; static void CheckSpaceDimension(int spaceDim); static int FindIntRoot(int val, int order); - static void SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); - static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, int nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, int ghostSize); + static void SpreadCoarseToFineGhost2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); + static void SpreadCoarseToFineGhostZone2D(const double *inPtr, double *outPtr, std::size_t nbCompo, const std::vector& coarseSt, const std::vector< std::pair >& fineLocInCoarse, const std::vector& facts, mcIdType ghostSize); private: int _space_dim; double _origin[3]; diff --git a/src/MEDCoupling/MEDCouplingMap.cxx b/src/MEDCoupling/MEDCouplingMap.cxx index afeabb2eb..d4534d3d0 100644 --- a/src/MEDCoupling/MEDCouplingMap.cxx +++ b/src/MEDCoupling/MEDCouplingMap.cxx @@ -22,4 +22,4 @@ using namespace MEDCoupling; -template class MEDCoupling::MapKeyVal; +template class MEDCoupling::MapKeyVal; diff --git a/src/MEDCoupling/MEDCouplingMap.hxx b/src/MEDCoupling/MEDCouplingMap.hxx index 68b084a77..395d56e49 100644 --- a/src/MEDCoupling/MEDCouplingMap.hxx +++ b/src/MEDCoupling/MEDCouplingMap.hxx @@ -23,6 +23,7 @@ #include "MEDCoupling.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MEDCouplingRefCountObject.hxx" #include "InterpKernelException.hxx" @@ -31,13 +32,13 @@ namespace MEDCoupling { - template + template class MapKeyVal : public RefCountObject, public TimeLabel { public: - static MCAuto< MapKeyVal > New(); - std::map& data() { return _m; } - const std::map& data() const { return _m; } + static MCAuto< MapKeyVal > New(); + std::map& data() { return _m; } + const std::map& data() const { return _m; } std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; void updateTime() const { } @@ -45,10 +46,10 @@ namespace MEDCoupling MapKeyVal() { } ~MapKeyVal() { } private: - std::map _m; + std::map _m; }; - using MapII = MapKeyVal; + using MapII = MapKeyVal; } #endif diff --git a/src/MEDCoupling/MEDCouplingMap.txx b/src/MEDCoupling/MEDCouplingMap.txx index 6248b4ee6..fb8f0cc88 100644 --- a/src/MEDCoupling/MEDCouplingMap.txx +++ b/src/MEDCoupling/MEDCouplingMap.txx @@ -25,21 +25,21 @@ namespace MEDCoupling { - template - MCAuto< MapKeyVal > MapKeyVal::New() + template + MCAuto< MapKeyVal > MapKeyVal::New() { - MCAuto< MapKeyVal > ret(new MapKeyVal); + MCAuto< MapKeyVal > ret(new MapKeyVal); return ret; } - template - std::size_t MapKeyVal::getHeapMemorySizeWithoutChildren() const + template + std::size_t MapKeyVal::getHeapMemorySizeWithoutChildren() const { - return _m.size()*sizeof(std::pair); + return _m.size()*sizeof(std::pair); } - template - std::vector MapKeyVal::getDirectChildrenWithNull() const + template + std::vector MapKeyVal::getDirectChildrenWithNull() const { return std::vector();//not a bug no child. Leaf object ! } diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index b39cd225e..429ec16c6 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -46,7 +46,7 @@ using namespace MEDCoupling; * because the mesh is aggregated and potentially modified by rotate or translate method. * @param cell2DId Id of cell in mesh2D mesh where the computation of 1D mesh will be done. */ -MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) +MEDCouplingMappedExtrudedMesh *MEDCouplingMappedExtrudedMesh::New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId) { return new MEDCouplingMappedExtrudedMesh(mesh3D,mesh2D,cell2DId); } @@ -98,7 +98,7 @@ void MEDCouplingMappedExtrudedMesh::copyTinyStringsFrom(const MEDCouplingMesh *o _mesh1D->copyTinyStringsFrom(otherC->_mesh1D); } -MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) +MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId) try:_mesh2D(const_cast(mesh2D)),_mesh1D(MEDCouplingUMesh::New()),_mesh3D_ids(0),_cell_2D_id(cell2DId) { if(_mesh2D.isNotNull()) @@ -146,12 +146,12 @@ MEDCouplingMappedExtrudedMesh::MEDCouplingMappedExtrudedMesh(const MEDCouplingMa } } -std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCells() const +mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCells() const { return _mesh2D->getNumberOfCells()*_mesh1D->getNumberOfCells(); } -int MEDCouplingMappedExtrudedMesh::getNumberOfNodes() const +mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfNodes() const { return _mesh2D->getNumberOfNodes(); } @@ -235,27 +235,27 @@ bool MEDCouplingMappedExtrudedMesh::isEqualWithoutConsideringStr(const MEDCoupli } void MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalWith : not implemented yet !"); } void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const + DataArrayIdType *&cellCor) const { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !"); } -INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(std::size_t cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(mcIdType cellId) const { - const int *ids(_mesh3D_ids->begin()); + const mcIdType *ids(_mesh3D_ids->begin()); std::size_t nbOf3DCells(_mesh3D_ids->getNumberOfTuples()); - const int *where(std::find(ids,ids+nbOf3DCells,cellId)); + const mcIdType *where(std::find(ids,ids+nbOf3DCells,cellId)); if(where==ids+nbOf3DCells) throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); std::size_t nbOfCells2D(_mesh2D->getNumberOfCells()); std::size_t locId((std::distance(ids,where))%nbOfCells2D); - INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(locId)); + INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(ToIdType(locId))); return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); } @@ -268,65 +268,65 @@ std::set MEDCouplingMappedExtrudedMesh::getAl return ret; } -DataArrayInt *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(type)); INTERP_KERNEL::NormalizedCellType revExtTyp(cm.getReverseExtrudedType()); - MCAuto ret(DataArrayInt::New()); + MCAuto ret(DataArrayIdType::New()); if(revExtTyp==INTERP_KERNEL::NORM_ERROR) { ret->alloc(0,1); return ret.retn(); } - MCAuto tmp(_mesh2D->giveCellsWithType(revExtTyp)); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - int nbOfTuples(tmp->getNumberOfTuples()); + MCAuto tmp(_mesh2D->giveCellsWithType(revExtTyp)); + mcIdType nbOfLevs=_mesh1D->getNumberOfCells(); + mcIdType nbOfCells2D=_mesh2D->getNumberOfCells(); + mcIdType nbOfTuples(tmp->getNumberOfTuples()); ret->alloc(nbOfLevs*nbOfTuples,1); - int *pt(ret->getPointer()); + mcIdType *pt(ret->getPointer()); for(int i=0;ibegin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); - MCAuto ret2(ret->renumberR(_mesh3D_ids->begin())); + std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus(),i*nbOfCells2D)); + MCAuto ret2(ret->renumberR(_mesh3D_ids->begin())); ret2->sort(); return ret2.retn(); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfNodesPerCell() const { - MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt(ret3D->getPointer()); + MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); + 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;ibegin(),ret2D->end(),pt); ret3D->applyLin(2,0,0); return ret3D->renumberR(_mesh3D_ids->begin()); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeNbOfFacesPerCell() const { - MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); - int nbOfLevs(_mesh1D->getNumberOfCells()); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - MCAuto ret3D(DataArrayInt::New()); ret3D->alloc(nbOfLevs*nbOfCells2D,1); - int *pt(ret3D->getPointer()); + MCAuto ret2D(_mesh2D->computeNbOfNodesPerCell()); + 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;ibegin(),ret2D->end(),pt); ret3D->applyLin(2,2,0); return ret3D->renumberR(_mesh3D_ids->begin()); } -DataArrayInt *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() const { return computeNbOfNodesPerCell(); } -std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - std::size_t ret(0); - std::size_t nbOfCells2D(_mesh2D->getNumberOfCells()); - for(std::size_t i=0;igetNumberOfCells()); + for(mcIdType i=0;igetTypeOfCell(i)); if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) @@ -335,26 +335,26 @@ std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNE return ret*_mesh1D->getNumberOfCells(); } -void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCouplingMappedExtrudedMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - int nbOfCells2D(_mesh2D->getNumberOfCells()); - int nbOfNodes2D(_mesh2D->getNumberOfNodes()); - int locId(cellId%nbOfCells2D); - int lev(cellId/nbOfCells2D); - std::vector tmp,tmp2; + 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; - std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); - std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); + std::transform(tmp.begin(),tmp.end(),tmp.begin(),std::bind2nd(std::plus(),nbOfNodes2D*lev)); + std::transform(tmp2.begin(),tmp2.end(),tmp2.begin(),std::bind2nd(std::plus(),nbOfNodes2D*(lev+1))); conn.insert(conn.end(),tmp.begin(),tmp.end()); conn.insert(conn.end(),tmp2.begin(),tmp2.end()); } -void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingMappedExtrudedMesh::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { - int nbOfNodes2D(_mesh2D->getNumberOfNodes()); - int locId(nodeId%nbOfNodes2D); - int 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; @@ -415,17 +415,17 @@ void MEDCouplingMappedExtrudedMesh::getBoundingBox(double *bbox) const double bbox2D[6]; _mesh2D->getBoundingBox(bbox2D); const double *nodes1D(_mesh1D->getCoords()->begin()); - int 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())); - for(int i=0;i(std::min)); std::transform(nodes1D+3*i,nodes1D+3*(i+1),bbox1DMax,bbox1DMax,static_cast(std::max)); } std::transform(bbox1DMax,bbox1DMax+3,bbox1DMin,tmp,std::minus()); - int id=(int)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]; @@ -440,7 +440,7 @@ void MEDCouplingMappedExtrudedMesh::updateTime() const updateTimeWith(*_mesh1D); } -void MEDCouplingMappedExtrudedMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCouplingMappedExtrudedMesh::renumberCells(const mcIdType *old2NewBg, bool check) { throw INTERP_KERNEL::Exception("Functionality of renumbering cells unavailable for ExtrudedMesh"); } @@ -454,7 +454,7 @@ MEDCouplingUMesh *MEDCouplingMappedExtrudedMesh::build3DUnstructuredMesh() const MCAuto mesh2DZC(_mesh2D->deepCopyConnectivityOnly()); mesh2DZC->zipCoords(); MCAuto ret(mesh2DZC->buildExtrudedMesh(_mesh1D,0)); - const int *renum(_mesh3D_ids->begin()); + const mcIdType *renum(_mesh3D_ids->begin()); ret->renumberCells(renum,false); ret->setName(getName()); return ret.retn(); @@ -476,16 +476,17 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::getMeasureField(bool) con MCAuto ret2D(_mesh2D->getMeasureField(true)),ret1D(_mesh1D->getMeasureField(true)); const double *ret2DPtr(ret2D->getArray()->begin()); const double *ret1DPtr(ret1D->getArray()->begin()); - int nbOf2DCells(_mesh2D->getNumberOfCells()),nbOf1DCells(_mesh1D->getNumberOfCells()),nbOf3DCells(nbOf2DCells*nbOf1DCells); - const int *renum(_mesh3D_ids->begin()); + mcIdType nbOf2DCells=_mesh2D->getNumberOfCells(), + nbOf1DCells=_mesh1D->getNumberOfCells(),nbOf3DCells(nbOf2DCells*nbOf1DCells); + const mcIdType *renum(_mesh3D_ids->begin()); MCAuto ret(MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME)); ret->setMesh(this); ret->synchronizeTimeWithMesh(); MCAuto da(DataArrayDouble::New()); da->alloc(nbOf3DCells,1); double *retPtr(da->getPointer()); - for(int i=0;isetArray(da); ret->setName(name); @@ -503,12 +504,12 @@ MEDCouplingFieldDouble *MEDCouplingMappedExtrudedMesh::buildOrthogonalField() co throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::buildOrthogonalField : This method has no sense for MEDCouplingMappedExtrudedMesh that is 3D !"); } -int 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 !"); } @@ -529,35 +530,35 @@ void MEDCouplingMappedExtrudedMesh::computeExtrusion(const MEDCouplingUMesh *mes if(mesh3D->getNumberOfCells()%_mesh2D->getNumberOfCells()!=0) throw INTERP_KERNEL::Exception(errMsg3); if(_mesh3D_ids.isNull()) - _mesh3D_ids=DataArrayInt::New(); + _mesh3D_ids=DataArrayIdType::New(); if(_mesh1D.isNull()) _mesh1D=MEDCouplingUMesh::New(); computeExtrusionAlg(mesh3D); } -void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, - const int *desc3D, const int *descIndx3D, - const int *revDesc3D, const int *revDescIndx3D, +void MEDCouplingMappedExtrudedMesh::build1DExtrusion(mcIdType idIn3DDesc, mcIdType newId, mcIdType nbOf1DLev, MEDCouplingUMesh *subMesh, + const mcIdType *desc3D, const mcIdType *descIndx3D, + const mcIdType *revDesc3D, const mcIdType *revDescIndx3D, bool computeMesh1D) { - int nbOf2DCells(_mesh2D->getNumberOfCells()); - int start(revDescIndx3D[idIn3DDesc]); - int end(revDescIndx3D[idIn3DDesc+1]); + mcIdType nbOf2DCells=_mesh2D->getNumberOfCells(); + mcIdType start(revDescIndx3D[idIn3DDesc]); + mcIdType end(revDescIndx3D[idIn3DDesc+1]); if(end-start!=1) { std::ostringstream ost; ost << "Invalid bases 2D mesh specified : 2D cell # " << idIn3DDesc; ost << " shared by more than 1 3D cell !!!"; throw INTERP_KERNEL::Exception(ost.str().c_str()); } - int current3DCell(revDesc3D[start]); - int current2DCell(idIn3DDesc); - int *mesh3DIDs(_mesh3D_ids->getPointer()); + mcIdType current3DCell(revDesc3D[start]); + mcIdType current2DCell(idIn3DDesc); + mcIdType *mesh3DIDs(_mesh3D_ids->getPointer()); mesh3DIDs[newId]=current3DCell; - const int *conn2D(subMesh->getNodalConnectivity()->begin()); - const int *conn2DIndx(subMesh->getNodalConnectivityIndex()->begin()); - for(int i=1;igetNodalConnectivity()->begin()); + const mcIdType *conn2DIndx(subMesh->getNodalConnectivityIndex()->begin()); + for(mcIdType i=1;i conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); std::sort(conn.begin(),conn.end()); if(computeMesh1D) computeBaryCenterOfFace(conn,i-1); @@ -579,7 +580,7 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, } if(computeMesh1D) { - std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); + std::vector conn(conn2D+conn2DIndx[current2DCell]+1,conn2D+conn2DIndx[current2DCell+1]); std::sort(conn.begin(),conn.end()); computeBaryCenterOfFace(conn,nbOf1DLev-1); current2DCell=findOppositeFaceOf(current2DCell,current3DCell,conn, @@ -591,22 +592,22 @@ void MEDCouplingMappedExtrudedMesh::build1DExtrusion(int idIn3DDesc, int newId, } } -int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx) +mcIdType MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector& connSorted, + const mcIdType *desc3D, const mcIdType *descIndx3D, + const mcIdType *conn2D, const mcIdType *conn2DIndx) { - int start(descIndx3D[current3DCell]); - int end(descIndx3D[current3DCell+1]); + mcIdType start(descIndx3D[current3DCell]); + mcIdType end(descIndx3D[current3DCell+1]); bool found=false; - for(const int *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++) + for(const mcIdType *candidate2D=desc3D+start;candidate2D!=desc3D+end && !found;candidate2D++) { if(*candidate2D!=current2DCell) { - std::vector conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); + std::vector conn2(conn2D+conn2DIndx[*candidate2D]+1,conn2D+conn2DIndx[*candidate2D+1]); std::sort(conn2.begin(),conn2.end()); - std::list intersect; + std::list intersect; std::set_intersection(connSorted.begin(),connSorted.end(),conn2.begin(),conn2.end(), - std::insert_iterator< std::list >(intersect,intersect.begin())); + std::insert_iterator< std::list >(intersect,intersect.begin())); if(intersect.empty()) return *candidate2D; } @@ -616,33 +617,33 @@ int MEDCouplingMappedExtrudedMesh::findOppositeFaceOf(int current2DCell, int cur throw INTERP_KERNEL::Exception(ost.str().c_str()); } -void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId) +void MEDCouplingMappedExtrudedMesh::computeBaryCenterOfFace(const std::vector& nodalConnec, mcIdType lev1DId) { double *zoneToUpdate(_mesh1D->getCoords()->getPointer()+lev1DId*3); std::fill(zoneToUpdate,zoneToUpdate+3,0.); const double *coords(_mesh2D->getCoords()->begin()); - for(std::vector::const_iterator iter=nodalConnec.begin();iter!=nodalConnec.end();iter++) + 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::bind2nd(std::multiplies(),(double)(1./(int)nodalConnec.size()))); + std::transform(zoneToUpdate,zoneToUpdate+3,zoneToUpdate,std::bind2nd(std::multiplies(),(1./(double)nodalConnec.size()))); } -int MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const int *revNodalPtr, const int *revNodalIndxPtr) +mcIdType MEDCouplingMappedExtrudedMesh::FindCorrespCellByNodalConn(const std::vector& nodalConnec, const mcIdType *revNodalPtr, const mcIdType *revNodalIndxPtr) { - std::vector::const_iterator iter=nodalConnec.begin(); - std::set s1(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1]); + 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 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())); + 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; } if(s1.size()==1) return *(s1.begin()); std::ostringstream ostr; ostr << "Cell with nodal connec : "; - std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator(ostr," ")); + std::copy(nodalConnec.begin(),nodalConnec.end(),std::ostream_iterator(ostr," ")); ostr << " is not part of mesh"; throw INTERP_KERNEL::Exception(ostr.str().c_str()); } @@ -669,7 +670,7 @@ void MEDCouplingMappedExtrudedMesh::Project1DMeshes(const MEDCouplingUMesh *m1, m2r=m2->clone(true); m1r->changeSpaceDimension(1); m2r->changeSpaceDimension(1); - std::vector c; + std::vector c; std::vector ref,ref2; m1->getNodeIdsOfCell(0,c); m1->getCoordinatesOfNode(c[0],ref); @@ -699,34 +700,34 @@ void MEDCouplingMappedExtrudedMesh::scale(const double *point, double factor) _mesh1D->scale(point,factor); } -std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const +std::vector MEDCouplingMappedExtrudedMesh::getDistributionOfTypes() const { throw INTERP_KERNEL::Exception("Not implemented yet !"); } -DataArrayInt *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 DataArrayInt *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 int *start, const int *end) const +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPart(const mcIdType *start, const mcIdType *end) const { // not implemented yet ! return 0; } -MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const +MEDCouplingMesh *MEDCouplingMappedExtrudedMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const { // not implemented yet ! return 0; } -DataArrayInt *MEDCouplingMappedExtrudedMesh::simplexize(int policy) +DataArrayIdType *MEDCouplingMappedExtrudedMesh::simplexize(int policy) { throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::simplexize : unavailable for such a type of mesh : Extruded !"); } @@ -743,18 +744,18 @@ DataArrayDouble *MEDCouplingMappedExtrudedMesh::getCoordinatesAndOwner() const const DataArrayDouble *arr1D(_mesh1D->getCoords()); MCAuto ret(DataArrayDouble::New()); ret->alloc(getNumberOfNodes(),3); - int nbOf1DLev(_mesh1D->getNumberOfNodes()); - int 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); - for(int i=1;ibegin()+3*i,arr1D->begin()+3*(i+1),vec); std::transform(arr1D->begin()+3*(i-1),arr1D->begin()+3*i,vec,vec,std::minus()); - for(int j=0;j()); } return ret.retn(); @@ -770,7 +771,7 @@ DataArrayDouble *MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCe throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !"); } -void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { MCAuto m(buildUnstructured()); m->getReverseNodalConnectivity(revNodal,revNodalIndx); @@ -779,11 +780,11 @@ void MEDCouplingMappedExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *re void MEDCouplingMappedExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) { _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); - int nbOf1DLev(mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells()); + mcIdType nbOf1DLev=mesh3D->getNumberOfCells()/_mesh2D->getNumberOfCells(); _mesh1D->setMeshDimension(1); _mesh1D->allocateCells(nbOf1DLev); - int tmpConn[2]; - for(int i=0;ialloc(nbOf1DLev+1,3); _mesh1D->setCoords(myCoords); myCoords->decrRef(); - MCAuto desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New()); MCAuto subMesh(mesh3D->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)); - MCAuto revNodal2D(DataArrayInt::New()),revNodalIndx2D(DataArrayInt::New()); + MCAuto revNodal2D(DataArrayIdType::New()),revNodalIndx2D(DataArrayIdType::New()); subMesh->getReverseNodalConnectivity(revNodal2D,revNodalIndx2D); - const int *nodal2D(_mesh2D->getNodalConnectivity()->begin()); - const int *nodal2DIndx(_mesh2D->getNodalConnectivityIndex()->begin()); - const int *revNodal2DPtr(revNodal2D->begin()); - const int *revNodalIndx2DPtr(revNodalIndx2D->begin()); - const int *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin()); + const mcIdType *nodal2D(_mesh2D->getNodalConnectivity()->begin()); + const mcIdType *nodal2DIndx(_mesh2D->getNodalConnectivityIndex()->begin()); + const mcIdType *revNodal2DPtr(revNodal2D->begin()); + const mcIdType *revNodalIndx2DPtr(revNodalIndx2D->begin()); + const mcIdType *descP(desc->begin()),*descIndxP(descIndx->begin()),*revDescP(revDesc->begin()),*revDescIndxP(revDescIndx->begin()); // - int nbOf2DCells(_mesh2D->getNumberOfCells()); - for(int i=0;igetNumberOfCells(); + for(mcIdType i=0;i nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); + mcIdType idInSubMesh; + std::vector nodalConnec(nodal2D+nodal2DIndx[i]+1,nodal2D+nodal2DIndx[i+1]); try { idInSubMesh=FindCorrespCellByNodalConn(nodalConnec,revNodal2DPtr,revNodalIndx2DPtr); @@ -823,13 +824,13 @@ 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 tinyInfo1; std::vector ls1; std::vector ls3; _mesh2D->getTinySerializationInformation(ls3,tinyInfo1,ls1); - std::vector tinyInfo2; + std::vector tinyInfo2; std::vector ls2; std::vector ls4; _mesh1D->getTinySerializationInformation(ls4,tinyInfo2,ls2); @@ -839,27 +840,27 @@ void MEDCouplingMappedExtrudedMesh::getTinySerializationInformation(std::vector< tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end()); littleStrings.insert(littleStrings.end(),ls2.begin(),ls2.end()); tinyInfo.push_back(_cell_2D_id); - tinyInfo.push_back((int)tinyInfo1.size()); + tinyInfo.push_back(ToIdType(tinyInfo1.size())); tinyInfo.push_back(_mesh3D_ids->getNbOfElems()); littleStrings.push_back(getName()); littleStrings.push_back(getDescription()); } -void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingMappedExtrudedMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { std::size_t sz=tinyInfo.size(); - int sz1=tinyInfo[sz-2]; - std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); + 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(); - DataArrayInt *a1tmp=DataArrayInt::New(); + DataArrayIdType *a1tmp=DataArrayIdType::New(); DataArrayDouble *a2tmp=DataArrayDouble::New(); - int la1=0,la2=0; + mcIdType la1=0,la2=0; std::vector ls1,ls2; um->resizeForUnserialization(ti1,a1tmp,a2tmp,ls1); la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); a1tmp->decrRef(); a2tmp->decrRef(); - a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); + a1tmp=DataArrayIdType::New(); a2tmp=DataArrayDouble::New(); um->resizeForUnserialization(ti2,a1tmp,a2tmp,ls2); la1+=a1tmp->getNbOfElems(); la2+=a2tmp->getNbOfElems(); a1tmp->decrRef(); a2tmp->decrRef(); @@ -870,15 +871,15 @@ 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); - int *ptri=a1->getPointer(); + mcIdType *ptri=a1->getPointer(); ptri=std::copy(a1_1->begin(),a1_1->begin()+a1_1->getNbOfElems(),ptri); a1_1->decrRef(); ptri=std::copy(a1_2->begin(),a1_2->begin()+a1_2->getNbOfElems(),ptri); @@ -892,18 +893,18 @@ void MEDCouplingMappedExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble a2_2->decrRef(); } -void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *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 sz=tinyInfo.size(); - int sz1=tinyInfo[sz-2]; + mcIdType sz1=tinyInfo[sz-2]; _cell_2D_id=tinyInfo[sz-3]; - std::vector ti1(tinyInfo.begin(),tinyInfo.begin()+sz1); - std::vector ti2(tinyInfo.begin()+sz1,tinyInfo.end()-3); - DataArrayInt *a1tmp=DataArrayInt::New(); + 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 int *a1Ptr=a1->begin(); + const mcIdType *a1Ptr=a1->begin(); const double *a2Ptr=a2->begin(); _mesh2D=MEDCouplingUMesh::New(); std::vector ls1,ls2; @@ -920,7 +921,7 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& t ls2.clear(); ls2.insert(ls2.end(),littleStrings.begin()+ls1.size(),littleStrings.end()-2); _mesh1D=MEDCouplingUMesh::New(); - a1tmp=DataArrayInt::New(); a2tmp=DataArrayDouble::New(); + a1tmp=DataArrayIdType::New(); a2tmp=DataArrayDouble::New(); _mesh1D->resizeForUnserialization(ti2,a1tmp,a2tmp,ls1); std::copy(a2Ptr,a2Ptr+a2tmp->getNbOfElems(),a2tmp->getPointer()); std::copy(a1Ptr,a1Ptr+a1tmp->getNbOfElems(),a1tmp->getPointer()); @@ -928,8 +929,8 @@ void MEDCouplingMappedExtrudedMesh::unserialization(const std::vector& t _mesh1D->unserialization(d1,ti2,a1tmp,a2tmp,ls2); a1tmp->decrRef(); a2tmp->decrRef(); // - _mesh3D_ids=DataArrayInt::New(); - int szIds=(int)std::distance(a1Ptr,a1->begin()+a1->getNbOfElems()); + _mesh3D_ids=DataArrayIdType::New(); + 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 ec5d5da9e..c2fcadd14 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -28,7 +28,7 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; class MEDCouplingUMesh; class MEDCouplingCMesh; @@ -37,15 +37,15 @@ namespace MEDCoupling class MEDCouplingMappedExtrudedMesh : public MEDCouplingMesh { public: - MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); + MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId); MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(const MEDCouplingCMesh *mesh3D); MEDCOUPLING_EXPORT static MEDCouplingMappedExtrudedMesh *New(); 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 std::size_t getNumberOfCells() const; - MEDCOUPLING_EXPORT int getNumberOfNodes() const; + 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; @@ -54,77 +54,77 @@ namespace MEDCoupling 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, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const; + DataArrayIdType *&cellCor) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const; MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const; - MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) 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 int *old2NewBg, bool check=true); + 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 DataArrayInt *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); } + MEDCOUPLING_EXPORT DataArrayIdType *getMesh3DIds() const { return _mesh3D_ids.iAmATrollConstCast(); } MEDCOUPLING_EXPORT MEDCouplingUMesh *build3DUnstructuredMesh() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const; - MEDCOUPLING_EXPORT static int FindCorrespCellByNodalConn(const std::vector& nodalConnec, - const int *revNodalPtr, const int *revNodalIndxPtr); + 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); MEDCOUPLING_EXPORT void translate(const double *vector); MEDCOUPLING_EXPORT void scale(const double *point, double factor); - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; - MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); + 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(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT std::string getVTKFileExtension() const; - MEDCOUPLING_EXPORT int get2DCellIdForExtrusion() const { return _cell_2D_id; } + MEDCOUPLING_EXPORT mcIdType get2DCellIdForExtrusion() const { return _cell_2D_id; } private: - MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId); + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId); MEDCouplingMappedExtrudedMesh(const MEDCouplingCMesh *mesh3D); MEDCouplingMappedExtrudedMesh(const MEDCouplingMappedExtrudedMesh& other, bool deepCpy); MEDCouplingMappedExtrudedMesh(); void computeExtrusion(const MEDCouplingUMesh *mesh3D); void computeExtrusionAlg(const MEDCouplingUMesh *mesh3D); - void build1DExtrusion(int idIn3DDesc, int newId, int nbOf1DLev, MEDCouplingUMesh *subMesh, - const int *desc3D, const int *descIndx3D, - const int *revDesc3D, const int *revDescIndx3D, + void build1DExtrusion(mcIdType idIn3DDesc, mcIdType newId, mcIdType nbOf1DLev, MEDCouplingUMesh *subMesh, + const mcIdType *desc3D, const mcIdType *descIndx3D, + const mcIdType *revDesc3D, const mcIdType *revDescIndx3D, bool computeMesh1D); - int findOppositeFaceOf(int current2DCell, int current3DCell, const std::vector& connSorted, - const int *desc3D, const int *descIndx3D, - const int *conn2D, const int *conn2DIndx); - void computeBaryCenterOfFace(const std::vector& nodalConnec, int lev1DId); + mcIdType findOppositeFaceOf(mcIdType current2DCell, mcIdType current3DCell, const std::vector& connSorted, + const mcIdType *desc3D, const mcIdType *descIndx3D, + const mcIdType *conn2D, const mcIdType *conn2DIndx); + void computeBaryCenterOfFace(const std::vector& nodalConnec, mcIdType lev1DId); ~MEDCouplingMappedExtrudedMesh(); void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const; std::string getVTKDataSetType() const; diff --git a/src/MEDCoupling/MEDCouplingMatrix.cxx b/src/MEDCoupling/MEDCouplingMatrix.cxx old mode 100644 new mode 100755 index 1045e260c..35b6e1e75 --- a/src/MEDCoupling/MEDCouplingMatrix.cxx +++ b/src/MEDCoupling/MEDCouplingMatrix.cxx @@ -26,12 +26,12 @@ using namespace MEDCoupling; -DenseMatrix *DenseMatrix::New(int nbRows, int nbCols) +DenseMatrix *DenseMatrix::New(mcIdType nbRows, mcIdType nbCols) { return new DenseMatrix(nbRows,nbCols); } -DenseMatrix *DenseMatrix::New(DataArrayDouble *array, int nbRows, int nbCols) +DenseMatrix *DenseMatrix::New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols) { return new DenseMatrix(array,nbRows,nbCols); } @@ -77,9 +77,9 @@ void DenseMatrix::updateTime() const * * \sa reShape */ -void DenseMatrix::reBuild(DataArrayDouble *array, int nbRows, int nbCols) +void DenseMatrix::reBuild(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols) { - int nbr(getNumberOfRowsExt(nbRows)),nbc(getNumberOfColsExt(nbCols)); + mcIdType nbr(getNumberOfRowsExt(nbRows)),nbc(getNumberOfColsExt(nbCols)); CheckArraySizes(array,nbr,nbc); DataArrayDouble *data(_data); if(data!=array) @@ -108,7 +108,7 @@ void DenseMatrix::reBuild(DataArrayDouble *array, int nbRows, int nbCols) * \throw if the \c nbRows*nbCols is not equal to \c this->getNbOfElems() * \sa reBuild */ -void DenseMatrix::reShape(int nbRows, int nbCols) +void DenseMatrix::reShape(mcIdType nbRows, mcIdType nbCols) { if(nbRows<0 || nbCols<0) throw INTERP_KERNEL::Exception("DenseMatrix::reShape : number of rows and number of cols must be > 0 both !"); @@ -225,7 +225,7 @@ DenseMatrix *DenseMatrix::Multiply(const DenseMatrix *a1, const DenseMatrix *a2) if(!a1 || !a2) throw INTERP_KERNEL::Exception("DenseMatrix::Multiply : input matrices must be not NULL !"); CheckCompatibleSizeForMul(a1,a2); - int nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols()); + mcIdType nbr(a1->getNumberOfRows()),nbc(a2->getNumberOfCols()); MCAuto data(DataArrayDouble::New()); data->alloc(nbr*nbc,1); MCAuto ret(DenseMatrix::New(data,a1->getNumberOfRows(),a2->getNumberOfCols())); INTERP_KERNEL::matrixProduct(a1->getData()->begin(),a1->getNumberOfRows(),a1->getNumberOfCols(),a2->getData()->begin(),a2->getNumberOfRows(),a2->getNumberOfCols(),data->getPointer()); @@ -246,21 +246,21 @@ DenseMatrix::~DenseMatrix() { } -DenseMatrix::DenseMatrix(int nbRows, int nbCols):_nb_rows(nbRows),_nb_cols(nbCols),_data(DataArrayDouble::New()) +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 !"); - int nbOfTuples(_nb_rows*_nb_cols); + mcIdType nbOfTuples(_nb_rows*_nb_cols); _data->alloc(nbOfTuples,1); } -DenseMatrix::DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols):_nb_rows(nbRows),_nb_cols(nbCols) +DenseMatrix::DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols):_nb_rows(nbRows),_nb_cols(nbCols) { CheckArraySizes(array,_nb_rows,_nb_cols); _data=array; _data->incrRef(); } -int DenseMatrix::getNumberOfRowsExt(int nbRows) const +mcIdType DenseMatrix::getNumberOfRowsExt(mcIdType nbRows) const { if(nbRows<-1) throw INTERP_KERNEL::Exception("DenseMatrix::getNumberOfRowsExt : invalid input must be >= -1 !"); @@ -270,7 +270,7 @@ int DenseMatrix::getNumberOfRowsExt(int nbRows) const return nbRows; } -int DenseMatrix::getNumberOfColsExt(int nbCols) const +mcIdType DenseMatrix::getNumberOfColsExt(mcIdType nbCols) const { if(nbCols<-1) throw INTERP_KERNEL::Exception("DenseMatrix::getNumberOfColsExt : invalid input must be >= -1 !"); @@ -290,7 +290,7 @@ void DenseMatrix::checkValidData() const throw INTERP_KERNEL::Exception("DenseMatrix::checkValidData : data has not 1 component !"); } -void DenseMatrix::CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols) +void DenseMatrix::CheckArraySizes(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols) { if(nbRows<0 || nbCols<0) throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : number of rows and number of cols must be > 0 both !"); @@ -298,8 +298,7 @@ void DenseMatrix::CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : input array is empty or not allocated !"); if(array->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : input array must have exactly one component !"); - std::size_t nbr((std::size_t)nbRows),nbc((std::size_t)nbCols); - if(nbr*nbc!=array->getNbOfElems()) + if(nbRows*nbCols!=array->getNbOfElems()) throw INTERP_KERNEL::Exception("constructor #2 of DenseMatrix : the number of elems in input array is not equal to the product of nbRows and nbCols !"); } diff --git a/src/MEDCoupling/MEDCouplingMatrix.hxx b/src/MEDCoupling/MEDCouplingMatrix.hxx index c62272be1..e999bf290 100644 --- a/src/MEDCoupling/MEDCouplingMatrix.hxx +++ b/src/MEDCoupling/MEDCouplingMatrix.hxx @@ -38,19 +38,19 @@ namespace MEDCoupling class DenseMatrix : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT static DenseMatrix *New(int nbRows, int nbCols); - MEDCOUPLING_EXPORT static DenseMatrix *New(DataArrayDouble *array, int nbRows, int nbCols); + MEDCOUPLING_EXPORT static DenseMatrix *New(mcIdType nbRows, mcIdType nbCols); + MEDCOUPLING_EXPORT static DenseMatrix *New(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols); MEDCOUPLING_EXPORT DenseMatrix *deepCopy() const; MEDCOUPLING_EXPORT DenseMatrix *shallowCpy() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void updateTime() const; // - MEDCOUPLING_EXPORT int getNumberOfRows() const { return _nb_rows; } - MEDCOUPLING_EXPORT int getNumberOfCols() const { return _nb_cols; } - MEDCOUPLING_EXPORT int getNbOfElems() const { return _nb_rows*_nb_cols; } - MEDCOUPLING_EXPORT void reBuild(DataArrayDouble *array, int nbRows=-1, int nbCols=-1); - MEDCOUPLING_EXPORT void reShape(int nbRows, int nbCols); + MEDCOUPLING_EXPORT mcIdType getNumberOfRows() const { return _nb_rows; } + MEDCOUPLING_EXPORT mcIdType getNumberOfCols() const { return _nb_cols; } + MEDCOUPLING_EXPORT mcIdType getNbOfElems() const { return _nb_rows*_nb_cols; } + MEDCOUPLING_EXPORT void reBuild(DataArrayDouble *array, mcIdType nbRows=-1, mcIdType nbCols=-1); + MEDCOUPLING_EXPORT void reShape(mcIdType nbRows, mcIdType nbCols); MEDCOUPLING_EXPORT void transpose(); // MEDCOUPLING_EXPORT bool isEqual(const DenseMatrix& other, double eps) const; @@ -68,17 +68,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *getData() { return _data; } private: ~DenseMatrix(); - DenseMatrix(int nbRows, int nbCols); - DenseMatrix(DataArrayDouble *array, int nbRows, int nbCols); - int getNumberOfRowsExt(int nbRows) const; - int getNumberOfColsExt(int nbCols) const; + DenseMatrix(mcIdType nbRows, mcIdType nbCols); + DenseMatrix(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols); + mcIdType getNumberOfRowsExt(mcIdType nbRows) const; + mcIdType getNumberOfColsExt(mcIdType nbCols) const; void checkValidData() const; - static void CheckArraySizes(DataArrayDouble *array, int nbRows, int nbCols); + static void CheckArraySizes(DataArrayDouble *array, mcIdType nbRows, mcIdType nbCols); static void CheckSameSize(const DenseMatrix *a1, const DenseMatrix *a2); static void CheckCompatibleSizeForMul(const DenseMatrix *a1, const DenseMatrix *a2); private: - int _nb_rows; - int _nb_cols; + mcIdType _nb_rows; + mcIdType _nb_cols; MCAuto _data; }; } diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx old mode 100644 new mode 100755 index 9e7408f26..50f19056d --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -42,39 +42,39 @@ typedef double (*MYFUNCPTR)(double); using namespace MEDCoupling; -template class MEDCoupling::MemArray; +template class MEDCoupling::MemArray; template class MEDCoupling::MemArray; -template class MEDCoupling::DataArrayTemplate; +template class MEDCoupling::DataArrayTemplate; template class MEDCoupling::DataArrayTemplate; -template class MEDCoupling::DataArrayTemplateClassic; +template class MEDCoupling::DataArrayTemplateClassic; template class MEDCoupling::DataArrayTemplateClassic; template class MEDCoupling::DataArrayTemplateFP; template class MEDCoupling::DataArrayIterator; -template class MEDCoupling::DataArrayIterator; +template class MEDCoupling::DataArrayIterator; template class MEDCoupling::DataArrayDiscrete; template class MEDCoupling::DataArrayDiscreteSigned; template class MEDCoupling::DataArrayDiscrete; template class MEDCoupling::DataArrayDiscreteSigned; -template class MEDCoupling::DataArrayTuple; +template class MEDCoupling::DataArrayTuple; template class MEDCoupling::DataArrayTuple; template class MEDCoupling::DataArrayTuple; -template -void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const +template +void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const { const double *coordsPtr=getConstPointer(); - BBTreePts myTree(bbox,0,0,nbNodes,prec); + BBTreePts myTree(bbox,0,0,nbNodes,prec); std::vector isDone(nbNodes); - for(int i=0;i intersectingElems; + std::vector intersectingElems; myTree.getElementsAroundPoint(coordsPtr+i*SPACEDIM,intersectingElems); if(intersectingElems.size()>1) { - std::vector commonNodes; - for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + std::vector commonNodes; + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) if(*it!=i) if(*it>=limitNodeId) { @@ -83,7 +83,7 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int l } if(!commonNodes.empty()) { - cI->pushBackSilent(cI->back()+(int)commonNodes.size()+1); + cI->pushBackSilent(cI->back()+ToIdType(commonNodes.size())+1); c->pushBackSilent(i); c->insertAtTheEnd(commonNodes.begin(),commonNodes.end()); } @@ -92,33 +92,33 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int l } } -template -void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, int nbOfTuples, double eps, - DataArrayInt *c, DataArrayInt *cI) +template +void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double eps, + DataArrayIdType *c, DataArrayIdType *cI) { - for(int i=0;i intersectingElems; + std::vector intersectingElems; myTree.getElementsAroundPoint(pos+i*SPACEDIM,intersectingElems); - std::vector commonNodes; - for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + std::vector commonNodes; + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) commonNodes.push_back(*it); - cI->pushBackSilent(cI->back()+(int)commonNodes.size()); + 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, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res) +template +void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res) { double distOpt(dist); const double *p(pos); - int *r(res); - for(int i=0;i::max()) { @@ -132,7 +132,7 @@ void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTre } } -int DataArray::EffectiveCircPerm(int nbOfShift, int nbOfTuples) +mcIdType DataArray::EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples) { if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArray::EffectiveCircPerm : number of tuples is expected to be > 0 !"); @@ -142,7 +142,7 @@ int DataArray::EffectiveCircPerm(int nbOfShift, int nbOfTuples) } else { - int tmp(-nbOfShift); + mcIdType tmp(-nbOfShift); tmp=tmp%nbOfTuples; return nbOfTuples-tmp; } @@ -191,9 +191,9 @@ void DataArray::copyStringInfoFrom(const DataArray& other) _info_on_compo=other._info_on_compo; } -void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) +void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds) { - int nbOfCompoOth=other.getNumberOfComponents(); + std::size_t nbOfCompoOth=other.getNumberOfComponents(); std::size_t newNbOfCompo=compoIds.size(); for(std::size_t i=0;i=nbOfCompoOth || compoIds[i]<0) @@ -202,23 +202,23 @@ void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vect throw INTERP_KERNEL::Exception(oss.str().c_str()); } for(std::size_t i=0;i& compoIds, const DataArray& other) +void DataArray::copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other) { - std::size_t nbOfCompo(getNumberOfComponents()); - std::size_t partOfCompoToSet=compoIds.size(); - if(partOfCompoToSet!=other.getNumberOfComponents()) + 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 partOfCompoToSet=compoIds.size(); + std::size_t nbOfCompo=getNumberOfComponents(); for(std::size_t i=0;i=(int)nbOfCompo || compoIds[i]<0) + if(compoIds[i]>=nbOfCompo || compoIds[i]<0) { std::ostringstream oss; oss << "Specified component id is out of range (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } for(std::size_t i=0;i& info) * * \sa DataArrayDouble::setPartOfValues3, DataArrayInt::setPartOfValues3, DataArrayChar::setPartOfValues3. */ -void DataArray::setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) +void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!aBase) throw INTERP_KERNEL::Exception("DataArray::setPartOfValuesBase3 : input aBase object is NULL !"); DataArrayDouble *this1(dynamic_cast(this)); - DataArrayInt *this2(dynamic_cast(this)); + DataArrayIdType *this2(dynamic_cast(this)); DataArrayChar *this3(dynamic_cast(this)); const DataArrayDouble *a1(dynamic_cast(aBase)); - const DataArrayInt *a2(dynamic_cast(aBase)); + const DataArrayIdType *a2(dynamic_cast(aBase)); const DataArrayChar *a3(dynamic_cast(aBase)); if(this1 && a1) { @@ -330,18 +330,18 @@ void DataArray::setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples std::vector DataArray::getVarsOnComponent() const { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); - for(int i=0;i DataArray::getUnitsOnComponent() const { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); std::vector ret(nbOfCompo); - for(int i=0;i DataArray::getUnitsOnComponent() const * \return std::string - a string containing the information on \a i-th component. * \throw If \a i is not a valid component index. */ -std::string DataArray::getInfoOnComponent(int i) const +std::string DataArray::getInfoOnComponent(std::size_t i) const { - if(i<(int)_info_on_compo.size() && i>=0) + if(i<_info_on_compo.size()) return _info_on_compo[i]; else { - std::ostringstream oss; oss << "DataArray::getInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size(); + std::ostringstream oss; oss << "DataArray::getInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -377,15 +377,15 @@ std::string DataArray::getInfoOnComponent(int i) const * \return std::string - a string containing the var information, or the full info. * \throw If \a i is not a valid component index. */ -std::string DataArray::getVarOnComponent(int i) const +std::string DataArray::getVarOnComponent(std::size_t i) const { - if(i<(int)_info_on_compo.size() && i>=0) + if(i<_info_on_compo.size()) { return GetVarNameFromInfo(_info_on_compo[i]); } else { - std::ostringstream oss; oss << "DataArray::getVarOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size(); + std::ostringstream oss; oss << "DataArray::getVarOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -402,15 +402,15 @@ std::string DataArray::getVarOnComponent(int i) const * \return std::string - a string containing the unit information, if any, or "". * \throw If \a i is not a valid component index. */ -std::string DataArray::getUnitOnComponent(int i) const +std::string DataArray::getUnitOnComponent(std::size_t i) const { - if(i<(int)_info_on_compo.size() && i>=0) + if(i<_info_on_compo.size()) { return GetUnitFromInfo(_info_on_compo[i]); } else { - std::ostringstream oss; oss << "DataArray::getUnitOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size(); + std::ostringstream oss; oss << "DataArray::getUnitOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -510,14 +510,14 @@ DataArray *DataArray::Aggregate(const std::vector& arrs) if(arr2.empty()) throw INTERP_KERNEL::Exception("DataArray::Aggregate : only null instance in input vector !"); std::vector arrd; - std::vector arri; + std::vector arri; std::vector arrc; for(std::vector::const_iterator it=arr2.begin();it!=arr2.end();it++) { const DataArrayDouble *a=dynamic_cast(*it); if(a) { arrd.push_back(a); continue; } - const DataArrayInt *b=dynamic_cast(*it); + const DataArrayIdType *b=dynamic_cast(*it); if(b) { arri.push_back(b); continue; } const DataArrayChar *c=dynamic_cast(*it); @@ -528,7 +528,7 @@ DataArray *DataArray::Aggregate(const std::vector& arrs) if(arr2.size()==arrd.size()) return DataArrayDouble::Aggregate(arrd); if(arr2.size()==arri.size()) - return DataArrayInt::Aggregate(arri); + return DataArrayIdType::Aggregate(arri); if(arr2.size()==arrc.size()) return DataArrayChar::Aggregate(arrc); throw INTERP_KERNEL::Exception("DataArray::Aggregate : all input arrays must have the same type !"); @@ -543,13 +543,13 @@ DataArray *DataArray::Aggregate(const std::vector& arrs) * \param [in] info - the string containing the information. * \throw If \a i is not a valid component index. */ -void DataArray::setInfoOnComponent(int i, const std::string& info) +void DataArray::setInfoOnComponent(std::size_t i, const std::string& info) { - if(i<(int)_info_on_compo.size() && i>=0) + if(i<_info_on_compo.size()) _info_on_compo[i]=info; else { - std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size(); + std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << _info_on_compo.size(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -581,25 +581,25 @@ void DataArray::setInfoAndChangeNbOfCompo(const std::vector& info) _info_on_compo=info; } -void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const +void DataArray::checkNbOfTuples(mcIdType nbOfTuples, const std::string& msg) const { - if((int)getNumberOfTuples()!=nbOfTuples) + if(getNumberOfTuples()!=nbOfTuples) { std::ostringstream oss; oss << msg << " : mismatch number of tuples : expected " << nbOfTuples << " having " << getNumberOfTuples() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } -void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const +void DataArray::checkNbOfComps(std::size_t nbOfCompo, const std::string& msg) const { - if((int)getNumberOfComponents()!=nbOfCompo) + if (getNumberOfComponents()!=nbOfCompo) { std::ostringstream oss; oss << msg << " : mismatch number of components : expected " << nbOfCompo << " having " << getNumberOfComponents() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } -void DataArray::checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const +void DataArray::checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const { if(getNbOfElems()!=nbOfElems) { @@ -622,7 +622,7 @@ void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const std::string } } -void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const +void DataArray::checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const { checkNbOfTuples(nbOfTuples,msg); checkNbOfComps(nbOfCompo,msg); @@ -631,7 +631,7 @@ void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std: /*! * Simply this method checks that \b value is in [0,\b ref). */ -void DataArray::CheckValueInRange(int ref, int value, const std::string& msg) +void DataArray::CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg) { if(value<0 || value>=ref) { @@ -644,7 +644,7 @@ void DataArray::CheckValueInRange(int ref, int value, const std::string& msg) * This method checks that [\b start, \b end) is compliant with ref length \b value. * typically start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported. */ -void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg) +void DataArray::CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg) { if(start<0 || start>=value) { @@ -661,7 +661,7 @@ void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::st } } -void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg) +void DataArray::CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg) { if(value<0 || value>ref) { @@ -688,95 +688,24 @@ void DataArray::CheckClosingParInRange(int ref, int value, const std::string& ms * \throw If \a nbOfSlices not > 0 * \throw If \a sliceId not in [0,nbOfSlices) */ -void DataArray::GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice) +void DataArray::GetSlice(mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType& startSlice, mcIdType& stopSlice) { - if(nbOfSlices<=0) - { - std::ostringstream oss; oss << "DataArray::GetSlice : nbOfSlices (" << nbOfSlices << ") must be > 0 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if(sliceId<0 || sliceId>=nbOfSlices) - { - std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - int nbElems=GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice"); - int minNbOfElemsPerSlice=nbElems/nbOfSlices; - startSlice=start+minNbOfElemsPerSlice*step*sliceId; - if(sliceId::GetSlice(start, stop, step, sliceId, nbOfSlices, startSlice, stopSlice); } -int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) +mcIdType DataArray::GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg) { - if(end 0 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - return (end-1-begin)/step+1; + return DataArrayTools::GetNumberOfItemGivenBES(begin, end, step, msg); } -int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) +mcIdType DataArray::GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg) { - if(step==0) - throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !"); - if(end0) - { - std::ostringstream oss; oss << msg << " : end before begin whereas step is positive !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if(begin 0 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if(begin!=end) - return (std::max(begin,end)-1-std::min(begin,end))/std::abs(step)+1; - else - return 0; + return DataArrayTools::GetNumberOfItemGivenBESRelative(begin, end, step, msg); } -int DataArray::GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) +mcIdType DataArray::GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step) { - if(step!=0) - { - if(step>0) - { - if(begin<=value && value=value && value>end) - { - if((begin-value)%(-step)==0) - return (begin-value)/(-step); - else - return -1; - } - else - return -1; - } - } - else - return -1; + return DataArrayTools::GetPosOfItemGivenBESRelativeNoThrow(value, begin, end, step); } /*! @@ -858,7 +787,7 @@ 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 !"); - int nbOfElements=getNumberOfTuples(); + mcIdType nbOfElements(getNumberOfTuples()); const double *ptr=getConstPointer(); if(nbOfElements==0) return true; @@ -866,7 +795,7 @@ bool DataArrayDouble::isMonotonic(bool increasing, double eps) const double absEps=fabs(eps); if(increasing) { - for(int i=1;i(ref-absEps)) return false; @@ -886,7 +815,7 @@ bool DataArrayDouble::isMonotonic(bool increasing, double eps) const } } -void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const +void DataArrayDouble::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; checkAllocated(); @@ -925,7 +854,8 @@ void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents()); + mcIdType nbTuples=getNumberOfTuples(); + std::size_t nbComp=getNumberOfComponents(); const double *data(getConstPointer()); stream.precision(17); stream << "DataArrayDouble *" << varName << "=DataArrayDouble::New();" << std::endl; @@ -953,7 +883,7 @@ void DataArrayDouble::reprQuickOverview(std::ostream& stream) const std::size_t nbOfCompo(_info_on_compo.size()); if(nbOfCompo>=1) { - std::size_t nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -967,18 +897,18 @@ void DataArrayDouble::reprQuickOverview(std::ostream& stream) const void DataArrayDouble::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const double *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_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()); bool isFinished=true; - for(int i=0;i1) { oss2 << "("; - for(int j=0;jgetNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !"); MCAuto a=DataArrayDouble::Aggregate(this,other); - DataArrayInt *c=0,*ci=0; + DataArrayIdType *c=0,*ci=0; a->findCommonTuples(prec,getNumberOfTuples(),c,ci); - MCAuto cSafe(c),ciSafe(ci); - int newNbOfTuples=-1; - MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); - MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); + MCAuto cSafe(c),ciSafe(ci); + mcIdType newNbOfTuples=-1; + MCAuto ids=DataArrayIdType::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); + MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); tupleIds=ret1.retn(); return newNbOfTuples==getNumberOfTuples(); } @@ -1102,16 +1032,16 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, * \endif * \sa DataArrayInt::ConvertIndexArrayToO2N(), DataArrayDouble::areIncludedInMe */ -void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const +void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const { checkAllocated(); - int 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."); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples(getNumberOfTuples()); // - MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0); + MCAuto c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(0,1); cI->pushBackSilent(0); switch(nbOfCompo) { case 4: @@ -1143,18 +1073,18 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI * \return the minimal distance between the two set of points \a this and \a other. * \sa DataArrayDouble::findClosestTupleId */ -double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const +double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const { - MCAuto part1=findClosestTupleId(other); - int nbOfCompo(getNumberOfComponents()); - int otherNbTuples(other->getNumberOfTuples()); + MCAuto part1=findClosestTupleId(other); + std::size_t nbOfCompo=getNumberOfComponents(); + mcIdType otherNbTuples=other->getNumberOfTuples(); const double *thisPt(begin()),*otherPt(other->begin()); - const int *part1Pt(part1->begin()); + const mcIdType *part1Pt(part1->begin()); double ret=std::numeric_limits::max(); - for(int i=0;igetNumberOfTuples() tuples and one components. * \sa DataArrayDouble::minimalDistanceTo */ -DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const +DataArrayIdType *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !"); @@ -1182,9 +1112,9 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) oss << ", whereas number of components in other is " << other->getNumberOfComponents() << "! Should be equal !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int nbOfTuples=other->getNumberOfTuples(); - int thisNbOfTuples=getNumberOfTuples(); - MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); + mcIdType nbOfTuples(other->getNumberOfTuples()); + mcIdType thisNbOfTuples(getNumberOfTuples()); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); double bounds[6]; getMinMaxPerComponent(bounds); switch(nbOfCompo) @@ -1194,7 +1124,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) 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 characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.); - BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + 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; } @@ -1203,14 +1133,14 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])); double delta=std::max(xDelta,yDelta); double characSize=sqrt(delta/(double)thisNbOfTuples); - BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + 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 characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples; - BBTreePts<1,int> myTree(begin(),0,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; } @@ -1232,13 +1162,14 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) * \throw If \a this and \a otherBBoxFrmt have not the same number of components. * \throw If \a this and \a otherBBoxFrmt number of components is not even (BBox format). */ -DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const +DataArrayIdType *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const { if(!otherBBoxFrmt) 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 nbOfComp(getNumberOfComponents()),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() << ") !"; @@ -1249,29 +1180,29 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : Number of components (" << nbOfComp << ") is not even ! It should be to be compatible with bbox format !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfTuples,1); const double *thisBBPtr(begin()); - int *retPtr(ret->getPointer()); + mcIdType *retPtr(ret->getPointer()); switch(nbOfComp/2) { case 3: { - BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); - for(std::size_t i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); - for(std::size_t i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); - for(std::size_t i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + for(mcIdType i=0;i c(c0),cI(cI0); - int newNbOfTuples=-1; - MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); + MCAuto c(c0),cI(cI0); + mcIdType newNbOfTuples=-1; + MCAuto o2n=DataArrayIdType::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples); } @@ -1328,22 +1259,21 @@ DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTuple * \ref py_mcdataarraydouble_setselectedcomponents "Here is a Python example". * \endif */ -void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds) +void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds) { if(!a) throw INTERP_KERNEL::Exception("DataArrayDouble::setSelectedComponents : input DataArrayDouble is NULL !"); checkAllocated(); copyPartOfStringInfoFrom2(compoIds,*a); std::size_t partOfCompoSz=compoIds.size(); - int nbOfCompo=getNumberOfComponents(); - int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); + std::size_t nbOfCompo=getNumberOfComponents(); + mcIdType nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); const double *ac=a->getConstPointer(); double *nc=getPointer(); - for(int i=0;i::max(); bounds[idim*2+1]=-std::numeric_limits::max(); } const double *ptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;iptr[i*dim+idim]) { @@ -1410,14 +1340,14 @@ DataArrayDouble *DataArrayDouble::computeBBoxPerTuple(double epsilon) const { checkAllocated(); const double *dataPtr=getConstPointer(); - int nbOfCompo=getNumberOfComponents(); - int nbTuples=getNumberOfTuples(); + std::size_t nbOfCompo=getNumberOfComponents(); + mcIdType nbTuples=getNumberOfTuples(); MCAuto bbox=DataArrayDouble::New(); bbox->alloc(nbTuples,2*nbOfCompo); double *bboxPtr=bbox->getPointer(); - for(int i=0;icheckAllocated(); - int nbOfCompo=getNumberOfComponents(); - int 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 !"); - int nbOfTuplesOther=other->getNumberOfTuples(); - MCAuto cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); + 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,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<3,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 2: { - BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<2,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 1: { - BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),eps); + BBTreePts<1,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } @@ -1491,10 +1422,10 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do void DataArrayDouble::recenterForMaxPrecision(double eps) { checkAllocated(); - int dim=getNumberOfComponents(); + std::size_t dim=getNumberOfComponents(); std::vector bounds(2*dim); getMinMaxPerComponent(&bounds[0]); - for(int i=0;igetNumberOfComponents() != 1 * \throw If \a this->getNumberOfTuples() < 1 */ -double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const +double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const { - int tmp; + mcIdType tmp; tupleIds=0; double ret=getMaxValue(tmp); tupleIds=findIdsInRange(ret,ret); @@ -1532,9 +1463,9 @@ double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const * \throw If \a this->getNumberOfComponents() != 1 * \throw If \a this->getNumberOfTuples() < 1 */ -double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const +double DataArrayDouble::getMinValue2(DataArrayIdType*& tupleIds) const { - int tmp; + mcIdType tmp; tupleIds=0; double ret=getMinValue(tmp); tupleIds=findIdsInRange(ret,ret); @@ -1550,15 +1481,15 @@ double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const * \throw If \a this is not allocated * */ -int DataArrayDouble::count(double value, double eps) const +mcIdType DataArrayDouble::count(double value, double eps) const { - int ret=0; + mcIdType ret=0; checkAllocated(); 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(); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i 0 !"); const double *vals=getConstPointer(); double ret=std::accumulate(vals,vals+nbOfTuples,0.); - return ret/nbOfTuples; + return ret/FromIdType(nbOfTuples); } /*! @@ -1632,12 +1563,12 @@ double DataArrayDouble::normMax() const void DataArrayDouble::normMaxPerComponent(double * res) const { checkAllocated(); - std::size_t nbOfTuples(getNumberOfTuples()); - int nbOfCompos(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t nbOfCompos(getNumberOfComponents()); std::fill(res, res+nbOfCompos, -1.0); const double *pt(getConstPointer()); - for(std::size_t i=0;ires[j]) @@ -1680,10 +1611,10 @@ void DataArrayDouble::accumulate(double *res) const { checkAllocated(); const double *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); + mcIdType nbTuple(getNumberOfTuples()); + std::size_t nbComps(getNumberOfComponents()); std::fill(res,res+nbComps,0.); - for(int i=0;i()); } @@ -1701,22 +1632,22 @@ void DataArrayDouble::accumulate(double *res) const * \return the min distance. * \sa MEDCouplingUMesh::distanceToPoint */ -double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const +double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const { checkAllocated(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); - if(nbComps!=(int)std::distance(tupleBg,tupleEnd)) + 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) throw INTERP_KERNEL::Exception("DataArrayDouble::distanceToTuple : no tuple in this ! No distance to compute !"); double ret0=std::numeric_limits::max(); tupleId=-1; const double *work=getConstPointer(); - for(int i=0;i=ret0) continue; @@ -1734,16 +1665,16 @@ double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tup * \throw If \a the condition ( 0 <= \a compId < \a this->getNumberOfComponents() ) is * not respected. */ -double DataArrayDouble::accumulate(int compId) const +double DataArrayDouble::accumulate(std::size_t compId) const { checkAllocated(); const double *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); - if(compId<0 || compId>=nbComps) + 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.; - for(int i=0;igetNumberOfTuples). * \throw If std::distance(bgOfIndex,endOfIndex)==0. */ -DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const +DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const { if(!bgOfIndex || !endOfIndex) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !"); checkAllocated(); - int nbCompo=getNumberOfComponents(); - int nbOfTuples=getNumberOfTuples(); - int sz=(int)std::distance(bgOfIndex,endOfIndex); + 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 !"); sz--; MCAuto ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo); - const int *w=bgOfIndex; + const mcIdType *w=bgOfIndex; if(*w<0 || *w>=nbOfTuples) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); const double *srcPt=begin()+(*w)*nbCompo; double *tmp=ret->getPointer(); - for(int i=0;i=w[0]) { - for(int j=w[0];j=0 && j()); @@ -1819,12 +1750,12 @@ MCAuto DataArrayDouble::cumSum() const { checkAllocated(); checkNbOfComps(1,"DataArrayDouble::cumSum : this is expected to be single component"); - int nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfTuple+1,1); double *ptr(ret->getPointer()); ptr[0]=0.; const double *thisPtr(begin()); - for(int i=0;i DataArrayDouble::cumSum() const DataArrayDouble *DataArrayDouble::fromPolarToCart() const { checkAllocated(); - int nbOfComp(getNumberOfComponents()); + std::size_t nbOfComp(getNumberOfComponents()); if(nbOfComp!=2) throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !"); - int nbOfTuple(getNumberOfTuples()); + mcIdType nbOfTuple(getNumberOfTuples()); DataArrayDouble *ret(DataArrayDouble::New()); ret->alloc(nbOfTuple,2); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;ialloc(getNumberOfTuples(),3); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;ialloc(getNumberOfTuples(),3); double *w(ret->getPointer()); const double *wIn(getConstPointer()); - for(int i=0;i ret; switch(atOfThis) { @@ -1983,13 +1914,14 @@ DataArrayDouble *DataArrayDouble::fromCartToPolar() const { MCAuto ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),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); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;i ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),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); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;i ret(DataArrayDouble::New()); checkAllocated(); - int nbOfComp(getNumberOfComponents()),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); double *retPtr(ret->getPointer()); const double *ptr(begin()); - for(int i=0;i ret(DataArrayDouble::New()); checkAllocated(); coords->checkAllocated(); - std::size_t nbOfComp(getNumberOfComponents()),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) @@ -2069,7 +2004,7 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor double Ur[3],Uteta[3],Uz[3],*retPtr(ret->getPointer()); const double *coo(coords->begin()),*vectField(begin()); std::transform(vect,vect+3,Uz,std::bind2nd(std::multiplies(),1./magOfVect)); - for(int i=0;i()); 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]; @@ -2096,15 +2031,15 @@ DataArrayDouble *DataArrayDouble::fromCartToCylGiven(const DataArrayDouble *coor DataArrayDouble *DataArrayDouble::doublyContractedProduct() const { checkAllocated(); - int 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(); - int nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple=getNumberOfTuples(); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); switch(getNumberOfComponents()) { case 6: - for(int i=0;ialloc(nbOfTuple,3); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,9); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,nbOfComp); const double *src=getConstPointer(); double *dest=ret->getPointer(); if(nbOfComp==6) - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); if(nbOfComp==6) - for(int i=0;ialloc(nbOfTuple,6); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;ialloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;i ret=DataArrayDouble::New(); - int nbOfTuple=getNumberOfTuples(); + mcIdType nbOfTuple(getNumberOfTuples()); ret->alloc(nbOfTuple,1); const double *src=getConstPointer(); double *dest=ret->getPointer(); - for(int i=0;i ret0=DataArrayDouble::New(); - MCAuto ret1=DataArrayInt::New(); - int nbOfTuple=getNumberOfTuples(); + MCAuto ret1=DataArrayIdType::New(); + mcIdType nbOfTuple=getNumberOfTuples(); ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1); const double *src=getConstPointer(); - double *dest=ret0->getPointer(); int *dest1=ret1->getPointer(); - for(int i=0;igetPointer(); mcIdType *dest1=ret1->getPointer(); + for(mcIdType i=0;i ret=DataArrayDouble::New(); ret->alloc(nbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); - for(int i=0;icheckAllocated(); - int nbOfComp=getNumberOfComponents(); - int 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()); } - int nbOfTuples=getNumberOfTuples(); - int otherNbOfTuples=other->getNumberOfTuples(); + mcIdType nbOfTuples(getNumberOfTuples()); + mcIdType otherNbOfTuples(other->getNumberOfTuples()); const double *inData=getConstPointer(); const double *inDataOther=other->getConstPointer(); MCAuto ret=DataArrayDouble::New(); ret->alloc(otherNbOfTuples*nbOfTuples,1); double *outData=ret->getPointer(); - for(int i=0;i()); declareAsNew(); } @@ -2665,16 +2600,16 @@ void DataArrayDouble::applyRPow(double val) * \throw If \a this is not allocated. * \throw If \a func returns \a false. */ -DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) const +DataArrayDouble *DataArrayDouble::applyFunc(std::size_t nbOfComp, FunctionToEvaluate func) const { checkAllocated(); DataArrayDouble *newArr=DataArrayDouble::New(); - int nbOfTuples=getNumberOfTuples(); - int oldNbOfComp=getNumberOfComponents(); + mcIdType nbOfTuples(getNumberOfTuples()); + std::size_t oldNbOfComp(getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); const double *ptr=getConstPointer(); double *ptrToFill=newArr->getPointer(); - for(int i=0;i 0 !"); checkAllocated(); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); MCAuto newArr(DataArrayDouble::New()); newArr->alloc(nbOfTuples,nbOfComp); INTERP_KERNEL::ExprParser expr(func); expr.parse(); std::set vars; expr.getTrueSetOfVars(vars); - if((int)vars.size()>1) + if(vars.size()>1) { std::ostringstream oss; oss << "DataArrayDouble::applyFunc : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); @@ -2767,9 +2702,9 @@ DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func, bool isSafe expr.prepareFastEvaluator(); if(!isSafe) { - for(int i=0;i 0 !"); checkAllocated(); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples(getNumberOfTuples()); INTERP_KERNEL::ExprParser expr(func); expr.parse(); std::set vars; expr.getTrueSetOfVars(vars); - if((int)vars.size()>1) + if(vars.size()>1) { std::ostringstream oss; oss << "DataArrayDouble::applyFuncOnThis : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); @@ -2852,9 +2787,9 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) expr.prepareFastEvaluator(); if(!isSafe) { - for(int i=0;igetInfoOnComponent(). * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe) const +DataArrayDouble *DataArrayDouble::applyFuncCompo(std::size_t nbOfComp, const std::string& func, bool isSafe) const { return applyFuncNamedCompo(nbOfComp,getVarsOnComponent(),func,isSafe); } @@ -2928,21 +2863,21 @@ DataArrayDouble *DataArrayDouble::applyFuncCompo(int nbOfComp, const std::string * \throw If \a func contains vars not in \a varsOrder. * \throw If computing \a func fails. */ -DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe) const +DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(std::size_t nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe) const { if(nbOfComp<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::applyFuncNamedCompo : output number of component must be > 0 !"); std::vector varsOrder2(varsOrder); - int oldNbOfComp(getNumberOfComponents()); - for(int i=(int)varsOrder.size();i vars; expr.getTrueSetOfVars(vars); - if((int)vars.size()>oldNbOfComp) + if(vars.size()>oldNbOfComp) { std::ostringstream oss; oss << "The field has " << oldNbOfComp << " components and there are "; oss << vars.size() << " variables : "; @@ -2954,15 +2889,15 @@ DataArrayDouble *DataArrayDouble::applyFuncNamedCompo(int nbOfComp, const std::v INTERP_KERNEL::AutoPtr buff(new double[oldNbOfComp]); double *buffPtr(buff),*ptrToFill; std::vector stck; - for(int iComp=0;iCompgetPointer()+iComp; if(!isSafe) { - for(int 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 !"); - int nbTuples(getNumberOfTuples()); + mcIdType nbTuples(getNumberOfTuples()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbTuples,3); Symmetry3DPlane(point,normalVector,nbTuples,begin(),ret->getPointer()); @@ -3067,15 +3002,15 @@ DataArrayDoubleIterator *DataArrayDouble::iterator() * \ref py_mcdataarraydouble_getidsinrange "Here is a Python example". * \endif */ -DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const +DataArrayIdType *DataArrayDouble::findIdsInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !"); const double *cptr(begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(getNumberOfTuples()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + mcIdType nbOfTuples(getNumberOfTuples()); + for(mcIdType i=0;i=vmin && *cptr<=vmax) ret->pushBackSilent(i); return ret.retn(); @@ -3093,15 +3028,15 @@ DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const * * \sa DataArrayDouble::findIdsInRange */ -DataArrayInt *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const +DataArrayIdType *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !"); const double *cptr(begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(getNumberOfTuples()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + mcIdType nbOfTuples(getNumberOfTuples()); + for(mcIdType i=0;ivmax) ret->pushBackSilent(i); return ret.retn(); @@ -3153,8 +3088,8 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vector::const_iterator it=a.begin(); std::size_t nbOfComp((*it)->getNumberOfComponents()); - int nbt=(*it++)->getNumberOfTuples(); - for(int i=1;it!=a.end();it++,i++) + mcIdType nbt=(*it++)->getNumberOfTuples(); + for(mcIdType i=1;it!=a.end();it++,i++) { if((*it)->getNumberOfComponents()!=nbOfComp) throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : Nb of components mismatch for array aggregation !"); @@ -3194,14 +3129,14 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array Dot !"); - std::size_t 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(); ret->alloc(nbOfTuple,1); double *retPtr=ret->getPointer(); const double *a1Ptr=a1->begin(),*a2Ptr(a2->begin()); - for(std::size_t i=0;igetNumberOfTuples()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); if(nbOfTuple!=a2->getNumberOfTuples()) throw INTERP_KERNEL::Exception("Nb of tuples mismatch for array crossProduct !"); DataArrayDouble *ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,3); double *retPtr=ret->getPointer(); const double *a1Ptr(a1->begin()),*a2Ptr(a2->begin()); - for(std::size_t i=0;igetNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array Max !"); - std::size_t 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()); @@ -3310,7 +3245,7 @@ DataArrayDouble *DataArrayDouble::Min(const DataArrayDouble *a1, const DataArray std::size_t nbOfComp(a1->getNumberOfComponents()); if(nbOfComp!=a2->getNumberOfComponents()) throw INTERP_KERNEL::Exception("Nb of components mismatch for array min !"); - std::size_t 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()); @@ -3342,10 +3277,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 !"); - int nbOfTuple=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp=a1->getNumberOfComponents(); - int 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) @@ -3353,7 +3288,7 @@ DataArrayDouble *DataArrayDouble::Pow(const DataArrayDouble *a1, const DataArray MCAuto ret=DataArrayDouble::New(); ret->alloc(nbOfTuple,1); const double *ptr1(a1->begin()),*ptr2(a2->begin()); double *ptr=ret->getPointer(); - for(int i=0;i=0) { @@ -3381,17 +3316,17 @@ void DataArrayDouble::powEqual(const DataArrayDouble *other) { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : input instance is null !"); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int 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) throw INTERP_KERNEL::Exception("DataArrayDouble::powEqual : number of components of both arrays must be equal to 1 !"); double *ptr=getPointer(); const double *ptrc=other->begin(); - for(int i=0;i=0) *ptr=pow(*ptr,*ptrc); @@ -3417,10 +3352,10 @@ std::vector DataArrayDouble::toVectorOfBool(double eps) const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::toVectorOfBool : must be applied on single component array !"); - int nbt(getNumberOfTuples()); + mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt); const double *pt(begin()); - for(int i=0;i DataArrayDouble::toVectorOfBool(double eps) const * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. * Server side. */ -void DataArrayDouble::getTinySerializationIntInformation(std::vector& tinyInfo) const +void DataArrayDouble::getTinySerializationIntInformation(std::vector& tinyInfo) const { tinyInfo.resize(2); if(isAllocated()) { tinyInfo[0]=getNumberOfTuples(); - tinyInfo[1]=getNumberOfComponents(); + tinyInfo[1]=ToIdType(getNumberOfComponents()); } else { @@ -3462,10 +3397,10 @@ void DataArrayDouble::getTinySerializationStrInformation(std::vector& tinyInfoI) +bool DataArrayDouble::resizeForUnserialization(const std::vector& tinyInfoI) { - int nbOfTuple=tinyInfoI[0]; - int nbOfComp=tinyInfoI[1]; + mcIdType nbOfTuple=tinyInfoI[0]; + mcIdType nbOfComp=tinyInfoI[1]; if(nbOfTuple!=-1 || nbOfComp!=-1) { alloc(nbOfTuple,nbOfComp); @@ -3494,13 +3429,13 @@ bool DataArrayDouble::resizeForUnserialization(const std::vector& tinyInfoI /*! * 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()) { - int nbOfCompo=getNumberOfComponents(); - for(int i=0;i& tinyInfoI, c * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in \a coordsIn * around an axe ( \a center, \a vect) and with angle \a angle. */ -void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut) { if(!center || !vect) throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : null vector in input !"); @@ -3536,7 +3471,7 @@ void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, doub std::transform(matrix,matrix+9,matrixTmp,matrix,std::plus()); //rotation matrix computed. double tmp[3]; - for(int i=0; i()); coordsOut[i*3]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+matrix[2]*tmp[2]+center[0]; @@ -3545,7 +3480,7 @@ void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, doub } } -void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut) { double matrix[9],matrix2[9],matrix3[9]; double vect[3],crossVect[3]; @@ -3560,17 +3495,17 @@ void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normal matrix2[0]=vect[0]/nv; matrix2[1]=vect[1]/nv; matrix2[2]=vect[2]/nv; matrix2[3]=crossVect[0]/nc; matrix2[4]=crossVect[1]/nc; matrix2[5]=crossVect[2]/nc; matrix2[6]=normalVector[0]/ni; matrix2[7]=normalVector[1]/ni; matrix2[8]=normalVector[2]/ni; - for(int i=0;i<3;i++) - for(int j=0;j<3;j++) + for(mcIdType i=0;i<3;i++) + for(mcIdType j=0;j<3;j++) { double val(0.); - for(int k=0;k<3;k++) + for(mcIdType k=0;k<3;k++) val+=matrix[3*i+k]*matrix2[3*k+j]; matrix3[3*i+j]=val; } //rotation matrix computed. double tmp[3]; - for(int i=0; i()); coordsOut[i*3]=matrix3[0]*tmp[0]+matrix3[1]*tmp[1]+matrix3[2]*tmp[2]+point[0]; @@ -3610,14 +3545,14 @@ void DataArrayDouble::ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const * Low static method that operates 3D rotation of \a nbNodes 3D nodes whose coordinates are arranged in \a coords * around the center point \a center and with angle \a angle. */ -void DataArrayDouble::Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut) { 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]; - for(int i=0; i()); coordsOut[i*2]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+center[0]; @@ -3629,7 +3564,7 @@ DataArrayDoubleIterator::DataArrayDoubleIterator(DataArrayDouble *da):DataArrayI { } -DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):DataArrayTuple(pt,nbOfComp) +DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, std::size_t nbOfComp):DataArrayTuple(pt,nbOfComp) { } @@ -3637,7 +3572,7 @@ DataArrayDoubleTuple::DataArrayDoubleTuple(double *pt, int nbOfComp):DataArrayTu std::string DataArrayDoubleTuple::repr() const { std::ostringstream oss; oss.precision(17); oss << "("; - for(int i=0;i<_nb_of_compo-1;i++) + for(std::size_t i=0;i<_nb_of_compo-1;i++) oss << _pt[i] << ", "; oss << _pt[_nb_of_compo-1] << ")"; return oss.str(); @@ -3654,32 +3589,11 @@ double DataArrayDoubleTuple::doubleValue() const * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayDouble *DataArrayDoubleTuple::buildDADouble(int nbOfTuples, int nbOfCompo) const +DataArrayDouble *DataArrayDoubleTuple::buildDADouble(std::size_t nbOfTuples, std::size_t nbOfCompo) const { return this->buildDA(nbOfTuples,nbOfCompo); } -/*! - * Returns the only one value in \a this, if and only if number of elements - * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated. - * \return double - the sole value stored in \a this array. - * \throw If at least one of conditions stated above is not fulfilled. - */ -int DataArrayInt::intValue() const -{ - if(isAllocated()) - { - if(getNbOfElems()==1) - { - return *getConstPointer(); - } - else - throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is allocated but number of elements is not equal to 1 !"); - } - else - throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is not allocated !"); -} - /*! * Returns a full copy of \a this. For more info on copying data arrays see * \ref MEDCouplingArrayBasicsCopyDeep. @@ -3690,3386 +3604,78 @@ DataArrayInt32 *DataArrayInt32::deepCopy() const return new DataArrayInt32(*this); } -/*! - * Computes distribution of values of \a this one-dimensional array between given value - * ranges (casts). This method is typically useful for entity number splitting by types, - * for example. - * \warning The values contained in \a arrBg should be sorted ascendently. No - * check of this is be done. If not, the result is not warranted. - * \param [in] arrBg - the array of ascending values defining the value ranges. The i-th - * value of \a arrBg (\a arrBg[ i ]) gives the lowest value of the i-th range, - * and the greatest value of the i-th range equals to \a arrBg[ i+1 ] - 1. \a - * arrBg containing \a n values defines \a n-1 ranges. The last value of \a arrBg - * should be more than every value in \a this array. - * \param [in] arrEnd - specifies the end of the array \a arrBg, so that - * the last value of \a arrBg is \a arrEnd[ -1 ]. - * \param [out] castArr - a new instance of DataArrayInt, of same size as \a this array - * (same number of tuples and components), the caller is to delete - * using decrRef() as it is no more needed. - * This array contains indices of ranges for every value of \a this array. I.e. - * the i-th value of \a castArr gives the index of range the i-th value of \a this - * belongs to. Or, in other words, this parameter contains for each tuple in \a - * this in which cast it holds. - * \param [out] rankInsideCast - a new instance of DataArrayInt, of same size as \a this - * array, the caller is to delete using decrRef() as it is no more needed. - * This array contains ranks of values of \a this array within ranges - * they belongs to. I.e. the i-th value of \a rankInsideCast gives the rank of - * the i-th value of \a this array within the \a castArr[ i ]-th range, to which - * the i-th value of \a this belongs to. Or, in other words, this param contains - * for each tuple its rank inside its cast. The rank is computed as difference - * between the value and the lowest value of range. - * \param [out] castsPresent - a new instance of DataArrayInt, containing indices of - * ranges (casts) to which at least one value of \a this array belongs. - * Or, in other words, this param contains the casts that \a this contains. - * The caller is to delete this array using decrRef() as it is no more needed. - * - * \b Example: If \a this contains [6,5,0,3,2,7,8,1,4] and \a arrBg contains [0,4,9] then - * the output of this method will be : - * - \a castArr : [1,1,0,0,0,1,1,0,1] - * - \a rankInsideCast: [2,1,0,3,2,3,4,1,0] - * - \a castsPresent : [0,1] - * - * I.e. values of \a this array belong to 2 ranges: #0 and #1. Value 6 belongs to the - * range #1 and its rank within this range is 2; etc. - * - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If \a arrEnd - arrBg < 2. - * \throw If any value of \a this is not less than \a arrEnd[-1]. - */ -void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd, - DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const +DataArrayInt32Iterator *DataArrayInt32::iterator() { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - int nbOfTuples=getNumberOfTuples(); - std::size_t nbOfCast=std::distance(arrBg,arrEnd); - if(nbOfCast<2) - throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !"); - nbOfCast--; - const int *work=getConstPointer(); - typedef std::reverse_iterator rintstart; - rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2 - rintstart end2(arrBg); - MCAuto ret1=DataArrayInt::New(); - MCAuto ret2=DataArrayInt::New(); - MCAuto ret3=DataArrayInt::New(); - ret1->alloc(nbOfTuples,1); - ret2->alloc(nbOfTuples,1); - int *ret1Ptr=ret1->getPointer(); - int *ret2Ptr=ret2->getPointer(); - std::set castsDetected; - for(int i=0;i(), work[i])); - std::size_t pos=std::distance(bg,res); - std::size_t pos2=nbOfCast-pos; - if(pos2alloc((int)castsDetected.size(),1); - std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer()); - castArr=ret1.retn(); - rankInsideCast=ret2.retn(); - castsPresent=ret3.retn(); + return new DataArrayInt32Iterator(this); } -/*! - * This method look at \a this if it can be considered as a range defined by the 3-tuple ( \a strt , \a sttoopp , \a stteepp ). - * If false is returned the tuple must be ignored. If true is returned \a this can be considered by a range( \a strt , \a sttoopp , \a stteepp ). - * This method works only if \a this is allocated and single component. If not an exception will be thrown. - * - * \param [out] strt - the start of the range (included) if true is returned. - * \param [out] sttoopp - the end of the range (not included) if true is returned. - * \param [out] stteepp - the step of the range if true is returned. - * \return the verdict of the check. - * - * \sa DataArray::GetNumberOfItemGivenBES - */ -bool DataArrayInt::isRange(int& strt, int& sttoopp, int& stteepp) const + +DataArrayInt32Iterator::DataArrayInt32Iterator(DataArrayInt32 *da):DataArrayIterator(da) { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !"); - int nbTuples(getNumberOfTuples()); - if(nbTuples==0) - { strt=0; sttoopp=0; stteepp=1; return true; } - const int *pt(begin()); - strt=*pt; - if(nbTuples==1) - { sttoopp=strt+1; stteepp=1; return true; } - strt=*pt; sttoopp=pt[nbTuples-1]; - if(strt==sttoopp) - return false; - if(sttoopp>strt) - { - sttoopp++; - int a(sttoopp-1-strt),tmp(strt); - if(a%(nbTuples-1)!=0) - return false; - stteepp=a/(nbTuples-1); - for(int i=0;igetNumberOfComponents() != 1. - * \throw If any value of \a this array is not a valid index for \a indArrBg array. - * \throw If any value of \a indArrBg is not a valid index for \a this array. - */ -DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const +DataArrayInt32Tuple::DataArrayInt32Tuple(Int32 *pt, std::size_t nbOfComp):DataArrayTuple(pt,nbOfComp) { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - int nbElemsIn=(int)std::distance(indArrBg,indArrEnd); - int nbOfTuples=getNumberOfTuples(); - const int *pt=getConstPointer(); - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuples,1); - ret->fillWithValue(-1); - int *tmp=ret->getPointer(); - for(int i=0;i=0 && *pt=0 && pos - * \ref py_mcdataarrayint_invertarrayo2n2n2o "Here is a Python example". - * \endif - */ -DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const -{ - MCAuto ret(DataArrayInt::New()); - ret->alloc(newNbOfElem,1); - int nbOfOldNodes(this->getNumberOfTuples()); - const int *old2New(begin()); - int *pt(ret->getPointer()); - for(int i=0;i!=nbOfOldNodes;i++) - { - int newp(old2New[i]); - if(newp!=-1) - { - if(newp>=0 && newp ret=DataArrayInt::New(); - ret->alloc(newNbOfElem,1); - int nbOfOldNodes=getNumberOfTuples(); - const int *old2New=getConstPointer(); - int *pt=ret->getPointer(); - for(int i=nbOfOldNodes-1;i>=0;i--) - { - int newp(old2New[i]); - if(newp!=-1) - { - if(newp>=0 && newpzeValue(); } /*! - * Creates a one-dimensional DataArrayInt of given length, whose contents are computed - * from values of \a this array, which is supposed to contain a renumbering map in - * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode. - * To know how to use the renumbering maps see \ref numbering. - * \param [in] newNbOfElem - the number of tuples in the result array. - * \return DataArrayInt * - the new instance of DataArrayInt. - * The caller is to delete this result array using decrRef() as it is no more - * needed. - * - * \if ENABLE_EXAMPLES - * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example". - * - * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example". - * \sa invertArrayN2O2O2NOptimized - * \endif + * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayInt::decrRef. + * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayInt::useArray with ownership set to \b false. + * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or + * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const +DataArrayInt32 *DataArrayInt32Tuple::buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const { - checkAllocated(); - MCAuto ret=DataArrayInt::New(); - ret->alloc(oldNbOfElem,1); - const int *new2Old=getConstPointer(); - int *pt=ret->getPointer(); - std::fill(pt,pt+oldNbOfElem,-1); - int nbOfNewElems=getNumberOfTuples(); - for(int i=0;i=0 && vbuildDA(nbOfTuples,nbOfCompo); } -/*! - * Creates a map, whose contents are computed - * from values of \a this array, which is supposed to contain a renumbering map in - * "New to Old" mode. The result array contains a renumbering map in "Old to New" mode. - * To know how to use the renumbering maps see \ref numbering. - * \param [in] newNbOfElem - the number of tuples in the result array. - * \return MapII - the new instance of Map. - * - * \if ENABLE_EXAMPLES - * \ref cpp_mcdataarrayint_invertarrayn2o2o2n "Here is a C++ example". - * - * \ref py_mcdataarrayint_invertarrayn2o2o2n "Here is a Python example". - * \sa invertArrayN2O2O2N, giveN2OOptimized, MEDCouplingPointSet::renumberNodesInConn - * \endif - */ -MCAuto< MapKeyVal > DataArrayInt32::invertArrayN2O2O2NOptimized() const +DataArrayInt64Iterator *DataArrayInt64::iterator() { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt32::invertArrayN2O2O2NOptimized : single component expected !"); - MCAuto< MapKeyVal > ret(MapKeyVal::New()); - std::map& m(ret->data()); - const int *new2Old(begin()); - std::size_t nbOfNewElems(this->getNumberOfTuples()); - for(std::size_t i=0;i > DataArrayInt32::giveN2OOptimized() const + +DataArrayInt64Iterator::DataArrayInt64Iterator(DataArrayInt64 *da):DataArrayIterator(da) { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt32::giveN2OOptimized : single component expected !"); - MCAuto< MapKeyVal > ret(MapKeyVal::New()); - std::map& m(ret->data()); - const int *new2Old(begin()); - std::size_t nbOfNewElems(this->getNumberOfTuples()); - for(std::size_t i=0;irenumber(\a res) then the returned array contains [0,3,4,6,7,9,10,11]. - * This method is useful for renumbering (in MED file for example). For more info - * on renumbering see \ref numbering. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If there are equal values in \a this array. - */ -DataArrayInt *DataArrayInt::checkAndPreparePermutation() const +DataArrayInt64Tuple::DataArrayInt64Tuple(Int64 *pt, std::size_t nbOfComp):DataArrayTuple(pt,nbOfComp) { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !"); - int nbTuples=getNumberOfTuples(); - const int *pt=getConstPointer(); - int *pt2=CheckAndPreparePermutation(pt,pt+nbTuples); - DataArrayInt *ret=DataArrayInt::New(); - ret->useArray(pt2,true,DeallocType::C_DEALLOC,nbTuples,1); - return ret; } -/*! - * This method tries to find the permutation to apply to the first input \a ids1 to obtain the same array (without considering strings information) the second - * input array \a ids2. - * \a ids1 and \a ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative. - * This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in \a ids1 not in \a ids2 or - * inversely. - * In case of success both assertion will be true (no throw) : - * \c ids1->renumber(ret)->isEqual(ids2) where \a ret is the return of this method. - * \c ret->transformWithIndArr(ids2)->isEqual(ids1) - * - * \b Example: - * - \a ids1 : [3,1,103,4,6,10,-7,205] - * - \a ids2 : [-7,1,205,10,6,3,103,4] - * - \a return is : [5,1,6,7,4,3,0,2] because ids2[5]==ids1[0], ids2[1]==ids1[1], ids2[6]==ids1[2]... - * - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If either ids1 or ids2 is null not allocated or not with one components. - * - * \sa DataArrayInt32::findIdForEach - */ -DataArrayInt *DataArrayInt::FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) -{ - if(!ids1 || !ids2) - throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be not null !"); - if(!ids1->isAllocated() || !ids2->isAllocated()) - throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be allocated !"); - if(ids1->getNumberOfComponents()!=1 || ids2->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays have exactly one component !"); - if(ids1->getNumberOfTuples()!=ids2->getNumberOfTuples()) - { - std::ostringstream oss; oss << "DataArrayInt::FindPermutationFromFirstToSecond : first array has " << ids1->getNumberOfTuples() << " tuples and the second one " << ids2->getNumberOfTuples() << " tuples ! No chance to find a permutation between the 2 arrays !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - MCAuto p1(ids1->deepCopy()); - MCAuto p2(ids2->deepCopy()); - p1->sort(true); p2->sort(true); - if(!p1->isEqualWithoutConsideringStr(*p2)) - throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !"); - p1=ids1->checkAndPreparePermutation(); - p2=ids2->checkAndPreparePermutation(); - p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples()); - p2=p2->selectByTupleIdSafe(p1->begin(),p1->end()); - return p2.retn(); +std::string DataArrayInt64Tuple::repr() const +{ + std::ostringstream oss; oss << "("; + for(std::size_t i=0;i<_nb_of_compo-1;i++) + oss << _pt[i] << ", "; + oss << _pt[_nb_of_compo-1] << ")"; + return oss.str(); } -/*! - * Returns two arrays describing a surjective mapping from \a this set of values (\a A) - * onto a set of values of size \a targetNb (\a B). The surjective function is - * \a B[ \a A[ i ]] = i. That is to say that for each \a id in [0,\a targetNb), where \a - * targetNb < \a this->getNumberOfTuples(), there exists at least one tupleId (\a tid) so - * that this->getIJ( tid, 0 ) == id.
- * The first of out arrays returns indices of elements of \a this array, grouped by their - * place in the set \a B. The second out array is the index of the first one; it shows how - * many elements of \a A are mapped into each element of \a B.
- * For more info on - * mapping and its usage in renumbering see \ref numbering.
- * \b Example: - * - \a this: [0,3,2,3,2,2,1,2] - * - \a targetNb: 4 - * - \a arr: [0, 6, 2,4,5,7, 1,3] - * - \a arrI: [0,1,2,6,8] - * - * This result means:
- * the element of \a B 0 encounters within \a A once (\a arrI[ 0+1 ] - \a arrI[ 0 ]) and - * its index within \a A is 0 ( \a arr[ 0:1 ] == \a arr[ \a arrI[ 0 ] : \a arrI[ 0+1 ]]);
- * the element of \a B 2 encounters within \a A 4 times (\a arrI[ 2+1 ] - \a arrI[ 2 ]) and - * its indices within \a A are [2,4,5,7] ( \a arr[ 2:6 ] == \a arr[ \a arrI[ 2 ] : - * \a arrI[ 2+1 ]]);
etc. - * \param [in] targetNb - the size of the set \a B. \a targetNb must be equal or more - * than the maximal value of \a A. - * \param [out] arr - a new instance of DataArrayInt returning indices of - * elements of \a this, grouped by their place in the set \a B. The caller is to delete - * this array using decrRef() as it is no more needed. - * \param [out] arrI - a new instance of DataArrayInt returning size of groups of equal - * elements of \a this. The caller is to delete this array using decrRef() as it - * is no more needed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If any value in \a this is more or equal to \a targetNb. - */ -void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArrayInt *&arrI) const +Int64 DataArrayInt64Tuple::intValue() const { - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !"); - int nbOfTuples=getNumberOfTuples(); - MCAuto ret(DataArrayInt::New()); - MCAuto retI(DataArrayInt::New()); - retI->alloc(targetNb+1,1); - const int *input=getConstPointer(); - std::vector< std::vector > tmp(targetNb); - for(int i=0;i=0 && tmp2getPointer(); - *retIPtr=0; - for(std::vector< std::vector >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++) - retIPtr[1]=retIPtr[0]+(int)((*it1).size()); - if(nbOfTuples!=retI->getIJ(targetNb,0)) - throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !"); - ret->alloc(nbOfTuples,1); - int *retPtr=ret->getPointer(); - 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(); + return this->zeValue(); } - -/*! - * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode computed - * from a zip representation of a surjective format (returned e.g. by - * \ref MEDCoupling::DataArrayDouble::findCommonTuples() "DataArrayDouble::findCommonTuples()" - * for example). The result array minimizes the permutation.
- * For more info on renumbering see \ref numbering.
- * \b Example:
- * - \a nbOfOldTuples: 10 - * - \a arr : [0,3, 5,7,9] - * - \a arrIBg : [0,2,5] - * - \a newNbOfTuples: 7 - * - result array : [0,1,2,0,3,4,5,4,6,4] - * - * \param [in] nbOfOldTuples - number of tuples in the initial array \a arr. - * \param [in] arr - the array of tuple indices grouped by \a arrIBg array. - * \param [in] arrIBg - the array dividing all indices stored in \a arr into groups of - * (indices of) equal values. Its every element (except the last one) points to - * the first element of a group of equal values. - * \param [in] arrIEnd - specifies the end of \a arrIBg, so that the last element of \a - * arrIBg is \a arrIEnd[ -1 ]. - * \param [out] newNbOfTuples - number of tuples after surjection application. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ). - */ -DataArrayInt *DataArrayInt::ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples) -{ - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfOldTuples,1); - int *pt=ret->getPointer(); - std::fill(pt,pt+nbOfOldTuples,-1); - int nbOfGrps=((int)std::distance(arrIBg,arrIEnd))-1; - const int *cIPtr=arrIBg; - for(int i=0;i=0 && arr[j]buildDA(nbOfTuples,nbOfCompo); } -/*! - * Returns a new DataArrayInt containing a renumbering map in "New to Old" mode, - * which if applied to \a this array would make it sorted ascendingly. - * For more info on renumbering see \ref numbering.
- * \b Example:
- * - \a this: [2,0,1,1,0,1,2,0,1,1,0,0] - * - result: [10,0,5,6,1,7,11,2,8,9,3,4] - * - after applying result to \a this: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2] - * - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::buildPermArrPerLevel() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !"); - int nbOfTuples=getNumberOfTuples(); - const int *pt=getConstPointer(); - std::map m; - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuples,1); - int *opt=ret->getPointer(); - for(int i=0;i::iterator it=m.find(val); - if(it!=m.end()) - { - *opt=(*it).second; - (*it).second++; - } - else - { - *opt=0; - m.insert(std::pair(val,1)); - } - } - int sum=0; - for(std::map::iterator it=m.begin();it!=m.end();it++) - { - int vt=(*it).second; - (*it).second=sum; - sum+=vt; - } - pt=getConstPointer(); - opt=ret->getPointer(); - for(int i=0;igetNumberOfTuples()) - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - */ -bool DataArrayInt::isIota(int sizeExpected) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - return false; - int nbOfTuples(getNumberOfTuples()); - if(nbOfTuples!=sizeExpected) - return false; - const int *pt=getConstPointer(); - for(int i=0;igetNumberOfComponents() != 1 - * \sa DataArrayInt::checkUniformAndGuess - */ -bool DataArrayInt::isUniform(int val) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); - const int *w(begin()),*end2(end()); - for(;w!=end2;w++) - if(*w!=val) - return false; - return true; -} - -/*! - * This method checks that \a this is uniform. If not and exception will be thrown. - * In case of uniformity the corresponding value is returned. - * - * \return int - the unique value contained in this - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1 - * \throw If \a this is not uniform. - * \sa DataArrayInt::isUniform - */ -int DataArrayInt::checkUniformAndGuess() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); - if(empty()) - throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is empty !"); - const int *w(begin()),*end2(end()); - int ret(*w); - for(;w!=end2;w++) - if(*w!=ret) - throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is not uniform !"); - return ret; -} - -/*! - * Checks if all values in \a this array are unique. - * \return bool - \a true if condition above is true - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1 - */ -bool DataArrayInt::hasUniqueValues() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); - std::size_t nbOfTuples(getNumberOfTuples()); - std::set s(begin(),end()); // in C++11, should use unordered_set (O(1) complexity) - if (s.size() != nbOfTuples) - return false; - return true; -} - -/*! - * Copy all components in a specified order from another DataArrayInt. - * The specified components become the first ones in \a this array. - * Both numerical and textual data is copied. The number of tuples in \a this and - * the other array can be different. - * \param [in] a - the array to copy data from. - * \param [in] compoIds - sequence of zero based indices of components, data of which is - * to be copied. - * \throw If \a a is NULL. - * \throw If \a compoIds.size() != \a a->getNumberOfComponents(). - * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents(). - * - * \if ENABLE_EXAMPLES - * \ref py_mcdataarrayint_setselectedcomponents "Here is a Python example". - * \endif - */ -void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector& compoIds) -{ - if(!a) - throw INTERP_KERNEL::Exception("DataArrayInt::setSelectedComponents : input DataArrayInt is NULL !"); - checkAllocated(); - a->checkAllocated(); - copyPartOfStringInfoFrom2(compoIds,*a); - std::size_t partOfCompoSz=compoIds.size(); - int nbOfCompo=getNumberOfComponents(); - int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples()); - const int *ac=a->getConstPointer(); - int *nc=getPointer(); - for(int i=0;igetNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::findIdsNotEqual(int val) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); - const int *cptr(getConstPointer()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;ipushBackSilent(i); - return ret.retn(); -} - -/*! - * Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd ) - * This method is an extension of DataArrayInt::findIdsEqual method. - * - * \param [in] tupleBg - the begin (included) of the input tuple to find within \a this. - * \param [in] tupleEnd - the end (excluded) of the input tuple to find within \a this. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != std::distance(tupleBg,tupleEnd). - * \throw If \a this->getNumberOfComponents() is equal to 0. - * \sa DataArrayInt::findIdsEqual - */ -DataArrayInt *DataArrayInt::findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const -{ - std::size_t nbOfCompoExp(std::distance(tupleBg,tupleEnd)); - checkAllocated(); - if(getNumberOfComponents()!=nbOfCompoExp) - { - std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << getNumberOfComponents() << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if(nbOfCompoExp==0) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !"); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - const int *bg(begin()),*end2(end()),*work(begin()); - while(work!=end2) - { - work=std::search(work,end2,tupleBg,tupleEnd); - if(work!=end2) - { - std::size_t pos(std::distance(bg,work)); - if(pos%nbOfCompoExp==0) - ret->pushBackSilent(pos/nbOfCompoExp); - work++; - } - } - return ret.retn(); -} - -/*! - * This method finds for each element \a ELT in [valsBg,valsEnd) elements in \a this equal to it. Associated to ELT - * this method will return the tuple id of last element found. If there is no element in \a this equal to ELT - * an exception will be thrown. - * - * In case of success this[ret]==vals. Samely ret->transformWithIndArr(this->begin(),this->end())==vals. - * Where \a vals is the [valsBg,valsEnd) array and \a ret the array returned by this method. - * This method can be seen as an extension of FindPermutationFromFirstToSecond. - *
- * \b Example:
- * - \a this: [17,27,2,10,-4,3,12,27,16] - * - \a val : [3,16,-4,27,17] - * - result: [5,8,4,7,0] - * - * \return - An array of size std::distance(valsBg,valsEnd) - * - * \sa DataArrayInt32::FindPermutationFromFirstToSecond - */ -MCAuto DataArrayInt32::findIdForEach(const int *valsBg, const int *valsEnd) const -{ - MCAuto ret(DataArrayInt32::New()); - std::size_t nbOfTuplesOut(std::distance(valsBg,valsEnd)); - ret->alloc(nbOfTuplesOut,1); - MCAuto< MapKeyVal > zeMap(invertArrayN2O2O2NOptimized()); - const std::map& dat(zeMap->data()); - int *ptToFeed(ret->getPointer()); - for(const int *pt=valsBg;pt!=valsEnd;pt++) - { - std::map::const_iterator it(dat.find(*pt)); - if(it!=dat.end()) - *ptToFeed++=(*it).second; - else - { - std::ostringstream oss; oss << "DataArrayInt32::findIdForEach : error for element at place " << std::distance(valsBg,pt); - oss << " of input array value is " << *pt << " which is not in this !"; - throw INTERP_KERNEL::Exception(oss.str()); - } - } - return ret; -} - -/*! - * Assigns \a newValue to all elements holding \a oldValue within \a this - * one-dimensional array. - * \param [in] oldValue - the value to replace. - * \param [in] newValue - the value to assign. - * \return int - number of replacements performed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - */ -int DataArrayInt::changeValue(int oldValue, int newValue) -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !"); - if(oldValue==newValue) - return 0; - int *start(getPointer()),*end2(start+getNbOfElems()); - int ret(0); - for(int *val=start;val!=end2;val++) - { - if(*val==oldValue) - { - *val=newValue; - ret++; - } - } - if(ret>0) - declareAsNew(); - return ret; -} - -/*! - * Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to - * one of given values. - * \param [in] valsBg - an array of values to find within \a this array. - * \param [in] valsEnd - specifies the end of the array \a valsBg, so that - * the last value of \a valsBg is \a valsEnd[ -1 ]. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::findIdsEqualList(const int *valsBg, const int *valsEnd) const -{ - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : the array must have only one component, you can call 'rearrange' method before !"); - std::set vals2(valsBg,valsEnd); - const int *cptr(getConstPointer()); - std::vector res; - int nbOfTuples(getNumberOfTuples()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;ipushBackSilent(i); - return ret.retn(); -} - -/*! - * Creates a new DataArrayInt containing IDs (indices) of tuples holding values \b not - * equal to any of given values. - * \param [in] valsBg - an array of values to ignore within \a this array. - * \param [in] valsEnd - specifies the end of the array \a valsBg, so that - * the last value of \a valsBg is \a valsEnd[ -1 ]. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *valsEnd) const -{ - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !"); - std::set vals2(valsBg,valsEnd); - const int *cptr=getConstPointer(); - std::vector res; - int nbOfTuples=getNumberOfTuples(); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(int i=0;ipushBackSilent(i); - return ret.retn(); -} - -/*! - * This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with - * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). - * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. - * If any the tuple id is returned. If not -1 is returned. - * - * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of - * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. - * - * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. - * \sa DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple. - */ -int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const -{ - checkAllocated(); - int nbOfCompo=getNumberOfComponents(); - if(nbOfCompo==0) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !"); - if(nbOfCompo!=(int)tupl.size()) - { - std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - const int *cptr=getConstPointer(); - std::size_t nbOfVals=getNbOfElems(); - for(const int *work=cptr;work!=cptr+nbOfVals;) - { - work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end()); - if(work!=cptr+nbOfVals) - { - if(std::distance(cptr,work)%nbOfCompo!=0) - work++; - else - return std::distance(cptr,work)/nbOfCompo; - } - } - return -1; -} - -/*! - * This method searches the sequence specified in input parameter \b vals in \b this. - * This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown). - * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple. - * \sa DataArrayInt::findIdFirstEqualTuple - */ -int DataArrayInt::findIdSequence(const std::vector& vals) const -{ - checkAllocated(); - int nbOfCompo=getNumberOfComponents(); - if(nbOfCompo!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !"); - const int *cptr=getConstPointer(); - std::size_t nbOfVals=getNbOfElems(); - const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); - if(loc!=cptr+nbOfVals) - return std::distance(cptr,loc); - return -1; -} - -/*! - * This method expects to be called when number of components of this is equal to one. - * This method returns the tuple id, if it exists, of the first tuple equal to \b value. - * If not any tuple contains \b value -1 is returned. - * \sa DataArrayInt::presenceOfValue - */ -int DataArrayInt::findIdFirstEqual(int value) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); - const int *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - const int *ret=std::find(cptr,cptr+nbOfTuples,value); - if(ret!=cptr+nbOfTuples) - return std::distance(cptr,ret); - return -1; -} - -/*! - * This method expects to be called when number of components of this is equal to one. - * This method returns the tuple id, if it exists, of the first tuple so that the value is contained in \b vals. - * If not any tuple contains one of the values contained in 'vals' -1 is returned. - * \sa DataArrayInt::presenceOfValue - */ -int DataArrayInt::findIdFirstEqual(const std::vector& vals) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); - std::set vals2(vals.begin(),vals.end()); - const int *cptr=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - for(const int *w=cptr;w!=cptr+nbOfTuples;w++) - if(vals2.find(*w)!=vals2.end()) - return std::distance(cptr,w); - return -1; -} - -/*! - * This method returns the number of values in \a this that are equals to input parameter \a value. - * This method only works for single component array. - * - * \return a value in [ 0, \c this->getNumberOfTuples() ) - * - * \throw If \a this is not allocated - * - */ -int DataArrayInt::count(int value) const -{ - int ret=0; - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); - const int *vals=begin(); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i& tupl) const -{ - return findIdFirstEqualTuple(tupl)!=-1; -} - - -/*! - * Returns \a true if a given value is present within \a this one-dimensional array. - * \param [in] value - the value to find within \a this array. - * \return bool - \a true in case if \a value is present within \a this array. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \sa findIdFirstEqual() - */ -bool DataArrayInt::presenceOfValue(int value) const -{ - return findIdFirstEqual(value)!=-1; -} - -/*! - * This method expects to be called when number of components of this is equal to one. - * This method returns true if it exists a tuple so that the value is contained in \b vals. - * If not any tuple contains one of the values contained in 'vals' false is returned. - * \sa DataArrayInt::findIdFirstEqual - */ -bool DataArrayInt::presenceOfValue(const std::vector& vals) const -{ - return findIdFirstEqual(vals)!=-1; -} - -/*! - * Accumulates values of each component of \a this array. - * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated - * by the caller, that is filled by this method with sum value for each - * component. - * \throw If \a this is not allocated. - */ -void DataArrayInt::accumulate(int *res) const -{ - checkAllocated(); - const int *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); - std::fill(res,res+nbComps,0); - for(int i=0;i()); -} - -int DataArrayInt::accumulate(int compId) const -{ - checkAllocated(); - const int *ptr=getConstPointer(); - int nbTuple=getNumberOfTuples(); - int nbComps=getNumberOfComponents(); - if(compId<0 || compId>=nbComps) - throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !"); - int ret=0; - for(int i=0;igetNumberOfTuples). - * - * \param [in] bgOfIndex - begin (included) of the input index array. - * \param [in] endOfIndex - end (excluded) of the input index array. - * \return DataArrayInt * - the new instance having the same number of components than \a this. - * - * \throw If bgOfIndex or end is NULL. - * \throw If input index array is not ascendingly sorted. - * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples). - * \throw If std::distance(bgOfIndex,endOfIndex)==0. - */ -DataArrayInt *DataArrayInt::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const -{ - if(!bgOfIndex || !endOfIndex) - throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !"); - checkAllocated(); - int nbCompo=getNumberOfComponents(); - int nbOfTuples=getNumberOfTuples(); - int sz=(int)std::distance(bgOfIndex,endOfIndex); - if(sz<1) - throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !"); - sz--; - MCAuto ret=DataArrayInt::New(); ret->alloc(sz,nbCompo); - const int *w=bgOfIndex; - if(*w<0 || *w>=nbOfTuples) - throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); - const int *srcPt=begin()+(*w)*nbCompo; - int *tmp=ret->getPointer(); - for(int i=0;i=w[0]) - { - for(int j=w[0];j=0 && j()); - else - { - std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - } - else - { - std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted."; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - ret->copyStringInfoFrom(*this); - return ret.retn(); -} - -/*! - * Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number - * of tuples in the result array is a1->getNumberOfTuples() + a2->getNumberOfTuples() - - * offsetA2 and (2) - * the number of component in the result array is same as that of each of given arrays. - * First \a offsetA2 tuples of \a a2 are skipped and thus are missing from the result array. - * Info on components is copied from the first of the given arrays. Number of components - * in the given arrays must be the same. - * \param [in] a1 - an array to include in the result array. - * \param [in] a2 - another array to include in the result array. - * \param [in] offsetA2 - number of tuples of \a a2 to skip. - * \return DataArrayInt * - the new instance of DataArrayInt. - * The caller is to delete this result array using decrRef() as it is no more - * needed. - * \throw If either \a a1 or \a a2 is NULL. - * \throw If \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents(). - */ -DataArrayInt *DataArrayInt::Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) -{ - if(!a1 || !a2) - throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !"); - std::size_t nbOfComp(a1->getNumberOfComponents()); - if(nbOfComp!=a2->getNumberOfComponents()) - throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !"); - std::size_t nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); - MCAuto ret(DataArrayInt::New()); - ret->alloc(nbOfTuple1+nbOfTuple2-offsetA2,nbOfComp); - int *pt=std::copy(a1->begin(),a1->end(),ret->getPointer()); - std::copy(a2->getConstPointer()+offsetA2*nbOfComp,a2->getConstPointer()+nbOfTuple2*nbOfComp,pt); - ret->copyStringInfoFrom(*a1); - return ret.retn(); -} - -/*! - * Returns a new DataArrayInt by concatenating all given arrays, so that (1) the number - * of tuples in the result array is a sum of the number of tuples of given arrays and (2) - * the number of component in the result array is same as that of each of given arrays. - * Info on components is copied from the first of the given arrays. Number of components - * in the given arrays must be the same. - * If the number of non null of elements in \a arr is equal to one the returned object is a copy of it - * not the object itself. - * \param [in] arr - a sequence of arrays to include in the result array. - * \return DataArrayInt * - the new instance of DataArrayInt. - * The caller is to delete this result array using decrRef() as it is no more - * needed. - * \throw If all arrays within \a arr are NULL. - * \throw If getNumberOfComponents() of arrays within \a arr. - */ -DataArrayInt *DataArrayInt::Aggregate(const std::vector& arr) -{ - std::vector a; - 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("DataArrayInt::Aggregate : input list must be NON EMPTY !"); - std::vector::const_iterator it=a.begin(); - std::size_t nbOfComp((*it)->getNumberOfComponents()),nbt((*it++)->getNumberOfTuples()); - for(int i=1;it!=a.end();it++,i++) - { - if((*it)->getNumberOfComponents()!=nbOfComp) - throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !"); - nbt+=(*it)->getNumberOfTuples(); - } - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbt,nbOfComp); - int *pt=ret->getPointer(); - for(it=a.begin();it!=a.end();it++) - pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt); - ret->copyStringInfoFrom(*(a[0])); - return ret.retn(); -} - -/*! - * This method takes as input a list of DataArrayInt instances \a arrs that represent each a packed index arrays. - * A packed index array is an allocated array with one component, and at least one tuple. The first element - * of each array in \a arrs must be 0. Each array in \a arrs is expected to be increasingly monotonic. - * This method is useful for users that want to aggregate a pair of DataArrayInt representing an indexed data (typically nodal connectivity index in unstructured meshes. - * - * \return DataArrayInt * - a new object to be managed by the caller. - */ -DataArrayInt *DataArrayInt::AggregateIndexes(const std::vector& arrs) -{ - int retSz=1; - for(std::vector::const_iterator it4=arrs.begin();it4!=arrs.end();it4++) - { - if(*it4) - { - (*it4)->checkAllocated(); - if((*it4)->getNumberOfComponents()!=1) - { - std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of compo != 1 at pos " << std::distance(arrs.begin(),it4) << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - int nbTupl=(*it4)->getNumberOfTuples(); - if(nbTupl<1) - { - std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if((*it4)->front()!=0) - { - std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with front value != 0 at pos " << std::distance(arrs.begin(),it4) << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - retSz+=nbTupl-1; - } - else - { - std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a null instance at pos " << std::distance(arrs.begin(),it4) << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - if(arrs.empty()) - throw INTERP_KERNEL::Exception("DataArrayInt::AggregateIndexes : input list must be NON EMPTY !"); - MCAuto ret=DataArrayInt::New(); - ret->alloc(retSz,1); - int *pt=ret->getPointer(); *pt++=0; - for(std::vector::const_iterator it=arrs.begin();it!=arrs.end();it++) - pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus(),pt[-1])); - ret->copyStringInfoFrom(*(arrs[0])); - return ret.retn(); -} - -/*! - * Returns in a single walk in \a this the min value and the max value in \a this. - * \a this is expected to be single component array. - * - * \param [out] minValue - the min value in \a this. - * \param [out] maxValue - the max value in \a this. - * - * \sa getMinValueInArray, getMinValue, getMaxValueInArray, getMaxValue - */ -void DataArrayInt::getMinMaxValues(int& minValue, int& maxValue) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !"); - int nbTuples(getNumberOfTuples()); - const int *pt(begin()); - minValue=std::numeric_limits::max(); maxValue=-std::numeric_limits::max(); - for(int i=0;imaxValue) - maxValue=*pt; - } -} - -/*! - * Modify all elements of \a this array, so that - * an element _x_ becomes \f$ numerator / x \f$. - * \warning If an exception is thrown because of presence of 0 element in \a this - * array, all elements processed before detection of the zero element remain - * modified. - * \param [in] numerator - the numerator used to modify array elements. - * \throw If \a this is not allocated. - * \throw If there is an element equal to 0 in \a this array. - */ -void DataArrayInt::applyInv(int numerator) -{ - checkAllocated(); - int *ptr=getPointer(); - std::size_t nbOfElems=getNbOfElems(); - for(std::size_t i=0;i(),val)); - declareAsNew(); -} - -/*! - * Modify all elements of \a this array, so that - * an element _x_ becomes x % val . - * \param [in] val - the divisor used to modify array elements. - * \throw If \a this is not allocated. - * \throw If \a val <= 0. - */ -void DataArrayInt::applyModulus(int val) -{ - if(val<=0) - throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !"); - checkAllocated(); - int *ptr=getPointer(); - std::size_t nbOfElems=getNbOfElems(); - std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus(),val)); - declareAsNew(); -} - -/*! - * This method works only on data array with one component. - * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that - * this[*id] in [\b vmin,\b vmax) - * - * \param [in] vmin begin of range. This value is included in range (included). - * \param [in] vmax end of range. This value is \b not included in range (excluded). - * \return a newly allocated data array that the caller should deal with. - * - * \sa DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative - */ -DataArrayInt *DataArrayInt::findIdsInRange(int vmin, int vmax) const -{ - InRange ir(vmin,vmax); - MCAuto ret(findIdsAdv(ir)); - return ret.retn(); -} - -/*! - * This method works only on data array with one component. - * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that - * this[*id] \b not in [\b vmin,\b vmax) - * - * \param [in] vmin begin of range. This value is \b not included in range (excluded). - * \param [in] vmax end of range. This value is included in range (included). - * \return a newly allocated data array that the caller should deal with. - * - * \sa DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative - */ -DataArrayInt *DataArrayInt::findIdsNotInRange(int vmin, int vmax) const -{ - NotInRange nir(vmin,vmax); - MCAuto ret(findIdsAdv(nir)); - return ret.retn(); -} - -/*! - * This method works only on data array with one component. - * This method checks that all ids in \b this are in [ \b vmin, \b vmax ). If there is at least one element in \a this not in [ \b vmin, \b vmax ) an exception will be thrown. - * - * \param [in] vmin begin of range. This value is included in range (included). - * \param [in] vmax end of range. This value is \b not included in range (excluded). - * \return if all ids in \a this are so that (*this)[i]==i for all i in [ 0, \c this->getNumberOfTuples() ). */ -bool DataArrayInt::checkAllIdsInRange(int vmin, int vmax) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::checkAllIdsInRange : this must have exactly one component !"); - int nbOfTuples=getNumberOfTuples(); - bool ret=true; - const int *cptr=getConstPointer(); - for(int i=0;i=vmin && *cptr val % x . - * \warning If an exception is thrown because of presence of an element <= 0 in \a this - * array, all elements processed before detection of the zero element remain - * modified. - * \param [in] val - the divident used to modify array elements. - * \throw If \a this is not allocated. - * \throw If there is an element equal to or less than 0 in \a this array. - */ -void DataArrayInt::applyRModulus(int val) -{ - checkAllocated(); - int *ptr=getPointer(); - std::size_t nbOfElems=getNbOfElems(); - for(std::size_t i=0;i0) - { - *ptr=val%(*ptr); - } - else - { - std::ostringstream oss; oss << "DataArrayInt::applyRModulus : presence of value <=0 in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents(); - oss << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - declareAsNew(); -} - -/*! - * Modify all elements of \a this array, so that - * an element _x_ becomes val ^ x . - * \param [in] val - the value used to apply pow on all array elements. - * \throw If \a this is not allocated. - * \throw If \a val < 0. - */ -void DataArrayInt::applyPow(int val) -{ - checkAllocated(); - if(val<0) - throw INTERP_KERNEL::Exception("DataArrayInt::applyPow : input pow in < 0 !"); - int *ptr=getPointer(); - std::size_t nbOfElems=getNbOfElems(); - if(val==0) - { - std::fill(ptr,ptr+nbOfElems,1); - return ; - } - for(std::size_t i=0;i=0) - { - int tmp=1; - for(int j=0;j<*ptr;j++) - tmp*=val; - *ptr=tmp; - } - else - { - std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/getNumberOfComponents() << " component #" << i%getNumberOfComponents(); - oss << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - declareAsNew(); -} - -/*! - * Returns a new DataArrayInt which is a minimal partition of elements of \a groups. - * The i-th item of the result array is an ID of a set of elements belonging to a - * unique set of groups, which the i-th element is a part of. This set of elements - * belonging to a unique set of groups is called \a family, so the result array contains - * IDs of families each element belongs to. - * - * \b Example: if we have two groups of elements: \a group1 [0,4] and \a group2 [ 0,1,2 ], - * then there are 3 families: - * - \a family1 (with ID 1) contains element [0] belonging to ( \a group1 + \a group2 ), - * - \a family2 (with ID 2) contains elements [4] belonging to ( \a group1 ), - * - \a family3 (with ID 3) contains element [1,2] belonging to ( \a group2 ),
- * and the result array contains IDs of families [ 1,3,3,0,2 ].
Note a family ID 0 which - * stands for the element #3 which is in none of groups. - * - * \param [in] groups - sequence of groups of element IDs. - * \param [in] newNb - total number of elements; it must be more than max ID of element - * in \a groups. - * \param [out] fidsOfGroups - IDs of families the elements of each group belong to. - * \return DataArrayInt * - a new instance of DataArrayInt containing IDs of families - * each element with ID from range [0, \a newNb ) belongs to. The caller is to - * delete this array using decrRef() as it is no more needed. - * \throw If any element ID in \a groups violates condition ( 0 <= ID < \a newNb ). - */ -DataArrayInt *DataArrayInt::MakePartition(const std::vector& groups, int newNb, std::vector< std::vector >& fidsOfGroups) -{ - std::vector groups2; - for(std::vector::const_iterator it4=groups.begin();it4!=groups.end();it4++) - if(*it4) - groups2.push_back(*it4); - MCAuto ret=DataArrayInt::New(); - ret->alloc(newNb,1); - int *retPtr=ret->getPointer(); - std::fill(retPtr,retPtr+newNb,0); - int fid=1; - for(std::vector::const_iterator iter=groups2.begin();iter!=groups2.end();iter++) - { - const int *ptr=(*iter)->getConstPointer(); - std::size_t nbOfElem=(*iter)->getNbOfElems(); - int sfid=fid; - for(int j=0;j=0 && ptr[i]getName() << "\" in tuple #" << i << " value = " << ptr[i] << " ! Should be in [0," << newNb; - oss << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - if(found) - fid++; - } - } - fidsOfGroups.clear(); - fidsOfGroups.resize(groups2.size()); - int grId=0; - for(std::vector::const_iterator iter=groups2.begin();iter!=groups2.end();iter++,grId++) - { - std::set tmp; - const int *ptr=(*iter)->getConstPointer(); - std::size_t nbOfElem=(*iter)->getNbOfElems(); - for(const int *p=ptr;p!=ptr+nbOfElem;p++) - tmp.insert(retPtr[*p]); - fidsOfGroups[grId].insert(fidsOfGroups[grId].end(),tmp.begin(),tmp.end()); - } - return ret.retn(); -} - -/*! - * Returns a new DataArrayInt which contains all elements of given one-dimensional - * arrays. The result array does not contain any duplicates and its values - * are sorted in ascending order. - * \param [in] arr - sequence of DataArrayInt's to unite. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If any \a arr[i] is not allocated. - * \throw If \a arr[i]->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::BuildUnion(const std::vector& arr) -{ - std::vector a; - for(std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) - if(*it4) - a.push_back(*it4); - for(std::vector::const_iterator it=a.begin();it!=a.end();it++) - { - (*it)->checkAllocated(); - if((*it)->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !"); - } - // - std::set r; - for(std::vector::const_iterator it=a.begin();it!=a.end();it++) - { - const int *pt=(*it)->getConstPointer(); - int nbOfTuples=(*it)->getNumberOfTuples(); - r.insert(pt,pt+nbOfTuples); - } - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)r.size(),1); - std::copy(r.begin(),r.end(),ret->getPointer()); - return ret; -} - -/*! - * Returns a new DataArrayInt which contains elements present in each of given one-dimensional - * arrays. The result array does not contain any duplicates and its values - * are sorted in ascending order. - * \param [in] arr - sequence of DataArrayInt's to intersect. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If any \a arr[i] is not allocated. - * \throw If \a arr[i]->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::BuildIntersection(const std::vector& arr) -{ - std::vector a; - for(std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) - if(*it4) - a.push_back(*it4); - for(std::vector::const_iterator it=a.begin();it!=a.end();it++) - { - (*it)->checkAllocated(); - if((*it)->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !"); - } - // - std::set r; - for(std::vector::const_iterator it=a.begin();it!=a.end();it++) - { - const int *pt=(*it)->getConstPointer(); - int nbOfTuples=(*it)->getNumberOfTuples(); - std::set s1(pt,pt+nbOfTuples); - if(it!=a.begin()) - { - std::set r2; - std::set_intersection(r.begin(),r.end(),s1.begin(),s1.end(),inserter(r2,r2.end())); - r=r2; - } - else - r=s1; - } - DataArrayInt *ret(DataArrayInt::New()); - ret->alloc((int)r.size(),1); - std::copy(r.begin(),r.end(),ret->getPointer()); - return ret; -} - -/// @cond INTERNAL -namespace MEDCouplingImpl -{ - class OpSwitchedOn - { - public: - OpSwitchedOn(int *pt):_pt(pt),_cnt(0) { } - void operator()(const bool& b) { if(b) *_pt++=_cnt; _cnt++; } - private: - int *_pt; - int _cnt; - }; - - class OpSwitchedOff - { - public: - OpSwitchedOff(int *pt):_pt(pt),_cnt(0) { } - void operator()(const bool& b) { if(!b) *_pt++=_cnt; _cnt++; } - private: - int *_pt; - int _cnt; - }; -} -/// @endcond - -/*! - * This method returns the list of ids in ascending mode so that v[id]==true. - */ -DataArrayInt *DataArrayInt::BuildListOfSwitchedOn(const std::vector& v) -{ - int sz((int)std::count(v.begin(),v.end(),true)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn(ret->getPointer())); - return ret.retn(); -} - -/*! - * This method returns the list of ids in ascending mode so that v[id]==false. - */ -DataArrayInt *DataArrayInt::BuildListOfSwitchedOff(const std::vector& v) -{ - int sz((int)std::count(v.begin(),v.end(),false)); - MCAuto ret(DataArrayInt::New()); ret->alloc(sz,1); - std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff(ret->getPointer())); - return ret.retn(); -} - -/*! - * This method allows to put a vector of vector of integer into a more compact data structure (skyline). - * This method is not available into python because no available optimized data structure available to map std::vector< std::vector >. - * - * \param [in] v the input data structure to be translate into skyline format. - * \param [out] data the first element of the skyline format. The user is expected to deal with newly allocated array. - * \param [out] dataIndex the second element of the skyline format. - */ -void DataArrayInt::PutIntoToSkylineFrmt(const std::vector< std::vector >& v, DataArrayInt *& data, DataArrayInt *& dataIndex) -{ - int sz((int)v.size()); - MCAuto ret0(DataArrayInt::New()),ret1(DataArrayInt::New()); - ret1->alloc(sz+1,1); - int *pt(ret1->getPointer()); *pt=0; - for(int i=0;ialloc(ret1->back(),1); - pt=ret0->getPointer(); - for(int i=0;igetNumberOfComponents() != 1. - * \throw If any element \a x of \a this array violates condition ( 0 <= \a x < \a - * nbOfElement ). - */ -DataArrayInt *DataArrayInt::buildComplement(int nbOfElement) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !"); - std::vector tmp(nbOfElement); - const int *pt=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - for(const int *w=pt;w!=pt+nbOfTuples;w++) - if(*w>=0 && *walloc(nbOfRetVal,1); - int j=0; - int *retPtr=ret->getPointer(); - for(int i=0;igetNumberOfComponents() != 1. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \sa DataArrayInt::buildSubstractionOptimized() - */ -DataArrayInt *DataArrayInt::buildSubstraction(const DataArrayInt *other) const -{ - if(!other) - throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !"); - checkAllocated(); - other->checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !"); - if(other->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !"); - const int *pt=getConstPointer(); - int nbOfTuples=getNumberOfTuples(); - std::set s1(pt,pt+nbOfTuples); - pt=other->getConstPointer(); - nbOfTuples=other->getNumberOfTuples(); - std::set s2(pt,pt+nbOfTuples); - std::vector r; - std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector >(r)); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)r.size(),1); - std::copy(r.begin(),r.end(),ret->getPointer()); - return ret; -} - -/*! - * \a this is expected to have one component and to be sorted ascendingly (as for \a other). - * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead. - * - * \param [in] other an array with one component and expected to be sorted ascendingly. - * \ret list of ids in \a this but not in \a other. - * \sa DataArrayInt::buildSubstraction - */ -DataArrayInt *DataArrayInt::buildSubstractionOptimized(const DataArrayInt *other) const -{ - static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !"; - if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !"); - checkAllocated(); other->checkAllocated(); - if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG); - if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG); - const int *pt1Bg(begin()),*pt1End(end()),*pt2Bg(other->begin()),*pt2End(other->end()); - const int *work1(pt1Bg),*work2(pt2Bg); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(;work1!=pt1End;work1++) - { - if(work2!=pt2End && *work1==*work2) - work2++; - else - ret->pushBackSilent(*work1); - } - return ret.retn(); -} - - -/*! - * Returns a new DataArrayInt which contains all elements of \a this and a given - * one-dimensional arrays. The result array does not contain any duplicates - * and its values are sorted in ascending order. - * \param [in] other - an array to unite with \a this one. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this or \a other is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If \a other->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::buildUnion(const DataArrayInt *other) const -{ - std::vectorarrs(2); - arrs[0]=this; arrs[1]=other; - return BuildUnion(arrs); -} - - -/*! - * Returns a new DataArrayInt which contains elements present in both \a this and a given - * one-dimensional arrays. The result array does not contain any duplicates - * and its values are sorted in ascending order. - * \param [in] other - an array to intersect with \a this one. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a this or \a other is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If \a other->getNumberOfComponents() != 1. - */ -DataArrayInt *DataArrayInt::buildIntersection(const DataArrayInt *other) const -{ - std::vectorarrs(2); - arrs[0]=this; arrs[1]=other; - return BuildIntersection(arrs); -} - -/*! - * This method can be applied on allocated with one component DataArrayInt instance. - * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance. - * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19] - * - * \return a newly allocated array that contain the result of the unique operation applied on \a this. - * \throw if \a this is not allocated or if \a this has not exactly one component. - * \sa DataArrayInt::buildUniqueNotSorted - */ -DataArrayInt *DataArrayInt::buildUnique() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); - MCAuto tmp=deepCopy(); - int *data=tmp->getPointer(); - int *last=std::unique(data,data+nbOfTuples); - MCAuto ret=DataArrayInt::New(); - ret->alloc(std::distance(data,last),1); - std::copy(data,last,ret->getPointer()); - return ret.retn(); -} - -/*! - * This method can be applied on allocated with one component DataArrayInt instance. - * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted. - * - * \return a newly allocated array that contain the result of the unique operation applied on \a this. - * - * \throw if \a this is not allocated or if \a this has not exactly one component. - * - * \sa DataArrayInt::buildUnique - */ -DataArrayInt *DataArrayInt::buildUniqueNotSorted() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !"); - int minVal,maxVal; - getMinMaxValues(minVal,maxVal); - std::vector b(maxVal-minVal+1,false); - const int *ptBg(begin()),*endBg(end()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(const int *pt=ptBg;pt!=endBg;pt++) - { - if(!b[*pt-minVal]) - { - ret->pushBackSilent(*pt); - b[*pt-minVal]=true; - } - } - ret->copyStringInfoFrom(*this); - return ret.retn(); -} - -/*! - * Returns a new DataArrayInt which contains size of every of groups described by \a this - * "index" array. Such "index" array is returned for example by - * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity - * "MEDCouplingUMesh::buildDescendingConnectivity" and - * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex - * "MEDCouplingUMesh::getNodalConnectivityIndex" etc. - * This method performs the reverse operation of DataArrayInt::computeOffsetsFull. - * \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples - * equals to \a this->getNumberOfComponents() - 1, and number of components is 1. - * The caller is to delete this array using decrRef() as it is no more needed. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If \a this->getNumberOfTuples() < 2. - * - * \b Example:
- * - this contains [1,3,6,7,7,9,15] - * - result array contains [2,3,1,0,2,6], - * where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc. - * - * \sa DataArrayInt::computeOffsetsFull - */ -DataArrayInt *DataArrayInt::deltaShiftIndex() const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); - if(nbOfTuples<2) - throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !"); - const int *ptr=getConstPointer(); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc(nbOfTuples-1,1); - int *out=ret->getPointer(); - std::transform(ptr+1,ptr+nbOfTuples,ptr,out,std::minus()); - return ret; -} - -/*! - * Modifies \a this one-dimensional array so that value of each element \a x - * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$. - * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples - * and components remains the same.
- * This method is useful for allToAllV in MPI with contiguous policy. This method - * differs from computeOffsetsFull() in that the number of tuples is \b not changed by - * this one. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * - * \b Example:
- * - Before \a this contains [3,5,1,2,0,8] - * - After \a this contains [0,3,8,9,11,11]
- * Note that the last element 19 = 11 + 8 is missing because size of \a this - * array is retained and thus there is no space to store the last element. - */ -void DataArrayInt::computeOffsets() -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); - if(nbOfTuples==0) - return ; - int *work=getPointer(); - int tmp=work[0]; - work[0]=0; - for(int i=1;i0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number - * components remains the same and number of tuples is inceamented by one.
- * This method is useful for allToAllV in MPI with contiguous policy. This method - * differs from computeOffsets() in that the number of tuples is changed by this one. - * This method performs the reverse operation of DataArrayInt::deltaShiftIndex. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * - * \b Example:
- * - Before \a this contains [3,5,1,2,0,8] - * - After \a this contains [0,3,8,9,11,11,19]
- * \sa DataArrayInt::deltaShiftIndex - */ -void DataArrayInt::computeOffsetsFull() -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !"); - int nbOfTuples=getNumberOfTuples(); - int *ret=(int *)malloc((nbOfTuples+1)*sizeof(int)); - const int *work=getConstPointer(); - ret[0]=0; - for(int i=0;igetNumberOfComponents() ranges, all ids in \a listOfIds - * filling completely one of the ranges in \a this. - * - * \param [in] listOfIds a list of ids that has to be sorted ascendingly. - * \param [out] rangeIdsFetched the range ids fetched - * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So - * \a idsInInputListThatFetch is a part of input \a listOfIds. - * - * \sa DataArrayInt::computeOffsetsFull - * - * \b Example:
- * - \a this : [0,3,7,9,15,18] - * - \a listOfIds contains [0,1,2,3,7,8,15,16,17] - * - \a rangeIdsFetched result array: [0,2,4] - * - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17] - * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch. - *
- */ -void DataArrayInt::findIdsRangesInListOfIds(const DataArrayInt *listOfIds, DataArrayInt *& rangeIdsFetched, DataArrayInt *& idsInInputListThatFetch) const -{ - if(!listOfIds) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !"); - listOfIds->checkAllocated(); checkAllocated(); - if(listOfIds->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !"); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !"); - MCAuto ret0=DataArrayInt::New(); ret0->alloc(0,1); - MCAuto ret1=DataArrayInt::New(); ret1->alloc(0,1); - const int *tupEnd(listOfIds->end()),*offBg(begin()),*offEnd(end()-1); - const int *tupPtr(listOfIds->begin()),*offPtr(offBg); - while(tupPtr!=tupEnd && offPtr!=offEnd) - { - if(*tupPtr==*offPtr) - { - int i=offPtr[0]; - while(ipushBackSilent((int)std::distance(offBg,offPtr)); - ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr); - offPtr++; - } - } - else - { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; } - } - rangeIdsFetched=ret0.retn(); - idsInInputListThatFetch=ret1.retn(); -} - -/*! - * Returns a new DataArrayInt whose contents is computed from that of \a this and \a - * offsets arrays as follows. \a offsets is a one-dimensional array considered as an - * "index" array of a "iota" array, thus, whose each element gives an index of a group - * beginning within the "iota" array. And \a this is a one-dimensional array - * considered as a selector of groups described by \a offsets to include into the result array. - * \throw If \a offsets is NULL. - * \throw If \a offsets is not allocated. - * \throw If \a offsets->getNumberOfComponents() != 1. - * \throw If \a offsets is not monotonically increasing. - * \throw If \a this is not allocated. - * \throw If \a this->getNumberOfComponents() != 1. - * \throw If any element of \a this is not a valid index for \a offsets array. - * - * \b Example:
- * - \a this: [0,2,3] - * - \a offsets: [0,3,6,10,14,20] - * - result array: [0,1,2,6,7,8,9,10,11,12,13] ==
- * \c range(0,3) + \c range(6,10) + \c range(10,14) ==
- * \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) + - * \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) + - * \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ]) - */ -DataArrayInt *DataArrayInt::buildExplicitArrByRanges(const DataArrayInt *offsets) const -{ - if(!offsets) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !"); - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !"); - offsets->checkAllocated(); - if(offsets->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !"); - int othNbTuples=offsets->getNumberOfTuples()-1; - int nbOfTuples=getNumberOfTuples(); - int retNbOftuples=0; - const int *work=getConstPointer(); - const int *offPtr=offsets->getConstPointer(); - for(int i=0;i=0 && val=0) - retNbOftuples+=delta; - else - { - std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - else - { - std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val; - oss << " whereas offsets array is of size " << othNbTuples+1 << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - MCAuto ret=DataArrayInt::New(); - ret->alloc(retNbOftuples,1); - int *retPtr=ret->getPointer(); - for(int i=0;igetNumberOfComponents() != 1. - * \throw If \a this->getNumberOfTuples() == 0. - * \throw If \a this is not monotonically increasing. - * \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this. - * - * \b Example:
- * - \a bg , \a stop and \a step : (0,5,2) - * - \a this: [0,3,6,10,14,20] - * - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] ==
- */ -DataArrayInt *DataArrayInt::buildExplicitArrOfSliceOnScaledArr(int bg, int stop, int step) const -{ - if(!isAllocated()) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !"); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !"); - int nbOfTuples(getNumberOfTuples()); - if(nbOfTuples==0) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !"); - const int *ids(begin()); - int nbOfEltsInSlc(GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr")),sz(0),pos(bg); - for(int i=0;i=0 && pos ret(DataArrayInt::New()); ret->alloc(sz,1); - int *retPtr(ret->getPointer()); - pos=bg; - for(int i=0;igetIJ(i,0) and put the result - * in tuple **i** of returned DataArrayInt. - * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range. - * - * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] - * The return DataArrayInt will contain : **[0,4,1,2,2,3]** - * - * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is - * for lower value included and 2nd component is the upper value of corresponding range **excluded**. - * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception - * is thrown if no ranges in \a ranges contains value in \a this. - * - * \sa DataArrayInt::findIdInRangeForEachTuple - */ -DataArrayInt *DataArrayInt::findRangeIdForEachTuple(const DataArrayInt *ranges) const -{ - if(!ranges) - throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !"); - if(ranges->getNumberOfComponents()!=2) - throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !"); - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !"); - int nbTuples=getNumberOfTuples(); - MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,1); - int nbOfRanges=ranges->getNumberOfTuples(); - const int *rangesPtr=ranges->getConstPointer(); - int *retPtr=ret->getPointer(); - const int *inPtr=getConstPointer(); - for(int i=0;i=rangesPtr[2*j] && valgetIJ(i,0) and put the result - * in tuple **i** of returned DataArrayInt. - * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range. - * - * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] - * The return DataArrayInt will contain : **[1,2,4,0,2,2]** - * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method. - * - * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is - * for lower value included and 2nd component is the upper value of corresponding range **excluded**. - * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception - * is thrown if no ranges in \a ranges contains value in \a this. - * \sa DataArrayInt::findRangeIdForEachTuple - */ -DataArrayInt *DataArrayInt::findIdInRangeForEachTuple(const DataArrayInt *ranges) const -{ - if(!ranges) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !"); - if(ranges->getNumberOfComponents()!=2) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !"); - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !"); - int nbTuples=getNumberOfTuples(); - MCAuto ret=DataArrayInt::New(); ret->alloc(nbTuples,1); - int nbOfRanges=ranges->getNumberOfTuples(); - const int *rangesPtr=ranges->getConstPointer(); - int *retPtr=ret->getPointer(); - const int *inPtr=getConstPointer(); - for(int i=0;i=rangesPtr[2*j] && valgetIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0). - * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified ! - * If this method has correctly worked, \a this will be able to be considered as a linked list. - * This method does nothing if number of tuples is lower of equal to 1. - * - * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internally the connectivity without any coordinates consideration. - * - * \sa MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::fromLinkedListOfPairToList - */ -void DataArrayInt::sortEachPairToMakeALinkedList() -{ - checkAllocated(); - if(getNumberOfComponents()!=2) - throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !"); - int nbOfTuples(getNumberOfTuples()); - if(nbOfTuples<=1) - return ; - int *conn(getPointer()); - for(int i=1;i1) - { - if(conn[2]==conn[3]) - { - std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0]) - std::swap(conn[2],conn[3]); - //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0]) - if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0]) - { - std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - else - { - if(conn[0]==conn[1] || conn[2]==conn[3]) - throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !"); - int tmp[4]; - std::set s; - s.insert(conn,conn+4); - if(s.size()!=3) - throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !"); - if(std::count(conn,conn+4,conn[0])==2) - { - tmp[0]=conn[1]; - tmp[1]=conn[0]; - tmp[2]=conn[0]; - if(conn[2]==conn[0]) - { tmp[3]=conn[3]; } - else - { tmp[3]=conn[2];} - std::copy(tmp,tmp+4,conn); - } - else - {//here we are sure to have (std::count(conn,conn+4,conn[1])==2) - if(conn[1]==conn[3]) - std::swap(conn[2],conn[3]); - } - } - } -} - -/*! - * \a this is expected to be a correctly linked list of pairs. - * - * \sa DataArrayInt::sortEachPairToMakeALinkedList - */ -MCAuto DataArrayInt::fromLinkedListOfPairToList() const -{ - checkAllocated(); - checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components"); - int nbTuples(getNumberOfTuples()); - if(nbTuples<1) - throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !"); - MCAuto ret(DataArrayInt::New()); ret->alloc(nbTuples+1,1); - const int *thisPtr(begin()); - int *retPtr(ret->getPointer()); - retPtr[0]=thisPtr[0]; - for(int i=0;i ret; - ret.insert(begin(),end()); - MCAuto ret2=DataArrayInt::New(); ret2->alloc((int)ret.size(),1); - std::copy(ret.begin(),ret.end(),ret2->getPointer()); - return ret2.retn(); -} - -/*! - * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of - * them it tells which tuple id have this id. - * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ). - * This method returns two arrays having same size. - * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method. - * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]] - */ -std::vector DataArrayInt::partitionByDifferentValues(std::vector& differentIds) const -{ - checkAllocated(); - if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !"); - int id=0; - std::map m,m2,m3; - for(const int *w=begin();w!=end();w++) - m[*w]++; - differentIds.resize(m.size()); - std::vector ret(m.size()); - std::vector retPtr(m.size()); - for(std::map::const_iterator it=m.begin();it!=m.end();it++,id++) - { - m2[(*it).first]=id; - ret[id]=DataArrayInt::New(); - ret[id]->alloc((*it).second,1); - retPtr[id]=ret[id]->getPointer(); - differentIds[id]=(*it).first; - } - id=0; - for(const int *w=begin();w!=end();w++,id++) - { - retPtr[m2[*w]][m3[*w]++]=id; - } - return ret; -} - -/*! - * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each). - * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible. - * - * \param [in] nbOfSlices - number of slices expected. - * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks. - * - * \sa DataArray::GetSlice - * \throw If \a this is not allocated or not with exactly one component. - * \throw If an element in \a this if < 0. - */ -std::vector< std::pair > DataArrayInt::splitInBalancedSlices(int nbOfSlices) const -{ - if(!isAllocated() || getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !"); - if(nbOfSlices<=0) - throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !"); - int sum(accumulate(0)),nbOfTuples(getNumberOfTuples()); - int sumPerSlc(sum/nbOfSlices),pos(0); - const int *w(begin()); - std::vector< std::pair > ret(nbOfSlices); - for(int i=0;i p(pos,-1); - int locSum(0); - while(locSumgetNumberOfTuples() != \a a2->getNumberOfTuples() and - * \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and - * none of them has number of tuples or components equal to 1. - */ -DataArrayInt *DataArrayInt::Modulus(const DataArrayInt *a1, const DataArrayInt *a2) -{ - if(!a1 || !a2) - throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !"); - int nbOfTuple1=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp1=a1->getNumberOfComponents(); - int nbOfComp2=a2->getNumberOfComponents(); - if(nbOfTuple2==nbOfTuple1) - { - if(nbOfComp1==nbOfComp2) - { - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuple2,nbOfComp1); - std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus()); - ret->copyStringInfoFrom(*a1); - return ret.retn(); - } - else if(nbOfComp2==1) - { - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuple1,nbOfComp1); - const int *a2Ptr=a2->getConstPointer(); - const int *a1Ptr=a1->getConstPointer(); - int *res=ret->getPointer(); - for(int i=0;i(),a2Ptr[i])); - ret->copyStringInfoFrom(*a1); - return ret.retn(); - } - else - { - a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !"); - return 0; - } - } - else if(nbOfTuple2==1) - { - a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !"); - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuple1,nbOfComp1); - const int *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); - int *pt=ret->getPointer(); - for(int i=0;i()); - ret->copyStringInfoFrom(*a1); - return ret.retn(); - } - else - { - a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Modulus !");//will always throw an exception - return 0; - } -} - -/*! - * Modify \a this array so that each value becomes a modulus of division of this value by - * a value of another DataArrayInt. There are 3 valid cases. - * 1. The arrays have same number of tuples and components. Then each value of - * \a this array is divided by the corresponding value of \a other one, i.e.: - * _a_ [ i, j ] %= _other_ [ i, j ]. - * 2. The arrays have same number of tuples and \a other array has one component. Then - * _a_ [ i, j ] %= _other_ [ i, 0 ]. - * 3. The arrays have same number of components and \a other array has one tuple. Then - * _a_ [ i, j ] %= _a2_ [ 0, j ]. - * - * \warning No check of division by zero is performed! - * \param [in] other - a divisor array. - * \throw If \a other is NULL. - * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() and - * \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and - * \a other has number of both tuples and components not equal to 1. - */ -void DataArrayInt::modulusEqual(const DataArrayInt *other) -{ - if(!other) - throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !"); - const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !"; - checkAllocated(); other->checkAllocated(); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); - if(nbOfTuple==nbOfTuple2) - { - if(nbOfComp==nbOfComp2) - { - std::transform(begin(),end(),other->begin(),getPointer(),std::modulus()); - } - else if(nbOfComp2==1) - { - if(nbOfComp2==nbOfComp) - { - int *ptr=getPointer(); - const int *ptrc=other->getConstPointer(); - for(int i=0;i(),*ptrc++)); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else if(nbOfTuple2==1) - { - int *ptr=getPointer(); - const int *ptrc=other->getConstPointer(); - for(int i=0;i()); - } - else - throw INTERP_KERNEL::Exception(msg); - declareAsNew(); -} - -/*! - * Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3 - * valid cases. - * - * \param [in] a1 - an array to pow up. - * \param [in] a2 - another array to sum up. - * \return DataArrayInt * - the new instance of DataArrayInt. - * The caller is to delete this result array using decrRef() as it is no more - * needed. - * \throw If either \a a1 or \a a2 is NULL. - * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() - * \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1. - * \throw If there is a negative value in \a a2. - */ -DataArrayInt *DataArrayInt::Pow(const DataArrayInt *a1, const DataArrayInt *a2) -{ - if(!a1 || !a2) - throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !"); - int nbOfTuple=a1->getNumberOfTuples(); - int nbOfTuple2=a2->getNumberOfTuples(); - int nbOfComp=a1->getNumberOfComponents(); - int nbOfComp2=a2->getNumberOfComponents(); - if(nbOfTuple!=nbOfTuple2) - throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of tuples mismatches !"); - if(nbOfComp!=1 || nbOfComp2!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !"); - MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuple,1); - const int *ptr1(a1->begin()),*ptr2(a2->begin()); - int *ptr=ret->getPointer(); - for(int i=0;i=0) - { - int tmp=1; - for(int j=0;j<*ptr2;j++) - tmp*=*ptr1; - *ptr=tmp; - } - else - { - std::ostringstream oss; oss << "DataArrayInt::Pow : on tuple #" << i << " of a2 value is < 0 (" << *ptr2 << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - return ret.retn(); -} - -/*! - * Apply pow on values of another DataArrayInt to values of \a this one. - * - * \param [in] other - an array to pow to \a this one. - * \throw If \a other is NULL. - * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() - * \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1 - * \throw If there is a negative value in \a other. - */ -void DataArrayInt::powEqual(const DataArrayInt *other) -{ - if(!other) - throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !"); - int nbOfTuple=getNumberOfTuples(); - int nbOfTuple2=other->getNumberOfTuples(); - int nbOfComp=getNumberOfComponents(); - int nbOfComp2=other->getNumberOfComponents(); - if(nbOfTuple!=nbOfTuple2) - throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !"); - if(nbOfComp!=1 || nbOfComp2!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !"); - int *ptr=getPointer(); - const int *ptrc=other->begin(); - for(int i=0;i=0) - { - int tmp=1; - for(int j=0;j<*ptrc;j++) - tmp*=*ptr; - *ptr=tmp; - } - else - { - std::ostringstream oss; oss << "DataArrayInt::powEqual : on tuple #" << i << " of other value is < 0 (" << *ptrc << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - declareAsNew(); -} - -/*! - * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn - * (\ref numbering-indirect). - * This method returns the result of the extraction ( specified by a set of ids in [\b idsOfSelectBg , \b idsOfSelectEnd ) ). - * The selection of extraction is done standardly in new2old format. - * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut). - * - * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included) - * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded) - * \param [in] arrIn arr origin array from which the extraction will be done. - * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn - * \param [out] arrOut the resulting array - * \param [out] arrIndexOut the index array of the resulting array \b arrOut - * \sa DataArrayInt::ExtractFromIndexedArraysSlice - */ -void DataArrayInt::ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) -{ - if(!arrIn || !arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input pointer is NULL !"); - 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 sz=std::distance(idsOfSelectBg,idsOfSelectEnd); - const int *arrInPtr=arrIn->begin(); - const int *arrIndxPtr=arrIndxIn->begin(); - int 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 !"); - int maxSizeOfArr=arrIn->getNumberOfTuples(); - MCAuto arro=DataArrayInt::New(); - MCAuto arrIo=DataArrayInt::New(); - arrIo->alloc((int)(sz+1),1); - const int *idsIt=idsOfSelectBg; - int *work=arrIo->getPointer(); - *work++=0; - int lgth=0; - for(std::size_t i=0;i=0 && *idsIt=work[-1]) - *work=lgth; - else - { - std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " and at this pos arrIndxIn[" << *idsIt; - oss << "+1]-arrIndxIn[" << *idsIt << "] < 0 ! The input index array is bugged !"; - throw INTERP_KERNEL::Exception(oss.str()); - } - } - arro->alloc(lgth,1); - work=arro->getPointer(); - idsIt=idsOfSelectBg; - for(std::size_t i=0;i=0 && arrIndxPtr[*idsIt+1]<=maxSizeOfArr) - work=std::copy(arrInPtr+arrIndxPtr[*idsIt],arrInPtr+arrIndxPtr[*idsIt+1],work); - else - { - std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " arrIndx[" << *idsIt << "] must be >= 0 and arrIndx["; - oss << *idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; - throw INTERP_KERNEL::Exception(oss.str()); - } - } - arrOut=arro.retn(); - arrIndexOut=arrIo.retn(); -} - -/*! - * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn - * (\ref numbering-indirect). - * This method returns the result of the extraction ( specified by a set of ids with a slice given by \a idsOfSelectStart, \a idsOfSelectStop and \a idsOfSelectStep ). - * The selection of extraction is done standardly in new2old format. - * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut). - * - * \param [in] idsOfSelectStart begin of set of ids of the input extraction (included) - * \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded) - * \param [in] idsOfSelectStep - * \param [in] arrIn arr origin array from which the extraction will be done. - * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn - * \param [out] arrOut the resulting array - * \param [out] arrIndexOut the index array of the resulting array \b arrOut - * \sa DataArrayInt::ExtractFromIndexedArrays - */ -void DataArrayInt::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) -{ - if(!arrIn || !arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input pointer is NULL !"); - arrIn->checkAllocated(); arrIndxIn->checkAllocated(); - if(arrIn->getNumberOfComponents()!=1 || arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input arrays must have exactly one component !"); - int sz=DataArrayInt::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); - const int *arrInPtr=arrIn->begin(); - const int *arrIndxPtr=arrIndxIn->begin(); - int 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 !"); - int maxSizeOfArr=arrIn->getNumberOfTuples(); - MCAuto arro=DataArrayInt::New(); - MCAuto arrIo=DataArrayInt::New(); - arrIo->alloc((int)(sz+1),1); - int idsIt=idsOfSelectStart; - int *work=arrIo->getPointer(); - *work++=0; - int lgth=0; - for(int i=0;i=0 && idsIt=work[-1]) - *work=lgth; - else - { - std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt; - oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !"; - throw INTERP_KERNEL::Exception(oss.str()); - } - } - arro->alloc(lgth,1); - work=arro->getPointer(); - idsIt=idsOfSelectStart; - for(int i=0;i=0 && arrIndxPtr[idsIt+1]<=maxSizeOfArr) - work=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],work); - else - { - std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx["; - oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; - throw INTERP_KERNEL::Exception(oss.str()); - } - } - arrOut=arro.retn(); - arrIndexOut=arrIo.retn(); -} - -/*! - * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn. - * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for - * cellIds \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex). - * This method is an generalization of MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays. - * - * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included) - * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded) - * \param [in] arrIn arr origin array from which the extraction will be done. - * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn - * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg, \b idsOfSelectEnd ) - * \param [in] srcArrIndex index array of \b srcArr - * \param [out] arrOut the resulting array - * \param [out] arrIndexOut the index array of the resulting array \b arrOut - * - * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx - */ -void DataArrayInt::SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut) -{ - if(arrIn==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : presence of null pointer in input parameter !"); - MCAuto arro=DataArrayInt::New(); - MCAuto arrIo=DataArrayInt::New(); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; - std::vector v(nbOfTuples,true); - int offset=0; - const int *arrIndxInPtr=arrIndxIn->begin(); - const int *srcArrIndexPtr=srcArrIndex->begin(); - for(const int *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++) - { - if(*it>=0 && *itbegin(); - arrIo->alloc(nbOfTuples+1,1); - arro->alloc(arrIn->getNumberOfTuples()+offset,1); - const int *arrInPtr=arrIn->begin(); - const int *srcArrPtr=srcArr->begin(); - int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; - int *arroPtr=arro->getPointer(); - for(int ii=0;ii arro=DataArrayInt::New(); - MCAuto arrIo=DataArrayInt::New(); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; - int offset=0; - const int *arrIndxInPtr=arrIndxIn->begin(); - const int *srcArrIndexPtr=srcArrIndex->begin(); - int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : "); - int it=start; - for(int i=0;i=0 && itbegin(); - arrIo->alloc(nbOfTuples+1,1); - arro->alloc(arrIn->getNumberOfTuples()+offset,1); - const int *arrInPtr=arrIn->begin(); - const int *srcArrPtr=srcArr->begin(); - int *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; - int *arroPtr=arro->getPointer(); - for(int ii=0;iigetNumberOfTuples()-1; - const int *arrIndxInPtr=arrIndxIn->begin(); - const int *srcArrIndexPtr=srcArrIndex->begin(); - int *arrInOutPtr=arrInOut->getPointer(); - const int *srcArrPtr=srcArr->begin(); - for(const int *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++) - { - if(*it>=0 && *itgetNumberOfTuples()-1) removal process will be performed in the following range [arr+arrIndx[i]+offsetForRemoval,arr+arr[i+1]) - * \return true if \b arr and \b arrIndx have been modified, false if not. - */ -bool DataArrayInt::RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const int *idsToRemoveEnd, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval) -{ - if(!arrIndx || !arr) - throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : some input arrays are empty !"); - if(offsetForRemoval<0) - throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !"); - std::set s(idsToRemoveBg,idsToRemoveEnd); - int nbOfGrps=arrIndx->getNumberOfTuples()-1; - int *arrIPtr=arrIndx->getPointer(); - *arrIPtr++=0; - int previousArrI=0; - const int *arrPtr=arr->begin(); - std::vector arrOut;//no utility to switch to DataArrayInt because copy always needed - for(int i=0;ioffsetForRemoval) - { - for(const int *work=arrPtr+previousArrI+offsetForRemoval;work!=arrPtr+*arrIPtr;work++) - { - if(s.find(*work)==s.end()) - arrOut.push_back(*work); - } - } - previousArrI=*arrIPtr; - *arrIPtr=(int)arrOut.size(); - } - if(arr->getNumberOfTuples()==arrOut.size()) - return false; - arr->alloc((int)arrOut.size(),1); - std::copy(arrOut.begin(),arrOut.end(),arr->getPointer()); - return true; -} - -/*! - * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn. - * This method is an specialization of MEDCouplingUMesh::SetPartOfIndexedArrays in the case of assignment do not modify the index in \b arrIndxIn. - * - * \param [in] start begin of set of ids of the input extraction (included) - * \param [in] end end of set of ids of the input extraction (excluded) - * \param [in] step step of the set of ids in range mode. - * \param [in,out] arrInOut arr origin array from which the extraction will be done. - * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn - * \param [in] srcArr input array that will be used as source of copy for ids in [\b idsOfSelectBg, \b idsOfSelectEnd) - * \param [in] srcArrIndex index array of \b srcArr - * - * \sa DataArrayInt::SetPartOfIndexedArraysSlice DataArrayInt::SetPartOfIndexedArraysSameIdx - */ -void DataArrayInt::SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) -{ - if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; - const int *arrIndxInPtr=arrIndxIn->begin(); - const int *srcArrIndexPtr=srcArrIndex->begin(); - int *arrInOutPtr=arrInOut->getPointer(); - const int *srcArrPtr=srcArr->begin(); - int nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : "); - int it=start; - for(int i=0;i=0 && it m; - for(int *workPt=work;workPt!=work+sz;workPt++) - m[*workPt]=(int)std::distance(work,workPt); - int *iter2=ret; - for(const int *iter=start;iter!=end;iter++,iter2++) - *iter2=m[*iter]; - delete [] work; - return ret; -} - -/*! - * Returns a new DataArrayInt containing an arithmetic progression - * that is equal to the sequence returned by Python \c range(\a begin,\a end,\a step ) - * function. - * \param [in] begin - the start value of the result sequence. - * \param [in] end - limiting value, so that every value of the result array is less than - * \a end. - * \param [in] step - specifies the increment or decrement. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this - * array using decrRef() as it is no more needed. - * \throw If \a step == 0. - * \throw If \a end < \a begin && \a step > 0. - * \throw If \a end > \a begin && \a step < 0. - */ -DataArrayInt *DataArrayInt::Range(int begin, int end, int step) -{ - int nbOfTuples=GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range"); - MCAuto ret=DataArrayInt::New(); - ret->alloc(nbOfTuples,1); - int *ptr=ret->getPointer(); - if(step>0) - { - for(int i=begin;iend;i+=step,ptr++) - *ptr=i; - } - return ret.retn(); -} - -/*! - * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. - * Server side. - */ -void DataArrayInt::getTinySerializationIntInformation(std::vector& tinyInfo) const -{ - tinyInfo.resize(2); - if(isAllocated()) - { - tinyInfo[0]=getNumberOfTuples(); - tinyInfo[1]=getNumberOfComponents(); - } - else - { - tinyInfo[0]=-1; - tinyInfo[1]=-1; - } -} - -/*! - * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. - * Server side. - */ -void DataArrayInt::getTinySerializationStrInformation(std::vector& tinyInfo) const -{ - if(isAllocated()) - { - int nbOfCompo=getNumberOfComponents(); - tinyInfo.resize(nbOfCompo+1); - tinyInfo[0]=getName(); - for(int i=0;i& tinyInfoI) -{ - int nbOfTuple=tinyInfoI[0]; - int nbOfComp=tinyInfoI[1]; - if(nbOfTuple!=-1 || nbOfComp!=-1) - { - alloc(nbOfTuple,nbOfComp); - return true; - } - return false; -} - -/*! - * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. - * This method returns if a feeding is needed. - */ -void DataArrayInt::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) -{ - setName(tinyInfoS[0]); - if(isAllocated()) - { - int nbOfCompo=tinyInfoI[1]; - for(int i=0;i(da) -{ -} - -DataArrayInt32Tuple::DataArrayInt32Tuple(int *pt, int nbOfComp):DataArrayTuple(pt,nbOfComp) -{ -} - -std::string DataArrayIntTuple::repr() const -{ - std::ostringstream oss; oss << "("; - for(int i=0;i<_nb_of_compo-1;i++) - oss << _pt[i] << ", "; - oss << _pt[_nb_of_compo-1] << ")"; - return oss.str(); -} - -int DataArrayIntTuple::intValue() const -{ - return this->zeValue(); -} - -/*! - * This method returns a newly allocated instance the caller should dealed with by a MEDCoupling::DataArrayInt::decrRef. - * This method performs \b no copy of data. The content is only referenced using MEDCoupling::DataArrayInt::useArray with ownership set to \b false. - * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or - * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. - */ -DataArrayInt *DataArrayIntTuple::buildDAInt(int nbOfTuples, int nbOfCompo) const -{ - return this->buildDA(nbOfTuples,nbOfCompo); -} DataArrayInt64 *DataArrayInt64::deepCopy() const { diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx old mode 100644 new mode 100755 index 15038c267..549f3ca9b --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -82,15 +82,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; } MEDCOUPLING_EXPORT T& operator[](std::size_t id) { return _pointer.getPointer()[id]; } MEDCOUPLING_EXPORT bool isEqual(const MemArray& other, T prec, std::string& reason) const; - MEDCOUPLING_EXPORT void repr(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT bool reprHeader(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprZip(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprNotTooLong(int sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void repr(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT bool reprHeader(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprZip(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprNotTooLong(mcIdType sl, std::ostream& stream) const; MEDCOUPLING_EXPORT void fillWithValue(const T& val); - MEDCOUPLING_EXPORT T *fromNoInterlace(int nbOfComp) const; - MEDCOUPLING_EXPORT T *toNoInterlace(int nbOfComp) const; + MEDCOUPLING_EXPORT T *fromNoInterlace(std::size_t nbOfComp) const; + MEDCOUPLING_EXPORT T *toNoInterlace(std::size_t nbOfComp) const; MEDCOUPLING_EXPORT void sort(bool asc); - MEDCOUPLING_EXPORT void reverse(int nbOfComp); + MEDCOUPLING_EXPORT void reverse(std::size_t nbOfComp); MEDCOUPLING_EXPORT void alloc(std::size_t nbOfElements); MEDCOUPLING_EXPORT void reserve(std::size_t newNbOfElements); MEDCOUPLING_EXPORT void reAlloc(std::size_t newNbOfElements); @@ -125,7 +125,15 @@ namespace MEDCoupling void *_param_for_deallocator; }; - class DataArrayInt32; + template class DataArrayTools + { + public: + MEDCOUPLING_EXPORT static void GetSlice(T start, T stop, T step, mcIdType sliceId, mcIdType nbOfSlices, T& startSlice, T& stopSlice); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBES(T begin, T end, T step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBESRelative(T begin, T end, T step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(T value, T begin, T end, T step); + }; + class DataArrayByte; class DataArray : public RefCountObject, public TimeLabel @@ -135,8 +143,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; MEDCOUPLING_EXPORT void setName(const std::string& name); MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other); - MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); - MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); + MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); + MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const; MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const; MEDCOUPLING_EXPORT std::string cppRepr(const std::string& varName) const; @@ -147,45 +155,45 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector& info); MEDCOUPLING_EXPORT std::vector getVarsOnComponent() const; MEDCOUPLING_EXPORT std::vector getUnitsOnComponent() const; - MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const; - MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const; - MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const; - MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info); + MEDCOUPLING_EXPORT std::string getInfoOnComponent(std::size_t i) const; + MEDCOUPLING_EXPORT std::string getVarOnComponent(std::size_t i) const; + MEDCOUPLING_EXPORT std::string getUnitOnComponent(std::size_t i) const; + MEDCOUPLING_EXPORT void setInfoOnComponent(std::size_t i, const std::string& info); MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const { return _info_on_compo.size(); } - MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); MEDCOUPLING_EXPORT virtual void *getVoidStarPointer() = 0; MEDCOUPLING_EXPORT virtual DataArray *deepCopy() const = 0; MEDCOUPLING_EXPORT virtual DataArray *buildNewEmptyInstance() const = 0; MEDCOUPLING_EXPORT virtual bool isAllocated() const = 0; MEDCOUPLING_EXPORT virtual void checkAllocated() const = 0; MEDCOUPLING_EXPORT virtual void desallocate() = 0; - MEDCOUPLING_EXPORT virtual std::size_t getNumberOfTuples() const = 0; - MEDCOUPLING_EXPORT virtual std::size_t getNbOfElems() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfTuples() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNbOfElems() const = 0; MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const = 0; MEDCOUPLING_EXPORT virtual void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) = 0; MEDCOUPLING_EXPORT virtual void reAlloc(std::size_t newNbOfTuple) = 0; - MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) = 0; - MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) = 0; - MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec) = 0; - MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector >& ranges) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0; - MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0; - MEDCOUPLING_EXPORT virtual void circularPermutation(int nbOfShift=1) = 0; - MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(int nbOfShift=1) = 0; + MEDCOUPLING_EXPORT virtual void renumberInPlace(const mcIdType *old2New) = 0; + MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const mcIdType *new2Old) = 0; + MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) = 0; + MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector >& ranges) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const = 0; + MEDCOUPLING_EXPORT virtual void rearrange(std::size_t newNbOfCompo) = 0; + MEDCOUPLING_EXPORT virtual void circularPermutation(mcIdType nbOfShift=1) = 0; + MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(mcIdType nbOfShift=1) = 0; MEDCOUPLING_EXPORT virtual void reversePerTuple() = 0; - MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const; - MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfTuples(mcIdType nbOfTuples, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfComps(std::size_t nbOfCompo, const std::string& msg) const; MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const; - MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const; - MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const; - MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg); - MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step); + MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const; + MEDCOUPLING_EXPORT void checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const; + MEDCOUPLING_EXPORT static void GetSlice(mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType& startSlice, mcIdType& stopSlice); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step); MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit); @@ -202,10 +210,10 @@ namespace MEDCoupling DataArray() { } ~DataArray() { } protected: - MEDCOUPLING_EXPORT static void CheckValueInRange(int ref, int value, const std::string& msg); - MEDCOUPLING_EXPORT static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg); - MEDCOUPLING_EXPORT static void CheckClosingParInRange(int ref, int value, const std::string& msg); - MEDCOUPLING_EXPORT static int EffectiveCircPerm(int nbOfShift, int nbOfTuples); + MEDCOUPLING_EXPORT static void CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg); + MEDCOUPLING_EXPORT static void CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg); + MEDCOUPLING_EXPORT static void CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples); protected: std::string _name; std::vector _info_on_compo; @@ -214,8 +222,6 @@ namespace MEDCoupling namespace MEDCoupling { - class DataArrayInt32; - template class DataArrayTemplate : public DataArray { @@ -228,8 +234,8 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT void updateTime() const { } // - MEDCOUPLING_EXPORT std::size_t getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); } - MEDCOUPLING_EXPORT std::size_t getNbOfElems() const { return _mem.getNbOfElem(); } + MEDCOUPLING_EXPORT mcIdType getNumberOfTuples() const { return ToIdType(_info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents()); } + MEDCOUPLING_EXPORT mcIdType getNbOfElems() const { return ToIdType(_mem.getNbOfElem()); } MEDCOUPLING_EXPORT bool empty() const; MEDCOUPLING_EXPORT void *getVoidStarPointer() { return getPointer(); } MEDCOUPLING_EXPORT const T *getConstPointer() const { return _mem.getConstPointer(); } @@ -238,19 +244,19 @@ namespace MEDCoupling MEDCOUPLING_EXPORT T *rwBegin() { return getPointer(); } MEDCOUPLING_EXPORT T *rwEnd() { return getPointer()+getNbOfElems(); } MEDCOUPLING_EXPORT void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1); - MEDCOUPLING_EXPORT void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo); - MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo); - MEDCOUPLING_EXPORT T getIJSafe(int tupleId, int compoId) const; - MEDCOUPLING_EXPORT T getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } - MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); } - MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; } + MEDCOUPLING_EXPORT void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo); + MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo); + MEDCOUPLING_EXPORT T getIJSafe(std::size_t tupleId, std::size_t compoId) const; + MEDCOUPLING_EXPORT T getIJ(std::size_t tupleId, std::size_t compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; } + MEDCOUPLING_EXPORT void setIJ(std::size_t tupleId, std::size_t compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); } + MEDCOUPLING_EXPORT void setIJSilent(std::size_t tupleId, std::size_t compoId, T newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; } MEDCOUPLING_EXPORT T *getPointer() { return _mem.getPointer(); declareAsNew(); } MEDCOUPLING_EXPORT void pack() const; MEDCOUPLING_EXPORT bool isAllocated() const override; MEDCOUPLING_EXPORT void checkAllocated() const; MEDCOUPLING_EXPORT void desallocate(); MEDCOUPLING_EXPORT void reserve(std::size_t nbOfElems); - MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); + MEDCOUPLING_EXPORT void rearrange(std::size_t newNbOfCompo); MEDCOUPLING_EXPORT void transpose(); MEDCOUPLING_EXPORT void pushBackSilent(T val); MEDCOUPLING_EXPORT void pushBackValsSilent(const T *valsBg, const T *valsEnd); @@ -258,45 +264,45 @@ namespace MEDCoupling MEDCOUPLING_EXPORT T front() const; MEDCOUPLING_EXPORT T back() const; MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); } - MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo); + MEDCOUPLING_EXPORT void allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo); MEDCOUPLING_EXPORT void deepCopyFrom(const DataArrayTemplate& other); MEDCOUPLING_EXPORT void reverse(); MEDCOUPLING_EXPORT void fillWithValue(T val); MEDCOUPLING_EXPORT void reAlloc(std::size_t newNbOfTuple); - MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New); - MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old); + MEDCOUPLING_EXPORT void renumberInPlace(const mcIdType *old2New); + MEDCOUPLING_EXPORT void renumberInPlaceR(const mcIdType *new2Old); MEDCOUPLING_EXPORT void sort(bool asc=true); - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumber(const int *old2New) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberR(const int *new2Old) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *changeNbOfComponents(int newNbOfComp, T dftValue) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumber(const mcIdType *old2New) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberR(const mcIdType *new2Old) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; MEDCOUPLING_EXPORT MCAuto::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const; - MEDCOUPLING_EXPORT void circularPermutation(int nbOfShift=1); - MEDCOUPLING_EXPORT void circularPermutationPerTuple(int nbOfShift=1); + MEDCOUPLING_EXPORT void circularPermutation(mcIdType nbOfShift=1); + MEDCOUPLING_EXPORT void circularPermutationPerTuple(mcIdType nbOfShift=1); MEDCOUPLING_EXPORT void reversePerTuple(); - MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp); - MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp); - MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); - MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayInt32 *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); - MEDCOUPLING_EXPORT T getMaxValue(int& tupleId) const; + MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp); + MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp); + MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayIdType *tuplesSelec); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step); + MEDCOUPLING_EXPORT T getMaxValue(mcIdType& tupleId) const; MEDCOUPLING_EXPORT T getMaxValueInArray() const; MEDCOUPLING_EXPORT T getMaxAbsValue(std::size_t& tupleId) const; MEDCOUPLING_EXPORT T getMaxAbsValueInArray() const; - MEDCOUPLING_EXPORT T getMinValue(int& tupleId) const; + MEDCOUPLING_EXPORT T getMinValue(mcIdType& tupleId) const; MEDCOUPLING_EXPORT T getMinValueInArray() const; - MEDCOUPLING_EXPORT void getTuple(int tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } + MEDCOUPLING_EXPORT void getTuple(mcIdType tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } template void insertAtTheEnd(InputIterator first, InputIterator last); MEDCOUPLING_EXPORT static void SetArrayIn(typename Traits::ArrayType *newArray, typename Traits::ArrayType* &arrayToSet); - MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); } + MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, mcIdType sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); } MEDCOUPLING_EXPORT void fillWithZero(); public: MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } @@ -304,10 +310,10 @@ namespace MEDCoupling protected: typename Traits::ArrayType *mySelectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; typename Traits::ArrayType *mySelectByTupleId(const DataArrayIdType& di) const; - typename Traits::ArrayType *mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; - typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; - typename Traits::ArrayType *mySelectByTupleIdSafeSlice(int bg, int end2, int step) const; - typename Traits::ArrayType *mySelectByTupleRanges(const std::vector >& ranges) const; + typename Traits::ArrayType *mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; + typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; + typename Traits::ArrayType *mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const; + typename Traits::ArrayType *mySelectByTupleRanges(const std::vector >& ranges) const; protected: MemArray _mem; }; @@ -317,9 +323,9 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MCAuto convertToDblArr() const; - MEDCOUPLING_EXPORT MCAuto convertToIntArr() const; + MEDCOUPLING_EXPORT MCAuto convertToIntArr() const; MEDCOUPLING_EXPORT MCAuto convertToFloatArr() const; - MEDCOUPLING_EXPORT void applyLin(T a, T b, int compoId); + MEDCOUPLING_EXPORT void applyLin(T a, T b, std::size_t compoId); MEDCOUPLING_EXPORT void applyLin(T a, T b); MEDCOUPLING_EXPORT typename Traits::ArrayType *negate() const; MEDCOUPLING_EXPORT void addEqual(const typename Traits::ArrayType *other); @@ -332,15 +338,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static typename Traits::ArrayType *Multiply(const typename Traits::ArrayType *a1, const typename Traits::ArrayType *a2); MEDCOUPLING_EXPORT static typename Traits::ArrayType *Meld(const typename Traits::ArrayType *a1, const typename Traits::ArrayType *a2); MEDCOUPLING_EXPORT static typename Traits::ArrayType *Meld(const std::vector::ArrayType *>& arr); - MEDCOUPLING_EXPORT MCAuto findIdsGreaterOrEqualTo(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsGreaterThan(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsLowerOrEqualTo(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsLowerThan(T val) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsStrictlyNegative() const; + MEDCOUPLING_EXPORT MCAuto findIdsGreaterOrEqualTo(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsGreaterThan(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsLowerOrEqualTo(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsLowerThan(T val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsStrictlyNegative() const; MEDCOUPLING_EXPORT typename Traits::ArrayType *fromNoInterlace() const; MEDCOUPLING_EXPORT typename Traits::ArrayType *toNoInterlace() const; MEDCOUPLING_EXPORT void meldWith(const typename Traits::ArrayType *other); - MEDCOUPLING_EXPORT typename Traits::ArrayType *duplicateEachTupleNTimes(int nbTimes) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *duplicateEachTupleNTimes(mcIdType nbTimes) const; MEDCOUPLING_EXPORT void aggregate(const typename Traits::ArrayType *other); MEDCOUPLING_EXPORT void abs(); MEDCOUPLING_EXPORT typename Traits::ArrayType *computeAbs() const; @@ -361,7 +367,7 @@ namespace MEDCoupling protected: static typename Traits::ArrayType *PerformCopyOrIncrRef(bool dCpy, const typename Traits::ArrayType& self); template - MCAuto findIdsAdv(const OP& op) const; + MCAuto findIdsAdv(const OP& op) const; private: template void somethingEqual(const typename Traits::ArrayType *other); @@ -385,11 +391,11 @@ namespace MEDCoupling public:// abstract method overload MEDCOUPLING_EXPORT DataArrayFloat *deepCopy() const; MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; @@ -417,7 +423,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); } MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const; MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; @@ -426,36 +432,36 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt32 *&tupleIds) const; - MEDCOUPLING_EXPORT void findCommonTuples(double prec, int limitTupleId, DataArrayInt32 *&comm, DataArrayInt32 *&commIndex) const; - MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const; - MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findClosestTupleId(const DataArrayDouble *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; - MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds); + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const; + MEDCOUPLING_EXPORT void findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const; + MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const; + MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, mcIdType limitTupleId=-1) const; + MEDCOUPLING_EXPORT DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; + MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds); MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator(); MEDCOUPLING_EXPORT void checkNoNullValues() const; MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const; MEDCOUPLING_EXPORT DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const; - MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt32 *& c, DataArrayInt32 *& cI) const; + MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const; MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps); - MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt32*& tupleIds) const; - MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt32*& tupleIds) const; - MEDCOUPLING_EXPORT int count(double value, double eps) const; + MEDCOUPLING_EXPORT double getMaxValue2(DataArrayIdType*& tupleIds) const; + MEDCOUPLING_EXPORT double getMinValue2(DataArrayIdType*& tupleIds) const; + MEDCOUPLING_EXPORT mcIdType count(double value, double eps) const; MEDCOUPLING_EXPORT double getAverageValue() const; MEDCOUPLING_EXPORT double norm2() const; MEDCOUPLING_EXPORT double normMax() const; MEDCOUPLING_EXPORT void normMaxPerComponent(double * res) const; MEDCOUPLING_EXPORT double normMin() const; MEDCOUPLING_EXPORT void accumulate(double *res) const; - MEDCOUPLING_EXPORT double accumulate(int compId) const; - MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const; + MEDCOUPLING_EXPORT double accumulate(std::size_t compId) const; + MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const; MEDCOUPLING_EXPORT MCAuto cumSum() const; - MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const; + MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const; MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const; MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const; MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const; @@ -473,7 +479,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *deviator() const; MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const; MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const; - MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt32* &compoIdOfMaxPerTuple) const; + MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const; MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const; MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const; MEDCOUPLING_EXPORT void asArcOfCircle(double center[2], double& radius, double& ang) const; @@ -481,17 +487,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void applyInv(double numerator); MEDCOUPLING_EXPORT void applyPow(double val); MEDCOUPLING_EXPORT void applyRPow(double val); - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(std::size_t nbOfComp, FunctionToEvaluate func) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(std::size_t nbOfComp, const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT void applyFuncOnThis(const std::string& func, bool isSafe=true); - MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const; - MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFuncCompo(std::size_t nbOfComp, const std::string& func, bool isSafe=true) const; + MEDCOUPLING_EXPORT DataArrayDouble *applyFuncNamedCompo(std::size_t nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT MCAuto symmetry3DPlane(const double point[3], const double normalVector[3]) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(double vmin, double vmax) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -501,34 +507,40 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2); MEDCOUPLING_EXPORT void powEqual(const DataArrayDouble *other); MEDCOUPLING_EXPORT std::vector toVectorOfBool(double eps) const; - MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut); - MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut); - MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut); MEDCOUPLING_EXPORT static void GiveBaseForPlane(const double normalVector[3], double baseOfPlane[9]); MEDCOUPLING_EXPORT static void ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const double tri3[6], double coeffs[3], double& length); public: - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); - public: - template - void findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt32 *c, DataArrayInt32 *cI) const; - template - static void FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res); - template - static void FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, int nbOfTuples, double eps, - DataArrayInt32 *c, DataArrayInt32 *cI); + MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); + public: + template + void findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const; + template + static void FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res); + template + static void FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double eps, + DataArrayIdType *c, DataArrayIdType *cI); private: ~DataArrayDouble() { } DataArrayDouble() { } }; +} +namespace MEDCoupling +{ template class DataArrayDiscrete : public DataArrayTemplateClassic { public: - MEDCOUPLING_EXPORT static typename Traits::ArrayType *New(); + typedef typename Traits::ArrayType DataArrayType; + public: + MEDCOUPLING_EXPORT static DataArrayType *New(); + MEDCOUPLING_EXPORT T intValue() const; MEDCOUPLING_EXPORT bool isEqual(const DataArrayDiscrete& other) const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDiscrete& other, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDiscrete& other) const; @@ -541,14 +553,126 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isMonotonic(bool increasing) const; MEDCOUPLING_EXPORT void checkStrictlyMonotonic(bool increasing) const; MEDCOUPLING_EXPORT bool isStrictlyMonotonic(bool increasing) const; - MEDCOUPLING_EXPORT int getHashCode() const; + MEDCOUPLING_EXPORT mcIdType getHashCode() const; MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void transformWithIndArr(const T *indArrBg, const T *indArrEnd); - MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal& m); + MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal& m); MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(T val) const; + MEDCOUPLING_EXPORT DataArrayIdType *transformWithIndArrR(const T *indArr2Bg, const T *indArrEnd) const; + MEDCOUPLING_EXPORT void splitByValueRange(const T *arrBg, const T *arrEnd, + DataArrayType *& castArr, DataArrayType *& rankInsideCast, DataArrayType *& castsPresent) const; + MEDCOUPLING_EXPORT bool isRange(T& strt, T& sttoopp, T& stteepp) const; + MEDCOUPLING_EXPORT DataArrayIdType *invertArrayO2N2N2O(mcIdType newNbOfElem) const; + MEDCOUPLING_EXPORT DataArrayIdType *invertArrayN2O2O2N(mcIdType oldNbOfElem) const; + MEDCOUPLING_EXPORT DataArrayIdType *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const; + MEDCOUPLING_EXPORT MCAuto< MapKeyVal > invertArrayN2O2O2NOptimized() const; + MEDCOUPLING_EXPORT MCAuto< MapKeyVal > giveN2OOptimized() const; + MEDCOUPLING_EXPORT MCAuto findIdForEach(const T *valsBg, const T *valsEnd) const; + MEDCOUPLING_EXPORT DataArrayIdType *checkAndPreparePermutation() const; + MEDCOUPLING_EXPORT void changeSurjectiveFormat(T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const; + MEDCOUPLING_EXPORT DataArrayIdType *buildPermArrPerLevel() const; + MEDCOUPLING_EXPORT bool isIota(mcIdType sizeExpected) const; + MEDCOUPLING_EXPORT bool isUniform(T val) const; + MEDCOUPLING_EXPORT T checkUniformAndGuess() const; + MEDCOUPLING_EXPORT bool hasUniqueValues() const; + MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayType *a, const std::vector& compoIds); + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqual(T val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqualTuple(const T *tupleBg, const T *tupleEnd) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqualList(const T *valsBg, const T *valsEnd) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqualList(const T *valsBg, const T *valsEnd) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(T value) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(const std::vector& vals) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqualTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT mcIdType findIdSequence(const std::vector& vals) const; + MEDCOUPLING_EXPORT mcIdType changeValue(T oldValue, T newValue); + MEDCOUPLING_EXPORT mcIdType count(T value) const; + MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT bool presenceOfValue(T value) const; + MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; + MEDCOUPLING_EXPORT void accumulate(T *res) const; + MEDCOUPLING_EXPORT T accumulate(std::size_t compId) const; + MEDCOUPLING_EXPORT DataArrayType *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const; + MEDCOUPLING_EXPORT void getMinMaxValues(T& minValue, T& maxValue) const; + MEDCOUPLING_EXPORT void applyInv(T numerator); + MEDCOUPLING_EXPORT void applyDivideBy(T val); + MEDCOUPLING_EXPORT void applyModulus(T val); + MEDCOUPLING_EXPORT void applyRModulus(T val); + MEDCOUPLING_EXPORT void applyPow(T val); + MEDCOUPLING_EXPORT void applyRPow(T val); + MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(T vmin, T vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotInRange(T vmin, T vmax) const; + MEDCOUPLING_EXPORT bool checkAllIdsInRange(T vmin, T vmax) const; + MEDCOUPLING_EXPORT static DataArrayType *Aggregate(const DataArrayType *a1, const DataArrayType *a2, T offsetA2); + MEDCOUPLING_EXPORT static DataArrayType *Aggregate(const std::vector& arr); + MEDCOUPLING_EXPORT static DataArrayType *AggregateIndexes(const std::vector& arrs); + MEDCOUPLING_EXPORT static DataArrayType *BuildUnion(const std::vector& arr); + MEDCOUPLING_EXPORT static DataArrayType *BuildIntersection(const std::vector& arr); + MEDCOUPLING_EXPORT static void PutIntoToSkylineFrmt(const std::vector< std::vector >& v, DataArrayType *& data, DataArrayIdType *& dataIndex); + MEDCOUPLING_EXPORT DataArrayIdType *buildComplement(mcIdType nbOfElement) const; + MEDCOUPLING_EXPORT DataArrayType *buildSubstraction(const DataArrayType *other) const; + MEDCOUPLING_EXPORT DataArrayType *buildSubstractionOptimized(const DataArrayType *other) const; + MEDCOUPLING_EXPORT DataArrayType *buildUnion(const DataArrayType *other) const; + MEDCOUPLING_EXPORT DataArrayType *buildIntersection(const DataArrayType *other) const; + MEDCOUPLING_EXPORT DataArrayType *buildUnique() const; + MEDCOUPLING_EXPORT DataArrayType *buildUniqueNotSorted() const; + MEDCOUPLING_EXPORT DataArrayType *deltaShiftIndex() const; + MEDCOUPLING_EXPORT void computeOffsets(); + MEDCOUPLING_EXPORT void computeOffsetsFull(); + MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayType *listOfIds, DataArrayIdType *& rangeIdsFetched, DataArrayType *& idsInInputListThatFetch) const; + MEDCOUPLING_EXPORT DataArrayType *buildExplicitArrByRanges(const DataArrayType *offsets) const; + MEDCOUPLING_EXPORT DataArrayType *buildExplicitArrOfSliceOnScaledArr(T begin, T stop, T step) const; + MEDCOUPLING_EXPORT DataArrayIdType *findRangeIdForEachTuple(const DataArrayType *ranges) const; + MEDCOUPLING_EXPORT DataArrayType *findIdInRangeForEachTuple(const DataArrayType *ranges) const; + MEDCOUPLING_EXPORT void sortEachPairToMakeALinkedList(); + MEDCOUPLING_EXPORT MCAuto fromLinkedListOfPairToList() const; + MEDCOUPLING_EXPORT DataArrayType *getDifferentValues() const; + MEDCOUPLING_EXPORT std::vector partitionByDifferentValues(std::vector& differentIds) const; + MEDCOUPLING_EXPORT std::vector< std::pair > splitInBalancedSlices(mcIdType nbOfSlices) const; + MEDCOUPLING_EXPORT static DataArrayType *Modulus(const DataArrayType *a1, const DataArrayType *a2); + MEDCOUPLING_EXPORT void modulusEqual(const DataArrayType *other); + MEDCOUPLING_EXPORT static DataArrayType *Pow(const DataArrayType *a1, const DataArrayType *a2); + MEDCOUPLING_EXPORT void powEqual(const DataArrayType *other); + //MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } + //MEDCOUPLING_EXPORT const MemArray& accessToMemArray() const { return _mem; } + public: + MEDCOUPLING_EXPORT static DataArrayIdType *FindPermutationFromFirstToSecond(const DataArrayType *ids1, const DataArrayType *ids2); + MEDCOUPLING_EXPORT static mcIdType *CheckAndPreparePermutation(const T *start, const T *end); + MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOn(const std::vector& v); + MEDCOUPLING_EXPORT static DataArrayType *BuildListOfSwitchedOff(const std::vector& v); + MEDCOUPLING_EXPORT static DataArrayIdType *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples); + MEDCOUPLING_EXPORT static DataArrayIdType *MakePartition(const std::vector& groups, mcIdType newNb, std::vector< std::vector >& fidsOfGroups); + public: + MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut); + MEDCOUPLING_EXPORT static void ExtractFromIndexedArraysSlice(mcIdType idsOfSelectStart, mcIdType idsOfSelectStop, mcIdType idsOfSelectStep, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut); + MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut); + MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSlice(mcIdType start, mcIdType end, mcIdType step, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut); + MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex); + MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdxSlice(mcIdType start, mcIdType end, mcIdType step, + DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex); + MEDCOUPLING_EXPORT static bool RemoveIdsFromIndexedArrays(const T *idsToRemoveBg, const T *idsToRemoveEnd, + DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0); + MEDCOUPLING_EXPORT static DataArrayType *Range(T begin, T end, T step); + public: + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); protected: template void switchOnTupleAlg(T val, std::vector& vec, ALG algo) const; @@ -571,153 +695,57 @@ namespace MEDCoupling { friend class DataArrayDiscrete; public: - MEDCOUPLING_EXPORT int intValue() const; MEDCOUPLING_EXPORT DataArrayInt32 *deepCopy() const;//ok MEDCOUPLING_EXPORT DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); }//ok - MEDCOUPLING_EXPORT DataArrayInt32 *transformWithIndArrR(const int *indArr2Bg, const int *indArrEnd) const; - MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd, - DataArrayInt32 *& castArr, DataArrayInt32 *& rankInsideCast, DataArrayInt32 *& castsPresent) const; - MEDCOUPLING_EXPORT bool isRange(int& strt, int& sttoopp, int& stteepp) const; - MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2O(int newNbOfElem) const; - MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayN2O2O2N(int oldNbOfElem) const; - MEDCOUPLING_EXPORT MCAuto< MapKeyVal > invertArrayN2O2O2NOptimized() const; - MEDCOUPLING_EXPORT MCAuto< MapKeyVal > giveN2OOptimized() const; - MEDCOUPLING_EXPORT DataArrayInt32 *invertArrayO2N2N2OBis(int newNbOfElem) const; + public: MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT DataArrayInt32 *checkAndPreparePermutation() const; - MEDCOUPLING_EXPORT static DataArrayInt32 *FindPermutationFromFirstToSecond(const DataArrayInt32 *ids1, const DataArrayInt32 *ids2); - MEDCOUPLING_EXPORT void changeSurjectiveFormat(int targetNb, DataArrayInt32 *&arr, DataArrayInt32 *&arrI) const; - MEDCOUPLING_EXPORT static DataArrayInt32 *ConvertIndexArrayToO2N(int nbOfOldTuples, const int *arr, const int *arrIBg, const int *arrIEnd, int &newNbOfTuples); - MEDCOUPLING_EXPORT DataArrayInt32 *buildPermArrPerLevel() const; - MEDCOUPLING_EXPORT bool isIota(int sizeExpected) const; - MEDCOUPLING_EXPORT bool isUniform(int val) const; - MEDCOUPLING_EXPORT int checkUniformAndGuess() const; - MEDCOUPLING_EXPORT bool hasUniqueValues() const; - MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt32 *a, const std::vector& compoIds); + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return this->myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return this->mySelectByTupleRanges(ranges); } + public: MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator(); - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqual(int val) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualList(const int *valsBg, const int *valsEnd) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotEqualList(const int *valsBg, const int *valsEnd) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsEqualTuple(const int *tupleBg, const int *tupleEnd) const; - MEDCOUPLING_EXPORT MCAuto findIdForEach(const int *valsBg, const int *valsEnd) const; - MEDCOUPLING_EXPORT int changeValue(int oldValue, int newValue); - MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; - MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const; - MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; - MEDCOUPLING_EXPORT int findIdSequence(const std::vector& vals) const; - MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; - MEDCOUPLING_EXPORT bool presenceOfValue(int value) const; - MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; - MEDCOUPLING_EXPORT int count(int value) const; - MEDCOUPLING_EXPORT void accumulate(int *res) const; - MEDCOUPLING_EXPORT int accumulate(int compId) const; - MEDCOUPLING_EXPORT DataArrayInt32 *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const; - MEDCOUPLING_EXPORT void getMinMaxValues(int& minValue, int& maxValue) const; - MEDCOUPLING_EXPORT void applyInv(int numerator); - MEDCOUPLING_EXPORT void applyDivideBy(int val); - MEDCOUPLING_EXPORT void applyModulus(int val); - MEDCOUPLING_EXPORT void applyRModulus(int val); - MEDCOUPLING_EXPORT void applyPow(int val); - MEDCOUPLING_EXPORT void applyRPow(int val); - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(int vmin, int vmax) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(int vmin, int vmax) const; - MEDCOUPLING_EXPORT bool checkAllIdsInRange(int vmin, int vmax) const; - MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const DataArrayInt32 *a1, const DataArrayInt32 *a2, int offsetA2); - MEDCOUPLING_EXPORT static DataArrayInt32 *Aggregate(const std::vector& arr); - MEDCOUPLING_EXPORT static DataArrayInt32 *AggregateIndexes(const std::vector& arrs); - MEDCOUPLING_EXPORT static DataArrayInt32 *MakePartition(const std::vector& groups, int newNb, std::vector< std::vector >& fidsOfGroups); - MEDCOUPLING_EXPORT static DataArrayInt32 *BuildUnion(const std::vector& arr); - MEDCOUPLING_EXPORT static DataArrayInt32 *BuildIntersection(const std::vector& arr); - MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOn(const std::vector& v); - MEDCOUPLING_EXPORT static DataArrayInt32 *BuildListOfSwitchedOff(const std::vector& v); - MEDCOUPLING_EXPORT static void PutIntoToSkylineFrmt(const std::vector< std::vector >& v, DataArrayInt32 *& data, DataArrayInt32 *& dataIndex); - MEDCOUPLING_EXPORT DataArrayInt32 *buildComplement(int nbOfElement) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstraction(const DataArrayInt32 *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildSubstractionOptimized(const DataArrayInt32 *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildUnion(const DataArrayInt32 *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildIntersection(const DataArrayInt32 *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildUnique() const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildUniqueNotSorted() const; - MEDCOUPLING_EXPORT DataArrayInt32 *deltaShiftIndex() const; - MEDCOUPLING_EXPORT void computeOffsets(); - MEDCOUPLING_EXPORT void computeOffsetsFull(); - MEDCOUPLING_EXPORT void findIdsRangesInListOfIds(const DataArrayInt32 *listOfIds, DataArrayInt32 *& rangeIdsFetched, DataArrayInt32 *& idsInInputListThatFetch) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrByRanges(const DataArrayInt32 *offsets) const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildExplicitArrOfSliceOnScaledArr(int begin, int stop, int step) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findRangeIdForEachTuple(const DataArrayInt32 *ranges) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdInRangeForEachTuple(const DataArrayInt32 *ranges) const; - MEDCOUPLING_EXPORT void sortEachPairToMakeALinkedList(); - MEDCOUPLING_EXPORT MCAuto fromLinkedListOfPairToList() const; - MEDCOUPLING_EXPORT DataArrayInt32 *getDifferentValues() const; - MEDCOUPLING_EXPORT std::vector partitionByDifferentValues(std::vector& differentIds) const; - MEDCOUPLING_EXPORT std::vector< std::pair > splitInBalancedSlices(int nbOfSlices) const; - MEDCOUPLING_EXPORT static DataArrayInt32 *Modulus(const DataArrayInt32 *a1, const DataArrayInt32 *a2); - MEDCOUPLING_EXPORT void modulusEqual(const DataArrayInt32 *other); - MEDCOUPLING_EXPORT static DataArrayInt32 *Pow(const DataArrayInt32 *a1, const DataArrayInt32 *a2); - MEDCOUPLING_EXPORT void powEqual(const DataArrayInt32 *other); - MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } - MEDCOUPLING_EXPORT const MemArray& accessToMemArray() const { return _mem; } - public: - MEDCOUPLING_EXPORT static void ExtractFromIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void ExtractFromIndexedArraysSlice(int idsOfSelectStart, int idsOfSelectStop, int idsOfSelectStep, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArrays(const int *idsOfSelectBg, const int *idsOfSelectEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSlice(int start, int end, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex, - DataArrayInt* &arrOut, DataArrayInt* &arrIndexOut); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdx(const int *idsOfSelectBg, const int *idsOfSelectEnd, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex); - MEDCOUPLING_EXPORT static void SetPartOfIndexedArraysSameIdxSlice(int start, int end, int step, DataArrayInt *arrInOut, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex); - MEDCOUPLING_EXPORT static bool RemoveIdsFromIndexedArrays(const int *idsToRemoveBg, const int *idsToRemoveEnd, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0); - MEDCOUPLING_EXPORT static int *CheckAndPreparePermutation(const int *start, const int *end); - MEDCOUPLING_EXPORT static DataArrayInt32 *Range(int begin, int end, int step); - public: - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); private: ~DataArrayInt32() { } DataArrayInt32() { } }; - class DataArrayInt64 : public DataArrayDiscrete + class DataArrayInt64 : public DataArrayDiscreteSigned { friend class DataArrayDiscrete; public: MEDCOUPLING_EXPORT DataArrayInt64 *deepCopy() const; MEDCOUPLING_EXPORT DataArrayInt64 *buildNewEmptyInstance() const { return DataArrayInt64::New(); }//ok + public: MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + public: + MEDCOUPLING_EXPORT DataArrayInt64Iterator *iterator(); private: ~DataArrayInt64() { } DataArrayInt64() { } }; - +} + +namespace MEDCoupling +{ + template template - MCAuto DataArrayTemplateClassic::findIdsAdv(const OP& op) const + MCAuto DataArrayTemplateClassic::findIdsAdv(const OP& op) const { this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !"); const T *cptr(this->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples(this->getNumberOfTuples()); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + mcIdType nbOfTuples=this->getNumberOfTuples(); + for(mcIdType i=0;ipushBackSilent(i); return ret; @@ -727,7 +755,7 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const = 0; - MEDCOUPLING_EXPORT int getHashCode() const; + MEDCOUPLING_EXPORT mcIdType getHashCode() const; MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const; MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const; @@ -736,22 +764,22 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const; MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT bool isUniform(char val) const; MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other); - MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const; - MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) const; - MEDCOUPLING_EXPORT int findIdSequence(const std::vector& vals) const; - MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; - MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const; - MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; + MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(char val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqual(char val) const; + MEDCOUPLING_EXPORT mcIdType findIdSequence(const std::vector& vals) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqualTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(char value) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(const std::vector& vals) const; MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT bool presenceOfValue(char value) const; MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; - MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(char vmin, char vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(char vmin, char vmax) const; MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); @@ -759,10 +787,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } MEDCOUPLING_EXPORT const MemArray& accessToMemArray() const { return _mem; } public: - //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; //MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); + //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); protected: DataArrayChar() { } }; @@ -832,26 +860,26 @@ namespace MEDCoupling private: typename Traits::ArrayType *_da; T *_pt; - int _tuple_id; - int _nb_comp; - int _nb_tuple; + mcIdType _tuple_id; + std::size_t _nb_comp; + mcIdType _nb_tuple; }; template class DataArrayTuple { public: - MEDCOUPLING_EXPORT DataArrayTuple(T *pt, int nbOfComp); - MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; } + MEDCOUPLING_EXPORT DataArrayTuple(T *pt, std::size_t nbOfComp); + //MEDCOUPLING_EXPORT std::string repr() const; + MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; } MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pt; } MEDCOUPLING_EXPORT T *getPointer() { return _pt; } - MEDCOUPLING_EXPORT typename Traits::ArrayType *buildDA(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *buildDA(std::size_t nbOfTuples, std::size_t nbOfCompo) const; protected: T zeValue() const; protected: T *_pt; - int _nb_of_compo; + std::size_t _nb_of_compo; }; class DataArrayDoubleTuple; @@ -866,10 +894,10 @@ namespace MEDCoupling class DataArrayDoubleTuple : public DataArrayTuple { public: - MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, int nbOfComp); + MEDCOUPLING_EXPORT DataArrayDoubleTuple(double *pt, std::size_t nbOfComp); MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT double doubleValue() const; - MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT DataArrayDouble *buildDADouble(std::size_t nbOfTuples, std::size_t nbOfCompo) const; }; class DataArrayFloatTuple; @@ -884,26 +912,42 @@ namespace MEDCoupling class DataArrayFloatTuple : public DataArrayTuple { public: - MEDCOUPLING_EXPORT DataArrayFloatTuple(float *pt, int nbOfComp); + MEDCOUPLING_EXPORT DataArrayFloatTuple(float *pt, std::size_t nbOfComp); MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT float floatValue() const; - MEDCOUPLING_EXPORT DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT DataArrayFloat *buildDAFloat(std::size_t nbOfTuples, std::size_t nbOfCompo) const; }; - class DataArrayIntIterator : public DataArrayIterator + class DataArrayInt32Iterator : public DataArrayIterator + { + public: + MEDCOUPLING_EXPORT DataArrayInt32Iterator(DataArrayInt32 *da); + MEDCOUPLING_EXPORT ~DataArrayInt32Iterator() { } + }; + + class DataArrayInt64Iterator : public DataArrayIterator { public: - MEDCOUPLING_EXPORT DataArrayIntIterator(DataArrayInt *da); - MEDCOUPLING_EXPORT ~DataArrayIntIterator() { } + MEDCOUPLING_EXPORT DataArrayInt64Iterator(DataArrayInt64 *da); + MEDCOUPLING_EXPORT ~DataArrayInt64Iterator() { } }; class DataArrayInt32Tuple : public DataArrayTuple { public: - MEDCOUPLING_EXPORT DataArrayInt32Tuple(int *pt, int nbOfComp); + MEDCOUPLING_EXPORT DataArrayInt32Tuple(Int32 *pt, std::size_t nbOfComp); + MEDCOUPLING_EXPORT std::string repr() const; + MEDCOUPLING_EXPORT Int32 intValue() const; + MEDCOUPLING_EXPORT DataArrayInt32 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const; + }; + + class DataArrayInt64Tuple : public DataArrayTuple + { + public: + MEDCOUPLING_EXPORT DataArrayInt64Tuple(Int64 *pt, std::size_t nbOfComp); MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT int intValue() const; - MEDCOUPLING_EXPORT DataArrayInt32 *buildDAInt(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT Int64 intValue() const; + MEDCOUPLING_EXPORT DataArrayInt64 *buildDAInt(std::size_t nbOfTuples, std::size_t nbOfCompo) const; }; typedef DataArrayInt32Tuple DataArrayIntTuple; @@ -919,24 +963,24 @@ namespace MEDCoupling private: DataArrayAsciiChar *_da; char *_pt; - int _tuple_id; - int _nb_comp; - int _nb_tuple; + mcIdType _tuple_id; + std::size_t _nb_comp; + mcIdType _nb_tuple; }; class DataArrayAsciiCharTuple { public: - MEDCOUPLING_EXPORT DataArrayAsciiCharTuple(char *pt, int nbOfComp); + MEDCOUPLING_EXPORT DataArrayAsciiCharTuple(char *pt, std::size_t nbOfComp); MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; } + MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; } MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; } MEDCOUPLING_EXPORT char *getPointer() { return _pt; } MEDCOUPLING_EXPORT char asciiCharValue() const; - MEDCOUPLING_EXPORT DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT DataArrayAsciiChar *buildDAAsciiChar(std::size_t nbOfTuples, std::size_t nbOfCompo) const; private: char *_pt; - int _nb_of_compo; + std::size_t _nb_of_compo; }; class DataArrayByteTuple; @@ -950,24 +994,24 @@ namespace MEDCoupling private: DataArrayByte *_da; char *_pt; - int _tuple_id; - int _nb_comp; - int _nb_tuple; + mcIdType _tuple_id; + std::size_t _nb_comp; + mcIdType _nb_tuple; }; class DataArrayByteTuple { public: - MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, int nbOfComp); + MEDCOUPLING_EXPORT DataArrayByteTuple(char *pt, std::size_t nbOfComp); MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT int getNumberOfCompo() const { return _nb_of_compo; } + MEDCOUPLING_EXPORT std::size_t getNumberOfCompo() const { return _nb_of_compo; } MEDCOUPLING_EXPORT const char *getConstPointer() const { return _pt; } MEDCOUPLING_EXPORT char *getPointer() { return _pt; } MEDCOUPLING_EXPORT char byteValue() const; - MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const; + MEDCOUPLING_EXPORT DataArrayByte *buildDAByte(std::size_t nbOfTuples, std::size_t nbOfCompo) const; private: char *_pt; - int _nb_of_compo; + std::size_t _nb_of_compo; }; } @@ -993,7 +1037,7 @@ namespace MEDCoupling template void DataArrayTemplate::insertAtTheEnd(InputIterator first, InputIterator last) { - int nbCompo(this->getNumberOfComponents()); + std::size_t nbCompo(this->getNumberOfComponents()); if(nbCompo==1) this->_mem.insertAtTheEnd(first,last); else if(nbCompo==0) diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx old mode 100644 new mode 100755 index 570f0f832..e054290ad --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -28,6 +28,7 @@ #include "MEDCouplingPartDefinition.hxx" #include "InterpKernelAutoPtr.hxx" #include "MCAuto.hxx" +#include "MEDCouplingMap.txx" #include #include @@ -161,7 +162,7 @@ namespace MEDCoupling * \return True if a not null pointer is present, False if not. */ template - bool MemArray::reprHeader(int sl, std::ostream& stream) const + bool MemArray::reprHeader(mcIdType sl, std::ostream& stream) const { stream << "Number of tuples : "; if(!_pointer.isNull()) @@ -185,7 +186,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::repr(int sl, std::ostream& stream) const + void MemArray::repr(mcIdType sl, std::ostream& stream) const { if(reprHeader(sl,stream)) { @@ -210,7 +211,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::reprZip(int sl, std::ostream& stream) const + void MemArray::reprZip(mcIdType sl, std::ostream& stream) const { stream << "Number of tuples : "; if(!_pointer.isNull()) @@ -250,7 +251,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::reprNotTooLong(int sl, std::ostream& stream) const + void MemArray::reprNotTooLong(mcIdType sl, std::ostream& stream) const { if(reprHeader(sl,stream)) { @@ -298,7 +299,7 @@ namespace MEDCoupling } template - T *MemArray::fromNoInterlace(int nbOfComp) const + T *MemArray::fromNoInterlace(std::size_t nbOfComp) const { if(nbOfComp<1) throw INTERP_KERNEL::Exception("MemArray::fromNoInterlace : number of components must be > 0 !"); @@ -307,13 +308,13 @@ namespace MEDCoupling T *ret=(T*)malloc(_nb_of_elem*sizeof(T)); T *w=ret; for(std::size_t i=0;i - T *MemArray::toNoInterlace(int nbOfComp) const + T *MemArray::toNoInterlace(std::size_t nbOfComp) const { if(nbOfComp<1) throw INTERP_KERNEL::Exception("MemArray::toNoInterlace : number of components must be > 0 !"); @@ -321,7 +322,7 @@ namespace MEDCoupling std::size_t nbOfTuples=_nb_of_elem/nbOfComp; T *ret=(T*)malloc(_nb_of_elem*sizeof(T)); T *w=ret; - for(int i=0;i - void MemArray::reverse(int nbOfComp) + void MemArray::reverse(std::size_t nbOfComp) { if(nbOfComp<1) throw INTERP_KERNEL::Exception("MemArray::reverse : only supported with 'this' array with ONE or more than ONE component !"); @@ -358,7 +359,7 @@ namespace MEDCoupling std::size_t nbOfTuples=_nb_of_elem/nbOfComp; for(std::size_t i=0;i - DataArrayTuple::DataArrayTuple(T *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp) + DataArrayTuple::DataArrayTuple(T *pt, std::size_t nbOfComp):_pt(pt),_nb_of_compo(nbOfComp) { } @@ -543,7 +544,7 @@ namespace MEDCoupling } template - typename Traits::ArrayType *DataArrayTuple::buildDA(int nbOfTuples, int nbOfCompo) const + typename Traits::ArrayType *DataArrayTuple::buildDA(std::size_t nbOfTuples, std::size_t nbOfCompo) const { if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1)) { @@ -561,6 +562,106 @@ namespace MEDCoupling ////////////////////////////////// + /*! + * This method is useful to slice work among a pool of threads or processes. \a begin, \a end \a step is the input whole slice of work to perform, + * typically it is a whole slice of tuples of DataArray or cells, nodes of a mesh... + * + * The input \a sliceId should be an id in [0, \a nbOfSlices) that specifies the slice of work. + * + * \param [in] start - the start of the input slice of the whole work to perform split into slices. + * \param [in] stop - the stop of the input slice of the whole work to perform split into slices. + * \param [in] step - the step (that can be <0) of the input slice of the whole work to perform split into slices. + * \param [in] sliceId - the slice id considered + * \param [in] nbOfSlices - the number of slices (typically the number of cores on which the work is expected to be sliced) + * \param [out] startSlice - the start of the slice considered + * \param [out] stopSlice - the stop of the slice consided + * + * \throw If \a step == 0 + * \throw If \a nbOfSlices not > 0 + * \throw If \a sliceId not in [0,nbOfSlices) + */ + template + void DataArrayTools::GetSlice(T start, T stop, T step, mcIdType sliceId, mcIdType nbOfSlices, T& startSlice, T& stopSlice) + { + if(nbOfSlices<=0) + { + std::ostringstream oss; oss << "DataArray::GetSlice : nbOfSlices (" << nbOfSlices << ") must be > 0 !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if(sliceId<0 || sliceId>=nbOfSlices) + { + std::ostringstream oss; oss << "DataArray::GetSlice : sliceId (" << nbOfSlices << ") must be in [0 , nbOfSlices (" << nbOfSlices << ") ) !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + mcIdType nbElems=DataArrayTemplate::GetNumberOfItemGivenBESRelative(start,stop,step,"DataArray::GetSlice"); + mcIdType minNbOfElemsPerSlice=nbElems/nbOfSlices; + startSlice=start+minNbOfElemsPerSlice*step*sliceId; + if(sliceId + mcIdType DataArrayTools::GetNumberOfItemGivenBES(T begin, T end, T step, const std::string& msg) + { + if(end 0 !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + return ToIdType((end-1-begin)/step+1); + } + + template + mcIdType DataArrayTools::GetNumberOfItemGivenBESRelative(T begin, T end, T step, const std::string& msg) + { + if(step==0) + throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !"); + if(end0) + { + std::ostringstream oss; oss << msg << " : end before begin whereas step is positive !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if(begin 0 !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if(begin!=end) + return ToIdType((std::max(begin,end)-1-std::min(begin,end))/std::abs(step)+1); + else + return 0; + } + + template + mcIdType DataArrayTools::GetPosOfItemGivenBESRelativeNoThrow(T value, T begin, T end, T step) + { + if (step == 0) + return -1; + + if((step>0 && begin<=value && value=value && value>end)) + { + mcIdType id = ToIdType((value-begin)/step); + if (begin + step * id == value) + return id; + else + return -1; + } + else + return -1; + } + + ////////////////////////////////// + template MCAuto< typename Traits::ArrayTypeCh > DataArrayTemplate::NewFromStdVector(const typename std::vector& v) { @@ -577,7 +678,7 @@ namespace MEDCoupling { checkAllocated(); std::size_t sz(getNumberOfComponents()); - int nbTuples(getNumberOfTuples()); + mcIdType nbTuples(getNumberOfTuples()); std::string name(getName()); std::vector compNames(getInfoOnComponents()); std::vector< MCAuto< typename Traits::ArrayTypeCh > > ret(sz); @@ -589,7 +690,7 @@ namespace MEDCoupling part->setName(name); part->setInfoOnComponent(0,compNames[i]); T *otherPt(part->getPointer()); - for(int j=0;j - void DataArrayTemplate::useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) + void DataArrayTemplate::useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfTuple, std::size_t nbOfCompo) { _info_on_compo.resize(nbOfCompo); - _mem.useArray(array,ownership,type,(std::size_t)nbOfTuple*nbOfCompo); + _mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo); declareAsNew(); } template - void DataArrayTemplate::useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo) + void DataArrayTemplate::useExternalArrayWithRWAccess(const T *array, std::size_t nbOfTuple, std::size_t nbOfCompo) { _info_on_compo.resize(nbOfCompo); - _mem.useExternalArrayWithRWAccess(array,(std::size_t)nbOfTuple*nbOfCompo); + _mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo); declareAsNew(); } @@ -661,15 +762,15 @@ namespace MEDCoupling * \throw If condition ( 0 <= compoId < this->getNumberOfComponents() ) is violated. */ template - T DataArrayTemplate::getIJSafe(int tupleId, int compoId) const + T DataArrayTemplate::getIJSafe(std::size_t tupleId, std::size_t compoId) const { checkAllocated(); - if(tupleId<0 || tupleId>=getNumberOfTuples()) + if(ToIdType(tupleId)>=getNumberOfTuples()) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::getIJSafe : request for tupleId " << tupleId << " should be in [0," << getNumberOfTuples() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - if(compoId<0 || compoId>=(int)getNumberOfComponents()) + if(compoId>=getNumberOfComponents()) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::getIJSafe : request for compoId " << compoId << " should be in [0," << getNumberOfComponents() << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -735,7 +836,7 @@ namespace MEDCoupling template void DataArrayTemplate::reserve(std::size_t nbOfElems) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) { _mem.reserve(nbOfElems); @@ -763,7 +864,7 @@ namespace MEDCoupling template void DataArrayTemplate::pushBackSilent(T val) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) _mem.pushBack(val); else if(nbCompo==0) @@ -791,7 +892,7 @@ namespace MEDCoupling template void DataArrayTemplate::pushBackValsSilent(const T *valsBg, const T *valsEnd) { - int nbCompo(getNumberOfComponents()); + std::size_t nbCompo(getNumberOfComponents()); if(nbCompo==1) _mem.insertAtTheEnd(valsBg,valsEnd); else if(nbCompo==0) @@ -831,11 +932,11 @@ namespace MEDCoupling * \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0. */ template - void DataArrayTemplate::allocIfNecessary(int nbOfTuple, int nbOfCompo) + void DataArrayTemplate::allocIfNecessary(std::size_t nbOfTuple, std::size_t nbOfCompo) { if(isAllocated()) { - if(nbOfTuple!=getNumberOfTuples() || nbOfCompo!=(int)getNumberOfComponents()) + if(ToIdType(nbOfTuple)!=getNumberOfTuples() || nbOfCompo!=getNumberOfComponents()) alloc(nbOfTuple,nbOfCompo); } else @@ -864,9 +965,10 @@ namespace MEDCoupling void DataArrayTemplate::deepCopyFrom(const DataArrayTemplate& other) { other.checkAllocated(); - int nbOfTuples(other.getNumberOfTuples()),nbOfComp(other.getNumberOfComponents()); + mcIdType nbOfTuples(other.getNumberOfTuples()); + std::size_t nbOfComp(other.getNumberOfComponents()); allocIfNecessary(nbOfTuples,nbOfComp); - std::size_t nbOfElems((std::size_t)nbOfTuples*nbOfComp); + std::size_t nbOfElems(nbOfTuples*nbOfComp); T *pt(getPointer()); const T *ptI(other.begin()); for(std::size_t i=0;i - void DataArrayTemplate::renumberInPlace(const int *old2New) + void DataArrayTemplate::renumberInPlace(const mcIdType *old2New) { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); - for(int i=0;i=0 && v - void DataArrayTemplate::renumberInPlaceR(const int *new2Old) + void DataArrayTemplate::renumberInPlaceR(const mcIdType *new2Old) { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); - for(int i=0;i=0 && v - typename Traits::ArrayType *DataArrayTemplate::renumber(const int *old2New) const + typename Traits::ArrayType *DataArrayTemplate::renumber(const mcIdType *old2New) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const T *iptr(begin()); T *optr(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1042,17 +1147,18 @@ namespace MEDCoupling * is to delete using decrRef() as it is no more needed. */ template - typename Traits::ArrayType *DataArrayTemplate::renumberR(const int *new2Old) const + typename Traits::ArrayType *DataArrayTemplate::renumberR(const mcIdType *new2Old) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(nbTuples,nbOfCompo); ret->copyStringInfoFrom(*this); const T *iptr(getConstPointer()); T *optr(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1072,18 +1178,19 @@ namespace MEDCoupling * is to delete using decrRef() as it is no more needed. */ template - typename Traits::ArrayType *DataArrayTemplate::renumberAndReduce(const int *old2New, int newNbOfTuple) const + typename Traits::ArrayType *DataArrayTemplate::renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const { checkAllocated(); - int nbTuples(getNumberOfTuples()),nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(newNbOfTuple,nbOfCompo); const T *iptr=getConstPointer(); T *optr=ret->getPointer(); - for(int i=0;i=0) std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo); } @@ -1119,7 +1226,7 @@ namespace MEDCoupling T *pt(ret->getPointer()); const T *srcPt(getConstPointer()); std::size_t i(0); - for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++) + for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++) std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp); ret->copyStringInfoFrom(*this); return ret.retn(); @@ -1140,9 +1247,9 @@ namespace MEDCoupling const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { - int a,b,c; + mcIdType a,b,c; spd->getSlice(a,b,c); - if(a==0 && b==(int)getNumberOfTuples() && c==1) + if(a==0 && b==getNumberOfTuples() && c==1) { DataArrayTemplate *directRet(const_cast *>(this)); directRet->incrRef(); @@ -1158,7 +1265,7 @@ namespace MEDCoupling const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { - MCAuto arr(dpd->toDAI()); + MCAuto arr(dpd->toDAI()); MCAuto ret2(selectByTupleIdSafe(arr->begin(),arr->end())); return DynamicCastSafe::ArrayTypeCh>(ret2); @@ -1186,18 +1293,19 @@ namespace MEDCoupling * \throw If \a new2OldEnd - \a new2OldBg > \a this->getNumberOfTuples(). */ template - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - int nbComp(getNumberOfComponents()),oldNbOfTuples(getNumberOfTuples()); - ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); + std::size_t nbComp(getNumberOfComponents()); + mcIdType oldNbOfTuples(getNumberOfTuples()); + ret->alloc(std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); T *pt(ret->getPointer()); const T *srcPt(getConstPointer()); - int i(0); - for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++) + mcIdType i(0); + for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++) if(*w>=0 && *w - void DataArrayTemplate::rearrange(int newNbOfCompo) + void DataArrayTemplate::rearrange(std::size_t newNbOfCompo) { checkAllocated(); if(newNbOfCompo<1) @@ -1235,7 +1343,7 @@ namespace MEDCoupling std::ostringstream oss; oss << Traits::ArrayTypeName << "::rearrange : nbOfElems%newNbOfCompo!=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits::max()) + if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits::max()) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -1259,8 +1367,7 @@ namespace MEDCoupling void DataArrayTemplate::transpose() { checkAllocated(); - int nbOfTuples(getNumberOfTuples()); - rearrange(nbOfTuples); + rearrange(getNumberOfTuples()); } /*! @@ -1277,7 +1384,7 @@ namespace MEDCoupling * \throw If \a this is not allocated. */ template - typename Traits::ArrayType *DataArrayTemplate::changeNbOfComponents(int newNbOfComp, T dftValue) const + typename Traits::ArrayType *DataArrayTemplate::changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); @@ -1285,18 +1392,19 @@ namespace MEDCoupling ret->alloc(getNumberOfTuples(),newNbOfComp); const T *oldc(getConstPointer()); T *nc(ret->getPointer()); - int nbOfTuples(getNumberOfTuples()),oldNbOfComp(getNumberOfComponents()); - int dim(std::min(oldNbOfComp,newNbOfComp)); - for(int i=0;isetName(getName()); - for(int i=0;isetInfoOnComponent(i,getInfoOnComponent(i)); ret->setName(getName()); return ret.retn(); @@ -1320,25 +1428,25 @@ namespace MEDCoupling * \endif */ template - typename Traits::ArrayType *DataArrayTemplate::myKeepSelectedComponents(const std::vector& compoIds) const + typename Traits::ArrayType *DataArrayTemplate::myKeepSelectedComponents(const std::vector& compoIds) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - std::size_t newNbOfCompo(compoIds.size()); - int oldNbOfCompo(getNumberOfComponents()); - for(std::vector::const_iterator it=compoIds.begin();it!=compoIds.end();it++) + 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)<0 || (*it)>=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()); } - int nbOfTuples(getNumberOfTuples()); - ret->alloc(nbOfTuples,(int)newNbOfCompo); + mcIdType nbOfTuples(getNumberOfTuples()); + ret->alloc(nbOfTuples,newNbOfCompo); ret->copyPartOfStringInfoFrom(*this,compoIds); const T *oldc(getConstPointer()); T *nc(ret->getPointer()); - for(int i=0;i - typename Traits::ArrayType *DataArrayTemplate::subArray(int tupleIdBg, int tupleIdEnd) const + typename Traits::ArrayType *DataArrayTemplate::subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd) const { checkAllocated(); - int nbt(getNumberOfTuples()); + mcIdType nbt=getNumberOfTuples(); if(tupleIdBg<0) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::subArray : The tupleIdBg parameter must be greater than 0 !"; @@ -1374,7 +1482,7 @@ namespace MEDCoupling std::ostringstream oss; oss << Traits::ArrayTypeName << ":subArray : The tupleIdBg parameter is greater than number of tuples !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - int trueEnd=tupleIdEnd; + mcIdType trueEnd=tupleIdEnd; if(tupleIdEnd!=-1) { if(tupleIdEnd>nbt) @@ -1385,7 +1493,7 @@ namespace MEDCoupling } else trueEnd=nbt; - int nbComp(getNumberOfComponents()); + std::size_t nbComp=getNumberOfComponents(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); ret->alloc(trueEnd-tupleIdBg,nbComp); @@ -1410,18 +1518,18 @@ namespace MEDCoupling * \sa DataArrayDouble::subArray. */ template - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafeSlice(int bg, int end2, int step) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); - int nbComp(getNumberOfComponents()); + std::size_t nbComp(getNumberOfComponents()); std::ostringstream oss; oss << Traits::ArrayTypeName << "::selectByTupleIdSafeSlice : "; - int 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); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1464,7 +1572,7 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValues1(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues1(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!a) { @@ -1474,13 +1582,14 @@ namespace MEDCoupling const char msg[]="DataArrayTemplate::setPartOfValues1"; checkAllocated(); a->checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + 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"); - DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); + DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value"); bool assignTech(true); - if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp) + if(a->getNbOfElems()==newNbOfTuples*newNbOfComp) { if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1494,16 +1603,16 @@ namespace MEDCoupling T *pt(getPointer()+bgTuples*nbComp+bgComp); if(assignTech) { - for(int i=0;i - void DataArrayTemplate::setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) + void DataArrayTemplate::setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple1"; checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); + 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"); - DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); + DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value"); T *pt=getPointer()+bgTuples*nbComp+bgComp; - for(int i=0;i - void DataArrayTemplate::setPartOfValues2(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues2(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare) { if(!a) throw INTERP_KERNEL::Exception("DataArrayDouble::setPartOfValues2 : input DataArrayDouble is NULL !"); const char msg[]="DataArrayTemplate::setPartOfValues2"; checkAllocated(); a->checkAllocated(); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); - for(const int *z=bgComp;z!=endComp;z++) - DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); - int newNbOfTuples((int)std::distance(bgTuples,endTuples)); - int newNbOfComp((int)std::distance(bgComp,endComp)); + std::size_t nbComp(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); + for(const mcIdType *z=bgComp;z!=endComp;z++) + DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); + mcIdType newNbOfTuples(ToIdType(std::distance(bgTuples,endTuples))); + mcIdType newNbOfComp(ToIdType(std::distance(bgComp,endComp))); bool assignTech(true); - if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp) + if(a->getNbOfElems()==newNbOfTuples*newNbOfComp) { if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1615,10 +1726,10 @@ namespace MEDCoupling const T *srcPt(a->getConstPointer()); if(assignTech) { - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) { DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); - for(const int *z=bgComp;z!=endComp;z++,srcPt++) + for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt++) { pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt; } @@ -1626,11 +1737,11 @@ namespace MEDCoupling } else { - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) { const T *srcPt2=srcPt; DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); - for(const int *z=bgComp;z!=endComp;z++,srcPt2++) + for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt2++) { pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2; } @@ -1661,15 +1772,16 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) + void DataArrayTemplate::setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp) { checkAllocated(); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); - for(const int *z=bgComp;z!=endComp;z++) - DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); + std::size_t nbComp=getNumberOfComponents(); + mcIdType nbOfTuples=getNumberOfTuples(); + for(const mcIdType *z=bgComp;z!=endComp;z++) + DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); T *pt(getPointer()); - for(const int *w=bgTuples;w!=endTuples;w++) - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *z=bgComp;z!=endComp;z++) { DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); pt[(std::size_t)(*w)*nbComp+(*z)]=a; @@ -1723,20 +1835,20 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValues3(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues3(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues3 : input DataArrayDouble is NULL !"); const char msg[]="DataArrayTemplate::setPartOfValues3"; checkAllocated(); a->checkAllocated(); - int newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg); - int nbComp=getNumberOfComponents(); - int nbOfTuples=getNumberOfTuples(); - DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); - int newNbOfTuples=(int)std::distance(bgTuples,endTuples); + mcIdType newNbOfComp=DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg); + std::size_t nbComp(getNumberOfComponents()); + mcIdType nbOfTuples(getNumberOfTuples()); + DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value"); + mcIdType newNbOfTuples=ToIdType(std::distance(bgTuples,endTuples)); bool assignTech=true; - if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp) + if(a->getNbOfElems()==newNbOfTuples*newNbOfComp) { if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1750,8 +1862,8 @@ namespace MEDCoupling const T *srcPt(a->getConstPointer()); if(assignTech) { - for(const int *w=bgTuples;w!=endTuples;w++) - for(int j=0;j - void DataArrayTemplate::setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) + void DataArrayTemplate::setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple3"; checkAllocated(); - int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); - int nbComp(getNumberOfComponents()),nbOfTuples(getNumberOfTuples()); - DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value"); + 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"); T *pt(getPointer()+bgComp); - for(const int *w=bgTuples;w!=endTuples;w++) - for(int j=0;j - void DataArrayTemplate::setPartOfValues4(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues4(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare) {if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues4 : input DataArrayTemplate is NULL !"); const char msg[]="DataArrayTemplate::setPartOfValues4"; checkAllocated(); a->checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int newNbOfComp((int)std::distance(bgComp,endComp)); - int nbComp(getNumberOfComponents()); - for(const int *z=bgComp;z!=endComp;z++) - DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); - int nbOfTuples(getNumberOfTuples()); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + std::size_t newNbOfComp(std::distance(bgComp,endComp)); + std::size_t nbComp(getNumberOfComponents()); + for(const mcIdType *z=bgComp;z!=endComp;z++) + DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); + mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); bool assignTech(true); - if(a->getNbOfElems()==(std::size_t)newNbOfTuples*newNbOfComp) + if(a->getNbOfElems()==ToIdType(newNbOfTuples*newNbOfComp)) { if(strictCompoCompare) a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg); @@ -1877,35 +1990,35 @@ namespace MEDCoupling T *pt(getPointer()+bgTuples*nbComp); if(assignTech) { - for(int i=0;i - void DataArrayTemplate::setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) + void DataArrayTemplate::setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple4"; checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int nbComp(getNumberOfComponents()); - for(const int *z=bgComp;z!=endComp;z++) - DataArray::CheckValueInRange(nbComp,*z,"invalid component id"); - int nbOfTuples(getNumberOfTuples()); + 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"); + mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); T *pt=getPointer()+bgTuples*nbComp; - for(int i=0;i - void DataArrayTemplate::setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayInt *tuplesSelec) + void DataArrayTemplate::setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayIdType *tuplesSelec) { if(!a || !tuplesSelec) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : input DataArrayTemplate is NULL !"); @@ -1943,11 +2056,11 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : This and a do not have the same number of components !"); if(tuplesSelec->getNumberOfComponents()!=2) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : Expecting to have a tuple selector DataArrayInt instance with exactly 2 components !"); - int thisNt(getNumberOfTuples()); - int aNt(a->getNumberOfTuples()); + mcIdType thisNt(getNumberOfTuples()); + mcIdType aNt(a->getNumberOfTuples()); T *valsToSet(getPointer()); const T *valsSrc(a->getConstPointer()); - for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2) + for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2) { if(tuple[1]>=0 && tuple[1] - void DataArrayTemplate::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) + void DataArrayTemplate::setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) { if(!aBase || !tuplesSelec) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray is NULL !"); @@ -2008,14 +2121,14 @@ namespace MEDCoupling 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 !"); - int thisNt(getNumberOfTuples()); - int aNt(a->getNumberOfTuples()); - int 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 !"); const T *valsSrc=a->getConstPointer(); - for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp) + for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp) { if(*tuple>=0 && *tuple - void DataArrayTemplate::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) + void DataArrayTemplate::setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) { if(!aBase) { @@ -2070,17 +2183,18 @@ namespace MEDCoupling a->checkAllocated(); std::size_t nbOfComp(getNumberOfComponents()); const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice"; - int 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 !"); - int thisNt(getNumberOfTuples()),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 !"); if(end2>aNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid range of values to read !"); const T *valsSrc(a->getConstPointer()+bg*nbOfComp); - for(int i=0;i - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const { checkAllocated(); - int nbOfComp(getNumberOfComponents()),nbOfTuplesThis(getNumberOfTuples()); + std::size_t nbOfComp(getNumberOfComponents()); + mcIdType nbOfTuplesThis(getNumberOfTuples()); if(ranges.empty()) { MCAuto ret0(buildNewEmptyInstance()); @@ -2111,9 +2226,9 @@ namespace MEDCoupling ret->copyStringInfoFrom(*this); return ret.retn(); } - int ref(ranges.front().first),nbOfTuples(0); + mcIdType ref(ranges.front().first),nbOfTuples(0); bool isIncreasing(true); - for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) + for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) { if((*it).first<=(*it).second) { @@ -2146,7 +2261,7 @@ namespace MEDCoupling ret->copyStringInfoFrom(*this); const T *src(getConstPointer()); T *work(ret->getPointer()); - for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) + 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(); } @@ -2164,7 +2279,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of components not equal to one !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples<1) throw INTERP_KERNEL::Exception("DataArrayTemplate::front : number of tuples must be >= 1 !"); return *(getConstPointer()); @@ -2183,7 +2298,7 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of components not equal to one !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples<1) throw INTERP_KERNEL::Exception("DataArrayTemplate::back : number of tuples must be >= 1 !"); return *(getConstPointer()+nbOfTuples-1); @@ -2198,17 +2313,17 @@ namespace MEDCoupling * \sa getMaxAbsValue, getMinValue */ template - T DataArrayTemplate::getMaxValue(int& tupleId) const + T DataArrayTemplate::getMaxValue(mcIdType& tupleId) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); const T *loc(std::max_element(vals,vals+nbOfTuples)); - tupleId=(int)std::distance(vals,loc); + tupleId=ToIdType(std::distance(vals,loc)); return *loc; } @@ -2240,22 +2355,22 @@ namespace MEDCoupling checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxAbsValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !"); - std::size_t nbTuples(this->getNumberOfTuples()); + mcIdType nbTuples(this->getNumberOfTuples()); if(nbTuples==0) throw INTERP_KERNEL::Exception("DataArrayTemplate::getMaxAbsValue : empty array !"); T ret((T)-1); tupleId=0; const T *pt(begin()); - for(std::size_t i=0;iret) { ret=cand; tupleId=i; } } - return this->getIJ(tupleId,0); + return this->getIJ(ToIdType(tupleId),0); } /*! @@ -2279,17 +2394,17 @@ namespace MEDCoupling * \throw If \a this->getNumberOfTuples() < 1 */ template - T DataArrayTemplate::getMinValue(int& tupleId) const + T DataArrayTemplate::getMinValue(mcIdType& tupleId) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before call 'getMinValueInArray' method !"); - int nbOfTuples(getNumberOfTuples()); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); const T *loc(std::min_element(vals,vals+nbOfTuples)); - tupleId=(int)std::distance(vals,loc); + tupleId=ToIdType(std::distance(vals,loc)); return *loc; } @@ -2308,11 +2423,12 @@ namespace MEDCoupling } template - void DataArrayTemplate::circularPermutation(int nbOfShift) + void DataArrayTemplate::circularPermutation(mcIdType nbOfShift) { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); - int effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); if(effNbSh==0) return ; T *work(getPointer()); @@ -2333,18 +2449,19 @@ namespace MEDCoupling } template - void DataArrayTemplate::circularPermutationPerTuple(int nbOfShift) + void DataArrayTemplate::circularPermutationPerTuple(mcIdType nbOfShift) { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); - int effNbSh(EffectiveCircPerm(nbOfShift,nbOfCompo)); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo))); if(effNbSh==0) return ; T *work(getPointer()); - if(effNbSh buf(new T[effNbSh]); - for(int i=0;i buf(new T[nbOfCompo-effNbSh]); - for(int i=0;i sts(nbOfCompo); - for(int i=0;i::reversePerTuple() { checkAllocated(); - int nbOfCompo(getNumberOfComponents()),nbTuples(getNumberOfTuples()); + std::size_t nbOfCompo(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); if(nbOfCompo<=1) return ; T *work(getPointer()); - for(int i=0;i + static void copyCast (const TIn *begin, const TIn *end, TOut* dest) + { + for (const TIn *src = begin; src != end; ++src, ++dest) + *dest=static_cast(*src); + } + } + template template MCAuto< typename Traits::ArrayType > DataArrayTemplateClassic::convertToOtherTypeOfArr() const @@ -2423,9 +2552,8 @@ namespace MEDCoupling const T *src(this->begin()); U *dest(ret->getPointer()); // to make Visual C++ happy : instead of std::size_t nbOfVals=getNbOfElems(); std::copy(src,src+nbOfVals,dest); - //for(const T *src=this->begin();src!=this->end();src++,dest++) - // *dest=(int)*src; - std::copy(src,src+nbOfVals,dest); + copyCast(src, src+nbOfVals, dest); + //std::copy(src,src+nbOfVals,dest); ret->copyStringInfoFrom(*this); return ret; } @@ -2472,17 +2600,18 @@ namespace MEDCoupling * \throw If \a this is not allocated, or \a compoId is not in [0,\c this->getNumberOfComponents() ). */ template - void DataArrayTemplateClassic::applyLin(T a, T b, int compoId) + void DataArrayTemplateClassic::applyLin(T a, T b, std::size_t compoId) { this->checkAllocated(); - T *ptr(this->getPointer()+compoId); - int nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples()); - if(compoId<0 || compoId>=nbOfComp) + std::size_t nbOfComp=this->getNumberOfComponents(); + if(compoId>=nbOfComp) { std::ostringstream oss; oss << "DataArrayDouble::applyLin : The compoId requested (" << compoId << ") is not valid ! Must be in [0," << nbOfComp << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int i=0;igetPointer()+compoId); + mcIdType nbOfTuple=this->getNumberOfTuples(); + for(mcIdType i=0;ideclareAsNew(); } @@ -2518,7 +2647,8 @@ namespace MEDCoupling { this->checkAllocated(); MCAuto::ArrayType> newArr(Traits::ArrayType::New()); - int nbOfTuples(this->getNumberOfTuples()),nbOfComp(this->getNumberOfComponents()); + mcIdType nbOfTuples(this->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); const T *cptr(this->begin()); std::transform(cptr,cptr+nbOfTuples*nbOfComp,newArr->getPointer(),std::negate()); @@ -2535,8 +2665,10 @@ namespace MEDCoupling const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !"; this->checkAllocated(); other->checkAllocated(); - int nbOfTuple(this->getNumberOfTuples()),nbOfTuple2(other->getNumberOfTuples()); - int nbOfComp(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents()); + mcIdType nbOfTuple(this->getNumberOfTuples()); + mcIdType nbOfTuple2(other->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); + std::size_t nbOfComp2(other->getNumberOfComponents()); if(nbOfTuple==nbOfTuple2) { if(nbOfComp==nbOfComp2) @@ -2547,7 +2679,7 @@ namespace MEDCoupling { T *ptr(this->getPointer()); const T *ptrc(other->begin()); - for(int i=0;igetPointer()); const T *ptrc(other->begin()); - for(int i=0;igetNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); - int nbOfComp1(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents()); + mcIdType nbOfTuple1(a1->getNumberOfTuples()); + mcIdType nbOfTuple2(a2->getNumberOfTuples()); + std::size_t nbOfComp1(a1->getNumberOfComponents()); + std::size_t nbOfComp2(a2->getNumberOfComponents()); if(nbOfTuple2==nbOfTuple1) { if(nbOfComp1==nbOfComp2) @@ -2686,7 +2820,7 @@ namespace MEDCoupling ret->alloc(nbOfTuple1,nbOfComp1); const T *a2Ptr(a2->begin()),*a1Ptr(a1->begin()); T *res(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*a1); return ret.retn(); @@ -2704,7 +2838,7 @@ namespace MEDCoupling ret->alloc(nbOfTuple1,nbOfComp1); const T *a1ptr=a1->begin(),*a2ptr(a2->begin()); T *pt(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*a1); return ret.retn(); @@ -2784,8 +2918,10 @@ namespace MEDCoupling { if(!a1 || !a2) throw INTERP_KERNEL::Exception("DataArrayDouble::MulAdd : input DataArrayDouble instance is NULL !"); - int nbOfTuple(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); - int nbOfComp(a1->getNumberOfComponents()),nbOfComp2(a2->getNumberOfComponents()); + mcIdType nbOfTuple(a1->getNumberOfTuples()); + mcIdType nbOfTuple2(a2->getNumberOfTuples()); + std::size_t nbOfComp(a1->getNumberOfComponents()); + std::size_t nbOfComp2(a2->getNumberOfComponents()); MCAuto::ArrayType> ret=0; if(nbOfTuple==nbOfTuple2) { @@ -2798,7 +2934,7 @@ namespace MEDCoupling } else { - int nbOfCompMin,nbOfCompMax; + std::size_t nbOfCompMin,nbOfCompMax; const typename Traits::ArrayType *aMin, *aMax; if(nbOfComp>nbOfComp2) { @@ -2817,7 +2953,7 @@ namespace MEDCoupling const T *aMinPtr(aMin->begin()); const T *aMaxPtr(aMax->begin()); T *res=ret->getPointer(); - for(int i=0;icopyStringInfoFrom(*aMax); } @@ -2829,14 +2965,14 @@ namespace MEDCoupling { if(nbOfComp==nbOfComp2) { - int nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2); + mcIdType nbOfTupleMax=std::max(nbOfTuple,nbOfTuple2); const typename Traits::ArrayType *aMin(nbOfTuple>nbOfTuple2?a2:a1); const typename Traits::ArrayType *aMax(nbOfTuple>nbOfTuple2?a1:a2); const T *aMinPtr(aMin->begin()),*aMaxPtr(aMax->begin()); ret=Traits::ArrayType::New(); ret->alloc(nbOfTupleMax,nbOfComp); T *res(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*aMax); } @@ -2984,36 +3120,36 @@ struct NotInRange * \sa DataArrayInt::findIdsInRange */ template - DataArrayInt *DataArrayTemplateClassic::findIdsStrictlyNegative() const + DataArrayIdType *DataArrayTemplateClassic::findIdsStrictlyNegative() const { LowerThan lt((T)0); - MCAuto ret(findIdsAdv(lt)); + MCAuto ret(findIdsAdv(lt)); return ret.retn(); } template - MCAuto DataArrayTemplateClassic::findIdsGreaterOrEqualTo(T val) const + MCAuto DataArrayTemplateClassic::findIdsGreaterOrEqualTo(T val) const { GreatEqual ge(val); return findIdsAdv(ge); } template - MCAuto DataArrayTemplateClassic::findIdsGreaterThan(T val) const + MCAuto DataArrayTemplateClassic::findIdsGreaterThan(T val) const { GreaterThan gt(val); return findIdsAdv(gt); } template - MCAuto DataArrayTemplateClassic::findIdsLowerOrEqualTo(T val) const + MCAuto DataArrayTemplateClassic::findIdsLowerOrEqualTo(T val) const { LowerEqual le(val); return findIdsAdv(le); } template - MCAuto DataArrayTemplateClassic::findIdsLowerThan(T val) const + MCAuto DataArrayTemplateClassic::findIdsLowerThan(T val) const { LowerThan lt(val); return findIdsAdv(lt); @@ -3071,31 +3207,31 @@ struct NotInRange for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - std::size_t nbOfTuples((*it)->getNumberOfTuples()); - std::vector nbc(a.size()); + mcIdType nbOfTuples((*it)->getNumberOfTuples()); + std::vector nbc(a.size()); std::vector pts(a.size()); nbc[0]=(*it)->getNumberOfComponents(); pts[0]=(*it++)->getConstPointer(); - for(int i=1;it!=a.end();it++,i++) + for(mcIdType i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !"); nbc[i]=(*it)->getNumberOfComponents(); pts[i]=(*it)->getConstPointer(); } - int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0); + std::size_t totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),(std::size_t)0); typename Traits::ArrayType *ret(Traits::ArrayType::New()); ret->alloc(nbOfTuples,totalNbOfComp); T *retPtr(ret->getPointer()); - for(std::size_t i=0;isetInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -3161,21 +3297,22 @@ struct NotInRange { this->checkAllocated(); other->checkAllocated(); - std::size_t nbOfTuples(this->getNumberOfTuples()); + mcIdType nbOfTuples(this->getNumberOfTuples()); if(nbOfTuples!=other->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayDouble::meldWith : mismatch of number of tuples !"); - int nbOfComp1(this->getNumberOfComponents()),nbOfComp2(other->getNumberOfComponents()); + std::size_t nbOfComp1=this->getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); T *newArr=(T *)malloc((nbOfTuples*(nbOfComp1+nbOfComp2))*sizeof(T)); T *w=newArr; const T *inp1(this->begin()),*inp2(other->begin()); - for(std::size_t i=0;iuseArray(newArr,true,DeallocType::C_DEALLOC,nbOfTuples,nbOfComp1+nbOfComp2); - std::vector compIds(nbOfComp2); - for(int i=0;i compIds(nbOfComp2); + for(std::size_t i=0;icopyPartOfStringInfoFrom2(compIds,*other); } @@ -3188,21 +3325,21 @@ struct NotInRange * \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1. */ template - typename Traits::ArrayType *DataArrayTemplateClassic::duplicateEachTupleNTimes(int nbTimes) const + typename Traits::ArrayType *DataArrayTemplateClassic::duplicateEachTupleNTimes(mcIdType nbTimes) const { this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : this should have only one component !"); if(nbTimes<1) throw INTERP_KERNEL::Exception("DataArrayDouble::duplicateEachTupleNTimes : nb times should be >= 1 !"); - int nbTuples(this->getNumberOfTuples()); + mcIdType nbTuples=this->getNumberOfTuples(); const T *inPtr(this->begin()); MCAuto::ArrayType> ret(Traits::ArrayType::New()); ret->alloc(nbTimes*nbTuples,1); T *retPtr(ret->getPointer()); - for(int i=0;icopyStringInfoFrom(*this); @@ -3253,8 +3390,8 @@ struct NotInRange { this->checkAllocated(); MCAuto::ArrayType> newArr(Traits::ArrayType::New()); - int nbOfTuples(this->getNumberOfTuples()); - int nbOfComp(this->getNumberOfComponents()); + mcIdType nbOfTuples(this->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); newArr->alloc(nbOfTuples,nbOfComp); std::transform(this->begin(),this->end(),newArr->getPointer(),std::ptr_fun(std::abs)); newArr->copyStringInfoFrom(*this); @@ -3288,12 +3425,13 @@ struct NotInRange typename Traits::ArrayType *DataArrayTemplateClassic::sumPerTuple() const { this->checkAllocated(); - std::size_t nbOfComp(this->getNumberOfComponents()),nbOfTuple(this->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); + mcIdType nbOfTuple(this->getNumberOfTuples()); MCAuto::ArrayType> ret(Traits::ArrayType::New()); ret->alloc(nbOfTuple,1); const T *src(this->begin()); T *dest(ret->getPointer()); - for(std::size_t i=0;igetNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::iota : works only for arrays with only one component, you can call 'rearrange' method before !"); T *ptr(this->getPointer()); - std::size_t ntuples(this->getNumberOfTuples()); - for(std::size_t i=0;igetNumberOfTuples()); + for(mcIdType i=0;ideclareAsNew(); } @@ -3353,7 +3491,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.repr(this->getNumberOfComponents(),stream); + this->_mem.repr(ToIdType(this->getNumberOfComponents()),stream); } template @@ -3361,7 +3499,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.reprZip(this->getNumberOfComponents(),stream); + this->_mem.reprZip(ToIdType(this->getNumberOfComponents()),stream); } template @@ -3369,7 +3507,7 @@ struct NotInRange { DataArray::reprWithoutNameStream(stream); ImplReprTraits::SetPrecision(stream); - this->_mem.reprNotTooLong(this->getNumberOfComponents(),stream); + this->_mem.reprNotTooLong(ToIdType(this->getNumberOfComponents()),stream); } /*! @@ -3433,6 +3571,30 @@ struct NotInRange return true; } + ///////////////////////////////// + + /*! + * Returns the only one value in \a this, if and only if number of elements + * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated. + * \return double - the sole value stored in \a this array. + * \throw If at least one of conditions stated above is not fulfilled. + */ + template + T DataArrayDiscrete::intValue() const + { + if(this->isAllocated()) + { + if(this->getNbOfElems()==1) + { + return *this->getConstPointer(); + } + else + throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is allocated but number of elements is not equal to 1 !"); + } + else + throw INTERP_KERNEL::Exception("DataArrayInt::intValue : DataArrayInt instance is not allocated !"); + } + /*! * Equivalent to DataArrayInt::isEqual except that if false the reason of * mismatch is given. @@ -3509,11 +3671,11 @@ struct NotInRange this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of components of this should be equal to one !"); - int nbOfTuples(this->getNumberOfTuples()); - if(nbOfTuples!=(int)vec.size()) + mcIdType nbOfTuples(this->getNumberOfTuples()); + if(nbOfTuples!=ToIdType(vec.size())) throw INTERP_KERNEL::Exception("DataArrayInt::switchOnTupleEqualTo : number of tuples of this should be equal to size of input vector of bool !"); const T *pt(this->begin()); - for(int i=0;icheckAllocated(); if(this->getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !"); - std::size_t nbTuple(this->getNumberOfTuples()); + mcIdType nbTuple(this->getNumberOfTuples()); other.checkAllocated(); if(nbTuple!=other.getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !"); @@ -3579,14 +3741,14 @@ struct NotInRange ret->alloc(nbTuple,1); ret->fillWithValue(-1); const T *pt(this->begin()); - std::map mm; - for(std::size_t i=0;i mm; + for(mcIdType i=0;igetPointer()); - for(std::size_t i=0;i::const_iterator it=mm.find(pt[i]); + std::map::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' !"; @@ -3616,19 +3778,19 @@ struct NotInRange if(this->getNumberOfComponents()!=1 || partOfThis.getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::indicesOfSubPart : this and input array must be one component array !"); this->checkAllocated(); partOfThis.checkAllocated(); - std::size_t thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples()); + mcIdType thisNbTuples(this->getNumberOfTuples()),nbTuples(partOfThis.getNumberOfTuples()); const T *thisPt(this->begin()),*pt(partOfThis.begin()); MCAuto ret(DataArrayIdType::New()); ret->alloc(nbTuples,1); mcIdType *retPt(ret->getPointer()); - std::map m; - for(std::size_t i=0;i m; + for(mcIdType i=0;i::const_iterator it(m.find(*pt)); + std::map::const_iterator it(m.find(ToIdType(*pt))); if(it!=m.end()) *retPt=(*it).second; else @@ -3757,35 +3919,36 @@ struct NotInRange /*! * Returns an integer value characterizing \a this array, which is useful for a quick * comparison of many instances of DataArrayInt. - * \return int - the hash value. + * \return mcIdType - the hash value. * \throw If \a this is not allocated. */ template - int DataArrayDiscrete::getHashCode() const + mcIdType DataArrayDiscrete::getHashCode() const { this->checkAllocated(); - std::size_t nbOfElems(this->getNbOfElems()); - int ret=nbOfElems*65536; - int delta=3; + mcIdType nbOfElems=ToIdType(this->getNbOfElems()); + mcIdType ret=nbOfElems*65536; + mcIdType delta=3; if(nbOfElems>48) delta=nbOfElems/8; T ret0(0); const T *pt(this->begin()); - for(std::size_t i=0;i void DataArrayDiscrete::reprCppStream(const std::string& varName, std::ostream& stream) const { - std::size_t nbTuples(this->getNumberOfTuples()),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) { - stream << "const int " << varName << "Data[" << nbTuples*nbComp << "]={"; - std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator(stream,",")); + stream << "const mcIdType " << varName << "Data[" << nbTuples*nbComp << "]={"; + std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator(stream,",")); stream << data[nbTuples*nbComp-1] << "};" << std::endl; stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl; } @@ -3807,7 +3970,7 @@ struct NotInRange std::size_t nbOfCompo(this->getNumberOfComponents()); if(nbOfCompo>=1) { - std::size_t 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); } @@ -3822,16 +3985,17 @@ struct NotInRange void DataArrayDiscrete::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const T *data(this->begin()); - std::size_t nbOfTuples(this->getNumberOfTuples()),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; - for(int i=0;i1) { oss2 << "("; - for(int j=0;j - void DataArrayDiscrete::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const + void DataArrayDiscrete::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; this->checkAllocated(); @@ -3873,14 +4037,14 @@ struct NotInRange else if(std::string(type)=="Int8") { INTERP_KERNEL::AutoPtr tmp(new char[this->getNbOfElems()]); - std::copy(this->begin(),this->end(),(char *)tmp); + copyCast(this->begin(),this->end(),(char *)tmp); byteArr->insertAtTheEnd((char *)tmp,(char *)tmp+this->getNbOfElems()); byteArr->insertAtTheEnd(SPACE,SPACE+4); } else if(std::string(type)=="UInt8") { INTERP_KERNEL::AutoPtr tmp(new unsigned char[this->getNbOfElems()]); - std::copy(this->begin(),this->end(),(unsigned char *)tmp); + copyCast(this->begin(),this->end(),(unsigned char *)tmp); byteArr->insertAtTheEnd((unsigned char *)tmp,(unsigned char *)tmp+this->getNbOfElems()); byteArr->insertAtTheEnd(SPACE,SPACE+4); } @@ -3894,7 +4058,7 @@ struct NotInRange else { ofs << " RangeMin=\"" << this->getMinValueInArray() << "\" RangeMax=\"" << this->getMaxValueInArray() << "\" format=\"ascii\">\n" << idt; - std::copy(this->begin(),this->end(),std::ostream_iterator(ofs," ")); + std::copy(this->begin(),this->end(),std::ostream_iterator(ofs," ")); } ofs << std::endl << idt << "\n"; } @@ -3918,9 +4082,10 @@ struct NotInRange this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - std::size_t nbElemsIn(std::distance(indArrBg,indArrEnd)),nbOfTuples(this->getNumberOfTuples()); + mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd)); + mcIdType nbOfTuples(this->getNumberOfTuples()); T *pt(this->getPointer()); - for(std::size_t i=0;i=0 && *pt - void DataArrayDiscrete::transformWithIndArr(const MapKeyVal& m) + void DataArrayDiscrete::transformWithIndArr(const MapKeyVal& m) { this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !"); const typename std::map& dat(m.data()); - std::size_t nbOfTuples(this->getNumberOfTuples()); + mcIdType nbOfTuples(this->getNumberOfTuples()); T *pt(this->getPointer()); - for(std::size_t i=0;i::const_iterator it(dat.find(*pt)); if(it!=dat.end()) @@ -3974,15 +4139,3468 @@ struct NotInRange throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqual : the array must have only one component, you can call 'rearrange' method before !"); const T *cptr(this->getConstPointer()); MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); - std::size_t nbOfTuples(this->getNumberOfTuples()); - for(std::size_t i=0;igetNumberOfTuples()); + for(mcIdType i=0;ipushBackSilent(ToIdType(i)); return ret.retn(); } - //////////////////////////////////// + /*! + * Creates a one-dimensional DataArrayInt (\a res) whose contents are computed from + * values of \a this (\a a) and the given (\a indArr) arrays as follows: + * \a res[ \a indArr[ \a a[ i ]]] = i. I.e. for each value in place i \a v = \a a[ i ], + * new value in place \a indArr[ \a v ] is i. + * \param [in] indArrBg - the array holding indices within the result array to assign + * indices of values of \a this array pointing to values of \a indArrBg. + * \param [in] indArrEnd - specifies the end of the array \a indArrBg, so that + * the last value of \a indArrBg is \a indArrEnd[ -1 ]. + * \return DataArrayInt * - the new instance of DataArrayInt. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If any value of \a this array is not a valid index for \a indArrBg array. + * \throw If any value of \a indArrBg is not a valid index for \a this array. + */ + template + DataArrayIdType *DataArrayDiscrete::transformWithIndArrR(const T *indArrBg, const T *indArrEnd) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !"); + mcIdType nbElemsIn=ToIdType(std::distance(indArrBg,indArrEnd)); + mcIdType nbOfTuples(this->getNumberOfTuples()); + const T *pt=this->getConstPointer(); + MCAuto ret=DataArrayIdType::New(); + ret->alloc(nbOfTuples,1); + ret->fillWithValue(-1); + mcIdType *tmp=ret->getPointer(); + for(mcIdType i=0;i=0 && *pt=0 && posgetNumberOfComponents() != 1. + * \throw If \a arrEnd - arrBg < 2. + * \throw If any value of \a this is not less than \a arrEnd[-1]. + */ + template + void DataArrayDiscrete::splitByValueRange(const T *arrBg, const T *arrEnd, + DataArrayType *& castArr, DataArrayType *& rankInsideCast, DataArrayType *& castsPresent) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("Call splitByValueRange method on DataArrayInt with only one component, you can call 'rearrange' method before !"); + mcIdType nbOfTuples=this->getNumberOfTuples(); + std::size_t nbOfCast=std::distance(arrBg,arrEnd); + if(nbOfCast<2) + throw INTERP_KERNEL::Exception("DataArrayInt::splitByValueRange : The input array giving the cast range values should be of size >=2 !"); + nbOfCast--; + const T *work=this->getConstPointer(); + typedef std::reverse_iterator rintstart; + rintstart bg(arrEnd);//OK no problem because size of 'arr' is greater or equal 2 + rintstart end2(arrBg); + MCAuto ret1=DataArrayType::New(); + MCAuto ret2=DataArrayType::New(); + MCAuto ret3=DataArrayType::New(); + ret1->alloc(nbOfTuples,1); + ret2->alloc(nbOfTuples,1); + T *ret1Ptr=ret1->getPointer(); + T *ret2Ptr=ret2->getPointer(); + std::set castsDetected; + for(mcIdType i=0;i(), work[i])); + std::size_t pos=std::distance(bg,res); + std::size_t pos2=nbOfCast-pos; + if(pos2(pos2); + ret2Ptr[i]=work[i]-arrBg[pos2]; + castsDetected.insert(ret1Ptr[i]); + } + else + { + std::ostringstream oss; oss << "DataArrayInt::splitByValueRange : At rank #" << i << " the value is " << work[i] << " should be in [0," << *bg << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + ret3->alloc(castsDetected.size(),1); + std::copy(castsDetected.begin(),castsDetected.end(),ret3->getPointer()); + castArr=ret1.retn(); + rankInsideCast=ret2.retn(); + castsPresent=ret3.retn(); + } + + /*! + * This method look at \a this if it can be considered as a range defined by the 3-tuple ( \a strt , \a sttoopp , \a stteepp ). + * If false is returned the tuple must be ignored. If true is returned \a this can be considered by a range( \a strt , \a sttoopp , \a stteepp ). + * This method works only if \a this is allocated and single component. If not an exception will be thrown. + * + * \param [out] strt - the start of the range (included) if true is returned. + * \param [out] sttoopp - the end of the range (not included) if true is returned. + * \param [out] stteepp - the step of the range if true is returned. + * \return the verdict of the check. + * + * \sa DataArray::GetNumberOfItemGivenBES + */ + template + bool DataArrayDiscrete::isRange(T& strt, T& sttoopp, T& stteepp) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::isRange : this must be single component array !"); + mcIdType nbTuples(this->getNumberOfTuples()); + if(nbTuples==0) + { strt=0; sttoopp=0; stteepp=1; return true; } + const T *pt(this->begin()); + strt=*pt; + if(nbTuples==1) + { sttoopp=strt+1; stteepp=1; return true; } + strt=*pt; sttoopp=pt[nbTuples-1]; + if(strt==sttoopp) + return false; + if(sttoopp>strt) + { + sttoopp++; + T a(sttoopp-1-strt),tmp(strt); + if(a%(nbTuples-1)!=0) + return false; + stteepp=a/(FromIdType(nbTuples)-1); + for(mcIdType i=0;i(nbTuples)-1)); + for(mcIdType i=0;i + * \ref py_mcdataarrayint_invertarrayo2n2n2o "Here is a Python example". + * \endif + */ + template + DataArrayIdType * DataArrayDiscrete::invertArrayO2N2N2O(mcIdType newNbOfElem) const + { + MCAuto ret(DataArrayIdType::New()); + ret->alloc(newNbOfElem,1); + mcIdType nbOfOldNodes(this->getNumberOfTuples()); + const T *old2New(this->begin()); + mcIdType *pt(ret->getPointer()); + for(mcIdType i=0;i!=nbOfOldNodes;i++) + { + T newp(old2New[i]); + if(newp!=-1) + { + if(newp>=0 && newp + DataArrayIdType *DataArrayDiscrete::invertArrayN2O2O2N(mcIdType oldNbOfElem) const + { + this->checkAllocated(); + MCAuto ret=DataArrayIdType::New(); + ret->alloc(oldNbOfElem,1); + const T *new2Old=this->getConstPointer(); + mcIdType *pt=ret->getPointer(); + std::fill(pt,pt+oldNbOfElem,-1); + mcIdType nbOfNewElems(this->getNumberOfTuples()); + for(mcIdType i=0;i=0 && v + DataArrayIdType *DataArrayDiscrete::invertArrayO2N2N2OBis(mcIdType newNbOfElem) const + { + MCAuto ret=DataArrayIdType::New(); + ret->alloc(newNbOfElem,1); + mcIdType nbOfOldNodes(this->getNumberOfTuples()); + const T *old2New=this->getConstPointer(); + mcIdType *pt=ret->getPointer(); + for(mcIdType i=nbOfOldNodes-1;i>=0;i--) + { + T newp(old2New[i]); + if(newp!=-1) + { + if(newp>=0 && newp + MCAuto< MapKeyVal > DataArrayDiscrete::invertArrayN2O2O2NOptimized() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::invertArrayN2O2O2NOptimized : single component expected !"); + MCAuto< MapKeyVal > ret(MapKeyVal::New()); + std::map& m(ret->data()); + const T *new2Old(this->begin()); + mcIdType nbOfNewElems(this->getNumberOfTuples()); + for(mcIdType i=0;i + MCAuto< MapKeyVal > DataArrayDiscrete::giveN2OOptimized() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::giveN2OOptimized : single component expected !"); + MCAuto< MapKeyVal > ret(MapKeyVal::New()); + std::map& m(ret->data()); + const T *new2Old(this->begin()); + mcIdType nbOfNewElems(this->getNumberOfTuples()); + for(mcIdType i=0;itransformWithIndArr(this->begin(),this->end())==vals. + * Where \a vals is the [valsBg,valsEnd) array and \a ret the array returned by this method. + * This method can be seen as an extension of FindPermutationFromFirstToSecond. + *
+ * \b Example:
+ * - \a this: [17,27,2,10,-4,3,12,27,16] + * - \a val : [3,16,-4,27,17] + * - result: [5,8,4,7,0] + * + * \return - An array of size std::distance(valsBg,valsEnd) + * + * \sa DataArrayInt::FindPermutationFromFirstToSecond + */ + template + MCAuto DataArrayDiscrete::findIdForEach(const T *valsBg, const T *valsEnd) const + { + MCAuto ret(DataArrayIdType::New()); + std::size_t nbOfTuplesOut(std::distance(valsBg,valsEnd)); + ret->alloc(nbOfTuplesOut,1); + MCAuto< MapKeyVal > zeMap(this->invertArrayN2O2O2NOptimized()); + const std::map& dat(zeMap->data()); + mcIdType *ptToFeed(ret->getPointer()); + for(const T *pt=valsBg;pt!=valsEnd;pt++) + { + typename std::map::const_iterator it(dat.find(*pt)); + if(it!=dat.end()) + *ptToFeed++=(*it).second; + else + { + std::ostringstream oss; oss << "DataArrayInt::findIdForEach : error for element at place " << std::distance(valsBg,pt); + oss << " of input array value is " << *pt << " which is not in this !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + return ret; + } + /*! + * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode. + * This map, if applied to \a this array, would make it sorted. For example, if + * \a this array contents are [9,10,0,6,4,11,3,7] then the contents of the result array + * are [5,6,0,3,2,7,1,4]; if this result array (\a res) is used as an argument in call + * \a this->renumber(\a res) then the returned array contains [0,3,4,6,7,9,10,11]. + * This method is useful for renumbering (in MED file for example). For more info + * on renumbering see \ref numbering. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If there are equal values in \a this array. + */ + template + DataArrayIdType *DataArrayDiscrete::checkAndPreparePermutation() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::checkAndPreparePermutation : number of components must == 1 !"); + mcIdType nbTuples(this->getNumberOfTuples()); + const T *pt=this->getConstPointer(); + mcIdType *pt2=this->CheckAndPreparePermutation(pt,pt+nbTuples); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->useArray(pt2,true,DeallocType::C_DEALLOC,nbTuples,1); + return ret; + } + + /*! + * Returns two arrays describing a surjective mapping from \a this set of values (\a A) + * onto a set of values of size \a targetNb (\a B). The surjective function is + * \a B[ \a A[ i ]] = i. That is to say that for each \a id in [0,\a targetNb), where \a + * targetNb < \a this->getNumberOfTuples(), there exists at least one tupleId (\a tid) so + * that this->getIJ( tid, 0 ) == id.
+ * The first of out arrays returns indices of elements of \a this array, grouped by their + * place in the set \a B. The second out array is the index of the first one; it shows how + * many elements of \a A are mapped into each element of \a B.
+ * For more info on + * mapping and its usage in renumbering see \ref numbering.
+ * \b Example: + * - \a this: [0,3,2,3,2,2,1,2] + * - \a targetNb: 4 + * - \a arr: [0, 6, 2,4,5,7, 1,3] + * - \a arrI: [0,1,2,6,8] + * + * This result means:
+ * the element of \a B 0 encounters within \a A once (\a arrI[ 0+1 ] - \a arrI[ 0 ]) and + * its index within \a A is 0 ( \a arr[ 0:1 ] == \a arr[ \a arrI[ 0 ] : \a arrI[ 0+1 ]]);
+ * the element of \a B 2 encounters within \a A 4 times (\a arrI[ 2+1 ] - \a arrI[ 2 ]) and + * its indices within \a A are [2,4,5,7] ( \a arr[ 2:6 ] == \a arr[ \a arrI[ 2 ] : + * \a arrI[ 2+1 ]]);
etc. + * \param [in] targetNb - the size of the set \a B. \a targetNb must be equal or more + * than the maximal value of \a A. + * \param [out] arr - a new instance of DataArrayInt returning indices of + * elements of \a this, grouped by their place in the set \a B. The caller is to delete + * this array using decrRef() as it is no more needed. + * \param [out] arrI - a new instance of DataArrayInt returning size of groups of equal + * elements of \a this. The caller is to delete this array using decrRef() as it + * is no more needed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If any value in \a this is more or equal to \a targetNb. + */ + template + void DataArrayDiscrete::changeSurjectiveFormat(T targetNb, DataArrayIdType *&arr, DataArrayIdType *&arrI) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : number of components must == 1 !"); + mcIdType nbOfTuples(this->getNumberOfTuples()); + const T *input=this->getConstPointer(); + std::vector< std::vector > tmp(targetNb); + for(mcIdType i=0;i=0 && tmp2 retI(DataArrayIdType::New()); + retI->alloc(targetNb+1,1); + mcIdType *retIPtr=retI->getPointer(); + *retIPtr=0; + for(std::vector< std::vector >::const_iterator it1=tmp.begin();it1!=tmp.end();it1++,retIPtr++) + retIPtr[1]=retIPtr[0]+ToIdType((*it1).size()); + if(nbOfTuples!=retI->getIJ(ToIdType(targetNb),0)) + throw INTERP_KERNEL::Exception("DataArrayInt::changeSurjectiveFormat : big problem should never happen !"); + MCAuto ret(DataArrayIdType::New()); + ret->alloc(nbOfTuples,1); + mcIdType *retPtr=ret->getPointer(); + 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(); + } + + /*! + * Returns a new DataArrayInt containing a renumbering map in "New to Old" mode, + * which if applied to \a this array would make it sorted ascendingly. + * For more info on renumbering see \ref numbering.
+ * \b Example:
+ * - \a this: [2,0,1,1,0,1,2,0,1,1,0,0] + * - result: [10,0,5,6,1,7,11,2,8,9,3,4] + * - after applying result to \a this: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2] + * + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + */ + template + DataArrayIdType *DataArrayDiscrete::buildPermArrPerLevel() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildPermArrPerLevel : number of components must == 1 !"); + mcIdType nbOfTuples=this->getNumberOfTuples(); + const T *pt=this->getConstPointer(); + std::map m; + MCAuto ret=DataArrayIdType::New(); + ret->alloc(nbOfTuples,1); + mcIdType *opt=ret->getPointer(); + for(mcIdType i=0;i::iterator it=m.find(val); + if(it!=m.end()) + { + *opt=(*it).second; + (*it).second++; + } + else + { + *opt=0; + m.insert(std::pair(val,1)); + } + } + mcIdType sum=0; + for(typename std::map::iterator it=m.begin();it!=m.end();it++) + { + mcIdType vt=(*it).second; + (*it).second=sum; + sum+=vt; + } + pt=this->getConstPointer(); + opt=ret->getPointer(); + for(mcIdType i=0;igetNumberOfTuples()) + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + */ + template + bool DataArrayDiscrete::isIota(mcIdType sizeExpected) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + return false; + mcIdType nbOfTuples(this->getNumberOfTuples()); + if(nbOfTuples!=sizeExpected) + return false; + const T *pt=this->getConstPointer(); + for(mcIdType i=0;igetNumberOfComponents() != 1 + * \sa DataArrayInt::checkUniformAndGuess + */ + template + bool DataArrayDiscrete::isUniform(T val) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::isUniform : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); + const T *w(this->begin()),*end2(this->end()); + for(;w!=end2;w++) + if(*w!=val) + return false; + return true; + } + + /*! + * This method checks that \a this is uniform. If not and exception will be thrown. + * In case of uniformity the corresponding value is returned. + * + * \return mcIdType - the unique value contained in this + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1 + * \throw If \a this is not uniform. + * \sa DataArrayInt::isUniform + */ + template + T DataArrayDiscrete::checkUniformAndGuess() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); + if(this->empty()) + throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is empty !"); + const T *w(this->begin()),*end2(this->end()); + T ret(*w); + for(;w!=end2;w++) + if(*w!=ret) + throw INTERP_KERNEL::Exception("DataArrayInt::checkUniformAndGuess : this is not uniform !"); + return ret; + } + + /*! + * Checks if all values in \a this array are unique. + * \return bool - \a true if condition above is true + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1 + */ + template + bool DataArrayDiscrete::hasUniqueValues() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::hasOnlyUniqueValues: must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); + std::size_t nbOfElements(this->getNumberOfTuples()); + std::set s(this->begin(),this->end()); // in C++11, should use unordered_set (O(1) complexity) + if (s.size() != nbOfElements) + return false; + return true; + } + + /*! + * Copy all components in a specified order from another DataArrayInt. + * The specified components become the first ones in \a this array. + * Both numerical and textual data is copied. The number of tuples in \a this and + * the other array can be different. + * \param [in] a - the array to copy data from. + * \param [in] compoIds - sequence of zero based indices of components, data of which is + * to be copied. + * \throw If \a a is NULL. + * \throw If \a compoIds.size() != \a a->getNumberOfComponents(). + * \throw If \a compoIds[i] < 0 or \a compoIds[i] > \a this->getNumberOfComponents(). + * + * \if ENABLE_EXAMPLES + * \ref py_mcdataarrayint_setselectedcomponents "Here is a Python example". + * \endif + */ + template + void DataArrayDiscrete::setSelectedComponents(const DataArrayType *a, const std::vector& compoIds) + { + if(!a) + throw INTERP_KERNEL::Exception("DataArrayInt::setSelectedComponents : input DataArrayInt is NULL !"); + this->checkAllocated(); + a->checkAllocated(); + this->copyPartOfStringInfoFrom2(compoIds,*a); + 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(); + T *nc=this->getPointer(); + for(mcIdType i=0;igetNumberOfComponents() != 1. + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsNotEqual(T val) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !"); + const T *cptr(this->getConstPointer()); + MCAuto ret(DataArrayIdType::New()); + ret->alloc(0,1); + mcIdType nbOfTuples(this->getNumberOfTuples()); + for(mcIdType i=0;ipushBackSilent(i); + return ret.retn(); + } + + /*! + * Creates a new DataArrayInt containing IDs (indices) of tuples holding tuple equal to those defined by [ \a tupleBg , \a tupleEnd ) + * This method is an extension of DataArrayInt::findIdsEqual method. + * + * \param [in] tupleBg - the begin (included) of the input tuple to find within \a this. + * \param [in] tupleEnd - the end (excluded) of the input tuple to find within \a this. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != std::distance(tupleBg,tupleEnd). + * \throw If \a this->getNumberOfComponents() is equal to 0. + * \sa DataArrayInt::findIdsEqual + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsEqualTuple(const T *tupleBg, const T *tupleEnd) const + { + std::size_t nbOfCompoExp=std::distance(tupleBg,tupleEnd); + this->checkAllocated(); + if(this->getNumberOfComponents()!=nbOfCompoExp) + { + std::ostringstream oss; oss << "DataArrayInt::findIdsEqualTuple : mismatch of number of components. Input tuple has " << nbOfCompoExp << " whereas this array has " << this->getNumberOfComponents() << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if(nbOfCompoExp==0) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualTuple : number of components should be > 0 !"); + MCAuto ret(DataArrayIdType::New()); + ret->alloc(0,1); + const T *bg(this->begin()),*end2(this->end()),*work(this->begin()); + while(work!=end2) + { + work=std::search(work,end2,tupleBg,tupleEnd); + if(work!=end2) + { + std::ptrdiff_t pos=std::distance(bg,work); + if(pos%nbOfCompoExp==0) + ret->pushBackSilent(ToIdType(pos/nbOfCompoExp)); + work++; + } + } + return ret.retn(); + } + + /*! + * Creates a new DataArrayInt containing IDs (indices) of tuples holding value equal to + * one of given values. + * \param [in] valsBg - an array of values to find within \a this array. + * \param [in] valsEnd - specifies the end of the array \a valsBg, so that + * the last value of \a valsBg is \a valsEnd[ -1 ]. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this->getNumberOfComponents() != 1. + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsEqualList(const T *valsBg, const T *valsEnd) const + { + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : the array must have only one component, you can call 'rearrange' method before !"); + std::set vals2(valsBg,valsEnd); + const T *cptr(this->getConstPointer()); + mcIdType nbOfTuples(this->getNumberOfTuples()); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); + for(mcIdType i=0;ipushBackSilent(i); + return ret.retn(); + } + + /*! + * Creates a new DataArrayInt containing IDs (indices) of tuples holding values \b not + * equal to any of given values. + * \param [in] valsBg - an array of values to ignore within \a this array. + * \param [in] valsEnd - specifies the end of the array \a valsBg, so that + * the last value of \a valsBg is \a valsEnd[ -1 ]. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this->getNumberOfComponents() != 1. + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsNotEqualList(const T *valsBg, const T *valsEnd) const + { + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : the array must have only one component, you can call 'rearrange' method before !"); + std::set vals2(valsBg,valsEnd); + const T *cptr=this->getConstPointer(); + mcIdType nbOfTuples(this->getNumberOfTuples()); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); + for(mcIdType i=0;ipushBackSilent(i); + return ret.retn(); + } + + /*! + * This method expects to be called when number of components of this is equal to one. + * This method returns the tuple id, if it exists, of the first tuple equal to \b value. + * If not any tuple contains \b value -1 is returned. + * \sa DataArrayInt::presenceOfValue + */ + template + mcIdType DataArrayDiscrete::findIdFirstEqual(T value) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); + const T *cptr=this->getConstPointer(); + mcIdType nbOfTuples(this->getNumberOfTuples()); + const T *ret=std::find(cptr,cptr+nbOfTuples,value); + if(ret!=cptr+nbOfTuples) + return ToIdType(std::distance(cptr,ret)); + return -1; + } + + /*! + * This method expects to be called when number of components of this is equal to one. + * This method returns the tuple id, if it exists, of the first tuple so that the value is contained in \b vals. + * If not any tuple contains one of the values contained in 'vals' -1 is returned. + * \sa DataArrayInt::presenceOfValue + */ + template + mcIdType DataArrayDiscrete::findIdFirstEqual(const std::vector& vals) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); + std::set vals2(vals.begin(),vals.end()); + const T *cptr=this->getConstPointer(); + mcIdType nbOfTuples(this->getNumberOfTuples()); + for(const T *w=cptr;w!=cptr+nbOfTuples;w++) + if(vals2.find(*w)!=vals2.end()) + return ToIdType(std::distance(cptr,w)); + return -1; + } + + /*! + * This method is an extension of DataArrayInt::findIdFirstEqual method because this method works for DataArrayInt with + * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case). + * This method searches in \b this is there is a tuple that matched the input parameter \b tupl. + * If any the tuple id is returned. If not -1 is returned. + * + * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of + * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. + * + * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. + * \sa DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple. + */ + template + mcIdType DataArrayDiscrete::findIdFirstEqualTuple(const std::vector& tupl) const + { + this->checkAllocated(); + std::size_t nbOfCompo(this->getNumberOfComponents()); + if(nbOfCompo==0) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdFirstEqualTuple : 0 components in 'this' !"); + if(nbOfCompo!=tupl.size()) + { + std::ostringstream oss; oss << "DataArrayInt::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + const T *cptr=this->getConstPointer(); + std::size_t nbOfVals=this->getNbOfElems(); + for(const T *work=cptr;work!=cptr+nbOfVals;) + { + work=std::search(work,cptr+nbOfVals,tupl.begin(),tupl.end()); + if(work!=cptr+nbOfVals) + { + if(std::distance(cptr,work)%nbOfCompo!=0) + work++; + else + return ToIdType (std::distance(cptr,work)/nbOfCompo); + } + } + return -1; + } + + /*! + * This method searches the sequence specified in input parameter \b vals in \b this. + * This works only for DataArrayInt having number of components equal to one (if not an INTERP_KERNEL::Exception will be thrown). + * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple. + * \sa DataArrayInt::findIdFirstEqualTuple + */ + template + mcIdType DataArrayDiscrete::findIdSequence(const std::vector& vals) const + { + this->checkAllocated(); + std::size_t nbOfCompo=this->getNumberOfComponents(); + if(nbOfCompo!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !"); + const T *cptr=this->getConstPointer(); + std::size_t nbOfVals=this->getNbOfElems(); + const T *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); + if(loc!=cptr+nbOfVals) + return ToIdType(std::distance(cptr,loc)); + return -1; + } + + /*! + * Assigns \a newValue to all elements holding \a oldValue within \a this + * one-dimensional array. + * \param [in] oldValue - the value to replace. + * \param [in] newValue - the value to assign. + * \return mcIdType - number of replacements performed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + */ + template + mcIdType DataArrayDiscrete::changeValue(T oldValue, T newValue) + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !"); + if(oldValue==newValue) + return 0; + T *start(this->getPointer()),*end2(start+this->getNbOfElems()); + mcIdType ret(0); + for(T *val=start;val!=end2;val++) + { + if(*val==oldValue) + { + *val=newValue; + ret++; + } + } + if(ret>0) + this->declareAsNew(); + return ret; + } + + /*! + * This method returns the number of values in \a this that are equals to input parameter \a value. + * This method only works for single component array. + * + * \return a value in [ 0, \c this->getNumberOfTuples() ) + * + * \throw If \a this is not allocated + * + */ + template + mcIdType DataArrayDiscrete::count(T value) const + { + mcIdType ret=0; + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::count : must be applied on DataArrayInt with only one component, you can call 'rearrange' method before !"); + const T *vals=this->begin(); + std::size_t nbOfElements=this->getNumberOfTuples(); + for(std::size_t i=0;i + bool DataArrayDiscrete::presenceOfTuple(const std::vector& tupl) const + { + return this->findIdFirstEqualTuple(tupl)!=-1; + } + + + /*! + * Returns \a true if a given value is present within \a this one-dimensional array. + * \param [in] value - the value to find within \a this array. + * \return bool - \a true in case if \a value is present within \a this array. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \sa findIdFirstEqual() + */ + template + bool DataArrayDiscrete::presenceOfValue(T value) const + { + return this->findIdFirstEqual(value)!=-1; + } + + /*! + * This method expects to be called when number of components of this is equal to one. + * This method returns true if it exists a tuple so that the value is contained in \b vals. + * If not any tuple contains one of the values contained in 'vals' false is returned. + * \sa DataArrayInt::findIdFirstEqual + */ + template + bool DataArrayDiscrete::presenceOfValue(const std::vector& vals) const + { + return this->findIdFirstEqual(vals)!=-1; + } + + /*! + * Accumulates values of each component of \a this array. + * \param [out] res - an array of length \a this->getNumberOfComponents(), allocated + * by the caller, that is filled by this method with sum value for each + * component. + * \throw If \a this is not allocated. + */ + template + void DataArrayDiscrete::accumulate(T *res) const + { + this->checkAllocated(); + const T *ptr=this->getConstPointer(); + mcIdType nbTuple(this->getNumberOfTuples()); + std::size_t nbComps(this->getNumberOfComponents()); + std::fill(res,res+nbComps,0); + for(mcIdType i=0;i()); + } + + template + T DataArrayDiscrete::accumulate(std::size_t compId) const + { + this->checkAllocated(); + const T *ptr=this->getConstPointer(); + mcIdType nbTuple(this->getNumberOfTuples()); + std::size_t nbComps(this->getNumberOfComponents()); + if(compId<0 || compId>=nbComps) + throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !"); + T ret=0; + for(mcIdType i=0;igetNumberOfTuples). + * + * \param [in] bgOfIndex - begin (included) of the input index array. + * \param [in] endOfIndex - end (excluded) of the input index array. + * \return DataArrayInt * - the new instance having the same number of components than \a this. + * + * \throw If bgOfIndex or end is NULL. + * \throw If input index array is not ascendingly sorted. + * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples). + * \throw If std::distance(bgOfIndex,endOfIndex)==0. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const + { + if(!bgOfIndex || !endOfIndex) + throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : input pointer NULL !"); + this->checkAllocated(); + std::size_t nbCompo(this->getNumberOfComponents()); + mcIdType nbOfTuples(this->getNumberOfTuples()); + mcIdType sz=ToIdType(std::distance(bgOfIndex,endOfIndex)); + if(sz<1) + throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : invalid size of input index array !"); + sz--; + MCAuto ret=DataArrayType::New(); ret->alloc(sz,nbCompo); + const mcIdType *w=bgOfIndex; + if(*w<0 || *w>=nbOfTuples) + throw INTERP_KERNEL::Exception("DataArrayInt::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); + const T *srcPt=this->begin()+(*w)*nbCompo; + T *tmp=ret->getPointer(); + for(mcIdType i=0;i=w[0]) + { + for(mcIdType j=w[0];j=0 && j()); + else + { + std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array points to id " << j << " should be in [0," << nbOfTuples << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + } + else + { + std::ostringstream oss; oss << "DataArrayInt::accumulatePerChunck : At rank #" << i << " the input index array is not in ascendingly sorted."; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + ret->copyStringInfoFrom(*this); + return ret.retn(); + } + + /*! + * Returns in a single walk in \a this the min value and the max value in \a this. + * \a this is expected to be single component array. + * + * \param [out] minValue - the min value in \a this. + * \param [out] maxValue - the max value in \a this. + * + * \sa getMinValueInArray, getMinValue, getMaxValueInArray, getMaxValue + */ + template + void DataArrayDiscrete::getMinMaxValues(T& minValue, T& maxValue) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::getMinMaxValues : must be applied on DataArrayInt with only one component !"); + std::size_t nbElements(this->getNumberOfTuples()); + const T *pt(this->begin()); + minValue=std::numeric_limits::max(); maxValue=-std::numeric_limits::max(); + for(std::size_t i=0;imaxValue) + maxValue=*pt; + } + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes \f$ numerator / x \f$. + * \warning If an exception is thrown because of presence of 0 element in \a this + * array, all elements processed before detection of the zero element remain + * modified. + * \param [in] numerator - the numerator used to modify array elements. + * \throw If \a this is not allocated. + * \throw If there is an element equal to 0 in \a this array. + */ + template + void DataArrayDiscrete::applyInv(T numerator) + { + this->checkAllocated(); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + for(std::size_t i=0;igetNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents()); + oss << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + this->declareAsNew(); + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes \f$ x / val \f$. + * \param [in] val - the denominator used to modify array elements. + * \throw If \a this is not allocated. + * \throw If \a val == 0. + */ + template + void DataArrayDiscrete::applyDivideBy(T val) + { + if(val==0) + throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to divide by 0 !"); + this->checkAllocated(); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::divides(),val)); + this->declareAsNew(); + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes x % val . + * \param [in] val - the divisor used to modify array elements. + * \throw If \a this is not allocated. + * \throw If \a val <= 0. + */ + template + void DataArrayDiscrete::applyModulus(T val) + { + if(val<=0) + throw INTERP_KERNEL::Exception("DataArrayInt::applyDivideBy : Trying to operate modulus on value <= 0 !"); + this->checkAllocated(); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + std::transform(ptr,ptr+nbOfElems,ptr,std::bind2nd(std::modulus(),val)); + this->declareAsNew(); + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes val % x . + * \warning If an exception is thrown because of presence of an element <= 0 in \a this + * array, all elements processed before detection of the zero element remain + * modified. + * \param [in] val - the divident used to modify array elements. + * \throw If \a this is not allocated. + * \throw If there is an element equal to or less than 0 in \a this array. + */ + template + void DataArrayDiscrete::applyRModulus(T val) + { + this->checkAllocated(); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + for(std::size_t i=0;i0) + { + *ptr=val%(*ptr); + } + else + { + std::ostringstream oss; oss << "DataArrayInt::applyRModulus : presence of value <=0 in tuple #" << i/(this->getNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents()); + oss << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + this->declareAsNew(); + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes val ^ x . + * \param [in] val - the value used to apply pow on all array elements. + * \throw If \a this is not allocated. + * \throw If \a val < 0. + */ + template + void DataArrayDiscrete::applyPow(T val) + { + this->checkAllocated(); + if(val<0) + throw INTERP_KERNEL::Exception("DataArrayInt::applyPow : input pow in < 0 !"); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + if(val==0) + { + std::fill(ptr,ptr+nbOfElems,1); + return ; + } + for(std::size_t i=0;ideclareAsNew(); + } + + /*! + * Modify all elements of \a this array, so that + * an element _x_ becomes \f$ val ^ x \f$. + * \param [in] val - the value used to apply pow on all array elements. + * \throw If \a this is not allocated. + * \throw If there is an element < 0 in \a this array. + * \warning If an exception is thrown because of presence of 0 element in \a this + * array, all elements processed before detection of the zero element remain + * modified. + */ + template + void DataArrayDiscrete::applyRPow(T val) + { + this->checkAllocated(); + T *ptr=this->getPointer(); + std::size_t nbOfElems=this->getNbOfElems(); + for(std::size_t i=0;i=0) + { + T tmp=1; + for(T j=0;j<*ptr;j++) + tmp*=val; + *ptr=tmp; + } + else + { + std::ostringstream oss; oss << "DataArrayInt::applyRPow : presence of negative value in tuple #" << i/(this->getNumberOfComponents()) << " component #" << i%(this->getNumberOfComponents()); + oss << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + this->declareAsNew(); + } + + /*! + * This method works only on data array with one component. + * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that + * this[*id] in [\b vmin,\b vmax) + * + * \param [in] vmin begin of range. This value is included in range (included). + * \param [in] vmax end of range. This value is \b not included in range (excluded). + * \return a newly allocated data array that the caller should deal with. + * + * \sa DataArrayInt::findIdsNotInRange , DataArrayInt::findIdsStricltyNegative + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsInRange(T vmin, T vmax) const + { + InRange ir(vmin,vmax); + MCAuto ret(this->findIdsAdv(ir)); + return ret.retn(); + } + + /*! + * This method works only on data array with one component. + * This method returns a newly allocated array storing stored ascendantly tuple ids in \b this so that + * this[*id] \b not in [\b vmin,\b vmax) + * + * \param [in] vmin begin of range. This value is \b not included in range (excluded). + * \param [in] vmax end of range. This value is included in range (included). + * \return a newly allocated data array that the caller should deal with. + * + * \sa DataArrayInt::findIdsInRange , DataArrayInt::findIdsStricltyNegative + */ + template + DataArrayIdType *DataArrayDiscrete::findIdsNotInRange(T vmin, T vmax) const + { + NotInRange nir(vmin,vmax); + MCAuto ret(this->findIdsAdv(nir)); + return ret.retn(); + } + + /*! + * This method works only on data array with one component. + * This method checks that all ids in \b this are in [ \b vmin, \b vmax ). If there is at least one element in \a this not in [ \b vmin, \b vmax ) an exception will be thrown. + * + * \param [in] vmin begin of range. This value is included in range (included). + * \param [in] vmax end of range. This value is \b not included in range (excluded). + * \return if all ids in \a this are so that (*this)[i]==i for all i in [ 0, \c this->getNumberOfTuples() ). */ + template + bool DataArrayDiscrete::checkAllIdsInRange(T vmin, T vmax) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::checkAllIdsInRange : this must have exactly one component !"); + mcIdType nbOfTuples(this->getNumberOfTuples()); + bool ret=true; + const T *cptr=this->getConstPointer(); + for(mcIdType i=0;i=vmin && *cptrgetNumberOfComponents() != 1. + * \throw If any element \a x of \a this array violates condition ( 0 <= \a x < \a + * nbOfElement ). + */ + template + DataArrayIdType *DataArrayDiscrete::buildComplement(mcIdType nbOfElement) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildComplement : only single component allowed !"); + std::vector tmp(nbOfElement); + const T *pt=this->getConstPointer(); + std::size_t nbOfElements=this->getNumberOfTuples(); + for(const T *w=pt;w!=pt+nbOfElements;w++) + if(*w>=0 && *walloc(nbOfRetVal,1); + mcIdType j=0; + mcIdType *retPtr=ret->getPointer(); + for(mcIdType i=0;igetNumberOfComponents() != 1. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \sa DataArrayInt::buildSubstractionOptimized() + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildSubstraction(const DataArrayType *other) const + { + if(!other) + throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : DataArrayInt pointer in input is NULL !"); + this->checkAllocated(); + other->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed !"); + if(other->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstraction : only single component allowed for other type !"); + const T *pt=this->getConstPointer(); + std::size_t nbOfElements=this->getNumberOfTuples(); + std::set s1(pt,pt+nbOfElements); + pt=other->getConstPointer(); + nbOfElements=other->getNumberOfTuples(); + std::set s2(pt,pt+nbOfElements); + std::vector r; + std::set_difference(s1.begin(),s1.end(),s2.begin(),s2.end(),std::back_insert_iterator< std::vector >(r)); + DataArrayType *ret=DataArrayType::New(); + ret->alloc(r.size(),1); + std::copy(r.begin(),r.end(),ret->getPointer()); + return ret; + } + + /*! + * \a this is expected to have one component and to be sorted ascendingly (as for \a other). + * \a other is expected to be a part of \a this. If not DataArrayInt::buildSubstraction should be called instead. + * + * \param [in] other an array with one component and expected to be sorted ascendingly. + * \ret list of ids in \a this but not in \a other. + * \sa DataArrayInt::buildSubstraction + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildSubstractionOptimized(const DataArrayType *other) const + { + static const char *MSG="DataArrayInt::buildSubstractionOptimized : only single component allowed !"; + if(!other) throw INTERP_KERNEL::Exception("DataArrayInt::buildSubstractionOptimized : NULL input array !"); + this->checkAllocated(); other->checkAllocated(); + if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG); + if(other->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception(MSG); + const T *pt1Bg(this->begin()),*pt1End(this->end()),*pt2Bg(other->begin()),*pt2End(other->end()); + const T *work1(pt1Bg),*work2(pt2Bg); + MCAuto ret(DataArrayType::New()); ret->alloc(0,1); + for(;work1!=pt1End;work1++) + { + if(work2!=pt2End && *work1==*work2) + work2++; + else + ret->pushBackSilent(*work1); + } + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt which contains all elements of \a this and a given + * one-dimensional arrays. The result array does not contain any duplicates + * and its values are sorted in ascending order. + * \param [in] other - an array to unite with \a this one. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this or \a other is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If \a other->getNumberOfComponents() != 1. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildUnion(const DataArrayType *other) const + { + std::vectorarrs(2); + arrs[0]=dynamic_cast(this); arrs[1]=other; + return DataArrayDiscrete::BuildUnion(arrs); + } + + /*! + * Returns a new DataArrayInt which contains elements present in both \a this and a given + * one-dimensional arrays. The result array does not contain any duplicates + * and its values are sorted in ascending order. + * \param [in] other - an array to intersect with \a this one. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a this or \a other is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If \a other->getNumberOfComponents() != 1. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildIntersection(const DataArrayType *other) const + { + std::vectorarrs(2); + arrs[0]=dynamic_cast(this); arrs[1]=other; + return DataArrayDiscrete::BuildIntersection(arrs); + } + + /*! + * This method can be applied on allocated with one component DataArrayInt instance. + * This method is typically relevant for sorted arrays. All consecutive duplicated items in \a this will appear only once in returned DataArrayInt instance. + * Example : if \a this contains [1,2,2,3,3,3,3,4,5,5,7,7,7,19] the returned array will contain [1,2,3,4,5,7,19] + * + * \return a newly allocated array that contain the result of the unique operation applied on \a this. + * \throw if \a this is not allocated or if \a this has not exactly one component. + * \sa DataArrayInt::buildUniqueNotSorted + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildUnique() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildUnique : only single component allowed !"); + std::size_t nbOfElements=this->getNumberOfTuples(); + MCAuto tmp=DataArrayType::New(); + tmp->deepCopyFrom (*this); + T *data=tmp->getPointer(); + T *last=std::unique(data,data+nbOfElements); + MCAuto ret=DataArrayType::New(); + ret->alloc(std::distance(data,last),1); + std::copy(data,last,ret->getPointer()); + return ret.retn(); + } + + /*! + * This method can be applied on allocated with one component DataArrayInt instance. + * This method keep elements only once by keeping the same order in \a this that is not expected to be sorted. + * + * \return a newly allocated array that contain the result of the unique operation applied on \a this. + * + * \throw if \a this is not allocated or if \a this has not exactly one component. + * + * \sa DataArrayInt::buildUnique + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildUniqueNotSorted() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildUniqueNotSorted : only single component allowed !"); + T minVal,maxVal; + this->getMinMaxValues(minVal,maxVal); + std::vector b(maxVal-minVal+1,false); + const T *ptBg(this->begin()),*endBg(this->end()); + MCAuto ret(DataArrayType::New()); ret->alloc(0,1); + for(const T *pt=ptBg;pt!=endBg;pt++) + { + if(!b[*pt-minVal]) + { + ret->pushBackSilent(*pt); + b[*pt-minVal]=true; + } + } + ret->copyStringInfoFrom(*this); + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt which contains size of every of groups described by \a this + * "index" array. Such "index" array is returned for example by + * \ref MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity + * "MEDCouplingUMesh::buildDescendingConnectivity" and + * \ref MEDCoupling::MEDCouplingUMesh::getNodalConnectivityIndex + * "MEDCouplingUMesh::getNodalConnectivityIndex" etc. + * This method performs the reverse operation of DataArrayInt::computeOffsetsFull. + * \return DataArrayInt * - a new instance of DataArrayInt, whose number of tuples + * equals to \a this->getNumberOfComponents() - 1, and number of components is 1. + * The caller is to delete this array using decrRef() as it is no more needed. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If \a this->getNumberOfTuples() < 2. + * + * \b Example:
+ * - this contains [1,3,6,7,7,9,15] + * - result array contains [2,3,1,0,2,6], + * where 2 = 3 - 1, 3 = 6 - 3, 1 = 7 - 6 etc. + * + * \sa DataArrayInt::computeOffsetsFull + */ + template + typename Traits::ArrayType *DataArrayDiscrete::deltaShiftIndex() const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : only single component allowed !"); + std::size_t nbOfElements=this->getNumberOfTuples(); + if(nbOfElements<2) + throw INTERP_KERNEL::Exception("DataArrayInt::deltaShiftIndex : 1 tuple at least must be present in 'this' !"); + const T *ptr=this->getConstPointer(); + DataArrayType *ret=DataArrayType::New(); + ret->alloc(nbOfElements-1,1); + T *out=ret->getPointer(); + std::transform(ptr+1,ptr+nbOfElements,ptr,out,std::minus()); + return ret; + } + + /*! + * Modifies \a this one-dimensional array so that value of each element \a x + * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$. + * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number of tuples + * and components remains the same.
+ * This method is useful for allToAllV in MPI with contiguous policy. This method + * differs from computeOffsetsFull() in that the number of tuples is \b not changed by + * this one. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * + * \b Example:
+ * - Before \a this contains [3,5,1,2,0,8] + * - After \a this contains [0,3,8,9,11,11]
+ * Note that the last element 19 = 11 + 8 is missing because size of \a this + * array is retained and thus there is no space to store the last element. + */ + template + void DataArrayDiscrete::computeOffsets() + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsets : only single component allowed !"); + std::size_t nbOfElements=this->getNumberOfTuples(); + if(nbOfElements==0) + return ; + T *work=this->getPointer(); + T tmp=work[0]; + work[0]=0; + for(std::size_t i=1;ideclareAsNew(); + } + + /*! + * Modifies \a this one-dimensional array so that value of each element \a x + * of \a this array (\a a) is computed as \f$ x_i = \sum_{j=0}^{i-1} a[ j ] \f$. + * Or: for each i>0 new[i]=new[i-1]+old[i-1] for i==0 new[i]=0. Number + * components remains the same and number of tuples is inceamented by one.
+ * This method is useful for allToAllV in MPI with contiguous policy. This method + * differs from computeOffsets() in that the number of tuples is changed by this one. + * This method performs the reverse operation of DataArrayInt::deltaShiftIndex. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * + * \b Example:
+ * - Before \a this contains [3,5,1,2,0,8] + * - After \a this contains [0,3,8,9,11,11,19]
+ * \sa DataArrayInt::deltaShiftIndex + */ + template + void DataArrayDiscrete::computeOffsetsFull() + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::computeOffsetsFull : only single component allowed !"); + std::size_t nbOfElements=this->getNumberOfTuples(); + T *ret=(T *)malloc((nbOfElements+1)*sizeof(T)); + const T *work=this->getConstPointer(); + ret[0]=0; + for(std::size_t i=0;iuseArray(ret,true,DeallocType::C_DEALLOC,nbOfElements+1,1); + this->declareAsNew(); + } + + /*! + * Returns two new DataArrayInt instances whose contents is computed from that of \a this and \a listOfIds arrays as follows. + * \a this is expected to be an offset format ( as returned by DataArrayInt::computeOffsetsFull ) that is to say with one component + * and ** sorted strictly increasingly **. \a listOfIds is expected to be sorted ascendingly (not strictly needed for \a listOfIds). + * This methods searches in \a this, considered as a set of contiguous \c this->getNumberOfComponents() ranges, all ids in \a listOfIds + * filling completely one of the ranges in \a this. + * + * \param [in] listOfIds a list of ids that has to be sorted ascendingly. + * \param [out] rangeIdsFetched the range ids fetched + * \param [out] idsInInputListThatFetch contains the list of ids in \a listOfIds that are \b fully included in a range in \a this. So + * \a idsInInputListThatFetch is a part of input \a listOfIds. + * + * \sa DataArrayInt::computeOffsetsFull + * + * \b Example:
+ * - \a this : [0,3,7,9,15,18] + * - \a listOfIds contains [0,1,2,3,7,8,15,16,17] + * - \a rangeIdsFetched result array: [0,2,4] + * - \a idsInInputListThatFetch result array: [0,1,2,7,8,15,16,17] + * In this example id 3 in input \a listOfIds is alone so it do not appear in output \a idsInInputListThatFetch. + *
+ */ + template + void DataArrayDiscrete::findIdsRangesInListOfIds(const DataArrayType *listOfIds, DataArrayIdType *& rangeIdsFetched, DataArrayType *& idsInInputListThatFetch) const + { + if(!listOfIds) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids is null !"); + listOfIds->checkAllocated(); this->checkAllocated(); + if(listOfIds->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : input list of ids must have exactly one component !"); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdsRangesInListOfIds : this must have exactly one component !"); + MCAuto ret0=DataArrayIdType::New(); ret0->alloc(0,1); + MCAuto ret1=DataArrayType::New(); ret1->alloc(0,1); + const T *tupPtr(listOfIds->begin()), *tupEnd(listOfIds->end()); + const T *offBg(this->begin()),*offEnd(this->end()-1); + const T *offPtr(offBg); + while(tupPtr!=tupEnd && offPtr!=offEnd) + { + if(*tupPtr==*offPtr) + { + T i=offPtr[0]; + while(ipushBackSilent(ToIdType(std::distance(offBg,offPtr))); + ret1->pushBackValsSilent(tupPtr-(offPtr[1]-offPtr[0]),tupPtr); + offPtr++; + } + } + else + { if(*tupPtr<*offPtr) tupPtr++; else offPtr++; } + } + rangeIdsFetched=ret0.retn(); + idsInInputListThatFetch=ret1.retn(); + } + + /*! + * Returns a new DataArrayInt whose contents is computed from that of \a this and \a + * offsets arrays as follows. \a offsets is a one-dimensional array considered as an + * "index" array of a "iota" array, thus, whose each element gives an index of a group + * beginning within the "iota" array. And \a this is a one-dimensional array + * considered as a selector of groups described by \a offsets to include into the result array. + * \throw If \a offsets is NULL. + * \throw If \a offsets is not allocated. + * \throw If \a offsets->getNumberOfComponents() != 1. + * \throw If \a offsets is not monotonically increasing. + * \throw If \a this is not allocated. + * \throw If \a this->getNumberOfComponents() != 1. + * \throw If any element of \a this is not a valid index for \a offsets array. + * + * \b Example:
+ * - \a this: [0,2,3] + * - \a offsets: [0,3,6,10,14,20] + * - result array: [0,1,2,6,7,8,9,10,11,12,13] ==
+ * \c range(0,3) + \c range(6,10) + \c range(10,14) ==
+ * \c range( \a offsets[ \a this[0] ], offsets[ \a this[0]+1 ]) + + * \c range( \a offsets[ \a this[1] ], offsets[ \a this[1]+1 ]) + + * \c range( \a offsets[ \a this[2] ], offsets[ \a this[2]+1 ]) + */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildExplicitArrByRanges(const DataArrayType *offsets) const + { + if(!offsets) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : DataArrayInt pointer in input is NULL !"); + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : only single component allowed !"); + offsets->checkAllocated(); + if(offsets->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrByRanges : input array should have only single component !"); + mcIdType othNbTuples=offsets->getNumberOfTuples()-1; + mcIdType nbOfTuples=this->getNumberOfTuples(); + T retNbOftuples=0; + const T *work=this->getConstPointer(); + const T *offPtr=offsets->getConstPointer(); + for(mcIdType i=0;i=0 && val=0) + retNbOftuples+=delta; + else + { + std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << val << " of offset array has a delta < 0 !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + else + { + std::ostringstream oss; oss << "DataArrayInt::buildExplicitArrByRanges : Tuple #" << i << " in this contains " << val; + oss << " whereas offsets array is of size " << othNbTuples+1 << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + MCAuto ret=DataArrayType::New(); + ret->alloc(retNbOftuples,1); + T *retPtr=ret->getPointer(); + for(mcIdType i=0;igetNumberOfComponents() != 1. + * \throw If \a this->getNumberOfTuples() == 0. + * \throw If \a this is not monotonically increasing. + * \throw If any element of ids in ( \a bg \a stop \a step ) points outside the scale in \a this. + * + * \b Example:
+ * - \a bg , \a stop and \a step : (0,5,2) + * - \a this: [0,3,6,10,14,20] + * - result array: [0,0,0, 2,2,2,2, 4,4,4,4,4,4] ==
+ */ + template + typename Traits::ArrayType *DataArrayDiscrete::buildExplicitArrOfSliceOnScaledArr(T bg, T stop, T step) const + { + if(!this->isAllocated()) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : not allocated array !"); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of components is expected to be equal to one !"); + mcIdType nbOfTuples(this->getNumberOfTuples()); + if(nbOfTuples==0) + throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr : number of tuples must be != 0 !"); + const T *ids(this->begin()); + mcIdType nbOfEltsInSlc=DataArrayTools::GetNumberOfItemGivenBESRelative(bg,stop,step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr"); + T sz(0),pos(bg); + for(mcIdType i=0;i=0 && pos ret(DataArrayType::New()); ret->alloc(sz,1); + T *retPtr(ret->getPointer()); + pos=bg; + for(mcIdType i=0;igetIJ(i,0) and put the result + * in tuple **i** of returned DataArrayInt. + * If ranges overlapped (in theory it should not) this method do not detect it and always returns the first range. + * + * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] + * The return DataArrayInt will contain : **[0,4,1,2,2,3]** + * + * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is + * for lower value included and 2nd component is the upper value of corresponding range **excluded**. + * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception + * is thrown if no ranges in \a ranges contains value in \a this. + * + * \sa DataArrayInt::findIdInRangeForEachTuple + */ + template + DataArrayIdType *DataArrayDiscrete::findRangeIdForEachTuple(const DataArrayType *ranges) const + { + if(!ranges) + throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : null input pointer !"); + if(ranges->getNumberOfComponents()!=2) + throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : input DataArrayInt instance should have 2 components !"); + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findRangeIdForEachTuple : this should have only one component !"); + mcIdType nbTuples(this->getNumberOfTuples()); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbTuples,1); + mcIdType nbOfRanges(ranges->getNumberOfTuples()); + const T *rangesPtr=ranges->getConstPointer(); + mcIdType *retPtr=ret->getPointer(); + const T *inPtr=this->getConstPointer(); + for(mcIdType i=0;i=rangesPtr[2*j] && valgetIJ(i,0) and put the result + * in tuple **i** of returned DataArrayInt. + * If ranges overlapped (in theory it should not) this method do not detect it and always returns the sub position of the first range. + * + * For example if \a this contains : [1,24,7,8,10,17] and \a ranges contains [(0,3),(3,8),(8,15),(15,22),(22,30)] + * The return DataArrayInt will contain : **[1,2,4,0,2,2]** + * This method is often called in pair with DataArrayInt::findRangeIdForEachTuple method. + * + * \param [in] ranges typically come from output of MEDCouplingUMesh::ComputeRangesFromTypeDistribution. Each range is specified like this : 1st component is + * for lower value included and 2nd component is the upper value of corresponding range **excluded**. + * \throw If offsets is a null pointer or does not have 2 components or if \a this is not allocated or \a this do not have exactly one component. To finish an exception + * is thrown if no ranges in \a ranges contains value in \a this. + * \sa DataArrayInt::findRangeIdForEachTuple + */ + template + typename Traits::ArrayType *DataArrayDiscrete::findIdInRangeForEachTuple(const DataArrayType *ranges) const + { + if(!ranges) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : null input pointer !"); + if(ranges->getNumberOfComponents()!=2) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : input DataArrayInt instance should have 2 components !"); + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::findIdInRangeForEachTuple : this should have only one component !"); + mcIdType nbTuples=this->getNumberOfTuples(); + MCAuto ret=DataArrayType::New(); ret->alloc(nbTuples,1); + mcIdType nbOfRanges=ranges->getNumberOfTuples(); + const T *rangesPtr=ranges->getConstPointer(); + T *retPtr=ret->getPointer(); + const T *inPtr=this->getConstPointer(); + for(mcIdType i=0;i=rangesPtr[2*j] && valgetIJ(tid,0)==this->getIJ(tid-1,1) and \c this->getIJ(tid,1)==this->getIJ(tid+1,0). + * If it is impossible to reach such condition an exception will be thrown ! \b WARNING In case of throw \a this can be partially modified ! + * If this method has correctly worked, \a this will be able to be considered as a linked list. + * This method does nothing if number of tuples is lower of equal to 1. + * + * This method is useful for users having an unstructured mesh having only SEG2 to rearrange internally the connectivity without any coordinates consideration. + * + * \sa MEDCouplingUMesh::orderConsecutiveCells1D, DataArrayInt::fromLinkedListOfPairToList + */ + template + void DataArrayDiscrete::sortEachPairToMakeALinkedList() + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=2) + throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : Only works on DataArrayInt instance with nb of components equal to 2 !"); + mcIdType nbOfTuples(this->getNumberOfTuples()); + if(nbOfTuples<=1) + return ; + T *conn(this->getPointer()); + for(mcIdType i=1;i1) + { + if(conn[2]==conn[3]) + { + std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " presence of a pair filled with same ids !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if(conn[2]!=conn[1] && conn[3]==conn[1] && conn[2]!=conn[0]) + std::swap(conn[2],conn[3]); + //not(conn[2]==conn[1] && conn[3]!=conn[1] && conn[3]!=conn[0]) + if(conn[2]!=conn[1] || conn[3]==conn[1] || conn[3]==conn[0]) + { + std::ostringstream oss; oss << "DataArrayInt::sortEachPairToMakeALinkedList : In the tuple #" << i << " something is invalid !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + else + { + if(conn[0]==conn[1] || conn[2]==conn[3]) + throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : In the 2 first tuples presence of a pair filled with same ids !"); + T tmp[4]; + std::set s; + s.insert(conn,conn+4); + if(s.size()!=3) + throw INTERP_KERNEL::Exception("DataArrayInt::sortEachPairToMakeALinkedList : This can't be considered as a linked list regarding 2 first tuples !"); + if(std::count(conn,conn+4,conn[0])==2) + { + tmp[0]=conn[1]; + tmp[1]=conn[0]; + tmp[2]=conn[0]; + if(conn[2]==conn[0]) + { tmp[3]=conn[3]; } + else + { tmp[3]=conn[2];} + std::copy(tmp,tmp+4,conn); + } + else + {//here we are sure to have (std::count(conn,conn+4,conn[1])==2) + if(conn[1]==conn[3]) + std::swap(conn[2],conn[3]); + } + } + } + } + + /*! + * \a this is expected to be a correctly linked list of pairs. + * + * \sa DataArrayInt::sortEachPairToMakeALinkedList + */ + template + MCAuto::ArrayType> DataArrayDiscrete::fromLinkedListOfPairToList() const + { + this->checkAllocated(); + this->checkNbOfComps(2,"DataArrayInt::fromLinkedListOfPairToList : this is expected to have 2 components"); + mcIdType nbTuples(this->getNumberOfTuples()); + if(nbTuples<1) + throw INTERP_KERNEL::Exception("DataArrayInt::fromLinkedListOfPairToList : no tuples in this ! Not a linked list !"); + MCAuto ret(DataArrayType::New()); ret->alloc(nbTuples+1,1); + const T *thisPtr(this->begin()); + T *retPtr(ret->getPointer()); + retPtr[0]=thisPtr[0]; + for(mcIdType i=0;i + typename Traits::ArrayType *DataArrayDiscrete::getDifferentValues() const + { + this->checkAllocated(); + std::set ret; + ret.insert(this->begin(),this->end()); + MCAuto ret2=DataArrayType::New(); + ret2->alloc(ret.size(),1); + std::copy(ret.begin(),ret.end(),ret2->getPointer()); + return ret2.retn(); + } + + /*! + * This method is a refinement of DataArrayInt::getDifferentValues because it returns not only different values in \a this but also, for each of + * them it tells which tuple id have this id. + * This method works only on arrays with one component (if it is not the case call DataArrayInt::rearrange(1) ). + * This method returns two arrays having same size. + * The instances of DataArrayInt in the returned vector have be specially allocated and computed by this method. Each of them should be dealt by the caller of this method. + * Example : if this is equal to [1,0,1,2,0,2,2,-3,2] -> differentIds=[-3,0,1,2] and returned array will be equal to [[7],[1,4],[0,2],[3,5,6,8]] + */ + template + std::vector DataArrayDiscrete::partitionByDifferentValues(std::vector& differentIds) const + { + this->checkAllocated(); + if(this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::partitionByDifferentValues : this should have only one component !"); + mcIdType id=0; + std::map m,m2,m3; + for(const T *w=this->begin();w!=this->end();w++) + m[*w]++; + differentIds.resize(m.size()); + std::vector ret(m.size()); + std::vector retPtr(m.size()); + for(typename std::map::const_iterator it=m.begin();it!=m.end();it++,id++) + { + m2[(*it).first]=id; + ret[id]=DataArrayIdType::New(); + ret[id]->alloc((*it).second,1); + retPtr[id]=ret[id]->getPointer(); + differentIds[id]=(*it).first; + } + id=0; + for(const T *w=this->begin();w!=this->end();w++,id++) + { + retPtr[m2[*w]][m3[*w]++]=id; + } + return ret; + } + + /*! + * This method split ids in [0, \c this->getNumberOfTuples() ) using \a this array as a field of weight (>=0 each). + * The aim of this method is to return a set of \a nbOfSlices chunk of contiguous ids as balanced as possible. + * + * \param [in] nbOfSlices - number of slices expected. + * \return - a vector having a size equal to \a nbOfSlices giving the start (included) and the stop (excluded) of each chunks. + * + * \sa DataArray::GetSlice + * \throw If \a this is not allocated or not with exactly one component. + * \throw If an element in \a this if < 0. + */ + template + std::vector< std::pair > DataArrayDiscrete::splitInBalancedSlices(mcIdType nbOfSlices) const + { + if(!this->isAllocated() || this->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : this array should have number of components equal to one and must be allocated !"); + if(nbOfSlices<=0) + throw INTERP_KERNEL::Exception("DataArrayInt::splitInBalancedSlices : number of slices must be >= 1 !"); + T sum(this->accumulate((std::size_t)0)); + mcIdType nbOfTuples(this->getNumberOfTuples()); + T sumPerSlc(sum/FromIdType(nbOfSlices)); + mcIdType pos(0); + const T *w(this->begin()); + std::vector< std::pair > ret(nbOfSlices); + for(mcIdType i=0;i p(pos,-1); + T locSum(0); + while(locSumgetNumberOfTuples() != \a other->getNumberOfTuples() and + * \a this->getNumberOfComponents() != \a other->getNumberOfComponents() and + * \a other has number of both tuples and components not equal to 1. + */ + template + void DataArrayDiscrete::modulusEqual(const DataArrayType *other) + { + if(!other) + throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !"); + const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !"; + this->checkAllocated(); other->checkAllocated(); + mcIdType nbOfTuple(this->getNumberOfTuples()); + mcIdType nbOfTuple2(other->getNumberOfTuples()); + std::size_t nbOfComp(this->getNumberOfComponents()); + std::size_t nbOfComp2(other->getNumberOfComponents()); + if(nbOfTuple==nbOfTuple2) + { + if(nbOfComp==nbOfComp2) + { + std::transform(this->begin(),this->end(),other->begin(),this->getPointer(),std::modulus()); + } + else if(nbOfComp2==1) + { + if(nbOfComp2==nbOfComp) + { + T *ptr=this->getPointer(); + const T *ptrc=other->getConstPointer(); + for(mcIdType i=0;i(),*ptrc++)); + } + else + throw INTERP_KERNEL::Exception(msg); + } + else + throw INTERP_KERNEL::Exception(msg); + } + else if(nbOfTuple2==1) + { + T *ptr=this->getPointer(); + const T *ptrc=other->getConstPointer(); + for(mcIdType i=0;i()); + } + else + throw INTERP_KERNEL::Exception(msg); + this->declareAsNew(); + } + + /*! + * Apply pow on values of another DataArrayInt to values of \a this one. + * + * \param [in] other - an array to pow to \a this one. + * \throw If \a other is NULL. + * \throw If \a this->getNumberOfTuples() != \a other->getNumberOfTuples() + * \throw If \a this->getNumberOfComponents() != 1 or \a other->getNumberOfComponents() != 1 + * \throw If there is a negative value in \a other. + */ + template + void DataArrayDiscrete::powEqual(const DataArrayType *other) + { + if(!other) + throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : input instance is null !"); + mcIdType nbOfTuple=this->getNumberOfTuples(); + mcIdType nbOfTuple2=other->getNumberOfTuples(); + std::size_t nbOfComp=this->getNumberOfComponents(); + std::size_t nbOfComp2=other->getNumberOfComponents(); + if(nbOfTuple!=nbOfTuple2) + throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of tuples mismatches !"); + if(nbOfComp!=1 || nbOfComp2!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::powEqual : number of components of both arrays must be equal to 1 !"); + T *ptr=this->getPointer(); + const T *ptrc=other->begin(); + for(mcIdType i=0;i=0) + { + T tmp=1; + for(T j=0;j<*ptrc;j++) + tmp*=*ptr; + *ptr=tmp; + } + else + { + std::ostringstream oss; oss << "DataArrayInt::powEqual : on tuple #" << i << " of other value is < 0 (" << *ptrc << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + this->declareAsNew(); + } + + //////////////////////////////////// + /*! + * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. + * Server side. + */ + template + void DataArrayDiscrete::getTinySerializationIntInformation(std::vector& tinyInfo) const + { + tinyInfo.resize(2); + if(this->isAllocated()) + { + tinyInfo[0]=this->getNumberOfTuples(); + tinyInfo[1]=ToIdType(this->getNumberOfComponents()); + } + else + { + tinyInfo[0]=-1; + tinyInfo[1]=-1; + } + } + + /*! + * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. + * Server side. + */ + template + void DataArrayDiscrete::getTinySerializationStrInformation(std::vector& tinyInfo) const + { + if(this->isAllocated()) + { + std::size_t nbOfCompo(this->getNumberOfComponents()); + tinyInfo.resize(nbOfCompo+1); + tinyInfo[0]=this->getName(); + for(std::size_t i=0;igetInfoOnComponent(i); + } + else + { + tinyInfo.resize(1); + tinyInfo[0]=this->getName(); + } + } + + /*! + * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. + * This method returns if a feeding is needed. + */ + template + bool DataArrayDiscrete::resizeForUnserialization(const std::vector& tinyInfoI) + { + mcIdType nbOfTuple=tinyInfoI[0]; + mcIdType nbOfComp=tinyInfoI[1]; + if(nbOfTuple!=-1 || nbOfComp!=-1) + { + this->alloc(nbOfTuple,nbOfComp); + return true; + } + return false; + } + + /*! + * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. + * This method returns if a feeding is needed. + */ + template + void DataArrayDiscrete::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) + { + this->setName(tinyInfoS[0]); + if(this->isAllocated()) + { + mcIdType nbOfCompo=tinyInfoI[1]; + for(mcIdType i=0;isetInfoOnComponent(i,tinyInfoS[i+1]); + } + } + + //////////////////////////////////// + + /*! + * Returns a new DataArrayInt that is the result of pow of two given arrays. There are 3 + * valid cases. + * + * \param [in] a1 - an array to pow up. + * \param [in] a2 - another array to sum up. + * \return DataArrayInt * - the new instance of DataArrayInt. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If either \a a1 or \a a2 is NULL. + * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() + * \throw If \a a1->getNumberOfComponents() != 1 or \a a2->getNumberOfComponents() != 1. + * \throw If there is a negative value in \a a2. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::Pow(const DataArrayType *a1, const DataArrayType *a2) + { + if(!a1 || !a2) + throw INTERP_KERNEL::Exception("DataArrayInt::Pow : at least one of input instances is null !"); + 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("DataArrayInt::Pow : number of tuples mismatches !"); + if(nbOfComp!=1 || nbOfComp2!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::Pow : number of components of both arrays must be equal to 1 !"); + MCAuto ret=DataArrayType::New(); ret->alloc(nbOfTuple,1); + const T *ptr1(a1->begin()),*ptr2(a2->begin()); + T *ptr=ret->getPointer(); + for(mcIdType i=0;i=0) + { + T tmp=1; + for(T j=0;j<*ptr2;j++) + tmp*=*ptr1; + *ptr=tmp; + } + else + { + std::ostringstream oss; oss << "DataArrayInt::Pow : on tuple #" << i << " of a2 value is < 0 (" << *ptr2 << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt that is a modulus of two given arrays. There are 3 + * valid cases. + * 1. The arrays have same number of tuples and components. Then each value of + * the result array (_a_) is a division of the corresponding values of \a a1 and + * \a a2, i.e.: _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, j ]. + * 2. The arrays have same number of tuples and one array, say _a2_, has one + * component. Then + * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ i, 0 ]. + * 3. The arrays have same number of components and one array, say _a2_, has one + * tuple. Then + * _a_ [ i, j ] = _a1_ [ i, j ] % _a2_ [ 0, j ]. + * + * Info on components is copied either from the first array (in the first case) or from + * the array with maximal number of elements (getNbOfElems()). + * \warning No check of division by zero is performed! + * \param [in] a1 - a dividend array. + * \param [in] a2 - a divisor array. + * \return DataArrayInt * - the new instance of DataArrayInt. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If either \a a1 or \a a2 is NULL. + * \throw If \a a1->getNumberOfTuples() != \a a2->getNumberOfTuples() and + * \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents() and + * none of them has number of tuples or components equal to 1. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::Modulus(const DataArrayType *a1, const DataArrayType *a2) + { + if(!a1 || !a2) + throw INTERP_KERNEL::Exception("DataArrayInt::Modulus : input DataArrayInt instance is NULL !"); + mcIdType nbOfTuple1(a1->getNumberOfTuples()); + mcIdType nbOfTuple2(a2->getNumberOfTuples()); + std::size_t nbOfComp1(a1->getNumberOfComponents()); + std::size_t nbOfComp2(a2->getNumberOfComponents()); + if(nbOfTuple2==nbOfTuple1) + { + if(nbOfComp1==nbOfComp2) + { + MCAuto ret=DataArrayType::New(); + ret->alloc(nbOfTuple2,nbOfComp1); + std::transform(a1->begin(),a1->end(),a2->begin(),ret->getPointer(),std::modulus()); + ret->copyStringInfoFrom(*a1); + return ret.retn(); + } + else if(nbOfComp2==1) + { + MCAuto ret=DataArrayType::New(); + ret->alloc(nbOfTuple1,nbOfComp1); + const T *a2Ptr=a2->getConstPointer(); + const T *a1Ptr=a1->getConstPointer(); + T *res=ret->getPointer(); + for(mcIdType i=0;i(),a2Ptr[i])); + ret->copyStringInfoFrom(*a1); + return ret.retn(); + } + else + { + a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !"); + return 0; + } + } + else if(nbOfTuple2==1) + { + a1->checkNbOfComps(nbOfComp2,"Nb of components mismatch for array Modulus !"); + MCAuto ret=DataArrayType::New(); + ret->alloc(nbOfTuple1,nbOfComp1); + const T *a1ptr=a1->getConstPointer(),*a2ptr=a2->getConstPointer(); + T *pt=ret->getPointer(); + for(mcIdType i=0;i()); + ret->copyStringInfoFrom(*a1); + return ret.retn(); + } + else + { + a1->checkNbOfTuples(nbOfTuple2,"Nb of tuples mismatch for array Modulus !");//will always throw an exception + return 0; + } + } + + /*! + * This method tries to find the permutation to apply to the first input \a ids1 to obtain the same array (without considering strings information) the second + * input array \a ids2. + * \a ids1 and \a ids2 are expected to be both a list of ids (both with number of components equal to one) not sorted and with values that can be negative. + * This method will throw an exception is no such permutation array can be obtained. It is typically the case if there is some ids in \a ids1 not in \a ids2 or + * inversely. + * In case of success both assertion will be true (no throw) : + * \c ids1->renumber(ret)->isEqual(ids2) where \a ret is the return of this method. + * \c ret->transformWithIndArr(ids2)->isEqual(ids1) + * + * \b Example: + * - \a ids1 : [3,1,103,4,6,10,-7,205] + * - \a ids2 : [-7,1,205,10,6,3,103,4] + * - \a return is : [5,1,6,7,4,3,0,2] because ids2[5]==ids1[0], ids2[1]==ids1[1], ids2[6]==ids1[2]... + * + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If either ids1 or ids2 is null not allocated or not with one components. + * + * \sa DataArrayInt::findIdForEach + */ + template + DataArrayIdType *DataArrayDiscrete::FindPermutationFromFirstToSecond(const DataArrayType *ids1, const DataArrayType *ids2) + { + if(!ids1 || !ids2) + throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be not null !"); + if(!ids1->isAllocated() || !ids2->isAllocated()) + throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays must be allocated !"); + if(ids1->getNumberOfComponents()!=1 || ids2->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two input arrays have exactly one component !"); + if(ids1->getNumberOfTuples()!=ids2->getNumberOfTuples()) + { + std::ostringstream oss; oss << "DataArrayInt::FindPermutationFromFirstToSecond : first array has " << ids1->getNumberOfTuples() << " tuples and the second one " << ids2->getNumberOfTuples() << " tuples ! No chance to find a permutation between the 2 arrays !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + MCAuto c1(ids1->deepCopy()); + MCAuto c2(ids2->deepCopy()); + c1->sort(true); c2->sort(true); + if(!c1->isEqualWithoutConsideringStr(*c2)) + throw INTERP_KERNEL::Exception("DataArrayInt::FindPermutationFromFirstToSecond : the two arrays are not lying on same ids ! Impossible to find a permutation between the 2 arrays !"); + MCAuto p1=ids1->checkAndPreparePermutation(); + MCAuto p2=ids2->checkAndPreparePermutation(); + p2=p2->invertArrayO2N2N2O(p2->getNumberOfTuples()); + p2=p2->selectByTupleIdSafe(p1->begin(),p1->end()); + return p2.retn(); + } + + /*! + * Returns a C array which is a renumbering map in "Old to New" mode for the input array. + * This map, if applied to \a start array, would make it sorted. For example, if + * \a start array contents are [9,10,0,6,4,11,3,7] then the contents of the result array is + * [5,6,0,3,2,7,1,4]. + * \param [in] start - pointer to the first element of the array for which the + * permutation map is computed. + * \param [in] end - pointer specifying the end of the array \a start, so that + * the last value of \a start is \a end[ -1 ]. + * \return mcIdType * - the result permutation array that the caller is to delete as it is no + * more needed. + * \throw If there are equal values in the input array. + */ + template + mcIdType *DataArrayDiscrete::CheckAndPreparePermutation(const T *start, const T *end) + { + std::size_t sz=std::distance(start,end); + mcIdType *ret=(mcIdType *)malloc(sz*sizeof(mcIdType)); + T *work=new T[sz]; + std::copy(start,end,work); + std::sort(work,work+sz); + if(std::unique(work,work+sz)!=work+sz) + { + delete [] work; + free(ret); + throw INTERP_KERNEL::Exception("Some elements are equals in the specified array !"); + } + std::map m; + for(T *workPt=work;workPt!=work+sz;workPt++) + m[*workPt]=ToIdType(std::distance(work,workPt)); + mcIdType *iter2=ret; + for(const T *iter=start;iter!=end;iter++,iter2++) + *iter2=m[*iter]; + delete [] work; + return ret; + } + + /*! + * Returns a new DataArrayInt by concatenating two given arrays, so that (1) the number + * of tuples in the result array is a1->getNumberOfTuples() + a2->getNumberOfTuples() - + * offsetA2 and (2) + * the number of component in the result array is same as that of each of given arrays. + * First \a offsetA2 tuples of \a a2 are skipped and thus are missing from the result array. + * Info on components is copied from the first of the given arrays. Number of components + * in the given arrays must be the same. + * \param [in] a1 - an array to include in the result array. + * \param [in] a2 - another array to include in the result array. + * \param [in] offsetA2 - number of tuples of \a a2 to skip. + * \return DataArrayInt * - the new instance of DataArrayInt. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If either \a a1 or \a a2 is NULL. + * \throw If \a a1->getNumberOfComponents() != \a a2->getNumberOfComponents(). + */ + template + typename Traits::ArrayType *DataArrayDiscrete::Aggregate(const DataArrayType *a1, const DataArrayType *a2, T offsetA2) + { + if(!a1 || !a2) + throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input DataArrayInt instance is NULL !"); + std::size_t nbOfComp(a1->getNumberOfComponents()); + if(nbOfComp!=a2->getNumberOfComponents()) + throw INTERP_KERNEL::Exception("Nb of components mismatch for array Aggregation !"); + mcIdType nbOfTuple1(a1->getNumberOfTuples()),nbOfTuple2(a2->getNumberOfTuples()); + MCAuto ret(DataArrayType::New()); + ret->alloc(nbOfTuple1+nbOfTuple2-offsetA2,nbOfComp); + T *pt=std::copy(a1->begin(),a1->end(),ret->getPointer()); + std::copy(a2->getConstPointer()+offsetA2*nbOfComp,a2->getConstPointer()+nbOfTuple2*nbOfComp,pt); + ret->copyStringInfoFrom(*a1); + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt by concatenating all given arrays, so that (1) the number + * of tuples in the result array is a sum of the number of tuples of given arrays and (2) + * the number of component in the result array is same as that of each of given arrays. + * Info on components is copied from the first of the given arrays. Number of components + * in the given arrays must be the same. + * If the number of non null of elements in \a arr is equal to one the returned object is a copy of it + * not the object itself. + * \param [in] arr - a sequence of arrays to include in the result array. + * \return DataArrayInt * - the new instance of DataArrayInt. + * The caller is to delete this result array using decrRef() as it is no more + * needed. + * \throw If all arrays within \a arr are NULL. + * \throw If getNumberOfComponents() of arrays within \a arr. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::Aggregate(const std::vector& arr) + { + std::vector a; + for(typename std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); + if(a.empty()) + throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : input list must be NON EMPTY !"); + typename std::vector::const_iterator it=a.begin(); + std::size_t nbOfComp((*it)->getNumberOfComponents()); + mcIdType nbt((*it++)->getNumberOfTuples()); + for(;it!=a.end();it++) + { + if((*it)->getNumberOfComponents()!=nbOfComp) + throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !"); + nbt+=(*it)->getNumberOfTuples(); + } + MCAuto ret=DataArrayType::New(); + ret->alloc(nbt,nbOfComp); + T *pt=ret->getPointer(); + for(it=a.begin();it!=a.end();it++) + pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt); + ret->copyStringInfoFrom(*(a[0])); + return ret.retn(); + } + + /*! + * This method takes as input a list of DataArrayInt instances \a arrs that represent each a packed index arrays. + * A packed index array is an allocated array with one component, and at least one tuple. The first element + * of each array in \a arrs must be 0. Each array in \a arrs is expected to be increasingly monotonic. + * This method is useful for users that want to aggregate a pair of DataArrayInt representing an indexed data (typically nodal connectivity index in unstructured meshes. + * + * \return DataArrayInt * - a new object to be managed by the caller. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::AggregateIndexes(const std::vector& arrs) + { + mcIdType retSz=1; + for(typename std::vector::const_iterator it4=arrs.begin();it4!=arrs.end();it4++) + { + if(*it4) + { + (*it4)->checkAllocated(); + if((*it4)->getNumberOfComponents()!=1) + { + std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of compo != 1 at pos " << std::distance(arrs.begin(),it4) << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + mcIdType nbTupl((*it4)->getNumberOfTuples()); + if(nbTupl<1) + { + std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with nb of tuples < 1 at pos " << std::distance(arrs.begin(),it4) << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + if((*it4)->front()!=0) + { + std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a DataArrayInt instance with front value != 0 at pos " << std::distance(arrs.begin(),it4) << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + retSz+=nbTupl-1; + } + else + { + std::ostringstream oss; oss << "DataArrayInt::AggregateIndexes : presence of a null instance at pos " << std::distance(arrs.begin(),it4) << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + if(arrs.empty()) + throw INTERP_KERNEL::Exception("DataArrayInt::AggregateIndexes : input list must be NON EMPTY !"); + MCAuto ret=DataArrayType::New(); + ret->alloc(retSz,1); + T *pt=ret->getPointer(); *pt++=0; + for(typename std::vector::const_iterator it=arrs.begin();it!=arrs.end();it++) + pt=std::transform((*it)->begin()+1,(*it)->end(),pt,std::bind2nd(std::plus(),pt[-1])); + ret->copyStringInfoFrom(*(arrs[0])); + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt which contains all elements of given one-dimensional + * arrays. The result array does not contain any duplicates and its values + * are sorted in ascending order. + * \param [in] arr - sequence of DataArrayInt's to unite. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If any \a arr[i] is not allocated. + * \throw If \a arr[i]->getNumberOfComponents() != 1. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::BuildUnion(const std::vector& arr) + { + std::vector a; + for(typename std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); + for(typename std::vector::const_iterator it=a.begin();it!=a.end();it++) + { + (*it)->checkAllocated(); + if((*it)->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !"); + } + // + std::set r; + for(typename std::vector::const_iterator it=a.begin();it!=a.end();it++) + { + const T *pt=(*it)->getConstPointer(); + mcIdType nbOfTuples((*it)->getNumberOfTuples()); + r.insert(pt,pt+nbOfTuples); + } + DataArrayType *ret=DataArrayType::New(); + ret->alloc(r.size(),1); + std::copy(r.begin(),r.end(),ret->getPointer()); + return ret; + } + + /*! + * Returns a new DataArrayInt which contains elements present in each of given one-dimensional + * arrays. The result array does not contain any duplicates and its values + * are sorted in ascending order. + * \param [in] arr - sequence of DataArrayInt's to intersect. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If any \a arr[i] is not allocated. + * \throw If \a arr[i]->getNumberOfComponents() != 1. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::BuildIntersection(const std::vector& arr) + { + std::vector a; + for(typename std::vector::const_iterator it4=arr.begin();it4!=arr.end();it4++) + if(*it4) + a.push_back(*it4); + for(typename std::vector::const_iterator it=a.begin();it!=a.end();it++) + { + (*it)->checkAllocated(); + if((*it)->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !"); + } + // + std::set r; + for(typename std::vector::const_iterator it=a.begin();it!=a.end();it++) + { + const T *pt=(*it)->getConstPointer(); + mcIdType nbOfTuples((*it)->getNumberOfTuples()); + std::set s1(pt,pt+nbOfTuples); + if(it!=a.begin()) + { + std::set r2; + std::set_intersection(r.begin(),r.end(),s1.begin(),s1.end(),inserter(r2,r2.end())); + r=r2; + } + else + r=s1; + } + DataArrayType *ret(DataArrayType::New()); + ret->alloc(r.size(),1); + std::copy(r.begin(),r.end(),ret->getPointer()); + return ret; + } + + /*! + * This method allows to put a vector of vector of integer into a more compact data structure (skyline). + * This method is not available into python because no available optimized data structure available to map std::vector< std::vector >. + * + * \param [in] v the input data structure to be translate into skyline format. + * \param [out] data the first element of the skyline format. The user is expected to deal with newly allocated array. + * \param [out] dataIndex the second element of the skyline format. + */ + template + void DataArrayDiscrete::PutIntoToSkylineFrmt(const std::vector< std::vector >& v, DataArrayType *& data, DataArrayIdType *& dataIndex) + { + std::size_t sz(v.size()); + MCAuto retDat(DataArrayType::New()); + MCAuto retIdx(DataArrayIdType::New()); + retIdx->alloc(sz+1,1); + mcIdType *ptid(retIdx->getPointer()); *ptid=0; + for(std::size_t i=0;ialloc(retIdx->back(),1); + T *pt=retDat->getPointer(); + for(std::size_t i=0;i + void DataArrayDiscrete::ExtractFromIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) + { + if(!arrIn || !arrIndxIn) + throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : input pointer is NULL !"); + 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 sz=std::distance(idsOfSelectBg,idsOfSelectEnd); + const T *arrInPtr=arrIn->begin(); + const mcIdType *arrIndxPtr=arrIndxIn->begin(); + 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()); + MCAuto arro=DataArrayType::New(); + MCAuto arrIo=DataArrayIdType::New(); + arrIo->alloc(sz+1,1); + const mcIdType *idsIt=idsOfSelectBg; + mcIdType *work=arrIo->getPointer(); + *work++=0; + mcIdType lgth=0; + for(std::size_t i=0;i=0 && *idsIt=work[-1]) + *work=lgth; + else + { + std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " and at this pos arrIndxIn[" << *idsIt; + oss << "+1]-arrIndxIn[" << *idsIt << "] < 0 ! The input index array is bugged !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + arro->alloc(lgth,1); + T *data=arro->getPointer(); + idsIt=idsOfSelectBg; + for(std::size_t i=0;i=0 && arrIndxPtr[*idsIt+1]<=maxSizeOfArr) + data=std::copy(arrInPtr+arrIndxPtr[*idsIt],arrInPtr+arrIndxPtr[*idsIt+1],data); + else + { + std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " arrIndx[" << *idsIt << "] must be >= 0 and arrIndx["; + oss << *idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + arrOut=arro.retn(); + arrIndexOut=arrIo.retn(); + } + + /*! + * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn + * (\ref numbering-indirect). + * This method returns the result of the extraction ( specified by a set of ids with a slice given by \a idsOfSelectStart, \a idsOfSelectStop and \a idsOfSelectStep ). + * The selection of extraction is done standardly in new2old format. + * This method returns indexed arrays (\ref numbering-indirect) using 2 arrays (arrOut,arrIndexOut). + * + * \param [in] idsOfSelectStart begin of set of ids of the input extraction (included) + * \param [in] idsOfSelectStop end of set of ids of the input extraction (excluded) + * \param [in] idsOfSelectStep + * \param [in] arrIn arr origin array from which the extraction will be done. + * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn + * \param [out] arrOut the resulting array + * \param [out] arrIndexOut the index array of the resulting array \b arrOut + * \sa DataArrayInt::ExtractFromIndexedArrays + */ + template + void DataArrayDiscrete::ExtractFromIndexedArraysSlice(mcIdType idsOfSelectStart, mcIdType idsOfSelectStop, mcIdType idsOfSelectStep, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) + { + if(!arrIn || !arrIndxIn) + throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArraysSlice : input pointer is NULL !"); + 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 sz=DataArray::GetNumberOfItemGivenBESRelative(idsOfSelectStart,idsOfSelectStop,idsOfSelectStep,"MEDCouplingUMesh::ExtractFromIndexedArraysSlice : Input slice "); + const T *arrInPtr=arrIn->begin(); + const mcIdType *arrIndxPtr=arrIndxIn->begin(); + 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()); + MCAuto arro=DataArrayType::New(); + MCAuto arrIo=DataArrayIdType::New(); + arrIo->alloc(sz+1,1); + mcIdType idsIt=idsOfSelectStart; + mcIdType *work=arrIo->getPointer(); + *work++=0; + mcIdType lgth=0; + for(mcIdType i=0;i=0 && idsIt=work[-1]) + *work=lgth; + else + { + std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt; + oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + arro->alloc(lgth,1); + T *data=arro->getPointer(); + idsIt=idsOfSelectStart; + for(mcIdType i=0;i=0 && arrIndxPtr[idsIt+1]<=maxSizeOfArr) + data=std::copy(arrInPtr+arrIndxPtr[idsIt],arrInPtr+arrIndxPtr[idsIt+1],data); + else + { + std::ostringstream oss; oss << "DataArrayInt::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx["; + oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; + throw INTERP_KERNEL::Exception(oss.str()); + } + } + arrOut=arro.retn(); + arrIndexOut=arrIo.retn(); + } + + /*! + * This method works on an input pair (\b arrIn, \b arrIndxIn) where \b arrIn indexes is in \b arrIndxIn. + * This method builds an output pair (\b arrOut,\b arrIndexOut) that is a copy from \b arrIn for all cell ids \b not \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) and for + * cellIds \b in [ \b idsOfSelectBg , \b idsOfSelectEnd ) a copy coming from the corresponding values in input pair (\b srcArr, \b srcArrIndex). + * This method is an generalization of MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx that performs the same thing but by without building explicitly a result output arrays. + * + * \param [in] idsOfSelectBg begin of set of ids of the input extraction (included) + * \param [in] idsOfSelectEnd end of set of ids of the input extraction (excluded) + * \param [in] arrIn arr origin array from which the extraction will be done. + * \param [in] arrIndxIn is the input index array allowing to walk into \b arrIn + * \param [in] srcArr input array that will be used as source of copy for ids in [ \b idsOfSelectBg, \b idsOfSelectEnd ) + * \param [in] srcArrIndex index array of \b srcArr + * \param [out] arrOut the resulting array + * \param [out] arrIndexOut the index array of the resulting array \b arrOut + * + * \sa DataArrayInt::SetPartOfIndexedArraysSameIdx + */ + template + void DataArrayDiscrete::SetPartOfIndexedArrays(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) + { + 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 nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + std::vector v(nbOfTuples,true); + mcIdType offset=0; + const mcIdType *arrIndxInPtr=arrIndxIn->begin(); + const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); + for(const mcIdType *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++) + { + if(*it>=0 && *itbegin(); + arrIo->alloc(nbOfTuples+1,1); + arro->alloc(arrIn->getNumberOfTuples()+offset,1); + const T *arrInPtr=arrIn->begin(); + const T *srcArrPtr=srcArr->begin(); + mcIdType *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; + T *arroPtr=arro->getPointer(); + for(mcIdType ii=0;ii + void DataArrayDiscrete::SetPartOfIndexedArraysSlice(mcIdType start, mcIdType end, mcIdType step, + const DataArrayType *arrIn, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex, + DataArrayType* &arrOut, DataArrayIdType* &arrIndexOut) + { + 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 nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType offset=0; + const mcIdType *arrIndxInPtr=arrIndxIn->begin(); + const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); + mcIdType nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSlice : "); + mcIdType it=start; + for(mcIdType i=0;i=0 && itbegin(); + arrIo->alloc(nbOfTuples+1,1); + arro->alloc(arrIn->getNumberOfTuples()+offset,1); + const T *arrInPtr=arrIn->begin(); + const T *srcArrPtr=srcArr->begin(); + mcIdType *arrIoPtr=arrIo->getPointer(); *arrIoPtr++=0; + T *arroPtr=arro->getPointer(); + for(mcIdType ii=0;ii + void DataArrayDiscrete::SetPartOfIndexedArraysSameIdx(const mcIdType *idsOfSelectBg, const mcIdType *idsOfSelectEnd, + DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex) + { + if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) + throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : presence of null pointer in input parameter !"); + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + const mcIdType *arrIndxInPtr=arrIndxIn->begin(); + const mcIdType *srcArrIndexPtr=srcArrIndex->begin(); + T *arrInOutPtr=arrInOut->getPointer(); + const T *srcArrPtr=srcArr->begin(); + for(const mcIdType *it=idsOfSelectBg;it!=idsOfSelectEnd;it++,srcArrIndexPtr++) + { + if(*it>=0 && *it + void DataArrayDiscrete::SetPartOfIndexedArraysSameIdxSlice(mcIdType start, mcIdType end, mcIdType step, + DataArrayType *arrInOut, const DataArrayIdType *arrIndxIn, + const DataArrayType *srcArr, const DataArrayIdType *srcArrIndex) + { + if(arrInOut==0 || arrIndxIn==0 || srcArr==0 || srcArrIndex==0) + throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : presence of null pointer in input parameter !"); + 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 nbOfElemsToSet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"DataArrayInt::SetPartOfIndexedArraysSameIdxSlice : "); + mcIdType it=start; + for(mcIdType i=0;i=0 && itgetNumberOfTuples()-1) removal process will be performed in the following range [arr+arrIndx[i]+offsetForRemoval,arr+arr[i+1]) + * \return true if \b arr and \b arrIndx have been modified, false if not. + */ + template + bool DataArrayDiscrete::RemoveIdsFromIndexedArrays(const T *idsToRemoveBg, const T *idsToRemoveEnd, + DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval) + { + if(!arrIndx || !arr) + throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : some input arrays are empty !"); + if(offsetForRemoval<0) + throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : offsetForRemoval should be >=0 !"); + std::set s(idsToRemoveBg,idsToRemoveEnd); + mcIdType nbOfGrps=arrIndx->getNumberOfTuples()-1; + mcIdType *arrIPtr=arrIndx->getPointer(); + *arrIPtr++=0; + mcIdType previousArrI=0; + const T *arrPtr=arr->begin(); + std::vector arrOut;//no utility to switch to DataArrayInt because copy always needed + for(mcIdType i=0;ioffsetForRemoval) + { + for(const T *work=arrPtr+previousArrI+offsetForRemoval;work!=arrPtr+*arrIPtr;work++) + { + if(s.find(*work)==s.end()) + arrOut.push_back(*work); + } + } + previousArrI=*arrIPtr; + *arrIPtr=ToIdType(arrOut.size()); + } + if(arr->getNumberOfTuples()==ToIdType(arrOut.size())) + return false; + arr->alloc(arrOut.size(),1); + std::copy(arrOut.begin(),arrOut.end(),arr->getPointer()); + return true; + } + + /*! + * Returns a new DataArrayInt containing an arithmetic progression + * that is equal to the sequence returned by Python \c range(\a begin,\a end,\a step ) + * function. + * \param [in] begin - the start value of the result sequence. + * \param [in] end - limiting value, so that every value of the result array is less than + * \a end. + * \param [in] step - specifies the increment or decrement. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If \a step == 0. + * \throw If \a end < \a begin && \a step > 0. + * \throw If \a end > \a begin && \a step < 0. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::Range(T begin, T end, T step) + { + mcIdType nbOfTuples=DataArrayTools::GetNumberOfItemGivenBESRelative(begin,end,step,"DataArrayInt::Range"); + MCAuto ret=DataArrayType::New(); + ret->alloc(nbOfTuples,1); + T *ptr=ret->getPointer(); + if(step>0) + { + for(T i=begin;iend;i+=step,ptr++) + *ptr=i; + } + return ret.retn(); + } + + /*! + * Returns a new DataArrayInt containing a renumbering map in "Old to New" mode computed + * from a zip representation of a surjective format (returned e.g. by + * \ref MEDCoupling::DataArrayDouble::findCommonTuples() "DataArrayDouble::findCommonTuples()" + * for example). The result array minimizes the permutation.
+ * For more info on renumbering see \ref numbering.
+ * \b Example:
+ * - \a nbOfOldTuples: 10 + * - \a arr : [0,3, 5,7,9] + * - \a arrIBg : [0,2,5] + * - \a newNbOfTuples: 7 + * - result array : [0,1,2,0,3,4,5,4,6,4] + * + * \param [in] nbOfOldTuples - number of tuples in the initial array \a arr. + * \param [in] arr - the array of tuple indices grouped by \a arrIBg array. + * \param [in] arrIBg - the array dividing all indices stored in \a arr into groups of + * (indices of) equal values. Its every element (except the last one) points to + * the first element of a group of equal values. + * \param [in] arrIEnd - specifies the end of \a arrIBg, so that the last element of \a + * arrIBg is \a arrIEnd[ -1 ]. + * \param [out] newNbOfTuples - number of tuples after surjection application. + * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete this + * array using decrRef() as it is no more needed. + * \throw If any value of \a arr breaks condition ( 0 <= \a arr[ i ] < \a nbOfOldTuples ). + */ + template + DataArrayIdType *DataArrayDiscrete::ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, const mcIdType *arr, const mcIdType *arrIBg, const mcIdType *arrIEnd, mcIdType &newNbOfTuples) + { + MCAuto ret=DataArrayIdType::New(); + ret->alloc(nbOfOldTuples,1); + mcIdType *pt=ret->getPointer(); + std::fill(pt,pt+nbOfOldTuples,-1); + mcIdType nbOfGrps=ToIdType(std::distance(arrIBg,arrIEnd))-1; + const mcIdType *cIPtr=arrIBg; + for(mcIdType i=0;i=0 && arr[j] + * and the result array contains IDs of families [ 1,3,3,0,2 ].
Note a family ID 0 which + * stands for the element #3 which is in none of groups. + * + * \param [in] groups - sequence of groups of element IDs. + * \param [in] newNb - total number of elements; it must be more than max ID of element + * in \a groups. + * \param [out] fidsOfGroups - IDs of families the elements of each group belong to. + * \return DataArrayInt * - a new instance of DataArrayInt containing IDs of families + * each element with ID from range [0, \a newNb ) belongs to. The caller is to + * delete this array using decrRef() as it is no more needed. + * \throw If any element ID in \a groups violates condition ( 0 <= ID < \a newNb ). + */ + template + DataArrayIdType *DataArrayDiscrete::MakePartition(const std::vector& groups, mcIdType newNb, std::vector< std::vector >& fidsOfGroups) + { + std::vector groups2; + for(typename std::vector::const_iterator it4=groups.begin();it4!=groups.end();it4++) + if(*it4) + groups2.push_back(*it4); + MCAuto ret=DataArrayIdType::New(); + ret->alloc(newNb,1); + mcIdType *retPtr=ret->getPointer(); + std::fill(retPtr,retPtr+newNb,0); + mcIdType fid=1; + for(typename std::vector::const_iterator iter=groups2.begin();iter!=groups2.end();iter++) + { + const T *ptr=(*iter)->getConstPointer(); + std::size_t nbOfElem=(*iter)->getNbOfElems(); + mcIdType sfid=fid; + for(mcIdType j=0;j=0 && ptr[i]getName() << "\" in tuple #" << i << " value = " << ptr[i] << " ! Should be in [0," << newNb; + oss << ") !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + if(found) + fid++; + } + } + fidsOfGroups.clear(); + fidsOfGroups.resize(groups2.size()); + mcIdType grId=0; + for(typename std::vector::const_iterator iter=groups2.begin();iter!=groups2.end();iter++,grId++) + { + std::set tmp; + const T *ptr=(*iter)->getConstPointer(); + std::size_t nbOfElem=(*iter)->getNbOfElems(); + for(const T *p=ptr;p!=ptr+nbOfElem;p++) + tmp.insert(retPtr[*p]); + fidsOfGroups[grId].insert(fidsOfGroups[grId].end(),tmp.begin(),tmp.end()); + } + return ret.retn(); + } + +} + +/// @cond INTERNAL +namespace MEDCouplingImpl +{ + template + class OpSwitchedOn + { + public: + OpSwitchedOn(T *pt):_pt(pt),_cnt(0) { } + void operator()(const bool& b) { if(b) *_pt++=FromIdType(_cnt); _cnt++; } + private: + T *_pt; + MEDCoupling::mcIdType _cnt; + }; + + template + class OpSwitchedOff + { + public: + OpSwitchedOff(T *pt):_pt(pt),_cnt(0) { } + void operator()(const bool& b) { if(!b) *_pt++=FromIdType(_cnt); _cnt++; } + private: + T *_pt; + MEDCoupling::mcIdType _cnt; + }; +} +/// @endcond + +namespace MEDCoupling +{ + /*! + * This method returns the list of ids in ascending mode so that v[id]==true. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::BuildListOfSwitchedOn(const std::vector& v) + { + std::size_t sz(std::count(v.begin(),v.end(),true)); + MCAuto ret(DataArrayType::New()); ret->alloc(sz,1); + std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOn(ret->getPointer())); + return ret.retn(); + } + + /*! + * This method returns the list of ids in ascending mode so that v[id]==false. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::BuildListOfSwitchedOff(const std::vector& v) + { + std::size_t sz(std::count(v.begin(),v.end(),false)); + MCAuto ret(DataArrayType::New()); ret->alloc(sz,1); + std::for_each(v.begin(),v.end(),MEDCouplingImpl::OpSwitchedOff(ret->getPointer())); + return ret.retn(); + } +} + +namespace MEDCoupling +{ /*! * This method compares content of input vector \a v and \a this. * If for each id in \a this v[id]==True and for all other ids id2 not in \a this v[id2]==False, true is returned. @@ -4002,7 +7620,7 @@ struct NotInRange throw INTERP_KERNEL::Exception("DataArrayInt::isFittingWith : number of components of this should be equal to one !"); const T *w(this->begin()),*end2(this->end()); T refVal=-std::numeric_limits::max(); - int i=0; + T i=0; std::vector::const_iterator it(v.begin()); for(;it!=v.end();it++,i++) { diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx old mode 100644 new mode 100755 index 36349e2a8..965794bf8 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -35,23 +35,23 @@ template class MEDCoupling::DataArrayTemplate; /*! * Returns an integer value characterizing \a this array, which is useful for a quick - * comparison of many instances of DataArrayInt. - * \return int - the hash value. + * comparison of many instances of DataArrayChar. + * \return mcIdType - the hash value. * \throw If \a this is not allocated. */ -int DataArrayChar::getHashCode() const +mcIdType DataArrayChar::getHashCode() const { checkAllocated(); std::size_t nbOfElems=getNbOfElems(); - int ret=nbOfElems*65536; - int delta=3; + std::size_t ret=nbOfElems*65536; + std::size_t delta=3; if(nbOfElems>48) delta=nbOfElems/8; - int ret0=0; + mcIdType ret0=0; const char *pt=begin(); for(std::size_t i=0;icheckAllocated(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); if(nbOfTuples!=other->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meldWith : mismatch of number of tuples !"); - int nbOfComp1=getNumberOfComponents(); - int 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(); const char *inp2=other->getConstPointer(); - for(int i=0;i compIds(nbOfComp2); - for(int i=0;i compIds(nbOfComp2); + for(std::size_t i=0;igetNumberOfComponents() != 1. */ -DataArrayInt *DataArrayChar::findIdsEqual(char val) const +DataArrayIdType *DataArrayChar::findIdsEqual(char val) const { checkAllocated(); if(getNumberOfComponents()!=1) 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(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + mcIdType nbOfTuples=getNumberOfTuples(); + for(mcIdType i=0;ipushBackSilent(i); return ret.retn(); } /*! - * Creates a new DataArrayChar containing IDs (indices) of tuples holding value \b not + * Creates a new DataArrayIdType containing IDs (indices) of tuples holding value \b not * equal to a given one. * \param [in] val - the value to ignore within \a this. * \return DataArrayChar * - a new instance of DataArrayChar. The caller is to delete this @@ -224,15 +224,15 @@ DataArrayInt *DataArrayChar::findIdsEqual(char val) const * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. */ -DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const +DataArrayIdType *DataArrayChar::findIdsNotEqual(char val) const { checkAllocated(); if(getNumberOfComponents()!=1) 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(DataArrayInt::New()); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i ret(DataArrayIdType::New()); ret->alloc(0,1); + mcIdType nbOfTuples=getNumberOfTuples(); + for(mcIdType i=0;ipushBackSilent(i); return ret.retn(); @@ -244,17 +244,16 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const * This method differs from DataArrayChar::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayChar::findIdFirstEqualTuple. * \sa DataArrayChar::findIdFirstEqualTuple */ -int DataArrayChar::findIdSequence(const std::vector& vals) const +mcIdType DataArrayChar::findIdSequence(const std::vector& vals) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); - if(nbOfCompo!=1) + if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !"); const char *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); if(loc!=cptr+nbOfVals) - return std::distance(cptr,loc); + return ToIdType(std::distance(cptr,loc)); return -1; } @@ -270,13 +269,13 @@ int DataArrayChar::findIdSequence(const std::vector& vals) const * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. * \sa DataArrayChar::findIdSequence. */ -int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const +mcIdType DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { checkAllocated(); - int nbOfCompo=getNumberOfComponents(); + std::size_t nbOfCompo=getNumberOfComponents(); if(nbOfCompo==0) throw INTERP_KERNEL::Exception("DataArrayChar::findIdFirstEqualTuple : 0 components in 'this' !"); - if(nbOfCompo!=(int)tupl.size()) + if(nbOfCompo!=tupl.size()) { std::ostringstream oss; oss << "DataArrayChar::findIdFirstEqualTuple : 'this' contains " << nbOfCompo << " components and searching for a tuple of length " << tupl.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -291,7 +290,7 @@ int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const if(std::distance(cptr,work)%nbOfCompo!=0) work++; else - return std::distance(cptr,work)/nbOfCompo; + return ToIdType(std::distance(cptr,work)/nbOfCompo); } } return -1; @@ -340,16 +339,16 @@ bool DataArrayChar::presenceOfValue(const std::vector& vals) const * If not any tuple contains \b value -1 is returned. * \sa DataArrayChar::presenceOfValue */ -int DataArrayChar::findIdFirstEqual(char value) const +mcIdType DataArrayChar::findIdFirstEqual(char value) const { checkAllocated(); 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(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); const char *ret=std::find(cptr,cptr+nbOfTuples,value); if(ret!=cptr+nbOfTuples) - return std::distance(cptr,ret); + return ToIdType(std::distance(cptr,ret)); return -1; } @@ -359,17 +358,17 @@ int DataArrayChar::findIdFirstEqual(char value) const * If not any tuple contains one of the values contained in 'vals' false is returned. * \sa DataArrayChar::presenceOfValue */ -int DataArrayChar::findIdFirstEqual(const std::vector& vals) const +mcIdType DataArrayChar::findIdFirstEqual(const std::vector& vals) const { checkAllocated(); if(getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !"); + 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(); - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); for(const char *w=cptr;w!=cptr+nbOfTuples;w++) if(vals2.find(*w)!=vals2.end()) - return std::distance(cptr,w); + return ToIdType(std::distance(cptr,w)); return -1; } @@ -382,15 +381,15 @@ int DataArrayChar::findIdFirstEqual(const std::vector& vals) const * \param [in] vmax end of range. This value is \b not included in range. * \return a newly allocated data array that the caller should deal with. */ -DataArrayInt *DataArrayChar::findIdsInRange(char vmin, char vmax) const +DataArrayIdType *DataArrayChar::findIdsInRange(char vmin, char vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayChar::findIdsInRange : this must have exactly one component !"); const char *cptr=getConstPointer(); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); - int nbOfTuples=getNumberOfTuples(); - for(int i=0;i ret=DataArrayIdType::New(); ret->alloc(0,1); + mcIdType nbOfTuples=getNumberOfTuples(); + for(mcIdType i=0;i=vmin && *cptrpushBackSilent(i); return ret.retn(); @@ -444,8 +443,8 @@ DataArrayChar *DataArrayChar::Aggregate(const std::vector throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : input list must be NON EMPTY !"); std::vector::const_iterator it=a.begin(); std::size_t nbOfComp((*it)->getNumberOfComponents()); - int nbt=(*it++)->getNumberOfTuples(); - for(int i=1;it!=a.end();it++,i++) + mcIdType nbt=(*it++)->getNumberOfTuples(); + for(;it!=a.end();it++) { if((*it)->getNumberOfComponents()!=nbOfComp) throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !"); @@ -510,31 +509,31 @@ DataArrayChar *DataArrayChar::Meld(const std::vector& arr for(it=a.begin();it!=a.end();it++) (*it)->checkAllocated(); it=a.begin(); - int nbOfTuples=(*it)->getNumberOfTuples(); - std::vector nbc(a.size()); + mcIdType nbOfTuples=(*it)->getNumberOfTuples(); + std::vector nbc(a.size()); std::vector pts(a.size()); nbc[0]=(*it)->getNumberOfComponents(); pts[0]=(*it++)->getConstPointer(); - for(int i=1;it!=a.end();it++,i++) + for(std::size_t i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayChar::meld : mismatch of number of tuples !"); nbc[i]=(*it)->getNumberOfComponents(); pts[i]=(*it)->getConstPointer(); } - int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),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(); - for(int i=0;isetInfoOnComponent(k,a[i]->getInfoOnComponent(j)); return ret; } @@ -622,12 +621,12 @@ void DataArrayByte::reprZipStream(std::ostream& stream) const void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const { DataArray::reprWithoutNameStream(stream); - if(_mem.reprHeader(getNumberOfComponents(),stream)) + if(_mem.reprHeader(ToIdType(getNumberOfComponents()),stream)) { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbCompo=getNumberOfComponents(); - for(int i=0;i(stream," "));//it is not a bug int here not char because it is not ASCII here contrary to DataArrayAsciiChar @@ -639,12 +638,13 @@ void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const { DataArray::reprWithoutNameStream(stream); - _mem.reprZip(getNumberOfComponents(),stream); + _mem.reprZip(ToIdType(getNumberOfComponents()),stream); } void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents(); + mcIdType nbTuples=getNumberOfTuples(); + std::size_t nbComp=getNumberOfComponents(); const char *data=getConstPointer(); stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl; if(nbTuples*nbComp>=1) @@ -668,10 +668,10 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const stream << "DataArrayByte C++ instance at " << this << ". "; if(isAllocated()) { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -685,17 +685,17 @@ void DataArrayByte::reprQuickOverview(std::ostream& stream) const void DataArrayByte::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_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; - for(int i=0;i1) { oss2 << "("; - for(int j=0;j DataArrayByte::toVectorOfBool() const checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayByte::toVectorOfBool : this method can be used only if this has one component !"); - int nbt(getNumberOfTuples()); + mcIdType nbt(getNumberOfTuples()); std::vector ret(nbt,false); const char *pt(begin()); - for(int i=0;i_nb_of_elem and \bnbOfTuples==1 or * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayByte *DataArrayByteTuple::buildDAByte(int nbOfTuples, int nbOfCompo) const +DataArrayByte *DataArrayByteTuple::buildDAByte(std::size_t nbOfTuples, std::size_t nbOfCompo) const { if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1)) { @@ -888,10 +888,10 @@ DataArrayAsciiChar::DataArrayAsciiChar(const std::vector& vst, char 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 !"); - int nbTuples=(int)vst.size(); - alloc(nbTuples,(int)nbCompo); + std::size_t nbTuples=vst.size(); + alloc(nbTuples,nbCompo); char *pt=getPointer(); - for(int i=0;i(stream)); @@ -995,7 +995,8 @@ void DataArrayAsciiChar::reprZipWithoutNameStream(std::ostream& stream) const void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents(); + mcIdType nbTuples=getNumberOfTuples(); + std::size_t nbComp=getNumberOfComponents(); const char *data=getConstPointer(); stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl; if(nbTuples*nbComp>=1) @@ -1019,10 +1020,10 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const stream << "DataArrayAsciiChar C++ instance at " << this << ". "; if(isAllocated()) { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -1036,27 +1037,27 @@ void DataArrayAsciiChar::reprQuickOverview(std::ostream& stream) const void DataArrayAsciiChar::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const char *data=begin(); - int nbOfTuples=getNumberOfTuples(); - int nbOfCompo=(int)_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; - for(int i=0;i_nb_of_elem and \bnbOfTuples==1 or * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayAsciiChar *DataArrayAsciiCharTuple::buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const +DataArrayAsciiChar *DataArrayAsciiCharTuple::buildDAAsciiChar(std::size_t nbOfTuples, std::size_t nbOfCompo) const { if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1)) { diff --git a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx index fd5441f85..8465de034 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayFloat.cxx @@ -40,7 +40,8 @@ DataArrayFloat *DataArrayFloat::deepCopy() const void DataArrayFloat::reprCppStream(const std::string& varName, std::ostream& stream) const { - int nbTuples(getNumberOfTuples()),nbComp(getNumberOfComponents()); + mcIdType nbTuples(getNumberOfTuples()); + std::size_t nbComp(getNumberOfComponents()); const float *data(begin()); stream.precision(7); stream << "DataArrayFloat *" << varName << "=DataArrayFloat::New();" << std::endl; @@ -62,10 +63,10 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const stream << "DataArrayFloat C++ instance at " << this << ". "; if(isAllocated()) { - int nbOfCompo=(int)_info_on_compo.size(); + std::size_t nbOfCompo=_info_on_compo.size(); if(nbOfCompo>=1) { - int nbOfTuples=getNumberOfTuples(); + mcIdType nbOfTuples=getNumberOfTuples(); stream << "Number of tuples : " << nbOfTuples << ". Number of components : " << nbOfCompo << "." << std::endl; reprQuickOverviewData(stream,MAX_NB_OF_BYTE_IN_REPR); } @@ -79,18 +80,18 @@ void DataArrayFloat::reprQuickOverview(std::ostream& stream) const void DataArrayFloat::reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const { const float *data(begin()); - int nbOfTuples(getNumberOfTuples()); - int nbOfCompo=(int)_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()); bool isFinished=true; - for(int i=0;i1) { oss2 << "("; - for(int j=0;j(pt,nbOfComp) +DataArrayFloatTuple::DataArrayFloatTuple(float *pt, std::size_t nbOfComp):DataArrayTuple(pt,nbOfComp) { } std::string DataArrayFloatTuple::repr() const { std::ostringstream oss; oss.precision(7); oss << "("; - for(int i=0;i<_nb_of_compo-1;i++) + for(std::size_t i=0;i<_nb_of_compo-1;i++) oss << _pt[i] << ", "; oss << _pt[_nb_of_compo-1] << ")"; return oss.str(); @@ -164,7 +165,7 @@ float DataArrayFloatTuple::floatValue() const * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem. */ -DataArrayFloat *DataArrayFloatTuple::buildDAFloat(int nbOfTuples, int nbOfCompo) const +DataArrayFloat *DataArrayFloatTuple::buildDAFloat(std::size_t nbOfTuples, std::size_t nbOfCompo) const { return this->buildDA(nbOfTuples,nbOfCompo); } diff --git a/src/MEDCoupling/MEDCouplingMesh.cxx b/src/MEDCoupling/MEDCouplingMesh.cxx old mode 100644 new mode 100755 index af878faa5..195a6f308 --- a/src/MEDCoupling/MEDCouplingMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMesh.cxx @@ -146,7 +146,7 @@ bool MEDCouplingMesh::isEqual(const MEDCouplingMesh *other, double prec) const * to be compared. An interpolation using MEDCouplingRemapper class should be then used. */ void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { cellCor=0; nodeCor=0; @@ -195,28 +195,28 @@ void MEDCouplingMesh::checkGeoEquivalWith(const MEDCouplingMesh *other, int levO * \param [in] partBg - the array of node ids. * \param [in] partEnd - end of \a partBg, i.e. a pointer to a (last+1)-th element * of \a partBg. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found * cells. The caller is to delete this array using decrRef() as it is no * more needed. */ -DataArrayInt *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const +DataArrayIdType *MEDCouplingMesh::getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const { - std::vector crest; - std::set p(partBg,partEnd); - int nbOfCells=getNumberOfCells(); - for(int i=0;i crest; + std::set p(partBg,partEnd); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i conn; + std::vector conn; getNodeIdsOfCell(i,conn); bool cont=true; - for(std::vector::const_iterator iter=conn.begin();iter!=conn.end() && cont;iter++) + for(std::vector::const_iterator iter=conn.begin();iter!=conn.end() && cont;iter++) if(p.find(*iter)==p.end()) cont=false; if(cont) crest.push_back(i); } - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)crest.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(crest.size(),1); std::copy(crest.begin(),crest.end(),ret->getPointer()); return ret; } @@ -259,7 +259,7 @@ bool MEDCouplingMesh::areCompatibleForMerge(const MEDCouplingMesh *other) const * * \sa MEDCouplingMesh::buildPart */ -MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const +MEDCouplingMesh *MEDCouplingMesh::buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1) { @@ -269,7 +269,7 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId } else { - MCAuto cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildPart(cellIds->begin(),cellIds->end()); } } @@ -279,9 +279,9 @@ MEDCouplingMesh *MEDCouplingMesh::buildPartRange(int beginCellIds, int endCellId * * \sa MEDCouplingMesh::buildPartAndReduceNodes */ -MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const +MEDCouplingMesh *MEDCouplingMesh::buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const { - MCAuto cellIds=DataArrayInt::Range(beginCellIds,endCellIds,stepCellIds); + MCAuto cellIds=DataArrayIdType::Range(beginCellIds,endCellIds,stepCellIds); return buildPartAndReduceNodes(cellIds->begin(),cellIds->end(),arr); } @@ -572,12 +572,12 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingMesh::GetCorrespondingPolyType(INTE * \throw if type is dynamic as \c INTERP_KERNEL::NORM_POLYHED , \c INTERP_KERNEL::NORM_POLYGON , \c INTERP_KERNEL::NORM_QPOLYG * \throw if type is equal to \c INTERP_KERNEL::NORM_ERROR or to an unexisting geometric type. */ -int MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) +mcIdType MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); if(cm.isDynamic()) throw INTERP_KERNEL::Exception("MEDCouplingMesh::GetNumberOfNodesOfGeometricType : the input geometric type is dynamic ! Impossible to return a fixed number of nodes constituting it !"); - return (int) cm.getNumberOfNodes(); + return ToIdType( cm.getNumberOfNodes()); } /*! @@ -647,15 +647,15 @@ const char *MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NormalizedCel * \ref py_mcumesh_getCellsContainingPoints "Here is a Python example". * \endif */ -void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { - eltsIndex=DataArrayInt::New(); elts=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); - int *eltsIndexPtr(eltsIndex->getPointer()); + 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 spaceDim(getSpaceDimension()); const double *work(pos); - for(int i=0;i ret; + std::vector ret; getCellsContainingPoint(work,eps,ret); elts->insertAtTheEnd(ret.begin(),ret.end()); eltsIndexPtr[i+1]=elts->getNumberOfTuples(); @@ -669,7 +669,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints * * \sa MEDCouplingMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss */ -void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { this->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); } diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index d89292301..02e3bfc27 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -47,7 +47,7 @@ namespace MEDCoupling } MEDCouplingMeshType; // -- WARNING this enum must be synchronized with MEDCouplingCommon.i file ! -- - class DataArrayInt; + class DataArrayIdType; class DataArrayByte; class DataArrayDouble; class MEDCouplingUMesh; @@ -77,46 +77,46 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const = 0; MEDCOUPLING_EXPORT virtual void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const = 0; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const = 0; MEDCOUPLING_EXPORT virtual void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const = 0; + DataArrayIdType *&cellCor) const = 0; MEDCOUPLING_EXPORT virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const; MEDCOUPLING_EXPORT void checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; // MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; MEDCOUPLING_EXPORT virtual void checkConsistency(double eps=1e-12) const = 0; - MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCells() const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfNodes() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfCells() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfNodes() const = 0; MEDCOUPLING_EXPORT virtual int getSpaceDimension() const = 0; MEDCOUPLING_EXPORT virtual int getMeshDimension() const = 0; MEDCOUPLING_EXPORT virtual DataArrayDouble *getCoordinatesAndOwner() const = 0; MEDCOUPLING_EXPORT virtual DataArrayDouble *computeCellCenterOfMass() const = 0; MEDCOUPLING_EXPORT virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfNodesPerCell() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfFacesPerCell() const = 0; - MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; - MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *computeNbOfNodesPerCell() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *computeNbOfFacesPerCell() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; + MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const = 0; MEDCOUPLING_EXPORT virtual std::set getAllGeoTypes() const = 0; - MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(int nodeId, std::vector& coo) const = 0; + MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const; + MEDCOUPLING_EXPORT virtual void getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const = 0; MEDCOUPLING_EXPORT virtual std::string simpleRepr() const = 0; MEDCOUPLING_EXPORT virtual std::string advancedRepr() const = 0; // tools MEDCOUPLING_EXPORT virtual const DataArrayDouble *getDirectAccessOfCoordsArrIfInStructure() const = 0; - MEDCOUPLING_EXPORT virtual std::vector getDistributionOfTypes() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const = 0; - MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const = 0; + MEDCOUPLING_EXPORT virtual std::vector getDistributionOfTypes() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const = 0; + MEDCOUPLING_EXPORT virtual void splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const = 0; MEDCOUPLING_EXPORT virtual void getBoundingBox(double *bbox) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0; - MEDCOUPLING_EXPORT virtual int getCellContainingPoint(const double *pos, double eps) const = 0; - MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const = 0; - MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; - MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; + MEDCOUPLING_EXPORT virtual mcIdType getCellContainingPoint(const double *pos, double eps) const = 0; + MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const = 0; + MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; + MEDCOUPLING_EXPORT virtual void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalyticCompo(TypeOfField t, int nbOfComp, const std::string& func) const; @@ -125,29 +125,29 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void rotate(const double *center, const double *vector, double angle) = 0; MEDCOUPLING_EXPORT virtual void translate(const double *vector) = 0; MEDCOUPLING_EXPORT virtual void scale(const double *point, double factor) = 0; - MEDCOUPLING_EXPORT virtual void renumberCells(const int *old2NewBg, bool check=true) = 0; + MEDCOUPLING_EXPORT virtual void renumberCells(const mcIdType *old2NewBg, bool check=true) = 0; MEDCOUPLING_EXPORT virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPart(const int *start, const int *end) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const; - MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPart(const mcIdType *start, const mcIdType *end) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const; + MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType*& arr) const; MEDCOUPLING_EXPORT virtual MEDCouplingUMesh *buildUnstructured() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *simplexize(int policy) = 0; - MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *simplexize(int policy) = 0; + MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const = 0; MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(std::vector& meshes); MEDCOUPLING_EXPORT static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetCorrespondingPolyType(INTERP_KERNEL::NormalizedCellType type); - MEDCOUPLING_EXPORT static int GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static int GetDimensionOfGeometricType(INTERP_KERNEL::NormalizedCellType type); MEDCOUPLING_EXPORT static const char *GetReprOfGeometricType(INTERP_KERNEL::NormalizedCellType type); //serialisation-unserialization - MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const = 0; - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const = 0; - MEDCOUPLING_EXPORT virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0; - MEDCOUPLING_EXPORT virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + MEDCOUPLING_EXPORT virtual void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const = 0; + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const = 0; + MEDCOUPLING_EXPORT virtual void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const = 0; + MEDCOUPLING_EXPORT virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) = 0; MEDCOUPLING_EXPORT std::string writeVTK(const std::string& fileName, bool isBinary=true) const; MEDCOUPLING_EXPORT std::string getVTKFileNameOf(const std::string& fileName) const; diff --git a/src/MEDCoupling/MEDCouplingMultiFields.cxx b/src/MEDCoupling/MEDCouplingMultiFields.cxx index 8322da12f..bb7213e4f 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.cxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.cxx @@ -151,7 +151,7 @@ bool MEDCouplingMultiFields::isEqualWithoutConsideringStr(const MEDCouplingMulti const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldWithId(int id) const { - if(id>=(int)_fs.size() || id < 0) + if(id>=ToIdType(_fs.size()) || id < 0) throw INTERP_KERNEL::Exception("MEDCouplingMultiFields::getFieldWithId : invalid id outside boundaries !"); return _fs[id]; } @@ -170,7 +170,7 @@ int MEDCouplingMultiFields::getNumberOfFields() const const MEDCouplingFieldDouble *MEDCouplingMultiFields::getFieldAtPos(int id) const { - if(id<0 || id>=(int)_fs.size()) + if(id<0 || id>=ToIdType(_fs.size())) { std::ostringstream oss; oss << "MEDCouplingMultiFields::getFieldAtPos : Invalid given pos : should be >=0 and < " << _fs.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -354,7 +354,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields(const MEDCouplingMultiFields& oth tmp2[j]=0; } _fs[i]->setArrays(tmp2); - std::vector tinyInfo; + std::vector tinyInfo; std::vector tinyInfo2; other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tinyInfo); other._fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tinyInfo2); @@ -367,7 +367,7 @@ MEDCouplingMultiFields::MEDCouplingMultiFields() { } -void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const +void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& tinyInfo, std::vector& tinyInfo2, int& nbOfDiffMeshes, int& nbOfDiffArr) const { std::vector refs; std::vector ms=getDifferentMeshes(refs); @@ -376,70 +376,70 @@ void MEDCouplingMultiFields::getTinySerializationInformation(std::vector& t std::vector fs=getDifferentArrays(refs2); nbOfDiffArr=(int)fs.size(); // - std::size_t sz=refs.size();//==_fs.size() - int sz2=0; - for(std::size_t i=0;i doubleDaInd(sz); std::vector timeDiscrInt; tinyInfo.resize(sz2+5*sz+3); - tinyInfo[0]=(int)sz; + tinyInfo[0]=sz; tinyInfo[1]=sz2; - for(std::size_t i=0;i tmp; - std::vector tmp2; + std::vector tmp2; _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationDbleInformation2(tmp); _fs[i]->getTimeDiscretizationUnderGround()->getTinySerializationIntInformation2(tmp2); - tinyInfo[3*sz+3+i]=(int)tmp.size(); - tinyInfo[4*sz+3+i]=(int)tmp2.size(); + tinyInfo[3*sz+3+i]=ToIdType(tmp.size()); + tinyInfo[4*sz+3+i]=ToIdType(tmp2.size()); tinyInfo2.insert(tinyInfo2.end(),tmp.begin(),tmp.end()); timeDiscrInt.insert(timeDiscrInt.end(),tmp2.begin(),tmp2.end()); } - int sz3=(int)timeDiscrInt.size(); + mcIdType sz3=ToIdType(timeDiscrInt.size()); tinyInfo[2]=sz3; // - for(std::size_t i=0;igetTimeDiscretization(); + for(mcIdType i=0;igetTimeDiscretization()); int k=0; - for(std::size_t i=0;i::const_iterator it=refs2[i].begin();it!=refs2[i].end();it++,k++) tinyInfo[5*sz+k+3]=*it; tinyInfo.insert(tinyInfo.end(),timeDiscrInt.begin(),timeDiscrInt.end());//tinyInfo has lgth==sz3+sz2+5*sz+3 } -void MEDCouplingMultiFields::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, +void MEDCouplingMultiFields::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& ft, const std::vector& ms, const std::vector& das) { - int sz=tinyInfoI[0]; + mcIdType sz=tinyInfoI[0]; _fs.resize(sz); - int sz2=tinyInfoI[1]; + mcIdType sz2=tinyInfoI[1]; // dealing with ft with no mesh set. - for(int i=0;isetMesh(ms[meshId]); } // dealing with fieldtemplate->fielddouble - int k=0; - int offI=0; - int offD=0; - for(int i=0;i tmp(sz3); - for(int j=0;j& tinyI } _fs[i]->setArrays(tmp); // time discr tiny info - int lgthI=tinyInfoI[4*sz+3+i]; - int lgthD=tinyInfoI[3*sz+3+i]; + mcIdType lgthI=tinyInfoI[4*sz+3+i]; + mcIdType lgthD=tinyInfoI[3*sz+3+i]; // - std::vector tdInfoI(tinyInfoI.begin()+sz2+5*sz+3+offI,tinyInfoI.begin()+sz2+5*sz+3+offI+lgthI); + 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); // diff --git a/src/MEDCoupling/MEDCouplingMultiFields.hxx b/src/MEDCoupling/MEDCouplingMultiFields.hxx index e7a82b402..9fe1d9a13 100644 --- a/src/MEDCoupling/MEDCouplingMultiFields.hxx +++ b/src/MEDCoupling/MEDCouplingMultiFields.hxx @@ -24,6 +24,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "MEDCouplingTimeLabel.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include "InterpKernelException.hxx" @@ -61,8 +62,8 @@ namespace MEDCoupling 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, + 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, const std::vector& das); MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx index 3b7584558..8b076f1d6 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -34,7 +34,7 @@ class MEDCouplingNormalizedCartesianMesh public: static const int MY_SPACEDIM=SPACEDIM; static const int MY_MESHDIM=SPACEDIM; - typedef int MyConnType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; public: MEDCouplingNormalizedCartesianMesh(const MEDCoupling::MEDCouplingCMesh *mesh); @@ -42,8 +42,8 @@ public: //INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const; //int getNumberOfNodesOfElement(int eltId) const; //int getNumberOfNodes() const; - unsigned long getNumberOfElements() const; - unsigned long nbCellsAlongAxis(int axis) const; + mcIdType getNumberOfElements() const; + mcIdType nbCellsAlongAxis(int axis) const; const double * getCoordsAlongAxis(int axis) const; ~MEDCouplingNormalizedCartesianMesh(); private: diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx index 72412782c..7fe1ef125 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx @@ -39,13 +39,13 @@ MEDCouplingNormalizedCartesianMesh::~MEDCouplingNormalizedCartesianMes } template -unsigned long MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const +mcIdType MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const { return _mesh->getNumberOfCells(); } template -unsigned long MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const +mcIdType MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const { return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1; } diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx index 919ae7b34..d97062f5d 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.hxx @@ -22,6 +22,7 @@ #define __PARAMEDMEM_MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_HXX__ #include "NormalizedUnstructuredMesh.hxx" +#include "MCType.hxx" namespace MEDCoupling { @@ -34,26 +35,26 @@ class MEDCouplingNormalizedUnstructuredMesh public: static const int MY_SPACEDIM=SPACEDIM; static const int MY_MESHDIM=MESHDIM; - typedef int MyConnType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; public: MEDCouplingNormalizedUnstructuredMesh(const MEDCoupling::MEDCouplingPointSet *mesh); void getBoundingBox(double *boundingBox) const; - INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const; - int getNumberOfNodesOfElement(int eltId) const; - int getNumberOfElements() const; - int getNumberOfNodes() const; - const int *getConnectivityPtr() const; + INTERP_KERNEL::NormalizedCellType getTypeOfElement(mcIdType eltId) const; + mcIdType getNumberOfNodesOfElement(mcIdType eltId) const; + mcIdType getNumberOfElements() const; + mcIdType getNumberOfNodes() const; + const mcIdType *getConnectivityPtr() const; const double *getCoordinatesPtr() const; - const int *getConnectivityIndexPtr() const; + const mcIdType *getConnectivityIndexPtr() const; void releaseTempArrays(); ~MEDCouplingNormalizedUnstructuredMesh(); private: void prepare(); private: const MEDCoupling::MEDCouplingPointSet *_mesh; - int *_conn_for_interp; - int *_conn_index_for_interp; + mcIdType *_conn_for_interp; + mcIdType *_conn_index_for_interp; }; #endif diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 10d31c6a6..c9485e669 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -48,11 +48,11 @@ void MEDCouplingNormalizedUnstructuredMesh::getBoundingBox(dou } const MEDCoupling::DataArrayDouble *array=_mesh->getCoords(); const double *ptr=array->getConstPointer(); - int nbOfPts=array->getNbOfElems()/SPACEDIM; + mcIdType nbOfPts=ToIdType(array->getNbOfElems())/SPACEDIM; for(int j=0;j*work) boundingBox[j]=*work; @@ -63,31 +63,31 @@ void MEDCouplingNormalizedUnstructuredMesh::getBoundingBox(dou } template -INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh::getTypeOfElement(int eltId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingNormalizedUnstructuredMesh::getTypeOfElement(mcIdType eltId) const { return _mesh->getTypeOfCell(eltId); } template -int MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(int eltId) const +mcIdType MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodesOfElement(mcIdType eltId) const { return _mesh->getNumberOfNodesInCell(eltId); } template -int MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const +mcIdType MEDCouplingNormalizedUnstructuredMesh::getNumberOfElements() const { - return _mesh->getNumberOfCells(); + return ToIdType(_mesh->getNumberOfCells()); } template -int MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodes() const +mcIdType MEDCouplingNormalizedUnstructuredMesh::getNumberOfNodes() const { return _mesh->getNumberOfNodes(); } template -const int *MEDCouplingNormalizedUnstructuredMesh::getConnectivityPtr() const +const mcIdType *MEDCouplingNormalizedUnstructuredMesh::getConnectivityPtr() const { return _conn_for_interp; } @@ -100,7 +100,7 @@ const double *MEDCouplingNormalizedUnstructuredMesh::getCoordi } template -const int *MEDCouplingNormalizedUnstructuredMesh::getConnectivityIndexPtr() const +const mcIdType *MEDCouplingNormalizedUnstructuredMesh::getConnectivityIndexPtr() const { return _conn_index_for_interp; } @@ -129,18 +129,18 @@ void MEDCouplingNormalizedUnstructuredMesh::prepare() const MEDCoupling::MEDCouplingUMesh *m1(dynamic_cast(_mesh)); if(m1) { - int nbOfCell=m1->getNumberOfCells(); - int initialConnSize=m1->getNodalConnectivity()->getNbOfElems(); - _conn_for_interp=new int[initialConnSize-nbOfCell]; - _conn_index_for_interp=new int[nbOfCell+1]; + 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; - const int *work_conn=m1->getNodalConnectivity()->getConstPointer()+1; - const int *work_conn_index=m1->getNodalConnectivityIndex()->getConstPointer(); - int *work_conn_for_interp=_conn_for_interp; - int *work_conn_index_for_interp=_conn_index_for_interp; - for(int i=0;igetNodalConnectivity()->getConstPointer()+1; + const mcIdType *work_conn_index=m1->getNodalConnectivityIndex()->getConstPointer(); + mcIdType *work_conn_for_interp=_conn_for_interp; + mcIdType *work_conn_index_for_interp=_conn_index_for_interp; + for(mcIdType i=0;i::prepare() const MEDCoupling::MEDCoupling1DGTUMesh *m2(dynamic_cast(_mesh)); if(m2) { - int nbOfCell(m2->getNumberOfCells()); - _conn_index_for_interp=new int[nbOfCell+1]; - const int *conni(m2->getNodalConnectivityIndex()->begin()); + 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); - _conn_for_interp=new int[m2->getNodalConnectivity()->getNumberOfTuples()]; + _conn_for_interp=new mcIdType[m2->getNodalConnectivity()->getNumberOfTuples()]; std::copy(m2->getNodalConnectivity()->begin(),m2->getNodalConnectivity()->end(),_conn_for_interp); return ; } const MEDCoupling::MEDCoupling1SGTUMesh *m3(dynamic_cast(_mesh)); if(m3) { - int nbOfCell(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); - _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; - int *work(_conn_index_for_interp); - for(int i=0;igetNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); + _conn_index_for_interp=new mcIdType[nbOfCell+1]; _conn_index_for_interp[0]=0; + mcIdType *work(_conn_index_for_interp); + for(mcIdType i=0;igetNodalConnectivity()->getNumberOfTuples()]; + _conn_for_interp=new mcIdType[m3->getNodalConnectivity()->getNumberOfTuples()]; std::copy(m3->getNodalConnectivity()->begin(),m3->getNodalConnectivity()->end(),_conn_for_interp); return ; } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index ce270590a..80538490e 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -25,17 +25,17 @@ using namespace MEDCoupling; -PartDefinition *PartDefinition::New(int start, int stop, int step) +PartDefinition *PartDefinition::New(mcIdType start, mcIdType stop, mcIdType step) { return SlicePartDefinition::New(start,stop,step); } -PartDefinition *PartDefinition::New(DataArrayInt *listOfIds) +PartDefinition *PartDefinition::New(DataArrayIdType *listOfIds) { return DataArrayPartDefinition::New(listOfIds); } -PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { if(tinyInt.empty()) { @@ -57,7 +57,7 @@ PartDefinition::~PartDefinition() { } -DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayInt *listOfIds) +DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayIdType *listOfIds) { return new DataArrayPartDefinition(listOfIds); } @@ -75,7 +75,7 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !"; return false; } - const DataArrayInt *arr0(_arr),*arr1(otherC->_arr); + const DataArrayIdType *arr0(_arr),*arr1(otherC->_arr); if(!arr0 && !arr1) return true; if((arr0 && !arr1) || (!arr0 && arr1)) @@ -95,13 +95,13 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const { - const DataArrayInt *arr(_arr); + const DataArrayIdType *arr(_arr); if(!arr) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !"); - return DataArrayPartDefinition::New(const_cast(arr)); + return DataArrayPartDefinition::New(const_cast(arr)); } -int DataArrayPartDefinition::getNumberOfElems() const +mcIdType DataArrayPartDefinition::getNumberOfElems() const { checkInternalArrayOK(); return _arr->getNumberOfTuples(); @@ -124,7 +124,7 @@ PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) std::string DataArrayPartDefinition::getRepr() const { std::ostringstream oss; oss << "DataArray Part : "; - const DataArrayInt *arr(_arr); + const DataArrayIdType *arr(_arr); if(arr) arr->reprQuickOverview(oss); else @@ -145,19 +145,19 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other const SlicePartDefinition *spd(dynamic_cast(other)); if(spd) {//special case for optim - int a(0),b(0),c(0); + mcIdType a(0),b(0),c(0); spd->getSlice(a,b,c); if(c==1) { - MCAuto arr(DataArrayInt::New()); + MCAuto arr(DataArrayIdType::New()); arr->alloc(_arr->getNumberOfTuples(),1); - std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); + std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); return DataArrayPartDefinition::New(arr); } } // - MCAuto arr1(other->toDAI()); - MCAuto arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); + MCAuto arr1(other->toDAI()); + MCAuto arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); return DataArrayPartDefinition::New(arr2); } @@ -174,7 +174,7 @@ void DataArrayPartDefinition::checkConsistencyLight() const PartDefinition *DataArrayPartDefinition::tryToSimplify() const { checkConsistencyLight(); - int a(0),b(0),c(0); + mcIdType a(0),b(0),c(0); if(_arr->isRange(a,b,c)) { return SlicePartDefinition::New(a,b,c); @@ -187,21 +187,21 @@ 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); } -DataArrayInt *DataArrayPartDefinition::toDAI() const +DataArrayIdType *DataArrayPartDefinition::toDAI() const { checkInternalArrayOK(); - const DataArrayInt *arr(_arr); - DataArrayInt *arr2(const_cast(arr)); + const DataArrayIdType *arr(_arr); + DataArrayIdType *arr2(const_cast(arr)); arr2->incrRef(); return arr2; } -DataArrayPartDefinition::DataArrayPartDefinition(DataArrayInt *listOfIds) +DataArrayPartDefinition::DataArrayPartDefinition(DataArrayIdType *listOfIds) { CheckInternalArrayOK(listOfIds); _arr=listOfIds; @@ -213,7 +213,7 @@ void DataArrayPartDefinition::checkInternalArrayOK() const CheckInternalArrayOK(_arr); } -void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds) +void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayIdType *listOfIds) { if(!listOfIds || !listOfIds->isAllocated() || listOfIds->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::CheckInternalArrayOK : Input list must be not null allocated and with one components !"); @@ -221,7 +221,7 @@ void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds void DataArrayPartDefinition::updateTime() const { - if((const DataArrayInt *)_arr) + if((const DataArrayIdType *)_arr) updateTimeWith(*_arr); } @@ -232,22 +232,22 @@ std::size_t DataArrayPartDefinition::getHeapMemorySizeWithoutChildren() const std::vector DataArrayPartDefinition::getDirectChildrenWithNull() const { - std::vector ret(1,(const DataArrayInt *)_arr); + std::vector ret(1,(const DataArrayIdType *)_arr); return ret; } DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -256,7 +256,7 @@ DataArrayPartDefinition::~DataArrayPartDefinition() { } -SlicePartDefinition *SlicePartDefinition::New(int start, int stop, int step) +SlicePartDefinition *SlicePartDefinition::New(mcIdType start, mcIdType stop, mcIdType step) { return new SlicePartDefinition(start,stop,step); } @@ -288,12 +288,12 @@ SlicePartDefinition *SlicePartDefinition::deepCopy() const return SlicePartDefinition::New(_start,_stop,_step); } -DataArrayInt *SlicePartDefinition::toDAI() const +DataArrayIdType *SlicePartDefinition::toDAI() const { - return DataArrayInt::Range(_start,_stop,_step); + return DataArrayIdType::Range(_start,_stop,_step); } -int SlicePartDefinition::getNumberOfElems() const +mcIdType SlicePartDefinition::getNumberOfElems() const { return DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getNumberOfElems"); } @@ -322,8 +322,8 @@ PartDefinition *SlicePartDefinition::composeWith(const PartDefinition *other) co throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !"); checkConsistencyLight(); other->checkConsistencyLight(); - MCAuto arr(other->toDAI()); - MCAuto arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step)); + MCAuto arr(other->toDAI()); + MCAuto arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step)); return DataArrayPartDefinition::New(arr1); } @@ -346,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); @@ -360,20 +360,20 @@ std::string SlicePartDefinition::getRepr() const return oss.str(); } -int SlicePartDefinition::getEffectiveStop() const +mcIdType SlicePartDefinition::getEffectiveStop() const { - int nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); + mcIdType nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); return _start+nbElems*_step; } -void SlicePartDefinition::getSlice(int& start, int& stop, int& step) const +void SlicePartDefinition::getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const { start=_start; stop=_stop; step=_step; } -SlicePartDefinition::SlicePartDefinition(int start, int stop, int step):_start(start),_stop(stop),_step(step) +SlicePartDefinition::SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step):_start(start),_stop(stop),_step(step) { } @@ -396,8 +396,8 @@ std::vector SlicePartDefinition::getDirectChildrenWithN DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -410,8 +410,8 @@ PartDefinition *SlicePartDefinition::add2(const SlicePartDefinition *other) cons } else { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.hxx b/src/MEDCoupling/MEDCouplingPartDefinition.hxx index c675c8146..bb32ef9fa 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.hxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.hxx @@ -30,19 +30,19 @@ namespace MEDCoupling class PartDefinition : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT static PartDefinition *New(int start, int stop, int step); - MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayInt *listOfIds); - MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + MEDCOUPLING_EXPORT static PartDefinition *New(mcIdType start, mcIdType stop, mcIdType step); + MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayIdType *listOfIds); + MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); MEDCOUPLING_EXPORT virtual bool isEqual(const PartDefinition *other, std::string& what) const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *deepCopy() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *toDAI() const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfElems() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *toDAI() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfElems() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *operator+(const PartDefinition& other) const = 0; MEDCOUPLING_EXPORT virtual std::string getRepr() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *composeWith(const PartDefinition *other) const = 0; MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0; - MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; + MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; protected: virtual ~PartDefinition(); }; @@ -52,21 +52,21 @@ namespace MEDCoupling class DataArrayPartDefinition : public PartDefinition { public: - MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayInt *listOfIds); + MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const; - MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; - MEDCOUPLING_EXPORT int getNumberOfElems() 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; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; private: - DataArrayPartDefinition(DataArrayInt *listOfIds); + DataArrayPartDefinition(DataArrayIdType *listOfIds); void checkInternalArrayOK() const; - static void CheckInternalArrayOK(const DataArrayInt *listOfIds); + static void CheckInternalArrayOK(const DataArrayIdType *listOfIds); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -80,22 +80,22 @@ namespace MEDCoupling class SlicePartDefinition : public PartDefinition { public: - MEDCOUPLING_EXPORT static SlicePartDefinition *New(int start, int stop, int step); + MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const; - MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; - MEDCOUPLING_EXPORT int getNumberOfElems() 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; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; //specific method - MEDCOUPLING_EXPORT int getEffectiveStop() const; - MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const; + MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const; + MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const; private: - SlicePartDefinition(int start, int stop, int step); + SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx old mode 100644 new mode 100755 index c9c384d78..007621fb2 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -52,7 +52,7 @@ MEDCouplingPointSet::~MEDCouplingPointSet() _coords->decrRef(); } -int MEDCouplingPointSet::getNumberOfNodes() const +mcIdType MEDCouplingPointSet::getNumberOfNodes() const { if(_coords) return _coords->getNumberOfTuples(); @@ -63,7 +63,7 @@ int MEDCouplingPointSet::getNumberOfNodes() const int MEDCouplingPointSet::getSpaceDimension() const { if(_coords) - return _coords->getNumberOfComponents(); + return (int)_coords->getNumberOfComponents(); else throw INTERP_KERNEL::Exception("Unable to get space dimension because no coordinates specified !"); } @@ -228,15 +228,15 @@ bool MEDCouplingPointSet::areCoordsEqualWithoutConsideringStr(const MEDCouplingP * \ref py_mcpointset_getcoordinatesofnode "Here is a Python example". * \endif */ -void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector& coo) const +void MEDCouplingPointSet::getCoordinatesOfNode(mcIdType nodeId, std::vector& coo) const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCoordinatesOfNode : no coordinates array set !"); - int nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); if(nodeId>=0 && nodeIdgetConstPointer(); - int spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); coo.insert(coo.end(),cooPtr+spaceDim*nodeId,cooPtr+spaceDim*(nodeId+1)); } else @@ -256,17 +256,17 @@ void MEDCouplingPointSet::getCoordinatesOfNode(int nodeId, std::vector& * returned. Put -1 to this parameter to have all nodes returned. * \param [out] areNodesMerged - is set to \a true if any coincident nodes found. * \param [out] newNbOfNodes - returns number of unique nodes. - * \return DataArrayInt * - the permutation array in "Old to New" mode. For more + * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more * info on "Old to New" mode see \ref numbering. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. */ -DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const +DataArrayIdType *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, mcIdType limitNodeId, bool& areNodesMerged, mcIdType& newNbOfNodes) const { - DataArrayInt *comm,*commI; + DataArrayIdType *comm,*commI; findCommonNodes(precision,limitNodeId,comm,commI); - int oldNbOfNodes=getNumberOfNodes(); - MCAuto ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); + mcIdType oldNbOfNodes=getNumberOfNodes(); + MCAuto ret=buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); areNodesMerged=(oldNbOfNodes!=newNbOfNodes); comm->decrRef(); commI->decrRef(); @@ -299,7 +299,7 @@ DataArrayInt *MEDCouplingPointSet::buildPermArrayForMergeNode(double precision, * \ref py_mcpointset_findcommonnodes "Here is a Python example". * \endif */ -void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const +void MEDCouplingPointSet::findCommonNodes(double prec, mcIdType limitNodeId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findCommonNodes : no coords specified !"); @@ -313,7 +313,7 @@ void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArra * behavior is not warranted. * \param [in] eps - the lowest distance between a point and a node (using infinite norm) at which the node is * not returned by this method. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of nodes + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of nodes * close to the point. The caller is to delete this * array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -323,11 +323,11 @@ void MEDCouplingPointSet::findCommonNodes(double prec, int limitNodeId, DataArra * \ref py_mcpointset_getnodeidsnearpoint "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const +DataArrayIdType *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double eps) const { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; getNodeIdsNearPoints(pos,1,eps,c,cI); - MCAuto cITmp(cI); + MCAuto cITmp(cI); return c; } @@ -358,11 +358,11 @@ DataArrayInt *MEDCouplingPointSet::getNodeIdsNearPoint(const double *pos, double * \ref py_mcpointset_getnodeidsnearpoints "Here is a Python example". * \endif */ -void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const +void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, mcIdType nbOfPoints, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getNodeIdsNearPoint : no coordiantes set !"); - int 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); @@ -373,12 +373,12 @@ void MEDCouplingPointSet::getNodeIdsNearPoints(const double *pos, int nbOfPoints * @param commI in param in the same format than one returned by findCommonNodes method (\ref numbering-indirect). * @return the old to new correspondence array. */ -DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex, - int& newNbOfNodes) const +DataArrayIdType *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex, + mcIdType& newNbOfNodes) const { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat : no coords specified !"); - return DataArrayInt::ConvertIndexArrayToO2N(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes); + return DataArrayIdType::ConvertIndexArrayToO2N(getNumberOfNodes(),comm->begin(),commIndex->begin(),commIndex->end(),newNbOfNodes); } /*! @@ -398,7 +398,7 @@ DataArrayInt *MEDCouplingPointSet::buildNewNumberingFromCommonNodesFormat(const * \ref py_mcumesh_renumberNodes "Here is a Python example". * \endif */ -void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNodes) +void MEDCouplingPointSet::renumberNodes(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes) { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::renumberNodes : no coords specified !"); @@ -426,24 +426,24 @@ void MEDCouplingPointSet::renumberNodes(const int *newNodeNumbers, int newNbOfNo * \ref py_mcumesh_renumberNodes "Here is a Python example". * \endif */ -void MEDCouplingPointSet::renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes) +void MEDCouplingPointSet::renumberNodesCenter(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes) { DataArrayDouble *newCoords=DataArrayDouble::New(); - std::vector div(newNbOfNodes); - int spaceDim=getSpaceDimension(); + std::vector div(newNbOfNodes); + std::size_t spaceDim=getSpaceDimension(); newCoords->alloc(newNbOfNodes,spaceDim); newCoords->copyStringInfoFrom(*_coords); newCoords->fillWithZero(); - int oldNbOfNodes=getNumberOfNodes(); + mcIdType oldNbOfNodes=getNumberOfNodes(); double *ptToFill=newCoords->getPointer(); const double *oldCoordsPtr=_coords->getConstPointer(); - for(int i=0;i()); div[newNodeNumbers[i]]++; } - for(int i=0;i(),1./(double)div[i])); setCoords(newCoords); newCoords->decrRef(); @@ -480,7 +480,7 @@ void MEDCouplingPointSet::getBoundingBox(double *bbox) const void MEDCouplingPointSet::zipCoords() { checkFullyDefined(); - DataArrayInt *traducer=zipCoordsTraducer(); + DataArrayIdType *traducer=zipCoordsTraducer(); traducer->decrRef(); } @@ -501,7 +501,7 @@ double MEDCouplingPointSet::getCaracteristicDimension() const if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::getCaracteristicDimension : Coordinates not set !"); const double *coords=_coords->getConstPointer(); - int nbOfValues=_coords->getNbOfElems(); + std::size_t nbOfValues=_coords->getNbOfElems(); return std::abs(*std::max_element(coords,coords+nbOfValues,MEDCouplingCompAbs())); } @@ -543,7 +543,7 @@ void MEDCouplingPointSet::recenterForMaxPrecision(double eps) */ void MEDCouplingPointSet::rotate(const double *center, const double *vector, double angle) { - int spaceDim=getSpaceDimension(); + std::size_t spaceDim=getSpaceDimension(); if(spaceDim==3) rotate3D(center,vector,angle); else if(spaceDim==2) @@ -573,10 +573,10 @@ void MEDCouplingPointSet::translate(const double *vector) if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::translate : no coordinates set !"); double *coords=_coords->getPointer(); - int nbNodes=getNumberOfNodes(); - int dim=getSpaceDimension(); - for(int i=0; ideclareAsNew(); updateTime(); @@ -603,9 +603,9 @@ void MEDCouplingPointSet::scale(const double *point, double factor) if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::scale : no coordinates set !"); double *coords=_coords->getPointer(); - int nbNodes=getNumberOfNodes(); - int dim=getSpaceDimension(); - for(int i=0;i()); std::transform(coords+i*dim,coords+(i+1)*dim,coords+i*dim,std::bind2nd(std::multiplies(),factor)); @@ -671,7 +671,7 @@ void MEDCouplingPointSet::tryToShareSameCoords(const MEDCouplingPointSet& other, * \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only * \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only */ -void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) +void MEDCouplingPointSet::duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd) { if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : no coords set !"); @@ -695,7 +695,7 @@ void MEDCouplingPointSet::duplicateNodesInCoords(const int *nodeIdsToDuplicateBg * \throw If the magnitude of \a vec is zero. * \throw If \a this->getSpaceDimension() != 3. */ -void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const +void MEDCouplingPointSet::findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const { if(getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::findNodesOnPlane : Invalid spacedim to be applied on this ! Must be equal to 3 !"); @@ -703,13 +703,13 @@ 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 !"); - int 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 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(); - for(int i=0;igetSpaceDimension() != 3 && \a this->getSpaceDimension() != 2 ). */ -void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const +void MEDCouplingPointSet::findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const { - int 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 !"); - int nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); double den=0.; - for(int i=0;i vecn=new double[spaceDim]; - for(int i=0;igetConstPointer(); if(spaceDim==2) { - for(int i=0;i& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingPointSet::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { int it,order; double time=getTime(it,order); @@ -894,7 +894,7 @@ void MEDCouplingPointSet::getTinySerializationInformation(std::vector& t /*! * Third and final step of serialization process. */ -void MEDCouplingPointSet::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCouplingPointSet::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { if(_coords) { @@ -909,7 +909,7 @@ void MEDCouplingPointSet::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) con * Second step of serialization process. * @param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *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) { @@ -926,7 +926,7 @@ void MEDCouplingPointSet::resizeForUnserialization(const std::vector& tinyI * 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 DataArrayInt *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) { @@ -935,16 +935,16 @@ void MEDCouplingPointSet::unserialization(const std::vector& tinyInfoD, setDescription(littleStrings[1]); a2->setName(littleStrings[2]); setTimeUnit(littleStrings[3]); - for(int i=0;isetInfoOnComponent(i,littleStrings[i+4]); - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } else { setName(littleStrings[0]); setDescription(littleStrings[1]); setTimeUnit(littleStrings[2]); - setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]); + setTime(tinyInfoD[0],FromIdType(tinyInfo[3]),FromIdType(tinyInfo[4])); } } @@ -1023,7 +1023,7 @@ bool MEDCouplingPointSet::intersectsBoundingBox(const INTERP_KERNEL::DirectedBou void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, double angle) { double *coords(_coords->getPointer()); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); DataArrayDouble::Rotate3DAlg(center,vect,angle,nbNodes,coords,coords); } @@ -1034,11 +1034,11 @@ void MEDCouplingPointSet::rotate3D(const double *center, const double *vect, dou * \param [in] srcMesh - source mesh * \param [in] trgMesh - target mesh * \param [in] eps - precision of the detection - * \return DataArrayInt * - An array that gives for each cell of \a trgMesh, how many cells in \a srcMesh (regarding the precision of detection \a eps) can interacts. + * \return DataArrayIdType * - An array that gives for each cell of \a trgMesh, how many cells in \a srcMesh (regarding the precision of detection \a eps) can interacts. * * \throw If \a srcMesh and \a trgMesh have not the same space dimension. */ -DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) +DataArrayIdType *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps) { if(!srcMesh || !trgMesh) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells : the input meshes must be not NULL !"); @@ -1056,7 +1056,7 @@ DataArrayInt *MEDCouplingPointSet::ComputeNbOfInteractionsWithSrcCells(const MED * \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to * delete this mesh using decrRef() as it is no more needed. */ -MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end) const +MEDCouplingMesh *MEDCouplingPointSet::buildPart(const mcIdType *start, const mcIdType *end) const { return buildPartOfMySelf(start,end,true); } @@ -1069,12 +1069,12 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPart(const int *start, const int *end * \param [in] start - an array of cell ids to include to the result mesh. * \param [in] end - specifies the end of the array \a start, so that * the last value of \a start is \a end[ -1 ]. - * \param [out] arr - a new DataArrayInt that is the "Old to New" renumbering + * \param [out] arr - a new DataArrayIdType that is the "Old to New" renumbering * map. The caller is to delete this array using decrRef() as it is no more needed. * \return MEDCouplingMesh * - a new instance of MEDCouplingMesh. The caller is to * delete this mesh using decrRef() as it is no more needed. */ -MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const +MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const { MCAuto ret=buildPartOfMySelf(start,end,true); arr=ret->zipCoordsTraducer(); @@ -1092,9 +1092,9 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartAndReduceNodes(const int *start, * * \sa MEDCouplingUMesh::buildPartOfMySelfSlice */ -MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const +MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { - if(beginCellIds==0 && endCellIds==getNumberOfCells() && stepCellIds==1) + if(beginCellIds==0 && endCellIds==ToIdType(getNumberOfCells()) && stepCellIds==1) { MEDCouplingMesh *ret(const_cast(this)); ret->incrRef(); @@ -1116,7 +1116,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRange(int beginCellIds, int endCe * * \sa MEDCouplingUMesh::buildPartOfMySelfSlice */ -MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& 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(); @@ -1129,7 +1129,7 @@ MEDCouplingMesh *MEDCouplingPointSet::buildPartRangeAndReduceNodes(int beginCell void MEDCouplingPointSet::rotate2D(const double *center, double angle) { double *coords(_coords->getPointer()); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); DataArrayDouble::Rotate2DAlg(center,angle,nbNodes,coords,coords); } @@ -1140,7 +1140,7 @@ class DummyClsMCPS public: static const int MY_SPACEDIM=3; static const int MY_MESHDIM=2; - typedef int MyConnType; + typedef mcIdType MyConnType; static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; }; @@ -1152,21 +1152,21 @@ public: * If spaceDim==3 a projection will be done for each nodes on the middle plane containing these all nodes in [startConn;endConn). * And after each projected nodes are moved to Oxy plane in order to consider these nodes as 2D nodes. */ -void MEDCouplingPointSet::project2DCellOnXY(const int *startConn, const int *endConn, std::vector& res) const +void MEDCouplingPointSet::project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector& res) const { const double *coords(_coords->getConstPointer()); - int spaceDim(getSpaceDimension()); - for(const int *it=startConn;it!=endConn;it++) + 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) return ; if(spaceDim==3) { std::vector cpy(res); - int nbNodes=(int)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); + 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(int i=0;i& res, bool * This method compares 2 cells coming from two unstructured meshes : \a this and \a other. * This method compares 2 cells having the same id 'cellId' in \a this and \a other. */ -bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const +bool MEDCouplingPointSet::areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const { if(getTypeOfCell(cellId)!=other->getTypeOfCell(cellId)) return false; - std::vector c1,c2; + std::vector c1,c2; getNodeIdsOfCell(cellId,c1); other->getNodeIdsOfCell(cellId,c2); std::size_t sz(c1.size()); @@ -1249,21 +1249,21 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in other !"); if(!_coords) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute : No coords specified in this whereas there is any in other !"); - int otherNbOfNodes=other.getNumberOfNodes(); + mcIdType otherNbOfNodes=other.getNumberOfNodes(); MCAuto newCoords=MergeNodesArray(&other,this); _coords->incrRef(); MCAuto oldCoords=_coords; setCoords(newCoords); bool areNodesMerged; - int newNbOfNodes; - MCAuto da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes); + mcIdType newNbOfNodes; + MCAuto da=buildPermArrayForMergeNode(epsilon,otherNbOfNodes,areNodesMerged,newNbOfNodes); if(!areNodesMerged) { setCoords(oldCoords); throw INTERP_KERNEL::Exception("MEDCouplingPointSet::tryToShareSameCoordsPermute fails : no nodes are mergeable with specified given epsilon !"); } - int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes); - const int *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); + mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+otherNbOfNodes); + const mcIdType *pt=std::find_if(da->getConstPointer()+otherNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { setCoords(oldCoords); @@ -1274,7 +1274,7 @@ void MEDCouplingPointSet::tryToShareSameCoordsPermute(const MEDCouplingPointSet& setCoords(coords); } -MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const +MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords) const { MCAuto ret=buildPartOfMySelfKeepCoords(begin,end); if(!keepCoords) @@ -1282,7 +1282,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelf(const int *begin, co return ret.retn(); } -MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const +MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords) const { MCAuto ret=buildPartOfMySelfKeepCoordsSlice(start,end,step); if(!keepCoords) @@ -1313,11 +1313,11 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfSlice(int start, int * \ref py_mcumesh_buildPartOfMySelfNode "Here is a Python example". * \endif */ -MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const +MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const { - DataArrayInt *cellIdsKept=0; + DataArrayIdType *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); - MCAuto cellIdsKept2(cellIdsKept); + MCAuto cellIdsKept2(cellIdsKept); return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true); } @@ -1340,7 +1340,7 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin * \param [in] startCellId - specifies the cell id at which search for equal cells * starts. By default it is 0, which means that all cells in \a this will be * scanned. - * \return DataArrayInt - a new instance of DataArrayInt, of length \a + * \return DataArrayIdType - a new instance of DataArrayIdType, of length \a * this->getNumberOfCells() before call of this method. The caller is to * delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -1352,15 +1352,15 @@ MEDCouplingPointSet *MEDCouplingPointSet::buildPartOfMySelfNode(const int *begin * \ref py_mcumesh_zipConnectivityTraducer "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int startCellId) +DataArrayIdType *MEDCouplingPointSet::zipConnectivityTraducer(int compType, mcIdType startCellId) { - DataArrayInt *commonCells=0,*commonCellsI=0; + DataArrayIdType *commonCells=0,*commonCellsI=0; findCommonCells(compType,startCellId,commonCells,commonCellsI); - MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - int newNbOfCells=-1; - MCAuto ret=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(), + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + mcIdType newNbOfCells=-1; + MCAuto ret=DataArrayIdType::ConvertIndexArrayToO2N(ToIdType(getNumberOfCells()),commonCells->begin(),commonCellsI->begin(), commonCellsI->end(),newNbOfCells); - MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); + MCAuto ret2=ret->invertArrayO2N2N2O(newNbOfCells); MCAuto self=buildPartOfMySelf(ret2->begin(),ret2->end(),true); shallowCopyConnectivityFrom(self); return ret.retn(); @@ -1374,7 +1374,7 @@ DataArrayInt *MEDCouplingPointSet::zipConnectivityTraducer(int compType, int sta bool MEDCouplingPointSet::areAllNodesFetched() const { checkFullyDefined(); - int nbNodes(getNumberOfNodes()); + mcIdType nbNodes(getNumberOfNodes()); std::vector fetchedNodes(nbNodes,false); computeNodeIdsAlg(fetchedNodes); return std::find(fetchedNodes.begin(),fetchedNodes.end(),false)==fetchedNodes.end(); @@ -1411,7 +1411,7 @@ bool MEDCouplingPointSet::areAllNodesFetched() const * \endif */ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : input is null !"); @@ -1420,28 +1420,28 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalWith : other is not a PointSet mesh !"); MCAuto m=dynamic_cast(mergeMyselfWith(otherC)); bool areNodesMerged; - int newNbOfNodes; - int oldNbOfNodes=getNumberOfNodes(); - MCAuto da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); + mcIdType newNbOfNodes; + mcIdType oldNbOfNodes=getNumberOfNodes(); + MCAuto da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); //mergeNodes if(!areNodesMerged && oldNbOfNodes != 0) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! "); - const int *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),oldNbOfNodes-1)); + const mcIdType *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),oldNbOfNodes-1)); if(pt!=da->getConstPointer()+da->getNbOfElems()) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !"); m->renumberNodes(da->getConstPointer(),newNbOfNodes); // - MCAuto nodeCor2=da->subArray(oldNbOfNodes); + MCAuto nodeCor2=da->subArray(oldNbOfNodes); da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); - int nbCells=getNumberOfCells(); - if (nbCells != other->getNumberOfCells()) + mcIdType nbCells=ToIdType(getNumberOfCells()); + if (nbCells != ToIdType(other->getNumberOfCells())) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); - int dan(da->getNumberOfTuples()); + mcIdType dan(da->getNumberOfTuples()); if (dan) { - MCAuto da1(DataArrayInt::New()),da2(DataArrayInt::New()); + MCAuto da1(DataArrayIdType::New()),da2(DataArrayIdType::New()); da1->alloc(dan/2,1); da2->alloc(dan/2,1); std::copy(da->getConstPointer(), da->getConstPointer()+dan/2, da1->getPointer()); std::copy(da->getConstPointer()+dan/2, da->getConstPointer()+dan, da2->getPointer()); @@ -1449,7 +1449,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int if (!da1->isEqualWithoutConsideringStr(*da2)) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,da->getNbOfElems(),1); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(nbCells,ToIdType(da->getNbOfElems()),1); nodeCor=nodeCor2->isIota(nodeCor2->getNumberOfTuples())?0:nodeCor2.retn(); cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } @@ -1477,7 +1477,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int * \endif */ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const + DataArrayIdType *&cellCor) const { if(!other) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith : input is null !"); @@ -1487,14 +1487,14 @@ void MEDCouplingPointSet::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh 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); - int maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); - const int *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); + MCAuto da=m->zipConnectivityTraducer(cellCompPol); + mcIdType maxId=*std::max_element(da->getConstPointer(),da->getConstPointer()+getNumberOfCells()); + const mcIdType *pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),maxId)); if(pt!=da->getConstPointer()+da->getNbOfElems()) { throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !"); } - MCAuto cellCor2=da->selectByTupleIdSafeSlice(getNumberOfCells(),da->getNbOfElems(),1); + MCAuto cellCor2=da->selectByTupleIdSafeSlice(ToIdType(getNumberOfCells()),ToIdType(da->getNbOfElems()),1); cellCor=cellCor2->isIota(cellCor2->getNumberOfTuples())?0:cellCor2.retn(); } @@ -1505,7 +1505,7 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou const MEDCouplingPointSet *otherC=dynamic_cast(other); if(!otherC) throw INTERP_KERNEL::Exception("MEDCouplingPointSet::checkFastEquivalWith : fails because other is not a pointset mesh !"); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); if(nbOfCells<1) return ; bool status=true; @@ -1523,7 +1523,7 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou * \param [in] fullyIn - if \c true, then cells whose all nodes are in the * array \a begin are returned only, else cells whose any node is in the * array \a begin are returned. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found * cells. The caller is to delete this array using decrRef() as it is no more * needed. * \throw If the coordinates array is not set. @@ -1537,9 +1537,9 @@ void MEDCouplingPointSet::checkFastEquivalWith(const MEDCouplingMesh *other, dou * \ref py_mcumesh_getCellIdsLyingOnNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const +DataArrayIdType *MEDCouplingPointSet::getCellIdsLyingOnNodes(const mcIdType *begin, const mcIdType *end, bool fullyIn) const { - DataArrayInt *cellIdsKept=0; + DataArrayIdType *cellIdsKept=0; fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept); cellIdsKept->setName(getName()); return cellIdsKept; @@ -1551,7 +1551,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons * as last input argument). * \param [in] partBg - the array of node ids. * \param [in] partEnd - a pointer to a (last+1)-th element of \a partBg. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found * cells. The caller is to delete this array using decrRef() as it is no * more needed. * \throw If the coordinates array is not set. @@ -1565,7 +1565,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons * \ref py_mcumesh_getCellIdsFullyIncludedInNodeIds "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const +DataArrayIdType *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const mcIdType *partBg, const mcIdType *partEnd) const { return getCellIdsLyingOnNodes(partBg,partEnd,true); } @@ -1574,7 +1574,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p * Removes unused nodes (the node coordinates array is shorten) and returns an array * mapping between new and old node ids in "Old to New" mode. -1 values in the returned * array mean that the corresponding old node is no more used. - * \return DataArrayInt * - a new instance of DataArrayInt of length \a + * \return DataArrayIdType * - a new instance of DataArrayIdType of length \a * this->getNumberOfNodes() before call of this method. The caller is to * delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -1586,10 +1586,10 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsFullyIncludedInNodeIds(const int *p * \ref py_mcumesh_zipCoordsTraducer "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() +DataArrayIdType *MEDCouplingPointSet::zipCoordsTraducer() { - int newNbOfNodes=-1; - MCAuto traducer=getNodeIdsInUse(newNbOfNodes); + mcIdType newNbOfNodes=-1; + MCAuto traducer=getNodeIdsInUse(newNbOfNodes); renumberNodes(traducer->getConstPointer(),newNbOfNodes); return traducer.retn(); } @@ -1601,7 +1601,7 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() * considered not coincident. * \param [out] areNodesMerged - is set to \c true if any coincident nodes removed. * \param [out] newNbOfNodes - number of nodes remaining after the removal. - * \return DataArrayInt * - the permutation array in "Old to New" mode. For more + * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more * info on "Old to New" mode see \ref numbering. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -1612,9 +1612,9 @@ DataArrayInt *MEDCouplingPointSet::zipCoordsTraducer() * \ref py_mcumesh_mergeNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes) +DataArrayIdType *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes) { - MCAuto ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); + MCAuto ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); if(areNodesMerged) renumberNodes(ret->begin(),newNbOfNodes); return ret.retn(); @@ -1628,7 +1628,7 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe * considered not coincident. * \param [out] areNodesMerged - is set to \c true if any coincident nodes removed. * \param [out] newNbOfNodes - number of nodes remaining after the removal. - * \return DataArrayInt * - the permutation array in "Old to New" mode. For more + * \return DataArrayIdType * - the permutation array in "Old to New" mode. For more * info on "Old to New" mode see \ref numbering. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -1639,9 +1639,9 @@ DataArrayInt *MEDCouplingPointSet::mergeNodes(double precision, bool& areNodesMe * \ref py_mcumesh_mergeNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingPointSet::mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes) +DataArrayIdType *MEDCouplingPointSet::mergeNodesCenter(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes) { - DataArrayInt *ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); + DataArrayIdType *ret=buildPermArrayForMergeNode(precision,-1,areNodesMerged,newNbOfNodes); if(areNodesMerged) renumberNodesCenter(ret->getConstPointer(),newNbOfNodes); return ret; diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index 7d7d38e63..d76dc55c6 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -35,7 +35,7 @@ namespace INTERP_KERNEL namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; class DataArrayDouble; /*! @@ -56,7 +56,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; - MEDCOUPLING_EXPORT int getNumberOfNodes() 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; } @@ -68,26 +68,26 @@ namespace MEDCoupling 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, - DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; + DataArrayIdType *&cellCor, DataArrayIdType *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, - DataArrayInt *&cellCor) const; + 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; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const = 0; MEDCOUPLING_EXPORT virtual void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other) = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); - MEDCOUPLING_EXPORT virtual DataArrayInt *mergeNodesCenter(double precision, bool& areNodesMerged, int& newNbOfNodes); + MEDCOUPLING_EXPORT virtual DataArrayIdType *mergeNodes(double precision, bool& areNodesMerged, mcIdType& newNbOfNodes); + 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(int nodeId, std::vector& coo) const; - MEDCOUPLING_EXPORT DataArrayInt *buildPermArrayForMergeNode(double precision, int limitNodeId, bool& areNodesMerged, int& newNbOfNodes) const; - MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsNearPoint(const double *pos, double eps) const; - MEDCOUPLING_EXPORT void getNodeIdsNearPoints(const double *pos, int nbOfPoints, double eps, DataArrayInt *& c, DataArrayInt *& cI) const; - MEDCOUPLING_EXPORT void findCommonNodes(double prec, int limitNodeId, DataArrayInt *&comm, DataArrayInt *&commIndex) const; - MEDCOUPLING_EXPORT virtual void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const = 0; - MEDCOUPLING_EXPORT DataArrayInt *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex, - int& newNbOfNodes) const; + 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; + MEDCOUPLING_EXPORT void findCommonNodes(double prec, mcIdType limitNodeId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const; + 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; MEDCOUPLING_EXPORT void zipCoords(); MEDCOUPLING_EXPORT double getCaracteristicDimension() const; @@ -97,63 +97,63 @@ namespace MEDCoupling 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 int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd); + MEDCOUPLING_EXPORT void duplicateNodesInCoords(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd); MEDCOUPLING_EXPORT virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon); - MEDCOUPLING_EXPORT void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const; - MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const; + MEDCOUPLING_EXPORT void findNodesOnPlane(const double *pt, const double *vec, double eps, std::vector& nodes) const; + MEDCOUPLING_EXPORT void findNodesOnLine(const double *pt, const double *vec, double eps, std::vector& nodes) const; MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); MEDCOUPLING_EXPORT static DataArrayDouble *MergeNodesArray(const std::vector& ms); MEDCOUPLING_EXPORT static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type); - MEDCOUPLING_EXPORT static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const; - MEDCOUPLING_EXPORT DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords=true) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const = 0; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const; - MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *findBoundaryNodes() const = 0; + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); + 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; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const = 0; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildPartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const; + MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const mcIdType *start, const mcIdType *end, bool fullyIn) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *findBoundaryNodes() const = 0; MEDCOUPLING_EXPORT virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfNodesInCell(int cellId) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *computeFetchedNodeIds() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const = 0; - MEDCOUPLING_EXPORT virtual void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const = 0; - MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const int *newNodeNumbersO2N) = 0; - MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) = 0; - MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map& newNodeNumbersO2N) = 0; - MEDCOUPLING_EXPORT virtual void renumberNodesWithOffsetInConn(int offset) = 0; - MEDCOUPLING_EXPORT virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); - MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const int *newNodeNumbers, int newNbOfNodes); - MEDCOUPLING_EXPORT virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfNodesInCell(mcIdType cellId) const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *computeFetchedNodeIds() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const = 0; + MEDCOUPLING_EXPORT virtual void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const = 0; + MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const mcIdType *newNodeNumbersO2N) = 0; + MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) = 0; + MEDCOUPLING_EXPORT virtual void renumberNodesInConn(const std::map& newNodeNumbersO2N) = 0; + MEDCOUPLING_EXPORT virtual void renumberNodesWithOffsetInConn(mcIdType offset) = 0; + MEDCOUPLING_EXPORT virtual void renumberNodes(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes); + MEDCOUPLING_EXPORT virtual void renumberNodesCenter(const mcIdType *newNodeNumbers, mcIdType newNbOfNodes); + 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; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, + 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); MEDCOUPLING_EXPORT virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 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; MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *computeDiameterField() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *zipCoordsTraducer(); - MEDCOUPLING_EXPORT virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0); + MEDCOUPLING_EXPORT virtual DataArrayIdType *zipCoordsTraducer(); + MEDCOUPLING_EXPORT virtual DataArrayIdType *zipConnectivityTraducer(int compType, mcIdType startCellId=0); MEDCOUPLING_EXPORT virtual bool areAllNodesFetched() const; //tools public: - MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const; + MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, mcIdType cellId, double prec) const; protected: 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); MEDCOUPLING_EXPORT void rotate3D(const double *center, const double *vect, double angle); - MEDCOUPLING_EXPORT void project2DCellOnXY(const int *startConn, const int *endConn, std::vector& res) const; + MEDCOUPLING_EXPORT void project2DCellOnXY(const mcIdType *startConn, const mcIdType *endConn, std::vector& res) const; MEDCOUPLING_EXPORT static bool isButterfly2DCell(const std::vector& res, bool isQuad, double eps); protected: DataArrayDouble *_coords; diff --git a/src/MEDCoupling/MEDCouplingRemapper.cxx b/src/MEDCoupling/MEDCouplingRemapper.cxx old mode 100644 new mode 100755 index 5b4d4cc9a..bc18d38fe --- a/src/MEDCoupling/MEDCouplingRemapper.cxx +++ b/src/MEDCoupling/MEDCouplingRemapper.cxx @@ -94,17 +94,17 @@ int MEDCouplingRemapper::prepareEx(const MEDCouplingFieldTemplate *src, const ME return prepareNotInterpKernelOnly(); } -void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m) +void MEDCouplingRemapper::setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m) { MCAuto src,target; BuildFieldTemplatesFrom(srcMesh,targetMesh,method,src,target); setCrudeMatrixEx(src,target,m); } -void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m) +void MEDCouplingRemapper::setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m) { restartUsing(src,target); - if(m.size()!=target->getNumberOfTuplesExpected()) + if(ToIdType(m.size())!=target->getNumberOfTuplesExpected()) { std::ostringstream oss; oss << "MEDCouplingRemapper::setMatrixEx : input matrix has " << m.size() << " rows whereas there are " << target->getNumberOfTuplesExpected() << " expected !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -245,11 +245,11 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(srcField->getArray()); - int trgNbOfCompo=targetField->getNumberOfComponents(); + std::size_t trgNbOfCompo=targetField->getNumberOfComponents(); if(array) { srcField->checkConsistencyLight(); - if(trgNbOfCompo!=srcField->getNumberOfTuplesExpected()) + if(ToIdType(trgNbOfCompo)!=srcField->getNumberOfTuplesExpected()) throw INTERP_KERNEL::Exception("Number of components mismatch !"); } else @@ -261,7 +261,7 @@ void MEDCouplingRemapper::reverseTransfer(MEDCouplingFieldDouble *srcField, cons computeDeno(srcField->getNature(),srcField,targetField); double *resPointer(srcField->getArray()->getPointer()); const double *inputPointer=targetField->getArray()->getConstPointer(); - computeReverseProduct(inputPointer,trgNbOfCompo,dftValue,resPointer); + computeReverseProduct(inputPointer,(int)trgNbOfCompo,dftValue,resPointer); } /*! @@ -419,7 +419,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() if(trgSpaceDim!=srcSpaceDim) if(trgSpaceDim!=-1 && srcSpaceDim!=-1) throw INTERP_KERNEL::Exception("Incoherent space dimension detected between target and source."); - int nbCols; + mcIdType nbCols; if(srcMeshDim==1 && trgMeshDim==1 && srcSpaceDim==1) { MEDCouplingNormalizedUnstructuredMesh<1,1> source_mesh_wrapper(src_mesh); @@ -480,11 +480,11 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation3D1D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); } else if(srcMeshDim==2 && trgMeshDim==1 && srcSpaceDim==2) { @@ -500,19 +500,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D1D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); 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"; - for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) { oss << "1D Cell #" << (*it).first << " is part of common edge of following 2D cells ids : "; - std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -525,11 +525,11 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); } else { @@ -541,10 +541,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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"; - for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) { oss << "1D Cell #" << (*it).first << " is part of common edge of following 2D cells ids : "; - std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -564,10 +564,10 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() 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"; - for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) { oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : "; - std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -587,19 +587,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU() MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh); MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh); INTERP_KERNEL::Interpolation2D3D interpolation(*this); - std::vector > matrixTmp; + std::vector > matrixTmp; std::string revMethod(BuildMethodFrom(trgMeth,srcMeth)); nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod); ReverseMatrix(matrixTmp,nbCols,_matrix); - nbCols=matrixTmp.size(); + nbCols=ToIdType(matrixTmp.size()); 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"; - for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) + for(std::map >::const_iterator it=duplicateFaces.begin();it!=duplicateFaces.end();it++) { oss << "2D Cell #" << (*it).first << " is part of common face of following 3D cells ids : "; - std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); + std::copy((*it).second.begin(),(*it).second.end(),std::ostream_iterator(oss," ")); oss << std::endl; } } @@ -674,18 +674,18 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE() MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src2D); MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(trg2D); INTERP_KERNEL::Interpolation2D interpolation2D(*this); - std::vector > matrix2D; - int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC); + std::vector > matrix2D; + mcIdType nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC); MEDCouplingUMesh *s1D,*t1D; double v[3]; MEDCouplingMappedExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v); MEDCouplingNormalizedUnstructuredMesh<1,1> s1DWrapper(s1D); MEDCouplingNormalizedUnstructuredMesh<1,1> t1DWrapper(t1D); - std::vector > matrix1D; + std::vector > matrix1D; INTERP_KERNEL::Interpolation1D interpolation1D(*this); if(interpolation1D.getIntersectionType()==INTERP_KERNEL::Geometric2D)// For intersection type of 1D, Geometric2D do not deal with it ! -> make interpolation1D not inherite from this interpolation1D.setIntersectionType(INTERP_KERNEL::Triangulation);// - int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC); + mcIdType nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC); s1D->decrRef(); t1D->decrRef(); buildFinalInterpolationMatrixByConvolution(matrix1D,matrix2D,src_mesh->getMesh3DIds()->getConstPointer(),nbCols2D,nbCols1D, @@ -714,7 +714,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUC() const int trgMeshDim=target_mesh->getMeshDimension(); if(srcMeshDim!=srcSpceDim || srcMeshDim!=trgMeshDim) throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareInterpKernelOnlyUC: space dimension of unstructured source mesh should be equal to mesh dimension of unstructured source mesh, and should also be equal to target cartesian dimension!"); - std::vector > res; + std::vector > res; switch(srcMeshDim) { case 1: @@ -868,8 +868,8 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : The intersection type is not supported ! Only PointLocator is supported for Gauss->Gauss interpolation ! Please invoke setIntersectionType(PointLocator) on the MEDCouplingRemapper instance !"); MCAuto trgLoc=_target_ft->getLocalizationOfDiscr(); const double *trgLocPtr=trgLoc->begin(); - int trgSpaceDim=trgLoc->getNumberOfComponents(); - MCAuto srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); + mcIdType trgSpaceDim=ToIdType(trgLoc->getNumberOfComponents()); + MCAuto srcOffsetArr=_src_ft->getDiscretization()->getOffsetArr(_src_ft->getMesh()); if(trgSpaceDim!=_src_ft->getMesh()->getSpaceDimension()) { std::ostringstream oss; oss << "MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss : space dimensions mismatch between source and target !"; @@ -877,27 +877,27 @@ int MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss() oss << _src_ft->getMesh()->getSpaceDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const int *srcOffsetArrPtr=srcOffsetArr->begin(); + const mcIdType *srcOffsetArrPtr=srcOffsetArr->begin(); MCAuto srcLoc=_src_ft->getLocalizationOfDiscr(); const double *srcLocPtr=srcLoc->begin(); - MCAuto eltsArr,eltsIndexArr; - int trgNbOfGaussPts=trgLoc->getNumberOfTuples(); + MCAuto eltsArr,eltsIndexArr; + mcIdType trgNbOfGaussPts=trgLoc->getNumberOfTuples(); _matrix.resize(trgNbOfGaussPts); _src_ft->getMesh()->getCellsContainingPointsLinearPartOnlyOnNonDynType(trgLoc->begin(),trgNbOfGaussPts,getPrecision(),eltsArr,eltsIndexArr); - const int *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); - MCAuto nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); - MCAuto ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0); - for(const int *trgId=ids0->begin();trgId!=ids0->end();trgId++) + const mcIdType *elts(eltsArr->begin()),*eltsIndex(eltsIndexArr->begin()); + MCAuto nbOfSrcCellsShTrgPts(eltsIndexArr->deltaShiftIndex()); + MCAuto ids0=nbOfSrcCellsShTrgPts->findIdsNotEqual(0); + for(const mcIdType *trgId=ids0->begin();trgId!=ids0->end();trgId++) { const double *ptTrg=trgLocPtr+trgSpaceDim*(*trgId); - int srcCellId=elts[eltsIndex[*trgId]]; + mcIdType srcCellId=elts[eltsIndex[*trgId]]; double dist=std::numeric_limits::max(); - int srcEntry=-1; - for(int srcId=srcOffsetArrPtr[srcCellId];srcIdgetNumberOfTuples()!=trgNbOfGaussPts) { - MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); + MCAuto orphanTrgIds=nbOfSrcCellsShTrgPts->findIdsEqual(0); MCAuto orphanTrg=trgLoc->selectByTupleId(orphanTrgIds->begin(),orphanTrgIds->end()); - MCAuto srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); - const int *srcIdPerTrgPtr=srcIdPerTrg->begin(); - for(const int *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++) + MCAuto srcIdPerTrg=srcLoc->findClosestTupleId(orphanTrg); + const mcIdType *srcIdPerTrgPtr=srcIdPerTrg->begin(); + for(const mcIdType *orphanTrgId=orphanTrgIds->begin();orphanTrgId!=orphanTrgIds->end();orphanTrgId++,srcIdPerTrgPtr++) _matrix[*orphanTrgId][*srcIdPerTrgPtr]=2.; } _deno_multiply.clear(); @@ -1074,7 +1074,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF throw INTERP_KERNEL::Exception(oss.str().c_str()); } DataArrayDouble *array(targetField->getArray()); - int srcNbOfCompo(srcField->getNumberOfComponents()); + std::size_t srcNbOfCompo(srcField->getNumberOfComponents()); if(array) { targetField->checkConsistencyLight(); @@ -1092,7 +1092,7 @@ void MEDCouplingRemapper::transferUnderground(const MEDCouplingFieldDouble *srcF computeDeno(srcField->getNature(),srcField,targetField); double *resPointer(targetField->getArray()->getPointer()); const double *inputPointer(srcField->getArray()->getConstPointer()); - computeProduct(inputPointer,srcNbOfCompo,isDftVal,dftValue,resPointer); + computeProduct(inputPointer,(int)srcNbOfCompo,isDftVal,dftValue,resPointer); } void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) @@ -1108,7 +1108,7 @@ void MEDCouplingRemapper::computeDeno(NatureOfField nat, const MEDCouplingFieldD void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) { _nature_of_deno=nat; - _time_deno_update=getTimeOfThis(); + std::size_t _time_deno_update=getTimeOfThis(); switch(_nature_of_deno) { case IntensiveMaximum: @@ -1133,8 +1133,8 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.); } int idx=0; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { _deno_multiply[idx][(*iter2).first]=denoPtr[(*iter2).first]; _deno_reverse_multiply[(*iter2).first][idx]=denoRPtr[idx]; @@ -1164,9 +1164,9 @@ void MEDCouplingRemapper::computeDenoFromScratch(NatureOfField nat, const MEDCou double *denoPtr2=deno->getArray()->getPointer(); denoPtr2[0]=std::accumulate(denoRPtr,denoRPtr+denoR->getNumberOfTuples(),0.); } - int idx=0; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + mcIdType idx=0; + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { _deno_multiply[idx][(*iter2).first]=denoPtr[idx]; _deno_reverse_multiply[(*iter2).first][idx]=denoRPtr[(*iter2).first]; @@ -1184,7 +1184,7 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb { int idx=0; double *tmp=new double[inputNbOfCompo]; - for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { if((*iter1).empty()) { @@ -1194,8 +1194,8 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb } else std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,0.); - std::map::const_iterator iter3=_deno_multiply[idx].begin(); - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++) + std::map::const_iterator iter3=_deno_multiply[idx].begin(); + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter3++) { std::transform(inputPointer+(*iter2).first*inputNbOfCompo,inputPointer+((*iter2).first+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies(),(*iter2).second/(*iter3).second)); std::transform(tmp,tmp+inputNbOfCompo,resPointer+idx*inputNbOfCompo,resPointer+idx*inputNbOfCompo,std::plus()); @@ -1207,12 +1207,12 @@ void MEDCouplingRemapper::computeProduct(const double *inputPointer, int inputNb void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer) { std::vector isReached(_deno_reverse_multiply.size(),false); - int idx=0; + mcIdType idx=0; 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++) + for(std::vector >::const_iterator iter1=_matrix.begin();iter1!=_matrix.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { isReached[(*iter2).first]=true; std::transform(inputPointer+idx*inputNbOfCompo,inputPointer+(idx+1)*inputNbOfCompo,tmp,std::bind2nd(std::multiplies(),(*iter2).second/_deno_reverse_multiply[(*iter2).first][idx])); @@ -1226,81 +1226,81 @@ void MEDCouplingRemapper::computeReverseProduct(const double *inputPointer, int std::fill(resPointer+idx*inputNbOfCompo,resPointer+(idx+1)*inputNbOfCompo,dftValue); } -void MEDCouplingRemapper::ReverseMatrix(const std::vector >& matIn, int nbColsMatIn, std::vector >& matOut) +void MEDCouplingRemapper::ReverseMatrix(const std::vector >& matIn, mcIdType nbColsMatIn, std::vector >& matOut) { matOut.resize(nbColsMatIn); - int id=0; - for(std::vector >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++) - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + mcIdType id=0; + for(std::vector >::const_iterator iter1=matIn.begin();iter1!=matIn.end();iter1++,id++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) matOut[(*iter2).first][id]=(*iter2).second; } -void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse) +void MEDCouplingRemapper::ComputeRowSumAndColSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse) { - std::map values; - int idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + std::map values; + mcIdType idx=0; + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { double sum=0.; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { sum+=(*iter2).second; values[(*iter2).first]+=(*iter2).second; } - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) deno[idx][(*iter2).first]=sum; } idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) denoReverse[(*iter2).first][idx]=values[(*iter2).first]; } } -void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse) +void MEDCouplingRemapper::ComputeColSumAndRowSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse) { - std::map values; - int idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + std::map values; + mcIdType idx=0; + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { double sum=0.; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { sum+=(*iter2).second; values[(*iter2).first]+=(*iter2).second; } - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) denoReverse[(*iter2).first][idx]=sum; } idx=0; - for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) + for(std::vector >::const_iterator iter1=matrixDeno.begin();iter1!=matrixDeno.end();iter1++,idx++) { - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) deno[idx][(*iter2).first]=values[(*iter2).first]; } } -void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, - const std::vector< std::map >& m2D, - const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, - const int *corrCellIdTrg) +void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, + const std::vector< std::map >& m2D, + const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc, + const mcIdType *corrCellIdTrg) { - int nbOf2DCellsTrg=m2D.size(); - int nbOf1DCellsTrg=m1D.size(); - int nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg; + mcIdType nbOf2DCellsTrg=ToIdType(m2D.size()); + mcIdType nbOf1DCellsTrg=ToIdType(m1D.size()); + mcIdType nbOf3DCellsTrg=nbOf2DCellsTrg*nbOf1DCellsTrg; _matrix.resize(nbOf3DCellsTrg); - int id2R=0; - for(std::vector< std::map >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++) + mcIdType id2R=0; + for(std::vector< std::map >::const_iterator iter2R=m2D.begin();iter2R!=m2D.end();iter2R++,id2R++) { - for(std::map::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++) + for(std::map::const_iterator iter2C=(*iter2R).begin();iter2C!=(*iter2R).end();iter2C++) { - int id1R=0; - for(std::vector< std::map >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++) + mcIdType id1R=0; + for(std::vector< std::map >::const_iterator iter1R=m1D.begin();iter1R!=m1D.end();iter1R++,id1R++) { - for(std::map::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++) + for(std::map::const_iterator iter1C=(*iter1R).begin();iter1C!=(*iter1R).end();iter1C++) { _matrix[corrCellIdTrg[id1R*nbOf2DCellsTrg+id2R]][corrCellIdSrc[(*iter1C).first*nbOf2DCellsSrc+(*iter2C).first]]=(*iter1C).second*((*iter2C).second); } @@ -1309,19 +1309,19 @@ void MEDCouplingRemapper::buildFinalInterpolationMatrixByConvolution(const std:: } } -void MEDCouplingRemapper::PrintMatrix(const std::vector >& m) +void MEDCouplingRemapper::PrintMatrix(const std::vector >& m) { - int id=0; - for(std::vector >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++) + mcIdType id=0; + for(std::vector >::const_iterator iter1=m.begin();iter1!=m.end();iter1++,id++) { std::cout << "Target Cell # " << id << " : "; - for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) + for(std::map::const_iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) std::cout << "(" << (*iter2).first << "," << (*iter2).second << "), "; std::cout << std::endl; } } -const std::vector >& MEDCouplingRemapper::getCrudeMatrix() const +const std::vector >& MEDCouplingRemapper::getCrudeMatrix() const { return _matrix; } @@ -1329,9 +1329,9 @@ const std::vector >& MEDCouplingRemapper::getCrudeMatrix() /*! * Returns the number of columns of matrix returned by MEDCouplingRemapper::getCrudeMatrix method. */ -int MEDCouplingRemapper::getNumberOfColsOfMatrix() const +mcIdType MEDCouplingRemapper::getNumberOfColsOfMatrix() const { - return (int)_deno_reverse_multiply.size(); + return ToIdType(_deno_reverse_multiply.size()); } /*! @@ -1349,12 +1349,12 @@ int MEDCouplingRemapper::getNumberOfColsOfMatrix() const int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) { int ret=0; - std::vector > matrixNew(_matrix.size()); - int i=0; - for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++) + std::vector > matrixNew(_matrix.size()); + mcIdType i=0; + for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++,i++) { - std::map& rowNew=matrixNew[i]; - for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + std::map& rowNew=matrixNew[i]; + for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) { if(fabs((*it2).second)>maxValAbs) rowNew[(*it2).first]=(*it2).second; @@ -1398,8 +1398,8 @@ int MEDCouplingRemapper::nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) double MEDCouplingRemapper::getMaxValueInCrudeMatrix() const { double ret=0.; - for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++) - for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + for(std::vector >::const_iterator it1=_matrix.begin();it1!=_matrix.end();it1++) + for(std::map::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) if(fabs((*it2).second)>ret) ret=fabs((*it2).second); return ret; diff --git a/src/MEDCoupling/MEDCouplingRemapper.hxx b/src/MEDCoupling/MEDCouplingRemapper.hxx index 393436141..5d840c98d 100644 --- a/src/MEDCoupling/MEDCouplingRemapper.hxx +++ b/src/MEDCoupling/MEDCouplingRemapper.hxx @@ -57,8 +57,8 @@ namespace MEDCoupling 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); - MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, const std::vector >& m); MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue); MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField); MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue); @@ -74,9 +74,9 @@ namespace MEDCoupling MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor); MEDCOUPLINGREMAPPER_EXPORT double getMaxValueInCrudeMatrix() const; public: - MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; - MEDCOUPLINGREMAPPER_EXPORT int getNumberOfColsOfMatrix() const; - MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); + MEDCOUPLINGREMAPPER_EXPORT const std::vector >& getCrudeMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT mcIdType getNumberOfColsOfMatrix() const; + MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector >& m); MEDCOUPLINGREMAPPER_EXPORT static std::string BuildMethodFrom(const std::string& meth1, const std::string& meth2); MEDCOUPLINGREMAPPER_EXPORT void BuildFieldTemplatesFrom(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, MCAuto& src, MCAuto& target); private: @@ -103,16 +103,16 @@ namespace MEDCoupling void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField); void computeProduct(const double *inputPointer, int inputNbOfCompo, bool isDftVal, double dftValue, double *resPointer); void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer); - void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, - const std::vector< std::map >& m2D, - const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc, - const int *corrCellIdTrg); - static void ReverseMatrix(const std::vector >& matIn, int nbColsMatIn, - std::vector >& matOut); - static void ComputeRowSumAndColSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); - static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, - std::vector >& deno, std::vector >& denoReverse); + void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map >& m1D, + const std::vector< std::map >& m2D, + const mcIdType *corrCellIdSrc, mcIdType nbOf2DCellsSrc, mcIdType nbOf1DCellsSrc, + const mcIdType *corrCellIdTrg); + static void ReverseMatrix(const std::vector >& matIn, mcIdType nbColsMatIn, + std::vector >& matOut); + static void ComputeRowSumAndColSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); + static void ComputeColSumAndRowSum(const std::vector >& matrixDeno, + std::vector >& deno, std::vector >& denoReverse); private: MCAuto _src_ft; MCAuto _target_ft; diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx old mode 100644 new mode 100755 index d4a8c91b0..dcbb24a4c --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -26,7 +26,7 @@ using namespace MEDCoupling; MEDCouplingSkyLineArray::MEDCouplingSkyLineArray(): - _super_index( DataArrayInt::New() ), _index( DataArrayInt::New() ), _values( DataArrayInt::New() ) + _super_index( DataArrayIdType::New() ), _index( DataArrayIdType::New() ), _values( DataArrayIdType::New() ) { } @@ -39,8 +39,8 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New() return new MEDCouplingSkyLineArray(); } -MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& index, - const std::vector& value ) +MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& index, + const std::vector& value ) { MEDCouplingSkyLineArray * ret = new MEDCouplingSkyLineArray(); ret->_index->reserve( index.size() ); @@ -50,7 +50,7 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const std::vector& i return ret; } -MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayInt* index, DataArrayInt* value ) +MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( DataArrayIdType* index, DataArrayIdType* value ) { MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray(); ret->set(index, value); @@ -70,19 +70,19 @@ MEDCouplingSkyLineArray* MEDCouplingSkyLineArray::New( const MEDCouplingSkyLineA * polyhedrons or polygons). * The input arrays are deep copied, contrary to the other ctors. */ -MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI ) +MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI ) { using namespace std; MEDCouplingSkyLineArray* ret = new MEDCouplingSkyLineArray(); - const int * cP(c->begin()), * cIP(cI->begin()); - int prev = -1; - if ((int)c->getNbOfElems() != *(cI->end()-1)) + const mcIdType * cP(c->begin()), * cIP(cI->begin()); + mcIdType prev = -1; + if (c->getNbOfElems() != *(cI->end()-1)) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!"); - for (std::size_t i=0; i < cI->getNbOfElems(); i++) + for (mcIdType i=0; i < cI->getNbOfElems(); i++) { - int 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]; @@ -91,29 +91,29 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: connectivity containing other types than POLYHED!"); } - vector superIdx, idx, vals; - int cnt = 0, cnt2 = 0; + vector superIdx, idx, vals; + mcIdType cnt = 0, cnt2 = 0; superIdx.reserve(cI->getNbOfElems()); superIdx.push_back(0); idx.push_back(0); vals.resize(c->getNbOfElems()); // too much because of the type and the -1, but still better than push_back(). - for (std::size_t i=0; i < cI->getNbOfElems()-1; i++) + for (mcIdType i=0; i < cI->getNbOfElems()-1; i++) { - int start = cIP[i]+1, end = cIP[i+1]; - int * work = vals.data() + cnt; - const int * w = cP+start; - const int * w2 = find(w, cP+end, -1); + mcIdType start = cIP[i]+1, end = cIP[i+1]; + mcIdType * work = vals.data() + cnt; + const mcIdType * w = cP+start; + const mcIdType * w2 = find(w, cP+end, -1); while (w2 != cP+end) { copy(w, w2, work); - int d = distance(w, w2); + mcIdType d = ToIdType(distance(w, w2)); cnt += d; work +=d; idx.push_back(cnt); cnt2++; w = w2+1; // skip the -1 w2 = find(w, cP+end, -1); } copy(w, cP+end, work); - cnt += distance(w, cP+end); + cnt += ToIdType(distance(w, cP+end)); idx.push_back(cnt); cnt2++; superIdx.push_back(cnt2); } @@ -131,30 +131,30 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons * Convert a three-level SkyLineArray into a polyhedral connectivity. * The super-packs are interpreted as cell description, and the packs represent the face connectivity. */ -void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& c, MCAuto& cI) const +void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& c, MCAuto& cI) const { // TODO: in this case an iterator would be nice using namespace std; checkSuperIndex("convertToPolyhedronConn"); - const int * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin()); - int cnt = 0; + const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin()); + mcIdType cnt = 0; cI->alloc(_super_index->getNbOfElems(),1); // same number of super packs as number of cells - int * cIVecP(cI->getPointer()); - MCAuto dsi = _index->deltaShiftIndex(); - int sz = dsi->accumulate(0) + dsi->getNbOfElems(); // think about it: one slot for the type, -1 at the end of each face of the cell + mcIdType * cIVecP(cI->getPointer()); + MCAuto dsi = _index->deltaShiftIndex(); + 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); - int * cVecP(c->getPointer()); + mcIdType * cVecP(c->getPointer()); - for ( std::size_t i=0; i < _super_index->getNbOfElems()-1; i++) + for ( mcIdType i=0; i < _super_index->getNbOfElems()-1; i++) { cIVecP[i]= cnt; - int endId = siP[i+1]; + mcIdType endId = siP[i+1]; cVecP[cnt++] = INTERP_KERNEL::NORM_POLYHED; - for (int j=siP[i]; j < endId; j++) + for (mcIdType j=siP[i]; j < endId; j++) { - int startId2 = iP[j], endId2 = iP[j+1]; + mcIdType startId2 = iP[j], endId2 = iP[j+1]; copy(vP+startId2, vP+endId2, cVecP+cnt); cnt += endId2-startId2; if(j != endId-1) @@ -179,36 +179,36 @@ std::vector MEDCouplingSkyLineArray::getDirectChildrenW } -void MEDCouplingSkyLineArray::set( DataArrayInt* index, DataArrayInt* value ) +void MEDCouplingSkyLineArray::set( DataArrayIdType* index, DataArrayIdType* value ) { _index=index; _values=value; - if ( (DataArrayInt*)_index ) _index->incrRef(); - else _index = DataArrayInt::New(); - if ( (DataArrayInt*)_values ) _values->incrRef(); - else _values = DataArrayInt::New(); + if ( (DataArrayIdType*)_index ) _index->incrRef(); + else _index = DataArrayIdType::New(); + if ( (DataArrayIdType*)_values ) _values->incrRef(); + else _values = DataArrayIdType::New(); } -void MEDCouplingSkyLineArray::set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ) +void MEDCouplingSkyLineArray::set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value ) { _super_index=superIndex; - if ( (DataArrayInt*)_super_index ) _super_index->incrRef(); - else _super_index = DataArrayInt::New(); + if ( (DataArrayIdType*)_super_index ) _super_index->incrRef(); + else _super_index = DataArrayIdType::New(); set(index, value); } -DataArrayInt* MEDCouplingSkyLineArray::getSuperIndexArray() const +DataArrayIdType* MEDCouplingSkyLineArray::getSuperIndexArray() const { return const_cast(this)->_super_index; } -DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const +DataArrayIdType* MEDCouplingSkyLineArray::getIndexArray() const { return const_cast(this)->_index; } -DataArrayInt* MEDCouplingSkyLineArray::getValuesArray() const +DataArrayIdType* MEDCouplingSkyLineArray::getValuesArray() const { return const_cast(this)->_values; } @@ -223,9 +223,9 @@ void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const } } -void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int superIndex) const +void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, mcIdType superIndex) const { - if(superIndex < 0 || superIndex >= (int)_super_index->getNbOfElems()) + if(superIndex < 0 || superIndex >= _super_index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid super index!"; @@ -233,9 +233,9 @@ void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int super } } -void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const +void MEDCouplingSkyLineArray::validIndex(const std::string& func, mcIdType idx) const { - if(idx < 0 || idx >= (int)_index->getNbOfElems()) + if(idx < 0 || idx >= _index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!"; @@ -243,11 +243,11 @@ void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const } } -void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, int superIndex, int index) const +void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const { validSuperIndex(func, superIndex); - int idx = _super_index->begin()[superIndex] + index; - if(idx < 0 || idx >= (int)_index->getNbOfElems()) + mcIdType idx = _super_index->begin()[superIndex] + index; + if(idx < 0 || idx >= _index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!"; @@ -259,7 +259,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const { std::ostringstream oss; oss << "MEDCouplingSkyLineArray (" << this << ")" << std::endl; - MCAuto super_index = _super_index->deepCopy(); + MCAuto super_index = _super_index->deepCopy(); if (_super_index->getNbOfElems()) oss << " Nb of super-packs: " << getSuperNumberOf() << std::endl; else @@ -275,7 +275,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const { oss << " Super-indices:" << std::endl; oss << " "; - const int * i = _super_index->begin(); + const mcIdType * i = _super_index->begin(); for ( ; i != _super_index->end(); ++i ) oss << *i << " "; oss << std::endl; @@ -283,16 +283,16 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const oss << " Indices:" << std::endl; oss << " "; - const int * i = _index->begin(); + const mcIdType * i = _index->begin(); for ( ; i != _index->end(); ++i ) oss << *i << " "; oss << std::endl; oss << " Values:" << std::endl; oss << " "; - const int * v = _values->begin(); - int cnt = 0, cntI = 0; + const mcIdType * v = _values->begin(); + mcIdType cnt = 0, cntI = 0; i = _index->begin(); - for ( const int * si = super_index->begin()+1; v != _values->end(); ++v, ++cnt ) + for ( const mcIdType * si = super_index->begin()+1; v != _values->end(); ++v, ++cnt ) { if ( cnt == *i ) { @@ -315,12 +315,12 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const /** * For a 2- or 3-level SkyLine array, return a copy of the absolute pack with given identifier. */ -void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::vector & pack) const +void MEDCouplingSkyLineArray::getSimplePackSafe(const mcIdType absolutePackId, std::vector & pack) const { - if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems()) + if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems()) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!"); - const int * iP(_index->begin()), *vP(_values->begin()); - int sz = iP[absolutePackId+1]-iP[absolutePackId]; + const mcIdType * iP(_index->begin()), *vP(_values->begin()); + mcIdType sz = iP[absolutePackId+1]-iP[absolutePackId]; pack.resize(sz); std::copy(vP+iP[absolutePackId], vP+iP[absolutePackId+1],pack.begin()); } @@ -328,11 +328,11 @@ void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::v /** * Same as getPackSafe, but directly returns a pointer to the internal data with the size of the pack. */ -const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePackId, int & packSize) const +const mcIdType * MEDCouplingSkyLineArray::getSimplePackSafePtr(const mcIdType absolutePackId, mcIdType & packSize) const { - if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems()) + if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems()) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!"); - const int * iP(_index->begin()), *vP(_values->begin()); + const mcIdType * iP(_index->begin()), *vP(_values->begin()); packSize = iP[absolutePackId+1]-iP[absolutePackId]; return vP+iP[absolutePackId]; } @@ -344,30 +344,30 @@ const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePack * \param[in] superPackIndices the list of super-packs that should be inspected * \param[in] packBg the pack that the function is looking for in each of the provided super-pack * \param[in] packEnd the pack that the function is looking for in each of the provided super-pack - * \param[out] a vector of int, having the same size as superPackIndices and containing for each inspected super-pack + * \param[out] a vector of mcIdType, having the same size as superPackIndices and containing for each inspected super-pack * the index of the first matching pack, or -1 if none found. */ -void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndices, - const int *packBg, const int *packEnd, - std::vector& out) const +void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndices, + const mcIdType *packBg, const mcIdType *packEnd, + std::vector& out) const { using namespace std; checkSuperIndex("findPackIds"); - int packSz = 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()); - int i = 0; - const int * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin()); - for(vector::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++) + mcIdType i = 0; + const mcIdType * siP(_super_index->begin()), * iP(_index->begin()), *vP(_values->begin()); + for(vector::const_iterator it=superPackIndices.begin(); it!=superPackIndices.end(); ++it, i++) { out[i] = -1; - const int sPackIdx = *it; + const mcIdType sPackIdx = *it; // for each pack - for (int idx=siP[sPackIdx], j=0; idx < siP[sPackIdx+1]; idx++, j++) + for (mcIdType idx=siP[sPackIdx], j=0; idx < siP[sPackIdx+1]; idx++, j++) { if (packSz == (iP[idx+1] - iP[idx])) if (equal(&vP[iP[idx]], &vP[iP[idx+1]], packBg)) @@ -384,41 +384,41 @@ void MEDCouplingSkyLineArray::findPackIds(const std::vector & superPackIndi * \param[in] superIdx is the super-pack number * \param[in] idx is the pack index inside the super-pack 'superIdx'. */ -void MEDCouplingSkyLineArray::deletePack(const int superIdx, const int idx) +void MEDCouplingSkyLineArray::deletePack(const mcIdType superIdx, const mcIdType idx) { checkSuperIndex("deletePack"); validSuperIndexAndIndex("deletePack", superIdx, idx); - int * vP = _values->getPointer(); - int * siP(_super_index->getPointer()), *iP(_index->getPointer()); - const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; + mcIdType * vP = _values->getPointer(); + mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer()); + const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; // _values std::copy(vP+end, vP+_values->getNbOfElems(), vP+start); _values->reAlloc(_values->getNbOfElems() - (end-start)); // _index - int 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(int ii = siP[superIdx]+idx; ii < nt-1; ii++) + for(mcIdType ii = siP[superIdx]+idx; ii < nt-1; ii++) iP[ii] -= (end-start); // _super_index - for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++) + for(mcIdType ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++) (siP[ii])--; } -void MEDCouplingSkyLineArray::deleteSimplePack(const int idx) +void MEDCouplingSkyLineArray::deleteSimplePack(const mcIdType idx) { validIndex("deleteSimplePack", idx); - int* iP(_index->getPointer()); - const int start(iP[idx]), end(iP[idx+1]); + mcIdType* iP(_index->getPointer()); + const mcIdType start(iP[idx]), end(iP[idx+1]); // _values - int initValSz( _values->getNbOfElems() ); - int deltaSz( start-end ); // should be negative - int *vP(_values->getPointer()); + mcIdType initValSz=_values->getNbOfElems(); + mcIdType deltaSz( start-end ); // should be negative + mcIdType *vP(_values->getPointer()); if (deltaSz < 0) { std::copy(vP+end, vP+initValSz, vP+start); @@ -427,45 +427,45 @@ void MEDCouplingSkyLineArray::deleteSimplePack(const int idx) else throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePack"); // _index - int nt(_index->getNbOfElems()); + mcIdType nt=_index->getNbOfElems(); std::copy(iP+idx+1, iP+nt, iP+idx); - for(int ii = idx; ii < nt-1; ii++) + for(mcIdType ii = idx; ii < nt-1; ii++) iP[ii] += deltaSz; _index->reAlloc(nt-1); } -void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const std::vector& packs) +void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayIdType* idx, const std::vector& packs) { if (idx->empty()) return; - for (const int * id = idx->begin(); id != idx->end(); id++) + for (const mcIdType * id = idx->begin(); id != idx->end(); id++) validIndex("deleteSimplePacks", *id); - if (idx->getNbOfElems() != packs.size()) + if (idx->getNbOfElems() != ToIdType( packs.size())) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::deleteSimplePacks: size of list of pack is incorrect"); - // copy _index, _values into a deque> - std::deque< std::set > valuesByIdx; - int* vP(_values->getPointer()); - int* iP(_index->getPointer()); - std::size_t nt ( _index->getNbOfElems() ); - for (int ii = 0; ii < nt-1; ii++) - valuesByIdx.push_back(std::set(vP+iP[ii], vP+iP[ii+1])); + // copy _index, _values into a deque> + std::deque< std::set > valuesByIdx; + mcIdType* vP(_values->getPointer()); + mcIdType* iP(_index->getPointer()); + 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 - int ii(0); - for (const int *id = idx->begin(); id != idx->end(); id++) + // modify the deque> according to idx and packs + mcIdType ii(0); + 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 - int valSz(0); + // copy back the deque> into _index, _values + mcIdType valSz(0); *iP = 0; - for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) + for (std::deque< std::set >::const_iterator values=valuesByIdx.begin();values!=valuesByIdx.end();values++) { - valSz += (*values).size(); + valSz += ToIdType((*values).size()); *(++iP) = valSz; } _values->reAlloc(valSz); @@ -478,21 +478,21 @@ void MEDCouplingSkyLineArray::replaceSimplePacks(const DataArrayInt* idx, const } } -void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) +void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayIdType* idx) { for (auto id = idx->begin(); id != idx->end(); id++) validIndex("deleteSimplePacks", *id); - std::set packsToDelete(idx->begin(), idx->end()); + std::set packsToDelete(idx->begin(), idx->end()); // _values - int* iP(_index->getPointer()); - int initValSz = _values->getNbOfElems(); - int *vP(_values->getPointer()); - int end_prec(0),start_prec(0); - for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) + mcIdType* iP(_index->getPointer()); + mcIdType initValSz = _values->getNbOfElems(); + mcIdType *vP(_values->getPointer()); + mcIdType end_prec(0),start_prec(0); + for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) { - int 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; @@ -503,17 +503,17 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) _values->reAlloc(initValSz-(end_prec-start_prec)); // _index - int nt = _index->getNbOfElems(); - int offset = 0; + mcIdType nt = _index->getNbOfElems(); + mcIdType offset = 0; end_prec = 0; start_prec = 0; - int deleted = 0; - for(std::set::const_iterator ii=packsToDelete.begin();ii!=packsToDelete.end();ii++) + mcIdType deleted = 0; + 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 (int i=start_prec; i<*ii; i++) + for (mcIdType i=start_prec; i<*ii; i++) iP[i] -= offset; } offset += iP[*ii+1] - iP[*ii]; @@ -524,7 +524,7 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) if (end_prec != 0) { std::copy(iP+end_prec, iP+nt, iP+start_prec); - for (int i=start_prec; ireAlloc(nt-deleted); @@ -533,34 +533,34 @@ void MEDCouplingSkyLineArray::deleteSimplePacks(const DataArrayInt* idx) /**! * Insert a new pack in super-pack at index 'superIdx'. The pack is inserted at the end of the pack list of the chosen super-pack. */ -void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packBg, const int * packEnd) +void MEDCouplingSkyLineArray::pushBackPack(const mcIdType superIdx, const mcIdType * packBg, const mcIdType * packEnd) { using namespace std; checkSuperIndex("pushBackPack"); validSuperIndex("pushBackPack", superIdx); - int *siP(_super_index->getPointer()), *iP(_index->getPointer()); - const int sz(distance(packBg, packEnd)); + mcIdType *siP(_super_index->getPointer()), *iP(_index->getPointer()); + const mcIdType sz(ToIdType(distance(packBg, packEnd))); // _values _values->reAlloc(_values->getNbOfElems()+sz); - int * vPE(_values->getPointer()+_values->getNbOfElems()); - int *vP(_values->getPointer()); + mcIdType * vPE(_values->getPointer()+_values->getNbOfElems()); + mcIdType *vP(_values->getPointer()); copy(vP+iP[siP[superIdx+1]], vPE-sz, vP+iP[siP[superIdx+1]]+sz); // insert pack copy(packBg, packEnd, vP+iP[siP[superIdx+1]]); // _index - int nt = _index->getNbOfElems(); + 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; - for(int ii = siP[superIdx+1]+2; ii < nt+1; ii++) + for(mcIdType ii = siP[superIdx+1]+2; ii < nt+1; ii++) iP[ii] += sz; // _super_index - for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++) + for(mcIdType ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++) (siP[ii])++; } @@ -568,22 +568,22 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB * Replace pack with absolute index 'idx' with the provided new pack. Function can be used either * for 2-level SkyLine or 3-level SkyLine. */ -void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packBg, const int * packEnd) +void MEDCouplingSkyLineArray::replaceSimplePack(const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd) { validIndex("replaceSimplePack", idx); - int * iP(_index->getPointer()); - int newSz = std::distance(packBg, packEnd); - const int start = iP[idx], end = iP[idx+1]; + mcIdType * iP(_index->getPointer()); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); + const mcIdType start = iP[idx], end = iP[idx+1]; // _values - int initValSz = _values->getNbOfElems(); - int deltaSz = newSz-(end-start); // can be negative + mcIdType initValSz = _values->getNbOfElems(); + mcIdType deltaSz = newSz-(end-start); // can be negative if (deltaSz) { if (deltaSz > 0) _values->reAlloc(initValSz+deltaSz); - int *vP(_values->getPointer()); + mcIdType *vP(_values->getPointer()); std::copy(vP+end, vP+initValSz, vP+end+deltaSz); if (deltaSz < 0) _values->reAlloc(initValSz+deltaSz); @@ -593,7 +593,7 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB std::copy(packBg, packEnd, _values->getPointer()+start); // _index - for(int ii = idx+1; ii < (int)_index->getNbOfElems(); ii++) + for(mcIdType ii = idx+1; ii < _index->getNbOfElems(); ii++) iP[ii] += deltaSz; } @@ -601,23 +601,23 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB * Replace pack with super index 'superIdx' and index 'idx' with the provided new pack. * Function can be used only for 3-level SkyLine. */ -void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, const int *packBg, const int *packEnd) +void MEDCouplingSkyLineArray::replacePack(const mcIdType superIdx, const mcIdType idx, const mcIdType *packBg, const mcIdType *packEnd) { checkSuperIndex("replacePack"); validSuperIndexAndIndex("replacePack", superIdx, idx); - int * siP(_super_index->getPointer()), *iP(_index->getPointer()); - int newSz = std::distance(packBg, packEnd); - const int start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; + mcIdType * siP(_super_index->getPointer()), *iP(_index->getPointer()); + mcIdType newSz = ToIdType(std::distance(packBg, packEnd)); + const mcIdType start = iP[siP[superIdx]+idx], end = iP[siP[superIdx]+idx+1]; // _values - int initValSz = _values->getNbOfElems(); - int deltaSz = newSz-(end-start); // can be negative + mcIdType initValSz = _values->getNbOfElems(); + mcIdType deltaSz = newSz-(end-start); // can be negative if (deltaSz) { if (deltaSz > 0) _values->reAlloc(initValSz+deltaSz); - int *vP(_values->getPointer()); + mcIdType *vP(_values->getPointer()); std::copy(vP+end, vP+initValSz, vP+end+deltaSz); if (deltaSz < 0) _values->reAlloc(initValSz+deltaSz); @@ -627,6 +627,6 @@ void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, con std::copy(packBg, packEnd, _values->getPointer()+start); // _index - for(int ii = siP[superIdx]+idx+1; ii < (int)_index->getNbOfElems(); ii++) + for(mcIdType ii = siP[superIdx]+idx+1; ii < _index->getNbOfElems(); ii++) iP[ii] += deltaSz; } diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx index 665e7a870..f8afb84a1 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.hxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.hxx @@ -58,57 +58,57 @@ namespace MEDCoupling { public: static MEDCouplingSkyLineArray * New(); - static MEDCouplingSkyLineArray * New( const std::vector& index, const std::vector& value); - static MEDCouplingSkyLineArray * New( DataArrayInt* index, DataArrayInt* value ); + static MEDCouplingSkyLineArray * New( const std::vector& index, const std::vector& value); + static MEDCouplingSkyLineArray * New( DataArrayIdType* index, DataArrayIdType* value ); static MEDCouplingSkyLineArray * New( const MEDCouplingSkyLineArray & other ); - static MEDCouplingSkyLineArray * BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI ); + static MEDCouplingSkyLineArray * BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI ); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - void set( DataArrayInt* index, DataArrayInt* value ); - void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ); + void set( DataArrayIdType* index, DataArrayIdType* value ); + void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value ); - int getSuperNumberOf() const { return _super_index->getNbOfElems()-1; } - int getNumberOf() const { return _index->getNbOfElems()-1; } - int getLength() const { return _values->getNbOfElems(); } + mcIdType getSuperNumberOf() const { return ToIdType(_super_index->getNbOfElems())-1; } + mcIdType getNumberOf() const { return ToIdType(_index->getNbOfElems())-1; } + mcIdType getLength() const { return ToIdType(_values->getNbOfElems()); } - const int* getSuperIndex() const { return _super_index->begin(); } - const int* getIndex() const { return _index->begin(); } - const int* getValues() const { return _values->begin(); } + const mcIdType* getSuperIndex() const { return _super_index->begin(); } + const mcIdType* getIndex() const { return _index->begin(); } + const mcIdType* getValues() const { return _values->begin(); } - DataArrayInt* getSuperIndexArray() const; - DataArrayInt* getIndexArray() const; - DataArrayInt* getValuesArray() const; + DataArrayIdType* getSuperIndexArray() const; + DataArrayIdType* getIndexArray() const; + DataArrayIdType* getValuesArray() const; std::string simpleRepr() const; - void getSimplePackSafe(const int absolutePackId, std::vector & pack) const; - const int * getSimplePackSafePtr(const int absolutePackId, int & packSize) const; - void findPackIds(const std::vector & superPackIndices, const int *packBg, const int *packEnd, - std::vector& out) const; + void getSimplePackSafe(const mcIdType absolutePackId, std::vector & pack) const; + const mcIdType * getSimplePackSafePtr(const mcIdType absolutePackId, mcIdType & packSize) const; + void findPackIds(const std::vector & superPackIndices, const mcIdType *packBg, const mcIdType *packEnd, + std::vector& out) const; - void deletePack(const int superIdx, const int idx); - void deleteSimplePack(const int idx); - void pushBackPack(const int superIdx, const int * packBg, const int * packEnd); + void deletePack(const mcIdType superIdx, const mcIdType idx); + void deleteSimplePack(const mcIdType idx); + void pushBackPack(const mcIdType superIdx, const mcIdType * packBg, const mcIdType * packEnd); - void replaceSimplePack(const int idx, const int * packBg, const int * packEnd); - void replacePack(const int superIdx, const int idx, const int * packBg, const int * packEnd); + void replaceSimplePack(const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd); + void replacePack(const mcIdType superIdx, const mcIdType idx, const mcIdType * packBg, const mcIdType * packEnd); - void deleteSimplePacks(const DataArrayInt* idx); - void replaceSimplePacks(const DataArrayInt* idx, const std::vector& packs); + void deleteSimplePacks(const DataArrayIdType* idx); + void replaceSimplePacks(const DataArrayIdType* idx, const std::vector& packs); - void convertToPolyhedronConn( MCAuto& c, MCAuto& cI) const; + void convertToPolyhedronConn( MCAuto& c, MCAuto& cI) const; private: MEDCouplingSkyLineArray(); ~MEDCouplingSkyLineArray(); void checkSuperIndex(const std::string& func) const; - void validSuperIndex(const std::string& func, int superIndex) const; - void validIndex(const std::string& func, int index) const; - void validSuperIndexAndIndex(const std::string& func, int superIndex, int index) const; + void validSuperIndex(const std::string& func, mcIdType superIndex) const; + void validIndex(const std::string& func, mcIdType index) const; + void validSuperIndexAndIndex(const std::string& func, mcIdType superIndex, mcIdType index) const; MCAuto _super_index; MCAuto _index; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx old mode 100644 new mode 100755 index bdb9cdb55..69f68accd --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -56,7 +56,7 @@ bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, do return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason); } -INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(std::size_t cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(mcIdType cellId) const { return GetGeoTypeGivenMeshDimension(getMeshDimension()); } @@ -85,9 +85,9 @@ std::set MEDCouplingStructuredMesh::getAllGeo return ret2; } -std::size_t MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - std::size_t ret(getNumberOfCells()); + mcIdType ret(getNumberOfCells()); if(type==getTypeOfCell(0)) return ret; const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0))); @@ -95,9 +95,9 @@ std::size_t MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::N throw INTERP_KERNEL::Exception(oss.str().c_str()); } -DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +DataArrayIdType *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); if(getTypeOfCell(0)==type) { ret->alloc(getNumberOfCells(),1); @@ -108,23 +108,23 @@ DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::Normal return ret.retn(); } -DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const { - int nbCells=getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); + std::size_t nbCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); - ret->fillWithValue((int)cm.getNumberOfNodes()); + ret->fillWithValue(ToIdType(cm.getNumberOfNodes())); return ret.retn(); } -DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const { - int nbCells=getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); + std::size_t nbCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbCells,1); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); - ret->fillWithValue((int)cm.getNumberOfSons()); + ret->fillWithValue(ToIdType(cm.getNumberOfSons())); return ret.retn(); } @@ -133,20 +133,20 @@ DataArrayInt *MEDCouplingStructuredMesh::computeNbOfFacesPerCell() const * will be counted only once here whereas it will be counted several times in MEDCouplingMesh::computeNbOfNodesPerCell method. * Here for structured mesh it returns exactly as MEDCouplingStructuredMesh::computeNbOfNodesPerCell does. * - * \return DataArrayInt * - new object to be deallocated by the caller. + * \return DataArrayIdType * - new object to be deallocated by the caller. */ -DataArrayInt *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() const +DataArrayIdType *MEDCouplingStructuredMesh::computeEffectiveNbOfNodesPerCell() const { return computeNbOfNodesPerCell(); } -void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCouplingStructuredMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { int meshDim=getMeshDimension(); - int tmpCell[3],tmpNode[3]; + mcIdType tmpCell[3],tmpNode[3]; getSplitCellValues(tmpCell); getSplitNodeValues(tmpNode); - int tmp2[3]; + mcIdType tmp2[3]; GetPosFromId(cellId,meshDim,tmpCell,tmp2); switch(meshDim) { @@ -173,9 +173,9 @@ void MEDCouplingStructuredMesh::getNodeIdsOfCell(std::size_t cellId, std::vector */ int MEDCouplingStructuredMesh::getMeshDimension() const { - std::vector ngs(getNodeGridStructure()); + std::vector ngs(getNodeGridStructure()); int ret(0),pos(0); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++) + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++) { if(*it<=0) { @@ -195,11 +195,11 @@ int MEDCouplingStructuredMesh::getMeshDimension() const */ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const { - std::vector nodeStr(getNodeGridStructure()); + std::vector nodeStr(getNodeGridStructure()); int spd1(0),pos(0); - for(std::vector::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++) + for(std::vector::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++) { - int 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 !"; @@ -210,36 +210,36 @@ int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const return spd1; } -void MEDCouplingStructuredMesh::getSplitCellValues(int *res) const +void MEDCouplingStructuredMesh::getSplitCellValues(mcIdType *res) const { - std::vector strct(getCellGridStructure()); - std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); + std::vector strct(getCellGridStructure()); + std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); std::copy(ret.begin(),ret.end(),res); } -void MEDCouplingStructuredMesh::getSplitNodeValues(int *res) const +void MEDCouplingStructuredMesh::getSplitNodeValues(mcIdType *res) const { - std::vector strct(getNodeGridStructure()); - std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); + std::vector strct(getNodeGridStructure()); + std::vector ret(MEDCouplingStructuredMesh::GetSplitVectFromStruct(strct)); std::copy(ret.begin(),ret.end(),res); } /*! * This method returns the number of cells of unstructured sub level mesh, without building it. */ -int MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const +mcIdType MEDCouplingStructuredMesh::getNumberOfCellsOfSubLevelMesh() const { - std::vector cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); return GetNumberOfCellsOfSubLevelMesh(cgs,getMeshDimension()); } /*! * See MEDCouplingUMesh::getDistributionOfTypes for more information */ -std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const +std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const { //only one type of cell - std::vector ret(3); + std::vector ret(3); ret[0]=getTypeOfCell(0); ret[1]=getNumberOfCells(); ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here @@ -252,12 +252,12 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const * * See MEDCouplingUMesh::checkTypeConsistencyAndContig for more information */ -DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { - int 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]!=(int)getTypeOfCell(0)) + if(code[0]!=ToIdType(getTypeOfCell(0))) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : Mismatch of geometric type ! Asking for " << code[0] << " whereas the geometric type is \a this is " << getTypeOfCell(0) << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -275,15 +275,15 @@ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std if(code[2]!=0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : single geo type mesh ! 0 or -1 is expected at pos #2 of input code !"); if(idsPerType.size()!=1) - throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input code points to DataArrayInt #0 whereas the size of idsPerType is not equal to 1 !"); - const DataArrayInt *pfl=idsPerType[0]; + throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input code points to DataArrayIdType #0 whereas the size of idsPerType is not equal to 1 !"); + const DataArrayIdType *pfl=idsPerType[0]; if(!pfl) - throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayInt at rank 0 !"); + throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : the input code points to a NULL DataArrayIdType at rank 0 !"); if(pfl->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::checkTypeConsistencyAndContig : input profile should have exactly one component !"); pfl->checkAllIdsInRange(0,nbOfCells); pfl->incrRef(); - return const_cast(pfl); + return const_cast(pfl); } /*! @@ -310,16 +310,16 @@ DataArrayInt *MEDCouplingStructuredMesh::checkTypeConsistencyAndContig(const std * - After \a code contains [NORM_...,nbCells,0], \a idsInPflPerType [[0,1]] and \a idsPerType is [[1,2]]
*/ -void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile || !profile->isAllocated()) 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 !"); - int nbTuples(profile->getNumberOfTuples()); - int nbOfCells=getNumberOfCells(); + mcIdType nbTuples(profile->getNumberOfTuples()); + mcIdType nbOfCells=getNumberOfCells(); code.resize(3); idsInPflPerType.resize(1); - code[0]=(int)getTypeOfCell(0); code[1]=nbOfCells; + code[0]=ToIdType(getTypeOfCell(0)); code[1]=nbOfCells; idsInPflPerType.resize(1); if(smartPflKiller && profile->isIota(nbOfCells)) { @@ -333,7 +333,7 @@ void MEDCouplingStructuredMesh::splitProfilePerType(const DataArrayInt *profile, profile->checkAllIdsInRange(0,nbOfCells); idsPerType.resize(1); idsPerType[0]=profile->deepCopy(); - idsInPflPerType[0]=DataArrayInt::Range(0,nbTuples,1); + idsInPflPerType[0]=DataArrayIdType::Range(0,nbTuples,1); } /*! @@ -352,9 +352,9 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const if((meshDim<0 || meshDim>3) || (spaceDim<0 || spaceDim>3)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim and spacedim must be in [1,2,3] !"); MCAuto coords(getCoordinatesAndOwner()); - int ns[3]; + mcIdType ns[3]; getNodeGridStructure(ns); - MCAuto conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); + MCAuto conn(Build1GTNodalConnectivity(ns,ns+spaceDim)); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim))); ret->setNodalConnectivity(conn); ret->setCoords(coords); try @@ -375,9 +375,9 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTSubLevelMesh() const if(meshDim<1 || meshDim>3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTSubLevelMesh : meshdim must be in [2,3] !"); MCAuto coords(getCoordinatesAndOwner()); - int ns[3]; + mcIdType ns[3]; getNodeGridStructure(ns); - MCAuto conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); + MCAuto conn(Build1GTNodalConnectivityOfSubLevelMesh(ns,ns+meshDim)); MCAuto ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim-1))); ret->setNodalConnectivity(conn); ret->setCoords(coords); return ret.retn(); @@ -409,26 +409,26 @@ MEDCouplingUMesh *MEDCouplingStructuredMesh::buildUnstructured() const * \return MEDCouplingMesh * - a new instance of MEDCouplingUMesh. The caller is to * delete this mesh using decrRef() as it is no more needed. */ -MEDCouplingMesh *MEDCouplingStructuredMesh::buildPart(const int *start, const int *end) const +MEDCouplingMesh *MEDCouplingStructuredMesh::buildPart(const mcIdType *start, const mcIdType *end) const { MCAuto um(buildUnstructured()); return um->buildPart(start,end); } -MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const +MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const mcIdType *start, const mcIdType *end, DataArrayIdType*& arr) const { - std::vector cgs(getCellGridStructure()); - std::vector< std::pair > cellPartFormat,nodePartFormat; + std::vector cgs(getCellGridStructure()); + std::vector< std::pair > cellPartFormat,nodePartFormat; if(IsPartStructured(start,end,cgs,cellPartFormat)) { MCAuto ret(buildStructuredSubPart(cellPartFormat)); nodePartFormat=cellPartFormat; - for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) + for(std::vector< std::pair >::iterator it=nodePartFormat.begin();it!=nodePartFormat.end();it++) (*it).second++; - MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); - MCAuto tmp2(DataArrayInt::New()); tmp2->alloc(getNumberOfNodes(),1); + MCAuto tmp1(BuildExplicitIdsFrom(getNodeGridStructure(),nodePartFormat)); + MCAuto tmp2(DataArrayIdType::New()); tmp2->alloc(getNumberOfNodes(),1); tmp2->fillWithValue(-1); - MCAuto tmp3(DataArrayInt::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0); + MCAuto tmp3(DataArrayIdType::New()); tmp3->alloc(tmp1->getNumberOfTuples(),1); tmp3->iota(0); tmp2->setPartOfValues3(tmp3,tmp1->begin(),tmp1->end(),0,1,1); arr=tmp2.retn(); return ret.retn(); @@ -440,7 +440,7 @@ MEDCouplingMesh *MEDCouplingStructuredMesh::buildPartAndReduceNodes(const int *s } } -DataArrayInt *MEDCouplingStructuredMesh::simplexize(int policy) +DataArrayIdType *MEDCouplingStructuredMesh::simplexize(int policy) { throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::simplexize : not available for Cartesian mesh !"); } @@ -459,19 +459,19 @@ 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()); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); array->alloc(nbOfCells,3); double *vals(array->getPointer()); - for(int i=0;isetArray(array); ret->setMesh(this); return ret.retn(); } -void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const { - std::vector ngs(getNodeGridStructure()); + std::vector ngs(getNodeGridStructure()); int dim(getSpaceDimension()); switch(dim) { @@ -486,18 +486,18 @@ void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNod } } -void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { - int 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 ; } if(nbNodes==1) { revNodal->alloc(1,1); revNodal->setIJ(0,0,0); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,1); return ; } revNodal->alloc(2*(nbNodes-1),1); - int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); *rni++=0; *rni=1; *rn++=0; - for(int i=1;i& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { - int nbNodesX(ngs[0]),nbNodesY(ngs[1]); - int nbNodes(nbNodesX*nbNodesY); + mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]); + mcIdType nbNodes(nbNodesX*nbNodesY); if(nbNodesX==0 || nbNodesY==0) { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } if(nbNodesX==1 || nbNodesY==1) - { std::vector ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); } + { std::vector ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); } revNodalIndx->alloc(nbNodes+1,1); - int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1); + mcIdType nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1); revNodal->alloc(4*(nbNodesX-2)*(nbNodesY-2)+2*2*(nbNodesX-2)+2*2*(nbNodesY-2)+4,1); - int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); *rni++=0; *rni=1; *rn++=0; - for(int i=1;i& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) { - int nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]); - int nbNodes(nbNodesX*nbNodesY*nbNodesZ); + mcIdType nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]); + 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) { - std::vector ngs2(2); - int pos(0); + std::vector ngs2(2); + mcIdType pos(0); bool pass(false); for(int i=0;i<3;i++) { @@ -575,21 +575,21 @@ void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vectoralloc(nbNodes+1,1); - int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1); + mcIdType nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1); revNodal->alloc(8*(nbNodesX-2)*(nbNodesY-2)*(nbNodesZ-2)+4*(2*(nbNodesX-2)*(nbNodesY-2)+2*(nbNodesX-2)*(nbNodesZ-2)+2*(nbNodesY-2)*(nbNodesZ-2))+2*4*(nbNodesX-2)+2*4*(nbNodesY-2)+2*4*(nbNodesZ-2)+8,1); - int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + mcIdType *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); *rni=0; - for(int k=0;k=1 && j>=1 && i>=1) *rn++=off00+i-1; if(k>=1 && j>=1 && i conn(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(1,1); conn->setIJ(0,0,0); return conn.retn(); } @@ -650,7 +650,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *no } } -DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(const int *nodeStBg, const int *nodeStEnd) +DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd) { std::size_t dim(std::distance(nodeStBg,nodeStEnd)); switch(dim) @@ -666,46 +666,46 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh /*! * This method returns the list of ids sorted ascendingly of entities that are in the corner in ghost zone. - * The ids are returned in a newly created DataArrayInt having a single component. + * The ids are returned in a newly created DataArrayIdType having a single component. * * \param [in] st - The structure \b without ghost cells. * \param [in] ghostLev - The size of the ghost zone (>=0) - * \return DataArrayInt * - The DataArray containing all the ids the caller is to deallocate. + * \return DataArrayIdType * - The DataArray containing all the ids the caller is to deallocate. */ -DataArrayInt *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector& st, int ghostLev) +DataArrayIdType *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector& st, mcIdType ghostLev) { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ComputeCornersGhost : ghost lev must be >= 0 !"); std::size_t dim(st.size()); - MCAuto ret(DataArrayInt::New()); + MCAuto ret(DataArrayIdType::New()); switch(dim) { case 1: { ret->alloc(2*ghostLev,1); - int *ptr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i= 0 !"); - for(int i=0;i= 0 !"); ret->alloc(4*ghostLev,1); - int *ptr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i= 0 !"); ret->alloc(8*ghostLev,1); - int *ptr(ret->getPointer()); - int zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); - for(int i=0;igetPointer()); + mcIdType zeOffsetZ((offsetX+2*ghostLev)*(offsetY+2*ghostLev)); + for(mcIdType i=0;i=0;i--,j++) + mcIdType j(0),zeOffsetZ2(zeOffsetZ*(offsetZ+ghostLev)); + for(mcIdType i=ghostLev-1;i>=0;i--,j++) { *ptr++=i*(2*ghostLev+offsetX+1)+j*zeOffsetZ+zeOffsetZ2; *ptr++=offsetX+2*ghostLev-1+i*(2*ghostLev+offsetX-1)+j*zeOffsetZ+zeOffsetZ2; @@ -749,13 +749,13 @@ DataArrayInt *MEDCouplingStructuredMesh::ComputeCornersGhost(const std::vector >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat) { - int ret(1); + mcIdType ret(1); std::size_t ii(0); - for(std::vector< std::pair >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++) + for(std::vector< std::pair >::const_iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,ii++) { - int a((*it).first),b((*it).second); + mcIdType a((*it).first),b((*it).second); if(a<0 || b<0 || b-a<0) { std::ostringstream oss; oss << "MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt : invalid input at dimension " << ii << " !"; @@ -766,9 +766,9 @@ int MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(const std:: return ret; } -int MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector& st) +mcIdType MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(const std::vector& st) { - int ret(1); + mcIdType ret(1); bool isFetched(false); for(std::size_t i=0;i >& partCompactFormat, int& axisId, int& sizeOfRange) +void MEDCouplingStructuredMesh::FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, mcIdType& sizeOfRange) { - int dim((int)partCompactFormat.size()); - int ret(-1); + mcIdType dim(ToIdType(partCompactFormat.size())); + mcIdType ret(-1); for(int i=0;i& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf(mcIdType minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat) { if(minPatchLgth<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : the input minPatchLgth has to be >=0 !"); - if((int)crit.size()!=DeduceNumberOfGivenStructure(st)) + if(ToIdType(crit.size())!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : size of vector of boolean is invalid regarding the declared structure !"); - int ret(-1); - switch((int)st.size()) + mcIdType ret(-1); + switch(st.size()) { case 1: { @@ -841,13 +841,13 @@ int MEDCouplingStructuredMesh::FindMinimalPartOf(int minPatchLgth, const std::ve default: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf : only dimension 1, 2 and 3 are supported actually !"); } - std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); - int i(0); - for(std::vector< std::pair >::iterator it=partCompactFormat.begin();it!=partCompactFormat.end();it++,i++) + std::vector dims(MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(partCompactFormat)); + mcIdType i(0); + 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::vector< std::vector > MEDCouplingStructuredMesh::ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit) { - int dim((int)st.size()); - std::vector< std::vector > ret(dim); + std::size_t dim(st.size()); + std::vector< std::vector > ret(dim); switch(dim) { case 1: { - int nx(st[0]); + mcIdType nx(st[0]); ret[0].resize(nx); - std::vector& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retY(ret[1]); - for(int j=0;j& retY(ret[1]); + for(mcIdType j=0;j > MEDCouplingStructuredMesh::ComputeSignaturePerAx } case 3: { - int nx(st[0]),ny(st[1]),nz(st[2]); + mcIdType nx(st[0]),ny(st[1]),nz(st[2]); ret[0].resize(nx); ret[1].resize(ny); ret[2].resize(nz); - std::vector& retX(ret[0]); - for(int i=0;i& retX(ret[0]); + for(mcIdType i=0;i& retY(ret[1]); - for(int j=0;j& retY(ret[1]); + for(mcIdType j=0;j& retZ(ret[2]); - for(int k=0;k& retZ(ret[2]); + for(mcIdType k=0;k > MEDCouplingStructuredMesh::ComputeSignaturePerAx return ret; } -DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const int *nodeStBg) +DataArrayIdType *MEDCouplingStructuredMesh::Build1GTNodalConnectivity1D(const mcIdType *nodeStBg) { - std::size_t nbOfCells(*nodeStBg-1); - MCAuto conn(DataArrayInt::New()); + mcIdType nbOfCells=*nodeStBg-1; + MCAuto conn(DataArrayIdType::New()); conn->alloc(2*nbOfCells,1); - int *cp=conn->getPointer(); - for(std::size_t i=0;igetPointer(); + for(mcIdType i=0;i conn(DataArrayInt::New()); + mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1); + MCAuto conn(DataArrayIdType::New()); conn->alloc(4*n1*n2,1); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); std::size_t pos(0); - for(std::size_t j=0;j conn(DataArrayInt::New()); + mcIdType n1(nodeStBg[0]-1),n2(nodeStBg[1]-1),n3(nodeStBg[2]-1); + MCAuto conn(DataArrayIdType::New()); conn->alloc(8*n1*n2*n3,1); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); std::size_t pos(0); - for(std::size_t k=0;k ngs(3); - int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1),n2(nodeStBg[2]-1); ngs[0]=n0; ngs[1]=n1; ngs[2]=n2; - int off0(nodeStBg[0]),off1(nodeStBg[0]*nodeStBg[1]); - MCAuto conn(DataArrayInt::New()); + std::vector ngs(3); + mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1),n2(nodeStBg[2]-1); ngs[0]=n0; ngs[1]=n1; ngs[2]=n2; + mcIdType off0(nodeStBg[0]),off1(nodeStBg[0]*nodeStBg[1]); + MCAuto conn(DataArrayIdType::New()); conn->alloc(4*GetNumberOfCellsOfSubLevelMesh(ngs,3)); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); //X - for(int i=0;i& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf1D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) { if(st.size()!=1) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf1D : the input size of st must be equal to 1 !"); - int nxMin(std::numeric_limits::max()),nxMax(-std::numeric_limits::max()); - int nx(st[0]),ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()); + mcIdType nx(st[0]),ret(0); + for(mcIdType i=0;i& st, c /*! * \sa MEDCouplingStructuredMesh::FindMinimalPartOf */ -int MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) { if(st.size()!=2) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf2D : the input size of st must be equal to 2 !"); - int nxMin(std::numeric_limits::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()); - int it(0),nx(st[0]),ny(st[1]); - int ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()); + mcIdType it(0),nx(st[0]),ny(st[1]); + mcIdType ret(0); + for(mcIdType i=0;i& st, c /*! * \sa MEDCouplingStructuredMesh::FindMinimalPartOf */ -int MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) +mcIdType MEDCouplingStructuredMesh::FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat) { if(st.size()!=3) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindMinimalPartOf3D : the input size of st must be equal to 3 !"); - int nxMin(std::numeric_limits::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()),nzMin(std::numeric_limits::max()),nzMax(-std::numeric_limits::max()); - int it(0),nx(st[0]),ny(st[1]),nz(st[2]); - int ret(0); - for(int i=0;i::max()),nxMax(-std::numeric_limits::max()),nyMin(std::numeric_limits::max()),nyMax(-std::numeric_limits::max()),nzMin(std::numeric_limits::max()),nzMax(-std::numeric_limits::max()); + mcIdType it(0),nx(st[0]),ny(st[1]),nz(st[2]); + mcIdType ret(0); + for(mcIdType i=0;i& st, c * the meshDimension (or the zipped spaceDimension). * * \param [out] zipNodeSt - The zipped node structure - * \return int - the + * \return mcIdType - the */ -int MEDCouplingStructuredMesh::ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]) +int MEDCouplingStructuredMesh::ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3]) { - int spaceDim((int)std::distance(nodeStBg,nodeStEnd)); + std::size_t spaceDim(std::distance(nodeStBg,nodeStEnd)); if(spaceDim>3 || 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(int i=0;i ngs(2); - int n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; - int off0(nodeStBg[0]); - MCAuto conn(DataArrayInt::New()); + std::vector ngs(2); + mcIdType n0(nodeStBg[0]-1),n1(nodeStBg[1]-1); ngs[0]=n0; ngs[1]=n1; + mcIdType off0(nodeStBg[0]); + MCAuto conn(DataArrayIdType::New()); conn->alloc(2*GetNumberOfCellsOfSubLevelMesh(ngs,2)); - int *cp(conn->getPointer()); + mcIdType *cp(conn->getPointer()); //X - for(int i=0;i()); + std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+meshDim,0); } @@ -1226,28 +1226,28 @@ int MEDCouplingStructuredMesh::getCellIdFromPos(int i, int j, int k) const * \param [in] i - a index of node coordinates array along X axis. * \param [in] j - a index of node coordinates array along Y axis. * \param [in] k - a index of node coordinates array along Z axis. - * \return int - a node id in \a this mesh. + * \return mcIdType - a node id in \a this mesh. */ -int MEDCouplingStructuredMesh::getNodeIdFromPos(int i, int j, int k) const +mcIdType MEDCouplingStructuredMesh::getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const { - int tmp[3]={i,j,k}; - int tmp2[3]; - int spaceDim(getSpaceDimension()); + mcIdType tmp[3]={i,j,k}; + mcIdType tmp2[3]; + mcIdType spaceDim(getSpaceDimension()); getSplitNodeValues(tmp2); - std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies()); + std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies()); return std::accumulate(tmp,tmp+spaceDim,0); } -std::size_t MEDCouplingStructuredMesh::getNumberOfCells() const +mcIdType MEDCouplingStructuredMesh::getNumberOfCells() const { - std::vector ngs(getNodeGridStructure()); - std::size_t ret(1); + std::vector ngs(getNodeGridStructure()); + mcIdType ret(1); bool isCatched(false); std::size_t ii(0); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++) + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++) { - int 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 !"; @@ -1262,11 +1262,11 @@ std::size_t MEDCouplingStructuredMesh::getNumberOfCells() const return isCatched?ret:0; } -int MEDCouplingStructuredMesh::getNumberOfNodes() const +mcIdType MEDCouplingStructuredMesh::getNumberOfNodes() const { - std::vector ngs(getNodeGridStructure()); - int ret(1); - for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++) + std::vector ngs(getNodeGridStructure()); + mcIdType ret(1); + for(std::vector::const_iterator it=ngs.begin();it!=ngs.end();it++) ret*=*it; return ret; } @@ -1278,18 +1278,18 @@ int MEDCouplingStructuredMesh::getNumberOfNodes() const * \return - A vector of size this->getMeshDimension() * \throw if \a cellId not in [ 0, this->getNumberOfCells() ) */ -std::vector MEDCouplingStructuredMesh::getLocationFromCellId(int cellId) const +std::vector MEDCouplingStructuredMesh::getLocationFromCellId(mcIdType cellId) const { int meshDim(getMeshDimension()); - std::vector ret(meshDim); - std::vector struc(getCellGridStructure()); - int nbCells(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + std::vector ret(meshDim); + std::vector struc(getCellGridStructure()); + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector spt(GetSplitVectFromStruct(struc)); + std::vector spt(GetSplitVectFromStruct(struc)); GetPosFromId(cellId,meshDim,&spt[0],&ret[0]); return ret; } @@ -1301,37 +1301,37 @@ std::vector MEDCouplingStructuredMesh::getLocationFromCellId(int cellId) co * \return - A vector of size this->getSpaceDimension() * \throw if \a cellId not in [ 0, this->getNumberOfNodes() ) */ -std::vector MEDCouplingStructuredMesh::getLocationFromNodeId(int nodeId) const +std::vector MEDCouplingStructuredMesh::getLocationFromNodeId(mcIdType nodeId) const { int spaceDim(getSpaceDimension()); - std::vector ret(spaceDim); - std::vector struc(getNodeGridStructure()); - int nbNodes(std::accumulate(struc.begin(),struc.end(),1,std::multiplies())); + std::vector ret(spaceDim); + std::vector struc(getNodeGridStructure()); + 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 << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - std::vector spt(GetSplitVectFromStruct(struc)); + std::vector spt(GetSplitVectFromStruct(struc)); GetPosFromId(nodeId,spaceDim,&spt[0],&ret[0]); return ret; } -void MEDCouplingStructuredMesh::GetPosFromId(int eltId, int meshDim, const int *split, int *res) +void MEDCouplingStructuredMesh::GetPosFromId(mcIdType eltId, int meshDim, const mcIdType *split, mcIdType *res) { - int work(eltId); + mcIdType work(eltId); for(int i=meshDim-1;i>=0;i--) { - int pos=work/split[i]; + mcIdType pos=work/split[i]; work=work%split[i]; res[i]=pos; } } -std::vector MEDCouplingStructuredMesh::getCellGridStructure() const +std::vector MEDCouplingStructuredMesh::getCellGridStructure() const { - std::vector ret(getNodeGridStructure()); - std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus(),-1)); + std::vector ret(getNodeGridStructure()); + std::transform(ret.begin(),ret.end(),ret.begin(),std::bind2nd(std::plus(),-1)); return ret; } @@ -1340,7 +1340,7 @@ std::vector MEDCouplingStructuredMesh::getCellGridStructure() const */ double MEDCouplingStructuredMesh::computeSquareness() const { - std::vector cgs(getCellGridStructure()); + std::vector cgs(getCellGridStructure()); if(cgs.empty()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : empty mesh !"); std::size_t dim(cgs.size()); @@ -1348,7 +1348,7 @@ double MEDCouplingStructuredMesh::computeSquareness() const throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::computeSquareness : A segment cannot be square !"); if(dim<4) { - int minAx(cgs[0]),maxAx(cgs[0]); + mcIdType minAx(cgs[0]),maxAx(cgs[0]); for(std::size_t i=1;i MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector& strct) +std::vector MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::vector& strct) { - int spaceDim((int)strct.size()); - std::vector res(spaceDim); - for(int l=0;l res(spaceDim); + for(std::size_t l=0;l MEDCouplingStructuredMesh::GetSplitVectFromStruct(const std::ve * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt */ -bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat) +bool MEDCouplingStructuredMesh::IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat) { 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; + std::vector tmp2(dim),tmp(dim),tmp3(dim),tmp4(dim); tmp2[0]=1; for(int i=1;i=st[i]) @@ -1419,20 +1419,20 @@ bool MEDCouplingStructuredMesh::IsPartStructured(const int *startIds, const int return false; szExp*=tmp4[i]; } - if(szExp!=(int)sz) + if(szExp!=ToIdType(sz)) return false; - const int *w(startIds); + const mcIdType *w(startIds); switch(dim) { case 3: { - for(int i=0;i MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat) +std::vector MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat) { - std::vector ret(partCompactFormat.size()); + std::vector ret(partCompactFormat.size()); for(std::size_t i=0;ipartCompactFormat[i].second) @@ -1496,10 +1496,10 @@ std::vector MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(const s * \throw if there is an axis in \a dims that is < 0. * \sa GetDimensionsFromCompactFrmt, ChangeReferenceFromGlobalOfCompactFrmt, ChangeReferenceToGlobalOfCompactFrmt */ -std::vector< std::pair > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector& dims) +std::vector< std::pair > MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(const std::vector& dims) { std::size_t sz(dims.size()); - std::vector< std::pair > ret(sz); + std::vector< std::pair > ret(sz); for(std::size_t i=0;i > MEDCouplingStructuredMesh::GetCompactFrmtFromD * * \sa AreRangesIntersect */ -std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) +std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) { 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); + std::vector< std::pair > ret(sz); for(std::size_t i=0;ir1[i].second) @@ -1553,7 +1553,7 @@ std::vector< std::pair > MEDCouplingStructuredMesh::IntersectRanges(con * * \sa IntersectRanges */ -bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) +bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2) { std::size_t sz(r1.size()); if(sz!=r2.size()) @@ -1579,7 +1579,7 @@ bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair< } /*! - * This method is close to BuildExplicitIdsFrom except that instead of returning a DataArrayInt instance containing explicit ids it + * This method is close to BuildExplicitIdsFrom except that instead of returning a DataArrayIdType instance containing explicit ids it * enable elems in the vector of booleans (for performance reasons). As it is method for performance, this method is \b not * available in python. * @@ -1589,24 +1589,24 @@ bool MEDCouplingStructuredMesh::AreRangesIntersect(const std::vector< std::pair< * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, ExtractFieldOfBoolFrom */ -void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn) +void MEDCouplingStructuredMesh::SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn) { if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::SwitchOnIdsFrom : input arrays must have the same size !"); - if((int)vectToSwitchOn.size()!=DeduceNumberOfGivenStructure(st)) + if(ToIdType(vectToSwitchOn.size())!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::SwitchOnIdsFrom : invalid size of input vector of boolean regarding the structure !"); - std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); + std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); switch(st.size()) { case 3: { - for(int i=0;i& st, cons } case 2: { - for(int j=0;j& st, cons * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfDoubleFrom */ -void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut) +void MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut) { if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom : input arrays must have the same size !"); - if((int)fieldOfBool.size()!=DeduceNumberOfGivenStructure(st)) + if(ToIdType(fieldOfBool.size())!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfBoolFrom : invalid size of input field of boolean regarding the structure !"); - std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); + std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); + mcIdType nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)); fieldOut.resize(nbOfTuplesOfOutField); - int it(0); + mcIdType it(0); switch(st.size()) { case 3: { - for(int i=0;i& s } case 2: { - for(int j=0;j& s * * \sa MEDCouplingStructuredMesh::BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom */ -DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat) +DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat) { if(!fieldOfDbl || !fieldOfDbl->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input array of double is NULL or not allocated!"); @@ -1711,8 +1711,9 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : input arrays must have the same size !"); if(fieldOfDbl->getNumberOfTuples()!=DeduceNumberOfGivenStructure(st)) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom : invalid size of input array of double regarding the structure !"); - std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); - int nbOfTuplesOfOutField(DeduceNumberOfGivenStructure(dims)),nbComp(fieldOfDbl->getNumberOfComponents()); + std::vector dims(GetDimensionsFromCompactFrmt(partCompactFormat)); + 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()); @@ -1721,13 +1722,13 @@ DataArrayDouble *MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(const std:: { case 3: { - for(int i=0;i& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) +void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other) {//to be optimized - std::vector facts(st.size(),1.); + std::vector facts(st.size(),1); MEDCouplingIMesh::CondenseFineToCoarse(st,other,partCompactFormat,facts,fieldOfDbl); } @@ -1777,7 +1778,7 @@ void MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(const std::vector * * \sa ChangeReferenceToGlobalOfCompactFrmt, BuildExplicitIdsFrom, SwitchOnIdsFrom, ExtractFieldOfBoolFrom, ExtractFieldOfDoubleFrom */ -void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check) +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 dim(bigInAbs.size()); if(dim!=partOfBigInAbs.size()) @@ -1816,7 +1817,7 @@ void MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(const std * * \sa ChangeReferenceFromGlobalOfCompactFrmt */ -void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check) +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 dim(bigInAbs.size()); if(dim!=partOfBigRelativeToBig.size()) @@ -1855,12 +1856,12 @@ void MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(const std:: * * \sa FindTranslationFrom */ -std::vector< std::pair > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation) +std::vector< std::pair > MEDCouplingStructuredMesh::TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation) { 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); + std::vector< std::pair > ret(sz); for(std::size_t i=0;i > MEDCouplingStructuredMesh::TranslateCompactFrm /*! * \sa TranslateCompactFrmt */ -std::vector MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo) +std::vector MEDCouplingStructuredMesh::FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo) { std::size_t sz(startingFrom.size()); if(goingTo.size()!=sz) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::FindTranslationFrom : the sizes are not equal !"); - std::vector< int > ret(sz); + std::vector< mcIdType > ret(sz); for(std::size_t i=0;i MEDCouplingStructuredMesh::FindTranslationFrom(const std::vecto * This method builds the explicit entity array from the structure in \a st and the range in \a partCompactFormat. * If the range contains invalid values regarding structure an exception will be thrown. * - * \return DataArrayInt * - a new object. + * \return DataArrayIdType * - a new object. * \sa MEDCouplingStructuredMesh::IsPartStructured, MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt, SwitchOnIdsFrom, ExtractFieldOfBoolFrom, ExtractFieldOfDoubleFrom, MultiplyPartOf */ -DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat) +DataArrayIdType *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat) { if(st.size()!=partCompactFormat.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::BuildExplicitIdsFrom : input arrays must have the same size !"); - int nbOfItems(1); - std::vector dims(st.size()); + mcIdType nbOfItems(1); + std::vector dims(st.size()); for(std::size_t i=0;ist[i]) @@ -1909,20 +1910,20 @@ DataArrayInt *MEDCouplingStructuredMesh::BuildExplicitIdsFrom(const std::vector< dims[i]=partCompactFormat[i].second-partCompactFormat[i].first; nbOfItems*=dims[i]; } - MCAuto ret(DataArrayInt::New()); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfItems,1); - int *pt(ret->getPointer()); + mcIdType *pt(ret->getPointer()); switch(st.size()) { case 3: { - for(int i=0;i& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da) +void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da) { if(!da || !da->isAllocated()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : DataArrayDouble instance must be not NULL and allocated !"); if(st.size()!=part.size()) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : input arrays must have the same size !"); - std::vector dims(st.size()); + std::vector dims(st.size()); for(std::size_t i=0;ist[i]) @@ -1977,7 +1978,8 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::MultiplyPartOf : invalid input range 3 !"); dims[i]=part[i].second-part[i].first; } - int nbOfTuplesExp(MEDCouplingStructuredMesh::DeduceNumberOfGivenStructure(st)),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() << " !"; @@ -1988,15 +1990,15 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const { case 3: { - for(int i=0;i(),factor)); } } @@ -2005,12 +2007,12 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const } case 2: { - for(int j=0;j(),factor)); } } @@ -2018,9 +2020,9 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const } case 1: { - for(int k=0;k(),factor)); } break; @@ -2041,10 +2043,10 @@ void MEDCouplingStructuredMesh::MultiplyPartOf(const std::vector& st, const * * \sa MultiplyPartOf, PutInGhostFormat */ -void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, int ghostSize, double factor, DataArrayDouble *da) +void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, mcIdType ghostSize, double factor, DataArrayDouble *da) { - std::vector stWG; - std::vector< std::pair > partWG; + std::vector stWG; + std::vector< std::pair > partWG; PutInGhostFormat(ghostSize,st,part,stWG,partWG); MultiplyPartOf(stWG,partWG,factor,da); } @@ -2060,7 +2062,7 @@ void MEDCouplingStructuredMesh::MultiplyPartOfByGhost(const std::vector& st * * \sa MultiplyPartOf, PutInGhostFormat */ -void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost) +void MEDCouplingStructuredMesh::PutInGhostFormat(mcIdType ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : ghost size must be >= 0 !"); @@ -2071,7 +2073,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vecto if(part[i].first<0 || part[i].first>part[i].second || part[i].second>st[i]) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::PutInGhostFormat : the specified part is invalid ! The begin must be >= 0 and <= end ! The end must be <= to the size at considered dimension !"); stWithGhost.resize(st.size()); - std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus(),2*ghostSize)); + std::transform(st.begin(),st.end(),stWithGhost.begin(),std::bind2nd(std::plus(),2*ghostSize)); partWithGhost=part; ApplyGhostOnCompactFrmt(partWithGhost,ghostSize); } @@ -2080,7 +2082,7 @@ void MEDCouplingStructuredMesh::PutInGhostFormat(int ghostSize, const std::vecto * \param [in,out] partBeforeFact - the part of a image mesh in compact format that will be put in ghost reference. * \param [in] ghostSize - the ghost size of zone for all axis. */ -void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize) +void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize) { if(ghostSize<0) throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt : ghost size must be >= 0 !"); @@ -2092,12 +2094,12 @@ void MEDCouplingStructuredMesh::ApplyGhostOnCompactFrmt(std::vector< std::pair& cgs, int mdim) +mcIdType MEDCouplingStructuredMesh::GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim) { - int ret(0); + mcIdType ret(0); for(int i=0;i getAllGeoTypes() const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT std::vector getLocationFromCellId(int cellId) const; - MEDCOUPLING_EXPORT std::vector getLocationFromNodeId(int nodeId) const; - MEDCOUPLING_EXPORT static void GetPosFromId(int eltId, int meshDim, const int *split, int *res); - MEDCOUPLING_EXPORT static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim); - MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) 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; 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; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; + 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; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPart(const int *start, const int *end) const; - MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const; - MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); + 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(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const; //some useful methods MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const; - MEDCOUPLING_EXPORT int getCellIdFromPos(int i, int j, int k) const; - MEDCOUPLING_EXPORT int getNodeIdFromPos(int i, int j, int k) const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const; - MEDCOUPLING_EXPORT int getNumberOfNodes() 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; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodes() const; MEDCOUPLING_EXPORT int getMeshDimension() const; - MEDCOUPLING_EXPORT int getNumberOfCellsOfSubLevelMesh() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCellsOfSubLevelMesh() const; MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const; - MEDCOUPLING_EXPORT virtual void getNodeGridStructure(int *res) const = 0; - MEDCOUPLING_EXPORT virtual void getSplitCellValues(int *res) const; - MEDCOUPLING_EXPORT virtual void getSplitNodeValues(int *res) const; - MEDCOUPLING_EXPORT virtual std::vector getNodeGridStructure() const = 0; - MEDCOUPLING_EXPORT std::vector getCellGridStructure() const; + MEDCOUPLING_EXPORT virtual void getNodeGridStructure(mcIdType *res) const = 0; + MEDCOUPLING_EXPORT virtual void getSplitCellValues(mcIdType *res) const; + MEDCOUPLING_EXPORT virtual void getSplitNodeValues(mcIdType *res) const; + MEDCOUPLING_EXPORT virtual std::vector getNodeGridStructure() const = 0; + MEDCOUPLING_EXPORT std::vector getCellGridStructure() const; MEDCOUPLING_EXPORT double computeSquareness() const; - MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const = 0; - MEDCOUPLING_EXPORT static std::vector GetSplitVectFromStruct(const std::vector& strct); - MEDCOUPLING_EXPORT static bool IsPartStructured(const int *startIds, const int *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector< std::pair > GetCompactFrmtFromDimensions(const std::vector& dims); - MEDCOUPLING_EXPORT static std::vector< std::pair > IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); - MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); - MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn); - MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut); - MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other); - MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check=true); - MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check=true); - MEDCOUPLING_EXPORT static std::vector< std::pair > TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation); - MEDCOUPLING_EXPORT static std::vector FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo); - MEDCOUPLING_EXPORT static DataArrayInt *BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da); - MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, int ghostSize, double factor, DataArrayDouble *da); - MEDCOUPLING_EXPORT static void PutInGhostFormat(int ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost); - MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, int ghostSize); - MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd); - MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(const int *nodeStBg, const int *nodeStEnd); - MEDCOUPLING_EXPORT static DataArrayInt *ComputeCornersGhost(const std::vector& st, int ghostLev); - MEDCOUPLING_EXPORT static int DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static int DeduceNumberOfGivenStructure(const std::vector& st); - MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, int& sizeOfRange); - MEDCOUPLING_EXPORT static int FindMinimalPartOf(int minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat); - MEDCOUPLING_EXPORT static std::vector< std::vector > ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit); + MEDCOUPLING_EXPORT virtual MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair >& cellPart) const = 0; + MEDCOUPLING_EXPORT static std::vector GetSplitVectFromStruct(const std::vector& strct); + MEDCOUPLING_EXPORT static bool IsPartStructured(const mcIdType *startIds, const mcIdType *stopIds, const std::vector& st, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector GetDimensionsFromCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::pair > GetCompactFrmtFromDimensions(const std::vector& dims); + MEDCOUPLING_EXPORT static std::vector< std::pair > IntersectRanges(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static bool AreRangesIntersect(const std::vector< std::pair >& r1, const std::vector< std::pair >& r2); + MEDCOUPLING_EXPORT static void SwitchOnIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat, std::vector& vectToSwitchOn); + MEDCOUPLING_EXPORT static void ExtractFieldOfBoolFrom(const std::vector& st, const std::vector& fieldOfBool, const std::vector< std::pair >& partCompactFormat, std::vector& fieldOut); + MEDCOUPLING_EXPORT static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, const std::vector< std::pair >& partCompactFormat, const DataArrayDouble *other); + MEDCOUPLING_EXPORT static void ChangeReferenceFromGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigInAbs, std::vector< std::pair >& partOfBigRelativeToBig, bool check=true); + MEDCOUPLING_EXPORT static void ChangeReferenceToGlobalOfCompactFrmt(const std::vector< std::pair >& bigInAbs, const std::vector< std::pair >& partOfBigRelativeToBig, std::vector< std::pair >& partOfBigInAbs, bool check=true); + MEDCOUPLING_EXPORT static std::vector< std::pair > TranslateCompactFrmt(const std::vector< std::pair >& part, const std::vector& translation); + MEDCOUPLING_EXPORT static std::vector FindTranslationFrom(const std::vector< std::pair >& startingFrom, const std::vector< std::pair >& goingTo); + MEDCOUPLING_EXPORT static DataArrayIdType *BuildExplicitIdsFrom(const std::vector& st, const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static void MultiplyPartOf(const std::vector& st, const std::vector< std::pair >& part, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void MultiplyPartOfByGhost(const std::vector& st, const std::vector< std::pair >& part, mcIdType ghostSize, double factor, DataArrayDouble *da); + MEDCOUPLING_EXPORT static void PutInGhostFormat(mcIdType ghostSize, const std::vector& st, const std::vector< std::pair >& part, std::vector& stWithGhost, std::vector< std::pair >&partWithGhost); + MEDCOUPLING_EXPORT static void ApplyGhostOnCompactFrmt(std::vector< std::pair >& partBeforeFact, mcIdType ghostSize); + MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivity(const mcIdType *nodeStBg, const mcIdType *nodeStEnd); + MEDCOUPLING_EXPORT static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(const mcIdType *nodeStBg, const mcIdType *nodeStEnd); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeCornersGhost(const std::vector& st, mcIdType ghostLev); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static mcIdType DeduceNumberOfGivenStructure(const std::vector& st); + MEDCOUPLING_EXPORT static void FindTheWidestAxisOfGivenRangeInCompactFrmt(const std::vector< std::pair >& partCompactFormat, int& axisId, mcIdType& sizeOfRange); + MEDCOUPLING_EXPORT static mcIdType FindMinimalPartOf(mcIdType minPatchLgth, const std::vector& st, const std::vector& crit, std::vector& reducedCrit, std::vector< std::pair >& partCompactFormat); + MEDCOUPLING_EXPORT static std::vector< std::vector > ComputeSignaturePerAxisOf(const std::vector& st, const std::vector& crit); private: - static int GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim); - static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); - static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); - static void GetReverseNodalConnectivity3(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); - static DataArrayInt *Build1GTNodalConnectivity1D(const int *nodeStBg); - static DataArrayInt *Build1GTNodalConnectivity2D(const int *nodeStBg); - static DataArrayInt *Build1GTNodalConnectivity3D(const int *nodeStBg); - static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh2D(const int *nodeStBg); - static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh3D(const int *nodeStBg); - static int FindMinimalPartOf1D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); - static int FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); - static int FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType GetNumberOfCellsOfSubLevelMesh(const std::vector& cgs, int mdim); + static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static void GetReverseNodalConnectivity3(const std::vector& ngs, DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx); + static DataArrayIdType *Build1GTNodalConnectivity1D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivity2D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivity3D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh2D(const mcIdType *nodeStBg); + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh3D(const mcIdType *nodeStBg); + static mcIdType FindMinimalPartOf1D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf2D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); + static mcIdType FindMinimalPartOf3D(const std::vector& st, const std::vector& crit, std::vector< std::pair >& partCompactFormat); protected: - static int ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]); + static int ZipNodeStructure(const mcIdType *nodeStBg, const mcIdType *nodeStEnd, mcIdType zipNodeSt[3]); protected: MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(); MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy); diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx index 7e041ce71..8e213bfd0 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.cxx @@ -343,7 +343,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() cons return ret; } -MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector& compoIds) const +MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector& compoIds) const { std::vector arrays; getArrays(arrays); @@ -362,7 +362,7 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedCompon return ret; } -void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds) +void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds) { std::vector arrays1,arrays2; getArrays(arrays1); @@ -378,7 +378,7 @@ void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeD } } -void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue) +void MEDCouplingTimeDiscretization::changeNbOfComponents(std::size_t newNbOfComp, double dftValue) { std::vector arrays; getArrays(arrays); @@ -405,7 +405,7 @@ void MEDCouplingTimeDiscretization::sortPerTuple(bool asc) } } -void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value) +void MEDCouplingTimeDiscretization::setUniformValue(mcIdType nbOfTuple, int nbOfCompo, double value) { std::vector arrays; getArrays(arrays); @@ -430,7 +430,7 @@ void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo setArrays(arrays3,0); } -void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value) +void MEDCouplingTimeDiscretization::setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value) { std::vector arrays; getArrays(arrays); @@ -1168,12 +1168,12 @@ void MEDCouplingNoTimeLabel::setEndTime(double time, int iteration, int order) throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingNoTimeLabel::getValueOnTime(int 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(int 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); } @@ -1181,7 +1181,7 @@ void MEDCouplingNoTimeLabel::getValueOnDiscTime(int eltId, int iteration, int or /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingNoTimeLabel::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.clear(); } @@ -1198,7 +1198,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]; } @@ -1230,7 +1230,7 @@ void MEDCouplingWithTimeStep::synchronizeTimeWith(const MEDCouplingMesh *mesh) setTimeUnit(tUnit); } -void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingWithTimeStep::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_tk.getIteration()); @@ -1243,18 +1243,18 @@ void MEDCouplingWithTimeStep::getTinySerializationDbleInformation(std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingWithTimeStep::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS); _tk.setTimeValue(tinyInfoD[1]); - _tk.setIteration(tinyInfoI[2]); - _tk.setOrder(tinyInfoI[3]); + _tk.setIteration(FromIdType(tinyInfoI[2])); + _tk.setOrder(FromIdType(tinyInfoI[3])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingWithTimeStep::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(2); tinyInfo[0]=_tk.getIteration(); @@ -1274,10 +1274,10 @@ void MEDCouplingWithTimeStep::getTinySerializationDbleInformation2(std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingWithTimeStep::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _tk.setIteration(tinyInfoI[0]); - _tk.setOrder(tinyInfoI[1]); + _tk.setIteration(FromIdType(tinyInfoI[0])); + _tk.setOrder(FromIdType(tinyInfoI[1])); _time_tolerance=tinyInfoD[0]; _tk.setTimeValue(tinyInfoD[1]); } @@ -1593,7 +1593,7 @@ void MEDCouplingWithTimeStep::getValueForTime(double time, const std::vector_end); } -void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_start.getIteration()); @@ -1645,21 +1645,21 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation(std::ve tinyInfo.push_back(_end.getTimeValue()); } -void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingConstOnTimeInterval::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS); _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); - _start.setIteration(tinyInfoI[2]); - _start.setOrder(tinyInfoI[3]); - _end.setIteration(tinyInfoI[4]); - _end.setOrder(tinyInfoI[5]); + _start.setIteration(FromIdType(tinyInfoI[2])); + _start.setOrder(FromIdType(tinyInfoI[3])); + _end.setIteration(FromIdType(tinyInfoI[4])); + _end.setOrder(FromIdType(tinyInfoI[5])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingConstOnTimeInterval::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(4); tinyInfo[0]=_start.getIteration(); @@ -1682,12 +1682,12 @@ void MEDCouplingConstOnTimeInterval::getTinySerializationDbleInformation2(std::v /*! * idem finishUnserialization except that it is for multi field fetch */ -void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingConstOnTimeInterval::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _start.setIteration(tinyInfoI[0]); - _start.setOrder(tinyInfoI[1]); - _end.setIteration(tinyInfoI[2]); - _end.setOrder(tinyInfoI[3]); + _start.setIteration(FromIdType(tinyInfoI[0])); + _start.setOrder(FromIdType(tinyInfoI[1])); + _end.setIteration(FromIdType(tinyInfoI[2])); + _end.setOrder(FromIdType(tinyInfoI[3])); _time_tolerance=tinyInfoD[0]; _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); @@ -1812,7 +1812,7 @@ bool MEDCouplingConstOnTimeInterval::isEqualWithoutConsideringStr(const MEDCoupl return MEDCouplingTimeDiscretization::isEqualWithoutConsideringStr(other,prec); } -void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, double *value) const +void MEDCouplingConstOnTimeInterval::getValueOnTime(mcIdType eltId, double time, double *value) const { if(time>_start.getTimeValue()-_time_tolerance && time<_end.getTimeValue()+_time_tolerance) if(_array) @@ -1823,7 +1823,7 @@ void MEDCouplingConstOnTimeInterval::getValueOnTime(int eltId, double time, doub throw INTERP_KERNEL::Exception(EXCEPTION_MSG); } -void MEDCouplingConstOnTimeInterval::getValueOnDiscTime(int 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) @@ -2229,7 +2229,7 @@ void MEDCouplingTwoTimeSteps::setEndArray(DataArrayDouble *array, TimeLabel *own } } -void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector& tinyInfo) const +void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vector& tinyInfo) const { MEDCouplingTimeDiscretization::getTinySerializationIntInformation(tinyInfo); tinyInfo.push_back(_start.getIteration()); @@ -2239,7 +2239,7 @@ void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation(std::vectorgetNumberOfTuples()); - tinyInfo.push_back(_end_array->getNumberOfComponents()); + tinyInfo.push_back(ToIdType(_end_array->getNumberOfComponents())); } else { @@ -2257,14 +2257,14 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation(std::vector& tinyInfo) const { - int nbOfCompo=_array->getNumberOfComponents(); - for(int i=0;igetNumberOfComponents(); + for(std::size_t i=0;igetInfoOnComponent(i)); - for(int i=0;igetInfoOnComponent(i)); } -void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays) +void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& tinyInfoI, std::vector& arrays) { arrays.resize(2); if(_array!=0) @@ -2289,7 +2289,7 @@ void MEDCouplingTwoTimeSteps::resizeForUnserialization(const std::vector& t arrays[1]=arr; } -void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays) +void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& tinyInfoI, const std::vector& arrays) { static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size two !"; if(arrays.size()!=2) @@ -2315,21 +2315,21 @@ void MEDCouplingTwoTimeSteps::checkForUnserialization(const std::vector& ti } } -void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) +void MEDCouplingTwoTimeSteps::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS) { MEDCouplingTimeDiscretization::finishUnserialization(tinyInfoI,tinyInfoD,tinyInfoS); _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); - _start.setIteration(tinyInfoI[2]); - _start.setOrder(tinyInfoI[3]); - _end.setIteration(tinyInfoI[4]); - _end.setOrder(tinyInfoI[5]); + _start.setIteration(FromIdType(tinyInfoI[2])); + _start.setOrder(FromIdType(tinyInfoI[3])); + _end.setIteration(FromIdType(tinyInfoI[4])); + _end.setOrder(FromIdType(tinyInfoI[5])); } /*! * idem getTinySerializationIntInformation except that it is for multi field fetch */ -void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector& tinyInfo) const +void MEDCouplingTwoTimeSteps::getTinySerializationIntInformation2(std::vector& tinyInfo) const { tinyInfo.resize(4); tinyInfo[0]=_start.getIteration(); @@ -2352,12 +2352,12 @@ void MEDCouplingTwoTimeSteps::getTinySerializationDbleInformation2(std::vector& tinyInfoI, const std::vector& tinyInfoD) +void MEDCouplingTwoTimeSteps::finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) { - _start.setIteration(tinyInfoI[0]); - _start.setOrder(tinyInfoI[1]); - _end.setIteration(tinyInfoI[2]); - _end.setOrder(tinyInfoI[3]); + _start.setIteration(FromIdType(tinyInfoI[0])); + _start.setOrder(FromIdType(tinyInfoI[1])); + _end.setIteration(FromIdType(tinyInfoI[2])); + _end.setOrder(FromIdType(tinyInfoI[3])); _time_tolerance=tinyInfoD[0]; _start.setTimeValue(tinyInfoD[1]); _end.setTimeValue(tinyInfoD[2]); @@ -2459,8 +2459,8 @@ bool MEDCouplingLinearTime::areStrictlyCompatibleForDiv(const MEDCouplingTimeDis return true; if(_end_array==0 || otherC->_end_array==0) return false; - int nbC1=_end_array->getNumberOfComponents(); - int 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; @@ -2487,15 +2487,14 @@ void MEDCouplingLinearTime::getValueForTime(double time, const std::vector()); } -void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value) const +void MEDCouplingLinearTime::getValueOnTime(mcIdType eltId, double time, double *value) const { double alpha=(_end.getTimeValue()-time)/(_end.getTimeValue()-_start.getTimeValue()); - int nbComp; if(_array) _array->getTuple(eltId,value); else throw INTERP_KERNEL::Exception("No start array existing."); - nbComp=_array->getNumberOfComponents(); + std::size_t nbComp=_array->getNumberOfComponents(); std::transform(value,value+nbComp,value,std::bind2nd(std::multiplies(),alpha)); std::vector tmp(nbComp); if(_end_array) @@ -2506,7 +2505,7 @@ void MEDCouplingLinearTime::getValueOnTime(int eltId, double time, double *value std::transform(tmp.begin(),tmp.end(),value,value,std::plus()); } -void MEDCouplingLinearTime::getValueOnDiscTime(int eltId, int iteration, int order, double *value) const +void MEDCouplingLinearTime::getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const { if(iteration==_start.getIteration() && order==_start.getOrder()) { diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx index 8e7379d97..3a1d7b33d 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.hxx @@ -99,12 +99,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMul(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForDiv(const MEDCouplingTimeDiscretizationTemplate *other) const; MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretizationTemplate(); - MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation(std::vector& tinyInfo) const; + 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; - MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays); - MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT virtual void resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT virtual void checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays); + MEDCOUPLING_EXPORT virtual void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoD, const std::vector& tinyInfoS); protected: MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(); MEDCOUPLING_EXPORT MEDCouplingTimeDiscretizationTemplate(const MEDCouplingTimeDiscretizationTemplate& other, bool deepCopy); @@ -167,17 +167,17 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual void divideEqual(const MEDCouplingTimeDiscretization *other) = 0; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *pow(const MEDCouplingTimeDiscretization *other) const = 0; MEDCOUPLING_EXPORT virtual void powEqual(const MEDCouplingTimeDiscretization *other) = 0; - MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector& tinyInfo) const = 0; + MEDCOUPLING_EXPORT virtual void getTinySerializationIntInformation2(std::vector& tinyInfo) const = 0; MEDCOUPLING_EXPORT virtual void getTinySerializationDbleInformation2(std::vector& tinyInfo) const = 0; - MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) = 0; + MEDCOUPLING_EXPORT virtual void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD) = 0; MEDCOUPLING_EXPORT virtual void checkNoTimePresence() const = 0; MEDCOUPLING_EXPORT virtual void checkTimePresence(double time) const = 0; MEDCOUPLING_EXPORT virtual std::vector< const DataArrayDouble *> getArraysForTime(double time) const = 0; MEDCOUPLING_EXPORT virtual void getValueForTime(double time, const std::vector& vals, double *res) const = 0; MEDCOUPLING_EXPORT virtual bool isBefore(const MEDCouplingTimeDiscretization *other) const; MEDCOUPLING_EXPORT virtual bool isStrictlyBefore(const MEDCouplingTimeDiscretization *other) const; - MEDCOUPLING_EXPORT virtual void getValueOnTime(int eltId, double time, double *value) const = 0; - MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const = 0; + MEDCOUPLING_EXPORT virtual void getValueOnTime(mcIdType eltId, double time, double *value) const = 0; + MEDCOUPLING_EXPORT virtual void getValueOnDiscTime(mcIdType eltId, int iteration, int order, double *value) const = 0; // MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *computeVectorFieldCyl(const DataArrayDouble *coords, const double center[3], const double vect[3]) const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *doublyContractedProduct() const; @@ -190,12 +190,12 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *magnitude() const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *negate() const; MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *maxPerTuple() const; - MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector& compoIds) const; - MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds); - MEDCOUPLING_EXPORT virtual void changeNbOfComponents(int newNbOfComp, double dftValue); + MEDCOUPLING_EXPORT virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector& compoIds) const; + MEDCOUPLING_EXPORT virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds); + MEDCOUPLING_EXPORT virtual void changeNbOfComponents(std::size_t newNbOfComp, double dftValue); MEDCOUPLING_EXPORT virtual void sortPerTuple(bool asc); - MEDCOUPLING_EXPORT virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value); - MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value); + MEDCOUPLING_EXPORT virtual void setUniformValue(mcIdType nbOfTuple, int nbOfCompo, double value); + MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(mcIdType nbOfTuple, double value); MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId); MEDCOUPLING_EXPORT virtual void applyLin(double a, double b); MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func); @@ -311,11 +311,11 @@ namespace MEDCoupling 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(int eltId, double time, double *value) const; - MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) const; - MEDCOUPLING_EXPORT void getTinySerializationIntInformation2(std::vector& tinyInfo) 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 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 void finishUnserialization2(const std::vector& tinyInfoI, const std::vector& tinyInfoD); public: static const TypeOfTimeDiscretization DISCRETIZATION=NO_TIME; MEDCOUPLING_EXPORT static const char REPR[]; @@ -357,12 +357,12 @@ namespace MEDCoupling 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 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 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 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; @@ -378,8 +378,8 @@ namespace MEDCoupling 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(int eltId, double time, double *value) const; - MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) 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[]; @@ -396,12 +396,12 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT MEDCouplingConstOnTimeInterval(); MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingTimeDiscretizationTemplate& other); - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) 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 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 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; @@ -412,8 +412,8 @@ namespace MEDCoupling 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(int eltId, double time, double *value) const; - MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) 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; @@ -488,15 +488,15 @@ namespace MEDCoupling 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 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 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 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: @@ -523,8 +523,8 @@ namespace MEDCoupling 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(int eltId, double time, double *value) const; - MEDCOUPLING_EXPORT void getValueOnDiscTime(int eltId, int iteration, int order, double *value) 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; diff --git a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx index e66822e87..d17900a4d 100644 --- a/src/MEDCoupling/MEDCouplingTimeDiscretization.txx +++ b/src/MEDCoupling/MEDCouplingTimeDiscretization.txx @@ -148,8 +148,8 @@ namespace MEDCoupling return true; if(_array==0 || other->_array==0) return false; - int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); - int nbMin(std::min(nbC1,nbC2)); + std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); + std::size_t nbMin(std::min(nbC1,nbC2)); if(nbC1!=nbC2 && nbMin!=1) return false; return true; @@ -164,7 +164,7 @@ namespace MEDCoupling return true; if(_array==0 || other->_array==0) return false; - int nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); + std::size_t nbC1(_array->getNumberOfComponents()),nbC2(other->_array->getNumberOfComponents()); if(nbC1!=nbC2 && nbC2!=1) return false; return true; @@ -225,12 +225,12 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const + void MEDCouplingTimeDiscretizationTemplate::getTinySerializationIntInformation(std::vector& tinyInfo) const { if(_array) { tinyInfo.push_back(_array->getNumberOfTuples()); - tinyInfo.push_back(_array->getNumberOfComponents()); + tinyInfo.push_back(ToIdType(_array->getNumberOfComponents())); } else { @@ -248,13 +248,13 @@ namespace MEDCoupling template void MEDCouplingTimeDiscretizationTemplate::getTinySerializationStrInformation(std::vector& tinyInfo) const { - int nbOfCompo(_array->getNumberOfComponents()); - for(int i=0;igetNumberOfComponents()); + for(std::size_t i=0;igetInfoOnComponent(i)); } template - void MEDCouplingTimeDiscretizationTemplate::resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays) + void MEDCouplingTimeDiscretizationTemplate::resizeForUnserialization(const std::vector& tinyInfoI, std::vector::ArrayType *>& arrays) { arrays.resize(1); if(_array!=0) @@ -270,7 +270,7 @@ namespace MEDCoupling } template - void MEDCouplingTimeDiscretizationTemplate::checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays) + void MEDCouplingTimeDiscretizationTemplate::checkForUnserialization(const std::vector& tinyInfoI, const std::vector::ArrayType *>& arrays) { static const char MSG[]="MEDCouplingTimeDiscretization::checkForUnserialization : arrays in input is expected to have size one !"; if(arrays.size()!=1) @@ -289,11 +289,11 @@ 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]; - int nbOfCompo=_array->getNumberOfComponents(); - for(int i=0;igetNumberOfComponents(); + for(std::size_t i=0;isetInfoOnComponent(i,tinyInfoS[i]); } diff --git a/src/MEDCoupling/MEDCouplingTraits.hxx b/src/MEDCoupling/MEDCouplingTraits.hxx index e5961fe9a..9d10b48fa 100644 --- a/src/MEDCoupling/MEDCouplingTraits.hxx +++ b/src/MEDCoupling/MEDCouplingTraits.hxx @@ -23,6 +23,7 @@ #include "MEDCoupling.hxx" #include "MCType.hxx" +#include namespace MEDCoupling { @@ -42,8 +43,13 @@ namespace MEDCoupling class MEDCouplingFieldFloat; class MEDCouplingFieldInt; class DataArrayInt32Tuple; + class DataArrayInt64Tuple; class DataArrayFloatTuple; class DataArrayDoubleTuple; + class DataArrayByteTuple; + class DataArrayInt32Iterator; + class DataArrayInt64Iterator; + class DataArrayByteIterator; template<> struct MEDCOUPLING_EXPORT Traits @@ -83,6 +89,7 @@ namespace MEDCoupling typedef DataArrayInt32 ArrayTypeCh; typedef MEDCouplingFieldInt FieldType; typedef DataArrayInt32Tuple ArrayTuple; + typedef DataArrayInt32Iterator IteratorType; }; template<> @@ -96,7 +103,8 @@ namespace MEDCoupling typedef DataArrayInt64 ArrayType; typedef DataArrayInt64 ArrayTypeCh; //typedef MEDCouplingFieldInt64 FieldType; - //typedef DataArrayInt64Tuple ArrayTuple; + typedef DataArrayInt64Tuple ArrayTuple; + typedef DataArrayInt64Iterator IteratorType; }; template<> @@ -105,6 +113,8 @@ namespace MEDCoupling static const char ArrayTypeName[]; typedef DataArrayByte ArrayTypeCh; typedef DataArrayChar ArrayType; + typedef DataArrayByteTuple ArrayTuple; + typedef DataArrayByteIterator IteratorType; }; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx old mode 100644 new mode 100755 index 5b5ca7291..05eaf2661 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -57,7 +57,7 @@ double MEDCouplingUMesh::EPS_FOR_POLYH_ORIENTATION=1.e-14; /// @cond INTERNAL const INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::MEDMEM_ORDER[N_MEDMEM_ORDER] = { INTERP_KERNEL::NORM_POINT1, INTERP_KERNEL::NORM_SEG2, INTERP_KERNEL::NORM_SEG3, INTERP_KERNEL::NORM_SEG4, INTERP_KERNEL::NORM_POLYL, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_TRI7, INTERP_KERNEL::NORM_QUAD8, INTERP_KERNEL::NORM_QUAD9, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QPOLYG, INTERP_KERNEL::NORM_TETRA4, INTERP_KERNEL::NORM_PYRA5, INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXA8, INTERP_KERNEL::NORM_HEXGP12, INTERP_KERNEL::NORM_TETRA10, INTERP_KERNEL::NORM_PYRA13, INTERP_KERNEL::NORM_PENTA15, INTERP_KERNEL::NORM_PENTA18, INTERP_KERNEL::NORM_HEXA20, INTERP_KERNEL::NORM_HEXA27, INTERP_KERNEL::NORM_POLYHED }; -const int MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,32,-1,25,42,36,4}; +const mcIdType MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,32,-1,25,42,36,4}; /// @endcond MEDCouplingUMesh *MEDCouplingUMesh::New() @@ -108,7 +108,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::deepCopyConnectivityOnly() const { checkConnectivityFullyDefined(); MCAuto ret=clone(false); - MCAuto c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy()); + MCAuto c(getNodalConnectivity()->deepCopy()),ci(getNodalConnectivityIndex()->deepCopy()); ret->setConnectivity(c,ci); return ret.retn(); } @@ -176,7 +176,7 @@ void MEDCouplingUMesh::checkConsistencyLight() const MEDCouplingPointSet::checkConsistencyLight(); for(std::set::const_iterator iter=_types.begin();iter!=_types.end();iter++) { - if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).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 " << (*iter); @@ -227,22 +227,22 @@ void MEDCouplingUMesh::checkConsistency(double eps) const if(_mesh_dim==-1) return ; int meshDim=getMeshDimension(); - int nbOfNodes=getNumberOfNodes(); - int nbOfCells=getNumberOfCells(); - const int *ptr=_nodal_connec->getConstPointer(); - const int *ptrI=_nodal_connec_index->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *ptrI=_nodal_connec_index->getConstPointer(); + for(mcIdType i=0;i=0) { if(nodeId>=nbOfNodes) @@ -313,7 +313,7 @@ void MEDCouplingUMesh::setMeshDimension(int meshDim) * \ref medcouplingpyexamplesUmeshStdBuild1 "Here is a Python example". * \endif */ -void MEDCouplingUMesh::allocateCells(int nbOfCells) +void MEDCouplingUMesh::allocateCells(mcIdType nbOfCells) { if(nbOfCells<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::allocateCells : the input number of cells should be >= 0 !"); @@ -325,10 +325,10 @@ void MEDCouplingUMesh::allocateCells(int nbOfCells) { _nodal_connec->decrRef(); } - _nodal_connec_index=DataArrayInt::New(); + _nodal_connec_index=DataArrayIdType::New(); _nodal_connec_index->reserve(nbOfCells+1); _nodal_connec_index->pushBackSilent(0); - _nodal_connec=DataArrayInt::New(); + _nodal_connec=DataArrayIdType::New(); _nodal_connec->reserve(2*nbOfCells); _types.clear(); declareAsNew(); @@ -346,22 +346,22 @@ void MEDCouplingUMesh::allocateCells(int nbOfCells) * \ref medcouplingpyexamplesUmeshStdBuild1 "Here is a Python example". * \endif */ -void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell) +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==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::insertNextCell : nodal connectivity not set ! invoke allocateCells before calling insertNextCell !"); - if((int)cm.getDimension()==_mesh_dim) + if(ToIdType(cm.getDimension())==_mesh_dim) { if(!cm.isDynamic()) - if(size!=(int)cm.getNumberOfNodes()) + if(size!=ToIdType(cm.getNumberOfNodes())) { std::ostringstream oss; oss << "MEDCouplingUMesh::insertNextCell : Trying to push a " << cm.getRepr() << " cell with a size of " << size; oss << " ! Expecting " << cm.getNumberOfNodes() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - int idx=_nodal_connec_index->back(); - int 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); @@ -439,14 +439,14 @@ std::vector MEDCouplingUMesh::getAllGeoTypesS { std::vector ret; checkConnectivityFullyDefined(); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells==0) return ret; if(getNodalConnectivityArrayLen()<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getAllGeoTypesSorted : the connectivity in this seems invalid !"); - const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()); + const mcIdType *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()); ret.push_back((INTERP_KERNEL::NormalizedCellType)c[*ci++]); - for(int i=1;iuseArray(revNodalIndxPtr,true,DeallocType::C_DEALLOC,nbOfNodes+1,1); std::fill(revNodalIndxPtr,revNodalIndxPtr+nbOfNodes+1,0); - const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0); - for(int eltId=0;eltIdbegin()),*connIndex(_nodal_connec_index->begin()); + mcIdType nbOfCells(getNumberOfCells()),nbOfEltsInRevNodal(0); + for(mcIdType eltId=0;eltId=0)//for polyhedrons { nbOfEltsInRevNodal++; revNodalIndxPtr[(*iter)+1]++; } } - std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); - int *revNodalPtr=(int *)malloc((nbOfEltsInRevNodal)*sizeof(int)); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); + mcIdType *revNodalPtr=(mcIdType *)malloc(nbOfEltsInRevNodal*sizeof(mcIdType)); revNodal->useArray(revNodalPtr,true,DeallocType::C_DEALLOC,nbOfEltsInRevNodal,1); std::fill(revNodalPtr,revNodalPtr+nbOfEltsInRevNodal,-1); - for(int eltId=0;eltId=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; } } @@ -665,7 +665,7 @@ void MEDCouplingUMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataA * \endif * \sa buildDescendingConnectivity2() */ -MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const +MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const { return buildDescendingConnectivityGen(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer); } @@ -677,7 +677,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity(DataArrayInt *de * This method returns 4 arrays and a mesh as MEDCouplingUMesh::buildDescendingConnectivity does. * \sa MEDCouplingUMesh::buildDescendingConnectivity */ -MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const +MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const { checkFullyDefined(); if(getMeshDimension()!=3) @@ -691,7 +691,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::explode3DMeshTo1D(DataArrayInt *desc, DataAr * * \sa explode3DMeshTo1D, buildDescendingConnectiviy */ -MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const +MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const { checkFullyDefined(); switch(getMeshDimension()) @@ -756,7 +756,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayInt *desc * \endif * \sa buildDescendingConnectivity() */ -MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const +MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const { return buildDescendingConnectivityGen(desc,descIndx,revDesc,revDescIndx,MEDCouplingOrientationSensitiveNbrer); } @@ -777,18 +777,18 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivity2(DataArrayInt *d * \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be * dealt by the caller. This arrays allow to use the first output parameter \b neighbors (\ref numbering-indirect). */ -void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const +void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIndx) const { - MCAuto desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); meshDM1=0; ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx); } -void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI, MCAuto& cellNeigh, MCAuto& cellNeighIndex) const +void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto& cellNeigh, MCAuto& cellNeighIndex) const { if(!nodeNeigh || !nodeNeighI) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : null pointer !"); @@ -797,13 +797,13 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *n nodeNeigh->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh"); nodeNeighI->checkNbOfComps(1,"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : node neigh index"); nodeNeighI->checkNbOfTuples(1+getNumberOfNodes(),"MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne : invalid length"); - int nbCells(getNumberOfCells()); - const int *c(_nodal_connec->begin()),*ci(_nodal_connec_index->begin()),*ne(nodeNeigh->begin()),*nei(nodeNeighI->begin()); - cellNeigh=DataArrayInt::New(); cellNeigh->alloc(0,1); cellNeighIndex=DataArrayInt::New(); cellNeighIndex->alloc(1,1); cellNeighIndex->setIJ(0,0,0); - for(int i=0;ibegin()),*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;i s; - for(const int *it=c+ci[i]+1;it!=c+ci[i+1];it++) + std::set s; + for(const mcIdType *it=c+ci[i]+1;it!=c+ci[i+1];it++) if(*it>=0) s.insert(ne+nei[*it],ne+nei[*it+1]); s.erase(i); @@ -832,27 +832,27 @@ void MEDCouplingUMesh::computeCellNeighborhoodFromNodesOne(const DataArrayInt *n * parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx. * \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors. */ -void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descIndx, const DataArrayInt *revDesc, const DataArrayInt *revDescIndx, - DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) +void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descIndx, const DataArrayIdType *revDesc, const DataArrayIdType *revDescIndx, + DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIndx) { if(!desc || !descIndx || !revDesc || !revDescIndx) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeNeighborsOfCellsAdv some input array is empty !"); - const int *descPtr=desc->begin(); - const int *descIPtr=descIndx->begin(); - const int *revDescPtr=revDesc->begin(); - const int *revDescIPtr=revDescIndx->begin(); + const mcIdType *descPtr=desc->begin(); + const mcIdType *descIPtr=descIndx->begin(); + const mcIdType *revDescPtr=revDesc->begin(); + const mcIdType *revDescIPtr=revDescIndx->begin(); // - int nbCells=descIndx->getNumberOfTuples()-1; - MCAuto out0=DataArrayInt::New(); - MCAuto out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); - int *out1Ptr=out1->getPointer(); + mcIdType nbCells=descIndx->getNumberOfTuples()-1; + MCAuto out0=DataArrayIdType::New(); + MCAuto out1=DataArrayIdType::New(); out1->alloc(nbCells+1,1); + mcIdType *out1Ptr=out1->getPointer(); *out1Ptr++=0; out0->reserve(desc->getNumberOfTuples()); - for(int i=0;i s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]); + std::set s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]); s.erase(i); out0->insertAtTheEnd(s.begin(),s.end()); } @@ -865,11 +865,11 @@ void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, cons /*! * Explodes \a this into edges whatever its dimension. */ -MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const +MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const { checkFullyDefined(); int mdim(getMeshDimension()); - desc=DataArrayInt::New(); descIndex=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); + desc=DataArrayIdType::New(); descIndex=DataArrayIdType::New(); revDesc=DataArrayIdType::New(); revDescIndx=DataArrayIdType::New(); MCAuto mesh1D; switch(mdim) { @@ -908,11 +908,11 @@ MCAuto MEDCouplingUMesh::explodeIntoEdges(MCAuto * * \sa MEDCouplingUMesh::computeEnlargedNeighborsOfNodes */ -void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const +void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const { checkFullyDefined(); - int mdim(getMeshDimension()),nbNodes(getNumberOfNodes()); - MCAuto desc(DataArrayInt::New()),descIndx(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescIndx(DataArrayInt::New()); + mcIdType mdim(getMeshDimension()),nbNodes(getNumberOfNodes()); + MCAuto desc(DataArrayIdType::New()),descIndx(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescIndx(DataArrayIdType::New()); MCConstAuto mesh1D; switch(mdim) { @@ -936,15 +936,15 @@ void MEDCouplingUMesh::computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArr throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfNodes : Mesh dimension supported are [3,2,1] !"); } } - desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=0; revDescIndx=0; + desc=DataArrayIdType::New(); descIndx=DataArrayIdType::New(); revDesc=0; revDescIndx=0; mesh1D->getReverseNodalConnectivity(desc,descIndx); - MCAuto ret0(DataArrayInt::New()); + MCAuto ret0(DataArrayIdType::New()); ret0->alloc(desc->getNumberOfTuples(),1); - int *r0Pt(ret0->getPointer()); - const int *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin()); - for(int i=0;igetPointer()); + const mcIdType *c1DPtr(mesh1D->getNodalConnectivity()->begin()),*rn(desc->begin()),*rni(descIndx->begin()); + for(mcIdType i=0;i &neighbors, MCAuto& neighborsIdx) const +void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &neighbors, MCAuto& neighborsIdx) const { checkFullyDefined(); - int nbOfNodes(getNumberOfNodes()); - const int *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); - std::vector< std::set > st0(nbOfNodes); - for(int eltId=0;eltId s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons - for(std::set::const_iterator iter2=s.begin();iter2!=s.end();iter2++) + mcIdType nbOfNodes(getNumberOfNodes()); + const mcIdType *conn(_nodal_connec->begin()),*connIndex(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); + std::vector< std::set > st0(nbOfNodes); + for(mcIdType eltId=0;eltId s(strtNdlConnOfCurCell,endNdlConnOfCurCell); s.erase(-1); //for polyhedrons + for(std::set::const_iterator iter2=s.begin();iter2!=s.end();iter2++) st0[*iter2].insert(s.begin(),s.end()); } - neighborsIdx=DataArrayInt::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0); + neighborsIdx=DataArrayIdType::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0); { - int *neighIdx(neighborsIdx->getPointer()); - for(std::vector< std::set >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++) + mcIdType *neighIdx(neighborsIdx->getPointer()); + for(std::vector< std::set >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++) { if ((*it).empty()) neighIdx[1]=neighIdx[0]; else - neighIdx[1]=neighIdx[0]+(*it).size()-1; + neighIdx[1]=neighIdx[0]+ToIdType((*it).size())-1; } } - neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1); + neighbors=DataArrayIdType::New(); neighbors->alloc(neighborsIdx->back(),1); { - const int *neighIdx(neighborsIdx->begin()); - int *neigh(neighbors->getPointer()),nodeId(0); - for(std::vector< std::set >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++) + const mcIdType *neighIdx(neighborsIdx->begin()); + mcIdType *neigh(neighbors->getPointer()),nodeId(0); + for(std::vector< std::set >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++,nodeId++) { - std::set s(*it); s.erase(nodeId); + std::set s(*it); s.erase(nodeId); std::copy(s.begin(),s.end(),neigh+*neighIdx); } } @@ -1018,18 +1018,18 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto &nei * \ref py_mcumesh_convertToPolyTypes "Here is a Python example". * \endif */ -void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const int *cellIdsToConvertEnd) +void MEDCouplingUMesh::convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd) { checkFullyDefined(); int dim=getMeshDimension(); if(dim<2 || dim>3) throw INTERP_KERNEL::Exception("Invalid mesh dimension : must be 2 or 3 !"); - int nbOfCells(getNumberOfCells()); + mcIdType nbOfCells=getNumberOfCells(); if(dim==2) { - const int *connIndex=_nodal_connec_index->begin(); - int *conn=_nodal_connec->getPointer(); - for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) + const mcIdType *connIndex=_nodal_connec_index->begin(); + mcIdType *conn=_nodal_connec->getPointer(); + for(const mcIdType *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) { if(*iter>=0 && *itergetPointer()); - const int *connOld(_nodal_connec->getConstPointer()); - MCAuto connNew(DataArrayInt::New()),connNewI(DataArrayInt::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0); + mcIdType *connIndex(_nodal_connec_index->getPointer()); + const mcIdType *connOld(_nodal_connec->getConstPointer()); + MCAuto connNew(DataArrayIdType::New()),connNewI(DataArrayIdType::New()); connNew->alloc(0,1); connNewI->alloc(1,1); connNewI->setIJ(0,0,0); std::vector toBeDone(nbOfCells,false); - for(const int *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) + for(const mcIdType *iter=cellIdsToConvertBg;iter!=cellIdsToConvertEnd;iter++) { if(*iter>=0 && *iterpushBackValsSilent(tmp,tmp+newLgth); - connNewI->pushBackSilent(connNewI->back()+(int)newLgth); + connNewI->pushBackSilent(connNewI->back()+ToIdType(newLgth)); delete [] tmp; } else @@ -1109,11 +1109,11 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i */ void MEDCouplingUMesh::convertAllToPoly() { - int nbOfCells=getNumberOfCells(); - std::vector cellIds(nbOfCells); - for(int i=0;i cellIds(nbOfCells); + for(mcIdType i=0;i newCi=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto newCi=DataArrayIdType::New(); newCi->alloc(nbOfCells+1,1); - int *newci=newCi->getPointer(); - const int *ci=_nodal_connec_index->getConstPointer(); - const int *c=_nodal_connec->getConstPointer(); + mcIdType *newci=newCi->getPointer(); + const mcIdType *ci=_nodal_connec_index->getConstPointer(); + const mcIdType *c=_nodal_connec->getConstPointer(); newci[0]=0; - for(int i=0;i newC=DataArrayInt::New(); + MCAuto newC=DataArrayIdType::New(); newC->alloc(newci[nbOfCells],1); - int *newc=newC->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;igetPointer(); - int *index=_nodal_connec_index->getPointer(); - int posOfCurCell=0; - int newPos=0; - int lgthOfCurCell; + mcIdType initMeshLgth=getNodalConnectivityArrayLen(); + mcIdType *conn=_nodal_connec->getPointer(); + mcIdType *index=_nodal_connec_index->getPointer(); + mcIdType posOfCurCell=0; + mcIdType newPos=0; + mcIdType lgthOfCurCell; bool ret=false; - for(int i=0;i tmp=new int[lgthOfCurCell-1]; - std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(int *)tmp); + INTERP_KERNEL::AutoPtr tmp=new mcIdType[lgthOfCurCell-1]; + std::copy(conn+posOfCurCell+1,conn+posOfCurCell+lgthOfCurCell,(mcIdType *)tmp); newType=INTERP_KERNEL::CellSimplify::tryToUnPoly2D(cm.isQuadratic(),tmp,lgthOfCurCell-1,conn+newPos+1,newLgth); break; } case 3: { - int nbOfFaces,lgthOfPolyhConn; - INTERP_KERNEL::AutoPtr zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn); + mcIdType nbOfFaces,lgthOfPolyhConn; + INTERP_KERNEL::AutoPtr zipFullReprOfPolyh=INTERP_KERNEL::CellSimplify::getFullPolyh3DCell(type,conn+posOfCurCell+1,lgthOfCurCell-1,nbOfFaces,lgthOfPolyhConn); newType=INTERP_KERNEL::CellSimplify::tryToUnPoly3D(zipFullReprOfPolyh,nbOfFaces,lgthOfPolyhConn,conn+newPos+1,newLgth); break; } @@ -1307,19 +1307,19 @@ void MEDCouplingUMesh::simplifyPolyhedra(double eps) MCAuto coords=getCoords()->deepCopy(); coords->recenterForMaxPrecision(eps); // - int nbOfCells=getNumberOfCells(); - const int *conn=_nodal_connec->getConstPointer(); - const int *index=_nodal_connec_index->getConstPointer(); - MCAuto connINew=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *index=_nodal_connec_index->getConstPointer(); + MCAuto connINew=DataArrayIdType::New(); connINew->alloc(nbOfCells+1,1); - int *connINewPtr=connINew->getPointer(); *connINewPtr++=0; - MCAuto connNew=DataArrayInt::New(); connNew->alloc(0,1); - MCAuto E_Fi(DataArrayInt::New()), E_F(DataArrayInt::New()), F_Ei(DataArrayInt::New()), F_E(DataArrayInt::New()); + mcIdType *connINewPtr=connINew->getPointer(); *connINewPtr++=0; + MCAuto connNew=DataArrayIdType::New(); connNew->alloc(0,1); + MCAuto E_Fi(DataArrayIdType::New()), E_F(DataArrayIdType::New()), F_Ei(DataArrayIdType::New()), F_E(DataArrayIdType::New()); MCAuto m_faces(buildDescendingConnectivity(E_F, E_Fi, F_E, F_Ei)); bool changed=false; - for(int i=0;ibegin(),_nodal_connec->end())); - int maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1); + const mcIdType *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end())); + mcIdType maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1); std::vector retS(maxElt,false); computeNodeIdsAlg(retS); - return DataArrayInt::BuildListOfSwitchedOn(retS); + return DataArrayIdType::BuildListOfSwitchedOn(retS); } /*! @@ -1356,10 +1356,11 @@ DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const */ void MEDCouplingUMesh::computeNodeIdsAlg(std::vector& nodeIdsInUse) const { - int nbOfNodes((int)nodeIdsInUse.size()),nbOfCells(getNumberOfCells()); - const int *connIndex(_nodal_connec_index->getConstPointer()),*conn(_nodal_connec->getConstPointer()); - for(int i=0;igetConstPointer()),*conn(_nodal_connec->getConstPointer()); + for(mcIdType i=0;i=0) { if(conn[j]& nodeIdsInUse) const struct MEDCouplingAccVisit { MEDCouplingAccVisit():_new_nb_of_nodes(0) { } - int operator()(int val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; } - int _new_nb_of_nodes; + mcIdType operator()(mcIdType val) { if(val!=-1) return _new_nb_of_nodes++; else return -1; } + mcIdType _new_nb_of_nodes; }; /// @endcond @@ -1388,7 +1389,7 @@ struct MEDCouplingAccVisit * by excluding the unused nodes, for which the array holds -1. The result array is * a mapping in "Old to New" mode. * \param [out] nbrOfNodesInUse - number of node ids present in the nodal connectivity. - * \return DataArrayInt * - a new instance of DataArrayInt. Its length is \a + * \return DataArrayIdType * - a new instance of DataArrayIdType. Its length is \a * this->getNumberOfNodes(). It holds for each node of \a this mesh either -1 * if the node is unused or a new id else. The caller is to delete this * array using decrRef() as it is no more needed. @@ -1402,19 +1403,19 @@ struct MEDCouplingAccVisit * \endif * \sa computeFetchedNodeIds, computeNodeIdsAlg() */ -DataArrayInt *MEDCouplingUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const +DataArrayIdType *MEDCouplingUMesh::getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const { nbrOfNodesInUse=-1; - int nbOfNodes(getNumberOfNodes()); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfNodes(getNumberOfNodes()); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfNodes,1); - int *traducer=ret->getPointer(); + mcIdType *traducer=ret->getPointer(); std::fill(traducer,traducer+nbOfNodes,-1); - int nbOfCells=getNumberOfCells(); - const int *connIndex=_nodal_connec_index->getConstPointer(); - const int *conn=_nodal_connec->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + for(mcIdType i=0;i=0) { if(conn[j] ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *conn=getNodalConnectivity()->getConstPointer(); - const int *connI=getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;igetPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;i ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *conn=getNodalConnectivity()->getConstPointer(); - const int *connI=getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;i s(conn+connI[i]+1,conn+connI[i+1]); - if(conn[connI[i]]!=(int)INTERP_KERNEL::NORM_POLYHED) - *retPtr=(int)s.size(); + mcIdType *retPtr=ret->getPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;i s(conn+connI[i]+1,conn+connI[i+1]); + if(conn[connI[i]]!=ToIdType(INTERP_KERNEL::NORM_POLYHED)) + *retPtr=ToIdType(s.size()); else { s.erase(-1); - *retPtr=(int)s.size(); + *retPtr=ToIdType(s.size()); } } return ret.retn(); @@ -1494,16 +1495,16 @@ DataArrayInt *MEDCouplingUMesh::computeEffectiveNbOfNodesPerCell() const * * \return a newly allocated array */ -DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const +DataArrayIdType *MEDCouplingUMesh::computeNbOfFacesPerCell() const { checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); - const int *conn=getNodalConnectivity()->getConstPointer(); - const int *connI=getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;igetPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *connI=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;igetNumberOfNodes() before call of this method. The caller is to * delete this array using decrRef() as it is no more needed. * \throw If the coordinates array is not set. @@ -1528,7 +1529,7 @@ DataArrayInt *MEDCouplingUMesh::computeNbOfFacesPerCell() const * \ref py_mcumesh_zipCoordsTraducer "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingUMesh::zipCoordsTraducer() +DataArrayIdType *MEDCouplingUMesh::zipCoordsTraducer() { return MEDCouplingPointSet::zipCoordsTraducer(); } @@ -1537,7 +1538,7 @@ DataArrayInt *MEDCouplingUMesh::zipCoordsTraducer() * This method stands if 'cell1' and 'cell2' are equals regarding 'compType' policy. * The semantic of 'compType' is specified in MEDCouplingPointSet::zipConnectivityTraducer method. */ -int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1, int cell2, int compType) +int MEDCouplingUMesh::AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType) { switch(compType) { @@ -1558,7 +1559,7 @@ int MEDCouplingUMesh::AreCellsEqual(const int *conn, const int *connI, int cell1 /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 0. */ -int MEDCouplingUMesh::AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) return std::equal(conn+connI[cell1]+1,conn+connI[cell1+1],conn+connI[cell2]+1)?1:0; @@ -1568,9 +1569,9 @@ int MEDCouplingUMesh::AreCellsEqualPolicy0(const int *conn, const int *connI, in /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 1. */ -int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { - int 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]]) @@ -1581,11 +1582,11 @@ int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, in { if(dim!=1) { - int sz1=2*(sz-1); - INTERP_KERNEL::AutoPtr tmp=new int[sz1]; - int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp); + 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); - work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]); + work=std::search((mcIdType *)tmp,(mcIdType *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]); return work!=tmp+sz1?1:0; } else @@ -1601,14 +1602,14 @@ int MEDCouplingUMesh::AreCellsEqualPolicy1(const int *conn, const int *connI, in /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 2. */ -int MEDCouplingUMesh::AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) { if(conn[connI[cell1]]==conn[connI[cell2]]) { - std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set 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; } } @@ -1618,12 +1619,12 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2(const int *conn, const int *connI, in /*! * This method is less restrictive than AreCellsEqualPolicy2. Here the geometric type is absolutely not taken into account ! */ -int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { if(connI[cell1+1]-connI[cell1]==connI[cell2+1]-connI[cell2]) { - std::set s1(conn+connI[cell1]+1,conn+connI[cell1+1]); - std::set 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; @@ -1632,9 +1633,9 @@ int MEDCouplingUMesh::AreCellsEqualPolicy2NoType(const int *conn, const int *con /*! * This method is the last step of the MEDCouplingPointSet::zipConnectivityTraducer with policy 7. */ -int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2) +int MEDCouplingUMesh::AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2) { - int 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]]) @@ -1645,17 +1646,17 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in { if(dim!=1) { - int sz1=2*(sz-1); - INTERP_KERNEL::AutoPtr tmp=new int[sz1]; - int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp); + 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); - work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]); + work=std::search((mcIdType *)tmp,(mcIdType *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]); if(work!=tmp+sz1) return 1; else { - std::reverse_iterator it1((int *)tmp+sz1); - std::reverse_iterator it2((int *)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 @@ -1670,8 +1671,8 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in return 1; if(!cm.isQuadratic()) { - std::reverse_iterator it1(conn+connI[cell1+1]); - std::reverse_iterator 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; @@ -1709,33 +1710,33 @@ int MEDCouplingUMesh::AreCellsEqualPolicy7(const int *conn, const int *connI, in * \return the correspondence array old to new in a newly allocated array. * */ -void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const +void MEDCouplingUMesh::findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const { - MCAuto revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New(); + MCAuto revNodal=DataArrayIdType::New(),revNodalI=DataArrayIdType::New(); getReverseNodalConnectivity(revNodal,revNodalI); FindCommonCellsAlg(compType,startCellId,_nodal_connec,_nodal_connec_index,revNodal,revNodalI,commonCellsArr,commonCellsIArr); } -void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI, - DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) +void MEDCouplingUMesh::FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI, + DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) { - MCAuto commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New(); commonCells->alloc(0,1); - int nbOfCells=nodalI->getNumberOfTuples()-1; + MCAuto commonCells=DataArrayIdType::New(),commonCellsI=DataArrayIdType::New(); commonCells->alloc(0,1); + mcIdType nbOfCells=nodalI->getNumberOfTuples()-1; commonCellsI->reserve(1); commonCellsI->pushBackSilent(0); - const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer(); - const int *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer(); + const mcIdType *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer(); + const mcIdType *connPtr=nodal->getConstPointer(),*connIPtr=nodalI->getConstPointer(); std::vector isFetched(nbOfCells,false); if(startCellId==0) { - for(int i=0;i(),-1)); - std::vector v,v2; + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + std::vector v,v2; if(connOfNode!=connPtr+connIPtr[i+1]) { - const int *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); + const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); v2.insert(v2.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1]); connOfNode++; } @@ -1743,17 +1744,17 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(*connOfNode>=0) { v=v2; - const int *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); - std::vector::iterator it=std::set_intersection(v.begin(),v.end(),locRevNodal,revNodalPtr+revNodalIPtr[*connOfNode+1],v2.begin()); + const mcIdType *locRevNodal=std::find(revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1],i); + 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)) { - int pos=commonCellsI->back(); + mcIdType pos=commonCellsI->back(); commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); - for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) + for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } } @@ -1762,12 +1763,12 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D } else { - for(int i=startCellId;i(),-1)); - std::vector v,v2; + const mcIdType *connOfNode=std::find_if(connPtr+connIPtr[i]+1,connPtr+connIPtr[i+1],std::bind2nd(std::not_equal_to(),-1)); + std::vector v,v2; if(connOfNode!=connPtr+connIPtr[i+1]) { v2.insert(v2.end(),revNodalPtr+revNodalIPtr[*connOfNode],revNodalPtr+revNodalIPtr[*connOfNode+1]); @@ -1777,16 +1778,16 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D if(*connOfNode>=0) { v=v2; - std::vector::iterator 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)); } if(v2.size()>1) { if(AreCellsEqualInPool(v2,compType,connPtr,connIPtr,commonCells)) { - int pos=commonCellsI->back(); + mcIdType pos=commonCellsI->back(); commonCellsI->pushBackSilent(commonCells->getNumberOfTuples()); - for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++) + for(const mcIdType *it=commonCells->begin()+pos;it!=commonCells->end();it++) isFetched[*it]=true; } } @@ -1807,7 +1808,7 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D * \param [in] other - the mesh to compare with. * \param [in] compType - specifies a cell comparison technique. For meaning of its * valid values [0,1,2], see zipConnectivityTraducer(). - * \param [out] arr - a new instance of DataArrayInt returning correspondence + * \param [out] arr - a new instance of DataArrayIdType returning correspondence * between cells of the two meshes. It contains \a other->getNumberOfCells() * values. The caller is to delete this array using * decrRef() as it is no more needed. @@ -1821,10 +1822,10 @@ void MEDCouplingUMesh::FindCommonCellsAlg(int compType, int startCellId, const D * \sa checkDeepEquivalOnSameNodesWith() * \sa checkGeoEquivalWith() */ -bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const +bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); - int 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)) { @@ -1833,10 +1834,10 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com oss << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); + MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); arr=o2n->subArray(nbOfCells); arr->setName(other->getName()); - int tmp; + mcIdType tmp; if(other->getNumberOfCells()==0) return true; return arr->getMaxValue(tmp)getNumberOfCells()'. * \return If \a other is fully included in 'this 'true is returned. If not false is returned. */ -bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const +bool MEDCouplingUMesh::areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const { MCAuto mesh=MergeUMeshesOnSameCoords(this,other); - DataArrayInt *commonCells=0,*commonCellsI=0; - int thisNbCells=getNumberOfCells(); + DataArrayIdType *commonCells=0,*commonCellsI=0; + mcIdType thisNbCells=getNumberOfCells(); mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI); - MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); - int otherNbCells=other->getNumberOfCells(); - MCAuto arr2=DataArrayInt::New(); + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + const mcIdType *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer(); + mcIdType otherNbCells=other->getNumberOfCells(); + MCAuto arr2=DataArrayIdType::New(); arr2->alloc(otherNbCells,1); arr2->fillWithZero(); - int *arr2Ptr=arr2->getPointer(); - int nbOfCommon=commonCellsI->getNumberOfTuples()-1; - for(int i=0;igetPointer(); + mcIdType nbOfCommon=commonCellsI->getNumberOfTuples()-1; + for(mcIdType i=0;i0?1:-1; - int 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); } @@ -1914,13 +1915,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::mergeMyselfWithOnSameCoords(const MEDCouplin * \warning This method modifies can generate an unstructured mesh whose cells are not sorted by geometric type order. * In view of the MED file writing, a renumbering of cells of returned unstructured mesh (using MEDCouplingUMesh::sortCellsInMEDFileFrmt) should be necessary. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords) const { if(getMeshDimension()!=-1) return static_cast(MEDCouplingPointSet::buildPartOfMySelfSlice(start,end,step,keepCoords)); else { - int 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) @@ -1953,7 +1954,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfSlice(int start, int end, i * \ref py_mcumesh_buildPartOfMySelf "Here is a Python example". * \endif */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const int *end, bool keepCoords) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords) const { if(getMeshDimension()!=-1) return static_cast(MEDCouplingPointSet::buildPartOfMySelf(begin,end,keepCoords)); @@ -1980,7 +1981,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelf(const int *begin, const in * \param [in] otherOnSameCoordsThanThis an another mesh with same meshdimension than \b this with exactly the same number of cells than cell ids list in [\b cellIdsBg, \b cellIdsEnd ). * Coordinate pointer of \b this and those of \b otherOnSameCoordsThanThis must be the same */ -void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis) +void MEDCouplingUMesh::setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { checkConnectivityFullyDefined(); otherOnSameCoordsThanThis.checkConnectivityFullyDefined(); @@ -1992,19 +1993,19 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - std::size_t nbOfCellsToModify(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()); } - std::size_t nbOfCells(getNumberOfCells()); + mcIdType nbOfCells(getNumberOfCells()); bool easyAssign(true); - const int *connI(_nodal_connec_index->begin()); - const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin(); - for(const int *it=cellIdsBg;it!=cellIdsEnd && easyAssign;it++,connIOther++) + const mcIdType *connI(_nodal_connec_index->begin()); + const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->begin(); + for(const mcIdType *it=cellIdsBg;it!=cellIdsEnd && easyAssign;it++,connIOther++) { - if(*it>=0 && *it<(int)nbOfCells) + if(*it>=0 && *it arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); setConnectivity(arrOut,arrIOut,true); } } -void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) +void MEDCouplingUMesh::setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { checkConnectivityFullyDefined(); otherOnSameCoordsThanThis.checkConnectivityFullyDefined(); @@ -2041,18 +2042,18 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } - int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : "); - if(nbOfCellsToModify!=(int)otherOnSameCoordsThanThis.getNumberOfCells()) + 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()); } - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); bool easyAssign=true; - const int *connI=_nodal_connec_index->getConstPointer(); - const int *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer(); - int it=start; - for(int i=0;igetConstPointer(); + const mcIdType *connIOther=otherOnSameCoordsThanThis._nodal_connec_index->getConstPointer(); + mcIdType it=start; + for(mcIdType i=0;i=0 && it arrOutAuto(arrOut),arrIOutAuto(arrIOut); + MCAuto arrOutAuto(arrOut),arrIOutAuto(arrIOut); setConnectivity(arrOut,arrIOut,true); } } @@ -2104,10 +2105,10 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const * \ref py_mcumesh_buildFacePartOfMySelfNode "Here is a Python example". * \endif */ -MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const +MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const { - MCAuto desc,descIndx,revDesc,revDescIndx; - desc=DataArrayInt::New(); descIndx=DataArrayInt::New(); revDesc=DataArrayInt::New(); revDescIndx=DataArrayInt::New(); + 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=0; descIndx=0; revDesc=0; revDescIndx=0; return static_cast(subMesh->buildPartOfMySelfNode(begin,end,fullyIn)); @@ -2131,19 +2132,19 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildFacePartOfMySelfNode(const int *begin, */ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const { - DataArrayInt *desc=DataArrayInt::New(); - DataArrayInt *descIndx=DataArrayInt::New(); - DataArrayInt *revDesc=DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc=DataArrayIdType::New(); + DataArrayIdType *descIndx=DataArrayIdType::New(); + DataArrayIdType *revDesc=DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); // MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc->decrRef(); desc->decrRef(); descIndx->decrRef(); - int nbOfCells=meshDM1->getNumberOfCells(); - const int *revDescIndxC=revDescIndx->getConstPointer(); - std::vector boundaryCells; - for(int i=0;igetNumberOfCells(); + const mcIdType *revDescIndxC=revDescIndx->getConstPointer(); + std::vector boundaryCells; + for(mcIdType i=0;idecrRef(); @@ -2152,35 +2153,35 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const } /*! - * This method returns a newly created DataArrayInt instance containing ids of cells located in boundary. + * This method returns a newly created DataArrayIdType instance containing ids of cells located in boundary. * A cell is detected to be on boundary if it contains one or more than one face having only one father. * This method makes the assumption that \a this is fully defined (coords,connectivity). If not an exception will be thrown. */ -DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const +DataArrayIdType *MEDCouplingUMesh::findCellIdsOnBoundary() const { checkFullyDefined(); - MCAuto desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); // buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef(); - desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0; + desc=(DataArrayIdType*)0; descIndx=(DataArrayIdType*)0; // - MCAuto tmp=revDescIndx->deltaShiftIndex(); - MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayInt*)0; - const int *revDescPtr=revDesc->getConstPointer(); - const int *revDescIndxPtr=revDescIndx->getConstPointer(); - int nbOfCells=getNumberOfCells(); + MCAuto tmp=revDescIndx->deltaShiftIndex(); + MCAuto faceIds=tmp->findIdsEqual(1); tmp=(DataArrayIdType*)0; + const mcIdType *revDescPtr=revDesc->getConstPointer(); + const mcIdType *revDescIndxPtr=revDescIndx->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); std::vector ret1(nbOfCells,false); - int sz=0; - for(const int *pt=faceIds->begin();pt!=faceIds->end();pt++) + mcIdType sz=0; + for(const mcIdType *pt=faceIds->begin();pt!=faceIds->end();pt++) if(!ret1[revDescPtr[revDescIndxPtr[*pt]]]) { ret1[revDescPtr[revDescIndxPtr[*pt]]]=true; sz++; } // - DataArrayInt *ret2=DataArrayInt::New(); + DataArrayIdType *ret2=DataArrayIdType::New(); ret2->alloc(sz,1); - int *ret2Ptr=ret2->getPointer(); + mcIdType *ret2Ptr=ret2->getPointer(); sz=0; for(std::vector::const_iterator it=ret1.begin();it!=ret1.end();it++,sz++) if(*it) @@ -2207,7 +2208,7 @@ DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const * \param [out] cellIdsRk1 a newly allocated array containing the cell ids of s1 \b indexed into the \b cellIdsRk0 subset. To get the absolute ids of s1, simply invoke * cellIdsRk1->transformWithIndArr(cellIdsRk0->begin(),cellIdsRk0->end()); */ -void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const +void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const { if(getCoords()!=otherDimM1OnSameCoords.getCoords()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : coordinates pointer are not the same ! Use tryToShareSameCoords method !"); @@ -2215,21 +2216,21 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa otherDimM1OnSameCoords.checkConnectivityFullyDefined(); if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !"); - MCAuto fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); - MCAuto s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); + MCAuto fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); + MCAuto s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); MCAuto thisPart=static_cast(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true)); - MCAuto descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New(); + MCAuto descThisPart=DataArrayIdType::New(),descIThisPart=DataArrayIdType::New(),revDescThisPart=DataArrayIdType::New(),revDescIThisPart=DataArrayIdType::New(); MCAuto thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart); - const int *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer(); - DataArrayInt *idsOtherInConsti=0; + const mcIdType *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer(); + DataArrayIdType *idsOtherInConsti=0; bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti); - MCAuto idsOtherInConstiAuto(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(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) + std::set s1; + for(const mcIdType *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]); - MCAuto s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); + 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(); //cellIdsRk1=s_renum1.retn(); @@ -2244,21 +2245,21 @@ void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSa */ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const { - MCAuto desc=DataArrayInt::New(); - MCAuto descIndx=DataArrayInt::New(); - MCAuto revDesc=DataArrayInt::New(); - MCAuto revDescIndx=DataArrayInt::New(); + MCAuto desc=DataArrayIdType::New(); + MCAuto descIndx=DataArrayIdType::New(); + MCAuto revDesc=DataArrayIdType::New(); + MCAuto revDescIndx=DataArrayIdType::New(); // MCAuto meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); revDesc=0; desc=0; descIndx=0; - MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); - MCAuto part=revDescIndx2->findIdsEqual(1); + MCAuto revDescIndx2=revDescIndx->deltaShiftIndex(); + MCAuto part=revDescIndx2->findIdsEqual(1); return static_cast(meshDM1->buildPartOfMySelf(part->begin(),part->end(),true)); } /*! * Finds nodes lying on the boundary of \a this mesh. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of found * nodes. The caller is to delete this array using decrRef() as it is no * more needed. * \throw If the coordinates array is not set. @@ -2269,7 +2270,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::computeSkin() const * \ref py_mcumesh_findBoundaryNodes "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingUMesh::findBoundaryNodes() const +DataArrayIdType *MEDCouplingUMesh::findBoundaryNodes() const { MCAuto skin=computeSkin(); return skin->computeFetchedNodeIds(); @@ -2292,14 +2293,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildUnstructured() const * parameter is altered during the call. * \param [out] nodeIdsToDuplicate node ids needed to be duplicated following the algorithm explain above. * \param [out] cellIdsNeededToBeRenum cell ids in \b this in which the renumber of nodes should be performed. - * \param [out] cellIdsNotModified cell ids int \b this that lies on \b otherDimM1OnSameCoords mesh whose connectivity do \b not need to be modified as it is the case for \b cellIdsNeededToBeRenum. + * \param [out] cellIdsNotModified cell ids mcIdType \b this that lies on \b otherDimM1OnSameCoords mesh whose connectivity do \b not need to be modified as it is the case for \b cellIdsNeededToBeRenum. * * \warning This method modifies param \b otherDimM1OnSameCoords (for speed reasons). */ -void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, - DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const +void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *& nodeIdsToDuplicate, + DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const { - typedef MCAuto DAInt; + typedef MCAuto DAInt; typedef MCAuto MCUMesh; checkFullyDefined(); @@ -2310,7 +2311,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate : the mesh given in other parameter must have this->getMeshDimension()-1 !"); // Checking star-shaped M1 group: - DAInt dt0=DataArrayInt::New(),dit0=DataArrayInt::New(),rdt0=DataArrayInt::New(),rdit0=DataArrayInt::New(); + DAInt dt0=DataArrayIdType::New(),dit0=DataArrayIdType::New(),rdt0=DataArrayIdType::New(),rdit0=DataArrayIdType::New(); MCUMesh meshM2 = otherDimM1OnSameCoords.buildDescendingConnectivity(dt0, dit0, rdt0, rdit0); DAInt dsi = rdit0->deltaShiftIndex(); DAInt idsTmp0 = dsi->findIdsNotInRange(-1, 3); @@ -2323,7 +2324,7 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On 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!) - dt0=DataArrayInt::New(),dit0=DataArrayInt::New(),rdt0=DataArrayInt::New(),rdit0=DataArrayInt::New(); + dt0=DataArrayIdType::New(),dit0=DataArrayIdType::New(),rdt0=DataArrayIdType::New(),rdit0=DataArrayIdType::New(); MCUMesh m0desc = buildDescendingConnectivity(dt0, dit0, rdt0, rdit0); dt0=0; dit0=0; rdt0=0; dsi = rdit0->deltaShiftIndex(); DAInt boundSegs = dsi->findIdsEqual(1); // boundary segs/faces of the M0 mesh @@ -2333,10 +2334,10 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On DAInt notDup = 0; if (getMeshDimension() == 3) { - DAInt dnu1=DataArrayInt::New(), dnu2=DataArrayInt::New(), dnu3=DataArrayInt::New(), dnu4=DataArrayInt::New(); + DAInt dnu1=DataArrayIdType::New(), dnu2=DataArrayIdType::New(), dnu3=DataArrayIdType::New(), dnu4=DataArrayIdType::New(); MCUMesh m0descSkinDesc = m0descSkin->buildDescendingConnectivity(dnu1, dnu2, dnu3, dnu4); dnu1=0;dnu2=0;dnu3=0;dnu4=0; - DataArrayInt * corresp=0; + DataArrayIdType * corresp=0; meshM2->areCellsIncludedIn(m0descSkinDesc,2,corresp); DAInt validIds = corresp->findIdsInRange(0, meshM2->getNumberOfCells()); corresp->decrRef(); @@ -2360,23 +2361,23 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On // MCUMesh m0Part2=static_cast(buildPartOfMySelf(cellsAroundGroup->begin(),cellsAroundGroup->end(),true)); - int nCells2 = m0Part2->getNumberOfCells(); - DAInt desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New(); + mcIdType nCells2 = m0Part2->getNumberOfCells(); + DAInt desc00=DataArrayIdType::New(),descI00=DataArrayIdType::New(),revDesc00=DataArrayIdType::New(),revDescI00=DataArrayIdType::New(); MCUMesh m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); // Neighbor information of the mesh without considering the crack (serves to count how many connex pieces it is made of) - DataArrayInt *tmp00=0,*tmp11=0; + DataArrayIdType *tmp00=0,*tmp11=0; MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00, tmp00, tmp11); DAInt neighInit00(tmp00); DAInt neighIInit00(tmp11); // Neighbor information of the mesh WITH the crack (some neighbors are removed): - DataArrayInt *idsTmp=0; + DataArrayIdType *idsTmp=0; m01->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsTmp); DAInt ids(idsTmp); // 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): - DataArrayInt::RemoveIdsFromIndexedArrays(ids->begin(),ids->end(),desc00,descI00); - DataArrayInt *tmp0=0,*tmp1=0; + DataArrayIdType::RemoveIdsFromIndexedArrays(ids->begin(),ids->end(),desc00,descI00); + DataArrayIdType *tmp0=0,*tmp1=0; // Compute the neighbor of each cell in m0Part2, taking into account the broken link above. Two // cells on either side of the crack (defined by the mesh of low dimension) are not neighbor anymore. ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00,tmp0,tmp1); @@ -2384,11 +2385,11 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On DAInt neighI00(tmp1); // For each initial connex part of the sub-mesh (or said differently for each independent crack): - int seed = 0, nIter = 0; - int nIterMax = nCells2+1; // Safety net for the loop - DAInt hitCells = DataArrayInt::New(); hitCells->alloc(nCells2); + mcIdType seed = 0, nIter = 0; + mcIdType nIterMax = nCells2+1; // Safety net for the loop + DAInt hitCells = DataArrayIdType::New(); hitCells->alloc(nCells2); hitCells->fillWithValue(-1); - DAInt cellsToModifyConn0_torenum = DataArrayInt::New(); + DAInt cellsToModifyConn0_torenum = DataArrayIdType::New(); cellsToModifyConn0_torenum->alloc(0,1); while (nIter < nIterMax) { @@ -2396,14 +2397,14 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On if (!t->getNumberOfTuples()) break; // Connex zone without the crack (to compute the next seed really) - int dnu; + mcIdType dnu; DAInt connexCheck = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neighInit00,neighIInit00, -1, dnu); - std::size_t cnt(0); - for (int * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++) + mcIdType cnt(0); + for (mcIdType * ptr = connexCheck->getPointer(); cnt < connexCheck->getNumberOfTuples(); ptr++, cnt++) hitCells->setIJ(*ptr,0,1); // Connex zone WITH the crack (to identify cells lying on either part of the crack) DAInt spreadZone = MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(&seed, &seed+1, neigh00,neighI00, -1, dnu); - cellsToModifyConn0_torenum = DataArrayInt::Aggregate(cellsToModifyConn0_torenum, spreadZone, 0); + cellsToModifyConn0_torenum = DataArrayIdType::Aggregate(cellsToModifyConn0_torenum, spreadZone, 0); // Compute next seed, i.e. a cell in another connex part, which was not covered by the previous iterations DAInt comple = cellsToModifyConn0_torenum->buildComplement(nCells2); DAInt nonHitCells = hitCells->findIdsEqual(-1); @@ -2439,9 +2440,9 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On * \param [in] nodeIdsToDuplicateBg begin of node ids (included) to be duplicated in connectivity only * \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only */ -void MEDCouplingUMesh::duplicateNodes(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) +void MEDCouplingUMesh::duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd) { - int nbOfNodes=getNumberOfNodes(); + mcIdType nbOfNodes=getNumberOfNodes(); duplicateNodesInCoords(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd); duplicateNodesInConn(nodeIdsToDuplicateBg,nodeIdsToDuplicateEnd,nbOfNodes); } @@ -2454,16 +2455,16 @@ void MEDCouplingUMesh::duplicateNodes(const int *nodeIdsToDuplicateBg, const int * * \sa renumberNodesInConn */ -void MEDCouplingUMesh::renumberNodesWithOffsetInConn(int offset) +void MEDCouplingUMesh::renumberNodesWithOffsetInConn(mcIdType offset) { checkConnectivityFullyDefined(); - int *conn(getNodalConnectivity()->getPointer()); - const int *connIndex(getNodalConnectivityIndex()->getConstPointer()); - int nbOfCells(getNumberOfCells()); - for(int i=0;igetPointer()); + const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer()); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i=0)//avoid polyhedron separator { node+=offset; @@ -2474,23 +2475,23 @@ void MEDCouplingUMesh::renumberNodesWithOffsetInConn(int offset) } /*! - * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead + * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead * of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction * of a big mesh. */ -void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) +void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N) { - this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); + this->renumberNodesInConnT< INTERP_KERNEL::HashMap >(newNodeNumbersO2N); } /*! - * Same than renumberNodesInConn(const int *) except that here the format of old-to-new traducer is using map instead + * Same than renumberNodesInConn(const mcIdType *) except that here the format of old-to-new traducer is using map instead * of array. This method is dedicated for renumbering from a big set of nodes the a tiny set of nodes which is the case during extraction * of a big mesh. */ -void MEDCouplingUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) +void MEDCouplingUMesh::renumberNodesInConn(const std::map& newNodeNumbersO2N) { - this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); + this->renumberNodesInConnT< std::map >(newNodeNumbersO2N); } /*! @@ -2508,16 +2509,16 @@ void MEDCouplingUMesh::renumberNodesInConn(const std::map& newNodeNumbe * \ref py_mcumesh_renumberNodesInConn "Here is a Python example". * \endif */ -void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) +void MEDCouplingUMesh::renumberNodesInConn(const mcIdType *newNodeNumbersO2N) { checkConnectivityFullyDefined(); - int *conn=getNodalConnectivity()->getPointer(); - const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells(getNumberOfCells()); - for(int i=0;igetPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i=0)//avoid polyhedron separator { node=newNodeNumbersO2N[node]; @@ -2534,16 +2535,16 @@ void MEDCouplingUMesh::renumberNodesInConn(const int *newNodeNumbersO2N) * * \param [in] delta specifies the shift size applied to nodeId in nodal connectivity in \b this. */ -void MEDCouplingUMesh::shiftNodeNumbersInConn(int delta) +void MEDCouplingUMesh::shiftNodeNumbersInConn(mcIdType delta) { checkConnectivityFullyDefined(); - int *conn=getNodalConnectivity()->getPointer(); - const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for(int i=0;igetPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i=0)//avoid polyhedron separator { node+=delta; @@ -2569,23 +2570,23 @@ void MEDCouplingUMesh::shiftNodeNumbersInConn(int delta) * \param [in] nodeIdsToDuplicateEnd end of node ids (excluded) to be duplicated in connectivity only * \param [in] offset the offset applied to all node ids in connectivity that are in [ \a nodeIdsToDuplicateBg, \a nodeIdsToDuplicateEnd ). */ -void MEDCouplingUMesh::duplicateNodesInConn(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd, int offset) +void MEDCouplingUMesh::duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset) { checkConnectivityFullyDefined(); - std::map m; - int val=offset; - for(const int *work=nodeIdsToDuplicateBg;work!=nodeIdsToDuplicateEnd;work++,val++) + std::map m; + mcIdType val=offset; + for(const mcIdType *work=nodeIdsToDuplicateBg;work!=nodeIdsToDuplicateEnd;work++,val++) m[*work]=val; - int *conn=getNodalConnectivity()->getPointer(); - const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for(int i=0;igetPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i=0)//avoid polyhedron separator { - std::map::iterator it=m.find(node); + std::map::iterator it=m.find(node); if(it!=m.end()) node=(*it).second; } @@ -2610,34 +2611,34 @@ void MEDCouplingUMesh::duplicateNodesInConn(const int *nodeIdsToDuplicateBg, con * \param [in] old2NewBg is expected to be a dynamically allocated pointer of size at least equal to this->getNumberOfCells() * \param check */ -void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) +void MEDCouplingUMesh::renumberCells(const mcIdType *old2NewBg, bool check) { checkConnectivityFullyDefined(); - int nbCells=getNumberOfCells(); - const int *array=old2NewBg; + mcIdType nbCells=getNumberOfCells(); + const mcIdType *array=old2NewBg; if(check) - array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); + array=DataArrayIdType::CheckAndPreparePermutation(old2NewBg,old2NewBg+nbCells); // - const int *conn=_nodal_connec->getConstPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); - MCAuto o2n=DataArrayInt::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1); - MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); - const int *n2oPtr=n2o->begin(); - MCAuto newConn=DataArrayInt::New(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); + MCAuto o2n=DataArrayIdType::New(); o2n->useArray(array,false,DeallocType::C_DEALLOC,nbCells,1); + MCAuto n2o=o2n->invertArrayO2N2N2O(nbCells); + const mcIdType *n2oPtr=n2o->begin(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(_nodal_connec->getNumberOfTuples(),_nodal_connec->getNumberOfComponents()); newConn->copyStringInfoFrom(*_nodal_connec); - MCAuto newConnI=DataArrayInt::New(); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(_nodal_connec_index->getNumberOfTuples(),_nodal_connec_index->getNumberOfComponents()); newConnI->copyStringInfoFrom(*_nodal_connec_index); // - int *newC=newConn->getPointer(); - int *newCI=newConnI->getPointer(); - int loc=0; + mcIdType *newC=newConn->getPointer(); + mcIdType *newCI=newConnI->getPointer(); + mcIdType loc=0; newCI[0]=loc; - for(int i=0;i(array)); + free(const_cast(array)); } /*! @@ -2656,7 +2657,7 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) * \param [in] eps - a factor used to increase size of the bounding box of cell * before comparing it with \a bbox. This factor is multiplied by the maximal * extent of the bounding box of cell to produce an addition to this bounding box. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids for found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids for found * cells. The caller is to delete this array using decrRef() as it is no more * needed. * \throw If the coordinates array is not set. @@ -2667,9 +2668,9 @@ void MEDCouplingUMesh::renumberCells(const int *old2NewBg, bool check) * \ref py_mcumesh_getCellsInBoundingBox "Here is a Python example". * \endif */ -DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const +DataArrayIdType *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double eps) const { - MCAuto elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayIdType::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2677,11 +2678,11 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const double *bbox, double } int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr elem_bb=new double[2*dim]; - const int* conn = getNodalConnectivity()->getConstPointer(); - const int* conn_index= getNodalConnectivityIndex()->getConstPointer(); + const mcIdType* conn = getNodalConnectivity()->getConstPointer(); + const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for ( int ielem=0; ielem::max(); } - for (int inode=conn_index[ielem]+1; inode=0)//avoid polyhedron separator { for (int idim=0; idim elems=DataArrayInt::New(); elems->alloc(0,1); + MCAuto elems=DataArrayIdType::New(); elems->alloc(0,1); if(getMeshDimension()==-1) { elems->pushBackSilent(0); @@ -2728,11 +2729,11 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::Direc } int dim=getSpaceDimension(); INTERP_KERNEL::AutoPtr elem_bb=new double[2*dim]; - const int* conn = getNodalConnectivity()->getConstPointer(); - const int* conn_index= getNodalConnectivityIndex()->getConstPointer(); + const mcIdType* conn = getNodalConnectivity()->getConstPointer(); + const mcIdType* conn_index= getNodalConnectivityIndex()->getConstPointer(); const double* coords = getCoords()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - for ( int ielem=0; ielem::max(); } - for (int inode=conn_index[ielem]+1; inode=0)//avoid polyhedron separator { for (int idim=0; idimgetNumberOfCells() ). */ -INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(mcIdType cellId) const { - const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); + const mcIdType *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); if(cellId<_nodal_connec_index->getNbOfElems()-1) return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]]; else @@ -2791,20 +2792,20 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t ce * \param [in] type the geometric type * \return cell ids in this having geometric type \a type. */ -DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +DataArrayIdType *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(0,1); checkConnectivityFullyDefined(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); int mdim=getMeshDimension(); const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type); - if(mdim!=(int)cm.getDimension()) + if(mdim!=ToIdType(cm.getDimension())) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::giveCellsWithType : Mismatch between mesh dimension and dimension of the cell !"); - const int *ptI=_nodal_connec_index->getConstPointer(); - const int *pt=_nodal_connec->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *pt=_nodal_connec->getConstPointer(); + for(mcIdType i=0;ipushBackSilent(i); @@ -2815,11 +2816,11 @@ DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellT /*! * Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type. */ -std::size_t MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +mcIdType MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); - std::size_t nbOfCells(getNumberOfCells()),ret(0); - for(std::size_t i=0;ibegin()),*pt(_nodal_connec->begin()); + mcIdType nbOfCells(getNumberOfCells()),ret(0); + for(mcIdType i=0;igetNumberOfCells() ). */ -void MEDCouplingUMesh::getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const +void MEDCouplingUMesh::getNodeIdsOfCell(mcIdType cellId, std::vector& conn) const { - const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); - for(const int *w=pt+ptI[cellId]+1;w!=pt+ptI[cellId+1];w++) + const mcIdType *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); + for(const mcIdType *w=pt+ptI[cellId]+1;w!=pt+ptI[cellId+1];w++) if(*w>=0) conn.push_back(*w); } @@ -2938,17 +2939,17 @@ std::string MEDCouplingUMesh::reprConnectivityOfThis() const * This method analyzes the 3 arrays of \a this. For each the following behaviour is done : if the array is null a newly one is created * with number of tuples set to 0, if not the array is taken as this in the returned instance. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const +MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(std::size_t spaceDim) const { int mdim=getMeshDimension(); if(mdim<0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !"); MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); - MCAuto tmp1,tmp2; + MCAuto tmp1,tmp2; bool needToCpyCT=true; if(!_nodal_connec) { - tmp1=DataArrayInt::New(); tmp1->alloc(0,1); + tmp1=DataArrayIdType::New(); tmp1->alloc(0,1); needToCpyCT=false; } else @@ -2958,7 +2959,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const } if(!_nodal_connec_index) { - tmp2=DataArrayInt::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0); + tmp2=DataArrayIdType::New(); tmp2->alloc(1,1); tmp2->setIJ(0,0,0); needToCpyCT=false; } else @@ -2979,14 +2980,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const return ret.retn(); } -int MEDCouplingUMesh::getNumberOfNodesInCell(int cellId) const +mcIdType MEDCouplingUMesh::getNumberOfNodesInCell(mcIdType cellId) const { - const int *ptI=_nodal_connec_index->getConstPointer(); - const int *pt=_nodal_connec->getConstPointer(); + const mcIdType *ptI=_nodal_connec_index->getConstPointer(); + const mcIdType *pt=_nodal_connec->getConstPointer(); if(pt[ptI[cellId]]!=INTERP_KERNEL::NORM_POLYHED) return ptI[cellId+1]-ptI[cellId]-1; else - return (int)std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1)); + return ToIdType(std::count_if(pt+ptI[cellId]+1,pt+ptI[cellId+1],std::bind2nd(std::not_equal_to(),-1))); } /*! @@ -3000,13 +3001,13 @@ int MEDCouplingUMesh::getNumberOfNodesInCell(int cellId) const * \throw If the nodal connectivity of cells is not defined. * \sa getAllGeoTypes() */ -std::set MEDCouplingUMesh::getTypesOfPart(const int *begin, const int *end) const +std::set MEDCouplingUMesh::getTypesOfPart(const mcIdType *begin, const mcIdType *end) const { checkFullyDefined(); std::set ret; - const int *conn=_nodal_connec->getConstPointer(); - const int *connIndex=_nodal_connec_index->getConstPointer(); - for(const int *w=begin;w!=end;w++) + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); + for(const mcIdType *w=begin;w!=end;w++) ret.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]); return ret; } @@ -3022,10 +3023,10 @@ std::set MEDCouplingUMesh::getTypesOfPart(con * \param [in] isComputingTypes - if \c true, the set of types constituting \a this * mesh is updated. */ -void MEDCouplingUMesh::setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes) +void MEDCouplingUMesh::setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes) { - DataArrayInt::SetArrayIn(conn,_nodal_connec); - DataArrayInt::SetArrayIn(connIndex,_nodal_connec_index); + DataArrayIdType::SetArrayIn(conn,_nodal_connec); + DataArrayIdType::SetArrayIn(connIndex,_nodal_connec_index); if(isComputingTypes) computeTypes(); declareAsNew(); @@ -3065,10 +3066,10 @@ void MEDCouplingUMesh::computeTypes() /*! * Returns a number of cells constituting \a this mesh. - * \return int - the number of cells in \a this mesh. + * \return mcIdType - the number of cells in \a this mesh. * \throw If the nodal connectivity of cells is not defined. */ -std::size_t MEDCouplingUMesh::getNumberOfCells() const +mcIdType MEDCouplingUMesh::getNumberOfCells() const { if(_nodal_connec_index) return _nodal_connec_index->getNumberOfTuples()-1; @@ -3096,9 +3097,9 @@ int MEDCouplingUMesh::getMeshDimension() const * Returns a length of the nodal connectivity array. * This method is for test reason. Normally the integer returned is not useable by * user. For more info see \ref MEDCouplingUMeshNodalConnectivity. - * \return int - the length of the nodal connectivity array. + * \return mcIdType - the length of the nodal connectivity array. */ -int MEDCouplingUMesh::getNodalConnectivityArrayLen() const +mcIdType MEDCouplingUMesh::getNodalConnectivityArrayLen() const { return _nodal_connec->getNbOfElems(); } @@ -3106,10 +3107,10 @@ int MEDCouplingUMesh::getNodalConnectivityArrayLen() const /*! * First step of serialization process. Used by ParaMEDMEM and MEDCouplingCorba to transfert data between process. */ -void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const +void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const { MEDCouplingPointSet::getTinySerializationInformation(tinyInfoD,tinyInfo,littleStrings); - tinyInfo.push_back(getMeshDimension()); + tinyInfo.push_back(ToIdType(getMeshDimension())); tinyInfo.push_back(getNumberOfCells()); if(_nodal_connec) tinyInfo.push_back(getNodalConnectivityArrayLen()); @@ -3120,7 +3121,7 @@ void MEDCouplingUMesh::getTinySerializationInformation(std::vector& tiny /*! * First step of unserialization process. */ -bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const +bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const { return tinyInfo[6]<=0; } @@ -3132,7 +3133,7 @@ bool MEDCouplingUMesh::isEmptyMesh(const std::vector& tinyInfo) const * \param a2 * \param littleStrings */ -void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const +void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector& littleStrings) const { MEDCouplingPointSet::resizeForUnserialization(tinyInfo,a1,a2,littleStrings); if(tinyInfo[5]!=-1) @@ -3142,16 +3143,16 @@ void MEDCouplingUMesh::resizeForUnserialization(const std::vector& tinyInfo /*! * Third and final step of serialization process. */ -void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const +void MEDCouplingUMesh::serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const { MEDCouplingPointSet::serialize(a1,a2); if(getMeshDimension()>-1) { - a1=DataArrayInt::New(); + a1=DataArrayIdType::New(); a1->alloc(getNodalConnectivityArrayLen()+getNumberOfCells()+1,1); - int *ptA1=a1->getPointer(); - const int *conn=getNodalConnectivity()->getConstPointer(); - const int *index=getNodalConnectivityIndex()->getConstPointer(); + mcIdType *ptA1=a1->getPointer(); + const mcIdType *conn=getNodalConnectivity()->getConstPointer(); + const mcIdType *index=getNodalConnectivityIndex()->getConstPointer(); ptA1=std::copy(index,index+getNumberOfCells()+1,ptA1); std::copy(conn,conn+getNodalConnectivityArrayLen(),ptA1); } @@ -3163,18 +3164,18 @@ void MEDCouplingUMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const * Second and final unserialization process. * \param tinyInfo must be equal to the result given by getTinySerializationInformation method. */ -void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings) +void MEDCouplingUMesh::unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings) { MEDCouplingPointSet::unserialization(tinyInfoD,tinyInfo,a1,a2,littleStrings); - setMeshDimension(tinyInfo[5]); + setMeshDimension(FromIdType(tinyInfo[5])); if(tinyInfo[7]!=-1) { // Connectivity - const int *recvBuffer=a1->getConstPointer(); - MCAuto myConnecIndex=DataArrayInt::New(); + const mcIdType *recvBuffer=a1->getConstPointer(); + MCAuto myConnecIndex=DataArrayIdType::New(); myConnecIndex->alloc(tinyInfo[6]+1,1); std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer()); - MCAuto myConnec=DataArrayInt::New(); + MCAuto myConnec=DataArrayIdType::New(); myConnec->alloc(tinyInfo[7],1); std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer()); setConnectivity(myConnec, myConnecIndex); @@ -3199,7 +3200,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const { std::string name="MeasureOfMesh_"; name+=getName(); - int nbelem=getNumberOfCells(); + mcIdType nbelem=getNumberOfCells(); MCAuto field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); field->setName(name); MCAuto array=DataArrayDouble::New(); @@ -3210,17 +3211,17 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const field->synchronizeTimeWithMesh(); if(getMeshDimension()!=-1) { - int ipt; + mcIdType ipt; INTERP_KERNEL::NormalizedCellType type; int dim_space=getSpaceDimension(); const double *coords=getCoords()->getConstPointer(); - const int *connec=getNodalConnectivity()->getConstPointer(); - const int *connec_index=getNodalConnectivityIndex()->getConstPointer(); - for(int iel=0;ielgetConstPointer(); + const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType iel=0;iel(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space); + area_vol[iel]=INTERP_KERNEL::computeVolSurfOfCell2(type,connec+ipt+1,connec_index[iel+1]-ipt-1,coords,dim_space); } if(isAbs) std::transform(area_vol,area_vol+nbelem,area_vol,std::ptr_fun(fabs)); @@ -3252,28 +3253,28 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const * \endif * \sa getMeasureField() */ -DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *begin, const int *end) const +DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const { std::string name="PartMeasureOfMesh_"; name+=getName(); - int nbelem=(int)std::distance(begin,end); + std::size_t nbelem=std::distance(begin,end); MCAuto array=DataArrayDouble::New(); array->setName(name); array->alloc(nbelem,1); double *area_vol=array->getPointer(); if(getMeshDimension()!=-1) { - int ipt; + mcIdType ipt; INTERP_KERNEL::NormalizedCellType type; int dim_space=getSpaceDimension(); const double *coords=getCoords()->getConstPointer(); - const int *connec=getNodalConnectivity()->getConstPointer(); - const int *connec_index=getNodalConnectivityIndex()->getConstPointer(); - for(const int *iel=begin;iel!=end;iel++) + const mcIdType *connec=getNodalConnectivity()->getConstPointer(); + const mcIdType *connec_index=getNodalConnectivityIndex()->getConstPointer(); + for(const mcIdType *iel=begin;iel!=end;iel++) { ipt=connec_index[*iel]; type=(INTERP_KERNEL::NormalizedCellType)connec[ipt]; - *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space); + *area_vol++=INTERP_KERNEL::computeVolSurfOfCell2(type,connec+ipt+1,connec_index[*iel+1]-ipt-1,coords,dim_space); } if(isAbs) std::transform(array->getPointer(),area_vol,array->getPointer(),std::ptr_fun(fabs)); @@ -3305,10 +3306,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons MCAuto tmp=getMeasureField(isAbs); std::string name="MeasureOnNodeOfMesh_"; name+=getName(); - int nbNodes=getNumberOfNodes(); + mcIdType nbNodes=getNumberOfNodes(); MCAuto nnpc; { - MCAuto tmp(computeNbOfNodesPerCell()); + MCAuto tmp(computeNbOfNodesPerCell()); nnpc=tmp->convertToDblArr(); } std::for_each(nnpc->rwBegin(),nnpc->rwEnd(),[](double& v) { v=1./v; }); @@ -3319,13 +3320,13 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons double *valsToFill=array->getPointer(); std::fill(valsToFill,valsToFill+nbNodes,0.); const double *values=tmp->getArray()->getConstPointer(); - MCAuto da=DataArrayInt::New(); - MCAuto daInd=DataArrayInt::New(); + MCAuto da=DataArrayIdType::New(); + MCAuto daInd=DataArrayIdType::New(); getReverseNodalConnectivity(da,daInd); - const int *daPtr=da->getConstPointer(); - const int *daIPtr=daInd->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *daIPtr=daInd->getConstPointer(); + for(mcIdType i=0;isetMesh(this); ret->setArray(array); @@ -3355,12 +3356,12 @@ 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(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); int nbComp=getMeshDimension()+1; array->alloc(nbOfCells,nbComp); double *vals=array->getPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); - const int *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); const double *coords=_coords->getConstPointer(); if(getMeshDimension()==2) { @@ -3368,9 +3369,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { MCAuto loc=computeCellCenterOfMass(); const double *locPtr=loc->getConstPointer(); - for(int i=0;i(locPtr+3*i,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); double n=INTERP_KERNEL::norm<3>(vals); std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies(),1./n)); @@ -3380,16 +3381,16 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const { MCAuto isAbs=getMeasureField(false); const double *isAbsPtr=isAbs->getArray()->begin(); - for(int i=0;i0.?1.:-1.; } } } else//meshdimension==1 { double tmp[2]; - for(int i=0;i()); double n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); @@ -3428,7 +3429,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const * \ref py_mcumesh_buildPartOrthogonalField "Here is a Python example". * \endif */ -MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *begin, const int *end) const +MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const { if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2)) throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !"); @@ -3436,10 +3437,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be MCAuto array=DataArrayDouble::New(); std::size_t nbelems=std::distance(begin,end); int nbComp=getMeshDimension()+1; - array->alloc((int)nbelems,nbComp); + array->alloc(nbelems,nbComp); double *vals=array->getPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); - const int *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); const double *coords=_coords->getConstPointer(); if(getMeshDimension()==2) { @@ -3447,9 +3448,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be { MCAuto loc=getPartBarycenterAndOwner(begin,end); const double *locPtr=loc->getConstPointer(); - for(const int *i=begin;i!=end;i++,vals+=3,locPtr+=3) + for(const mcIdType *i=begin;i!=end;i++,vals+=3,locPtr+=3) { - int offset=connI[*i]; + mcIdType offset=connI[*i]; INTERP_KERNEL::crossprod<3>(locPtr,coords+3*conn[offset+1],coords+3*conn[offset+2],vals); double n=INTERP_KERNEL::norm<3>(vals); std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies(),1./n)); @@ -3464,9 +3465,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be else//meshdimension==1 { double tmp[2]; - for(const int *i=begin;i!=end;i++) + for(const mcIdType *i=begin;i!=end;i++) { - int 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 n=INTERP_KERNEL::norm<2>(tmp); std::transform(tmp,tmp+2,tmp,std::bind2nd(std::multiplies(),1./n)); @@ -3500,14 +3501,14 @@ 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(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); int spaceDim=getSpaceDimension(); array->alloc(nbOfCells,spaceDim); double *pt=array->getPointer(); const double *coo=getCoords()->getConstPointer(); - std::vector conn; + std::vector conn; conn.reserve(2); - for(int i=0;i candidates=getCellIdsCrossingPlane(origin,vec,eps); + MCAuto candidates=getCellIdsCrossingPlane(origin,vec,eps); if(candidates->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !"); - std::vector nodes; - DataArrayInt *cellIds1D=0; + std::vector nodes; + DataArrayIdType *cellIds1D=0; MCAuto subMesh=static_cast(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MCAuto desc1=DataArrayInt::New(),desc2=DataArrayInt::New(); - MCAuto descIndx1=DataArrayInt::New(),descIndx2=DataArrayInt::New(); - MCAuto revDesc1=DataArrayInt::New(),revDesc2=DataArrayInt::New(); - MCAuto revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New(); + MCAuto desc1=DataArrayIdType::New(),desc2=DataArrayIdType::New(); + MCAuto descIndx1=DataArrayIdType::New(),descIndx2=DataArrayIdType::New(); + 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=0; revDescIndx2=0; MCAuto mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3 revDesc1=0; revDescIndx1=0; mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MCAuto cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); + 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()); + std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(), mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()),cellIds2(DataArrayIdType::New()); connI->pushBackSilent(0); conn->alloc(0,1); cellIds2->alloc(0,1); subMesh->assemblyForSplitFrom3DSurf(cut3DSurf,desc2->getConstPointer(),descIndx2->getConstPointer(),conn,connI,cellIds2); if(cellIds2->empty()) @@ -3587,14 +3588,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3D(const double *origin, const dou /*! * Creates an 1D mesh by cutting \a this 2D mesh in 3D space with a plane. In -addition to the mesh, returns a new DataArrayInt, of length equal to the number of 1D cells in the result mesh, holding, for each cell in the result mesh, an id of a 2D cell it comes +addition to the mesh, returns a new DataArrayIdType, of length equal to the number of 1D cells in the result mesh, holding, for each cell in the result mesh, an id of a 2D cell it comes from. If a result segment is shared by two 2D cells, then the segment in included twice in the result mesh. * \param [in] origin - 3 components of a point defining location of the plane. * \param [in] vec - 3 components of a vector normal to the plane. Vector magnitude * must be greater than 1e-6. * \param [in] eps - half-thickness of the plane. - * \param [out] cellIds - a new instance of DataArrayInt holding ids of faces + * \param [out] cellIds - a new instance of DataArrayIdType holding ids of faces * producing correspondent segments. The caller is to delete this array * using decrRef() as it is no more needed. * \return MEDCouplingUMesh * - a new instance of MEDCouplingUMesh. This is an 1D @@ -3608,54 +3609,54 @@ the result mesh. * \throw If the plane does not intersect any 2D cell of \a this mesh. * \throw If \a this includes quadratic cells. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const +MEDCouplingUMesh *MEDCouplingUMesh::buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const { checkFullyDefined(); if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf works on umeshes with meshdim equal to 2 and spaceDim equal to 3 !"); - MCAuto candidates(getCellIdsCrossingPlane(origin,vec,eps)); + MCAuto candidates(getCellIdsCrossingPlane(origin,vec,eps)); 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; - DataArrayInt *cellIds1D(0); + std::vector nodes; + DataArrayIdType *cellIds1D(0); MCAuto subMesh(buildPartOfMySelf(candidates->begin(),candidates->end(),false)); subMesh->findNodesOnPlane(origin,vec,eps,nodes); - MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + 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 cellIds1DTmp(cellIds1D); + MCAuto cellIds1DTmp(cellIds1D); // - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); + for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++) cut3DCurve[*it]=-1; mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); - int ncellsSub=subMesh->getNumberOfCells(); - std::vector< std::pair > cut3DSurf(ncellsSub); + 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(), desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()),cellIds2(DataArrayIdType::New()); connI->pushBackSilent(0); conn->alloc(0,1); - const int *nodal=subMesh->getNodalConnectivity()->getConstPointer(); - const int *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;igetNodalConnectivity()->getConstPointer(); + const mcIdType *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;ipushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second); + conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second); connI->pushBackSilent(conn->getNumberOfTuples()); cellIds2->pushBackSilent(i); } else { - int cellId3DSurf=cut3DSurf[i].second; - int offset=nodalI[cellId3DSurf]+1; - int nbOfEdges=nodalI[cellId3DSurf+1]-offset; - for(int j=0;jpushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]); + conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG2)); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]); connI->pushBackSilent(conn->getNumberOfTuples()); cellIds2->pushBackSilent(cellId3DSurf); } @@ -3679,52 +3680,52 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double if(getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane works only on mesh containing exactly one cell !"); // - std::vector nodes; + std::vector nodes; findNodesOnPlane(origin,vec,eps,nodes); - MCAuto desc1(DataArrayInt::New()),desc2(DataArrayInt::New()),descIndx1(DataArrayInt::New()),descIndx2(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()),revDescIndx2(DataArrayInt::New()); + 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=0; revDescIndx2=0; MCAuto mDesc1(mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1));//meshDim==1 spaceDim==3 revDesc1=0; revDescIndx1=0; - DataArrayInt *cellIds1D(0); + DataArrayIdType *cellIds1D(0); mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D); - MCAuto cellIds1DTmp(cellIds1D); - std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); - for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) + MCAuto cellIds1DTmp(cellIds1D); + std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); + for(const mcIdType *it=cellIds1D->begin();it!=cellIds1D->end();it++) cut3DCurve[*it]=-1; bool sameNbNodes; { - int oldNbNodes(mDesc1->getNumberOfNodes()); + mcIdType oldNbNodes(mDesc1->getNumberOfNodes()); mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); sameNbNodes=(mDesc1->getNumberOfNodes()==oldNbNodes); } - std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); + std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->begin(),mDesc2->getNodalConnectivityIndex()->begin(), mDesc1->getNodalConnectivity()->begin(),mDesc1->getNodalConnectivityIndex()->begin(), desc1->begin(),descIndx1->begin(),cut3DSurf); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); connI->pushBackSilent(0); conn->alloc(0,1); { - MCAuto cellIds2(DataArrayInt::New()); cellIds2->alloc(0,1); + MCAuto cellIds2(DataArrayIdType::New()); cellIds2->alloc(0,1); assemblyForSplitFrom3DSurf(cut3DSurf,desc2->begin(),descIndx2->begin(),conn,connI,cellIds2); if(cellIds2->empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane !"); } - std::vector > res; + std::vector > res; buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res); std::size_t sz(res.size()); - if(res.size()==mDesc1->getNumberOfCells() && sameNbNodes) + if(ToIdType(res.size())==mDesc1->getNumberOfCells() && sameNbNodes) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !"); for(std::size_t i=0;ipushBackSilent((int)INTERP_KERNEL::NORM_POLYGON); + conn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYGON)); conn->insertAtTheEnd(res[i].begin(),res[i].end()); connI->pushBackSilent(conn->getNumberOfTuples()); } MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(mDesc1->getCoords()); ret->setConnectivity(conn,connI,true); - int 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()); @@ -3740,13 +3741,13 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double vec2->setPartOfValuesSimple1(vec[0],0,nbCellsRet,1,0,1,1); vec2->setPartOfValuesSimple1(vec[1],0,nbCellsRet,1,1,2,1); vec2->setPartOfValuesSimple1(vec[2],0,nbCellsRet,1,2,3,1); MCAuto dott2(DataArrayDouble::Dot(occm,vec2)); // - const int *cPtr(ret->getNodalConnectivity()->begin()),*ciPtr(ret->getNodalConnectivityIndex()->begin()); + const mcIdType *cPtr(ret->getNodalConnectivity()->begin()),*ciPtr(ret->getNodalConnectivityIndex()->begin()); MCAuto ret2(MEDCouplingUMesh::New("Clip3D",3)); ret2->setCoords(mDesc1->getCoords()); - MCAuto conn2(DataArrayInt::New()),conn2I(DataArrayInt::New()); + MCAuto conn2(DataArrayIdType::New()),conn2I(DataArrayIdType::New()); conn2I->pushBackSilent(0); conn2->alloc(0,1); - std::vector cell0(1,(int)INTERP_KERNEL::NORM_POLYHED); - std::vector cell1(1,(int)INTERP_KERNEL::NORM_POLYHED); + std::vector cell0(1,ToIdType(INTERP_KERNEL::NORM_POLYHED)); + std::vector cell1(1,ToIdType(INTERP_KERNEL::NORM_POLYHED)); if(dott->getIJ(0,0)>0) { cell0.insert(cell0.end(),cPtr+1,cPtr+ciPtr[1]); @@ -3757,7 +3758,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double cell1.insert(cell1.end(),cPtr+1,cPtr+ciPtr[1]); std::reverse_copy(cPtr+1,cPtr+ciPtr[1],std::inserter(cell0,cell0.end())); } - for(int i=1;igetIJ(i,0)<0) { @@ -3792,7 +3793,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double * \param [in] vec - 3 components of a vector normal to the plane. Vector magnitude * must be greater than 1e-6. * \param [in] eps - half-thickness of the plane. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of the found + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of the found * cells. The caller is to delete this array using decrRef() as it is no more * needed. * \throw If the coordinates array is not set. @@ -3801,7 +3802,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double * \throw If magnitude of \a vec is less than 1e-6. * \sa buildSlice3D() */ -DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const +DataArrayIdType *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const { checkFullyDefined(); if(getSpaceDimension()!=3) @@ -3812,7 +3813,7 @@ DataArrayInt *MEDCouplingUMesh::getCellIdsCrossingPlane(const double *origin, co 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 angle=acos(vec[2]/normm); - MCAuto cellIds; + MCAuto cellIds; double bbox[6]; if(angle>eps) { @@ -3846,12 +3847,12 @@ bool MEDCouplingUMesh::isContiguous1D() const { if(getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense only for 1D mesh !"); - int nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); if(nbCells<1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::isContiguous1D : this method has a sense for non empty mesh !"); - const int *connI(_nodal_connec_index->begin()),*conn(_nodal_connec->begin()); - int ref=conn[connI[0]+2]; - for(int i=1;ibegin()),*conn(_nodal_connec->begin()); + mcIdType ref=conn[connI[0]+2]; + for(mcIdType i=1;i f=buildDirectionVectorField(); const double *fPtr=f->getArray()->getConstPointer(); double tmp[3]; - for(std::size_t i=0;igetConstPointer(); - for(int i=0;i()); std::transform(tmp,tmp+3,v,tmp,std::multiplies()); @@ -3920,7 +3921,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps, * dimension - 1. * \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoints */ -double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, int& cellId) const +double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const { int meshDim=getMeshDimension(),spaceDim=getSpaceDimension(); if(meshDim!=spaceDim-1) @@ -3928,12 +3929,12 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd if(meshDim!=2 && meshDim!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoint : only mesh dimension 2 and 1 are implemented !"); checkFullyDefined(); - if((int)std::distance(ptBg,ptEnd)!=spaceDim) + 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()); } - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; MCAuto pts=DataArrayDouble::New(); pts->useArray(ptBg,false,DeallocType::C_DEALLOC,1,spaceDim); MCAuto ret0=distanceToPoints(pts,ret1); - MCAuto ret1Safe(ret1); + MCAuto ret1Safe(ret1); cellId=*ret1Safe->begin(); return *ret0->begin(); } @@ -3959,7 +3960,7 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd * \throw if mesh dimension of \a this is not equal to space dimension - 1. * \sa DataArrayDouble::distanceToTuple, MEDCouplingUMesh::distanceToPoint */ -DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const +DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const { if(!pts) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : input points pointer is NULL !"); @@ -3969,20 +3970,20 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints works only for spaceDim=meshDim+1 !"); if(meshDim!=2 && meshDim!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : only mesh dimension 2 and 1 are implemented !"); - if((int)pts->getNumberOfComponents()!=spaceDim) + if(ToIdType(pts->getNumberOfComponents())!=spaceDim) { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoints : input pts DataArrayDouble has " << pts->getNumberOfComponents() << " components whereas it should be equal to " << spaceDim << " (mesh spaceDimension) !"; throw INTERP_KERNEL::Exception(oss.str()); } checkFullyDefined(); - int nbCells=getNumberOfCells(); + mcIdType nbCells=getNumberOfCells(); if(nbCells==0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoints : no cells in this !"); - int nbOfPts=pts->getNumberOfTuples(); + mcIdType nbOfPts=pts->getNumberOfTuples(); MCAuto ret0=DataArrayDouble::New(); ret0->alloc(nbOfPts,1); - MCAuto ret1=DataArrayInt::New(); ret1->alloc(nbOfPts,1); - const int *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); - double *ret0Ptr=ret0->getPointer(); int *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin(); + MCAuto ret1=DataArrayIdType::New(); ret1->alloc(nbOfPts,1); + const mcIdType *nc=_nodal_connec->begin(),*ncI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); + double *ret0Ptr=ret0->getPointer(); mcIdType *ret1Ptr=ret1->getPointer(); const double *ptsPtr=pts->begin(); MCAuto bboxArr(getBoundingBoxForBBTree()); const double *bbox(bboxArr->begin()); switch(spaceDim) @@ -3990,10 +3991,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, case 3: { BBTreeDst<3> myTree(bbox,0,0,nbCells); - for(int i=0;i::max(); - std::vector elems; + std::vector elems; myTree.getMinDistanceOfMax(ptsPtr,x); myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems); DistanceToPoint3DSurfAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr); @@ -4003,10 +4004,10 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, case 2: { BBTreeDst<2> myTree(bbox,0,0,nbCells); - for(int i=0;i::max(); - std::vector elems; + std::vector elems; myTree.getMinDistanceOfMax(ptsPtr,x); myTree.getElemsWhoseMinDistanceToPtSmallerThan(ptsPtr,x,elems); DistanceToPoint2DCurveAlg(ptsPtr,&elems[0],&elems[0]+elems.size(),coords,nc,ncI,*ret0Ptr,*ret1Ptr); @@ -4034,14 +4035,14 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, * faster. * \param [in] pos - array of coordinates of the ball central point. * \param [in] eps - ball radius. - * \return int - a smallest id of cells being in contact with the ball, -1 in case + * \return mcIdType - a smallest id of cells being in contact with the ball, -1 in case * if there are no such cells. * \throw If the coordinates array is not set. * \throw If \a this->getMeshDimension() != \a this->getSpaceDimension(). */ -int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const +mcIdType MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) const { - std::vector elts; + std::vector elts; getCellsContainingPoint(pos,eps,elts); if(elts.empty()) return -1; @@ -4067,16 +4068,16 @@ int MEDCouplingUMesh::getCellContainingPoint(const double *pos, double eps) cons * \ref py_mcumesh_getCellsContainingPoint "Here is a Python example". * \endif */ -void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const +void MEDCouplingUMesh::getCellsContainingPoint(const double *pos, double eps, std::vector& elts) const { - MCAuto eltsUg,eltsIndexUg; + MCAuto eltsUg,eltsIndexUg; getCellsContainingPoints(pos,1,eps,eltsUg,eltsIndexUg); elts.clear(); elts.insert(elts.end(),eltsUg->begin(),eltsUg->end()); } -void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, int nbOfPoints, double eps, - MCAuto& elts, MCAuto& eltsIndex, - std::function sensibilityTo2DQuadraticLinearCellsFunc) const +void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& eltsIndex, + std::function sensibilityTo2DQuadraticLinearCellsFunc) const { int spaceDim(getSpaceDimension()),mDim(getMeshDimension()); if(spaceDim==3) @@ -4142,8 +4143,8 @@ void MEDCouplingUMesh::getCellsContainingPointsZeAlg(const double *pos, int nbOf * \ref py_mcumesh_getCellsContainingPoints "Here is a Python example". * \endif */ -void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, - MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& eltsIndex) const { auto yesImSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType ct, int mdim) { return INTERP_KERNEL::CellModel::GetCellModel(ct).isQuadratic() && mdim == 2; } ); this->getCellsContainingPointsZeAlg(pos,nbOfPoints,eps,elts,eltsIndex,yesImSensibleTo2DQuadraticLinearCellsFunc); @@ -4156,9 +4157,9 @@ void MEDCouplingUMesh::getCellsContainingPoints(const double *pos, int nbOfPoint * * \sa MEDCouplingUMesh::getCellsContainingPoints, MEDCouplingRemapper::prepareNotInterpKernelOnlyGaussGauss */ -void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const +void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const { - auto noImNotSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType,int) { return false; } ); + auto noImNotSensibleTo2DQuadraticLinearCellsFunc([](INTERP_KERNEL::NormalizedCellType,mcIdType) { return false; } ); this->getCellsContainingPointsZeAlg(pos,nbOfPoints,eps,elts,eltsIndex,noImNotSensibleTo2DQuadraticLinearCellsFunc); } @@ -4172,7 +4173,7 @@ void MEDCouplingUMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType(const * \throw If \a this->getMeshDimension() != 2. * \throw If \a this->getSpaceDimension() != 2 && \a this->getSpaceDimension() != 3. */ -void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) const +void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) const { const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!"; if(getMeshDimension()!=2) @@ -4180,14 +4181,14 @@ void MEDCouplingUMesh::checkButterflyCells(std::vector& cells, double eps) int spaceDim=getSpaceDimension(); if(spaceDim!=2 && spaceDim!=3) throw INTERP_KERNEL::Exception(msg); - const int *conn=_nodal_connec->getConstPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); std::vector cell2DinS2; - for(int i=0;i& cells, double eps) * \return a newly allocated array containing cellIds that have been modified if any. If no cells have been impacted by this method NULL is returned. * \sa MEDCouplingUMesh::colinearize2D */ -DataArrayInt *MEDCouplingUMesh::convexEnvelop2D() +DataArrayIdType *MEDCouplingUMesh::convexEnvelop2D() { if(getMeshDimension()!=2 || getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convexEnvelop2D works only for meshDim=2 and spaceDim=2 !"); checkFullyDefined(); const double *coords=getCoords()->getConstPointer(); - int nbOfCells=getNumberOfCells(); - MCAuto nodalConnecIndexOut=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto nodalConnecIndexOut=DataArrayIdType::New(); nodalConnecIndexOut->alloc(nbOfCells+1,1); - MCAuto nodalConnecOut(DataArrayInt::New()); - int *workIndexOut=nodalConnecIndexOut->getPointer(); + MCAuto nodalConnecOut(DataArrayIdType::New()); + mcIdType *workIndexOut=nodalConnecIndexOut->getPointer(); *workIndexOut=0; - const int *nodalConnecIn=_nodal_connec->getConstPointer(); - const int *nodalConnecIndexIn=_nodal_connec_index->getConstPointer(); + const mcIdType *nodalConnecIn=_nodal_connec->getConstPointer(); + const mcIdType *nodalConnecIndexIn=_nodal_connec_index->getConstPointer(); std::set types; - MCAuto isChanged(DataArrayInt::New()); + MCAuto isChanged(DataArrayIdType::New()); isChanged->alloc(0,1); - for(int 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)); @@ -4278,7 +4279,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 !"); } - int oldNbOfNodes(getNumberOfNodes()); + mcIdType oldNbOfNodes(getNumberOfNodes()); MCAuto newCoords; switch(policy) { @@ -4312,8 +4313,8 @@ bool MEDCouplingUMesh::isFullyQuadratic() const { checkFullyDefined(); bool ret=true; - int nbOfCells=getNumberOfCells(); - for(int i=0;ibegin(); - for(int i=0;ibegin(); + for(mcIdType i=0;i newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); - const int *icptr(_nodal_connec->begin()); + MCAuto newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); + const mcIdType *icptr(_nodal_connec->begin()); newConn->alloc(getNodalConnectivityArrayLen()-delta,1); newConnI->alloc(nbOfCells+1,1); - int *ocptr(newConn->getPointer()),*ociptr(newConnI->getPointer()); + mcIdType *ocptr(newConn->getPointer()),*ociptr(newConnI->getPointer()); *ociptr=0; _types.clear(); - for(int i=0;i types; checkFullyDefined(); - MCAuto ret,connSafe,connISafe; + MCAuto ret,connSafe,connISafe; MCAuto coordsSafe; int meshDim=getMeshDimension(); switch(conversionType) @@ -4530,8 +4531,8 @@ void MEDCouplingUMesh::tessellate2D(double eps) * * \sa buildDescendingConnectivity2 */ -void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, const DataArrayInt *nodeIdsIndexToAdd, const DataArrayInt *edgeIdsToBeSplit, - const MEDCouplingUMesh *mesh1Desc, const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) +void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayIdType *nodeIdsToAdd, const DataArrayIdType *nodeIdsIndexToAdd, const DataArrayIdType *edgeIdsToBeSplit, + const MEDCouplingUMesh *mesh1Desc, const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI) { if(!nodeIdsToAdd || !nodeIdsIndexToAdd || !edgeIdsToBeSplit || !mesh1Desc || !desc || !descI || !revDesc || !revDescI) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : input pointers must be not NULL !"); @@ -4540,9 +4541,9 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : this must have spacedim=meshdim=2 !"); if(mesh1Desc->getSpaceDimension()!=2 || mesh1Desc->getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitSomeEdgesOf2DMesh : mesh1Desc must be the explosion of this with spaceDim=2 and meshDim = 1 !"); - //DataArrayInt *out0(0),*outi0(0); + //DataArrayIdType *out0(0),*outi0(0); //MEDCouplingUMesh::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); - //MCAuto out0s(out0),outi0s(outi0); + //MCAuto out0s(out0),outi0s(outi0); //out0s=out0s->buildUnique(); out0s->sort(true); } #endif @@ -4563,7 +4564,7 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, * - INTERP_KERNEL::PLANAR_FACE_6 - to split HEXA8 into 6 TETRA4 (for 3D mesh only - see INTERP_KERNEL::SplittingPolicy for an image). * * - * \return DataArrayInt * - a new instance of DataArrayInt holding, for each new cell, + * \return DataArrayIdType * - a new instance of DataArrayIdType holding, for each new cell, * an id of old cell producing it. The caller is to delete this array using * decrRef() as it is no more needed. * @@ -4574,7 +4575,7 @@ void MEDCouplingUMesh::splitSomeEdgesOf2DMesh(const DataArrayInt *nodeIdsToAdd, * \throw If the nodal connectivity of cells is not defined. * \sa MEDCouplingUMesh::tetrahedrize, MEDCoupling1SGTUMesh::sortHexa8EachOther */ -DataArrayInt *MEDCouplingUMesh::simplexize(int policy) +DataArrayIdType *MEDCouplingUMesh::simplexize(int policy) { switch(policy) { @@ -4582,9 +4583,9 @@ DataArrayInt *MEDCouplingUMesh::simplexize(int policy) return simplexizePol0(); case 1: return simplexizePol1(); - case (int) INTERP_KERNEL::PLANAR_FACE_5: + case INTERP_KERNEL::PLANAR_FACE_5: return simplexizePlanarFace5(); - case (int) INTERP_KERNEL::PLANAR_FACE_6: + case INTERP_KERNEL::PLANAR_FACE_6: return simplexizePlanarFace6(); default: throw INTERP_KERNEL::Exception("MEDCouplingUMesh::simplexize : unrecognized policy ! Must be :\n - 0 or 1 (only available for meshdim=2) \n - PLANAR_FACE_5, PLANAR_FACE_6 (only for meshdim=3)"); @@ -4611,10 +4612,10 @@ bool MEDCouplingUMesh::areOnlySimplexCells() const 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 !"); - int nbCells=getNumberOfCells(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - for(int i=0;ibegin(); + const mcIdType *connI=_nodal_connec_index->begin(); + for(mcIdType i=0;igetPointer(); - int *index=_nodal_connec_index->getPointer(); - int posOfCurCell=0; - int newPos=0; - int lgthOfCurCell; - for(int i=0;igetPointer(); + mcIdType *index=_nodal_connec_index->getPointer(); + mcIdType posOfCurCell=0; + mcIdType newPos=0; + mcIdType lgthOfCurCell; + for(mcIdType i=0;i ret(DataArrayInt::New()); ret->alloc(0,1); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); if(nbOfCells<1) return ret.retn(); - int initMeshLgth=getNodalConnectivityArrayLen(); - int *conn=_nodal_connec->getPointer(); - int *index=_nodal_connec_index->getPointer(); - int posOfCurCell=0; - int newPos=0; - int lgthOfCurCell, nbDelCells(0); - for(int i=0;igetPointer(); + mcIdType *index=_nodal_connec_index->getPointer(); + mcIdType posOfCurCell=0; + mcIdType newPos=0; + mcIdType lgthOfCurCell, nbDelCells(0); + for(mcIdType i=0;ireAlloc(newPos); - const int nCellDel=ret->getNumberOfTuples(); + const mcIdType nCellDel=ret->getNumberOfTuples(); if (nCellDel) _nodal_connec_index->reAlloc(nbOfCells-nCellDel+1); computeTypes(); @@ -4732,7 +4733,7 @@ bool MEDCouplingUMesh::removeDegenerated1DCells() if(getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::removeDegenerated1DCells works on umeshes with meshdim equals to 1 !"); std::size_t nbCells(getNumberOfCells()),newSize(0),newSize2(0); - const int *conn(getNodalConnectivity()->begin()),*conni(getNodalConnectivityIndex()->begin()); + const mcIdType *conn(getNodalConnectivity()->begin()),*conni(getNodalConnectivityIndex()->begin()); { for(std::size_t i=0;i do nothing return false; - MCAuto newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); newConnI->alloc(newSize+1,1); newConn->alloc(newSize2,1); - int *newConnPtr(newConn->getPointer()),*newConnIPtr(newConnI->getPointer()); newConnIPtr[0]=0; + MCAuto newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); newConnI->alloc(newSize+1,1); newConn->alloc(newSize2,1); + mcIdType *newConnPtr(newConn->getPointer()),*newConnIPtr(newConnI->getPointer()); newConnIPtr[0]=0; for(std::size_t i=0;i& cells) const +void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const { if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply are2DCellsNotCorrectlyOriented on it : must be meshDim==2 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); - for(int i=0;igetPointer()); - const int *connI(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType *conn(_nodal_connec->getPointer()); + const mcIdType *connI(_nodal_connec_index->begin()); const double *coordsPtr(_coords->begin()); bool isModified(false); - for(int i=0;igetPointer()); - const int *connI(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType *conn(_nodal_connec->getPointer()); + const mcIdType *connI(_nodal_connec_index->begin()); if(mdim==2) {//2D - for(int i=0;i& cells) const +void MEDCouplingUMesh::arePolyhedronsNotCorrectlyOriented(std::vector& cells) const { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply arePolyhedronsNotCorrectlyOriented on it : must be meshDim==3 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); - for(int i=0;igetPointer(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType *conn=_nodal_connec->getPointer(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); - for(int i=0;i gts(getAllGeoTypes()); - int *conn(_nodal_connec->getPointer()); - const int *conni(_nodal_connec_index->begin()); + mcIdType *conn(_nodal_connec->getPointer()); + const mcIdType *conni(_nodal_connec_index->begin()); 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(const int *it=cwt->begin();it!=cwt->end();it++) + 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(); @@ -4987,7 +4990,7 @@ void MEDCouplingUMesh::invertOrientationOfAllCells() * INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXGP12 etc) to respect the MED convention * according to which the first facet of the cell should be oriented to have the normal vector * pointing out of cell. - * \return DataArrayInt * - a new instance of DataArrayInt holding ids of fixed + * \return DataArrayIdType * - a new instance of DataArrayIdType holding ids of fixed * cells. The caller is to delete this array using decrRef() as it is no more * needed. * \throw If \a this->getMeshDimension() != 3. @@ -5001,7 +5004,7 @@ void MEDCouplingUMesh::invertOrientationOfAllCells() * \endif * \sa MEDCouplingUMesh::findAndCorrectBadOriented3DCells */ -DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() +DataArrayIdType *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() { const char msg[]="check3DCellsWellOriented detection works only for 3D cells !"; if(getMeshDimension()!=3) @@ -5010,12 +5013,12 @@ DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() if(spaceDim!=3) throw INTERP_KERNEL::Exception(msg); // - int nbOfCells=getNumberOfCells(); - int *conn=_nodal_connec->getPointer(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType *conn=_nodal_connec->getPointer(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=getCoords()->begin(); - MCAuto cells(DataArrayInt::New()); cells->alloc(0,1); - for(int i=0;i cells(DataArrayIdType::New()); cells->alloc(0,1); + for(mcIdType i=0;igetPointer(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType *conn=_nodal_connec->getPointer(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); - for(int i=0;i ret=DataArrayIdType::New(); ret->alloc(0,1); + for(mcIdType i=0;ibegin(); - const int *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coordsPtr=_coords->begin(); - INTERP_KERNEL::areaVectorOfPolygon(conn+1,connI[1]-connI[0]-1,coordsPtr,vec); + INTERP_KERNEL::areaVectorOfPolygon(conn+1,connI[1]-connI[0]-1,coordsPtr,vec); std::copy(coordsPtr+3*conn[1],coordsPtr+3*conn[1]+3,pos); } @@ -5150,16 +5153,16 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getEdgeRatioField : MeshDimension must be equal to 2 or 3 !"); MCAuto ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=_coords->begin(); double tmp[12]; - for(int i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=_coords->begin(); double tmp[12]; - for(int i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=_coords->begin(); double tmp[12]; - for(int i=0;i ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); ret->setMesh(this); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); MCAuto arr=DataArrayDouble::New(); arr->alloc(nbOfCells,1); double *pt=arr->getPointer(); ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef. - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coo=_coords->begin(); double tmp[12]; - for(int i=0;isetMesh(this); std::set types; ComputeAllTypesInternal(types,_nodal_connec,_nodal_connec_index); - int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()); + int spaceDim(getSpaceDimension()); + mcIdType nbCells(getNumberOfCells()); MCAuto arr(DataArrayDouble::New()); arr->alloc(nbCells,1); for(std::set::const_iterator it=types.begin();it!=types.end();it++) { INTERP_KERNEL::AutoCppPtr dc(INTERP_KERNEL::CellModel::GetCellModel(*it).buildInstanceOfDiameterCalulator(spaceDim)); - MCAuto cellIds(giveCellsWithType(*it)); + MCAuto cellIds(giveCellsWithType(*it)); dc->computeForListOfCellIdsUMeshFrmt(cellIds->begin(),cellIds->end(),_nodal_connec_index->begin(),_nodal_connec->begin(),getCoords()->begin(),arr->getPointer()); } ret->setArray(arr); @@ -5475,23 +5479,24 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTree(double arcDetEps) con DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const { checkFullyDefined(); - int spaceDim(getSpaceDimension()),nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); + int spaceDim(getSpaceDimension()); + mcIdType nbOfCells(getNumberOfCells()), nbOfNodes(getNumberOfNodes()); MCAuto ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); - for(int i=0;i::max(); bbox[2*i+1]=-std::numeric_limits::max(); } const double *coordsPtr(_coords->begin()); - const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); - for(int i=0;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i=0 && nodeId ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->begin()); - const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); - for(int i=0;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); - for(int j=0;j ret(DataArrayDouble::New()); ret->alloc(nbOfCells,2*spaceDim); double *bbox(ret->getPointer()); const double *coords(_coords->begin()); - const int *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); - for(int i=0;ibegin()),*connI(_nodal_connec_index->begin()); + for(mcIdType i=0;i nodes(sz); INTERP_KERNEL::Edge *edge(0); - for(int j=0;j MEDCouplingUMesh::getDistributionOfTypes() const +std::vector MEDCouplingUMesh::getDistributionOfTypes() const { checkConnectivityFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - const int *work=connI; - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + const mcIdType *work=connI; + 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::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++) { @@ -5658,8 +5665,8 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const } types.insert(typ); ret[3*i]=typ; - const int *work2=std::find_if(work+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,typ)); - ret[3*i+1]=(int)std::distance(work,work2); + const mcIdType *work2=std::find_if(work+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,typ)); + ret[3*i+1]=ToIdType(std::distance(work,work2)); work=work2; } return ret; @@ -5680,9 +5687,9 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const * * If all geometric types in \a code are exactly those in \a this null pointer is returned. * If it exists a geometric type in \a this \b not in \a code \b no exception is thrown - * and a DataArrayInt instance is returned that the user has the responsibility to deallocate. + * and a DataArrayIdType instance is returned that the user has the responsibility to deallocate. */ -DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const +DataArrayIdType *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const { if(code.empty()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code is empty, should not !"); @@ -5691,7 +5698,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< if(sz%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::checkTypeConsistencyAndContig : code size is NOT %3 !"); std::vector types; - int nb=0; + mcIdType nb=0; bool isNoPflUsed=true; for(std::size_t i=0;i ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nb,1); - int *retPtr=ret->getPointer(); - const int *connI=_nodal_connec_index->begin(); - const int *conn=_nodal_connec->begin(); - int nbOfCells=getNumberOfCells(); - const int *i=connI; + mcIdType *retPtr=ret->getPointer(); + const mcIdType *connI=_nodal_connec_index->begin(); + const mcIdType *conn=_nodal_connec->begin(); + 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,(int)(*it))); - int offset=(int)std::distance(connI,i); - const int *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)(*it))); - int nbOfCellsOfCurType=(int)std::distance(i,j); + i=std::find_if(i,connI+nbOfCells,MEDCouplingImpl::ConnReader2(conn,ToIdType((*it)))); + mcIdType offset=ToIdType(std::distance(connI,i)); + const mcIdType *j=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType((*it)))); + mcIdType nbOfCellsOfCurType=ToIdType(std::distance(i,j)); if(code[3*kk+2]==-1) - for(int k=0;k=0 && idInIdsPerType<(int)idsPerType.size()) + mcIdType idInIdsPerType=code[3*kk+2]; + if(idInIdsPerType>=0 && idInIdsPerTypecheckAllocated(); if(zePfl->getNumberOfComponents()==1) { - for(const int *k=zePfl->begin();k!=zePfl->end();k++,retPtr++) + for(const mcIdType *k=zePfl->begin();k!=zePfl->end();k++,retPtr++) { if(*k>=0 && *k& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const +void MEDCouplingUMesh::splitProfilePerType(const DataArrayIdType *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller) const { if(!profile) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile is NULL !"); if(profile->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : input profile should have exactly one component !"); checkConnectivityFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); std::vector types; - std::vector typeRangeVals(1); - for(const int *i=connI;i!=connI+nbOfCells;) + std::vector typeRangeVals(1); + for(const mcIdType *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; if(std::find(types.begin(),types.end(),curType)!=types.end()) @@ -5803,33 +5810,33 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec throw INTERP_KERNEL::Exception("MEDCouplingUMesh::splitProfilePerType : current mesh is not sorted by type !"); } types.push_back(curType); - i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType)); - typeRangeVals.push_back((int)std::distance(connI,i)); + i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType))); + typeRangeVals.push_back(ToIdType(std::distance(connI,i))); } // - DataArrayInt *castArr=0,*rankInsideCast=0,*castsPresent=0; + DataArrayIdType *castArr=0,*rankInsideCast=0,*castsPresent=0; profile->splitByValueRange(&typeRangeVals[0],&typeRangeVals[0]+typeRangeVals.size(),castArr,rankInsideCast,castsPresent); - MCAuto tmp0=castArr; - MCAuto tmp1=rankInsideCast; - MCAuto tmp2=castsPresent; + MCAuto tmp0=castArr; + MCAuto tmp1=rankInsideCast; + MCAuto tmp2=castsPresent; // - int nbOfCastsFinal=castsPresent->getNumberOfTuples(); + mcIdType nbOfCastsFinal=castsPresent->getNumberOfTuples(); code.resize(3*nbOfCastsFinal); - std::vector< MCAuto > idsInPflPerType2; - std::vector< MCAuto > idsPerType2; - for(int i=0;i > idsInPflPerType2; + std::vector< MCAuto > idsPerType2; + for(mcIdType i=0;igetIJ(i,0); - MCAuto tmp3=castArr->findIdsEqual(castId); + mcIdType castId=castsPresent->getIJ(i,0); + MCAuto tmp3=castArr->findIdsEqual(castId); idsInPflPerType2.push_back(tmp3); - code[3*i]=(int)types[castId]; + code[3*i]=ToIdType(types[castId]); code[3*i+1]=tmp3->getNumberOfTuples(); - MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); + MCAuto tmp4=rankInsideCast->selectByTupleId(tmp3->begin(),tmp3->begin()+tmp3->getNumberOfTuples()); if(!smartPflKiller || !tmp4->isIota(typeRangeVals[castId+1]-typeRangeVals[castId])) { tmp4->copyStringInfoFrom(*profile); idsPerType2.push_back(tmp4); - code[3*i+2]=(int)idsPerType2.size()-1; + code[3*i+2]=ToIdType(idsPerType2.size())-1; } else { @@ -5840,7 +5847,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec idsInPflPerType.resize(sz2); for(std::size_t i=0;iincrRef(); idsInPflPerType[i]=locDa; } @@ -5848,7 +5855,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec idsPerType.resize(sz); for(std::size_t i=0;iincrRef(); idsPerType[i]=locDa; } @@ -5860,7 +5867,7 @@ void MEDCouplingUMesh::splitProfilePerType(const DataArrayInt *profile, std::vec * The following equality should be verified 'nM1LevMesh->getMeshDimension()==this->getMeshDimension()-1' * This method returns 5+2 elements. 'desc', 'descIndx', 'revDesc', 'revDescIndx' and 'meshnM1' behaves exactly as MEDCoupling::MEDCouplingUMesh::buildDescendingConnectivity except the content as described after. The returned array specifies the n-1 mesh reordered by type as MEDMEM does. 'nM1LevMeshIds' contains the ids in returned 'meshnM1'. Finally 'meshnM1Old2New' contains numbering old2new that is to say the cell #k in coarse 'nM1LevMesh' will have the number ret[k] in returned mesh 'nM1LevMesh' MEDMEM reordered. */ -MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const +MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const { checkFullyDefined(); nM1LevMesh->checkFullyDefined(); @@ -5868,20 +5875,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : The mesh passed as first argument should have a meshDim equal to this->getMeshDimension()-1 !" ); if(_coords!=nM1LevMesh->getCoords()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::emulateMEDMEMBDC : 'this' and mesh in first argument should share the same coords : Use tryToShareSameCoords method !"); - MCAuto tmp0=DataArrayInt::New(); - MCAuto tmp1=DataArrayInt::New(); + MCAuto tmp0=DataArrayIdType::New(); + MCAuto tmp1=DataArrayIdType::New(); MCAuto ret1=buildDescendingConnectivity(desc,descIndx,tmp0,tmp1); - MCAuto ret0=ret1->sortCellsInMEDFileFrmt(); + MCAuto ret0=ret1->sortCellsInMEDFileFrmt(); desc->transformWithIndArr(ret0->begin(),ret0->begin()+ret0->getNbOfElems()); MCAuto tmp=MEDCouplingUMesh::New(); tmp->setConnectivity(tmp0,tmp1); tmp->renumberCells(ret0->begin(),false); revDesc=tmp->getNodalConnectivity(); revDescIndx=tmp->getNodalConnectivityIndex(); - DataArrayInt *ret=0; + DataArrayIdType *ret=0; if(!ret1->areCellsIncludedIn(nM1LevMesh,2,ret)) { - int tmp2; + mcIdType tmp2; ret->getMaxValue(tmp2); ret->decrRef(); std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp2 << " !"; @@ -5901,14 +5908,14 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 * Permutes the nodal connectivity arrays so that the cells are sorted by type, which is * necessary for writing the mesh to MED file. Additionally returns a permutation array * in "Old to New" mode. - * \return DataArrayInt * - a new instance of DataArrayInt. The caller is to delete + * \return DataArrayIdType * - a new instance of DataArrayIdType. The caller is to delete * this array using decrRef() as it is no more needed. * \throw If the nodal connectivity of cells is not defined. */ -DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() +DataArrayIdType *MEDCouplingUMesh::sortCellsInMEDFileFrmt() { checkConnectivityFullyDefined(); - MCAuto ret=getRenumArrForMEDFileFrmt(); + MCAuto ret=getRenumArrForMEDFileFrmt(); renumberCells(ret->begin(),false); return ret.retn(); } @@ -5920,17 +5927,17 @@ DataArrayInt *MEDCouplingUMesh::sortCellsInMEDFileFrmt() bool MEDCouplingUMesh::checkConsecutiveCellTypes() const { checkFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); std::set types; - for(const int *i=connI;i!=connI+nbOfCells;) + for(const mcIdType *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; if(types.find(curType)!=types.end()) return false; types.insert(curType); - i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType)); + i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType))); } return true; } @@ -5955,30 +5962,30 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesForMEDFileFrmt() const bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const { checkFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells==0) return true; - int lastPos=-1; + mcIdType lastPos=-1; std::set sg; - for(const int *i=connI;i!=connI+nbOfCells;) + for(const mcIdType *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; const INTERP_KERNEL::NormalizedCellType *isTypeExists=std::find(orderBg,orderEnd,curType); if(isTypeExists!=orderEnd) { - int pos=(int)std::distance(orderBg,isTypeExists); + mcIdType pos=ToIdType(std::distance(orderBg,isTypeExists)); if(pos<=lastPos) return false; lastPos=pos; - i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType)); + i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType))); } else { if(sg.find(curType)==sg.end()) { - i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType)); + i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,ToIdType(curType))); sg.insert(curType); } else @@ -5989,29 +5996,29 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::No } /*! - * This method returns 2 newly allocated DataArrayInt instances. The first is an array of size 'this->getNumberOfCells()' with one component, + * This method returns 2 newly allocated DataArrayIdType instances. The first is an array of size 'this->getNumberOfCells()' with one component, * that tells for each cell the pos of its type in the array on type given in input parameter. The 2nd output parameter is an array with the same * number of tuples than input type array and with one component. This 2nd output array gives type by type the number of occurrence of type in 'this'. */ -DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const +DataArrayIdType *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const { checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - MCAuto tmpa=DataArrayInt::New(); - MCAuto tmpb=DataArrayInt::New(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + MCAuto tmpa=DataArrayIdType::New(); + MCAuto tmpb=DataArrayIdType::New(); tmpa->alloc(nbOfCells,1); - tmpb->alloc((int)std::distance(orderBg,orderEnd),1); + tmpb->alloc(std::distance(orderBg,orderEnd),1); tmpb->fillWithZero(); - int *tmp=tmpa->getPointer(); - int *tmp2=tmpb->getPointer(); - for(const int *i=connI;i!=connI+nbOfCells;i++) + mcIdType *tmp=tmpa->getPointer(); + mcIdType *tmp2=tmpb->getPointer(); + for(const mcIdType *i=connI;i!=connI+nbOfCells;i++) { const INTERP_KERNEL::NormalizedCellType *where=std::find(orderBg,orderEnd,(INTERP_KERNEL::NormalizedCellType)conn[*i]); if(where!=orderEnd) { - int pos=(int)std::distance(orderBg,where); + mcIdType pos=ToIdType(std::distance(orderBg,where)); tmp2[pos]++; tmp[std::distance(connI,i)]=pos; } @@ -6034,7 +6041,7 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma * * \sa MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec, MEDCouplingUMesh::sortCellsInMEDFileFrmt. */ -DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const +DataArrayIdType *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const { return getRenumArrForConsecutiveCellTypesSpec(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER); } @@ -6045,10 +6052,10 @@ DataArrayInt *MEDCouplingUMesh::getRenumArrForMEDFileFrmt() const * The mesh after this call to MEDCouplingMesh::renumberCells will pass the test of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder with the same inputs. * The returned array minimizes the permutations that is to say the order of cells inside same geometric type remains the same. */ -DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const +DataArrayIdType *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const { - DataArrayInt *nbPerType=0; - MCAuto tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); + DataArrayIdType *nbPerType=0; + MCAuto tmpa=getLevArrPerCellTypes(orderBg,orderEnd,nbPerType); nbPerType->decrRef(); return tmpa->buildPermArrPerLevel(); } @@ -6061,29 +6068,29 @@ DataArrayInt *MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec(const INT * * \return the array giving the correspondence old to new. */ -DataArrayInt *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() +DataArrayIdType *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() { checkFullyDefined(); computeTypes(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); std::vector types; - for(const int *i=connI;i!=connI+nbOfCells && (types.size()!=_types.size());) + 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()) { 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++); } - DataArrayInt *ret=DataArrayInt::New(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(nbOfCells,1); - int *retPtr=ret->getPointer(); + mcIdType *retPtr=ret->getPointer(); std::fill(retPtr,retPtr+nbOfCells,-1); - int newCellId=0; + mcIdType newCellId=0; for(std::vector::const_iterator iter=types.begin();iter!=types.end();iter++) { - for(const int *i=connI;i!=connI+nbOfCells;i++) + for(const mcIdType *i=connI;i!=connI+nbOfCells;i++) if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter)) retPtr[std::distance(connI,i)]=newCellId++; } @@ -6099,19 +6106,19 @@ DataArrayInt *MEDCouplingUMesh::rearrange2ConsecutiveCellTypes() std::vector MEDCouplingUMesh::splitByType() const { checkConnectivityFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); std::vector ret; - for(const int *i=connI;i!=connI+nbOfCells;) + for(const mcIdType *i=connI;i!=connI+nbOfCells;) { INTERP_KERNEL::NormalizedCellType curType=(INTERP_KERNEL::NormalizedCellType)conn[*i]; - int beginCellId=(int)std::distance(connI,i); - i=std::find_if(i+1,connI+nbOfCells,MEDCouplingImpl::ConnReader(conn,(int)curType)); - int endCellId=(int)std::distance(connI,i); - int sz=endCellId-beginCellId; - int *cells=new int[sz]; - for(int j=0;j((MEDCoupling1GTUMesh*)ret); if(retC) { - MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); + MCAuto c=convertNodalConnectivityToStaticGeoTypeMesh(); retC->setNodalConnectivity(c); } else @@ -6149,15 +6156,15 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const MEDCoupling1DGTUMesh *retD=dynamic_cast((MEDCoupling1GTUMesh*)ret); if(!retD) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : Internal error !"); - DataArrayInt *c=0,*ci=0; + DataArrayIdType *c=0,*ci=0; convertNodalConnectivityToDynamicGeoTypeMesh(c,ci); - MCAuto cs(c),cis(ci); + MCAuto cs(c),cis(ci); retD->setNodalConnectivity(cs,cis); } return ret.retn(); } -DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const +DataArrayIdType *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() const { checkConnectivityFullyDefined(); if(_types.size()!=1) @@ -6170,15 +6177,15 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !"; throw INTERP_KERNEL::Exception(oss.str()); } - int nbCells=getNumberOfCells(); - int typi=(int)typ; - int nbNodesPerCell=(int)cm.getNumberOfNodes(); - MCAuto connOut=DataArrayInt::New(); connOut->alloc(nbCells*nbNodesPerCell,1); - int *outPtr=connOut->getPointer(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + 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(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); nbNodesPerCell++; - for(int i=0;igetNumberOfTuples(); + mcIdType nbCells=getNumberOfCells(), + lgth=_nodal_connec->getNumberOfTuples(); if(lgth c(DataArrayInt::New()),ci(DataArrayInt::New()); + MCAuto c(DataArrayIdType::New()),ci(DataArrayIdType::New()); c->alloc(lgth-nbCells,1); ci->alloc(nbCells+1,1); - int *cp(c->getPointer()),*cip(ci->getPointer()); - const int *incp(_nodal_connec->begin()),*incip(_nodal_connec_index->begin()); + mcIdType *cp(c->getPointer()),*cip(ci->getPointer()); + const mcIdType *incp(_nodal_connec->begin()),*incip(_nodal_connec_index->begin()); cip[0]=0; - for(int i=0;i=1) { if((strt>=0 && strt=0 && stop<=lgth)) @@ -6238,16 +6246,16 @@ void MEDCouplingUMesh::convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt * * \param [in] ms meshes with same mesh dimension lying on the same coords and sorted by type following de the same geometric type order than * those specified in MEDCouplingUMesh::sortCellsInMEDFileFrmt method. - * \param [out] szOfCellGrpOfSameType is a newly allocated DataArrayInt instance whose number of tuples is equal to the number of chunks of same geotype + * \param [out] szOfCellGrpOfSameType is a newly allocated DataArrayIdType instance whose number of tuples is equal to the number of chunks of same geotype * in all meshes in \b ms. The accumulation of all values of this array is equal to the number of cells of returned mesh. - * \param [out] idInMsOfCellGrpOfSameType is a newly allocated DataArrayInt instance having the same size than \b szOfCellGrpOfSameType. This + * \param [out] idInMsOfCellGrpOfSameType is a newly allocated DataArrayIdType instance having the same size than \b szOfCellGrpOfSameType. This * output array gives for each chunck of same type the corresponding mesh id in \b ms. * \return A newly allocated unstructured mesh that is the result of the aggregation on same coords of all meshes in \b ms. This returned mesh * is sorted by type following the geo cell types order of MEDCouplingUMesh::sortCellsInMEDFileFrmt method. */ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(const std::vector& ms, - DataArrayInt *&szOfCellGrpOfSameType, - DataArrayInt *&idInMsOfCellGrpOfSameType) + DataArrayIdType *&szOfCellGrpOfSameType, + DataArrayIdType *&idInMsOfCellGrpOfSameType) { std::vector ms2; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) @@ -6265,8 +6273,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons // std::vector m1ssmSingle; std::vector< MCAuto > m1ssmSingleAuto; - int fake=0,rk=0; - MCAuto ret1(DataArrayInt::New()),ret2(DataArrayInt::New()); + mcIdType fake=0,rk=0; + MCAuto ret1(DataArrayIdType::New()),ret2(DataArrayIdType::New()); ret1->alloc(0,1); ret2->alloc(0,1); for(std::vector::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++) { @@ -6286,9 +6294,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons } } MCAuto m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle); - MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); + MCAuto renum=m1ssmSingle2->sortCellsInMEDFileFrmt(); std::vector m1ssmfinal(m1ssm.size()); - for(std::size_t i=0;igetIJ(i,0)]=m1ssm[i]; MCAuto ret0=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmfinal); szOfCellGrpOfSameType=ret1->renumber(renum->begin()); @@ -6297,16 +6305,16 @@ MEDCouplingUMesh *MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(cons } /*! - * This method returns a newly created DataArrayInt instance. + * This method returns a newly created DataArrayIdType instance. * This method retrieves cell ids in [ \a begin, \a end ) that have the type \a type. */ -DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const +DataArrayIdType *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const mcIdType *begin, const mcIdType *end) const { checkFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connIndex=_nodal_connec_index->begin(); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); - for(const int *w=begin;w!=end;w++) + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connIndex=_nodal_connec_index->begin(); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); + for(const mcIdType *w=begin;w!=end;w++) if((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]==type) ret->pushBackSilent(*w); return ret.retn(); @@ -6316,28 +6324,28 @@ DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellT * This method makes the assumption that da->getNumberOfTuples()getNumberOfCells(). This method makes the assumption that ids contained in 'da' * are in [0:getNumberOfCells()) */ -DataArrayInt *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayInt *da) const +DataArrayIdType *MEDCouplingUMesh::convertCellArrayPerGeoType(const DataArrayIdType *da) const { checkFullyDefined(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); - int nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); + mcIdType nbOfCells=getNumberOfCells(); std::set types(getAllGeoTypes()); - int *tmp=new int[nbOfCells]; + mcIdType *tmp=new mcIdType[nbOfCells]; for(std::set::const_iterator iter=types.begin();iter!=types.end();iter++) { - int j=0; - for(const int *i=connI;i!=connI+nbOfCells;i++) + mcIdType j=0; + for(const mcIdType *i=connI;i!=connI+nbOfCells;i++) if((INTERP_KERNEL::NormalizedCellType)conn[*i]==(*iter)) tmp[std::distance(connI,i)]=j++; } - DataArrayInt *ret=DataArrayInt::New(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(da->getNumberOfTuples(),da->getNumberOfComponents()); ret->copyStringInfoFrom(*da); - int *retPtr=ret->getPointer(); - const int *daPtr=da->begin(); - int nbOfElems=da->getNbOfElems(); - for(int k=0;kgetPointer(); + const mcIdType *daPtr=da->begin(); + mcIdType nbOfElems=da->getNbOfElems(); + for(mcIdType k=0;k code=getDistributionOfTypes(); + std::vector code=getDistributionOfTypes(); std::size_t nOfTypesInThis=code.size()/3; - int sz=0,szOfType=0; + mcIdType sz=0,szOfType=0; for(std::size_t i=0;i=szOfType) { std::ostringstream oss; oss << "MEDCouplingUMesh::keepSpecifiedCells : Request on type " << type << " at place #" << std::distance(idsPerGeoTypeBg,work) << " value " << *work; oss << ". It should be in [0," << szOfType << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); - int *idsPtr=idsTokeep->getPointer(); - int offset=0; + MCAuto idsTokeep=DataArrayIdType::New(); idsTokeep->alloc(sz+std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); + mcIdType *idsPtr=idsTokeep->getPointer(); + mcIdType offset=0; for(std::size_t i=0;i(),offset)); + idsPtr=std::transform(idsPerGeoTypeBg,idsPerGeoTypeEnd,idsPtr,std::bind2nd(std::plus(),offset)); offset+=code[3*i+1]; } MCAuto ret=static_cast(buildPartOfMySelf(idsTokeep->begin(),idsTokeep->end(),true)); @@ -6391,11 +6399,11 @@ MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::Normalized */ std::vector MEDCouplingUMesh::getQuadraticStatus() const { - int ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); std::vector ret(ncell); - const int *cI=getNodalConnectivityIndex()->begin(); - const int *c=getNodalConnectivity()->begin(); - for(int i=0;ibegin(); + const mcIdType *c=getNodalConnectivity()->begin(); + for(mcIdType i=0;i ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells(); + mcIdType nbOfCells=getNumberOfCells(); ret->alloc(nbOfCells,spaceDim); ret->copyStringInfoFrom(*getCoords()); double *ptToFill=ret->getPointer(); - const int *nodal=_nodal_connec->begin(); - const int *nodalI=_nodal_connec_index->begin(); + const mcIdType *nodal=_nodal_connec->begin(); + const mcIdType *nodalI=_nodal_connec_index->begin(); const double *coor=_coords->begin(); - for(int i=0;i(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill); + INTERP_KERNEL::computeBarycenter2(type,nodal+nodalI[i]+1,nodalI[i+1]-nodalI[i]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } return ret.retn(); @@ -6487,20 +6495,20 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const checkFullyDefined(); MCAuto ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfCells=getNumberOfCells(); - int nbOfNodes=getNumberOfNodes(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfNodes=getNumberOfNodes(); ret->alloc(nbOfCells,spaceDim); double *ptToFill=ret->getPointer(); - const int *nodal=_nodal_connec->begin(); - const int *nodalI=_nodal_connec_index->begin(); + const mcIdType *nodal=_nodal_connec->begin(); + const mcIdType *nodalI=_nodal_connec_index->begin(); const double *coor=_coords->begin(); - for(int i=0;i=0 && *conn()); @@ -6510,7 +6518,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const throw INTERP_KERNEL::Exception(oss.str()); } } - int nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1; + mcIdType nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1; if(nbOfNodesInCell>0) std::transform(ptToFill,ptToFill+spaceDim,ptToFill,std::bind2nd(std::multiplies(),1./(double)nbOfNodesInCell)); else @@ -6521,9 +6529,9 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const } else { - std::set s(nodal+nodalI[i]+1,nodal+nodalI[i+1]); + std::set s(nodal+nodalI[i]+1,nodal+nodalI[i+1]); s.erase(-1); - for(std::set::const_iterator it=s.begin();it!=s.end();it++) + for(std::set::const_iterator it=s.begin();it!=s.end();it++) { if(*it>=0 && *it()); @@ -6564,21 +6572,21 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const * \ref py_mcumesh_getPartBarycenterAndOwner "Here is a Python example". * \endif */ -DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, const int *end) const +DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const { DataArrayDouble *ret=DataArrayDouble::New(); int spaceDim=getSpaceDimension(); - int nbOfTuple=(int)std::distance(begin,end); + std::size_t nbOfTuple=std::distance(begin,end); ret->alloc(nbOfTuple,spaceDim); double *ptToFill=ret->getPointer(); double *tmp=new double[spaceDim]; - const int *nodal=_nodal_connec->begin(); - const int *nodalI=_nodal_connec_index->begin(); + const mcIdType *nodal=_nodal_connec->begin(); + const mcIdType *nodalI=_nodal_connec_index->begin(); const double *coor=_coords->begin(); - for(const int *w=begin;w!=end;w++) + for(const mcIdType *w=begin;w!=end;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); + INTERP_KERNEL::computeBarycenter2(type,nodal+nodalI[*w]+1,nodalI[*w+1]-nodalI[*w]-1,coor,spaceDim,ptToFill); ptToFill+=spaceDim; } delete [] tmp; @@ -6600,14 +6608,15 @@ DataArrayDouble *MEDCouplingUMesh::getPartBarycenterAndOwner(const int *begin, c DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const { MCAuto ret(DataArrayDouble::New()); - int nbOfCells(getNumberOfCells()),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); double *retPtr(ret->getPointer()); - const int *nodal(_nodal_connec->begin()),*nodalI(_nodal_connec_index->begin()); + const mcIdType *nodal(_nodal_connec->begin()),*nodalI(_nodal_connec_index->begin()); const double *coor(_coords->begin()); - for(int i=0;i=4) @@ -6622,7 +6631,7 @@ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const 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++) { - int nodeId(nodal[nodalI[0]+1+j]); + mcIdType nodeId(nodal[nodalI[0]+1+j]); if(nodeId>=0 && nodeId()); - int nbOfNodesInCell(nodalI[1]-nodalI[0]-1); + mcIdType nbOfNodesInCell(nodalI[1]-nodalI[0]-1); std::transform(dd,dd+3,dd,std::bind2nd(std::multiplies(),1./(double)nbOfNodesInCell)); std::copy(dd,dd+3,matrix+4*2); INTERP_KERNEL::inverseMatrix(matrix,4,matrix2); @@ -6677,13 +6686,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da) if(name.empty()) ret->setName("Mesh"); ret->setCoords(da); - int nbOfTuples(da->getNumberOfTuples()); - MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); + mcIdType nbOfTuples(da->getNumberOfTuples()); + MCAuto c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(2*nbOfTuples,1); cI->alloc(nbOfTuples+1,1); - int *cp(c->getPointer()),*cip(cI->getPointer()); + mcIdType *cp(c->getPointer()),*cip(cI->getPointer()); *cip++=0; - for(int i=0;igetCoords(); if(coo) - spaceDim=coo->getNumberOfComponents(); + spaceDim=int(coo->getNumberOfComponents()); } if(spaceDim==-3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : no spaceDim specified ! unable to perform merge !"); @@ -6831,8 +6840,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetCoords(); int meshDim=meshes.front()->getMeshDimension(); std::vector::const_iterator iter=meshes.begin(); - int meshLgth=0; - int meshIndexLgth=0; + mcIdType meshLgth=0; + mcIdType meshIndexLgth=0; for(;iter!=meshes.end();iter++) { if(coords!=(*iter)->getCoords()) @@ -6842,22 +6851,22 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetNodalConnectivityArrayLen(); meshIndexLgth+=(*iter)->getNumberOfCells(); } - MCAuto nodal=DataArrayInt::New(); + MCAuto nodal=DataArrayIdType::New(); nodal->alloc(meshLgth,1); - int *nodalPtr=nodal->getPointer(); - MCAuto nodalIndex=DataArrayInt::New(); + mcIdType *nodalPtr=nodal->getPointer(); + MCAuto nodalIndex=DataArrayIdType::New(); nodalIndex->alloc(meshIndexLgth+1,1); - int *nodalIndexPtr=nodalIndex->getPointer(); - int offset=0; + mcIdType *nodalIndexPtr=nodalIndex->getPointer(); + mcIdType offset=0; for(iter=meshes.begin();iter!=meshes.end();iter++) { - const int *nod=(*iter)->getNodalConnectivity()->begin(); - const int *index=(*iter)->getNodalConnectivityIndex()->begin(); - int nbOfCells=(*iter)->getNumberOfCells(); - int meshLgth2=(*iter)->getNodalConnectivityArrayLen(); + const mcIdType *nod=(*iter)->getNodalConnectivity()->begin(); + const mcIdType *index=(*iter)->getNodalConnectivityIndex()->begin(); + 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::bind2nd(std::plus(),offset)); + nodalIndexPtr=std::transform(index+1,index+nbOfCells+1,nodalIndexPtr,std::bind2nd(std::plus(),offset)); else nodalIndexPtr=std::copy(index,index+nbOfCells+1,nodalIndexPtr); offset+=meshLgth2; @@ -6879,7 +6888,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) +MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr) { //All checks are delegated to MergeUMeshesOnSameCoords MCAuto ret=MergeUMeshesOnSameCoords(meshes); - MCAuto o2n=ret->zipConnectivityTraducer(compType); + MCAuto o2n=ret->zipConnectivityTraducer(compType); corr.resize(meshes.size()); std::size_t nbOfMeshes=meshes.size(); - int offset=0; - const int *o2nPtr=o2n->begin(); + mcIdType offset=0; + const mcIdType *o2nPtr=o2n->begin(); for(std::size_t i=0;igetNumberOfCells(); + DataArrayIdType *tmp=DataArrayIdType::New(); + mcIdType curNbOfCells=meshes[i]->getNumberOfCells(); tmp->alloc(curNbOfCells,1); std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer()); offset+=curNbOfCells; @@ -6960,11 +6969,11 @@ void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector res=DataArrayDouble::Aggregate(coords); std::vector::const_iterator it=meshes.begin(); - int offset=(*it)->getNumberOfNodes(); + mcIdType offset=(*it)->getNumberOfNodes(); (*it++)->setCoords(res); for(;it!=meshes.end();it++) { - int oldNumberOfNodes=(*it)->getNumberOfNodes(); + mcIdType oldNumberOfNodes=(*it)->getNumberOfNodes(); (*it)->setCoords(res); (*it)->shiftNodeNumbersInConn(offset); offset+=oldNumberOfNodes; @@ -7007,12 +7016,12 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vectorfindCommonTuples(eps,-1,comm,commI); - MCAuto tmp1(comm),tmp2(commI); - int oldNbOfNodes=coo->getNumberOfTuples(); - int newNbOfNodes; - MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); + MCAuto tmp1(comm),tmp2(commI); + mcIdType oldNbOfNodes=coo->getNumberOfTuples(); + mcIdType newNbOfNodes; + MCAuto o2n=DataArrayIdType::ConvertIndexArrayToO2N(oldNbOfNodes,comm->begin(),commI->begin(),commI->end(),newNbOfNodes); if(oldNbOfNodes==newNbOfNodes) return ; MCAuto newCoords=coo->renumberAndReduce(o2n->begin(),newNbOfNodes); @@ -7027,7 +7036,7 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vector > edges; + std::vector > edges; std::size_t nbOfFaces=std::count(begin,end,-1)+1; - const int *bgFace=begin; + const mcIdType *bgFace=begin; for(std::size_t i=0;i 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); } bgFace=endFace+1; } - return INTERP_KERNEL::calculateVolumeForPolyh2(begin,(int)std::distance(begin,end),coords)>-EPS_FOR_POLYH_ORIENTATION; + return INTERP_KERNEL::calculateVolumeForPolyh2(begin,ToIdType(std::distance(begin,end)),coords)>-EPS_FOR_POLYH_ORIENTATION; } /*! * The 3D extruded static cell (PENTA6,HEXA8,HEXAGP12...) its connectivity nodes in [ \a begin , \a end ). */ -bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const int *begin, const int *end, const double *coords) +bool MEDCouplingUMesh::Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords) { double vec0[3],vec1[3]; 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 !"); - int nbOfNodes=(int)sz/2; - INTERP_KERNEL::areaVectorOfPolygon(begin,nbOfNodes,coords,vec0); + 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]; vec1[0]=pt1[0]-pt0[0]; vec1[1]=pt1[1]-pt0[1]; vec1[2]=pt1[2]-pt0[2]; return (vec0[0]*vec1[0]+vec0[1]*vec1[1]+vec0[2]*vec1[2])<0.; } -void MEDCouplingUMesh::CorrectExtrudedStaticCell(int *begin, int *end) +void MEDCouplingUMesh::CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end) { std::size_t sz=std::distance(begin,end); - INTERP_KERNEL::AutoPtr tmp=new int[sz]; + INTERP_KERNEL::AutoPtr tmp=new mcIdType[sz]; std::size_t nbOfNodes(sz/2); - std::copy(begin,end,(int *)tmp); + std::copy(begin,end,(mcIdType *)tmp); for(std::size_t j=1;j(begin,4,coords,vec0); + INTERP_KERNEL::areaVectorOfPolygon(begin,4,coords,vec0); const double *pt0=coords+3*begin[0],*pt1=coords+3*begin[4]; return (vec0[0]*(pt1[0]-pt0[0])+vec0[1]*(pt1[1]-pt0[1])+vec0[2]*(pt1[2]-pt0[2]))<0.; } @@ -7155,74 +7164,74 @@ bool MEDCouplingUMesh::IsPyra5WellOriented(const int *begin, const int *end, con * \param [in] end end of nodal connectivity of a single polyhedron cell (excluded) * \param [out] res the result is put at the end of the vector without any alteration of the data. */ -void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, int index, DataArrayInt *res, MEDCouplingUMesh *faces, - DataArrayInt *E_Fi, DataArrayInt *E_F, DataArrayInt *F_Ei, DataArrayInt *F_E) +void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces, + DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E) { - int nbFaces = E_Fi->getIJ(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); double *pPtr=p->getPointer(); - int *e_fi = E_Fi->getPointer(), *e_f = E_F->getPointer(), *f_ei = F_Ei->getPointer(), *f_e = F_E->getPointer(); - const int *f_idx = faces->getNodalConnectivityIndex()->getPointer(), *f_cnn = faces->getNodalConnectivity()->getPointer(); - for(int i=0;igetPointer(), *e_f = E_F->getPointer(), *f_ei = F_Ei->getPointer(), *f_e = F_E->getPointer(); + 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; - for (int j = f_ei[face]; j < f_ei[face + 1]; j++) - *pPtr += f_e[j]; + for (mcIdType j = f_ei[face]; j < f_ei[face + 1]; j++) + *pPtr += FromIdType(f_e[j]); } pPtr=p->getPointer(); vPtr=v->getPointer(); - DataArrayInt *comm1=0,*commI1=0; + DataArrayIdType *comm1=0,*commI1=0; v->findCommonTuples(eps,-1,comm1,commI1); - for (int i = 0; i < nbFaces; i++) + for (mcIdType i = 0; i < nbFaces; i++) if (comm1->findIdFirstEqual(i) < 0) { comm1->pushBackSilent(i); commI1->pushBackSilent(comm1->getNumberOfTuples()); } - MCAuto comm1Auto(comm1),commI1Auto(commI1); - const int *comm1Ptr=comm1->begin(); - const int *commI1Ptr=commI1->begin(); - int nbOfGrps1=commI1Auto->getNumberOfTuples()-1; - res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED); + MCAuto comm1Auto(comm1),commI1Auto(commI1); + const mcIdType *comm1Ptr=comm1->begin(); + const mcIdType *commI1Ptr=commI1->begin(); + mcIdType nbOfGrps1=commI1Auto->getNumberOfTuples()-1; + res->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYHED)); // - for(int i=0;i tmpgrp2=p->selectByTupleId(comm1Ptr+commI1Ptr[i],comm1Ptr+commI1Ptr[i+1]); - DataArrayInt *comm2=0,*commI2=0; + DataArrayIdType *comm2=0,*commI2=0; tmpgrp2->findCommonTuples(eps,-1,comm2,commI2); - for (int j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++) + for (mcIdType j = 0; j < commI1Ptr[i+1] - commI1Ptr[i]; j++) if (comm2->findIdFirstEqual(j) < 0) { comm2->pushBackSilent(j); commI2->pushBackSilent(comm2->getNumberOfTuples()); } - MCAuto comm2Auto(comm2),commI2Auto(commI2); - const int *comm2Ptr=comm2->begin(); - const int *commI2Ptr=commI2->begin(); - int nbOfGrps2=commI2Auto->getNumberOfTuples()-1; - for(int j=0;j comm2Auto(comm2),commI2Auto(commI2); + const mcIdType *comm2Ptr=comm2->begin(); + const mcIdType *commI2Ptr=commI2->begin(); + 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 { - int pointId=comm1Ptr[commI1Ptr[i]+comm2Ptr[commI2Ptr[j]]]; - MCAuto ids2=comm2->selectByTupleIdSafeSlice(commI2Ptr[j],commI2Ptr[j+1],1); + 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]); MCAuto mm3=static_cast(faces->buildPartOfMySelf(ids2->begin(),ids2->end(),true)); - MCAuto idsNodeTmp=mm3->zipCoordsTraducer(); - MCAuto idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes()); - const int *idsNodePtr=idsNode->begin(); + MCAuto idsNodeTmp=mm3->zipCoordsTraducer(); + MCAuto idsNode=idsNodeTmp->invertArrayO2N2N2O(mm3->getNumberOfNodes()); + 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 norm=vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]; @@ -7233,13 +7242,13 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble } mm3->changeSpaceDimension(2); MCAuto mm4=mm3->buildSpreadZonesWithPoly(); - const int *conn4=mm4->getNodalConnectivity()->begin(); - const int *connI4=mm4->getNodalConnectivityIndex()->begin(); - int nbOfCells=mm4->getNumberOfCells(); - for(int k=0;kgetNodalConnectivity()->begin(); + const mcIdType *connI4=mm4->getNodalConnectivityIndex()->begin(); + mcIdType nbOfCells=mm4->getNumberOfCells(); + for(mcIdType k=0;kpushBackSilent(idsNodePtr[*work]); res->pushBackSilent(-1); } @@ -7260,7 +7269,7 @@ void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble * \param [out] v the normalized vector of size 3 * \param [out] p the pos of plane */ -void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, const int *begin, const int *end, double *v, double *p) +void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p) { std::size_t nbPoints=std::distance(begin,end); if(nbPoints<3) @@ -7306,15 +7315,15 @@ void MEDCouplingUMesh::ComputeVecAndPtOfFace(double eps, const double *coords, c * This method tries to obtain a well oriented polyhedron. * If the algorithm fails, an exception will be thrown. */ -void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords) +void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords) { - std::list< std::pair > edgesOK,edgesFinished; + std::list< std::pair > edgesOK,edgesFinished; 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; - int *bgFace=begin,*endFace=std::find(begin+1,end,-1); + 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 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()) { @@ -7329,8 +7338,8 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c bool b; for(std::size_t j=0;j p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair p2(p1.second,p1.first); + 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; } @@ -7341,13 +7350,13 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c std::reverse(bgFace+1,endFace); for(std::size_t j=0;j p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); - std::pair 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()); } - std::list< std::pair >::iterator 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); @@ -7365,7 +7374,7 @@ void MEDCouplingUMesh::TryToCorrectPolyhedronOrientation(int *begin, int *end, c } if(!edgesOK.empty()) { throw INTERP_KERNEL::Exception("The polyhedron looks too bad to be repaired : Some edges are shared only once !"); } - if(INTERP_KERNEL::calculateVolumeForPolyh2(begin,(int)std::distance(begin,end),coords)<-EPS_FOR_POLYH_ORIENTATION) + if(INTERP_KERNEL::calculateVolumeForPolyh2(begin,ToIdType(std::distance(begin,end)),coords)<-EPS_FOR_POLYH_ORIENTATION) {//not lucky ! The first face was not correctly oriented : reorient all faces... bgFace=begin; for(std::size_t i=0;i skin(computeSkin()); - int oldNbOfNodes(skin->getNumberOfNodes()); - MCAuto o2n(skin->zipCoordsTraducer()); - int nbOfNodesExpected(skin->getNumberOfNodes()); - MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); - int nbCells(skin->getNumberOfCells()); + mcIdType oldNbOfNodes(skin->getNumberOfNodes()); + MCAuto o2n(skin->zipCoordsTraducer()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + MCAuto n2o(o2n->invertArrayO2N2N2O(oldNbOfNodes)); + mcIdType nbCells=skin->getNumberOfCells(); if(nbCells==nbOfNodesExpected) return buildUnionOf2DMeshLinear(skin,n2o); else if(2*nbCells==nbOfNodesExpected) @@ -7408,20 +7417,20 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMesh() const * * \return a newly allocated array containing the connectivity of a polygon type enum included (NORM_POLYHED in pos#0) */ -DataArrayInt *MEDCouplingUMesh::buildUnionOf3DMesh() const +DataArrayIdType *MEDCouplingUMesh::buildUnionOf3DMesh() const { if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildUnionOf3DMesh : meshdimension, spacedimension must be equal to 2 !"); MCAuto m=computeSkin(); - const int *conn=m->getNodalConnectivity()->begin(); - const int *connI=m->getNodalConnectivityIndex()->begin(); - int nbOfCells=m->getNumberOfCells(); - MCAuto ret=DataArrayInt::New(); ret->alloc(m->getNodalConnectivity()->getNumberOfTuples(),1); - int *work=ret->getPointer(); *work++=INTERP_KERNEL::NORM_POLYHED; + const mcIdType *conn=m->getNodalConnectivity()->begin(); + const mcIdType *connI=m->getNodalConnectivityIndex()->begin(); + 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) return ret.retn(); work=std::copy(conn+connI[0]+1,conn+connI[1],work); - for(int i=1;igetMeshDimension(); - MEDCoupling::DataArrayInt* indexr=MEDCoupling::DataArrayInt::New(); - MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* indexr=MEDCoupling::DataArrayIdType::New(); + MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); this->getReverseNodalConnectivity(revConn,indexr); - const int* indexr_ptr=indexr->begin(); - const int* revConn_ptr=revConn->begin(); + const mcIdType* indexr_ptr=indexr->begin(); + const mcIdType* revConn_ptr=revConn->begin(); - const MEDCoupling::DataArrayInt* index; - const MEDCoupling::DataArrayInt* conn; + const MEDCoupling::DataArrayIdType* index; + const MEDCoupling::DataArrayIdType* conn; conn=this->getNodalConnectivity(); // it includes a type as the 1st element!!! index=this->getNodalConnectivityIndex(); - int nbCells=this->getNumberOfCells(); - const int* index_ptr=index->begin(); - const int* conn_ptr=conn->begin(); + mcIdType nbCells=this->getNumberOfCells(); + const mcIdType* index_ptr=index->begin(); + const mcIdType* conn_ptr=conn->begin(); //creating graph arcs (cell to cell relations) //arcs are stored in terms of (index,value) notation @@ -7468,25 +7477,25 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const //warning here one node have less than or equal effective number of cell with it //but cell could have more than effective nodes //because other equals nodes in other domain (with other global inode) - std::vector cell2cell_index(nbCells+1,0); - std::vector cell2cell; + std::vector cell2cell_index(nbCells+1,0); + std::vector cell2cell; cell2cell.reserve(3*nbCells); - for (int icell=0; icell counter; - for (int iconn=index_ptr[icell]+1; iconn counter; + for (mcIdType iconn=index_ptr[icell]+1; iconn::iterator iter=counter.find(icell2); + mcIdType icell2=revConn_ptr[iconnr]; + std::map::iterator iter=counter.find(icell2); if (iter!=counter.end()) (iter->second)++; else counter.insert(std::make_pair(icell2,1)); } } - for (std::map::const_iterator iter=counter.begin(); + for (std::map::const_iterator iter=counter.begin(); iter!=counter.end(); iter++) if (iter->second >= meshDim) { @@ -7497,7 +7506,7 @@ MEDCouplingSkyLineArray* MEDCouplingUMesh::generateGraph() const indexr->decrRef(); revConn->decrRef(); cell2cell_index[0]=0; - for (int icell=0; icell\n"; @@ -7527,15 +7536,15 @@ void MEDCouplingUMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData } ofs << " \n"; ofs << " \n"; - const int *cPtr=_nodal_connec->begin(); - const int *cIPtr=_nodal_connec_index->begin(); - MCAuto faceoffsets=DataArrayInt::New(); faceoffsets->alloc(nbOfCells,1); - MCAuto types=DataArrayInt::New(); types->alloc(nbOfCells,1); - MCAuto offsets=DataArrayInt::New(); offsets->alloc(nbOfCells,1); - MCAuto connectivity=DataArrayInt::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1); - int *w1=faceoffsets->getPointer(),*w2=types->getPointer(),*w3=offsets->getPointer(),*w4=connectivity->getPointer(); - int szFaceOffsets=0,szConn=0; - for(int i=0;ibegin(); + const mcIdType *cIPtr=_nodal_connec_index->begin(); + MCAuto faceoffsets=DataArrayIdType::New(); faceoffsets->alloc(nbOfCells,1); + MCAuto types=DataArrayIdType::New(); types->alloc(nbOfCells,1); + MCAuto offsets=DataArrayIdType::New(); offsets->alloc(nbOfCells,1); + MCAuto connectivity=DataArrayIdType::New(); connectivity->alloc(_nodal_connec->getNumberOfTuples()-nbOfCells,1); + mcIdType *w1=faceoffsets->getPointer(),*w2=types->getPointer(),*w3=offsets->getPointer(),*w4=connectivity->getPointer(); + mcIdType szFaceOffsets=0,szConn=0; + for(mcIdType i=0;i c(cPtr+cIPtr[i]+1,cPtr+cIPtr[i+1]); c.erase(-1); - *w3=szConn+(int)c.size(); szConn+=(int)c.size(); + 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); } } types->transformWithIndArr(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE+1); types->writeVTK(ofs,8,"UInt8","types",byteData); - offsets->writeVTK(ofs,8,"Int32","offsets",byteData); + std::string vtkTypeName = Traits::VTKReprStr; + offsets->writeVTK(ofs,8,vtkTypeName,"offsets",byteData); if(szFaceOffsets!=0) {//presence of Polyhedra connectivity->reAlloc(szConn); - faceoffsets->writeVTK(ofs,8,"Int32","faceoffsets",byteData); - MCAuto faces=DataArrayInt::New(); faces->alloc(szFaceOffsets,1); + faceoffsets->writeVTK(ofs,8,vtkTypeName,"faceoffsets",byteData); + MCAuto faces=DataArrayIdType::New(); faces->alloc(szFaceOffsets,1); w1=faces->getPointer(); - for(int i=0;iwriteVTK(ofs,8,"Int32","faces",byteData); + faces->writeVTK(ofs,8,vtkTypeName,"faces",byteData); } - connectivity->writeVTK(ofs,8,"Int32","connectivity",byteData); + connectivity->writeVTK(ofs,8,vtkTypeName,"connectivity",byteData); ofs << " \n"; ofs << "
\n"; ofs << " \n"; @@ -7602,8 +7612,8 @@ void MEDCouplingUMesh::reprQuickOverview(std::ostream& stream) const { stream << std::endl << "Nodal connectivity NOT set !"; return ; } if(!_nodal_connec_index->isAllocated()) { stream << std::endl << "Nodal connectivity set but not allocated !"; return ; } - int lgth=_nodal_connec_index->getNumberOfTuples(); - int 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 << "."; @@ -7625,54 +7635,54 @@ std::string MEDCouplingUMesh::getVTKFileExtension() const * Provides a renumbering of the cells of this (which has to be a piecewise connected 1D line), so that * the segments of the line are indexed in consecutive order (i.e. cells \a i and \a i+1 are neighbors). * This doesn't modify the mesh. This method only works using nodal connectivity consideration. Coordinates of nodes are ignored here. - * The caller is to deal with the resulting DataArrayInt. + * The caller is to deal with the resulting DataArrayIdType. * \throw If the coordinate array is not set. * \throw If the nodal connectivity of the cells is not defined. * \throw If m1 is not a mesh of dimension 2, or m1 is not a mesh of dimension 1 * \throw If m2 is not a (piecewise) line (i.e. if a point has more than 2 adjacent segments) * - * \sa DataArrayInt::sortEachPairToMakeALinkedList + * \sa DataArrayIdType::sortEachPairToMakeALinkedList */ -DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const +DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const { checkFullyDefined(); if(getMeshDimension()!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D works on unstructured mesh with meshdim = 1 !"); // Check that this is a line (and not a more complex 1D mesh) - each point is used at most by 2 segments: - MCAuto _d(DataArrayInt::New()),_dI(DataArrayInt::New()); - MCAuto _rD(DataArrayInt::New()),_rDI(DataArrayInt::New()); + MCAuto _d(DataArrayIdType::New()),_dI(DataArrayIdType::New()); + MCAuto _rD(DataArrayIdType::New()),_rDI(DataArrayIdType::New()); MCAuto m_points(buildDescendingConnectivity(_d, _dI, _rD, _rDI)); - const int *d(_d->begin()), *dI(_dI->begin()); - const int *rD(_rD->begin()), *rDI(_rDI->begin()); - MCAuto _dsi(_rDI->deltaShiftIndex()); - const int * dsi(_dsi->begin()); - MCAuto dsii = _dsi->findIdsNotInRange(0,3); + const mcIdType *d(_d->begin()), *dI(_dI->begin()); + const mcIdType *rD(_rD->begin()), *rDI(_rDI->begin()); + MCAuto _dsi(_rDI->deltaShiftIndex()); + const mcIdType * dsi(_dsi->begin()); + MCAuto dsii = _dsi->findIdsNotInRange(0,3); m_points=0; if (dsii->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::orderConsecutiveCells1D only work with a mesh being a (piecewise) connected line!"); - int nc(getNumberOfCells()); - MCAuto result(DataArrayInt::New()); + mcIdType nc=getNumberOfCells(); + MCAuto result(DataArrayIdType::New()); result->alloc(nc,1); // set of edges not used so far - std::set edgeSet; - for (int i=0; i edgeSet; + for (mcIdType i=0; i linePiece; + std::list linePiece; // fills a list of consecutive segment linked to startSeg. This can go forward or backward. for (int direction=0;direction<2;direction++) // direction=0 --> forward, direction=1 --> backward { // Fill the list forward (resp. backward) from the start segment: - int activeSeg = startSeg; - int prevPointId = -20; - int ptId; + mcIdType activeSeg = startSeg; + mcIdType prevPointId = -20; + mcIdType ptId; while (!edgeSet.empty()) { if (!(direction == 1 && prevPointId==-20)) // prevent adding twice startSeg @@ -7684,18 +7694,18 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const edgeSet.erase(activeSeg); } - int ptId1 = d[dI[activeSeg]], ptId2 = d[dI[activeSeg]+1]; + mcIdType ptId1 = d[dI[activeSeg]], ptId2 = d[dI[activeSeg]+1]; ptId = direction ? (ptId1 == prevPointId ? ptId2 : ptId1) : (ptId2 == prevPointId ? ptId1 : ptId2); if (dsi[ptId] == 1) // hitting the end of the line break; prevPointId = ptId; - int seg1 = rD[rDI[ptId]], seg2 = rD[rDI[ptId]+1]; + mcIdType seg1 = rD[rDI[ptId]], seg2 = rD[rDI[ptId]+1]; activeSeg = (seg1 == activeSeg) ? seg2 : seg1; } } // Done, save final piece into DA: std::copy(linePiece.begin(), linePiece.end(), result->getPointer()+newIdx); - newIdx += linePiece.size(); + newIdx += ToIdType(linePiece.size()); // identify next valid start segment (one which is not consumed) if(!edgeSet.empty()) @@ -7715,7 +7725,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const * \b WARNING : is returned value is different from 0 a call to MEDCouplingUMesh::mergeNodes is necessary to * avoid to have a non conform mesh. * - * \return int - the number of new nodes created (in most of cases 0). + * \return mcIdType - the number of new nodes created (in most of cases 0). * * \throw If \a this is not coherent. * \throw If \a this has not spaceDim equal to 2. @@ -7723,7 +7733,7 @@ DataArrayInt *MEDCouplingUMesh::orderConsecutiveCells1D() const * \throw If some subcells needed to be split are orphan. * \sa MEDCouplingUMesh::conformize2D */ -int MEDCouplingUMesh::split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt, const DataArrayInt *midOptI) +mcIdType MEDCouplingUMesh::split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt, const DataArrayIdType *midOptI) { if(!desc || !descI || !subNodesInSeg || !subNodesInSegI) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split2DCells : the 4 first arrays must be not null !"); @@ -7750,7 +7760,7 @@ int MEDCouplingUMesh::split2DCells(const DataArrayInt *desc, const DataArrayInt * * \return false if the input connectivity represents already the convex hull, true if the input cell needs to be reordered. */ -bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, DataArrayInt *nodalConnecOut) +bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut) { std::size_t sz=std::distance(nodalConnBg,nodalConnEnd); if(sz>=4) @@ -7758,8 +7768,8 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)*nodalConnBg); if(cm.getDimension()==2) { - const int *node=nodalConnBg+1; - int startNode=*node++; + const mcIdType *node=nodalConnBg+1; + mcIdType startNode=*node++; double refX=coords[2*startNode]; for(;node!=nodalConnEnd;node++) { @@ -7769,14 +7779,14 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co refX=coords[2*startNode]; } } - std::vector tmpOut; tmpOut.reserve(sz); tmpOut.push_back(startNode); + std::vector tmpOut; tmpOut.reserve(sz); tmpOut.push_back(startNode); refX=1e300; double tmp1; double tmp2[2]; double angle0=-M_PI/2; // - int nextNode=-1; - int prevNode=-1; + mcIdType nextNode=-1; + mcIdType prevNode=-1; double resRef; double angleNext=0.; while(nextNode!=startNode) @@ -7811,8 +7821,8 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co tmpOut.push_back(nextNode); } } - std::vector tmp3(2*(sz-1)); - std::vector::iterator it=std::copy(nodalConnBg+1,nodalConnEnd,tmp3.begin()); + std::vector tmp3(2*(sz-1)); + 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()) { @@ -7826,7 +7836,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co } else { - nodalConnecOut->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON); + nodalConnecOut->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_POLYGON)); nodalConnecOut->insertAtTheEnd(tmpOut.begin(),tmpOut.end()); return true; } @@ -7841,7 +7851,7 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co /*! * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arr indexes is in \b arrIndxIn. * This method expects that these two input arrays come from the output of MEDCouplingUMesh::computeNeighborsOfCells method. - * This method start from id 0 that will be contained in output DataArrayInt. It searches then all neighbors of id0 looking at arrIn[arrIndxIn[0]:arrIndxIn[0+1]]. + * This method start from id 0 that will be contained in output DataArrayIdType. It searches then all neighbors of id0 looking at arrIn[arrIndxIn[0]:arrIndxIn[0+1]]. * Then it is repeated recursively until either all ids are fetched or no more ids are reachable step by step. * A negative value in \b arrIn means that it is ignored. * This method is useful to see if a mesh is contiguous regarding its connectivity. If it is not the case the size of returned array is different from arrIndxIn->getNumberOfTuples()-1. @@ -7851,16 +7861,16 @@ bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, co * \return a newly allocated DataArray that stores all ids fetched by the gradually spread process. * \sa MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed, MEDCouplingUMesh::partitionBySpreadZone */ -DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) +DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn) { - int seed=0,nbOfDepthPeelingPerformed=0; + mcIdType seed=0,nbOfDepthPeelingPerformed=0; return ComputeSpreadZoneGraduallyFromSeed(&seed,&seed+1,arrIn,arrIndxIn,-1,nbOfDepthPeelingPerformed); } /*! * This method works on a pair input (\b arrIn, \b arrIndxIn) where \b arr indexes is in \b arrIndxIn. * This method expects that these two input arrays come from the output of MEDCouplingUMesh::computeNeighborsOfCells method. - * This method start from id 0 that will be contained in output DataArrayInt. It searches then all neighbors of id0 regarding arrIn[arrIndxIn[0]:arrIndxIn[0+1]]. + * This method start from id 0 that will be contained in output DataArrayIdType. It searches then all neighbors of id0 regarding arrIn[arrIndxIn[0]:arrIndxIn[0+1]]. * Then it is repeated recursively until either all ids are fetched or no more ids are reachable step by step. * A negative value in \b arrIn means that it is ignored. * This method is useful to see if a mesh is contiguous regarding its connectivity. If it is not the case the size of returned array is different from arrIndxIn->getNumberOfTuples()-1. @@ -7873,15 +7883,15 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGradually(const DataArrayInt *a * \return a newly allocated DataArray that stores all ids fetched by the gradually spread process. * \sa MEDCouplingUMesh::partitionBySpreadZone */ -DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed) +DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed) { nbOfDepthPeelingPerformed=0; if(!arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed : arrIndxIn input pointer is NULL !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; if(nbOfTuples<=0) { - DataArrayInt *ret=DataArrayInt::New(); ret->alloc(0,1); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc(0,1); return ret; } // @@ -7907,17 +7917,17 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const int spaceDim=getSpaceDimension(); if(mdim!=spaceDim) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSpreadZonesWithPoly : meshdimension and spacedimension do not match !"); - std::vector partition=partitionBySpreadZone(); - std::vector< MCAuto > partitionAuto; partitionAuto.reserve(partition.size()); - std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); + std::vector partition=partitionBySpreadZone(); + std::vector< MCAuto > partitionAuto; partitionAuto.reserve(partition.size()); + std::copy(partition.begin(),partition.end(),std::back_insert_iterator > >(partitionAuto)); MCAuto ret=MEDCouplingUMesh::New(getName(),mdim); ret->setCoords(getCoords()); - ret->allocateCells((int)partition.size()); + ret->allocateCells(ToIdType(partition.size())); // - for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) + for(std::vector::const_iterator it=partition.begin();it!=partition.end();it++) { MCAuto tmp=static_cast(buildPartOfMySelf((*it)->begin(),(*it)->end(),true)); - MCAuto cell; + MCAuto cell; switch(mdim) { case 2: @@ -7942,56 +7952,56 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const * This method only needs a well defined connectivity. Coordinates are not considered here. * This method returns a vector of \b newly allocated arrays that the caller has to deal with. */ -std::vector MEDCouplingUMesh::partitionBySpreadZone() const +std::vector MEDCouplingUMesh::partitionBySpreadZone() const { - DataArrayInt *neigh=0,*neighI=0; + DataArrayIdType *neigh=0,*neighI=0; computeNeighborsOfCells(neigh,neighI); - MCAuto neighAuto(neigh),neighIAuto(neighI); + MCAuto neighAuto(neigh),neighIAuto(neighI); return PartitionBySpreadZone(neighAuto,neighIAuto); } -std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) +std::vector MEDCouplingUMesh::PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn) { if(!arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("PartitionBySpreadZone : null input pointers !"); arrIn->checkAllocated(); arrIndxIn->checkAllocated(); - int 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 !"); - int nbOfCellsCur(nbOfTuples-1); - std::vector ret; + mcIdType nbOfCellsCur(nbOfTuples-1); + std::vector ret; if(nbOfCellsCur<=0) return ret; std::vector fetchedCells(nbOfCellsCur,false); - std::vector< MCAuto > ret2; - int seed=0; + std::vector< MCAuto > ret2; + mcIdType seed=0; while(seed >::iterator it=ret2.begin();it!=ret2.end();it++) + for(std::vector< MCAuto >::iterator it=ret2.begin();it!=ret2.end();it++) ret.push_back((*it).retn()); return ret; } /*! * This method returns given a distribution of cell type (returned for example by MEDCouplingUMesh::getDistributionOfTypes method and customized after) a - * newly allocated DataArrayInt instance with 2 components ready to be interpreted as input of DataArrayInt::findRangeIdForEachTuple method. + * newly allocated DataArrayIdType instance with 2 components ready to be interpreted as input of DataArrayIdType::findRangeIdForEachTuple method. * * \param [in] code a code with the same format than those returned by MEDCouplingUMesh::getDistributionOfTypes except for the code[3*k+2] that should contain start id of chunck. - * \return a newly allocated DataArrayInt to be managed by the caller. + * \return a newly allocated DataArrayIdType to be managed by the caller. * \throw In case of \a code has not the right format (typically of size 3*n) */ -DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector& code) +DataArrayIdType *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vector& code) { - MCAuto ret=DataArrayInt::New(); + MCAuto ret=DataArrayIdType::New(); std::size_t nb=code.size()/3; if(code.size()%3!=0) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeRangesFromTypeDistribution : invalid input code !"); - ret->alloc((int)nb,2); - int *retPtr=ret->getPointer(); + ret->alloc(nb,2); + mcIdType *retPtr=ret->getPointer(); for(std::size_t i=0;i_coords. If > 0 a new coordinates object will be constructed result of the aggregation of the old one and the new points added. - * \param [out] n2oCells - A new instance of DataArrayInt holding, for each new cell, + * \param [out] n2oCells - A new instance of DataArrayIdType holding, for each new cell, * an id of old cell producing it. The caller is to delete this array using * decrRef() as it is no more needed. * \return MEDCoupling1SGTUMesh * - the mesh containing only INTERP_KERNEL::NORM_TETRA4 cells. @@ -8024,34 +8034,35 @@ DataArrayInt *MEDCouplingUMesh::ComputeRangesFromTypeDistribution(const std::vec * \throw If \a this is not fully constituted with linear 3D cells. * \sa MEDCouplingUMesh::simplexize, MEDCoupling1SGTUMesh::sortHexa8EachOther */ -MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *& n2oCells, int& nbOfAdditionalPoints) const +MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const { 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 !"); - int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes()); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbNodes(getNumberOfNodes()); MCAuto ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4)); - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfCells,1); - int *retPt(ret->getPointer()); - MCAuto newConn(DataArrayInt::New()); newConn->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfCells,1); + mcIdType *retPt(ret->getPointer()); + MCAuto newConn(DataArrayIdType::New()); newConn->alloc(0,1); MCAuto addPts(DataArrayDouble::New()); addPts->alloc(0,1); - const int *oldc(_nodal_connec->begin()); - const int *oldci(_nodal_connec_index->begin()); + const mcIdType *oldc(_nodal_connec->begin()); + const mcIdType *oldci(_nodal_connec_index->begin()); const double *coords(_coords->begin()); - for(int i=0;i a; std::vector b; + 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 nbOfTet(a.size()/4); *retPt=(int)nbOfTet; - const int *aa(&a[0]); + std::size_t nbOfTet(a.size()/4); *retPt=ToIdType(nbOfTet); + const mcIdType *aa(&a[0]); if(!b.empty()) { - for(std::vector::iterator it=a.begin();it!=a.end();it++) + 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+=(int)b.size()/3; + nbNodes+=ToIdType(b.size()/3); } for(std::size_t j=0;jinsertAtTheEnd(aa,aa+4); @@ -8093,7 +8104,7 @@ MEDCouplingUMeshCellIterator::~MEDCouplingUMeshCellIterator() delete _cell; } -MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, int bg, int end):_mesh(mesh),_cell(itc), +MEDCouplingUMeshCellIterator::MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end):_mesh(mesh),_cell(itc), _own_cell(false),_cell_id(bg-1), _nb_cell(end) { @@ -8130,7 +8141,7 @@ MEDCouplingUMeshCellByTypeEntry::~MEDCouplingUMeshCellByTypeEntry() _mesh->decrRef(); } -MEDCouplingUMeshCellEntry::MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, int bg, int end):_mesh(mesh),_type(type), +MEDCouplingUMeshCellEntry::MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end):_mesh(mesh),_type(type), _itc(itc), _bg(bg),_end(end) { @@ -8149,7 +8160,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshCellEntry::getType() const return _type; } -int MEDCouplingUMeshCellEntry::getNumberOfElems() const +mcIdType MEDCouplingUMeshCellEntry::getNumberOfElems() const { return _end-_bg; } @@ -8177,13 +8188,13 @@ MEDCouplingUMeshCellByTypeIterator::~MEDCouplingUMeshCellByTypeIterator() MEDCouplingUMeshCellEntry *MEDCouplingUMeshCellByTypeIterator::nextt() { - const int *c=_mesh->getNodalConnectivity()->begin(); - const int *ci=_mesh->getNodalConnectivityIndex()->begin(); + const mcIdType *c=_mesh->getNodalConnectivity()->begin(); + const mcIdType *ci=_mesh->getNodalConnectivityIndex()->begin(); if(_cell_id<_nb_cell) { INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)c[ci[_cell_id]]; - int nbOfElems=(int)std::distance(ci+_cell_id,std::find_if(ci+_cell_id,ci+_nb_cell,MEDCouplingImpl::ConnReader(c,type))); - int startId=_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); } @@ -8216,7 +8227,7 @@ std::string MEDCouplingUMeshCell::repr() const { std::ostringstream oss; oss << "Cell Type " << INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)_conn[0]).getRepr(); oss << " : "; - std::copy(_conn+1,_conn+_conn_lgth,std::ostream_iterator(oss," ")); + std::copy(_conn+1,_conn+_conn_lgth,std::ostream_iterator(oss," ")); return oss.str(); } else @@ -8231,7 +8242,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMeshCell::getType() const return INTERP_KERNEL::NORM_ERROR; } -const int *MEDCouplingUMeshCell::getAllConn(int& lgth) const +const mcIdType *MEDCouplingUMeshCell::getAllConn(mcIdType& lgth) const { lgth=_conn_lgth; if(_conn_lgth!=NOTICABLE_FIRST_VAL) diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 25fb72c8d..87a1c9a7d 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -58,125 +58,125 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const; MEDCOUPLING_EXPORT void setMeshDimension(int meshDim); - MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0); - MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell); + MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0); + MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell); MEDCOUPLING_EXPORT void finishInsertingCells(); MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator(); MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType(); MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT std::vector getAllGeoTypesSorted() const; - MEDCOUPLING_EXPORT std::set getTypesOfPart(const int *begin, const int *end) const; - MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true); - MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivity() const { return _nodal_connec; } - MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; } - MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() { return _nodal_connec; } - MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() { return _nodal_connec_index; } - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const; - MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - MEDCOUPLING_EXPORT void getNodeIdsOfCell(std::size_t cellId, std::vector& conn) const; + MEDCOUPLING_EXPORT std::set getTypesOfPart(const mcIdType *begin, const mcIdType *end) const; + MEDCOUPLING_EXPORT void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true); + MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivity() const { return _nodal_connec; } + 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; + 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(int spaceDim) const; - MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const; - MEDCOUPLING_EXPORT std::size_t getNumberOfCells() const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const; MEDCOUPLING_EXPORT int getMeshDimension() const; - MEDCOUPLING_EXPORT int getNodalConnectivityArrayLen() 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; - MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; - MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; - MEDCOUPLING_EXPORT void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + 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 int *conn, const int *connI, int cell1, int cell2, int compType); - MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const int *conn, const int *connI, int cell1, int cell2); - MEDCOUPLING_EXPORT void convertToPolyTypes(const int *cellIdsToConvertBg, const int *cellIdsToConvertEnd); + 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); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2); + MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2); + MEDCOUPLING_EXPORT void convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd); MEDCOUPLING_EXPORT void convertAllToPoly(); MEDCOUPLING_EXPORT void convertExtrudedPolyhedra(); MEDCOUPLING_EXPORT bool unPolyze(); MEDCOUPLING_EXPORT void simplifyPolyhedra(double eps); MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSpreadZonesWithPoly() const; - MEDCOUPLING_EXPORT std::vector partitionBySpreadZone() const; - MEDCOUPLING_EXPORT DataArrayInt *computeFetchedNodeIds() const; - MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const; + MEDCOUPLING_EXPORT std::vector partitionBySpreadZone() const; + MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const; + MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const; MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector& nodeIdsInUse) const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer(); - MEDCOUPLING_EXPORT void findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const; - MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayInt *& arr) const; - MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; - MEDCOUPLING_EXPORT MCAuto explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const; - MEDCOUPLING_EXPORT void computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI, MCAuto& cellNeigh, MCAuto& cellNeighIndex) const; - MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI, - DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx); - MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const; - MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto &neighbors, MCAuto& neighborsIdx) 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; + MEDCOUPLING_EXPORT MCAuto explodeIntoEdges(MCAuto& desc, MCAuto& descIndex, MCAuto& revDesc, MCAuto& revDescIndx) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const; + MEDCOUPLING_EXPORT void computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto& cellNeigh, MCAuto& cellNeighIndex) const; + MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI, + 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; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const int *begin, const int *end, bool keepCoords=true) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(int start, int end, int step, bool keepCoords=true) const; - MEDCOUPLING_EXPORT void setPartOfMySelf(const int *cellIdsBg, const int *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis); - MEDCOUPLING_EXPORT void setPartOfMySelfSlice(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis); - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const int *begin, const int *end, bool fullyIn) 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; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const; - MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() const; + MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const; MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const; - MEDCOUPLING_EXPORT DataArrayInt *findCellIdsOnBoundary() const; - MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const; + MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const; + MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const; MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const; - MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, - DataArrayInt *& cellIdsNeededToBeRenum, DataArrayInt *& cellIdsNotModified) const; - MEDCOUPLING_EXPORT void duplicateNodes(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd); - MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(int offset); - MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap& newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N); - MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map& newNodeNumbersO2N) override; - MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(int delta); - MEDCOUPLING_EXPORT void duplicateNodesInConn(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd, int offset); - MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check=true); - MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const double *bbox, double eps) const; - MEDCOUPLING_EXPORT DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); + MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *& nodeIdsToDuplicate, + DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const; + MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd); + 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); + 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 int *begin, const int *end) const; + MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const; - MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const int *begin, const int *end) 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, DataArrayInt *&cellIds) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayInt *&cellIds) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const; + MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const; MEDCOUPLING_EXPORT MCAuto clipSingle3DCellByPlane(const double origin[3], const double vec[3], double eps) const; - MEDCOUPLING_EXPORT DataArrayInt *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const; + MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const; MEDCOUPLING_EXPORT bool isContiguous1D() const; 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, int& cellId) const; - MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayInt *& cellIds) const; - MEDCOUPLING_EXPORT int 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, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; - MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, int nbOfPoints, double eps, MCAuto& elts, MCAuto& eltsIndex) const override; - MEDCOUPLING_EXPORT void checkButterflyCells(std::vector& cells, double eps=1e-12) const; - MEDCOUPLING_EXPORT DataArrayInt *convexEnvelop2D(); - MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DExtrudedCells(); - MEDCOUPLING_EXPORT DataArrayInt *findAndCorrectBadOriented3DCells(); + 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; + 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; MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTreeFast() const; MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const; @@ -185,22 +185,22 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isFullyQuadratic() const; MEDCOUPLING_EXPORT bool isPresenceOfQuadratic() const; MEDCOUPLING_EXPORT void convertQuadraticCellsToLinear(); - MEDCOUPLING_EXPORT DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0); + MEDCOUPLING_EXPORT DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0); MEDCOUPLING_EXPORT void tessellate2D(double eps); - MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayInt *& n2oCells, int& nbOfAdditionalPoints) const; - MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy); + MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const; + MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy); MEDCOUPLING_EXPORT bool areOnlySimplexCells() const; MEDCOUPLING_EXPORT void convertDegeneratedCells(); - MEDCOUPLING_EXPORT DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes(); + MEDCOUPLING_EXPORT DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes(); MEDCOUPLING_EXPORT bool removeDegenerated1DCells(); - MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const; + MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly); MEDCOUPLING_EXPORT void changeOrientationOfCells(); - MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; + MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons(); MEDCOUPLING_EXPORT void invertOrientationOfAllCells(); MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const; - MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd); + MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd); //Mesh quality MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getEdgeRatioField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const; @@ -208,72 +208,72 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const; //utilities for MED File RW - MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; - MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector& code, const std::vector& idsPerType) const; - MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType, bool smartPflKiller=true) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const; - MEDCOUPLING_EXPORT DataArrayInt *sortCellsInMEDFileFrmt(); + 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; MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesForMEDFileFrmt() const; MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const; - MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForMEDFileFrmt() const; - MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; - MEDCOUPLING_EXPORT DataArrayInt *rearrange2ConsecutiveCellTypes(); + MEDCOUPLING_EXPORT DataArrayIdType *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const; + MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForMEDFileFrmt() const; + MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; + MEDCOUPLING_EXPORT DataArrayIdType *rearrange2ConsecutiveCellTypes(); MEDCOUPLING_EXPORT std::vector splitByType() const; MEDCOUPLING_EXPORT MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const; - MEDCOUPLING_EXPORT DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const; - MEDCOUPLING_EXPORT void convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayInt *&nodalConn, DataArrayInt *&nodalConnIndex) const; + MEDCOUPLING_EXPORT DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const; + MEDCOUPLING_EXPORT void convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndex) const; MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateSortedByTypeMeshesOnSameCoords(const std::vector& ms, - DataArrayInt *&szOfCellGrpOfSameType, - DataArrayInt *&idInMsOfCellGrpOfSameType); - MEDCOUPLING_EXPORT DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const; - MEDCOUPLING_EXPORT DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const; - MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const int *idsPerGeoTypeBg, const int *idsPerGeoTypeEnd) const; + DataArrayIdType *&szOfCellGrpOfSameType, + DataArrayIdType *&idInMsOfCellGrpOfSameType); + MEDCOUPLING_EXPORT DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const mcIdType *begin, const mcIdType *end) const; + MEDCOUPLING_EXPORT DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const; + 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; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const; MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const int *begin, const int *end) const; + MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const; MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const; - MEDCOUPLING_EXPORT DataArrayInt *conformize2D(double eps); - MEDCOUPLING_EXPORT DataArrayInt *colinearize2D(double eps); - MEDCOUPLING_EXPORT DataArrayInt *colinearizeKeepingConform2D(double eps); - MEDCOUPLING_EXPORT DataArrayInt *conformize3D(double eps); - MEDCOUPLING_EXPORT int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0); + 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=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); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const std::vector& a); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector& meshes); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector& meshes, int compType, std::vector& corr); MEDCOUPLING_EXPORT static void PutUMeshesOnSameAggregatedCoords(const std::vector& meshes); MEDCOUPLING_EXPORT static void MergeNodesOnUMeshesSharingSameCoords(const std::vector& meshes, double eps); - MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const int *begin, const int *end, const double *coords); - MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const int *begin, const int *end, const double *coords); - MEDCOUPLING_EXPORT static bool Is3DExtrudedStaticCellWellOriented(const int *begin, const int *end, const double *coords); - MEDCOUPLING_EXPORT static void CorrectExtrudedStaticCell(int *begin, int *end); - MEDCOUPLING_EXPORT static bool IsTetra4WellOriented(const int *begin, const int *end, const double *coords); - MEDCOUPLING_EXPORT static bool IsPyra5WellOriented(const int *begin, const int *end, const double *coords); - MEDCOUPLING_EXPORT static void SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, int index, DataArrayInt *res, MEDCouplingUMesh *faces, - DataArrayInt *E_Fi, DataArrayInt *E_F, DataArrayInt *F_Ei, DataArrayInt *F_E); - MEDCOUPLING_EXPORT static void ComputeVecAndPtOfFace(double eps, const double *coords, const int *begin, const int *end, double *v, double *p); - MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(int *begin, int *end, const double *coords); - MEDCOUPLING_EXPORT static MEDCouplingUMesh *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2); + MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const mcIdType *begin, const mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static bool Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static void CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end); + MEDCOUPLING_EXPORT static bool IsTetra4WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static bool IsPyra5WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static void SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces, + DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E); + MEDCOUPLING_EXPORT static void ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p); + MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords); + MEDCOUPLING_EXPORT static MEDCouplingUMesh *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayIdType *&cellNb1, DataArrayIdType *&cellNb2); MEDCOUPLING_EXPORT static void Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, - double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayInt *&cellIdInMesh2D, DataArrayInt *&cellIdInMesh1D); - MEDCOUPLING_EXPORT static bool BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, DataArrayInt *nodalConnecOut); - MEDCOUPLING_EXPORT static std::vector PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn); - MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn); - MEDCOUPLING_EXPORT static DataArrayInt *ComputeSpreadZoneGraduallyFromSeed(const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed); - MEDCOUPLING_EXPORT static void FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI, - DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr); - MEDCOUPLING_EXPORT DataArrayInt *buildUnionOf2DMesh() const; - MEDCOUPLING_EXPORT DataArrayInt *buildUnionOf3DMesh() const; - MEDCOUPLING_EXPORT DataArrayInt *orderConsecutiveCells1D() const; + double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayIdType *&cellIdInMesh2D, DataArrayIdType *&cellIdInMesh1D); + MEDCOUPLING_EXPORT static bool BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut); + MEDCOUPLING_EXPORT static std::vector PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeed(const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed); + MEDCOUPLING_EXPORT static void FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI, + DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr); + MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf2DMesh() const; + MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf3DMesh() const; + MEDCOUPLING_EXPORT DataArrayIdType *orderConsecutiveCells1D() const; MEDCOUPLING_EXPORT MEDCouplingSkyLineArray* generateGraph() const; private: // all private methods are impl in MEDCouplingUMesh_internal.cxx @@ -284,82 +284,82 @@ namespace MEDCoupling void checkConnectivityFullyDefined() const; void reprConnectivityOfThisLL(std::ostringstream& stream) const; //tools - DataArrayInt *simplexizePol0(); - DataArrayInt *simplexizePol1(); - DataArrayInt *simplexizePlanarFace5(); - DataArrayInt *simplexizePlanarFace6(); + DataArrayIdType *simplexizePol0(); + DataArrayIdType *simplexizePol1(); + DataArrayIdType *simplexizePlanarFace5(); + DataArrayIdType *simplexizePlanarFace6(); void tessellate2DInternal(double eps); void tessellate2DCurveInternal(double eps); - void subDivide2DMesh(const int *nodeSubdived, const int *nodeIndxSubdived, const int *desc, const int *descIndex); - void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const; - void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector& cut3DCurve); - MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(int nbOfNodesOf1Lev, bool isQuad) const; + 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; + 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; DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation(const MEDCouplingUMesh *mesh1D, bool isQuad) const; 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 int *conn, const int *connI, DataArrayInt *result) ; - MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const; - MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const; - DataArrayInt *convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const; - DataArrayInt *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const; - DataArrayInt *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) 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; + 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; + DataArrayIdType *convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const; + DataArrayIdType *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const; + DataArrayIdType *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const; template - void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const; - void getCellsContainingPointsZeAlg(const double *pos, int nbOfPoints, double eps, - MCAuto& elts, MCAuto& eltsIndex, - std::function sensibilityTo2DQuadraticLinearCellsFunc) const; + void getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints, + double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const; + void getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps, + MCAuto& elts, MCAuto& eltsIndex, + std::function sensibilityTo2DQuadraticLinearCellsFunc) const; /// @cond INTERNAL static MEDCouplingUMesh *MergeUMeshesLL(const std::vector& a); - typedef int (*DimM1DescNbrer)(int id, unsigned nb, const INTERP_KERNEL::CellModel& cm, bool compute, const int *conn1, const int *conn2); + typedef mcIdType (*DimM1DescNbrer)(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2); template - MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx, DimM1DescNbrer nbrer) const; - static void DistanceToPoint3DSurfAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId); - static void DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId); - static DataArrayInt *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed); - static void FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt); - static void AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector& ret); - static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes); + 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); + static void DistanceToPoint2DCurveAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId); + static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed); + static void FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCell, const mcIdType *conn, const double *coo, double *zipFrmt); + static void AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector& ret); + static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, std::vector& addCoo, std::map& mergedNodes); static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, - MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, + MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1, std::vector& addCoo, - MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2); - static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge); - static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, - const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, + MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2); + static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge); + static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, + const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, - std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2); - static void AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf, - const int *nodal3DCurve, const int *nodalIndx3DCurve, - const int *desc, const int *descIndx, std::vector< std::pair >& cut3DSurf); - void assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, - const int *desc, const int *descIndx, DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const; - void buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, const int *desc, const int *descIndx, const double *coords, double eps, std::vector >& res) const; - void split2DCellsLinear(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI); - int split2DCellsQuadratic(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *mid, const DataArrayInt *midI); - static bool Colinearize2DCell(const double *coords, const int *connBg, const int *connEnd, int offset, const std::map& forbiddenPoints, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords); - static void ComputeAllTypesInternal(std::set& types, const DataArrayInt *nodalConnec, const DataArrayInt *nodalConnecIndex); - static bool OrderPointsAlongLine(const double * coo, int startNode, int endNode, - const int * c, const int * cI, const int *idsBg, const int *endBg, - std::vector & pointIds, std::vector & hitSegs); - static void ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxConnE, int startNode, int endNode, - const std::vector& insidePoints, std::vector& modifiedFace); - void attractSeg3MidPtsAroundNodesUnderground(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd); - DataArrayInt *internalColinearize2D(double eps, bool stayConform); + std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2); + static void AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf, + const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve, + const mcIdType *desc, const mcIdType *descIndx, std::vector< std::pair >& cut3DSurf); + void assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, + const mcIdType *desc, const mcIdType *descIndx, DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const; + void buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, std::vector >& res) const; + void split2DCellsLinear(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI); + mcIdType split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI); + static bool Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset, const std::map& forbiddenPoints, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords); + static void ComputeAllTypesInternal(std::set& types, const DataArrayIdType *nodalConnec, const DataArrayIdType *nodalConnecIndex); + static bool OrderPointsAlongLine(const double * coo, mcIdType startNode, mcIdType endNode, + const mcIdType * c, const mcIdType * cI, const mcIdType *idsBg, const mcIdType *endBg, + std::vector & pointIds, std::vector & hitSegs); + static void ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode, + const std::vector& insidePoints, std::vector& modifiedFace); + void attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd); + DataArrayIdType *internalColinearize2D(double eps, bool stayConform); template void renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N); public: - MEDCOUPLING_EXPORT static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector& code); + MEDCOUPLING_EXPORT static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector& code); MEDCOUPLING_EXPORT static const int N_MEDMEM_ORDER=25; MEDCOUPLING_EXPORT static const INTERP_KERNEL::NormalizedCellType MEDMEM_ORDER[N_MEDMEM_ORDER]; - MEDCOUPLING_EXPORT static const int MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]; + MEDCOUPLING_EXPORT static const mcIdType MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]; /// @endcond private: int _mesh_dim; @@ -376,15 +376,15 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh); - MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, int bg, int end); + MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end); MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellIterator(); MEDCOUPLING_EXPORT MEDCouplingUMeshCell *nextt(); private: MEDCouplingUMesh *_mesh; MEDCouplingUMeshCell *_cell; bool _own_cell; - int _cell_id; - int _nb_cell; + mcIdType _cell_id; + mcIdType _nb_cell; }; class MEDCouplingUMeshCellByTypeIterator; @@ -402,17 +402,17 @@ namespace MEDCoupling class MEDCouplingUMeshCellEntry { public: - MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, int bg, int end); + MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end); MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellEntry(); MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const; - MEDCOUPLING_EXPORT int getNumberOfElems() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const; MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *iterator(); private: MEDCouplingUMesh *_mesh; INTERP_KERNEL::NormalizedCellType _type; MEDCouplingUMeshCell *_itc; - int _bg; - int _end; + mcIdType _bg; + mcIdType _end; }; class MEDCouplingUMeshCellByTypeIterator @@ -424,8 +424,8 @@ namespace MEDCoupling private: MEDCouplingUMesh *_mesh; MEDCouplingUMeshCell *_cell; - int _cell_id; - int _nb_cell; + mcIdType _cell_id; + mcIdType _nb_cell; }; class MEDCouplingUMeshCell @@ -435,11 +435,11 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void next(); MEDCOUPLING_EXPORT std::string repr() const; MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const; - MEDCOUPLING_EXPORT const int *getAllConn(int& lgth) const; + MEDCOUPLING_EXPORT const mcIdType *getAllConn(mcIdType& lgth) const; private: - int *_conn; - int *_conn_indx; - int _conn_lgth; + mcIdType *_conn; + mcIdType *_conn_indx; + mcIdType _conn_lgth; static const int NOTICABLE_FIRST_VAL=-7; }; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.txx b/src/MEDCoupling/MEDCouplingUMesh.txx index 581cd29ca..b2cf017e6 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.txx +++ b/src/MEDCoupling/MEDCouplingUMesh.txx @@ -27,13 +27,13 @@ template void MEDCoupling::MEDCouplingUMesh::renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N) { checkConnectivityFullyDefined(); - int *conn(getNodalConnectivity()->getPointer()); - const int *connIndex(getNodalConnectivityIndex()->getConstPointer()); - int nbOfCells(getNumberOfCells()); - for(int i=0;igetPointer()); + const mcIdType *connIndex(getNodalConnectivityIndex()->getConstPointer()); + mcIdType nbOfCells=ToIdType(getNumberOfCells()); + for(mcIdType i=0;i=0)//avoid polyhedron separator { auto it(newNodeNumbersO2N.find(node)); diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx old mode 100644 new mode 100755 index 37640b535..4b6b75a84 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -74,10 +74,10 @@ void MEDCouplingUMesh::reprConnectivityOfThisLL(std::ostringstream& stream) cons { if(_nodal_connec!=0 && _nodal_connec_index!=0) { - int nbOfCells=getNumberOfCells(); - const int *c=_nodal_connec->getConstPointer(); - const int *ci=_nodal_connec_index->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *ci=_nodal_connec_index->getConstPointer(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } - int *retPt=ret->getPointer(); - MCAuto newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(nbOfCells+nbOfCutCells+1,1); newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1); - int *pt=newConn->getPointer(); - int *ptI=newConnI->getPointer(); + mcIdType *pt=newConn->getPointer(); + mcIdType *ptI=newConnI->getPointer(); ptI[0]=0; - const int *oldc=_nodal_connec->begin(); - const int *ci=_nodal_connec_index->begin(); - for(int i=0;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4); ret->alloc(nbOfCells+nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } - int *retPt=ret->getPointer(); - MCAuto newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(nbOfCells+nbOfCutCells+1,1); newConn->alloc(getNodalConnectivityArrayLen()+3*nbOfCutCells,1); - int *pt=newConn->getPointer(); - int *ptI=newConnI->getPointer(); + mcIdType *pt=newConn->getPointer(); + mcIdType *ptI=newConnI->getPointer(); ptI[0]=0; - const int *oldc=_nodal_connec->begin(); - const int *ci=_nodal_connec_index->begin(); - for(int i=0;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+4*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } - int *retPt=ret->getPointer(); - MCAuto newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(nbOfCells+4*nbOfCutCells+1,1); newConn->alloc(getNodalConnectivityArrayLen()+16*nbOfCutCells,1);//21 - int *pt=newConn->getPointer(); - int *ptI=newConnI->getPointer(); + mcIdType *pt=newConn->getPointer(); + mcIdType *ptI=newConnI->getPointer(); ptI[0]=0; - const int *oldc=_nodal_connec->begin(); - const int *ci=_nodal_connec_index->begin(); - for(int i=0;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i ret=DataArrayInt::New(); - int nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); + mcIdType nbOfCells=getNumberOfCells(); + MCAuto ret=DataArrayIdType::New(); + mcIdType nbOfCutCells=getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8); ret->alloc(nbOfCells+5*nbOfCutCells,1); if(nbOfCutCells==0) { ret->iota(0); return ret.retn(); } - int *retPt=ret->getPointer(); - MCAuto newConn=DataArrayInt::New(); - MCAuto newConnI=DataArrayInt::New(); + mcIdType *retPt=ret->getPointer(); + MCAuto newConn=DataArrayIdType::New(); + MCAuto newConnI=DataArrayIdType::New(); newConnI->alloc(nbOfCells+5*nbOfCutCells+1,1); newConn->alloc(getNodalConnectivityArrayLen()+21*nbOfCutCells,1); - int *pt=newConn->getPointer(); - int *ptI=newConnI->getPointer(); + mcIdType *pt=newConn->getPointer(); + mcIdType *ptI=newConnI->getPointer(); ptI[0]=0; - const int *oldc=_nodal_connec->begin(); - const int *ci=_nodal_connec_index->begin(); - for(int i=0;ibegin(); + const mcIdType *ci=_nodal_connec_index->begin(); + for(mcIdType i=0;i::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(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc(buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); revDesc1=0; revDescIndx1=0; mDesc->tessellate2D(eps); @@ -349,21 +349,21 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double 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 arcPrec(1.e-10); // RAII - int nbCells=getNumberOfCells(); - int nbNodes=getNumberOfNodes(); - const int *conn=_nodal_connec->begin(); - const int *connI=_nodal_connec_index->begin(); + mcIdType nbCells=getNumberOfCells(); + mcIdType nbNodes=getNumberOfNodes(); + const mcIdType *conn=_nodal_connec->begin(); + const mcIdType *connI=_nodal_connec_index->begin(); const double *coords=_coords->begin(); std::vector addCoo; - std::vector newConn;//no direct DataArrayInt because interface with Geometric2D - MCAuto newConnI(DataArrayInt::New()); + std::vector newConn;//no direct DataArrayIdType because interface with Geometric2D + MCAuto newConnI(DataArrayIdType::New()); newConnI->alloc(nbCells+1,1); - int *newConnIPtr=newConnI->getPointer(); + mcIdType *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; - int tmp1[3]; + mcIdType tmp1[3]; INTERP_KERNEL::Node *tmp2[3]; std::set types; - for(int i=0;itesselate(tmp1,nbNodes,epsa,newConn,addCoo); types.insert((INTERP_KERNEL::NormalizedCellType)newConn[newConnIPtr[0]]); delete eac; - newConnIPtr[1]=(int)newConn.size(); + newConnIPtr[1]=ToIdType(newConn.size()); } else { @@ -395,16 +395,16 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) newConnIPtr[1]=newConnIPtr[0]+3; } } - if(addCoo.empty() && newConn.size()==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed + if(addCoo.empty() && ToIdType(newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed return ; _types=types; - DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index); - MCAuto newConnArr=DataArrayInt::New(); - newConnArr->alloc((int)newConn.size(),1); + DataArrayIdType::SetArrayIn(newConnI,_nodal_connec_index); + MCAuto newConnArr=DataArrayIdType::New(); + newConnArr->alloc(newConn.size(),1); std::copy(newConn.begin(),newConn.end(),newConnArr->getPointer()); - DataArrayInt::SetArrayIn(newConnArr,_nodal_connec); + DataArrayIdType::SetArrayIn(newConnArr,_nodal_connec); MCAuto newCoords=DataArrayDouble::New(); - newCoords->alloc(nbNodes+((int)addCoo.size())/2,2); + newCoords->alloc(nbNodes+addCoo.size()/2,2); double *work=std::copy(_coords->begin(),_coords->end(),newCoords->getPointer()); std::copy(addCoo.begin(),addCoo.end(),work); DataArrayDouble::SetArrayIn(newCoords,_coords); @@ -420,34 +420,34 @@ void MEDCouplingUMesh::tessellate2DCurveInternal(double eps) * \param desc is descending connectivity in format specified in MEDCouplingUMesh::buildDescendingConnectivity2 * \param descIndex is descending connectivity index in format specified in MEDCouplingUMesh::buildDescendingConnectivity2 */ -void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeIndxSubdived, const int *desc, const int *descIndex) +void MEDCouplingUMesh::subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex) { checkFullyDefined(); if(getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::subDivide2DMesh : works only on umesh with meshdim==2 !"); - int nbOfCells=getNumberOfCells(); - int *connI=_nodal_connec_index->getPointer(); - int newConnLgth=0; - for(int i=0;igetPointer(); + mcIdType newConnLgth=0; + for(mcIdType i=0;i0; - int eedgeId=std::abs(desc[offset+nbOfEdges-1])-1; - int ref=ddirect?nodeSubdived[nodeIndxSubdived[eedgeId+1]-1]:nodeSubdived[nodeIndxSubdived[eedgeId]+1]; - for(int j=0;j0; - int edgeId=std::abs(desc[offset+j])-1; + mcIdType edgeId=std::abs(desc[offset+j])-1; if(!INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodeSubdived[nodeIndxSubdived[edgeId]]).isQuadratic()) { - int id1=nodeSubdived[nodeIndxSubdived[edgeId]+1]; - int id2=nodeSubdived[nodeIndxSubdived[edgeId+1]-1]; - int 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) { - int nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; + mcIdType nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; newConnLgth+=nbOfSubNodes-1; ref=direct?id2:id1; } @@ -466,29 +466,29 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI connI[1]=newConnLgth; } // - MCAuto newConn=DataArrayInt::New(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(newConnLgth,1); - int *work=newConn->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;i0; - int edgeId=std::abs(desc[offset+j])-1; + mcIdType edgeId=std::abs(desc[offset+j])-1; if(direct) work=std::copy(nodeSubdived+nodeIndxSubdived[edgeId]+1,nodeSubdived+nodeIndxSubdived[edgeId+1]-1,work); else { - int nbOfSubNodes=nodeIndxSubdived[edgeId+1]-nodeIndxSubdived[edgeId]-1; - std::reverse_iterator 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); } } } - DataArrayInt::SetArrayIn(newConn,_nodal_connec); + DataArrayIdType::SetArrayIn(newConn,_nodal_connec); _types.clear(); if(nbOfCells>0) _types.insert(INTERP_KERNEL::NORM_POLYGON); @@ -505,23 +505,23 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI * \param [in] fullyIn input that specifies if all node ids must be in [ \a begin,\a end ) array to consider cell to be in. * \param [in,out] cellIdsKeptArr array where all candidate cell ids are put at the end. */ -void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const +void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const { - MCAuto cellIdsKept=DataArrayInt::New(); cellIdsKept->alloc(0,1); + MCAuto cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); checkConnectivityFullyDefined(); - int tmp=-1; - int sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,0)+1; + mcIdType tmp=-1; + mcIdType sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) if(*work>=0 && *workgetConstPointer(); - const int *connIndex=getNodalConnectivityIndex()->getConstPointer(); - for(int i=0;igetConstPointer(); + const mcIdType *connIndex=getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=0;i=0) { ref++; @@ -545,29 +545,29 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int * if cut3DCurve[i]==-1, it means that cell#i has been already detected to be fully part of plane defined by ('origin','vec'). * This method will throw an exception if \a this contains a non linear segment. */ -void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector& cut3DCurve) +void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector& cut3DCurve) { checkFullyDefined(); if(getMeshDimension()!=1 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane works on umeshes with meshdim equal to 1 and spaceDim equal to 3 !"); - int ncells=getNumberOfCells(); - int nnodes=getNumberOfNodes(); + mcIdType ncells=getNumberOfCells(); + mcIdType nnodes=getNumberOfNodes(); double vec2[3],vec3[3],vec4[3]; double normm=sqrt(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]); if(normm<1e-6) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::split3DCurveWithPlane : parameter 'vec' should have a norm2 greater than 1e-6 !"); vec2[0]=vec[0]/normm; vec2[1]=vec[1]/normm; vec2[2]=vec[2]/normm; - const int *conn=_nodal_connec->getConstPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); const double *coo=_coords->getConstPointer(); std::vector addCoo; - for(int i=0;ieps && pos<1-eps) { - int nNode=((int)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; @@ -591,7 +591,7 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double } if(!addCoo.empty()) { - int newNbOfNodes=nnodes+((int)addCoo.size())/3; + mcIdType newNbOfNodes=nnodes+ToIdType(addCoo.size())/3; MCAuto coo2=DataArrayDouble::New(); coo2->alloc(newNbOfNodes,3); double *tmp=coo2->getPointer(); @@ -608,22 +608,22 @@ void MEDCouplingUMesh::split3DCurveWithPlane(const double *origin, const double */ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const { - int oldNbOfNodes=getNumberOfNodes(); - int nbOf1DCells=mesh1D->getNumberOfCells(); - int spaceDim=getSpaceDimension(); + mcIdType oldNbOfNodes=getNumberOfNodes(); + mcIdType nbOf1DCells=ToIdType(mesh1D->getNumberOfCells()); + std::size_t spaceDim=getSpaceDimension(); DataArrayDouble *ret=DataArrayDouble::New(); std::vector isQuads; - int nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1; + mcIdType nbOfLevsInVec=isQuad?2*nbOf1DCells+1:nbOf1DCells+1; ret->alloc(oldNbOfNodes*nbOfLevsInVec,spaceDim); double *retPtr=ret->getPointer(); const double *coords=getCoords()->getConstPointer(); double *work=std::copy(coords,coords+spaceDim*oldNbOfNodes,retPtr); - std::vector v; + std::vector v; std::vector c; double vec[3]; v.reserve(3); c.reserve(6); - for(int i=0;igetNodeIdsOfCell(i,v); @@ -631,7 +631,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCoupli mesh1D->getCoordinatesOfNode(v[isQuad?2:1],c); mesh1D->getCoordinatesOfNode(v[0],c); std::transform(c.begin(),c.begin()+spaceDim,c.begin()+spaceDim,vec,std::minus()); - for(int j=0;j()); if(isQuad) { @@ -639,7 +639,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslation(const MEDCoupli mesh1D->getCoordinatesOfNode(v[1],c); mesh1D->getCoordinatesOfNode(v[0],c); std::transform(c.begin(),c.begin()+spaceDim,c.begin()+spaceDim,vec,std::minus()); - for(int j=0;j()); } } @@ -670,12 +670,12 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con { if(isQuad) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : not implemented for quadratic cells !"); - int oldNbOfNodes=getNumberOfNodes(); - int nbOf1DCells=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(); - int 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); @@ -683,9 +683,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con MCAuto tmp2=getCoords()->deepCopy(); tmp->setCoords(tmp2); const double *coo1D=mesh1D->getCoords()->getConstPointer(); - const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer(); - const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); - for(int i=1;igetNodalConnectivity()->getConstPointer(); + const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=1;igetNumberOfCells(); + 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(); - int 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); @@ -727,9 +727,9 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con MCAuto tmp2=getCoords()->deepCopy(); tmp->setCoords(tmp2); const double *coo1D=mesh1D->getCoords()->getConstPointer(); - const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer(); - const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); - for(int i=1;igetNodalConnectivity()->getConstPointer(); + const mcIdType *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType i=1;ibegin()),*connI(_nodal_connec_index->begin()); - MCAuto newConn(DataArrayInt::New()),newConnI(DataArrayInt::New()); + const mcIdType *conn(_nodal_connec->begin()),*connI(_nodal_connec_index->begin()); + MCAuto newConn(DataArrayIdType::New()),newConnI(DataArrayIdType::New()); newConnI->alloc(nbOf3DCells+1,1); - int *newConnIPtr(newConnI->getPointer()); + mcIdType *newConnIPtr(newConnI->getPointer()); *newConnIPtr++=0; - std::vector newc; - for(int j=0;j newc; + for(mcIdType j=0;jalloc((int)(newc.size())*nbOf1DCells,1); - int *newConnPtr(newConn->getPointer()); - int deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev); + newConn->alloc(newc.size()*nbOf1DCells,1); + mcIdType *newConnPtr(newConn->getPointer()); + mcIdType deltaPerLev(isQuad?2*nbOfNodesOf1Lev:nbOfNodesOf1Lev); newConnIPtr=newConnI->getPointer(); - for(int iz=0;iz(),newConnIPtr[iz*nbOf2DCells])); - const int *posOfTypeOfCell(newConnIPtr); - for(std::vector::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++) + std::transform(newConnIPtr+1,newConnIPtr+1+nbOf2DCells,newConnIPtr+1+iz*nbOf2DCells,std::bind2nd(std::plus(),newConnIPtr[iz*nbOf2DCells])); + const mcIdType *posOfTypeOfCell(newConnIPtr); + for(std::vector::const_iterator iter=newc.begin();iter!=newc.end();iter++,newConnPtr++) { - int icell((int)(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) @@ -834,13 +834,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode * If in 'candidates' pool -1 value is considered as an empty value. * WARNING this method returns only ONE set of result ! */ -bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result) +bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) { if(candidates.size()<1) return false; bool ret=false; - std::vector::const_iterator iter=candidates.begin(); - int start=(*iter++); + std::vector::const_iterator iter=candidates.begin(); + mcIdType start=(*iter++); for(;iter!=candidates.end();iter++) { int status=AreCellsEqual(conn,connI,start,*iter,compType); @@ -865,20 +865,20 @@ bool MEDCouplingUMesh::AreCellsEqualInPool(const std::vector& candidates, i * Keeps from \a this only cells which constituing point id are in the ids specified by [ \a begin,\a end ). * The return newly allocated mesh will share the same coordinates as \a this. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const { checkConnectivityFullyDefined(); - int ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); std::size_t nbOfElemsRet=std::distance(begin,end); - int *connIndexRet=(int *)malloc((nbOfElemsRet+1)*sizeof(int)); + mcIdType *connIndexRet=(mcIdType *)malloc((nbOfElemsRet+1)*sizeof(mcIdType)); connIndexRet[0]=0; - const int *conn=_nodal_connec->getConstPointer(); - const int *connIndex=_nodal_connec_index->getConstPointer(); - int newNbring=0; - for(const int *work=begin;work!=end;work++,newNbring++) + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); + mcIdType newNbring=0; + for(const mcIdType *work=begin;work!=end;work++,newNbring++) { if(*work>=0 && *work types; - for(const int *work=begin;work!=end;work++) + for(const mcIdType *work=begin;work!=end;work++) { types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]); connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork); } - MCAuto connRetArr=DataArrayInt::New(); + MCAuto connRetArr=DataArrayIdType::New(); connRetArr->useArray(connRet,true,DeallocType::C_DEALLOC,connIndexRet[nbOfElemsRet],1); - MCAuto connIndexRetArr=DataArrayInt::New(); - connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,(int)nbOfElemsRet+1,1); + MCAuto connIndexRetArr=DataArrayIdType::New(); + connIndexRetArr->useArray(connIndexRet,true,DeallocType::C_DEALLOC,nbOfElemsRet+1,1); ret->setConnectivity(connRetArr,connIndexRetArr,false); ret->_types=types; ret->copyTinyInfoFrom(this); @@ -911,20 +911,20 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin * This is the low algorithm of MEDCouplingUMesh::buildPartOfMySelfSlice. * CellIds are given using range specified by a start an end and step. */ -MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const +MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { checkFullyDefined(); - int ncell=getNumberOfCells(); + mcIdType ncell=getNumberOfCells(); MCAuto ret=MEDCouplingUMesh::New(); ret->_mesh_dim=_mesh_dim; ret->setCoords(_coords); - int newNbOfCells=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : "); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(newNbOfCells+1,1); - int *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; - int work=start; - const int *conn=_nodal_connec->getConstPointer(); - const int *connIndex=_nodal_connec_index->getConstPointer(); - for(int i=0;i newConnI=DataArrayIdType::New(); newConnI->alloc(newNbOfCells+1,1); + mcIdType *newConnIPtr=newConnI->getPointer(); *newConnIPtr=0; + mcIdType work=start; + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); + for(mcIdType i=0;i=0 && work newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1); - int *newConnPtr=newConn->getPointer(); + MCAuto newConn=DataArrayIdType::New(); newConn->alloc(newConnIPtr[0],1); + mcIdType *newConnPtr=newConn->getPointer(); std::set types; work=start; - for(int i=0;i& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { MCAuto bary=computeCellCenterOfMass(); - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); - int nbOfCells=getNumberOfCells(); - int nbOfNodes=getNumberOfNodes(); - const int *cPtr=_nodal_connec->begin(); - const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0,offset=nbOfNodes; - for(int i=0;i 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 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;ipushBackSilent((int)INTERP_KERNEL::NORM_SEG3); + newConn->pushBackSilent(ToIdType(INTERP_KERNEL::NORM_SEG3)); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[0]+3); newConn->pushBackSilent(offset++); lastVal+=4; @@ -1013,26 +1013,26 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *& return ret.retn(); } -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayInt *desc, const DataArrayInt *descI, DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); + 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); // - const int *descPtr(desc->begin()),*descIPtr(descI->begin()); - DataArrayInt *conn1D=0,*conn1DI=0; + const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin()); + DataArrayIdType *conn1D=0,*conn1DI=0; std::set types1D; DataArrayDouble *coordsTmp=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); - MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); - const int *c1DPtr=conn1D->begin(); - const int *c1DIPtr=conn1DI->begin(); - int nbOfCells=getNumberOfCells(); - const int *cPtr=_nodal_connec->begin(); - const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0; - for(int i=0;i conn1DSafe(conn1D),conn1DISafe(conn1DI); + const mcIdType *c1DPtr=conn1D->begin(); + const mcIdType *c1DIPtr=conn1DI->begin(); + 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 int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) + for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0]); newConnI->pushBackSilent(lastVal); @@ -1061,40 +1061,41 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2DAnd3D0(const MEDC /*! * Implements \a conversionType 0 for meshes with meshDim = 2, of MEDCouplingUMesh::convertLinearCellsToQuadratic method. - * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells. + * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells. * \sa MEDCouplingUMesh::convertLinearCellsToQuadratic. */ -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m1D=buildDescendingConnectivity(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; // - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(); ret->alloc(0,1); + 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); // MCAuto bary=computeCellCenterOfMass(); - const int *descPtr(desc->begin()),*descIPtr(descI->begin()); - DataArrayInt *conn1D=0,*conn1DI=0; + const mcIdType *descPtr(desc->begin()),*descIPtr(descI->begin()); + DataArrayIdType *conn1D=0,*conn1DI=0; std::set types1D; DataArrayDouble *coordsTmp=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=0; MCAuto coordsTmpSafe(coordsTmp); - MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); - const int *c1DPtr=conn1D->begin(); - const int *c1DIPtr=conn1DI->begin(); - int nbOfCells=getNumberOfCells(); - const int *cPtr=_nodal_connec->begin(); - const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples(); - for(int i=0;i conn1DSafe(conn1D),conn1DISafe(conn1DI); + const mcIdType *c1DPtr=conn1D->begin(); + const mcIdType *c1DIPtr=conn1DI->begin(); + 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(typ2); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); - for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) + for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]); newConn->pushBackSilent(offset+ret->getNumberOfTuples()); lastVal+=(icPtr[1]-icPtr[0])+(descIPtr[1]-descIPtr[0])+1; @@ -1125,44 +1126,45 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D1(DataArrayInt *& /*! * Implements \a conversionType 0 for meshes with meshDim = 3, of MEDCouplingUMesh::convertLinearCellsToQuadratic method. - * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells. + * \return a newly created DataArrayIdType instance that the caller should deal with containing cell ids of converted cells. * \sa MEDCouplingUMesh::convertLinearCellsToQuadratic. */ -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m1D=explode3DMeshTo1D(desc,descI,tmp2,tmp3); tmp2=0; tmp3=0; return convertLinearCellsToQuadratic2DAnd3D0(m1D,desc,descI,conn,connI,coords,types); } -DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set& types) const +DataArrayIdType *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set& types) const { - MCAuto desc2(DataArrayInt::New()),desc2I(DataArrayInt::New()),tmp2(DataArrayInt::New()),tmp3(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),desc2I(DataArrayIdType::New()),tmp2(DataArrayIdType::New()),tmp3(DataArrayIdType::New()); MCAuto m2D=buildDescendingConnectivityGen(desc2,desc2I,tmp2,tmp3,MEDCouplingFastNbrer); tmp2=0; tmp3=0; - MCAuto desc1(DataArrayInt::New()),desc1I(DataArrayInt::New()),tmp4(DataArrayInt::New()),tmp5(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),desc1I(DataArrayIdType::New()),tmp4(DataArrayIdType::New()),tmp5(DataArrayIdType::New()); MCAuto m1D=explode3DMeshTo1D(desc1,desc1I,tmp4,tmp5); tmp4=0; tmp5=0; // - MCAuto newConn=DataArrayInt::New(); newConn->alloc(0,1); - MCAuto newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0); - MCAuto ret=DataArrayInt::New(),ret2=DataArrayInt::New(); ret->alloc(0,1); ret2->alloc(0,1); + 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(),ret2=DataArrayIdType::New(); ret->alloc(0,1); ret2->alloc(0,1); // MCAuto bary=computeCellCenterOfMass(); - const int *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin()); - DataArrayInt *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0; + const mcIdType *descPtr(desc1->begin()),*descIPtr(desc1I->begin()),*desc2Ptr(desc2->begin()),*desc2IPtr(desc2I->begin()); + DataArrayIdType *conn1D=0,*conn1DI=0,*conn2D=0,*conn2DI=0; std::set types1D,types2D; DataArrayDouble *coordsTmp=0,*coordsTmp2=0; - MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayInt::New(); ret1D->alloc(0,1); - MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); + MCAuto ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coordsTmp,types1D); ret1D=DataArrayIdType::New(); ret1D->alloc(0,1); + MCAuto conn1DSafe(conn1D),conn1DISafe(conn1DI); MCAuto coordsTmpSafe(coordsTmp); - MCAuto ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayInt::New(); ret2D->alloc(0,1); + MCAuto ret2D=m2D->convertLinearCellsToQuadratic2D1(conn2D,conn2DI,coordsTmp2,types2D); ret2D=DataArrayIdType::New(); ret2D->alloc(0,1); MCAuto coordsTmp2Safe(coordsTmp2); - MCAuto conn2DSafe(conn2D),conn2DISafe(conn2DI); - const int *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin(); - int nbOfCells=getNumberOfCells(); - const int *cPtr=_nodal_connec->begin(); - const int *icPtr=_nodal_connec_index->begin(); - int lastVal=0,offset=coordsTmpSafe->getNumberOfTuples(); - for(int i=0;i conn2DSafe(conn2D),conn2DISafe(conn2DI); + const mcIdType *c1DPtr=conn1D->begin(),*c1DIPtr=conn1DI->begin(),*c2DPtr=conn2D->begin(),*c2DIPtr=conn2DI->begin(); + 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(typ2); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); - for(const int *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) + for(const mcIdType *d=descPtr+descIPtr[0];d!=descPtr+descIPtr[1];d++) newConn->pushBackSilent(c1DPtr[c1DIPtr[*d]+3]); - for(const int *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++) + for(const mcIdType *d=desc2Ptr+desc2IPtr[0];d!=desc2Ptr+desc2IPtr[1];d++) { - int nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1]; - int tmpPos=newConn->getNumberOfTuples(); + mcIdType nodeId2=c2DPtr[c2DIPtr[(*d)+1]-1]; + mcIdType tmpPos=newConn->getNumberOfTuples(); newConn->pushBackSilent(nodeId2); ret2D->pushBackSilent(nodeId2); ret1D->pushBackSilent(tmpPos); } @@ -1198,48 +1200,48 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& newConn->pushBackValsSilent(cPtr+icPtr[0],cPtr+icPtr[1]); } } - MCAuto diffRet2D=ret2D->getDifferentValues(); - MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); + MCAuto diffRet2D=ret2D->getDifferentValues(); + MCAuto o2nRet2D=diffRet2D->invertArrayN2O2O2N(coordsTmp2Safe->getNumberOfTuples()); coordsTmp2Safe=coordsTmp2Safe->selectByTupleId(diffRet2D->begin(),diffRet2D->end()); MCAuto tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end()); std::vector v(3); v[0]=coordsTmpSafe; v[1]=coordsTmp2Safe; v[2]=tmp; - int *c=newConn->getPointer(); - const int *cI(newConnI->begin()); - for(const int *elt=ret1D->begin();elt!=ret1D->end();elt++) + mcIdType *c=newConn->getPointer(); + const mcIdType *cI(newConnI->begin()); + for(const mcIdType *elt=ret1D->begin();elt!=ret1D->end();elt++) c[*elt]=o2nRet2D->getIJ(c[*elt],0)+offset; offset=coordsTmp2Safe->getNumberOfTuples(); - for(const int *elt=ret->begin();elt!=ret->end();elt++) + 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(); } -DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const +DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const { - int nbOfNodesExpected(skin->getNumberOfNodes()); - const int *n2oPtr(n2o->begin()); - MCAuto revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + const mcIdType *n2oPtr(n2o->begin()); + MCAuto revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); - const int *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin()); - const int *nodalPtr(skin->getNodalConnectivity()->begin()); - const int *nodalIPtr(skin->getNodalConnectivityIndex()->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); - int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON; + const mcIdType *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin()); + const mcIdType *nodalPtr(skin->getNodalConnectivity()->begin()); + const mcIdType *nodalIPtr(skin->getNodalConnectivityIndex()->begin()); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodesExpected+1,1); + mcIdType *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_POLYGON; if(nbOfNodesExpected<1) return ret.retn(); - int prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]); + mcIdType prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]); *work++=n2oPtr[prevNode]; - for(int i=1;i conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); + std::set conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); conn.erase(prevNode); if(conn.size()==1) { - int curNode(*(conn.begin())); + mcIdType curNode(*(conn.begin())); *work++=n2oPtr[curNode]; - std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); + std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); shar.erase(prevCell); if(shar.size()==1) { @@ -1258,37 +1260,37 @@ DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshLinear(const MEDCouplingUMesh return ret.retn(); } -DataArrayInt *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayInt *n2o) const +DataArrayIdType *MEDCouplingUMesh::buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const { - int nbOfNodesExpected(skin->getNumberOfNodes()); - int nbOfTurn(nbOfNodesExpected/2); - const int *n2oPtr(n2o->begin()); - MCAuto revNodal(DataArrayInt::New()),revNodalI(DataArrayInt::New()); + mcIdType nbOfNodesExpected(skin->getNumberOfNodes()); + mcIdType nbOfTurn(nbOfNodesExpected/2); + const mcIdType *n2oPtr(n2o->begin()); + MCAuto revNodal(DataArrayIdType::New()),revNodalI(DataArrayIdType::New()); skin->getReverseNodalConnectivity(revNodal,revNodalI); - const int *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin()); - const int *nodalPtr(skin->getNodalConnectivity()->begin()); - const int *nodalIPtr(skin->getNodalConnectivityIndex()->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodesExpected+1,1); - int *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG; + const mcIdType *revNodalPtr(revNodal->begin()),*revNodalIPtr(revNodalI->begin()); + const mcIdType *nodalPtr(skin->getNodalConnectivity()->begin()); + const mcIdType *nodalIPtr(skin->getNodalConnectivityIndex()->begin()); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodesExpected+1,1); + mcIdType *work(ret->getPointer()); *work++=INTERP_KERNEL::NORM_QPOLYG; if(nbOfNodesExpected<1) return ret.retn(); - int prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]); + mcIdType prevCell(0),prevNode(nodalPtr[nodalIPtr[0]+1]); *work=n2oPtr[prevNode]; work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[0]+3]]; work++; - for(int i=1;i conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); + std::set conn(nodalPtr+nodalIPtr[prevCell]+1,nodalPtr+nodalIPtr[prevCell]+3); conn.erase(prevNode); if(conn.size()==1) { - int curNode(*(conn.begin())); + mcIdType curNode(*(conn.begin())); *work=n2oPtr[curNode]; - std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); + std::set shar(revNodalPtr+revNodalIPtr[curNode],revNodalPtr+revNodalIPtr[curNode+1]); shar.erase(prevCell); if(shar.size()==1) { - int curCell(*(shar.begin())); + mcIdType curCell(*(shar.begin())); work[nbOfTurn]=n2oPtr[nodalPtr[nodalIPtr[curCell]+3]]; prevCell=curCell; prevNode=curNode; @@ -1312,13 +1314,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector::const_iterator it=a.begin(); int meshDim=(*it)->getMeshDimension(); - int nbOfCells=(*it)->getNumberOfCells(); - int meshLgth=(*it++)->getNodalConnectivityArrayLen(); + mcIdType nbOfCells=ToIdType((*it)->getNumberOfCells()); + mcIdType meshLgth=(*it++)->getNodalConnectivityArrayLen(); for(;it!=a.end();it++) { if(meshDim!=(*it)->getMeshDimension()) throw INTERP_KERNEL::Exception("Mesh dimensions mismatches, MergeUMeshes impossible !"); - nbOfCells+=(*it)->getNumberOfCells(); + nbOfCells+=ToIdType((*it)->getNumberOfCells()); meshLgth+=(*it)->getNodalConnectivityArrayLen(); } std::vector aps(a.size()); @@ -1326,24 +1328,24 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector pts=MergeNodesArray(aps); MCAuto ret=MEDCouplingUMesh::New("merge",meshDim); ret->setCoords(pts); - MCAuto c=DataArrayInt::New(); + MCAuto c=DataArrayIdType::New(); c->alloc(meshLgth,1); - int *cPtr=c->getPointer(); - MCAuto cI=DataArrayInt::New(); + mcIdType *cPtr=c->getPointer(); + MCAuto cI=DataArrayIdType::New(); cI->alloc(nbOfCells+1,1); - int *cIPtr=cI->getPointer(); + mcIdType *cIPtr=cI->getPointer(); *cIPtr++=0; - int offset=0; - int offset2=0; + mcIdType offset=0; + mcIdType offset2=0; for(it=a.begin();it!=a.end();it++) { - int curNbOfCell=(*it)->getNumberOfCells(); - const int *curCI=(*it)->_nodal_connec_index->begin(); - const int *curC=(*it)->_nodal_connec->begin(); - cIPtr=std::transform(curCI+1,curCI+curNbOfCell+1,cIPtr,std::bind2nd(std::plus(),offset)); - for(int j=0;jgetNumberOfCells()); + 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::bind2nd(std::plus(),offset)); + for(mcIdType j=0;j::max(); - for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) + for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) { switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]]) { @@ -1411,11 +1413,11 @@ void MEDCouplingUMesh::DistanceToPoint3DSurfAlg(const double *pt, const int *cel * \param [out] cellId that corresponds to minimal distance. If the closer node is not linked to any cell in \a this -1 is returned. * \sa MEDCouplingUMesh::distanceToPoint, MEDCouplingUMesh::distanceToPoints */ -void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const int *cellIdsBg, const int *cellIdsEnd, const double *coords, const int *nc, const int *ncI, double& ret0, int& cellId) +void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId) { cellId=-1; ret0=std::numeric_limits::max(); - for(const int *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) + for(const mcIdType *zeCell=cellIdsBg;zeCell!=cellIdsEnd;zeCell++) { switch((INTERP_KERNEL::NormalizedCellType)nc[ncI[*zeCell]]) { @@ -1433,42 +1435,42 @@ void MEDCouplingUMesh::DistanceToPoint2DCurveAlg(const double *pt, const int *ce } } } -DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const int *seedBg, const int *seedEnd, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling, int& nbOfDepthPeelingPerformed) +DataArrayIdType *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vector& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed) { nbOfDepthPeelingPerformed=0; if(!seedBg || !seedEnd || !arrIn || !arrIndxIn) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : some input pointer is NULL !"); - int nbOfTuples=arrIndxIn->getNumberOfTuples()-1; + mcIdType nbOfTuples=arrIndxIn->getNumberOfTuples()-1; std::vector fetched2(nbOfTuples,false); int i=0; - for(const int *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++) + for(const mcIdType *seedElt=seedBg;seedElt!=seedEnd;seedElt++,i++) { if(*seedElt>=0 && *seedEltbegin(); - const int *arrIndxPtr=arrIndxIn->begin(); - int targetNbOfDepthPeeling=nbOfDepthPeeling!=-1?nbOfDepthPeeling:std::numeric_limits::max(); - std::vector idsToFetch1(seedBg,seedEnd); - std::vector idsToFetch2; - std::vector *idsToFetch=&idsToFetch1; - std::vector *idsToFetchOther=&idsToFetch2; + const mcIdType *arrInPtr=arrIn->begin(); + const mcIdType *arrIndxPtr=arrIndxIn->begin(); + 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 int *it2=arrInPtr+arrIndxPtr[*it];it2!=arrInPtr+arrIndxPtr[*it+1];it2++) + for(std::vector::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++; } - int lgth=(int)std::count(fetched2.begin(),fetched2.end(),true); + mcIdType lgth=ToIdType(std::count(fetched2.begin(),fetched2.end(),true)); i=0; - MCAuto ret=DataArrayInt::New(); ret->alloc(lgth,1); - int *retPtr=ret->getPointer(); + MCAuto ret=DataArrayIdType::New(); ret->alloc(lgth,1); + mcIdType *retPtr=ret->getPointer(); for(std::vector::const_iterator it=fetched2.begin();it!=fetched2.end();it++,i++) if(*it) *retPtr++=i; @@ -1479,7 +1481,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto * This method put in zip format into parameter 'zipFrmt' in full interlace mode. * This format is often asked by INTERP_KERNEL algorithms to avoid many indirections into coordinates array. */ -void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, const int *conn, const double *coo, double *zipFrmt) +void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCell, const mcIdType *conn, const double *coo, double *zipFrmt) { double *w=zipFrmt; if(spaceDim==3) @@ -1503,12 +1505,12 @@ void MEDCouplingUMesh::FillInCompact3DMode(int spaceDim, int nbOfNodesInCell, co * \param isQuad specifies the policy of connectivity. * @ret in/out parameter in which the result will be append */ -void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, int nbOfNodesPerLev, bool isQuad, std::vector& ret) +void MEDCouplingUMesh::AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector& ret) { INTERP_KERNEL::NormalizedCellType flatType=(INTERP_KERNEL::NormalizedCellType)connBg[0]; const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(flatType); ret.push_back(cm.getExtrudedType()); - int deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev; + mcIdType deltaz=isQuad?2*nbOfNodesPerLev:nbOfNodesPerLev; switch(flatType) { case INTERP_KERNEL::NORM_POINT1: @@ -1519,38 +1521,38 @@ void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, } case INTERP_KERNEL::NORM_SEG2: { - int conn[4]={connBg[1],connBg[2],connBg[2]+deltaz,connBg[1]+deltaz}; + mcIdType conn[4]={connBg[1],connBg[2],connBg[2]+deltaz,connBg[1]+deltaz}; ret.insert(ret.end(),conn,conn+4); break; } case INTERP_KERNEL::NORM_SEG3: { - int conn[8]={connBg[1],connBg[3],connBg[3]+deltaz,connBg[1]+deltaz,connBg[2],connBg[3]+nbOfNodesPerLev,connBg[2]+deltaz,connBg[1]+nbOfNodesPerLev}; + mcIdType conn[8]={connBg[1],connBg[3],connBg[3]+deltaz,connBg[1]+deltaz,connBg[2],connBg[3]+nbOfNodesPerLev,connBg[2]+deltaz,connBg[1]+nbOfNodesPerLev}; ret.insert(ret.end(),conn,conn+8); break; } case INTERP_KERNEL::NORM_QUAD4: { - int conn[8]={connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz}; + mcIdType conn[8]={connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz}; ret.insert(ret.end(),conn,conn+8); break; } case INTERP_KERNEL::NORM_TRI3: { - int conn[6]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz}; + mcIdType conn[6]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz}; ret.insert(ret.end(),conn,conn+6); break; } case INTERP_KERNEL::NORM_TRI6: { - int conn[15]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4],connBg[5],connBg[6],connBg[4]+deltaz,connBg[5]+deltaz,connBg[6]+deltaz, + mcIdType conn[15]={connBg[1],connBg[2],connBg[3],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4],connBg[5],connBg[6],connBg[4]+deltaz,connBg[5]+deltaz,connBg[6]+deltaz, connBg[1]+nbOfNodesPerLev,connBg[2]+nbOfNodesPerLev,connBg[3]+nbOfNodesPerLev}; ret.insert(ret.end(),conn,conn+15); break; } case INTERP_KERNEL::NORM_QUAD8: { - int conn[20]={ + mcIdType conn[20]={ connBg[1],connBg[2],connBg[3],connBg[4],connBg[1]+deltaz,connBg[2]+deltaz,connBg[3]+deltaz,connBg[4]+deltaz, connBg[5],connBg[6],connBg[7],connBg[8],connBg[5]+deltaz,connBg[6]+deltaz,connBg[7]+deltaz,connBg[8]+deltaz, connBg[1]+nbOfNodesPerLev,connBg[2]+nbOfNodesPerLev,connBg[3]+nbOfNodesPerLev,connBg[4]+nbOfNodesPerLev @@ -1560,17 +1562,17 @@ void MEDCouplingUMesh::AppendExtrudedCell(const int *connBg, const int *connEnd, } case INTERP_KERNEL::NORM_POLYGON: { - std::back_insert_iterator< std::vector > ii(ret); + std::back_insert_iterator< std::vector > ii(ret); std::copy(connBg+1,connEnd,ii); *ii++=-1; - std::reverse_iterator rConnBg(connEnd); - std::reverse_iterator rConnEnd(connBg+1); - std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); + std::reverse_iterator rConnBg(connEnd); + std::reverse_iterator rConnEnd(connBg+1); + std::transform(rConnBg,rConnEnd,ii,std::bind2nd(std::plus(),deltaz)); std::size_t nbOfRadFaces=std::distance(connBg+1,connEnd); for(std::size_t i=0;i3DCurve * \param [out] cut3DSuf input/output param. */ -void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const int *nodal3DSurf, const int *nodalIndx3DSurf, - const int *nodal3DCurve, const int *nodalIndx3DCurve, - const int *desc, const int *descIndx, - std::vector< std::pair >& cut3DSurf) +void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3DCurve, std::vector& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf, + const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve, + const mcIdType *desc, const mcIdType *descIndx, + std::vector< std::pair >& cut3DSurf) { - std::set nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); - int nbOf3DSurfCell=(int)cut3DSurf.size(); - for(int i=0;i nodesOnP(nodesOnPlane.begin(),nodesOnPlane.end()); + mcIdType nbOf3DSurfCell=ToIdType(cut3DSurf.size()); + for(mcIdType i=0;i res; - int offset=descIndx[i]; - int nbOfSeg=descIndx[i+1]-offset; - for(int j=0;j res; + mcIdType offset=descIndx[i]; + mcIdType nbOfSeg=descIndx[i+1]-offset; + for(mcIdType j=0;j-1) @@ -1632,8 +1634,8 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D case 1: case 0: { - 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)); + 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) { cut3DSurf[i].first=res[0]; cut3DSurf[i].second=res[1]; @@ -1646,7 +1648,7 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D } default: {// case when plane is on a multi colinear edge of a polyhedron - if((int)res.size()==2*nbOfSeg) + if(ToIdType(res.size())==2*nbOfSeg) { cut3DSurf[i].first=-2; cut3DSurf[i].second=i; } @@ -1667,25 +1669,25 @@ void MEDCouplingUMesh::AssemblyForSplitFrom3DCurve(const std::vector& cut3D * \param desc is the descending connectivity 3D->3DSurf * \param descIndx is the descending connectivity index 3D->3DSurf */ -void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, - const int *desc, const int *descIndx, - DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const +void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair >& cut3DSurf, + const mcIdType *desc, const mcIdType *descIndx, + DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const { checkFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::assemblyForSplitFrom3DSurf works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!"); - const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); - for(int i=0;ibegin()),*nodalIndx3D(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); + for(mcIdType i=0;i > m; - int offset=descIndx[i]; - int nbOfFaces=descIndx[i+1]-offset; - int start=-1; - int end=-1; + std::map > m; + mcIdType offset=descIndx[i]; + mcIdType nbOfFaces=descIndx[i+1]-offset; + mcIdType start=-1; + mcIdType end=-1; for(int j=0;j& p=cut3DSurf[desc[offset+j]]; + const std::pair& p=cut3DSurf[desc[offset+j]]; if(p.first!=-1 && p.second!=-1) { if(p.first!=-2) @@ -1697,8 +1699,8 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair tmp=new int[sz]; + mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; + INTERP_KERNEL::AutoPtr tmp=new mcIdType[sz]; INTERP_KERNEL::NormalizedCellType cmsId; unsigned nbOfNodesSon=cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId); start=tmp[0]; end=tmp[nbOfNodesSon-1]; @@ -1712,18 +1714,18 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair conn(1,(int)INTERP_KERNEL::NORM_POLYGON); - int prev=end; + std::vector conn(1,ToIdType(INTERP_KERNEL::NORM_POLYGON)); + mcIdType prev=end; while(end!=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::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) { - int val=*s3.begin(); + mcIdType val=*s3.begin(); conn.push_back(start); prev=start; start=val; @@ -1742,15 +1744,15 @@ void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair& types, const DataArrayInt *nodalConnec, const DataArrayInt *nodalConnecIndex) +void MEDCouplingUMesh::ComputeAllTypesInternal(std::set& types, const DataArrayIdType *nodalConnec, const DataArrayIdType *nodalConnecIndex) { if(nodalConnec && nodalConnecIndex) { types.clear(); - const int *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin()); - int nbOfElem(nodalConnecIndex->getNbOfElems()-1); + const mcIdType *conn(nodalConnec->begin()),*connIndex(nodalConnecIndex->begin()); + mcIdType nbOfElem=ToIdType(nodalConnecIndex->getNbOfElems())-1; if(nbOfElem>0) - for(const int *pt=connIndex;pt!=connIndex+nbOfElem;pt++) + for(const mcIdType *pt=connIndex;pt!=connIndex+nbOfElem;pt++) types.insert((INTERP_KERNEL::NormalizedCellType)conn[*pt]); } } @@ -1768,7 +1770,7 @@ void MEDCouplingUMesh::ComputeAllTypesInternal(std::set edges; { - MCAuto a,b,c,d; + MCAuto a,b,c,d; edges=this->explodeIntoEdges(a,b,c,d); } return edges->attractSeg3MidPtsAroundNodesUnderground(ratio,nodeIdsBg,nodeIdsEnd); @@ -1789,21 +1791,21 @@ void MEDCouplingUMesh::attractSeg3MidPtsAroundNodes(double ratio, const int *nod /*! * \a this is expected to have meshdim==1. */ -void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const int *nodeIdsBg, const int *nodeIdsEnd) +void MEDCouplingUMesh::attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd) { int spaceDim(getSpaceDimension()); double *coords(getCoords()->getPointer()); auto nbNodes(getNumberOfNodes()); - auto nbCells(getNumberOfCells()); + std::size_t nbCells(getNumberOfCells()); std::vector fastFinder(nbNodes,false); for(auto work=nodeIdsBg;work!=nodeIdsEnd;work++) if(*work>=0 && *work cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); - const int *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); - for(auto cellId=0;cellId cellsIds(getCellIdsLyingOnNodes(nodeIdsBg,nodeIdsEnd,false)); + const mcIdType *nc(_nodal_connec->begin()),*nci(_nodal_connec_index->begin()); + for(std::size_t cellId=0;cellId -void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints, - double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const +void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints, + double eps, MCAuto& elts, MCAuto& eltsIndex, std::function sensibilityTo2DQuadraticLinearCellsFunc) const { // Override precision for this method only: INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); - elts=DataArrayInt::New(); eltsIndex=DataArrayInt::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); - int *eltsIndexPtr(eltsIndex->getPointer()); + elts=DataArrayIdType::New(); eltsIndex=DataArrayIdType::New(); eltsIndex->alloc(nbOfPoints+1,1); eltsIndex->setIJ(0,0,0); elts->alloc(0,1); + mcIdType *eltsIndexPtr(eltsIndex->getPointer()); MCAuto bboxArr(getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); - int nbOfCells=getNumberOfCells(); - const int *conn=_nodal_connec->getConstPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connI=_nodal_connec_index->getConstPointer(); double bb[2*SPACEDIM]; - BBTree myTree(&bbox[0],0,0,nbOfCells,-eps); - for(int i=0;i myTree(&bbox[0],0,0,nbOfCells,-eps); + for(mcIdType i=0;i candidates; + std::vector candidates; myTree.getIntersectingElems(bb,candidates); - for(std::vector::const_iterator iter=candidates.begin();iter!=candidates.end();iter++) + for(std::vector::const_iterator iter=candidates.begin();iter!=candidates.end();iter++) { - int sz(connI[(*iter)+1]-connI[*iter]-1); + mcIdType sz(connI[(*iter)+1]-connI[*iter]-1); INTERP_KERNEL::NormalizedCellType ct((INTERP_KERNEL::NormalizedCellType)conn[connI[*iter]]); bool status(false); // [ABN] : point locator algorithms are only properly working for linear cells. @@ -138,9 +138,9 @@ void MEDCouplingUMesh::getCellsContainingPointsAlg(const double *coords, const d throw INTERP_KERNEL::Exception("MEDCouplingUMesh::getCellsContainingPointsAlg : not implemented yet for POLYGON and QPOLYGON in spaceDim 3 !"); std::vector nodes(sz); INTERP_KERNEL::QuadraticPolygon *pol(0); - for(int j=0;j -MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx, DimM1DescNbrer nbrer) const +MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const { if(!desc || !descIndx || !revDesc || !revDescIndx) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildDescendingConnectivityGen : present of a null pointer in input !"); checkConnectivityFullyDefined(); - int nbOfCells=getNumberOfCells(); - int nbOfNodes=getNumberOfNodes(); - MCAuto revNodalIndx=DataArrayInt::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero(); - int *revNodalIndxPtr=revNodalIndx->getPointer(); - const int *conn=_nodal_connec->getConstPointer(); - const int *connIndex=_nodal_connec_index->getConstPointer(); + mcIdType nbOfCells=getNumberOfCells(); + mcIdType nbOfNodes=getNumberOfNodes(); + MCAuto revNodalIndx=DataArrayIdType::New(); revNodalIndx->alloc(nbOfNodes+1,1); revNodalIndx->fillWithZero(); + mcIdType *revNodalIndxPtr=revNodalIndx->getPointer(); + const mcIdType *conn=_nodal_connec->getConstPointer(); + const mcIdType *connIndex=_nodal_connec_index->getConstPointer(); std::string name="Mesh constituent of "; name+=getName(); MCAuto ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA); ret->setCoords(getCoords()); ret->allocateCells(2*nbOfCells); descIndx->alloc(nbOfCells+1,1); - MCAuto revDesc2(DataArrayInt::New()); revDesc2->reserve(2*nbOfCells); - int *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0; - for(int eltId=0;eltId revDesc2(DataArrayIdType::New()); revDesc2->reserve(2*nbOfCells); + mcIdType *descIndxPtr=descIndx->getPointer(); *descIndxPtr++=0; + for(mcIdType eltId=0;eltId tmp=new int[posP1-pos]; + INTERP_KERNEL::AutoPtr tmp=new mcIdType[posP1-pos]; for(unsigned i=0;iinsertNextCell(cmsId,nbOfNodesSon,tmp); revDesc2->pushBackSilent(eltId); } - descIndxPtr[0]=descIndxPtr[-1]+(int)nbOfSons; + descIndxPtr[0]=descIndxPtr[-1]+ToIdType(nbOfSons); } - int nbOfCellsM1=ret->getNumberOfCells(); - std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); - MCAuto revNodal=DataArrayInt::New(); revNodal->alloc(revNodalIndx->back(),1); + mcIdType nbOfCellsM1=ret->getNumberOfCells(); + std::transform(revNodalIndxPtr+1,revNodalIndxPtr+nbOfNodes+1,revNodalIndxPtr,revNodalIndxPtr+1,std::plus()); + MCAuto revNodal=DataArrayIdType::New(); revNodal->alloc(revNodalIndx->back(),1); std::fill(revNodal->getPointer(),revNodal->getPointer()+revNodalIndx->back(),-1); - int *revNodalPtr=revNodal->getPointer(); - const int *connM1=ret->getNodalConnectivity()->getConstPointer(); - const int *connIndexM1=ret->getNodalConnectivityIndex()->getConstPointer(); - for(int eltId=0;eltIdgetPointer(); + const mcIdType *connM1=ret->getNodalConnectivity()->getConstPointer(); + const mcIdType *connIndexM1=ret->getNodalConnectivityIndex()->getConstPointer(); + for(mcIdType eltId=0;eltId=0)//for polyhedrons - *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; + *std::find_if(revNodalPtr+revNodalIndxPtr[*iter],revNodalPtr+revNodalIndxPtr[*iter+1],std::bind2nd(std::equal_to(),-1))=eltId; } // - DataArrayInt *commonCells=0,*commonCellsI=0; + DataArrayIdType *commonCells=0,*commonCellsI=0; FindCommonCellsAlg(3,0,ret->getNodalConnectivity(),ret->getNodalConnectivityIndex(),revNodal,revNodalIndx,commonCells,commonCellsI); - MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); - const int *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer()); - int newNbOfCellsM1=-1; - MCAuto o2nM1=DataArrayInt::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(), + MCAuto commonCellsTmp(commonCells),commonCellsITmp(commonCellsI); + const mcIdType *commonCellsPtr(commonCells->getConstPointer()),*commonCellsIPtr(commonCellsI->getConstPointer()); + mcIdType newNbOfCellsM1=-1; + MCAuto o2nM1=DataArrayIdType::ConvertIndexArrayToO2N(nbOfCellsM1,commonCells->begin(), commonCellsI->begin(),commonCellsI->end(),newNbOfCellsM1); std::vector isImpacted(nbOfCellsM1,false); - for(const int *work=commonCellsI->begin();work!=commonCellsI->end()-1;work++) - for(int work2=work[0];work2!=work[1];work2++) + for(const mcIdType *work=commonCellsI->begin();work!=commonCellsI->end()-1;work++) + for(mcIdType work2=work[0];work2!=work[1];work2++) isImpacted[commonCellsPtr[work2]]=true; - const int *o2nM1Ptr=o2nM1->getConstPointer(); - MCAuto n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); - const int *n2oM1Ptr=n2oM1->getConstPointer(); + const mcIdType *o2nM1Ptr=o2nM1->getConstPointer(); + MCAuto n2oM1=o2nM1->invertArrayO2N2N2OBis(newNbOfCellsM1); + const mcIdType *n2oM1Ptr=n2oM1->getConstPointer(); MCAuto ret2=static_cast(ret->buildPartOfMySelf(n2oM1->begin(),n2oM1->end(),true)); ret2->copyTinyInfoFrom(this); desc->alloc(descIndx->back(),1); - int *descPtr=desc->getPointer(); + mcIdType *descPtr=desc->getPointer(); const INTERP_KERNEL::CellModel& cmsDft=INTERP_KERNEL::CellModel::GetCellModel(INTERP_KERNEL::NORM_POINT1); - for(int i=0;ireserve(newNbOfCellsM1); revDescIndx->alloc(newNbOfCellsM1+1,1); - int *revDescIndxPtr=revDescIndx->getPointer(); *revDescIndxPtr++=0; - const int *revDesc2Ptr=revDesc2->getConstPointer(); - for(int i=0;igetPointer(); *revDescIndxPtr++=0; + const mcIdType *revDesc2Ptr=revDesc2->getConstPointer(); + for(mcIdType i=0;ipushBackSilent(revDesc2Ptr[oldCellIdM1]); @@ -269,7 +269,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt } else { - for(int j=commonCellsIPtr[0];jpushBackSilent(revDesc2Ptr[commonCellsPtr[j]]); revDescIndxPtr[0]=revDescIndxPtr[-1]+commonCellsIPtr[1]-commonCellsIPtr[0]; commonCellsIPtr++; diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index f2df4a04f..cdac34c4a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -50,13 +50,13 @@ using namespace MEDCoupling; /// @cond INTERNAL -int InternalAddPoint(const INTERP_KERNEL::Edge *e, int id, const double *coo, int startId, int endId, DataArrayDouble& addCoo, int& nodesCnter) +mcIdType InternalAddPoint(const INTERP_KERNEL::Edge *e, mcIdType id, const double *coo, mcIdType startId, mcIdType endId, DataArrayDouble& addCoo, mcIdType& nodesCnter) { if(id!=-1) return id; else { - int ret(nodesCnter++); + mcIdType ret(nodesCnter++); double newPt[2]; e->getMiddleOfPoints(coo+2*startId,coo+2*endId,newPt); addCoo.insertAtTheEnd(newPt,newPt+2); @@ -64,13 +64,13 @@ int InternalAddPoint(const INTERP_KERNEL::Edge *e, int id, const double *coo, in } } -int InternalAddPointOriented(const INTERP_KERNEL::Edge *e, int id, const double *coo, int startId, int endId, DataArrayDouble& addCoo, int& nodesCnter) +mcIdType InternalAddPointOriented(const INTERP_KERNEL::Edge *e, mcIdType id, const double *coo, mcIdType startId, mcIdType endId, DataArrayDouble& addCoo, mcIdType& nodesCnter) { if(id!=-1) return id; else { - int ret(nodesCnter++); + mcIdType ret(nodesCnter++); double newPt[2]; e->getMiddleOfPointsOriented(coo+2*startId,coo+2*endId,newPt); addCoo.insertAtTheEnd(newPt,newPt+2); @@ -79,17 +79,17 @@ int InternalAddPointOriented(const INTERP_KERNEL::Edge *e, int id, const double } -void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const int *connBg, int offset, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords, std::vector& middles) +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) { - int tmp[3]; + mcIdType tmp[3]; int trueStart(start>=0?start:nbOfEdges+start); - tmp[0]=linOrArc?(int)INTERP_KERNEL::NORM_QPOLYG:(int)INTERP_KERNEL::NORM_POLYGON; tmp[1]=connBg[trueStart]; tmp[2]=connBg[stp]; + 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) { if(stp-start>1) { - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); InternalAddPointOriented(e,-1,coords,tmp[1],tmp[2],*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -98,15 +98,15 @@ void EnterTheResultOf2DCellFirst(const INTERP_KERNEL::Edge *e, int start, int st } } -void EnterTheResultOf2DCellMiddle(const INTERP_KERNEL::Edge *e, int start, int stp, int nbOfEdges, bool linOrArc, const double *coords, const int *connBg, int offset, DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords, std::vector& middles) +void EnterTheResultOf2DCellMiddle(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) { - int tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]); + mcIdType tmpSrt(newConnOfCell->back()),tmpEnd(connBg[stp]); newConnOfCell->pushBackSilent(tmpEnd); if(linOrArc) { if(stp-start>1) { - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -115,15 +115,15 @@ 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 int *connBg, int offset, DataArrayInt *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) { if(stp-start>1) // if we are covering more than one segment we need to create a new mid point { - int tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg. - int tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); + mcIdType tmpSrt(connBg[start]),tmpEnd(connBg[stp % nbOfEdges]); // % to handle last seg. + mcIdType tmp2(0),tmp3(appendedCoords->getNumberOfTuples()/2); InternalAddPointOriented(e,-1,coords,tmpSrt,tmpEnd,*appendedCoords,tmp2); middles.push_back(tmp3+offset); } @@ -132,20 +132,20 @@ void EnterTheResultOf2DCellEnd(const INTERP_KERNEL::Edge *e, int start, int stp, } } -void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) +void IKGeo2DInternalMapper2(INTERP_KERNEL::Node *n, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { MCAuto nTmp(n); nTmp->incrRef(); - std::map,int>::const_iterator 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 !"); - int v((*it).second); + mcIdType v((*it).second); if(v==forbVal0 || v==forbVal1) return ; if(std::find(isect.begin(),isect.end(),v)==isect.end()) isect.push_back(v); } -bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map,int>& m, int forbVal0, int forbVal1, std::vector& isect) +bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map,mcIdType>& m, mcIdType forbVal0, mcIdType forbVal1, std::vector& isect) { int sz(c.size()); if(sz<=1) @@ -166,7 +166,7 @@ bool IKGeo2DInternalMapper(const INTERP_KERNEL::ComposedEdge& c, const std::map< namespace MEDCoupling { - INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const int *bg, const double *coords2D, std::map< MCAuto,int>& m) + INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge2(INTERP_KERNEL::NormalizedCellType typ, const mcIdType *bg, const double *coords2D, std::map< MCAuto,mcIdType>& m) { 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])); @@ -198,7 +198,7 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map& mapp2, const int *bg) + INTERP_KERNEL::Edge *MEDCouplingUMeshBuildQPFromEdge(INTERP_KERNEL::NormalizedCellType typ, std::map& mapp2, const mcIdType *bg) { INTERP_KERNEL::Edge *ret=0; @@ -240,29 +240,29 @@ namespace MEDCoupling * The input mesh 'mDesc' must be so that mDim==1 and spaceDim==2. * 'mapp' returns a mapping between local numbering in submesh (represented by a Node*) and the global node numbering in 'mDesc'. */ - INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector& candidates, - std::map& mapp) + INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector& candidates, + std::map& mapp) { mapp.clear(); - std::map mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY). + std::map mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY). const double *coo=mDesc->getCoords()->getConstPointer(); - const int *c=mDesc->getNodalConnectivity()->getConstPointer(); - const int *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); - std::set s; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); + const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); + std::set 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++) + for(std::set::const_iterator it2=s.begin();it2!=s.end();it2++) { 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); } INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { 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++) + for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR) mapp[(*it2).second.first]=(*it2).first; @@ -271,24 +271,24 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector& candidates, - std::map& mapp, - const BBTreePts<2,int> & nodeTree, - const std::map& mapRev) + INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMeshWithTree(const MEDCouplingUMesh *mDesc, const std::vector& candidates, + std::map& mapp, + const BBTreePts<2,mcIdType> & nodeTree, + const std::map& mapRev) { mapp.clear(); - std::map mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY). + std::map mapp2; // the last var is a flag specifying if node is an extreme node of the seg (LINEAR) or only a middle for SEG3 (QUADRATIC_ONLY). const double *coo=mDesc->getCoords()->getConstPointer(); - const int *c=mDesc->getNodalConnectivity()->getConstPointer(); - const int *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); - std::set s; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + const mcIdType *c=mDesc->getNodalConnectivity()->getConstPointer(); + const mcIdType *cI=mDesc->getNodalConnectivityIndex()->getConstPointer(); + std::set 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++) + 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; + std::vector 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!"); @@ -308,12 +308,12 @@ namespace MEDCoupling mapp2[*it2]=INTERP_KERNEL::NodeWithUsage(n,INTERP_KERNEL::USAGE_UNKNOWN); } INTERP_KERNEL::QuadraticPolygon *ret=new INTERP_KERNEL::QuadraticPolygon; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { 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++) + for(std::map::const_iterator it2=mapp2.begin();it2!=mapp2.end();it2++) { if((*it2).second.second == INTERP_KERNEL::USAGE_LINEAR) mapp[(*it2).second.first]=(*it2).first; @@ -322,16 +322,16 @@ namespace MEDCoupling return ret; } - INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(int nodeId, const double *coo1, int offset1, const double *coo2, int offset2, const std::vector& addCoo) + INTERP_KERNEL::Node *MEDCouplingUMeshBuildQPNode(mcIdType nodeId, const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector& addCoo) { if(nodeId>=offset2) { - int locId=nodeId-offset2; + mcIdType locId=nodeId-offset2; return new INTERP_KERNEL::Node(addCoo[2*locId],addCoo[2*locId+1]); } if(nodeId>=offset1) { - int 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]); @@ -340,16 +340,16 @@ namespace MEDCoupling /** * Construct a mapping between set of Nodes and the standard MEDCoupling connectivity format (c, cI). */ - void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, int offset1, const double *coo2, int offset2, const std::vector& addCoo, - const int *desc1Bg, const int *desc1End, const std::vector >& intesctEdges1, - /*output*/std::map& mapp, std::map& mappRev) + void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, mcIdType offset1, const double *coo2, mcIdType offset2, const std::vector& addCoo, + const mcIdType *desc1Bg, const mcIdType *desc1End, const std::vector >& intesctEdges1, + /*output*/std::map& mapp, std::map& mappRev) { - for(const int *desc1=desc1Bg;desc1!=desc1End;desc1++) + for(const mcIdType *desc1=desc1Bg;desc1!=desc1End;desc1++) { - int eltId1=abs(*desc1)-1; - for(std::vector::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) + mcIdType eltId1=std::abs(*desc1)-1; + for(std::vector::const_iterator it1=intesctEdges1[eltId1].begin();it1!=intesctEdges1[eltId1].end();it1++) { - std::map::const_iterator 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); @@ -368,28 +368,28 @@ namespace MEDCoupling * \a appendedCoords is a DataArrayDouble instance with number of components equal to one (even if the items are pushed by pair). * \param forbiddenPoints the list of points that should not be removed in the process */ -bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg, const int *connEnd, int offset, - const std::map& forbiddenPoints, - DataArrayInt *newConnOfCell, DataArrayDouble *appendedCoords) +bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset, + const std::map& forbiddenPoints, + DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords) { std::size_t sz(std::distance(connBg,connEnd)); if(sz<3)//3 because 2+1(for the cell type) and 2 is the minimal number of edges of 2D cell. throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Colinearize2DCell : the input cell has invalid format !"); sz--; - INTERP_KERNEL::AutoPtr tmpConn(new int[sz]); - INTERP_KERNEL::AutoPtr tmpConn2(new int[sz]); + 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 nbs(cm.getNumberOfSons2(connBg+1,sz)); + unsigned nbs(cm.getNumberOfSons2(connBg+1,ToIdType(sz))); unsigned nbOfHit(0); // number of fusions operated int posBaseElt(0),posEndElt(0),nbOfTurn(0); - const unsigned int 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 + 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 INTERP_KERNEL::NormalizedCellType typeOfSon; - std::vector middles; + std::vector middles; bool ret(false); for(;(nbOfTurn+nbOfHit),int> m; + cm.fillSonCellNodalConnectivity2(posBaseElt,connBg+1,ToIdType(sz),tmpConn,typeOfSon); + std::map,mcIdType> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2(typeOfSon,tmpConn,coords,m)); posEndElt = posBaseElt+1; @@ -399,9 +399,9 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg { for(unsigned i=1;idecrRef(); } @@ -469,14 +469,14 @@ bool MEDCouplingUMesh::Colinearize2DCell(const double *coords, const int *connBg -bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, const std::vector& candidates, int start, int stop, int& retVal) +bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, const std::vector& candidates, mcIdType start, mcIdType stop, mcIdType& retVal) { if(candidates.empty()) return false; - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) { - const std::vector& pool(intersectEdge1[*it]); - int tmp[2]; tmp[0]=start; tmp[1]=stop; + 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=*it+1; @@ -508,37 +508,37 @@ bool IsColinearOfACellOf(const std::vector< std::vector >& intersectEdge1, */ void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector& addCoo, - const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) + const std::vector< std::vector >& subDiv, std::vector< std::vector >& intersectEdge) { - int offset1=m1->getNumberOfNodes(); - int ncell2=m2->getNumberOfCells(); - const int *c=m2->getNodalConnectivity()->begin(); - const int *cI=m2->getNodalConnectivityIndex()->begin(); + 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(); - int offset2=offset1+m2->getNumberOfNodes(); + mcIdType offset2=offset1+m2->getNumberOfNodes(); intersectEdge.resize(ncell2); - for(int i=0;i& divs=subDiv[i]; - int nnode=cI[1]-cI[0]-1; - std::map mapp2; - std::map mapp22; - for(int j=0;j& divs=subDiv[i]; + mcIdType nnode=cI[1]-cI[0]-1; + std::map mapp2; + std::map mapp22; + for(mcIdType j=0;j::const_iterator it=mapp2.begin();it!=mapp2.end();it++) + for(std::map::const_iterator it=mapp2.begin();it!=mapp2.end();it++) ((*it).second.first)->decrRef(); std::vector addNodes(divs.size()); - std::map mapp3; + std::map mapp3; for(std::size_t j=0;j >& intersectEdge2, const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, - MCAuto& idsInRetColinear, MCAuto& idsInMesh1DForIdsInRetColinear) +MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std::vector< std::vector >& intersectEdge2, const DataArrayDouble *coords1, const std::vector& addCoo, const std::map& mergedNodes, const std::vector< std::vector >& colinear2, const std::vector< std::vector >& intersectEdge1, + MCAuto& idsInRetColinear, MCAuto& idsInMesh1DForIdsInRetColinear) { - idsInRetColinear=DataArrayInt::New(); idsInRetColinear->alloc(0,1); - idsInMesh1DForIdsInRetColinear=DataArrayInt::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1); - int nCells(mesh1D->getNumberOfCells()); - if(nCells!=(int)intersectEdge2.size()) + idsInRetColinear=DataArrayIdType::New(); idsInRetColinear->alloc(0,1); + idsInMesh1DForIdsInRetColinear=DataArrayIdType::New(); idsInMesh1DForIdsInRetColinear->alloc(0,1); + mcIdType nCells=mesh1D->getNumberOfCells(); + if(nCells!=ToIdType(intersectEdge2.size())) throw INTERP_KERNEL::Exception("BuildMesh1DCutFrom : internal error # 1 !"); const DataArrayDouble *coo2(mesh1D->getCoords()); - const int *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin()); + const mcIdType *c(mesh1D->getNodalConnectivity()->begin()),*ci(mesh1D->getNodalConnectivityIndex()->begin()); const double *coo2Ptr(coo2->begin()); - int offset1(coords1->getNumberOfTuples()); - int offset2(offset1+coo2->getNumberOfTuples()); - int offset3(offset2+addCoo.size()/2); + mcIdType offset1(coords1->getNumberOfTuples()); + mcIdType offset2(offset1+coo2->getNumberOfTuples()); + mcIdType offset3(offset2+ToIdType(addCoo.size())/2); std::vector addCooQuad; - MCAuto cOut(DataArrayInt::New()),ciOut(DataArrayInt::New()); cOut->alloc(0,1); ciOut->alloc(1,1); ciOut->setIJ(0,0,0); - int tmp[4],cicnt(0),kk(0); - for(int i=0;i 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); + for(mcIdType i=0;i,int> m; + 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]); - int nbSubEdge(subEdges.size()/2); - for(int j=0;j& subEdges(intersectEdge2[i]); + mcIdType nbSubEdge=ToIdType(subEdges.size()/2); + for(mcIdType j=0;j n1(MEDCouplingUMeshBuildQPNode(subEdges[2*j],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)),n2(MEDCouplingUMeshBuildQPNode(subEdges[2*j+1],coords1->begin(),offset1,coo2Ptr,offset2,addCoo)); MCAuto e2(e->buildEdgeLyingOnMe(n1,n2)); INTERP_KERNEL::Edge *e2Ptr(e2); - std::map::const_iterator itm; + std::map::const_iterator itm; if(dynamic_cast(e2Ptr)) { tmp[0]=INTERP_KERNEL::NORM_SEG3; @@ -592,7 +592,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: tmp[1]=itm!=mergedNodes.end()?(*itm).second:subEdges[2*j]; itm=mergedNodes.find(subEdges[2*j+1]); tmp[2]=itm!=mergedNodes.end()?(*itm).second:subEdges[2*j+1]; - tmp[3]=offset3+(int)addCooQuad.size()/2; + tmp[3]=offset3+ToIdType(addCooQuad.size()/2); double tmp2[2]; e2->getBarycenter(tmp2); addCooQuad.insert(addCooQuad.end(),tmp2,tmp2+2); cicnt+=4; @@ -610,7 +610,7 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: cOut->insertAtTheEnd(tmp,tmp+3); ciOut->pushBackSilent(cicnt); } - int tmp00; + mcIdType tmp00; if(IsColinearOfACellOf(intersectEdge1,colinear2[i],tmp[1],tmp[2],tmp00)) { idsInRetColinear->pushBackSilent(kk); @@ -622,8 +622,8 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: MCAuto ret(MEDCouplingUMesh::New(mesh1D->getName(),1)); ret->setConnectivity(cOut,ciOut,true); MCAuto arr3(DataArrayDouble::New()); - arr3->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,(int)addCoo.size()/2,2); - MCAuto arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,DeallocType::C_DEALLOC,(int)addCooQuad.size()/2,2); + arr3->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,addCoo.size()/2,2); + MCAuto arr4(DataArrayDouble::New()); arr4->useArray(&addCooQuad[0],false,DeallocType::C_DEALLOC,addCooQuad.size()/2,2); std::vector coordss(4); coordss[0]=coords1; coordss[1]=mesh1D->getCoords(); coordss[2]=arr3; coordss[3]=arr4; MCAuto arr(DataArrayDouble::Aggregate(coordss)); @@ -631,12 +631,12 @@ MEDCouplingUMesh *BuildMesh1DCutFrom(const MEDCouplingUMesh *mesh1D, const std:: return ret.retn(); } -MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const int *descBg, const int *descEnd, const std::vector< std::vector >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1) { - std::vector allEdges; - for(const int *it2(descBg);it2!=descEnd;it2++) + std::vector allEdges; + for(const mcIdType *it2(descBg);it2!=descEnd;it2++) { - const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); + const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); if(*it2>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -649,31 +649,31 @@ MEDCouplingUMesh *BuildRefined2DCellLinear(const DataArrayDouble *coords, const MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(coords); ret->allocateCells(1); - std::vector connOut(nbOfEdgesOf2DCellSplit); + std::vector connOut(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kkinsertNextCell(INTERP_KERNEL::NORM_POLYGON,connOut.size(),&connOut[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(connOut.size()),&connOut[0]); return ret.retn(); } -MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, int cellIdInMesh2D, const int *descBg, const int *descEnd, const std::vector< std::vector >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1) { - const int *c(mesh2D->getNodalConnectivity()->begin()),*ci(mesh2D->getNodalConnectivityIndex()->begin()); + 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]])); - std::size_t ii(0); + int ii(0); 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 int[ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]]); - std::vector allEdges,centers; + 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); - int offset(coords->getNumberOfTuples()); - for(const int *it2(descBg);it2!=descEnd;it2++,ii++) + mcIdType offset(coords->getNumberOfTuples()); + for(const mcIdType *it2(descBg);it2!=descEnd;it2++,ii++) { INTERP_KERNEL::NormalizedCellType typeOfSon; cm.fillSonCellNodalConnectivity2(ii,c+ci[cellIdInMesh2D]+1,ci[cellIdInMesh2D+1]-ci[cellIdInMesh2D]-1,tmpPtr,typeOfSon); - const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); + const std::vector& edge1(intersectEdge1[std::abs(*it2)-1]); if(*it2>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -682,11 +682,11 @@ 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. - std::size_t nbOfCentersToAppend(edge1.size()/2); - std::map< MCAuto,int> m; + 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()); - for(std::size_t k=0;k::const_iterator it3(allEdges.end()-edge1.size()); + for(mcIdType k=0;ksetCoords(addCoo); } ret->allocateCells(1); - std::vector connOut(nbOfEdgesOf2DCellSplit); + std::vector connOut(nbOfEdgesOf2DCellSplit); for(std::size_t kk=0;kkinsertNextCell(INTERP_KERNEL::NORM_QPOLYG,connOut.size(),&connOut[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(connOut.size()),&connOut[0]); return ret.retn(); } @@ -725,7 +725,7 @@ MEDCouplingUMesh *BuildRefined2DCellQuadratic(const DataArrayDouble *coords, con * * \param [in] mesh2D - The origin 2D mesh. \b Warning \b coords are not those of \a mesh2D. But mesh2D->getCoords()==coords[:mesh2D->getNumberOfNodes()] */ -MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, int cellIdInMesh2D, const int *descBg, const int *descEnd, const std::vector< std::vector >& intersectEdge1) +MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCouplingUMesh *mesh2D, mcIdType cellIdInMesh2D, const mcIdType *descBg, const mcIdType *descEnd, const std::vector< std::vector >& intersectEdge1) { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(mesh2D->getTypeOfCell(cellIdInMesh2D))); if(!cm.isQuadratic()) @@ -734,7 +734,7 @@ MEDCouplingUMesh *BuildRefined2DCell(const DataArrayDouble *coords, const MEDCou return BuildRefined2DCellQuadratic(coords,mesh2D,cellIdInMesh2D,descBg,descEnd,intersectEdge1); } -void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) +void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, const std::vector< MCAuto >& edges) { bool isQuad(false); for(std::vector< MCAuto >::const_iterator it=edges.begin();it!=edges.end();it++) @@ -744,25 +744,25 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con isQuad=true; } if(!isQuad) - mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,conn.size(),&conn[0]); + mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(conn.size()),&conn[0]); else { const double *coo(mesh2D->getCoords()->begin()); std::size_t sz(conn.size()); std::vector addCoo; - std::vector conn2(conn); - int offset(mesh2D->getNumberOfNodes()); + std::vector conn2(conn); + mcIdType offset(mesh2D->getNumberOfNodes()); for(std::size_t i=0;igetMiddleOfPoints(coo+2*conn[i],coo+2*conn[(i+1)%sz],tmp);// tony a chier i+1 -> i addCoo.insert(addCoo.end(),tmp,tmp+2); - conn2.push_back(offset+(int)i); + conn2.push_back(offset+ToIdType(i)); } mesh2D->getCoords()->rearrange(1); mesh2D->getCoords()->pushBackValsSilent(&addCoo[0],&addCoo[0]+addCoo.size()); mesh2D->getCoords()->rearrange(2); - mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,conn2.size(),&conn2[0]); + mesh2D->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,ToIdType(conn2.size()),&conn2[0]); } } @@ -772,23 +772,23 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con * This method cuts in 2 parts the input 2D cell given using boundaries description (\a edge1Bis and \a edge1BisPtr) using * a set of edges defined in \a splitMesh1D. */ -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) +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 nb(edge1Bis.size()/2); std::size_t nbOfEdgesOf2DCellSplit(nb/2); - int iEnd(splitMesh1D->getNumberOfCells()); + 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; - const int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); + const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); for(ii=0;ii single output cell out0.resize(1); out1.resize(1); - std::vector& connOut(out0[0]); + std::vector& connOut(out0[0]); connOut.resize(nbOfEdgesOf2DCellSplit); std::vector< MCAuto >& edgesPtr(out1[0]); edgesPtr.resize(nbOfEdgesOf2DCellSplit); @@ -802,25 +802,25 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec { // [i,iEnd[ contains the out0.resize(2); out1.resize(2); - std::vector& connOutLeft(out0[0]); - std::vector& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1] + std::vector& connOutLeft(out0[0]); + std::vector& connOutRight(out0[1]);//connOutLeft should end with edge1Bis[2*ii] and connOutRight should end with edge1Bis[2*jj+1] std::vector< MCAuto >& eleft(out1[0]); std::vector< MCAuto >& eright(out1[1]); for(std::size_t k=ii;k > ees(iEnd); - for(int ik=0;ik,int> m; + std::map< MCAuto,mcIdType> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); ees[ik]=ee; } - for(int ik=iEnd-1;ik>=0;ik--) + for(mcIdType ik=iEnd-1;ik>=0;ik--) connOutLeft.push_back(cSplitPtr[ciSplitPtr[ik]+1]); for(std::size_t k=jj+1;k& edges, const std::vector< MCAuto >& edgesPtr); + CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); public: - std::vector _edges; + std::vector _edges; std::vector< MCAuto > _edges_ptr; }; -CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) +CellInfo::CellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr) { std::size_t nbe(edges.size()); - std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); + std::vector edges2(2*nbe); std::vector< MCAuto > edgesPtr2(2*nbe); for(std::size_t i=0;i& edges, const std::vector< MCAuto& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } - EdgeInfo(int istart, int iend, int pos, const MCAuto& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { } - bool isInMyRange(int pos) const { return pos>=_istart && pos<_iend; } - void somethingHappendAt(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); - void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int offset, int neighbors[2]) const; + EdgeInfo(mcIdType istart, mcIdType iend, const MCAuto& mesh):_istart(istart),_iend(iend),_mesh(mesh),_left(-7),_right(-7) { } + EdgeInfo(mcIdType istart, mcIdType iend, mcIdType pos, const MCAuto& edge):_istart(istart),_iend(iend),_edge(edge),_left(pos),_right(pos+1) { } + bool isInMyRange(mcIdType pos) const { return pos>=_istart && pos<_iend; } + void somethingHappendAt(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); + void feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, mcIdType offset, mcIdType neighbors[2]) const; private: - int _istart; - int _iend; + mcIdType _istart; + mcIdType _iend; MCAuto _mesh; MCAuto _edge; - int _left; // index (local numbering) of the left 2D cell bordering the edge '_edge' - int _right; // same as above, right side. + mcIdType _left; // index (local numbering) of the left 2D cell bordering the edge '_edge' + mcIdType _right; // same as above, right side. }; /* * Update indices of left and right 2D cell bordering the current edge. */ -void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) +void EdgeInfo::somethingHappendAt(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { const MEDCouplingUMesh *mesh(_mesh); if(mesh) @@ -913,7 +913,7 @@ void EdgeInfo::somethingHappendAt(int pos, const std::vector< MCAuto barys(mesh->computeCellCenterOfMass()); - int 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; @@ -941,32 +941,32 @@ void EdgeInfo::feedEdgeInfoAt(double eps, const MEDCouplingUMesh *mesh2D, int of class VectorOfCellInfo { public: - VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); + VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr); std::size_t size() const { return _pool.size(); } - int getPositionOf(double eps, const MEDCouplingUMesh *mesh) const; - void setMeshAt(std::size_t pos, const MCAuto& mesh, int istart, int iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); - const std::vector& getConnOf(int pos) const { return get(pos)._edges; } - const std::vector< MCAuto >& getEdgePtrOf(int pos) const { return get(pos)._edges_ptr; } + mcIdType getPositionOf(double eps, const MEDCouplingUMesh *mesh) const; + void setMeshAt(mcIdType pos, const MCAuto& mesh, mcIdType istart, mcIdType iend, const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs); + const std::vector& getConnOf(mcIdType pos) const { return get(pos)._edges; } + const std::vector< MCAuto >& getEdgePtrOf(mcIdType pos) const { return get(pos)._edges_ptr; } MCAuto getZeMesh() const { return _ze_mesh; } - void feedEdgeInfoAt(double eps, int pos, int offset, int neighbors[2]) const; + void feedEdgeInfoAt(double eps, mcIdType pos, mcIdType offset, mcIdType neighbors[2]) const; private: - int getZePosOfEdgeGivenItsGlobalId(int pos) const; - void updateEdgeInfo(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); - const CellInfo& get(int pos) const; - CellInfo& get(int pos); + mcIdType getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const; + void updateEdgeInfo(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight); + const CellInfo& get(mcIdType pos) const; + CellInfo& get(mcIdType pos); private: - std::vector _pool; // for a newly created 2D cell, the list of edges (int) and edges ptr constiuing it + std::vector _pool; // for a newly created 2D cell, the list of edges ToIdType( and edges ptr constiuing it MCAuto _ze_mesh; // the aggregated mesh std::vector _edge_info; // for each new edge added when cuting the 2D cell, the information on left and right bordering 2D cell }; -VectorOfCellInfo::VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr):_pool(1) +VectorOfCellInfo::VectorOfCellInfo(const std::vector& edges, const std::vector< MCAuto >& edgesPtr):_pool(1) { _pool[0]._edges=edges; _pool[0]._edges_ptr=edgesPtr; } -int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) const +mcIdType VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) const { if(_pool.empty()) throw INTERP_KERNEL::Exception("VectorOfCellSplitter::getPositionOf : empty !"); @@ -979,8 +979,8 @@ int VectorOfCellInfo::getPositionOf(double eps, const MEDCouplingUMesh *mesh) co return zeMesh->getCellContainingPoint(barys->begin(),eps); } -void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto& mesh, int istart, int iend, - const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, +void VectorOfCellInfo::setMeshAt(mcIdType pos, const MCAuto& mesh, mcIdType istart, mcIdType iend, + const MCAuto& mesh1DInCase, const std::vector< std::vector >& edges, const std::vector< std::vector< MCAuto > >& edgePtrs) { get(pos);//to check pos @@ -993,11 +993,11 @@ void VectorOfCellInfo::setMeshAt(std::size_t pos, const MCAuto _edge_info.push_back(EdgeInfo(istart,iend,pos,edgePtrs[0].back())); // std::vector pool(_pool.size()-1+sz); - for(std::size_t i=0;i _ze_mesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms2); } -void VectorOfCellInfo::feedEdgeInfoAt(double eps, int pos, int offset, int neighbors[2]) const +void VectorOfCellInfo::feedEdgeInfoAt(double eps, mcIdType pos, mcIdType offset, mcIdType neighbors[2]) const { _edge_info[getZePosOfEdgeGivenItsGlobalId(pos)].feedEdgeInfoAt(eps,_ze_mesh,offset,neighbors); } -int VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(int pos) const +mcIdType VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(mcIdType pos) const { if(pos<0) throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id ! Must be >=0 !"); - int ret(0); + mcIdType ret(0); for(std::vector::const_iterator it=_edge_info.begin();it!=_edge_info.end();it++,ret++) { if((*it).isInMyRange(pos)) @@ -1046,7 +1046,7 @@ int VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId(int pos) const throw INTERP_KERNEL::Exception("VectorOfCellInfo::getZePosOfEdgeGivenItsGlobalId : invalid id !"); } -void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) +void VectorOfCellInfo::updateEdgeInfo(mcIdType pos, const std::vector< MCAuto >& newLeft, const std::vector< MCAuto >& newRight) { get(pos);//to perform the sanity check; if(_edge_info.empty()) @@ -1056,16 +1056,16 @@ void VectorOfCellInfo::updateEdgeInfo(int pos, const std::vector< MCAuto=(int)_pool.size()) + if(pos<0 || pos>=ToIdType(_pool.size())) throw INTERP_KERNEL::Exception("VectorOfCellSplitter::get const : invalid pos !"); return _pool[pos]; } -CellInfo& VectorOfCellInfo::get(int pos) +CellInfo& VectorOfCellInfo::get(mcIdType pos) { - if(pos<0 || pos>=(int)_pool.size()) + if(pos<0 || pos>=ToIdType(_pool.size())) throw INTERP_KERNEL::Exception("VectorOfCellSplitter::get : invalid pos !"); return _pool[pos]; } @@ -1081,36 +1081,36 @@ CellInfo& VectorOfCellInfo::get(int pos) * * \param [in] allEdges a list of pairs (beginNode, endNode). Represents all edges (already cut) in the single 2D cell being handled here. Linked with \a allEdgesPtr to get the equation of edge. */ -MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MCAuto >& allEdgesPtr, int offset, - MCAuto& idsLeftRight) +MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh1D, const std::vector& allEdges, const std::vector< MCAuto >& allEdgesPtr, mcIdType offset, + MCAuto& idsLeftRight) { - int 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 int *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); + const mcIdType *cSplitPtr(splitMesh1D->getNodalConnectivity()->begin()),*ciSplitPtr(splitMesh1D->getNodalConnectivityIndex()->begin()); std::size_t nb(allEdges.size()),jj; if(nb%2!=0) throw INTERP_KERNEL::Exception("BuildMesh2DCutFrom : internal error 2 !"); - std::vector edge1Bis(nb*2); + std::vector edge1Bis(nb*2); std::vector< MCAuto > edge1BisPtr(nb*2); std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin()); std::copy(allEdges.begin(),allEdges.end(),edge1Bis.begin()+nb); std::copy(allEdgesPtr.begin(),allEdgesPtr.end(),edge1BisPtr.begin()); std::copy(allEdgesPtr.begin(),allEdgesPtr.end(),edge1BisPtr.begin()+nb); // - idsLeftRight=DataArrayInt::New(); idsLeftRight->alloc(nbCellsInSplitMesh1D*2); idsLeftRight->fillWithValue(-2); idsLeftRight->rearrange(2); - int *idsLeftRightPtr(idsLeftRight->getPointer()); + idsLeftRight=DataArrayIdType::New(); idsLeftRight->alloc(nbCellsInSplitMesh1D*2); idsLeftRight->fillWithValue(-2); idsLeftRight->rearrange(2); + mcIdType *idsLeftRightPtr(idsLeftRight->getPointer()); VectorOfCellInfo pool(edge1Bis,edge1BisPtr); // Compute contiguous parts of splitMesh1D. We can not make the full assumption that segments are consecutive in the connectivity // (even if the user correctly called orderConsecutiveCells1D()). Indeed the tool might be a closed line whose junction point is in // splitMesh1D. There can be only one such a point, and if this happens this is necessarily at the start // of the connectivity. - MCAuto renumb(DataArrayInt::New()); + MCAuto renumb(DataArrayIdType::New()); renumb->alloc(nbCellsInSplitMesh1D,1); - const int * renumbP(renumb->begin()); + const mcIdType * renumbP(renumb->begin()); - int i, first=cSplitPtr[1]; + mcIdType i, first=cSplitPtr[1]; // Follow 1D line backward as long as it is connected: for (i=nbCellsInSplitMesh1D-1; cSplitPtr[ciSplitPtr[i]+2] == first; i--) first=cSplitPtr[ciSplitPtr[i]+1]; @@ -1132,9 +1132,9 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh // pool. The neighbourhood information detained by pool._edge_info is also updated so that left and right // adjacent 2D cell of a 1D piece is kept up to date. // And so on and so forth. - for(int iStart=0;iStart partOfSplitMesh1D(static_cast(splitMesh1D->buildPartOfMySelfSlice(iStart,iEnd,1,true))); - int pos(pool.getPositionOf(eps,partOfSplitMesh1D)); + mcIdType pos(pool.getPositionOf(eps,partOfSplitMesh1D)); // MCAutoretTmp(MEDCouplingUMesh::New("",2)); retTmp->setCoords(splitMesh1D->getCoords()); retTmp->allocateCells(); - std::vector< std::vector > out0; + std::vector< std::vector > out0; std::vector< std::vector< MCAuto > > out1; BuildMesh2DCutInternal2(partOfSplitMesh1D,pool.getConnOf(pos),pool.getEdgePtrOf(pos),out0,out1); @@ -1163,7 +1163,7 @@ MEDCouplingUMesh *BuildMesh2DCutInternal(double eps, MEDCouplingUMesh *splitMesh // iStart=iEnd; } - for(int mm=0;mm >& intersectEdge1, int offset, - MCAuto& idsLeftRight) +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) { - const int *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin()); + const mcIdType *cdescPtr(mesh2DDesc->getNodalConnectivity()->begin()),*cidescPtr(mesh2DDesc->getNodalConnectivityIndex()->begin()); // - std::vector allEdges; + std::vector allEdges; std::vector< MCAuto > allEdgesPtr; // for each sub edge in splitMesh2D the uncut Edge object of the original mesh2D - for(const int *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode + for(const mcIdType *it(descBg);it!=descEnd;it++) // for all edges in the descending connectivity of the 2D mesh in relative Fortran mode { - int edgeId(std::abs(*it)-1); - std::map< MCAuto,int> m; + mcIdType edgeId(std::abs(*it)-1); + std::map< MCAuto,mcIdType> m; MCAuto ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cdescPtr[cidescPtr[edgeId]],cdescPtr+cidescPtr[edgeId]+1,mesh2DDesc->getCoords()->begin(),m)); - const std::vector& edge1(intersectEdge1[edgeId]); + const std::vector& edge1(intersectEdge1[edgeId]); if(*it>0) allEdges.insert(allEdges.end(),edge1.begin(),edge1.end()); else @@ -1198,7 +1198,7 @@ MEDCouplingUMesh *BuildMesh2DCutFrom(double eps, int cellIdInMesh2D, const MEDCo return BuildMesh2DCutInternal(eps,splitMesh1D,allEdges,allEdgesPtr,offset,idsLeftRight); } -bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, const int *conn1, const INTERP_KERNEL::CellModel& typ2, const int *conn2, double eps) +bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, const mcIdType *conn1, const INTERP_KERNEL::CellModel& typ2, const mcIdType *conn2, double eps) { if(!typ1.isQuadratic() && !typ2.isQuadratic()) {//easy case comparison not @@ -1241,26 +1241,26 @@ bool AreEdgeEqual(const double *coo2D, const INTERP_KERNEL::CellModel& typ1, con * * \param [in] cellIdInMesh1DSplitRelative is in Fortran mode using sign to specify direction. */ -int FindRightCandidateAmong(const MEDCouplingUMesh *mesh2DSplit, const int *candidatesIn2DBg, const int *candidatesIn2DEnd, const MEDCouplingUMesh *mesh1DSplit, int cellIdInMesh1DSplitRelative, double eps) +mcIdType FindRightCandidateAmong(const MEDCouplingUMesh *mesh2DSplit, const mcIdType *candidatesIn2DBg, const mcIdType *candidatesIn2DEnd, const MEDCouplingUMesh *mesh1DSplit, mcIdType cellIdInMesh1DSplitRelative, double eps) { if(candidatesIn2DEnd==candidatesIn2DBg) throw INTERP_KERNEL::Exception("FindRightCandidateAmong : internal error 1 !"); const double *coo(mesh2DSplit->getCoords()->begin()); if(std::distance(candidatesIn2DBg,candidatesIn2DEnd)==1) return *candidatesIn2DBg; - int edgeId(std::abs(cellIdInMesh1DSplitRelative)-1); + mcIdType edgeId(std::abs(cellIdInMesh1DSplitRelative)-1); MCAuto cur1D(static_cast(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true))); if(cellIdInMesh1DSplitRelative<0) cur1D->changeOrientationOfCells(); - const int *c1D(cur1D->getNodalConnectivity()->begin()); + const mcIdType *c1D(cur1D->getNodalConnectivity()->begin()); const INTERP_KERNEL::CellModel& ref1DType(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c1D[0])); - for(const int *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++) + for(const mcIdType *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++) { MCAuto cur2D(static_cast(mesh2DSplit->buildPartOfMySelf(it,it+1,true))); - const int *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin()); + 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 sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1)); - INTERP_KERNEL::AutoPtr tmpPtr(new int[ci[1]-ci[0]]); + 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) + std::vector< std::vector >& 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 prec(eps); - const int *c1(m1Desc->getNodalConnectivity()->begin()),*ci1(m1Desc->getNodalConnectivityIndex()->begin()); + 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)); const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin()); - int nDescCell1(m1Desc->getNumberOfCells()),nDescCell2(m2Desc->getNumberOfCells()); + mcIdType nDescCell1=m1Desc->getNumberOfCells(),nDescCell2=m2Desc->getNumberOfCells(); intersectEdge1.resize(nDescCell1); colinear2.resize(nDescCell2); subDiv2.resize(nDescCell2); - BBTree myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps); - BBTreePts treeNodes2(m2Desc->getCoords()->begin(),0,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); - int offset1(m1Desc->getNumberOfNodes()); - int offset2(offset1+m2Desc->getNumberOfNodes()); - for(int i=0;i candidates1(1); + mcIdType offset1(m1Desc->getNumberOfNodes()); + mcIdType offset2(offset1+m2Desc->getNumberOfNodes()); + for(mcIdType i=0;i candidates2; // edges of mesh2 candidate for intersection + std::vector candidates2; // edges of mesh2 candidate for intersection myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2); if(!candidates2.empty()) // candidates2 holds edges from the second mesh potentially intersecting current edge i in mesh1 { - std::map map1,map2; - std::map revMap2; + std::map map1,map2; + std::map revMap2; // pol2 is not necessarily a closed polygon: just a set of (quadratic) edges (same as candidates2) in the Geometric DS format INTERP_KERNEL::QuadraticPolygon *pol2=MEDCouplingUMeshBuildQPFromMesh(m2Desc,candidates2,map2); // Build revMap2 @@ -1346,23 +1346,23 @@ void MEDCouplingUMesh::Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const M * Documentation about parameters colinear2 and subDiv2 can be found in method QuadraticPolygon::splitAbs(). */ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, - std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, - MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1, + std::vector< std::vector >& intersectEdge1, std::vector< std::vector >& colinear2, std::vector< std::vector >& subDiv2, + MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1, std::vector& addCoo, - MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2) + MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2) { // Build desc connectivity - desc1=DataArrayInt::New(); descIndx1=DataArrayInt::New(); revDesc1=DataArrayInt::New(); revDescIndx1=DataArrayInt::New(); - desc2=DataArrayInt::New(); - descIndx2=DataArrayInt::New(); - revDesc2=DataArrayInt::New(); - revDescIndx2=DataArrayInt::New(); - MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); - MCAuto dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2); + desc1=DataArrayIdType::New(); descIndx1=DataArrayIdType::New(); revDesc1=DataArrayIdType::New(); revDescIndx1=DataArrayIdType::New(); + desc2=DataArrayIdType::New(); + descIndx2=DataArrayIdType::New(); + revDesc2=DataArrayIdType::New(); + revDescIndx2=DataArrayIdType::New(); + MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + MCAuto dd5(desc2),dd6(descIndx2),dd7(revDesc2),dd8(revDescIndx2); m1Desc=m1->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1); m2Desc=m2->buildDescendingConnectivity2(desc2,descIndx2,revDesc2,revDescIndx2); MCAuto dd9(m1Desc),dd10(m2Desc); - std::map notUsedMap; + std::map notUsedMap; Intersect1DMeshes(m1Desc,m2Desc,eps,intersectEdge1,colinear2,subDiv2,addCoo,notUsedMap); m1Desc->incrRef(); desc1->incrRef(); descIndx1->incrRef(); revDesc1->incrRef(); revDescIndx1->incrRef(); m2Desc->incrRef(); desc2->incrRef(); descIndx2->incrRef(); revDesc2->incrRef(); revDescIndx2->incrRef(); @@ -1376,32 +1376,32 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c * @param[out] cNb1, cNb2 correspondence arrays giving for the merged mesh the initial cells IDs in m1 / m2 * TODO: describe input parameters */ -void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, - const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, - const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector >& intesctEdges2, +void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, + const std::vector >& intesctEdges1, const std::vector< std::vector >& colinear2, + const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector >& intesctEdges2, const std::vector& addCoords, - std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2) + std::vector& addCoordsQuadratic, std::vector& cr, std::vector& crI, std::vector& cNb1, std::vector& cNb2) { static const int SPACEDIM=2; const double *coo1(m1->getCoords()->begin()); - const int *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin()); - int offset1(m1->getNumberOfNodes()); + const mcIdType *conn1(m1->getNodalConnectivity()->begin()),*connI1(m1->getNodalConnectivityIndex()->begin()); + mcIdType offset1(m1->getNumberOfNodes()); const double *coo2(m2->getCoords()->begin()); - const int *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin()); - int offset2(offset1+m2->getNumberOfNodes()); - int offset3(offset2+((int)addCoords.size())/2); + const mcIdType *conn2(m2->getNodalConnectivity()->begin()),*connI2(m2->getNodalConnectivityIndex()->begin()); + 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 myTree(bbox2,0,0,m2->getNumberOfCells(),eps); - int ncell1(m1->getNumberOfCells()); + BBTree myTree(bbox2,0,0,m2->getNumberOfCells(),eps); + mcIdType ncell1=m1->getNumberOfCells(); crI.push_back(0); - for(int i=0;i candidates2; + std::vector candidates2; myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2); - std::map mapp; - std::map mappRev; + std::map mapp; + std::map mappRev; INTERP_KERNEL::QuadraticPolygon pol1; INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]]; const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ); @@ -1417,12 +1417,12 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo for(it1.first();!it1.finished();it1.next()) edges1.insert(it1.current()->getPtr()); // - std::map > edgesIn2ForShare; // common edges + std::map > edgesIn2ForShare; // common edges std::vector pol2s(candidates2.size()); - int ii=0; + mcIdType ii=0; // Build, for each intersecting cell candidate from mesh2, the corresponding QP. // Again all the additional intersecting nodes are there. - for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) + for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) { INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]]; const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2); @@ -1439,7 +1439,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo /// ii=0; // Now rebuild intersected cells from all this: - for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) + for(std::vector::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++) { INTERP_KERNEL::ComposedEdge::InitLocationsWithOther(pol1,pol2s[ii]); pol2s[ii].updateLocOfEdgeFromCrudeDataArray2(desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2); @@ -1460,21 +1460,21 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo throw INTERP_KERNEL::Exception(oss.str()); } } - for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) + for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) (*it).second->decrRef(); } } -void InsertNodeInConnIfNecessary(int nodeIdToInsert, std::vector& conn, const double *coords, double eps) +void InsertNodeInConnIfNecessary(mcIdType nodeIdToInsert, std::vector& conn, const double *coords, double eps) { - std::vector::iterator 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 sz(conn.size()); std::size_t found(std::numeric_limits::max()); for(std::size_t i=0;i(),1./normm)); @@ -1494,13 +1494,13 @@ void InsertNodeInConnIfNecessary(int nodeIdToInsert, std::vector& conn, con conn.insert(conn.begin()+(found+1)%sz,nodeIdToInsert); } -void SplitIntoToPart(const std::vector& conn, int pt0, int pt1, std::vector& part0, std::vector& part1) +void SplitIntoToPart(const std::vector& conn, mcIdType pt0, mcIdType pt1, std::vector& part0, std::vector& part1) { std::size_t sz(conn.size()); - std::vector *curPart(&part0); + std::vector *curPart(&part0); for(std::size_t i=0;i& conn, int pt0, int pt1, std::vector /*! * this method method splits cur cells 3D Surf in sub cells 3DSurf using the previous subsplit. This method is the last one used to clip. */ -void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, - const int *desc, const int *descIndx, const double *coords, double eps, - std::vector >& res) const +void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair >& cut3DSurf, + const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, + std::vector >& res) const { checkFullyDefined(); if(getMeshDimension()!=3 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works on umeshes with meshdim equal to 3 and spaceDim equal to 3 too!"); - const int *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin()); - int nbOfCells(getNumberOfCells()); + const mcIdType *nodal3D(_nodal_connec->begin()),*nodalIndx3D(_nodal_connec_index->begin()); + mcIdType nbOfCells=getNumberOfCells(); if(nbOfCells!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSubCellsFromCut works only with single cell presently !"); - for(int i=0;i& p=cut3DSurf[desc[offset+j]]; + const std::pair& p=cut3DSurf[desc[offset+j]]; const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)nodal3D[nodalIndx3D[i]])); - int sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; - INTERP_KERNEL::AutoPtr tmp(new int[sz]); + mcIdType sz=nodalIndx3D[i+1]-nodalIndx3D[i]-1; + INTERP_KERNEL::AutoPtr tmp(new mcIdType[sz]); INTERP_KERNEL::NormalizedCellType cmsId; unsigned nbOfNodesSon(cm.fillSonCellNodalConnectivity2(j,nodal3D+nodalIndx3D[i]+1,sz,tmp,cmsId)); - std::vector elt((int *)tmp,(int *)tmp+nbOfNodesSon); + std::vector elt((mcIdType *)tmp,(mcIdType *)tmp+nbOfNodesSon); if(p.first!=-1 && p.second!=-1) { if(p.first!=-2) { InsertNodeInConnIfNecessary(p.first,elt,coords,eps); InsertNodeInConnIfNecessary(p.second,elt,coords,eps); - std::vector elt1,elt2; + std::vector elt1,elt2; SplitIntoToPart(elt,p.first,p.second,elt1,elt2); res.push_back(elt1); res.push_back(elt2); @@ -1564,22 +1564,23 @@ void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pairgetNumberOfTuples()); - MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); - const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); - int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); - int prevPosOfCi(ciPtr[0]); - for(int i=0;igetNumberOfTuples()); + 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()); + mcIdType prevPosOfCi(ciPtr[0]); + for(mcIdType i=0;igetNumberOfTuples()),nodesCnt(getNumberOfNodes()); - MCAuto c(DataArrayInt::New()); c->alloc((std::size_t)lgthToReach); + 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); - const int *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); - const int *midPtr(mid->begin()),*midIPtr(midI->begin()); + const mcIdType *subPtr(subNodesInSeg->begin()),*subIPtr(subNodesInSegI->begin()),*descPtr(desc->begin()),*descIPtr(descI->begin()),*oldConn(getNodalConnectivity()->begin()); + const mcIdType *midPtr(mid->begin()),*midIPtr(midI->begin()); const double *oldCoordsPtr(getCoords()->begin()); - int *cPtr(c->getPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); - int prevPosOfCi(ciPtr[0]); - for(int i=0;igetPointer()),*ciPtr(getNodalConnectivityIndex()->getPointer()); + mcIdType prevPosOfCi(ciPtr[0]); + for(mcIdType i=0;i e(INTERP_KERNEL::QuadraticPolygon::BuildArcCircleEdge(ns)); - for(int k=0;k > intersectEdge1, colinear2, subDiv2; + std::vector< std::vector > intersectEdge1, colinear2, subDiv2; MEDCouplingUMesh *m1Desc=0,*m2Desc=0; // descending connec. meshes - DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0; + 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, addCoo, m2Desc,desc2,descIndx2,revDesc2,revDescIndx2); revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef(); - MCAuto dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); + MCAuto dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2); MCAuto dd5(m1Desc),dd6(m2Desc); // Step 2: re-order newly created nodes according to the ordering found in m2 - std::vector< std::vector > intersectEdge2; + std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2); subDiv2.clear(); dd5=0; dd6=0; // Step 3: - std::vector cr,crI; //no DataArrayInt because interface with Geometric2D - std::vector cNb1,cNb2; //no DataArrayInt because interface with Geometric2D + std::vector cr,crI; //no DataArrayIdType because interface with Geometric2D + std::vector cNb1,cNb2; //no DataArrayIdType because interface with Geometric2D BuildIntersecting2DCellsFromEdges(eps,m1,desc1->begin(),descIndx1->begin(),intersectEdge1,colinear2,m2,desc2->begin(),descIndx2->begin(),intersectEdge2,addCoo, /* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2); // Step 4: Prepare final result: MCAuto addCooDa(DataArrayDouble::New()); - addCooDa->alloc((int)(addCoo.size())/2,2); + addCooDa->alloc(addCoo.size()/2,2); std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer()); MCAuto addCoordsQuadraticDa(DataArrayDouble::New()); - addCoordsQuadraticDa->alloc((int)(addCoordsQuadratic.size())/2,2); + addCoordsQuadraticDa->alloc(addCoordsQuadratic.size()/2,2); std::copy(addCoordsQuadratic.begin(),addCoordsQuadratic.end(),addCoordsQuadraticDa->getPointer()); std::vector coordss(4); coordss[0]=m1->getCoords(); coordss[1]=m2->getCoords(); coordss[2]=addCooDa; coordss[3]=addCoordsQuadraticDa; MCAuto coo(DataArrayDouble::Aggregate(coordss)); MCAuto ret(MEDCouplingUMesh::New("Intersect2D",2)); - MCAuto conn(DataArrayInt::New()); conn->alloc((int)cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); - MCAuto connI(DataArrayInt::New()); connI->alloc((int)crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); - MCAuto c1(DataArrayInt::New()); c1->alloc((int)cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); - MCAuto c2(DataArrayInt::New()); c2->alloc((int)cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); + MCAuto conn(DataArrayIdType::New()); conn->alloc(cr.size(),1); std::copy(cr.begin(),cr.end(),conn->getPointer()); + MCAuto connI(DataArrayIdType::New()); connI->alloc(crI.size(),1); std::copy(crI.begin(),crI.end(),connI->getPointer()); + MCAuto c1(DataArrayIdType::New()); c1->alloc(cNb1.size(),1); std::copy(cNb1.begin(),cNb1.end(),c1->getPointer()); + MCAuto c2(DataArrayIdType::New()); c2->alloc(cNb2.size(),1); std::copy(cNb2.begin(),cNb2.end(),c2->getPointer()); ret->setConnectivity(conn,connI,true); ret->setCoords(coo); cellNb1=c1.retn(); cellNb2=c2.retn(); @@ -1765,7 +1768,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1 * * \sa Intersect2DMeshes, orderConsecutiveCells1D, conformize2D, mergeNodes */ -void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayInt *&cellIdInMesh2D, DataArrayInt *&cellIdInMesh1D) +void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayIdType *&cellIdInMesh2D, DataArrayIdType *&cellIdInMesh1D) { if(!mesh2D || !mesh1D) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshWith1DLine : input meshes must be not NULL !"); @@ -1775,22 +1778,22 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, if(mesh2D->getMeshDimension()!=2 || mesh2D->getSpaceDimension()!=2 || mesh1D->getMeshDimension()!=1 || mesh1D->getSpaceDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshWith1DLine works with mesh2D with spacedim=meshdim=2 and mesh1D with meshdim=1 spaceDim=2 !"); // Step 1: compute all edge intersections (new nodes) - std::vector< std::vector > intersectEdge1, colinear2, subDiv2; + std::vector< std::vector > intersectEdge1, colinear2, subDiv2; std::vector addCoo,addCoordsQuadratic; // coordinates of newly created nodes INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); // // Build desc connectivity - DataArrayInt *desc1(DataArrayInt::New()),*descIndx1(DataArrayInt::New()),*revDesc1(DataArrayInt::New()),*revDescIndx1(DataArrayInt::New()); - MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); + DataArrayIdType *desc1(DataArrayIdType::New()),*descIndx1(DataArrayIdType::New()),*revDesc1(DataArrayIdType::New()),*revDescIndx1(DataArrayIdType::New()); + MCAuto dd1(desc1),dd2(descIndx1),dd3(revDesc1),dd4(revDescIndx1); MCAuto m1Desc(mesh2D->buildDescendingConnectivity2(desc1,descIndx1,revDesc1,revDescIndx1)); - std::map mergedNodes; + std::map mergedNodes; Intersect1DMeshes(m1Desc,mesh1D,eps,intersectEdge1,colinear2,subDiv2,addCoo,mergedNodes); // use mergeNodes to fix intersectEdge1 - for(std::vector< std::vector >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++) + for(std::vector< std::vector >::iterator it0=intersectEdge1.begin();it0!=intersectEdge1.end();it0++) { std::size_t n((*it0).size()/2); - int eltStart((*it0)[0]),eltEnd((*it0)[2*n-1]); - std::map::const_iterator it1; + 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; @@ -1800,28 +1803,28 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } // MCAuto addCooDa(DataArrayDouble::New()); - addCooDa->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,(int)addCoo.size()/2,2); + addCooDa->useArray(&addCoo[0],false,DeallocType::C_DEALLOC,addCoo.size()/2,2); // Step 2: re-order newly created nodes according to the ordering found in m2 - std::vector< std::vector > intersectEdge2; + std::vector< std::vector > intersectEdge2; BuildIntersectEdges(m1Desc,mesh1D,addCoo,subDiv2,intersectEdge2); subDiv2.clear(); // Step 3: compute splitMesh1D - MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; - MCAuto ret2(DataArrayInt::New()); ret2->alloc(0,1); + MCAuto idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear; + MCAuto ret2(DataArrayIdType::New()); ret2->alloc(0,1); MCAuto ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear)); - MCAuto ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); - MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); + MCAuto ret3(DataArrayIdType::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); + MCAuto idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); // deal with cells in mesh2D that are not cut but only some of their edges are - MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); + MCAuto idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCopy()); idsInDesc2DToBeRefined->abs(); idsInDesc2DToBeRefined->applyLin(1,-1); idsInDesc2DToBeRefined=idsInDesc2DToBeRefined->buildUnique(); - 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 + 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()) { - DataArrayInt *out0(0),*outi0(0); - DataArrayInt::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); - MCAuto outi0s(outi0); + DataArrayIdType *out0(0),*outi0(0); + DataArrayIdType::ExtractFromIndexedArrays(idsInDesc2DToBeRefined->begin(),idsInDesc2DToBeRefined->end(),dd3,dd4,out0,outi0); + MCAuto outi0s(outi0); out0s=out0; out0s=out0s->buildUnique(); out0s->sort(true); @@ -1829,17 +1832,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // MCAuto ret1NonCol(static_cast(ret1->buildPartOfMySelf(idsInRet1NotColinear->begin(),idsInRet1NotColinear->end()))); MCAuto baryRet1(ret1NonCol->computeCellCenterOfMass()); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; mesh2D->getCellsContainingPoints(baryRet1->begin(),baryRet1->getNumberOfTuples(),eps,elts,eltsIndex); - MCAuto eltsIndex2(DataArrayInt::New()); eltsIndex2->alloc(0,1); + MCAuto eltsIndex2(DataArrayIdType::New()); eltsIndex2->alloc(0,1); if (eltsIndex->getNumberOfTuples() > 1) eltsIndex2 = eltsIndex->deltaShiftIndex(); - MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); + MCAuto eltsIndex3(eltsIndex2->findIdsEqual(1)); if(eltsIndex2->count(0)+eltsIndex3->getNumberOfTuples()!=ret1NonCol->getNumberOfCells()) throw INTERP_KERNEL::Exception("Intersect2DMeshWith1DLine : internal error 1 !"); - MCAuto cellsToBeModified(elts->buildUnique()); - MCAuto untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells())); - if((DataArrayInt *)out0s) + MCAuto cellsToBeModified(elts->buildUnique()); + MCAuto untouchedCells(cellsToBeModified->buildComplement(mesh2D->getNumberOfCells())); + if((DataArrayIdType *)out0s) untouchedCells=untouchedCells->buildSubstraction(out0s);//if some edges in ret1 are colinear to descending mesh of mesh2D remove cells from untouched one std::vector< MCAuto > outMesh2DSplit; // OK all is ready to insert in ret2 mesh @@ -1849,26 +1852,26 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, outMesh2DSplit.back()->setCoords(ret1->getCoords()); ret2->pushBackValsSilent(untouchedCells->begin(),untouchedCells->end()); } - if((DataArrayInt *)out0s) + if((DataArrayIdType *)out0s) {// here dealing with cells in out0s but not in cellsToBeModified - MCAuto fewModifiedCells(out0s->buildSubstraction(cellsToBeModified)); - const int *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin()); - for(const int *it=fewModifiedCells->begin();it!=fewModifiedCells->end();it++) + MCAuto fewModifiedCells(out0s->buildSubstraction(cellsToBeModified)); + const mcIdType *rdptr(dd3->begin()),*rdiptr(dd4->begin()),*dptr(dd1->begin()),*diptr(dd2->begin()); + 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)); ret1->setCoords(outMesh2DSplit.back()->getCoords()); } - int offset(ret2->getNumberOfTuples()); + mcIdType offset(ret2->getNumberOfTuples()); ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end()); - MCAuto partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); - partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); - int kk(0),*ret3ptr(partOfRet3->getPointer()); - for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++) + 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++) { - int faceId(std::abs(*it)-1); - for(const int *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++) + mcIdType faceId(std::abs(*it)-1); + for(const mcIdType *it2=rdptr+rdiptr[faceId];it2!=rdptr+rdiptr[faceId+1];it2++) { - int 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]) @@ -1896,17 +1899,17 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, } } cellsToBeModified=cellsToBeModified->buildUniqueNotSorted(); - for(const int *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++) + for(const mcIdType *it=cellsToBeModified->begin();it!=cellsToBeModified->end();it++) { - MCAuto idsNonColPerCell(elts->findIdsEqual(*it)); + MCAuto idsNonColPerCell(elts->findIdsEqual(*it)); idsNonColPerCell->transformWithIndArr(eltsIndex3->begin(),eltsIndex3->end()); - MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); + MCAuto idsNonColPerCell2(idsInRet1NotColinear->selectByTupleId(idsNonColPerCell->begin(),idsNonColPerCell->end())); MCAuto partOfMesh1CuttingCur2DCell(static_cast(ret1NonCol->buildPartOfMySelf(idsNonColPerCell->begin(),idsNonColPerCell->end()))); - MCAuto partOfRet3; + MCAuto partOfRet3; MCAuto splitOfOneCell(BuildMesh2DCutFrom(eps,*it,m1Desc,partOfMesh1CuttingCur2DCell,dd1->begin()+dd2->getIJ(*it,0),dd1->begin()+dd2->getIJ((*it)+1,0),intersectEdge1,ret2->getNumberOfTuples(),partOfRet3)); ret3->setPartOfValues3(partOfRet3,idsNonColPerCell2->begin(),idsNonColPerCell2->end(),0,2,1,true); outMesh2DSplit.push_back(splitOfOneCell); - for(std::size_t i=0;igetNumberOfCells();i++) + for(mcIdType i=0;igetNumberOfCells();i++) ret2->pushBackSilent(*it); } // @@ -1917,16 +1920,16 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, // ret1->getCoords()->setInfoOnComponents(compNames); MCAuto ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp)); - // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. + // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. ret3->rearrange(1); - MCAuto edgesToDealWith(ret3->findIdsStrictlyNegative()); - for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) + MCAuto edgesToDealWith(ret3->findIdsStrictlyNegative()); + for(const mcIdType *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) { - int old2DCellId(-ret3->getIJ(*it,0)-1); - MCAuto candidates(ret2->findIdsEqual(old2DCellId)); + 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 } - ret3->changeValue(std::numeric_limits::max(),-1); + ret3->changeValue(std::numeric_limits::max(),-1); ret3->rearrange(2); // splitMesh1D=ret1.retn(); @@ -1950,7 +1953,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, * If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method. * * \param [in] eps the relative error to detect merged edges. - * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array + * \return DataArrayIdType * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array * that the user is expected to deal with. * * \throw If \a this is not coherent. @@ -1958,30 +1961,30 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, * \throw If \a this has not meshDim equal to 2. * \sa MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::split2DCells */ -DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) +DataArrayIdType *MEDCouplingUMesh::conformize2D(double eps) { static const int SPACEDIM=2; checkConsistencyLight(); if(getSpaceDimension()!=2 || getMeshDimension()!=2) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : This method only works for meshes with spaceDim=2 and meshDim=2 !"); - MCAuto desc1(DataArrayInt::New()),descIndx1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescIndx1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descIndx1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescIndx1(DataArrayIdType::New()); MCAuto mDesc(buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1)); - const int *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin()); + const mcIdType *c(mDesc->getNodalConnectivity()->begin()),*ci(mDesc->getNodalConnectivityIndex()->begin()),*rd(revDesc1->begin()),*rdi(revDescIndx1->begin()); MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); - int nCell(getNumberOfCells()),nDescCell(mDesc->getNumberOfCells()); - std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); + mcIdType nCell=getNumberOfCells(),nDescCell=mDesc->getNumberOfCells(); + std::vector< std::vector > intersectEdge(nDescCell),overlapEdge(nDescCell); std::vector addCoo; - BBTree myTree(bbox,0,0,nDescCell,-eps); + BBTree myTree(bbox,0,0,nDescCell,-eps); INTERP_KERNEL::QuadraticPlanarPrecision prec(eps); - for(int i=0;i candidates; + std::vector candidates; myTree.getIntersectingElems(bbox+i*2*SPACEDIM,candidates); - for(std::vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + 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,int> m; + 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[*it]],c+ci[*it]+1,coords,m)); INTERP_KERNEL::MergePoints merge; @@ -1995,24 +1998,24 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) } } // splitting done. sort intersect point in intersectEdge. - std::vector< std::vector > middle(nDescCell); - int nbOf2DCellsToBeSplit(0); + std::vector< std::vector > middle(nDescCell); + mcIdType nbOf2DCellsToBeSplit(0); bool middleNeedsToBeUsed(false); std::vector cells2DToTreat(nDescCell,false); - for(int i=0;i& isect(intersectEdge[i]); - int sz((int)isect.size()); + std::vector& isect(intersectEdge[i]); + std::size_t sz(isect.size()); if(sz>1) { - std::map,int> m; + std::map,mcIdType> m; INTERP_KERNEL::Edge *e(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)c[ci[i]],c+ci[i]+1,coords,m)); e->sortSubNodesAbs(coords,isect); e->decrRef(); } if(sz!=0) { - int idx0(rdi[i]),idx1(rdi[i+1]); + mcIdType idx0(rdi[i]),idx1(rdi[i+1]); if(idx1-idx0!=1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize2D : internal error #0 !"); if(!cells2DToTreat[rd[idx0]]) @@ -2021,22 +2024,22 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) nbOf2DCellsToBeSplit++; } // try to reuse at most eventual 'middle' of SEG3 - std::vector& mid(middle[i]); + std::vector& mid(middle[i]); mid.resize(sz+1,-1); if((INTERP_KERNEL::NormalizedCellType)c[ci[i]]==INTERP_KERNEL::NORM_SEG3) { middleNeedsToBeUsed=true; - const std::vector& candidates(overlapEdge[i]); - std::vector trueCandidates; - for(std::vector::const_iterator itc=candidates.begin();itc!=candidates.end();itc++) + const std::vector& candidates(overlapEdge[i]); + std::vector trueCandidates; + 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); - int stNode(c[ci[i]+1]),endNode(isect[0]); - for(int j=0;j::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++) + for(std::vector::const_iterator itc=trueCandidates.begin();itc!=trueCandidates.end();itc++) { - int tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]); + mcIdType tmpSt(c[ci[*itc]+1]),tmpEnd(c[ci[*itc]+2]); if((tmpSt==stNode && tmpEnd==endNode) || (tmpSt==endNode && tmpEnd==stNode)) { mid[j]=*itc; break; } } @@ -2046,29 +2049,29 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) } } } - MCAuto ret(DataArrayInt::New()),notRet(DataArrayInt::New()); ret->alloc(nbOf2DCellsToBeSplit,1); + MCAuto ret(DataArrayIdType::New()),notRet(DataArrayIdType::New()); ret->alloc(nbOf2DCellsToBeSplit,1); if(nbOf2DCellsToBeSplit==0) return ret.retn(); // - int *retPtr(ret->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;i mSafe,nSafe,oSafe,pSafe,qSafe,rSafe; - DataArrayInt *m(0),*n(0),*o(0),*p(0),*q(0),*r(0); - DataArrayInt::ExtractFromIndexedArrays(ret->begin(),ret->end(),desc1,descIndx1,m,n); mSafe=m; nSafe=n; - DataArrayInt::PutIntoToSkylineFrmt(intersectEdge,o,p); oSafe=o; pSafe=p; + MCAuto mSafe,nSafe,oSafe,pSafe,qSafe,rSafe; + 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) - { DataArrayInt::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; } + { DataArrayIdType::PutIntoToSkylineFrmt(middle,q,r); qSafe=q; rSafe=r; } MCAuto modif(static_cast(buildPartOfMySelf(ret->begin(),ret->end(),true))); - int 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; int newNbOfNodes; + bool areNodesMerged; mcIdType newNbOfNodes; if(nbOfNodesCreated!=0) - MCAuto tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); + MCAuto tmp(mergeNodes(eps,areNodesMerged,newNbOfNodes)); } return ret.retn(); } @@ -2086,7 +2089,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) * * If \a this is constituted by only linear 2D cells, this method is close to the computation of the convex hull of each cells in \a this. * - * \return DataArrayInt * - The list of cellIds in \a this that have at least one edge colinearized. + * \return DataArrayIdType * - The list of cellIds in \a this that have at least one edge colinearized. * * \throw If \a this is not coherent. * \throw If \a this has not spaceDim equal to 2. @@ -2094,7 +2097,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) * * \sa MEDCouplingUMesh::conformize2D, MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::convexEnvelop2D. */ -DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) +DataArrayIdType *MEDCouplingUMesh::colinearize2D(double eps) { return internalColinearize2D(eps, false); } @@ -2106,7 +2109,7 @@ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) * * \sa MEDCouplingUMesh::colinearize2D */ -DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) +DataArrayIdType *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) { return internalColinearize2D(eps, true); } @@ -2115,35 +2118,35 @@ DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) /*! * \param stayConform is set to True, will not fuse two edges sharing a node that has (strictly) more than 2 egdes connected to it */ -DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConform) +DataArrayIdType *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConform) { - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); 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 prec(eps); - int nbOfCells(getNumberOfCells()),nbOfNodes(getNumberOfNodes()); - const int *cptr(_nodal_connec->begin()),*ciptr(_nodal_connec_index->begin()); - MCAuto newc(DataArrayInt::New()),newci(DataArrayInt::New()); newci->alloc(nbOfCells+1,1); newc->alloc(0,1); newci->setIJ(0,0,0); - std::map forbiddenPoints; // list of points that can not be removed (or it will break conformity) + 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); + std::map forbiddenPoints; // list of points that can not be removed (or it will break conformity) if(stayConform) // { // A point that is used by more than 2 edges can not be removed without breaking conformity: - MCAuto desc1(DataArrayInt::New()),descI1(DataArrayInt::New()),revDesc1(DataArrayInt::New()),revDescI1(DataArrayInt::New()); + MCAuto desc1(DataArrayIdType::New()),descI1(DataArrayIdType::New()),revDesc1(DataArrayIdType::New()),revDescI1(DataArrayIdType::New()); MCAuto mDesc1D(buildDescendingConnectivity(desc1,descI1,revDesc1,revDescI1)); - MCAuto desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New()); MCAuto mDesc0D(mDesc1D->buildDescendingConnectivity(desc2,descI2,revDesc2,revDescI2)); - MCAuto dsi(revDescI2->deltaShiftIndex()); - MCAuto ids(dsi->findIdsGreaterThan(2)); - const int * cPtr(mDesc0D->getNodalConnectivity()->begin()); + MCAuto dsi(revDescI2->deltaShiftIndex()); + MCAuto ids(dsi->findIdsGreaterThan(2)); + const mcIdType * cPtr(mDesc0D->getNodalConnectivity()->begin()); 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. const double *coords(_coords->begin()); - int *newciptr(newci->getPointer()); - for(int i=0;igetPointer()); + for(mcIdType i=0;ipushBackSilent(i); @@ -2170,19 +2173,19 @@ DataArrayInt *MEDCouplingUMesh::internalColinearize2D(double eps, bool stayConfo * startNode, endNode in global numbering *\return true if the segment is indeed split */ -bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, int endNode, - const int * c, const int * cI, const int *idsBg, const int *endBg, - std::vector & pointIds, std::vector & hitSegs) +bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, mcIdType startNode, mcIdType endNode, + const mcIdType * c, const mcIdType * cI, const mcIdType *idsBg, const mcIdType *endBg, + std::vector & pointIds, std::vector & hitSegs) { using namespace std; const int SPACEDIM=3; - typedef pair PairDI; + typedef pair PairDI; set< PairDI > x; - for (const int * it = idsBg; it != endBg; ++it) + for (const mcIdType * it = idsBg; it != endBg; ++it) { assert(c[cI[*it]] == INTERP_KERNEL::NORM_SEG2); - int start = c[cI[*it]+1], end = c[cI[*it]+2]; + mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2]; x.insert(make_pair(coo[start*SPACEDIM], start)); // take only X coords x.insert(make_pair(coo[end*SPACEDIM], end)); } @@ -2192,10 +2195,10 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i pointIds.reserve(xx.size()); // Keep what is inside [startNode, endNode]: - int go = 0; + mcIdType go = 0; for (vector::const_iterator it=xx.begin(); it != xx.end(); ++it) { - const int idx = (*it).second; + const mcIdType idx = (*it).second; if (!go) { if (idx == startNode) go = 1; @@ -2208,7 +2211,7 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i break; } -// vector pointIds2(pointIds.size()+2); +// vector pointIds2(pointIds.size()+2); // copy(pointIds.begin(), pointIds.end(), pointIds2.data()+1); // pointIds2[0] = startNode; // pointIds2[pointIds2.size()-1] = endNode; @@ -2217,12 +2220,12 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i reverse(pointIds.begin(), pointIds.end()); // Now identify smaller segments that are not sub-divided - those won't need any further treatment: - for (const int * it = idsBg; it != endBg; ++it) + for (const mcIdType * it = idsBg; it != endBg; ++it) { - int start = c[cI[*it]+1], end = c[cI[*it]+2]; - vector::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start); + mcIdType start = c[cI[*it]+1], end = c[cI[*it]+2]; + vector::const_iterator itStart = find(pointIds.begin(), pointIds.end(), start); if (itStart == pointIds.end()) continue; - vector::const_iterator 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. @@ -2231,23 +2234,23 @@ bool MEDCouplingUMesh::OrderPointsAlongLine(const double * coo, int startNode, i return (pointIds.size() > 2); // something else apart start and end node } -void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxConnE, int startNode, int endNode, - const std::vector& insidePoints, std::vector& modifiedFace) +void MEDCouplingUMesh::ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode, + const std::vector& insidePoints, std::vector& modifiedFace) { using namespace std; - int dst = distance(sIdxConn, sIdxConnE); + size_t dst = distance(sIdxConn, sIdxConnE); modifiedFace.reserve(dst + insidePoints.size()-2); modifiedFace.resize(dst); copy(sIdxConn, sIdxConnE, modifiedFace.data()); - vector::iterator shortEnd = modifiedFace.begin()+dst; - vector::iterator 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!"); - vector::iterator 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!"); - int 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 @@ -2269,7 +2272,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC * If it is not the case you can invoke MEDCouplingUMesh::mergeNodes before calling this method. * * \param [in] eps the relative error to detect merged edges. - * \return DataArrayInt * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array + * \return DataArrayIdType * - The list of cellIds in \a this that have been subdivided. If empty, nothing changed in \a this (as if it were a const method). The array is a newly allocated array * that the user is expected to deal with. * * \throw If \a this is not coherent. @@ -2277,7 +2280,7 @@ void MEDCouplingUMesh::ReplaceEdgeInFace(const int * sIdxConn, const int * sIdxC * \throw If \a this has not meshDim equal to 3. * \sa MEDCouplingUMesh::mergeNodes, MEDCouplingUMesh::conformize2D, MEDCouplingUMesh::convertAllToPoly() */ -DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) +DataArrayIdType *MEDCouplingUMesh::conformize3D(double eps) { using namespace std; @@ -2290,23 +2293,23 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex())); const double * coo(_coords->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); { /************************* * STEP 1 -- faces *************************/ - MCAuto descDNU(DataArrayInt::New()),descIDNU(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New()); + MCAuto descDNU(DataArrayIdType::New()),descIDNU(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New()); MCAuto mDesc(buildDescendingConnectivity(descDNU,descIDNU,revDesc,revDescI)); - const int *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer()); - const int *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin()); + const mcIdType *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer()); + const mcIdType *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin()); MCAuto connSlaDesc(MEDCouplingSkyLineArray::New(mDesc->getNodalConnectivityIndex(), mDesc->getNodalConnectivity())); // Build BBTree MCAuto bboxArr(mDesc->getBoundingBoxForBBTree(eps)); const double *bbox(bboxArr->begin()); getCoords()->begin(); - int nDescCell(mDesc->getNumberOfCells()); - BBTree myTree(bbox,0,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(); @@ -2316,26 +2319,26 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) const double * normalsP = normals->getConstPointer(); // Sort faces by decreasing surface: - vector< pair > S; - for(std::size_t i=0;i < surfs->getNumberOfTuples();i++) + vector< pair > S; + for(mcIdType i=0;i < surfs->getNumberOfTuples();i++) { - pair 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 hitPoly; // the final result: which 3D cells have been modified. + vector hitPoly; // the final result: which 3D cells have been modified. - for( vector >::const_iterator it = S.begin(); it != S.end(); it++) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - int faceIdx = (*it).second; + mcIdType faceIdx = (*it).second; if (hit[faceIdx]) continue; - vector candidates, cands2; + vector candidates, cands2; myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates); // Keep only candidates whose normal matches the normal of current face - for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps); if (*it2 != faceIdx && col) @@ -2354,16 +2357,16 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) MCAuto mPartCand(mDesc->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), false)); // false=zipCoords is called double * cooPartRef(mPartRef->_coords->getPointer()); double * cooPartCand(mPartCand->_coords->getPointer()); - for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartRef+SPACEDIM*ii); - for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartCand+SPACEDIM*ii); // Localize faces in 2D thanks to barycenters MCAuto baryPart = mPartCand->computeCellCenterOfMass(); - vector compo; compo.push_back(2); + vector compo; compo.push_back(2); MCAuto baryPartZ = baryPart->keepSelectedComponents(compo); - MCAuto idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps); + MCAuto idsGoodPlane = baryPartZ->findIdsInRange(-eps, +eps); if (!idsGoodPlane->getNumberOfTuples()) continue; @@ -2372,15 +2375,15 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) compo[0] = 0; compo.push_back(1); MCAuto baryPartXY = baryPart->keepSelectedComponents(compo); mPartRef->changeSpaceDimension(2,0.0); - MCAuto cc(DataArrayInt::New()), ccI(DataArrayInt::New()); + MCAuto cc(DataArrayIdType::New()), ccI(DataArrayIdType::New()); mPartRef->getCellsContainingPoints(baryPartXY->begin(), baryPartXY->getNumberOfTuples(), eps, cc, ccI); if (!cc->getNumberOfTuples()) continue; - MCAuto dsi = ccI->deltaShiftIndex(); + MCAuto dsi = ccI->deltaShiftIndex(); { - MCAuto tmp = dsi->findIdsInRange(0, 2); + MCAuto tmp = dsi->findIdsInRange(0, 2); if (tmp->getNumberOfTuples() != dsi->getNumberOfTuples()) { ostringstream oss; @@ -2389,16 +2392,16 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) } } - MCAuto ids = dsi->findIdsEqual(1); + MCAuto ids = dsi->findIdsEqual(1); // Boundary face: if (!ids->getNumberOfTuples()) continue; double checkSurf=0.0; - const int * idsGoodPlaneP(idsGoodPlane->begin()); - for (const int * ii = ids->begin(); ii != ids->end(); ii++) + const mcIdType * idsGoodPlaneP(idsGoodPlane->begin()); + for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++) { - int faceIdx2 = cands2[idsGoodPlaneP[*ii]]; + mcIdType faceIdx2 = cands2[idsGoodPlaneP[*ii]]; hit[faceIdx2] = true; checkSurf += surfs->begin()[faceIdx2]; } @@ -2410,18 +2413,18 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) } // For all polyhedrons using this face, replace connectivity: - vector polyIndices, packsIds, facePack; - for (int ii=revDescIP[faceIdx]; ii < revDescIP[faceIdx+1]; ii++) + vector polyIndices, packsIds, facePack; + for (mcIdType ii=revDescIP[faceIdx]; ii < revDescIP[faceIdx+1]; ii++) polyIndices.push_back(revDescP[ii]); ret->pushBackValsSilent(polyIndices.data(),polyIndices.data()+polyIndices.size()); // Current face connectivity - const int * sIdxConn = cDesc + cIDesc[faceIdx] + 1; - const int * sIdxConnE = cDesc + cIDesc[faceIdx+1]; + const mcIdType * sIdxConn = cDesc + cIDesc[faceIdx] + 1; + const mcIdType * sIdxConnE = cDesc + cIDesc[faceIdx+1]; connSla->findPackIds(polyIndices, sIdxConn, sIdxConnE, packsIds); // Deletion of old faces - int jj=0; - for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj) + mcIdType jj=0; + for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj) { if (packsIds[jj] == -1) // The below should never happen - if a face is used several times, with a different layout of the nodes @@ -2432,22 +2435,22 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) connSla->deletePack(*it2, packsIds[jj]); } // Insertion of new faces: - for (const int * ii = ids->begin(); ii != ids->end(); ii++) + for (const mcIdType * ii = ids->begin(); ii != ids->end(); ii++) { // Build pack from the face to insert: - int faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)]; - int facePack2Sz; - const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type! + 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 (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2) + for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2) connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz); // without the type } } } // end step1 // Set back modified connectivity - MCAuto cAuto; cAuto.takeRef(_nodal_connec); - MCAuto cIAuto; cIAuto.takeRef(_nodal_connec_index); + MCAuto cAuto; cAuto.takeRef(_nodal_connec); + MCAuto cIAuto; cIAuto.takeRef(_nodal_connec_index); connSla->convertToPolyhedronConn(cAuto, cIAuto); { @@ -2457,36 +2460,36 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Now we have a face-conform mesh. // Recompute descending - MCAuto desc(DataArrayInt::New()),descI(DataArrayInt::New()),revDesc(DataArrayInt::New()),revDescI(DataArrayInt::New()); + MCAuto desc(DataArrayIdType::New()),descI(DataArrayIdType::New()),revDesc(DataArrayIdType::New()),revDescI(DataArrayIdType::New()); // Rebuild desc connectivity with orientation this time!! MCAuto mDesc(buildDescendingConnectivity2(desc,descI,revDesc,revDescI)); - const int *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer()); - const int *descIP(descI->getConstPointer()), *descP(desc->getConstPointer()); - const int *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin()); - MCAuto ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy()); - MCAuto cDeepC(mDesc->getNodalConnectivity()->deepCopy()); + const mcIdType *revDescIP(revDescI->getConstPointer()), *revDescP(revDesc->getConstPointer()); + const mcIdType *descIP(descI->getConstPointer()), *descP(desc->getConstPointer()); + const mcIdType *cDesc(mDesc->getNodalConnectivity()->begin()),*cIDesc(mDesc->getNodalConnectivityIndex()->begin()); + MCAuto ciDeepC(mDesc->getNodalConnectivityIndex()->deepCopy()); + MCAuto cDeepC(mDesc->getNodalConnectivity()->deepCopy()); MCAuto connSlaDesc(MEDCouplingSkyLineArray::New(ciDeepC, cDeepC)); - MCAuto desc2(DataArrayInt::New()),descI2(DataArrayInt::New()),revDesc2(DataArrayInt::New()),revDescI2(DataArrayInt::New()); + MCAuto desc2(DataArrayIdType::New()),descI2(DataArrayIdType::New()),revDesc2(DataArrayIdType::New()),revDescI2(DataArrayIdType::New()); MCAuto mDesc2 = mDesc->buildDescendingConnectivity(desc2,descI2,revDesc2,revDescI2); // std::cout << "writing!\n"; // mDesc->writeVTK("/tmp/toto_desc_confInter.vtu"); // mDesc2->writeVTK("/tmp/toto_desc2_confInter.vtu"); - const int *revDescIP2(revDescI2->getConstPointer()), *revDescP2(revDesc2->getConstPointer()); - const int *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin()); + const mcIdType *revDescIP2(revDescI2->getConstPointer()), *revDescP2(revDesc2->getConstPointer()); + const mcIdType *cDesc2(mDesc2->getNodalConnectivity()->begin()),*cIDesc2(mDesc2->getNodalConnectivityIndex()->begin()); MCAuto bboxArr(mDesc2->getBoundingBoxForBBTree(eps)); const double *bbox2(bboxArr->begin()); - int nDesc2Cell=mDesc2->getNumberOfCells(); - BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); + mcIdType nDesc2Cell=mDesc2->getNumberOfCells(); + BBTree myTree2(bbox2,0,0,nDesc2Cell,-eps); // Edges - handle longest first MCAuto lenF = mDesc2->getMeasureField(true); DataArrayDouble * lens = lenF->getArray(); // Sort edges by decreasing length: - vector > S; - for(std::size_t i=0;i < lens->getNumberOfTuples();i++) + vector > S; + for(mcIdType i=0;i < lens->getNumberOfTuples();i++) { - pair 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 @@ -2494,24 +2497,24 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) vector hit(nDesc2Cell); fill(hit.begin(), hit.end(), false); - for( vector >::const_iterator it = S.begin(); it != S.end(); it++) + for( vector >::const_iterator it = S.begin(); it != S.end(); it++) { - int eIdx = (*it).second; + mcIdType eIdx = (*it).second; if (hit[eIdx]) continue; - vector candidates, cands2; + vector candidates, cands2; myTree2.getIntersectingElems(bbox2+eIdx*2*SPACEDIM,candidates); // Keep only candidates colinear with current edge double vCurr[3]; - unsigned start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2]; - for (int i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar? + mcIdType start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2]; + for (mcIdType i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar? vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3]; - for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { double vOther[3]; - unsigned start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2]; - for (int i3=0; i3 < 3; i3++) + 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]; bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps); // Warning: different from faces: we need to keep eIdx in the final list of candidates because we need @@ -2523,69 +2526,69 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) continue; // Now rotate edges to bring them on Ox - int startNode = cDesc2[cIDesc2[eIdx]+1]; - int 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 MCAuto mPartCand(mDesc2->buildPartOfMySelf(&cands2[0], &cands2[0]+cands2.size(), true)); // true=zipCoords is called - MCAuto nodeMap(mPartCand->zipCoordsTraducer()); - int nbElemsNotM1; + MCAuto nodeMap(mPartCand->zipCoordsTraducer()); + mcIdType nbElemsNotM1; { - MCAuto tmp(nodeMap->findIdsNotEqual(-1)); + MCAuto tmp(nodeMap->findIdsNotEqual(-1)); nbElemsNotM1 = tmp->getNbOfElems(); } - MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); + MCAuto nodeMapInv = nodeMap->invertArrayO2N2N2O(nbElemsNotM1); double * cooPartRef(mPartRef->_coords->getPointer()); double * cooPartCand(mPartCand->_coords->getPointer()); - for (std::size_t ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartRef->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartRef+SPACEDIM*ii); - for (std::size_t ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) + for (mcIdType ii = 0; ii < mPartCand->_coords->getNumberOfTuples(); ii++) rotation.transform_vector(cooPartCand+SPACEDIM*ii); // Eliminate all edges for which y or z is not null MCAuto baryPart = mPartCand->computeCellCenterOfMass(); - vector compo; compo.push_back(1); + vector compo; compo.push_back(1); MCAuto baryPartY = baryPart->keepSelectedComponents(compo); compo[0] = 2; MCAuto baryPartZ = baryPart->keepSelectedComponents(compo); - MCAuto idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps); - MCAuto idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps); - MCAuto idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2); + MCAuto idsGoodLine1 = baryPartY->findIdsInRange(-eps, +eps); + MCAuto idsGoodLine2 = baryPartZ->findIdsInRange(-eps, +eps); + MCAuto idsGoodLine = idsGoodLine1->buildIntersection(idsGoodLine2); if (!idsGoodLine->getNumberOfTuples()) continue; // Now the ordering along the Ox axis: - std::vector insidePoints, hitSegs; + std::vector insidePoints, hitSegs; 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 (vector::const_iterator its=hitSegs.begin(); its != hitSegs.end(); ++its) + 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 (std::vector::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit) + for (std::vector::iterator iit = insidePoints.begin(); iit!=insidePoints.end(); ++iit) *iit = nodeMapInv->begin()[*iit]; - vector polyIndices, packsIds, facePack; + vector polyIndices, packsIds, facePack; // For each face implying this edge - for (int ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++) + for (mcIdType ii=revDescIP2[eIdx]; ii < revDescIP2[eIdx+1]; ii++) { - int 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]); // Current face connectivity - const int * sIdxConn = cDesc + cIDesc[faceIdx] + 1; - const int * sIdxConnE = cDesc + cIDesc[faceIdx+1]; + const mcIdType * sIdxConn = cDesc + cIDesc[faceIdx] + 1; + const mcIdType * sIdxConnE = cDesc + cIDesc[faceIdx+1]; - vector modifiedFace; + vector modifiedFace; ReplaceEdgeInFace(sIdxConn, sIdxConnE, startNode, endNode, insidePoints, /*out*/modifiedFace); modifiedFace.insert(modifiedFace.begin(), INTERP_KERNEL::NORM_POLYGON); connSlaDesc->replaceSimplePack(faceIdx, modifiedFace.data(), modifiedFace.data()+modifiedFace.size()); @@ -2594,22 +2597,23 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Rebuild 3D connectivity from descending: MCAuto newConn(MEDCouplingSkyLineArray::New()); - MCAuto superIdx(DataArrayInt::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0); - MCAuto idx(DataArrayInt::New()); idx->alloc(1); idx->fillWithValue(0); - MCAuto vals(DataArrayInt::New()); vals->alloc(0); + MCAuto superIdx(DataArrayIdType::New()); superIdx->alloc(getNumberOfCells()+1); superIdx->fillWithValue(0); + MCAuto idx(DataArrayIdType::New()); idx->alloc(1); idx->fillWithValue(0); + MCAuto vals(DataArrayIdType::New()); vals->alloc(0); newConn->set3(superIdx, idx, vals); - for(std::size_t ii = 0; ii < getNumberOfCells(); ii++) - for (int jj=descIP[ii]; jj < descIP[ii+1]; jj++) + mcIdType nbCells=getNumberOfCells(); + for(mcIdType ii = 0; ii < nbCells; ii++) + for (mcIdType jj=descIP[ii]; jj < descIP[ii+1]; jj++) { - int sz, faceIdx = abs(descP[jj])-1; + mcIdType sz, faceIdx = abs(descP[jj])-1; bool orient = descP[jj]>0; - const int * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz); + const mcIdType * p = connSlaDesc->getSimplePackSafePtr(faceIdx, sz); if (orient) newConn->pushBackPack(ii, p+1, p+sz); // +1 to skip type else { - vector rev(sz-1); - for (int kk=0; kk rev(sz-1); + for (mcIdType kk=0; kkpushBackPack(ii, rev.data(), rev.data()+sz-1); } } diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx old mode 100644 new mode 100755 index 573099051..80e1b0e3d --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -74,17 +74,17 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt line->setCoords(coo); } line->allocateCells(); - static const int CONN[2]={0,1}; + static const mcIdType CONN[2]={0,1}; line->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,CONN); MCAuto sp2,sp1; { - DataArrayInt *cellNb1(0),*cellNb2(0); + 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); + MCAuto cellNb10(cellNb1),cellNb20(cellNb2); } - std::vector ccp; + std::vector ccp; sp2->getCellsContainingPoint(pt1,eps,ccp); if(ccp.size()!=1) throw INTERP_KERNEL::Exception("ComputeBigCellFrom : expected single element !"); @@ -96,31 +96,31 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt MCAuto MergeVorCells2D(MEDCouplingUMesh *p, double eps, bool isZip) { - MCAuto edgeToKeep; + MCAuto edgeToKeep; MCAuto p0; { - MCAuto d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New()); + MCAuto d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New()); p0=p->buildDescendingConnectivity(d,di,rd,rdi); - MCAuto dsi(rdi->deltaShiftIndex()); + MCAuto dsi(rdi->deltaShiftIndex()); edgeToKeep=dsi->findIdsEqual(1); } MCAuto skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end())); if(isZip) { skinOfRes->zipCoords(); - if(skinOfRes->getNumberOfCells()!=skinOfRes->getNumberOfNodes()) + if(ToIdType(skinOfRes->getNumberOfCells())!=skinOfRes->getNumberOfNodes()) throw INTERP_KERNEL::Exception("MergeVorCells : result of merge looks bad !"); } - MCAuto d(skinOfRes->orderConsecutiveCells1D()); + MCAuto d(skinOfRes->orderConsecutiveCells1D()); MCAuto skinOfRes2; { MCAuto part(skinOfRes->buildPartOfMySelf(d->begin(),d->end())); skinOfRes2=MEDCoupling1SGTUMesh::New(part); } - MCAuto c(skinOfRes2->getNodalConnectivity()->deepCopy()); + MCAuto c(skinOfRes2->getNodalConnectivity()->deepCopy()); c->circularPermutation(1); c->rearrange(2); - std::vector< MCAuto > vdi(c->explodeComponents()); + std::vector< MCAuto > vdi(c->explodeComponents()); if(!vdi[0]->isEqual(*vdi[1])) throw INTERP_KERNEL::Exception("MergeVorCells : internal error !"); MCAuto m(MEDCouplingUMesh::New("",2)); @@ -144,8 +144,8 @@ MCAuto MergeVorCells(const std::vector< MCAutozipCoords(); { - bool dummy; int dummy2; - MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } return MergeVorCells2D(p,eps,true); } @@ -157,13 +157,13 @@ MCAuto SimplifyPolygon(const MEDCouplingUMesh *m, double eps) { if(m->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception("SimplifyPolygon : internal error !"); - const int *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin()); - int nbPtsInPolygon(conni[1]-conni[0]-1); + const mcIdType *conn(m->getNodalConnectivity()->begin()),*conni(m->getNodalConnectivityIndex()->begin()); + mcIdType nbPtsInPolygon(conni[1]-conni[0]-1); const double *coo(m->getCoords()->begin()); - std::vector resConn; - for(int i=0;i resConn; + for(mcIdType i=0;i SimplifyPolygon(const MEDCouplingUMesh *m, double eps) MCAuto ret(MEDCouplingUMesh::New("",2)); ret->setCoords(m->getCoords()); ret->allocateCells(); - ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,resConn.size(),&resConn[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYGON,ToIdType(resConn.size()),&resConn[0]); return ret; } @@ -198,32 +198,32 @@ MCAuto MergeVorCells3D(const std::vector< MCAutozipCoords(); { - bool dummy; int dummy2; - MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(p->mergeNodes(eps,dummy,dummy2)); } - MCAuto edgeToKeep; + MCAuto edgeToKeep; MCAuto p0; { - MCAuto d(DataArrayInt::New()),di(DataArrayInt::New()),rd(DataArrayInt::New()),rdi(DataArrayInt::New()); + MCAuto d(DataArrayIdType::New()),di(DataArrayIdType::New()),rd(DataArrayIdType::New()),rdi(DataArrayIdType::New()); p0=p->buildDescendingConnectivity(d,di,rd,rdi); - MCAuto dsi(rdi->deltaShiftIndex()); + MCAuto dsi(rdi->deltaShiftIndex()); edgeToKeep=dsi->findIdsEqual(1); } MCAuto skinOfRes(p0->buildPartOfMySelf(edgeToKeep->begin(),edgeToKeep->end())); MCAuto eqn(skinOfRes->computePlaneEquationOf3DFaces()); - MCAuto comm,commI; + MCAuto comm,commI; { - DataArrayInt *a(0),*b(0); + DataArrayIdType *a(0),*b(0); eqn->findCommonTuples(eps,0,a,b); comm=a; commI=b; - //comm=DataArrayInt::New(); comm->alloc(0,1); commI=DataArrayInt::New(); commI->alloc(1,1); commI->setIJ(0,0,0); + //comm=DataArrayIdType::New(); comm->alloc(0,1); commI=DataArrayIdType::New(); commI->alloc(1,1); commI->setIJ(0,0,0); } MCAuto ret(MEDCouplingUMesh::New("",3)); ret->setCoords(skinOfRes->getCoords()); ret->allocateCells(); - std::vector conn; + std::vector conn; int jj(0); - for(int i=0;igetNumberOfTuples()-1;i++,jj++) + for(mcIdType i=0;igetNumberOfTuples()-1;i++,jj++) { if(jj!=0) conn.push_back(-1); @@ -234,27 +234,27 @@ MCAuto MergeVorCells3D(const std::vector< MCAutogetNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin()); + const mcIdType *cPtr(tmp2->getNodalConnectivity()->begin()),*ciPtr(tmp2->getNodalConnectivityIndex()->begin()); conn.insert(conn.end(),cPtr+1,cPtr+ciPtr[1]); } - MCAuto remain(comm->buildComplement(skinOfRes->getNumberOfCells())); + MCAuto remain(comm->buildComplement(ToIdType(skinOfRes->getNumberOfCells()))); { MCAuto tmp(skinOfRes->buildPartOfMySelf(remain->begin(),remain->end(),true)); - const int *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin()); - for(int i=0;igetNumberOfTuples();i++,jj++) + const mcIdType *cPtr(tmp->getNodalConnectivity()->begin()),*ciPtr(tmp->getNodalConnectivityIndex()->begin()); + for(mcIdType i=0;igetNumberOfTuples();i++,jj++) { if(jj!=0) conn.push_back(-1); conn.insert(conn.end(),cPtr+ciPtr[i]+1,cPtr+ciPtr[i+1]); } } - ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,conn.size(),&conn[0]); + ret->insertNextCell(INTERP_KERNEL::NORM_POLYHED,ToIdType(conn.size()),&conn[0]); return ret; } MCAuto MergeVorCells1D(const std::vector< MCAuto >& vcs, double eps) { - static const int CONN_SEG2_DFT[2]={0,1}; + static const mcIdType CONN_SEG2_DFT[2]={0,1}; if(vcs.empty()) throw INTERP_KERNEL::Exception("MergeVorCells1D : internal error 1 !"); if(vcs.size()==1) @@ -263,12 +263,12 @@ MCAuto MergeVorCells1D(const std::vector< MCAutogetNodalConnectivity()->begin()); + const mcIdType *connPtr(vcs[0]->getNodalConnectivity()->begin()); const double *coordPtr(vcs[0]->getCoords()->begin()); a0=coordPtr[connPtr[1]]; b0=coordPtr[connPtr[2]]; } { - const int *connPtr(vcs[1]->getNodalConnectivity()->begin()); + const mcIdType *connPtr(vcs[1]->getNodalConnectivity()->begin()); const double *coordPtr(vcs[1]->getCoords()->begin()); a1=coordPtr[connPtr[1]]; b1=coordPtr[connPtr[2]]; } @@ -283,7 +283,7 @@ MCAuto MergeVorCells1D(const std::vector< MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const { - static const int CONN_SEG2_DFT[2]={0,1}; + static const mcIdType CONN_SEG2_DFT[2]={0,1}; if(!m || !points) throw INTERP_KERNEL::Exception("Voronoize1D : null pointer !"); m->checkConsistencyLight(); @@ -292,14 +292,14 @@ 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 !"); - int nbPts(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize1D : at least one point expected !"); std::vector bbox(4); m->getBoundingBox(&bbox[0]); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -308,10 +308,10 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector polygsToIterOn; const double *pt(pts+i); vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn); if(polygsToIterOn.empty()) @@ -319,9 +319,9 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * if(polygsToIterOn.size()>2) throw INTERP_KERNEL::Exception("Voronoize1D : overlap of points !"); std::vector< MCAuto > newVorCells; - for(std::vector::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++) + for(std::vector::const_iterator it=polygsToIterOn.begin();it!=polygsToIterOn.end();it++) { - int poly(*it); + mcIdType poly(*it); // double seed(pts[poly]),zept(*pt); double mid((seed+zept)/2.); @@ -330,7 +330,7 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * tile->zipCoords(); double a,b; { - const int *connPtr(tile->getNodalConnectivity()->begin()); + const mcIdType *connPtr(tile->getNodalConnectivity()->begin()); const double *coordPtr(tile->getCoords()->begin()); a=coordPtr[connPtr[1]]; b=coordPtr[connPtr[2]]; } @@ -357,8 +357,8 @@ MCAuto MEDCoupling::Voronizer1D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } @@ -373,14 +373,14 @@ 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 !"); - int nbPts(points->getNumberOfTuples()); + mcIdType nbPts(points->getNumberOfTuples()); if(nbPts<1) throw INTERP_KERNEL::Exception("Voronoize2D : at least one point expected !"); std::vector bbox(4); m->getBoundingBox(&bbox[0]); std::vector< MCAuto > l0(1,MCAuto(m->deepCopy())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -389,36 +389,36 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector polygsToIterOn; const double *pt(pts+i*2); vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn); if(polygsToIterOn.size()<1) throw INTERP_KERNEL::Exception("Voronoize2D : presence of a point outside the given cell !"); - std::set elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]); + std::set elemsToDo,elemsDone; elemsToDo.insert(polygsToIterOn[0]); std::vector< MCAuto > newVorCells; while(!elemsToDo.empty()) { - int 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]); tile->zipCoords(); MCAuto a; - MCAuto b,c; + MCAuto b,c; { - DataArrayInt *bPtr(0),*cPtr(0); + DataArrayIdType *bPtr(0),*cPtr(0); a=MEDCouplingUMesh::Intersect2DMeshes(tile,cell,eps,bPtr,cPtr); b=bPtr; c=cPtr; } - MCAuto part(c->findIdsEqual(-1)); + MCAuto part(c->findIdsEqual(-1)); if(part->getNumberOfTuples()!=1) throw INTERP_KERNEL::Exception("Voronoize2D : internal error"); MCAuto newVorCell; { - MCAuto tmp(part->buildComplement(a->getNumberOfCells())); + MCAuto tmp(part->buildComplement(ToIdType(a->getNumberOfCells()))); newVorCell=a->buildPartOfMySelf(tmp->begin(),tmp->end()); } newVorCell->zipCoords(); @@ -426,9 +426,9 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * modifiedCell->zipCoords(); l0[poly]=modifiedCell; // - MCAuto ids; + MCAuto ids; { - DataArrayInt *tmp(0); + DataArrayIdType *tmp(0); bool sta(a->getCoords()->areIncludedInMe(cell->getCoords(),eps,tmp)); ids=tmp; if(!sta) @@ -436,19 +436,19 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * } MCAuto newCoords; { - MCAuto tmp(ids->buildComplement(a->getNumberOfNodes())); + MCAuto tmp(ids->buildComplement(a->getNumberOfNodes())); newCoords=a->getCoords()->selectByTupleId(tmp->begin(),tmp->end()); } const double *cPtr(newCoords->begin()); - for(int j=0;jgetNumberOfTuples();j++,cPtr+=2) + for(mcIdType j=0;jgetNumberOfTuples();j++,cPtr+=2) { - std::set zeCandidates; + std::set zeCandidates; { - std::vector zeCandidatesTmp; + std::vector zeCandidatesTmp; vorTess->getCellsContainingPoint(cPtr,eps,zeCandidatesTmp); zeCandidates.insert(zeCandidatesTmp.begin(),zeCandidatesTmp.end()); } - std::set tmp2,newElementsToDo; + std::set tmp2,newElementsToDo; std::set_difference(zeCandidates.begin(),zeCandidates.end(),elemsDone.begin(),elemsDone.end(),std::inserter(tmp2,tmp2.begin())); std::set_union(elemsToDo.begin(),elemsToDo.end(),tmp2.begin(),tmp2.end(),std::inserter(newElementsToDo,newElementsToDo.begin())); elemsToDo=newElementsToDo; @@ -460,13 +460,13 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType 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, int 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 !"); @@ -478,7 +478,7 @@ MCAuto Split3DCellInParts(const MEDCouplingUMesh *m, const dou MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh *m, const DataArrayDouble *points, double eps) const { - double eps2(1.-sqrt(eps));// 2nd eps for interpolation. Here the eps is computed to feet cos(eps) ~ 1-eps^2 + //double eps2(1.-sqrt(eps));// 2nd eps for interpolation. Here the eps is computed to feet cos(eps) ~ 1-eps^2 if(!m || !points) throw INTERP_KERNEL::Exception("Voronoize3D : null pointer !"); m->checkConsistencyLight(); @@ -487,12 +487,12 @@ 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 !"); - int 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())); const double *pts(points->begin()); - for(int i=1;i vorTess; { @@ -501,27 +501,27 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * } { bool dummy; - int newNbNodes; - MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); + mcIdType newNbNodes; + MCAuto dummy3(vorTess->mergeNodes(eps,dummy,newNbNodes)); } - std::vector polygsToIterOn; + std::vector polygsToIterOn; const double *pt(pts+i*3); vorTess->getCellsContainingPoint(pt,eps,polygsToIterOn); if(polygsToIterOn.size()<1) throw INTERP_KERNEL::Exception("Voronoize3D : presence of a point outside the given cell !"); std::vector< MCAuto > newVorCells; - for(int poly=0;polygetNumberOfCells();poly++) + for(mcIdType poly=0;polygetNumberOfCells());poly++) { const double *seed(pts+3*poly); MCAuto tile(l0[poly]); tile->zipCoords(); - int tmp[2]; + mcIdType tmp[2]; MCAuto cells; try { cells=Split3DCellInParts(tile,pt,seed,eps,tmp); } - catch(INTERP_KERNEL::Exception& e) + catch(INTERP_KERNEL::Exception&) { continue; } @@ -537,8 +537,8 @@ MCAuto MEDCoupling::Voronizer3D::doIt(const MEDCouplingUMesh * std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis)); { - bool dummy; int dummy2; - MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); + bool dummy; mcIdType dummy2; + MCAuto dummy3(ret->mergeNodes(eps,dummy,dummy2)); } return ret; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx index 6023488ed..ab111273d 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx @@ -22,6 +22,7 @@ #define __MEDCOUPLINGBASICSTEST_HXX__ #include +#include "MCType.hxx" #include #include @@ -93,9 +94,9 @@ namespace MEDCoupling static DataArrayDouble *buildCoordsForMultiTypes_1(); static MEDCouplingMultiFields *buildMultiFields_1(); static std::vector buildMultiFields_2(); - static double sumAll(const std::vector< std::map >& matrix); + static double sumAll(const std::vector< std::map >& matrix); protected: - static int countNonZero(const std::vector< std::map >& matrix); + static int countNonZero(const std::vector< std::map >& matrix); static void test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh, MEDCouplingUMesh *targetMesh, diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx index 1ee95f1ae..f057a7215 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx @@ -35,7 +35,7 @@ using namespace MEDCoupling; -typedef std::vector > IntersectionMatrix; +typedef std::vector > IntersectionMatrix; MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_2() { @@ -46,7 +46,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_2() 0.0, 200.0, 200.0, 200.0, 0.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 149.999999970343, 149.9999999874621, 49.999999881628682}; - int sourceConn[212]={25, 27, 13, 19, 18, 3, 20, 21, 5, 10, 17, 1, 1, 3, 0, 7, 18, 1, 0, 27, 12, 27, 13, 24, 25, 19, 16, 26, 1, 2, 6, 8, 15, 13, + mcIdType sourceConn[212]={25, 27, 13, 19, 18, 3, 20, 21, 5, 10, 17, 1, 1, 3, 0, 7, 18, 1, 0, 27, 12, 27, 13, 24, 25, 19, 16, 26, 1, 2, 6, 8, 15, 13, 12, 5, 24, 13, 25, 27, 10, 11, 9, 6, 19, 8, 23, 1, 22, 8, 23, 19, 16, 13, 17, 1, 6, 9, 10, 8, 13, 17, 5, 15, 5, 4, 1, 12, 18, 0, 24, 27, 19, 20, 18, 1, 7, 6, 5, 1, 4, 12, 15, 14, 25, 27, 19, 18, 1, 19, 16, 13, 20, 19, 23, 1, 27, 12, 1, 0, 6, 5, 1, 10, 4, 5, 1, 7, 12, 27, 1, 13, 5, 15, 4, 12, 19, 16, 26, 22, 13, 5, 17, 1, 1, 3, 7, 2, 13, 5, 1, 12, 18, 1, 3, 0, 8, 23, 2, 9, 3, @@ -70,7 +70,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_2() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_2() { double targetCoords[24]={200.0, 200.0, 0.0, 200.0, 200.0, 200.0, 200.0, 0.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 0.0, 200.0, 200.0, 0.0, 0.0, 0.0, 0.0, 0.0, 200.0}; - int targetConn[20]={5, 6, 3, 0, 1, 3, 0, 5, 3, 6, 5, 7, 6, 4, 0, 5, 6, 3, 0, 2}; + mcIdType targetConn[20]={5, 6, 3, 0, 1, 3, 0, 5, 3, 6, 5, 7, 6, 4, 0, 5, 6, 3, 0, 2}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(3); targetMesh->allocateCells(5); @@ -91,7 +91,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DTargetMesh_1() 25.,25.,0., 25.,25.,50., 25.,25.,200., 75.,25.,0., 75.,25.,50., 75.,25.,200., 25.,125.,0., 25.,125.,50., 25.,125.,200., 125.,125.,0., 125.,125.,50., 125.,125.,200. }; - int targetConn[16]={0,1, 1,2, 3,4, 4,5, 6,7, 7,8, 9,10, 10,11}; + mcIdType targetConn[16]={0,1, 1,2, 3,4, 4,5, 6,7, 7,8, 9,10, 10,11}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("my name of mesh 1D",1); targetMesh->allocateCells(8); @@ -109,7 +109,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DTargetMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DSourceMesh_1() { double sourceCoords[8]={-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7}; - int sourceConn[6]={0,3,1,0,2,3}; + mcIdType sourceConn[6]={0,3,1,0,2,3}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New("my name of mesh 2D",2); sourceMesh->allocateCells(2); sourceMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,sourceConn); @@ -126,7 +126,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DSourceMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_1() { double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; - int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -147,7 +147,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshPerm_1() { double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; - int targetConn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -168,7 +168,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshPerm_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_2() { double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; - int targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 }; + mcIdType targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 }; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(8); @@ -192,7 +192,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_2() MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU1DMesh_U() { double coords[4]={ 0.0, 0.3, 0.75, 1.0 }; - int conn[2*3]={ 0,1, 1,2, 2,3 }; + mcIdType conn[2*3]={ 0,1, 1,2, 2,3 }; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(1); mesh->allocateCells(3); @@ -210,7 +210,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU1DMesh_U() MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU2DMesh_U() { double coords[18]={0.0,0.0, 0.5,0.0, 1.0,0.0, 0.0,0.5, 0.5,0.5, 1.0,0.5, 0.0,1.0, 0.5,1.0, 1.0,1.0 }; - int conn[18]={0,1,4,3, 3,4,7,6, 4,5,8,7, 1,5,4, 1,2,5 }; + mcIdType conn[18]={0,1,4,3, 3,4,7,6, 4,5,8,7, 1,5,4, 1,2,5 }; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); @@ -234,7 +234,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU3DMesh_U() // 0.0,1.0,0.0 ,0.0,0.3,0.0 ,0.0,0.3,0.3 ,0.3,0.0,0.0 ,0.3,0.3,1.0 ,1.0,0.0,1.0 ,1.0,0.0,0.3 ,0.3,0.0,0.3 ,0.3,1.0,0.3 ,0.0,0.3,1.0 ,0.3,0.0,1.0 ,0.3,0.3,0.3 ,1.0,0.3,1.0 ,1.0,0.0,0.0 ,0.0,0.0,0.0 ,1.0,0.3,0.3 ,0.3,1.0,0.0 ,1.0,1.0,0.3 ,1.0,1.0,1.0 ,0.0,1.0,1.0 ,0.3,0.3,0.0 ,0.0,1.0,0.3 ,0.0,0.0,1.0 ,0.3,1.0,1.0 ,1.0,0.3,0.0 ,0.0,0.0,0.3 ,1.0,1.0,0.0 0.0,0.0,0.0, 0.3,0.0,0.0, 1.0,0.0,0.0, 0.0,0.3,0.0, 0.3,0.3,0.0, 1.0,0.3,0.0, 0.0,1.0,0.0, 0.3,1.0,0.0, 1.0,1.0,0.0, 0.0,0.0,0.3, 0.3,0.0,0.3, 1.0,0.0,0.3, 0.0,0.3,0.3, 0.3,0.3,0.3, 1.0,0.3,0.3, 0.0,1.0,0.3, 0.3,1.0,0.3, 1.0,1.0,0.3, 0.0,0.0,1.0, 0.3,0.0,1.0, 1.0,0.0,1.0, 0.0,0.3,1.0, 0.3,0.3,1.0, 1.0,0.3,1.0, 0.0,1.0,1.0, 0.3,1.0,1.0, 1.0,1.0,1.0, }; - int conn[8*8]= + mcIdType conn[8*8]= { // 11,15,12,4,8,17,18,23,3,13,6,7,20,24,15,11,14,3,7,25,1,20,11,2,1,20,11,2,0,16,8,21,20,24,15,11,16,26,17,8,25,7,10,22,2,11,4,9,2,11,4,9,21,8,23,19,7,6,5,10,11,15,12,4 0,3,4,1,9,12,13,10, 1,4,5,2,10,13,14,11, 3,6,7,4,12,15,16,13, 4,7,8,5,13,16,17,14, 9,12,13,10,18,21,22,19, 10,13,14,11,19,22,23,20, 12,15,16,13,21,24,25,22, 13,16,17,14,22,25,26,23 @@ -256,7 +256,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildCU3DMesh_U() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_1() { double sourceCoords[12]={-0.3,-0.3,0.5, 0.7,-0.3,1.5, -0.3,0.7,0.5, 0.7,0.7,1.5}; - int sourceConn[6]={0,3,1,0,2,3}; + mcIdType sourceConn[6]={0,3,1,0,2,3}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(2); sourceMesh->allocateCells(2); @@ -274,7 +274,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_2() { double sourceCoords[12]={-0.3,-0.3,0., 0.7,-0.3,0., -0.3,0.7,0., 0.7,0.7,0.}; - int sourceConn[6]={0,3,1,0,2,3}; + mcIdType sourceConn[6]={0,3,1,0,2,3}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(2); sourceMesh->allocateCells(2); @@ -292,7 +292,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfSourceMesh_2() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMesh_1() { double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5}; - int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -316,7 +316,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMeshPerm_1() { double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5}; - int targetConn[18]={0,3,4,1, 1,4,2, 4,2,5, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,2,5, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -337,7 +337,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMeshPerm_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSurfTargetMesh_2() { double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5}; - int targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 }; + mcIdType targetConn[24]={0,3,4, 0,4,1, 1,4,2, 4,5,2, 3,6,4, 6,7,4, 4,7,5, 7,8,5 }; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(8); @@ -362,7 +362,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DSourceMesh_1() { double sourceCoords[27]={ 0.0, 0.0, 200.0, 0.0, 0.0, 0.0, 0.0, 200.0, 200.0, 0.0, 200.0, 0.0, 200.0, 0.0, 200.0, 200.0, 0.0, 0.0, 200.0, 200.0, 200.0, 200.0, 200.0, 0.0, 100.0, 100.0, 100.0 }; - int sourceConn[48]={8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2}; + mcIdType sourceConn[48]={8,1,7,3, 6,0,8,2, 7,4,5,8, 6,8,4,7, 6,8,0,4, 6,8,7,3, 8,1,3,0, 4,1,5,8, 1,7,5,8, 0,3,8,2, 8,1,0,4, 3,6,8,2}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(3); sourceMesh->allocateCells(12); @@ -392,7 +392,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_1() double targetCoords[81]={ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. , 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. , 0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200. }; - int targetConn[64]={0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16, + mcIdType targetConn[64]={0,1,4,3,9,10,13,12, 1,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16, 9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,23,26,25}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(3); @@ -411,7 +411,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMesh_1() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshMergeNode_1() { double targetCoords[36]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,-0.3, 0.2,-0.3, 0.2,-0.3, 0.2,0.2, 0.2,0.2, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, 0.2,0.7 }; - int targetConn[18]={0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6}; + mcIdType targetConn[18]={0,9,7,5, 4,6,2, 10,11,8, 9,14,15,7, 17,16,13,6}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -434,7 +434,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DTargetMeshMergeNode_1() double targetCoords[93]={ 0., 0., 0., 50., 0., 0. , 200., 0., 0. , 0., 50., 0., 50., 50., 0. , 200., 50., 0., 0., 200., 0., 50., 200., 0. , 200., 200., 0. , 0., 0., 50., 50., 0., 50. , 200., 0., 50. , 0., 50., 50., 50., 50., 50. , 200., 50., 50., 0., 200., 50., 50., 200., 50. , 200., 200., 50. , 0., 0., 200., 50., 0., 200. , 200., 0., 200. , 0., 50., 200., 50., 50., 200. , 200., 50., 200., 0., 200., 200., 50., 200., 200. , 200., 200., 200., 50.,0.,0., 50.,0.,0., 50.,0.,0., 200., 50., 200.}; - int targetConn[64]={0,29,4,3,9,10,13,12, 28,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16, + mcIdType targetConn[64]={0,29,4,3,9,10,13,12, 28,2,5,4,10,11,14,13, 3,4,7,6,12,13,16,15, 4,5,8,7,13,14,17,16, 9,10,13,12,18,19,22,21, 10,11,14,13,19,20,23,22, 12,13,16,15,21,22,25,24, 13,14,17,16,22,30,26,25}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(3); @@ -462,7 +462,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DExtrudedUMesh_1(MEDCouplingUMesh 0.,0.,3., 1.,1.,3., 1.,1.25,3., 1.,0.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3., 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.}; - int conn[354]={ + mcIdType conn[354]={ // 0 0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17, 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21, @@ -479,7 +479,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DExtrudedUMesh_1(MEDCouplingUMesh 41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53, 37,42,44,43,52,57,59,58 }; - int conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3}; + mcIdType conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3}; // MEDCouplingUMesh *ret=MEDCouplingUMesh::New(); ret->setMeshDimension(3); @@ -559,7 +559,7 @@ void MEDCouplingBasicsTest::build3DExtrudedUMesh_2(MEDCouplingUMesh *&meshN, MED 4.2729998779296876, 0.43212001800537109, 0.14404000282287599, 4.2729998779296876, 0, 0.21606000900268554, 4.2729998779296876, 0.10803000450134277, 0.21606000900268554, 4.2729998779296876, 0.21606000900268554, 0.21606000900268554, 4.2729998779296876, 0.28808000564575198, 0.21606000900268554, 4.2729998779296876, 0.36010002136230468, 0.21606000900268554, 4.2729998779296876, 0.43212001800537109, 0.21606000900268554, 4.2729998779296876}; - const int connN[320]={ + const mcIdType connN[320]={ 0, 1, 7, 6, 30, 31, 37, 36, 1, 2, 8, 7, 31, 32, 38, 37, 2, 3, 9, 8, 32, 33, 39, 38, 3, 4, 10, 9, 33, 34, 40, 39, 4, 5, 11, 10, 34, 35, 41, 40, 6, 7, 13, 12, 36, 37, 43, 42, 7, 8, 14, 13, 37, 38, 44, 43, 8, 9, 15, 14, 38, 39, 45, 44, 9, 10, 16, 15, 39, 40, 46, 45, 10, 11, 17, 16, 40, 41, 47, 46, 12, 13, 19, 18, 42, 43, 49, 48, 13, 14, 20, 19, 43, 44, 50, 49, 14, 15, 21, 20, 44, 45, 51, 50, 15, 16, 22, 21, 45, 46, 52, 51, 16, 17, 23, @@ -617,7 +617,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMeshMerged_1() -0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, 0.7,-0.3, 1.7,-0.3, 0.7,0.7, 1.7,0.7 }; - int targetConn[24]={ + mcIdType targetConn[24]={ 0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4, 9,12,10,9,11,12 }; @@ -652,7 +652,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DCurveMesh(double dx, double dy) { 0.+dx,0.+dy, 1.+dx,0.+dy, 2.+dx,1.+dy }; - int targetConn[2*2]={1,2, 0,1}; + mcIdType targetConn[2*2]={1,2, 0,1}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("2Dcurve 1D mesh",1); targetMesh->allocateCells(2); @@ -673,7 +673,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DMesh(double dx) { 0.+dx, 1.+dx, 3.+dx, 4.+dx }; - int targetConn[2*3]={1,2, 0,1, 2,3}; + mcIdType targetConn[2*3]={1,2, 0,1, 2,3}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("1D mesh",1); targetMesh->allocateCells(3); @@ -692,7 +692,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DSourceMesh_2() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DSourceMesh",1); ret->allocateCells(4); - int conn[8]={0,1,2,3,1,2,3,4}; + mcIdType conn[8]={0,1,2,3,1,2,3,4}; for(int i=0;i<4;i++) ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i); ret->finishInsertingCells(); @@ -709,7 +709,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DTargetMesh_2() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DTargetMesh",1); ret->allocateCells(2); - int conn[4]={1,2,0,1}; + mcIdType conn[4]={1,2,0,1}; for(int i=0;i<2;i++) ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i); ret->finishInsertingCells(); @@ -726,7 +726,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DCurveSourceMesh_2() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DSourceMesh",1); ret->allocateCells(4); - int conn[8]={0,1,2,3,1,2,3,4}; + mcIdType conn[8]={0,1,2,3,1,2,3,4}; for(int i=0;i<4;i++) ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i); ret->finishInsertingCells(); @@ -743,7 +743,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DCurveTargetMesh_2() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DTargetMesh",1); ret->allocateCells(2); - int conn[4]={1,2,0,1}; + mcIdType conn[4]={1,2,0,1}; for(int i=0;i<2;i++) ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2*i); ret->finishInsertingCells(); @@ -760,7 +760,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DTargetMesh_3() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("1DMesh_3",1); ret->allocateCells(4); - int conn[10]={0,1,2, 3,4, 6,5,7 ,9,8}; + mcIdType conn[10]={0,1,2, 3,4, 6,5,7 ,9,8}; ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn); ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+3); ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+5); @@ -779,7 +779,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DCurveTargetMesh_3() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("2DCurveMesh_3",1); ret->allocateCells(4); - int conn[10]={0,1,2, 3,4, 6,5,7 ,9,8}; + mcIdType conn[10]={0,1,2, 3,4, 6,5,7 ,9,8}; ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn); ret->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+3); ret->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+5); @@ -798,7 +798,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_3() { MEDCouplingUMesh *ret=MEDCouplingUMesh::New("2DMesh_3",2); ret->allocateCells(10); - int conn[52]={ + mcIdType conn[52]={ 0,1,2, 0,1,3,4, 0,1,3,5,4, 0,1,2,6,7,8, 0,1,3,4,6,9,2,10, 0,2,1, 0,4,3,1, 0,4,5,3,1, 0,2,1,8,7,6, 0,4,3,1,10,2,9,6 }; @@ -829,7 +829,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_3() MEDCouplingUMesh *MEDCouplingBasicsTest::build2DTargetMesh_4() { double targetCoords[20]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; - int targetConn[18]={0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5}; + mcIdType targetConn[18]={0,4,5,1, 1,5,3, 5,6,2, 7,8,5,4, 8,9,6,5}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -995,7 +995,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build1DMultiTypes_1() { MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi1DMesh",1); DataArrayDouble *coo=buildCoordsForMultiTypes_1(); - const int conn[5]={0,2, 0,2,1}; + const mcIdType conn[5]={0,2, 0,2,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG3,3,conn+2); @@ -1009,7 +1009,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2DMultiTypes_1() { MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi2DMesh",2); DataArrayDouble *coo=buildCoordsForMultiTypes_1(); - const int conn[21]={3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15}; + const mcIdType conn[21]={3,4,5, 3,4,5,6,7,8, 0,9,10,11, 0,9,10,11,12,13,14,15}; mesh->allocateCells(4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI6,6,conn+3); @@ -1025,7 +1025,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3DMultiTypes_1() { MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Multi3DMesh",3); DataArrayDouble *coo=buildCoordsForMultiTypes_1(); - const int conn[81]={0,16,17,18, + const mcIdType conn[81]={0,16,17,18, 0,16,17,18,19,20,21,22,23,24, 0,11,10,9,25, 0,11,10,9,25,15,14,13,12,26,27,28,29, @@ -1124,7 +1124,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildHexa8Mesh_1() const double coords[81]={0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.5, 1.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.0, 1.0, 0.5, 0.5, 1.0, 0.5, 1.0, 1.0, 0.5, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.5, 1.0, 0.5, 0.5, 1.0, 1.0, 0.5, 1.0, 0.0, 1.0, 1.0, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0}; coo->alloc(27,3); std::copy(coords,coords+81,coo->getPointer()); - const int conn[64]={3,12,13,4,0,9,10,1, + const mcIdType conn[64]={3,12,13,4,0,9,10,1, 4,13,14,5,1,10,11,2, 6,15,16,7,3,12,13,4, 7,16,17,8,4,13,14,5, @@ -1146,7 +1146,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildPointe_1(MEDCouplingUMesh *& m1) MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("Pointe.med",3); MEDCouplingUMesh *mesh2=MEDCouplingUMesh::New("Pointe.med",2); const double coords[57]={0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 0.0, 1.0, 0.0, 2.0, 1.0, -2.0, 0.0, 1.0, 0.0, -2.0, 1.0, 1.0, 1.0, 2.0, -1.0, 1.0, 2.0, -1.0, -1.0, 2.0, 1.0, -1.0, 2.0, 1.0, 1.0, 3.0, -1.0, 1.0, 3.0, -1.0, -1.0, 3.0, 1.0, -1.0, 3.0, 1.0, 1.0, 4.0, -1.0, 1.0, 4.0, -1.0, -1.0, 4.0, 1.0, -1.0, 4.0, 0.0, 0.0, 5.0}; - const int conn[74]={0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13}; + const mcIdType conn[74]={0,1,2,5,0,1,3,2,0,1,4,3,0,1,5,4,1,6,3,2,1,7,4,3,1,8,5,4,1,9,2,5,1,6,2,9,1,7,3,6,1,8,4,7,1,9,5,8, 6,7,8,9,1,14,17,16,15,18, 10,11,12,13,6,7,8,9,14,15,16,17,10,11,12,13}; DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(19,3); std::copy(coords,coords+57,coo->getPointer()); @@ -1162,7 +1162,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildPointe_1(MEDCouplingUMesh *& m1) mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+66); mesh->finishInsertingCells(); //[1,34,29,23,41,32] - const int conn2[20]={0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9}; + const mcIdType conn2[20]={0,5,1,14,18,17,8,7,4,9,5,2, 12,8,9,13,6,7,8,9}; mesh2->allocateCells(6); for(int i=0;i<4;i++) mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn2+3*i); @@ -1174,11 +1174,11 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::buildPointe_1(MEDCouplingUMesh *& m1) return mesh; } -double MEDCouplingBasicsTest::sumAll(const std::vector< std::map >& matrix) +double MEDCouplingBasicsTest::sumAll(const std::vector< std::map >& matrix) { double ret=0.; - 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++) + 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; } @@ -1189,7 +1189,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DSourceMesh() -5., 3., -9., 0., -13., 3., -9., 8., -7., 0., -7., 8. }; - int sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8}; + mcIdType sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(1); sourceMesh->allocateCells(8); @@ -1213,7 +1213,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DSourceMesh() MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DTargetMesh() { double targetCoords[10]={-17., 0., -17.,6., -9.,6., -9.,0., -5., 3.}; - int targetConn[7]={0,1,2,3, 2,3,4}; + mcIdType targetConn[7]={0,1,2,3, 2,3,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(2); @@ -1238,7 +1238,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DSegSourceMesh(const double shi const int nbYP1 = nbY + 1; sourceMesh->allocateCells(nbY); - int sourceConn[2]; + mcIdType sourceConn[2]; for (int iY = 0; iY < nbY; ++iY) { sourceConn[0] = iY ; @@ -1273,7 +1273,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DQuadTargetMesh(const double in const int nbYP1 = nbY + 1; targetMesh->allocateCells(nbX * nbY); - int targetConn[4]; + mcIdType targetConn[4]; for (int iX = 0; iX < nbX; ++iX) { for (int iY = 0; iY < nbY; ++iY) @@ -1316,7 +1316,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DTriTargetMesh(const double inc const int nbYP1 = nbY + 1; targetMesh->allocateCells(nbX * nbY * 2); - int targetConn[3]; + mcIdType targetConn[3]; for (int iX = 0; iX < nbX; ++iX) { for (int iY = 0; iY < nbY; ++iY) @@ -1360,7 +1360,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DSourceMesh() -20., 0., 16., -18., 0., 16., -20., 2.5, 16., -25., 0., -5., 5., 0., -5., 5., 0. , 25., -25.,0.,25. }; - int sourceConn[25]={0,1,2, 3,4,5,6, 7,8,9, 10,11,12,13, 14,15,16, 3,4,8,7, 17,18,19,20}; + mcIdType sourceConn[25]={0,1,2, 3,4,5,6, 7,8,9, 10,11,12,13, 14,15,16, 3,4,8,7, 17,18,19,20}; MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New(); sourceMesh->setMeshDimension(2); sourceMesh->allocateCells(7); @@ -1388,7 +1388,7 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DTargetMesh() -20.,-5.,10., -20.,-5.,-4., -12.,-5.,-4., -12.,-5.,10., -20., 0.,-4., -12., 0.,-4. }; - int targetConn[20]={4,5,7,8, 0,3,2,1,4,7,6,5, 4,13,14,7,9,10,11,12}; + mcIdType targetConn[20]={4,5,7,8, 0,3,2,1,4,7,6,5, 4,13,14,7,9,10,11,12}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(3); targetMesh->allocateCells(3); @@ -1416,7 +1416,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DQuadSourceMesh(const double sh const int nbZP1 = nbZ + 1; sourceMesh->allocateCells(nbY * nbZ); - int sourceConn[4]; + mcIdType sourceConn[4]; for (int iY = 0; iY < nbY; ++iY) { for (int iZ = 0; iZ < nbZ; ++iZ) @@ -1462,7 +1462,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTriSourceMesh(const double shi const int nbZP1 = nbZ + 1; sourceMesh->allocateCells(nbY * nbZ * 2); - int sourceConn[3]; + mcIdType sourceConn[3]; for (int iY = 0; iY < nbY; ++iY) { for (int iZ = 0; iZ < nbZ; ++iZ) @@ -1512,7 +1512,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DHexaTargetMesh(const double in const int nbZP1 = nbZ + 1; targetMesh->allocateCells(nbX * nbY * nbZ); - int targetConn[8]; + mcIdType targetConn[8]; for (int iX = 0; iX < nbX; ++iX) { for (int iY = 0; iY < nbY; ++iY) @@ -1568,7 +1568,7 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTetraTargetMesh(const double i const int nbZP1 = nbZ + 1; targetMesh->allocateCells(nbX * nbY * nbZ * 5); - int targetConn[4]; + mcIdType targetConn[4]; for (int iX = 0; iX < nbX; ++iX) { for (int iY = 0; iY < nbY; ++iY) @@ -1627,11 +1627,11 @@ MEDCouplingUMesh* MEDCouplingBasicsTest::build3D2DTetraTargetMesh(const double i return targetMesh; } -int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map >& matrix) +int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map >& matrix) { - int ret=0.; - 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++) + int ret=0; + 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; } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 65b3a6c5e..417e6bbab 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -23,6 +23,7 @@ #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" +#include "MEDCouplingMemArray.txx" #include #include #include @@ -122,8 +123,8 @@ void MEDCouplingBasicsTest1::testArray3() void MEDCouplingBasicsTest1::testMesh() { - const int nbOfCells=6; - const int nbOfNodes=12; + const mcIdType nbOfCells=6; + const mcIdType nbOfNodes=12; double coords[3*nbOfNodes]={ 0.024155, 0.04183768725682622, -0.305, 0.04831000000000001, -1.015761910347357e-17, -0.305, 0.09662000000000001, -1.832979297858306e-18, @@ -132,10 +133,10 @@ void MEDCouplingBasicsTest1::testMesh() 0.09662000000000001, -1.832979297858306e-18, -0.2863, 0.120775, 0.04183768725682623, -0.2863, 0.09662000000000001, 0.08367537451365245, -0.2863, 0.04831000000000001, 0.08367537451365246, -0.2863, }; - int tab4[4*nbOfCells]={ + mcIdType tab4[4*nbOfCells]={ 1, 2, 8, 7, 2, 3, 9, 8, 3, 4, 10, 9, 4, 5, 11, 10, 5, 0, 6, 11, 0, 1, 7, 6, }; - CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),3); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI3),ToIdType(3)); CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI3)); CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI3)); CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI3),2); @@ -145,7 +146,7 @@ void MEDCouplingBasicsTest1::testMesh() CPPUNIT_ASSERT(MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_POLYGON)); CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_POLYGON),2); CPPUNIT_ASSERT_EQUAL(std::string(MEDCouplingMesh::GetReprOfGeometricType(INTERP_KERNEL::NORM_POLYGON)),std::string("NORM_POLYGON")); - CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),6); + CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetNumberOfNodesOfGeometricType(INTERP_KERNEL::NORM_TRI6),ToIdType(6)); CPPUNIT_ASSERT(MEDCouplingMesh::IsStaticGeometricType(INTERP_KERNEL::NORM_TRI6)); CPPUNIT_ASSERT(!MEDCouplingMesh::IsLinearGeometricType(INTERP_KERNEL::NORM_TRI6)); CPPUNIT_ASSERT_EQUAL(MEDCouplingMesh::GetDimensionOfGeometricType(INTERP_KERNEL::NORM_TRI6),2); @@ -153,19 +154,19 @@ void MEDCouplingBasicsTest1::testMesh() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(8); - const int *curConn=tab4; - for(int i=0;iinsertNextCell(INTERP_KERNEL::NORM_QUAD4,4,curConn); mesh->finishInsertingCells(); - CPPUNIT_ASSERT_EQUAL((std::size_t)30,mesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(30),mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells()); //test 0 - no copy no ownership DataArrayDouble *myCoords=DataArrayDouble::New(); myCoords->useArray(coords,false,DeallocType::CPP_DEALLOC,nbOfNodes,3); mesh->setCoords(myCoords); mesh->setCoords(myCoords); myCoords->decrRef(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells()); mesh->checkConsistencyLight(); //test 1 - no copy ownership C++ myCoords=DataArrayDouble::New(); @@ -174,7 +175,7 @@ void MEDCouplingBasicsTest1::testMesh() myCoords->useArray(tmp,true,DeallocType::CPP_DEALLOC,nbOfNodes,3); mesh->setCoords(myCoords); myCoords->decrRef(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh->getNumberOfCells()); mesh->checkConsistencyLight(); //test 2 - no copy ownership C myCoords=DataArrayDouble::New(); @@ -204,31 +205,31 @@ void MEDCouplingBasicsTest1::testMesh() MEDCouplingUMesh *mesh2=mesh->clone(false); CPPUNIT_ASSERT(mesh2!=mesh); mesh2->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh2->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh2->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh2->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh2->getSpaceDimension()); CPPUNIT_ASSERT(mesh!=mesh2); CPPUNIT_ASSERT(mesh->getCoords()==mesh2->getCoords()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.2863,mesh2->getCoords()->getIJ(11,2),1e-14); CPPUNIT_ASSERT(mesh->getNodalConnectivity()==mesh2->getNodalConnectivity()); - CPPUNIT_ASSERT_EQUAL(3,mesh2->getNodalConnectivity()->getIJ(7,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),mesh2->getNodalConnectivity()->getIJ(7,0)); CPPUNIT_ASSERT(mesh->getNodalConnectivityIndex()==mesh2->getNodalConnectivityIndex()); - CPPUNIT_ASSERT_EQUAL(15,mesh2->getNodalConnectivityIndex()->getIJ(3,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(15),mesh2->getNodalConnectivityIndex()->getIJ(3,0)); mesh2->decrRef(); // test clone not recursively MEDCouplingUMesh *mesh3=mesh->clone(true); CPPUNIT_ASSERT(mesh3!=mesh); mesh3->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)mesh3->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,mesh3->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(nbOfNodes,mesh3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh3->getSpaceDimension()); CPPUNIT_ASSERT(mesh!=mesh3); CPPUNIT_ASSERT(mesh->getCoords()!=mesh3->getCoords()); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.2863,mesh3->getCoords()->getIJ(11,2),1e-14); CPPUNIT_ASSERT(mesh->getNodalConnectivity()!=mesh3->getNodalConnectivity()); - CPPUNIT_ASSERT_EQUAL(3,mesh3->getNodalConnectivity()->getIJ(7,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),mesh3->getNodalConnectivity()->getIJ(7,0)); CPPUNIT_ASSERT(mesh->getNodalConnectivityIndex()!=mesh3->getNodalConnectivityIndex()); - CPPUNIT_ASSERT_EQUAL(15,mesh3->getNodalConnectivityIndex()->getIJ(3,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(15),mesh3->getNodalConnectivityIndex()->getIJ(3,0)); mesh3->decrRef(); //test 4 - Field on cells MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS); @@ -246,7 +247,7 @@ void MEDCouplingBasicsTest1::testMesh() MEDCouplingFieldDouble *fieldOnCells2=fieldOnCells->clone(false); CPPUNIT_ASSERT(fieldOnCells2!=fieldOnCells); fieldOnCells2->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)fieldOnCells2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)fieldOnCells2->getNumberOfComponents()); CPPUNIT_ASSERT(fieldOnCells2->getArray()==fieldOnCells->getArray()); CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,fieldOnCells2->getArray()->getIJ(3,7),1e-14); @@ -255,7 +256,7 @@ void MEDCouplingBasicsTest1::testMesh() MEDCouplingFieldDouble *fieldOnCells3=fieldOnCells->clone(true); CPPUNIT_ASSERT(fieldOnCells3!=fieldOnCells); fieldOnCells3->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(nbOfCells,(int)fieldOnCells3->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(nbOfCells,fieldOnCells3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)fieldOnCells3->getNumberOfComponents()); CPPUNIT_ASSERT(fieldOnCells3->getArray()!=fieldOnCells->getArray()); CPPUNIT_ASSERT_DOUBLES_EQUAL(7.,fieldOnCells3->getArray()->getIJ(3,7),1e-14); @@ -271,7 +272,7 @@ void MEDCouplingBasicsTest1::testMesh() void MEDCouplingBasicsTest1::testMeshPointsCloud() { double targetCoords[27]={-0.3,-0.3,0.5, 0.2,-0.3,1., 0.7,-0.3,1.5, -0.3,0.2,0.5, 0.2,0.2,1., 0.7,0.2,1.5, -0.3,0.7,0.5, 0.2,0.7,1., 0.7,0.7,1.5}; - const int targetConn[]={0,1,2,3,4,5,7,6}; + const mcIdType targetConn[]={0,1,2,3,4,5,7,6}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(0); targetMesh->allocateCells(8); @@ -294,7 +295,7 @@ void MEDCouplingBasicsTest1::testMeshPointsCloud() targetMesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(3,targetMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(8,(int)targetMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),targetMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(0,targetMesh->getMeshDimension()); // targetMesh->decrRef(); @@ -362,14 +363,14 @@ void MEDCouplingBasicsTest1::testDeepCopy() void MEDCouplingBasicsTest1::testRevNodal() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); - DataArrayInt *revNodal=DataArrayInt::New(); - DataArrayInt *revNodalIndx=DataArrayInt::New(); + DataArrayIdType *revNodal=DataArrayIdType::New(); + DataArrayIdType *revNodalIndx=DataArrayIdType::New(); // mesh->getReverseNodalConnectivity(revNodal,revNodalIndx); - const int revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4}; - const int revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18}; - CPPUNIT_ASSERT_EQUAL((std::size_t)18,revNodal->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)10,revNodalIndx->getNbOfElems()); + const mcIdType revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4}; + const mcIdType revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18}; + CPPUNIT_ASSERT_EQUAL(ToIdType(18),revNodal->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),revNodalIndx->getNbOfElems()); CPPUNIT_ASSERT(std::equal(revNodalExpected,revNodalExpected+18,revNodal->getPointer())); CPPUNIT_ASSERT(std::equal(revNodalIndexExpected,revNodalIndexExpected+10,revNodalIndx->getPointer())); // @@ -383,14 +384,14 @@ void MEDCouplingBasicsTest1::testConvertToPolyTypes() ////// 2D MEDCouplingUMesh *mesh=build2DTargetMesh_1(); // - const int elts[2]={1,3}; - std::vector eltsV(elts,elts+2); + const mcIdType elts[2]={1,3}; + std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); mesh->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(23,(int)mesh->getNodalConnectivity()->getNumberOfTuples()); - const int *pt=mesh->getNodalConnectivity()->getConstPointer(); - const int expected1[23]={4, 0, 3, 4, 1, 5, 1, 4, 2, 3, 4, 5, 2, 5, 6, 7, 4, 3, 4, 7, 8, 5, 4}; + const mcIdType *pt=mesh->getNodalConnectivity()->getConstPointer(); + const mcIdType expected1[23]={4, 0, 3, 4, 1, 5, 1, 4, 2, 3, 4, 5, 2, 5, 6, 7, 4, 3, 4, 7, 8, 5, 4}; CPPUNIT_ASSERT(std::equal(expected1,expected1+23,pt)); // mesh->decrRef(); @@ -411,32 +412,32 @@ void MEDCouplingBasicsTest1::testConvertToPolyTypes() void MEDCouplingBasicsTest1::testDescConn2D() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); - DataArrayInt *desc=DataArrayInt::New(); - DataArrayInt *descIndx=DataArrayInt::New(); - DataArrayInt *revDesc=DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc=DataArrayIdType::New(); + DataArrayIdType *descIndx=DataArrayIdType::New(); + DataArrayIdType *revDesc=DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); - const int expected1[18]={0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9}; + CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); + const mcIdType expected1[18]={0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9}; CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer())); - const int expected2[6]={0,4,7,10,14,18}; + const mcIdType expected2[6]={0,4,7,10,14,18}; CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer())); - const int expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18}; + const mcIdType expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18}; CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer())); - const int expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; + const mcIdType expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; CPPUNIT_ASSERT(std::equal(expected4,expected4+18,revDesc->getConstPointer())); - DataArrayInt *conn=mesh2->getNodalConnectivity(); - DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex(); - const int expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39}; + DataArrayIdType *conn=mesh2->getNodalConnectivity(); + DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex(); + const mcIdType expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39}; CPPUNIT_ASSERT(std::equal(expected5,expected5+14,connIndex->getConstPointer())); - const int expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5}; + const mcIdType expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5}; CPPUNIT_ASSERT(std::equal(expected6,expected6+39,conn->getConstPointer())); // desc->decrRef(); @@ -445,24 +446,24 @@ void MEDCouplingBasicsTest1::testDescConn2D() revDescIndx->decrRef(); mesh2->decrRef(); // - const int elts[2]={1,3}; - std::vector eltsV(elts,elts+2); + const mcIdType elts[2]={1,3}; + std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); mesh->checkConsistencyLight(); // - desc=DataArrayInt::New(); - descIndx=DataArrayInt::New(); - revDesc=DataArrayInt::New(); - revDescIndx=DataArrayInt::New(); + desc=DataArrayIdType::New(); + descIndx=DataArrayIdType::New(); + revDesc=DataArrayIdType::New(); + revDescIndx=DataArrayIdType::New(); // mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer())); @@ -483,29 +484,29 @@ void MEDCouplingBasicsTest1::testDescConn2D() void MEDCouplingBasicsTest1::testDescConn3D() { MEDCouplingUMesh *mesh=build3DTargetMesh_1(); - DataArrayInt *desc=DataArrayInt::New(); - DataArrayInt *descIndx=DataArrayInt::New(); - DataArrayInt *revDesc=DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc=DataArrayIdType::New(); + DataArrayIdType *descIndx=DataArrayIdType::New(); + DataArrayIdType *revDesc=DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(36,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); - const int expected1[9]={0, 6, 12, 18, 24, 30, 36, 42, 48}; - const int expected2[48]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 11, 12, 4, 13, 14, 15, 16, 17, 10, 18, 19, 13, 1, 20, 21, 22, 23, 24, 7, 25, 26, 27, 28, 22, 12, 29, 23, 30, 31, 32, 17, 33, 28, 34, 35, 30}; - const int expected3[37]={0, 1, 3, 4, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 48}; - const int expected4[48]={0, 0, 4, 0, 0, 1, 0, 2, 0, 1, 1, 5, 1, 1, 1, 3, 2, 2, 6, 2, 3, 2, 2, 3, 3, 7, 3, 3, 4, 4, 4, 5, 4, 6, 4, 5, 5, 5, 5, 7, 6, 6, 7, 6, 6, 7, 7, 7}; - const int expected5[37]={0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180}; - const int expected6[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 4, 1, 2, 5, 4, 4, 10, 13, 14, 11, 4, 1, 10, 11, 2, 4, 2, 11, 14, + CPPUNIT_ASSERT_EQUAL(ToIdType(37),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); + const mcIdType expected1[9]={0, 6, 12, 18, 24, 30, 36, 42, 48}; + const mcIdType expected2[48]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3, 11, 12, 4, 13, 14, 15, 16, 17, 10, 18, 19, 13, 1, 20, 21, 22, 23, 24, 7, 25, 26, 27, 28, 22, 12, 29, 23, 30, 31, 32, 17, 33, 28, 34, 35, 30}; + const mcIdType expected3[37]={0, 1, 3, 4, 6, 8, 9, 10, 12, 13, 14, 16, 17, 19, 21, 22, 23, 24, 26, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 48}; + const mcIdType expected4[48]={0, 0, 4, 0, 0, 1, 0, 2, 0, 1, 1, 5, 1, 1, 1, 3, 2, 2, 6, 2, 3, 2, 2, 3, 3, 7, 3, 3, 4, 4, 4, 5, 4, 6, 4, 5, 5, 5, 5, 7, 6, 6, 7, 6, 6, 7, 7, 7}; + const mcIdType expected5[37]={0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 125, 130, 135, 140, 145, 150, 155, 160, 165, 170, 175, 180}; + const mcIdType expected6[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 4, 1, 2, 5, 4, 4, 10, 13, 14, 11, 4, 1, 10, 11, 2, 4, 2, 11, 14, 5, 4, 5, 14, 13, 4, 4, 3, 4, 7, 6, 4, 12, 15, 16, 13, 4, 4, 13, 16, 7, 4, 7, 16, 15, 6, 4, 6, 15, 12, 3, 4, 4, 5, 8, 7, 4, 13, 16, 17, 14, 4, 5, 14, 17, 8, 4, 8, 17, 16, 7, 4, 18, 21, 22, 19, 4, 9, 18, 19, 10, 4, 10, 19, 22, 13, 4, 13, 22, 21, 12, 4, 12, 21, 18, 9, 4, 19, 22, 23, 20, 4, 10, 19, 20, 11, 4, 11, 20, 23, 14, 4, 14, 23, 22, 13, 4, 21, 24, 25, 22, 4, 13, 22, 25, 16, 4, 16, 25, 24, 15, 4, 15, 24, 21, 12, 4, 22, 25, 26, 23, 4, 14, 23, 26, 17, 4, 17, 26, 25, 16}; - const int expected7[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 5, 1, 2, 5, 4, 5, 10, 13, 14, 11, 5, 1, 10, 11, 2, 5, 2, 11, 14, + const mcIdType expected7[180]={4, 0, 1, 4, 3, 4, 9, 12, 13, 10, 4, 0, 9, 10, 1, 4, 1, 10, 13, 4, 4, 4, 13, 12, 3, 4, 3, 12, 9, 0, 5, 1, 2, 5, 4, 5, 10, 13, 14, 11, 5, 1, 10, 11, 2, 5, 2, 11, 14, 5, 5, 5, 14, 13, 4, 4, 3, 4, 7, 6, 4, 12, 15, 16, 13, 4, 4, 13, 16, 7, 4, 7, 16, 15, 6, 4, 6, 15, 12, 3, 5, 4, 5, 8, 7, 5, 13, 16, 17, 14, 5, 5, 14, 17, 8, 5, 8, 17, 16, 7, 4, 18, 21, 22, 19, 4, 9, 18, 19, 10, 4, 10, 19, 22, 13, 4, 13, 22, 21, 12, 4, 12, 21, 18, 9, 4, 19, 22, 23, 20, 4, 10, 19, 20, 11, 4, 11, 20, 23, 14, 4, 14, 23, 22, 13, 4, 21, 24, 25, 22, 4, 13, 22, 25, 16, 4, 16, 25, 24, 15, 4, 15, 24, 21, 12, 4, 22, 25, 26, 23, 4, 14, 23, 26, 17, 4, 17, 26, 25, 16}; @@ -523,22 +524,22 @@ void MEDCouplingBasicsTest1::testDescConn3D() revDescIndx->decrRef(); mesh2->decrRef(); // - const int elts[2]={1,3}; - std::vector eltsV(elts,elts+2); + const mcIdType elts[2]={1,3}; + std::vector eltsV(elts,elts+2); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); mesh->checkConsistencyLight(); - desc=DataArrayInt::New(); - descIndx=DataArrayInt::New(); - revDesc=DataArrayInt::New(); - revDescIndx=DataArrayInt::New(); + desc=DataArrayIdType::New(); + descIndx=DataArrayIdType::New(); + revDesc=DataArrayIdType::New(); + revDescIndx=DataArrayIdType::New(); mesh2=mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(36,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)37,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)9,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(37),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(37,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(9,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected1,expected1+9,descIndx->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+48,desc->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected3,expected3+37,revDescIndx->getConstPointer())); @@ -557,10 +558,10 @@ void MEDCouplingBasicsTest1::testDescConn3D() void MEDCouplingBasicsTest1::testFindBoundaryNodes() { MEDCouplingUMesh *mesh=build3DTargetMesh_1(); - DataArrayInt *boundaryNodes=mesh->findBoundaryNodes(); + DataArrayIdType *boundaryNodes=mesh->findBoundaryNodes(); CPPUNIT_ASSERT_EQUAL(26,(int)boundaryNodes->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)boundaryNodes->getNumberOfComponents()); - const int expected1[26]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}; + const mcIdType expected1[26]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}; CPPUNIT_ASSERT(std::equal(expected1,expected1+26,boundaryNodes->begin())); boundaryNodes->decrRef(); mesh->decrRef(); @@ -571,7 +572,7 @@ void MEDCouplingBasicsTest1::testBoundaryMesh() MEDCouplingUMesh *mesh=build3DTargetMesh_1(); MEDCouplingPointSet *mesh2=mesh->buildBoundaryMesh(false); CPPUNIT_ASSERT_EQUAL(24,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(26,mesh2->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(26,(int)mesh2->getNumberOfNodes()); mesh2->decrRef(); mesh->decrRef(); } @@ -580,8 +581,8 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); mesh->setName("Toto"); - const int tab1[2]={0,4}; - const int tab2[3]={0,2,3}; + const mcIdType tab1[2]={0,4}; + const mcIdType tab2[3]={0,2,3}; // MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelf(tab1,tab1+2,true); MEDCouplingUMesh *subMesh=dynamic_cast(subMeshSimple); @@ -595,10 +596,10 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf() CPPUNIT_ASSERT(name=="Toto"); CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords()); CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells()); - const int subConn[10]={4,0,3,4,1,4,7,8,5,4}; - const int subConnIndex[3]={0,5,10}; - CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType subConn[10]={4,0,3,4,1,4,7,8,5,4}; + const mcIdType subConnIndex[3]={0,5,10}; + CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer())); subMesh->decrRef(); @@ -613,13 +614,13 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf() CPPUNIT_ASSERT(name=="Toto"); CPPUNIT_ASSERT(mesh->getCoords()==subMesh->getCoords()); CPPUNIT_ASSERT_EQUAL(3,(int)subMesh->getNumberOfCells()); - const int subConn2[14]={4,0,3,4,1,3,4,5,2,4,6,7,4,3}; - const int subConnIndex2[4]={0,5,9,14}; - CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType subConn2[14]={4,0,3,4,1,3,4,5,2,4,6,7,4,3}; + const mcIdType subConnIndex2[4]={0,5,9,14}; + CPPUNIT_ASSERT_EQUAL(ToIdType(14),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),subMesh->getNodalConnectivityIndex()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex2,subConnIndex2+4,subMesh->getNodalConnectivityIndex()->getPointer())); - const int tab3[3]={0,1,2}; + const mcIdType tab3[3]={0,1,2}; MEDCouplingPointSet *subMeshSimple2=subMeshSimple->buildPartOfMySelf(tab3,tab3+3,true); subMesh->decrRef(); name=subMeshSimple2->getName(); @@ -632,17 +633,17 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelf() void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); - const int tab1[4]={5,7,8,4}; + const mcIdType tab1[4]={5,7,8,4}; MEDCouplingPointSet *subMeshSimple=mesh->buildPartOfMySelfNode(tab1,tab1+4,true); 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()); CPPUNIT_ASSERT_EQUAL(1,(int)subMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)5,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,subMesh->getNodalConnectivityIndex()->getNbOfElems()); - const int subConn[5]={4,7,8,5,4}; - const int subConnIndex[3]={0,5}; + CPPUNIT_ASSERT_EQUAL(ToIdType(5),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),subMesh->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType subConn[5]={4,7,8,5,4}; + const mcIdType subConnIndex[3]={0,5}; CPPUNIT_ASSERT(std::equal(subConn,subConn+5,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+2,subMesh->getNodalConnectivityIndex()->getPointer())); CPPUNIT_ASSERT(subMesh->getCoords()==mesh->getCoords()); @@ -655,16 +656,16 @@ void MEDCouplingBasicsTest1::testBuildPartOfMySelfNode() CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,*subMesh->getAllGeoTypes().begin()); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*(++subMesh->getAllGeoTypes().begin())); CPPUNIT_ASSERT_EQUAL(3,(int)subMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)14,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,subMesh->getNodalConnectivityIndex()->getNbOfElems()); - const int subConn2[14]={3,4,5,2,4,6,7,4,3,4,7,8,5,4}; - const int subConnIndex2[4]={0,4,9,14}; + CPPUNIT_ASSERT_EQUAL(ToIdType(14),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),subMesh->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType subConn2[14]={3,4,5,2,4,6,7,4,3,4,7,8,5,4}; + const mcIdType subConnIndex2[4]={0,4,9,14}; CPPUNIT_ASSERT(std::equal(subConn2,subConn2+14,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex2,subConnIndex2+4,subMesh->getNodalConnectivityIndex()->getPointer())); CPPUNIT_ASSERT(subMesh->getCoords()==mesh->getCoords()); subMeshSimple->decrRef(); //testing the case where length of tab2 is greater than max number of node per cell. - const int tab2[7]={0,3,2,1,4,5,6}; + const mcIdType tab2[7]={0,3,2,1,4,5,6}; subMeshSimple=mesh->buildPartOfMySelfNode(tab2,tab2+7,true); subMesh=dynamic_cast(subMeshSimple); CPPUNIT_ASSERT(subMesh); @@ -682,10 +683,10 @@ void MEDCouplingBasicsTest1::testZipCoords() MEDCouplingUMesh *mesh=build2DTargetMesh_1(); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(9,(int)mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells()); - std::vector oldConn(mesh->getNodalConnectivity()->getNbOfElems()); - std::vector oldConnIndex(mesh->getNumberOfCells()+1); + std::vector oldConn(mesh->getNodalConnectivity()->getNbOfElems()); + std::vector oldConnIndex(mesh->getNumberOfCells()+1); std::copy(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+oldConn.size(),oldConn.begin()); std::copy(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+mesh->getNumberOfCells()+1,oldConnIndex.begin()); DataArrayDouble *oldCoords=mesh->getCoords(); @@ -693,7 +694,7 @@ void MEDCouplingBasicsTest1::testZipCoords() mesh->zipCoords(); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(9,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(9,(int)mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(5,(int)mesh->getNumberOfCells()); CPPUNIT_ASSERT(mesh->getCoords()!=oldCoords); CPPUNIT_ASSERT(std::equal(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+2*9,oldCoords->getPointer())); @@ -701,21 +702,21 @@ void MEDCouplingBasicsTest1::testZipCoords() CPPUNIT_ASSERT(std::equal(oldConnIndex.begin(),oldConnIndex.end(),mesh->getNodalConnectivityIndex()->getPointer())); oldCoords->decrRef(); // - const int tab1[2]={0,4}; + const mcIdType tab1[2]={0,4}; MEDCouplingPointSet *subMeshPtSet=mesh->buildPartOfMySelf(tab1,tab1+2,true); MEDCouplingUMesh *subMesh=dynamic_cast(subMeshPtSet); CPPUNIT_ASSERT(subMesh); - DataArrayInt *traducer=subMesh->zipCoordsTraducer(); - const int expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6}; + DataArrayIdType *traducer=subMesh->zipCoordsTraducer(); + const mcIdType expectedTraducer[9]={0,1,-1,2,3,4,-1,5,6}; CPPUNIT_ASSERT(std::equal(expectedTraducer,expectedTraducer+9,traducer->getPointer())); traducer->decrRef(); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin()); CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells()); - const int subConn[10]={4,0,2,3,1,4,5,6,4,3}; - const int subConnIndex[3]={0,5,10}; - CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType subConn[10]={4,0,2,3,1,4,5,6,4,3}; + const mcIdType subConnIndex[3]={0,5,10}; + CPPUNIT_ASSERT_EQUAL(7,(int)subMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer())); subMesh->decrRef(); @@ -725,9 +726,9 @@ void MEDCouplingBasicsTest1::testZipCoords() CPPUNIT_ASSERT(subMesh); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,*subMesh->getAllGeoTypes().begin()); CPPUNIT_ASSERT_EQUAL(2,(int)subMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(7,subMesh->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL((std::size_t)10,subMesh->getNodalConnectivity()->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,subMesh->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(7,(int)subMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),subMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),subMesh->getNodalConnectivityIndex()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(subConn,subConn+10,subMesh->getNodalConnectivity()->getPointer())); CPPUNIT_ASSERT(std::equal(subConnIndex,subConnIndex+3,subMesh->getNodalConnectivityIndex()->getPointer())); subMesh->decrRef(); @@ -739,7 +740,7 @@ void MEDCouplingBasicsTest1::testZipConnectivity() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); MEDCouplingUMesh *m2=build2DTargetMesh_1(); - int cells1[3]={2,3,4}; + mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); @@ -753,15 +754,15 @@ void MEDCouplingBasicsTest1::testZipConnectivity() m5->decrRef(); // bool areNodesMerged; - int newNbOfNodes; + mcIdType newNbOfNodes; CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes()); - DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(22,(int)m6->getNumberOfNodes()); + DataArrayIdType *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes); arr->decrRef(); CPPUNIT_ASSERT(areNodesMerged); CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(9,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(9,(int)m6->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(9,(int)newNbOfNodes); // arr=m6->zipConnectivityTraducer(0); CPPUNIT_ASSERT_EQUAL(7,(int)m6->getNumberOfCells()); @@ -794,7 +795,7 @@ void MEDCouplingBasicsTest1::testEqualMesh() CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh2->isEqual(mesh1,1e-12)); // - int *pt2=mesh1->getNodalConnectivity()->getPointer(); + mcIdType *pt2=mesh1->getNodalConnectivity()->getPointer(); pt2[5]++; CPPUNIT_ASSERT(!mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(!mesh2->isEqual(mesh1,1e-12)); @@ -941,14 +942,14 @@ void MEDCouplingBasicsTest1::testBuildSubMeshData() //check buildSubMesh on field on cells MEDCouplingFieldDouble *fieldCells=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); fieldCells->setMesh(targetMesh); - const int elts[3]={1,2,4}; - DataArrayInt *di; + const mcIdType elts[3]={1,2,4}; + DataArrayIdType *di; MEDCouplingMesh *ret1=fieldCells->buildSubMeshData(elts,elts+3,di); CPPUNIT_ASSERT_EQUAL(3,(int)ret1->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(9,ret1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(9,(int)ret1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)di->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents()); - const int *toCheck=di->getConstPointer(); + const mcIdType *toCheck=di->getConstPointer(); CPPUNIT_ASSERT(std::equal(elts,elts+3,toCheck)); MEDCouplingUMesh *ret1DC=dynamic_cast(ret1); CPPUNIT_ASSERT(ret1DC); @@ -962,11 +963,11 @@ void MEDCouplingBasicsTest1::testBuildSubMeshData() MEDCouplingUMesh *ret2DC=dynamic_cast(ret2); CPPUNIT_ASSERT(ret2DC); CPPUNIT_ASSERT_EQUAL(3,(int)ret2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(6,ret2->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(6,(int)ret2->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(6,(int)di->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)di->getNumberOfComponents()); toCheck=di->getConstPointer(); - const int expected[6]={1,2,4,5,7,8}; + const mcIdType expected[6]={1,2,4,5,7,8}; CPPUNIT_ASSERT(std::equal(expected,expected+6,toCheck)); ret2->decrRef(); di->decrRef(); @@ -980,24 +981,24 @@ void MEDCouplingBasicsTest1::testExtrudedMesh1() MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); MEDCouplingMappedExtrudedMesh *ext=MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,1); CPPUNIT_ASSERT_EQUAL(18,(int)ext->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(60,ext->getNumberOfNodes()); - DataArrayInt *ids3D=ext->getMesh3DIds(); - const int ids3DExpected[18]={5,4,3,2,1,0, 11,10,9,8,7,6, 17,16,15,14,13,12}; + CPPUNIT_ASSERT_EQUAL(60,(int)ext->getNumberOfNodes()); + DataArrayIdType *ids3D=ext->getMesh3DIds(); + const mcIdType ids3DExpected[18]={5,4,3,2,1,0, 11,10,9,8,7,6, 17,16,15,14,13,12}; CPPUNIT_ASSERT_EQUAL(18,(int)ids3D->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)ids3D->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(ids3DExpected,ids3DExpected+18,ids3D->getConstPointer())); MEDCouplingUMesh *mesh1D=ext->getMesh1D(); - CPPUNIT_ASSERT_EQUAL(4,mesh1D->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)mesh1D->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh1D->getNumberOfCells()); const double mesh1DExpected[12]={0.66666666666666663, 1.4583333333333333, 0, 0.66666666666666663, 1.4583333333333333, 1, 0.66666666666666663, 1.4583333333333333, 2, 0.66666666666666663, 1.4583333333333333, 3}; DataArrayDouble *mesh1DCoords=mesh1D->getCoords(); CPPUNIT_ASSERT_EQUAL(4,(int)mesh1DCoords->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh1DCoords->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(mesh1DExpected,mesh1DExpected+12,mesh1DCoords->getConstPointer())); - DataArrayInt *conn1D=mesh1D->getNodalConnectivity(); + DataArrayIdType *conn1D=mesh1D->getNodalConnectivity(); CPPUNIT_ASSERT_EQUAL(9,(int)conn1D->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)conn1D->getNumberOfComponents()); - const int conn1DExpected[9]={1,0,1,1,1,2,1,2,3}; + const mcIdType conn1DExpected[9]={1,0,1,1,1,2,1,2,3}; CPPUNIT_ASSERT(std::equal(conn1DExpected,conn1DExpected+9,conn1D->getConstPointer())); ext->decrRef(); mesh3D->decrRef(); @@ -1010,11 +1011,11 @@ void MEDCouplingBasicsTest1::testExtrudedMesh2() build3DExtrudedUMesh_2(mN,mTT,mTF); // bool b=false; - int newNbOfNodes; - DataArrayInt *da=mTT->mergeNodes(1e-12,b,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *da=mTT->mergeNodes(1e-12,b,newNbOfNodes); CPPUNIT_ASSERT(b); da->decrRef(); - std::vector n; + std::vector n; double pt[3]={300.,300.,0.}; double v[3]={0.,0.,2.}; mTT->findNodesOnPlane(pt,v,1e-12,n); @@ -1081,12 +1082,12 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(5,(int)m4->getMesh2D()->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,(int)m4->getMesh1D()->getNumberOfCells()); - const int *m3DIds=m4->getMesh3DIds()->getConstPointer(); - for(int i=0;i<15;i++) + const mcIdType *m3DIds=m4->getMesh3DIds()->getConstPointer(); + for(mcIdType i=0;i<15;i++) CPPUNIT_ASSERT_EQUAL(i,m3DIds[i]); m4->decrRef(); //some random in cells to check that extrusion alg find it correctly - const int expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; + const mcIdType expected1[15]={1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; m3->renumberCells(expected1,false); m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells()); @@ -1098,7 +1099,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() m4->decrRef(); m3->decrRef(); //play with polygons and polyedrons - std::vector cells(2); cells[0]=2; cells[1]=3; + std::vector cells(2); cells[0]=2; cells[1]=3; m1->convertToPolyTypes(&cells[0],&cells[0]+cells.size()); m3=m1->buildExtrudedMesh(m2,0); CPPUNIT_ASSERT_EQUAL((int)INTERP_KERNEL::NORM_HEXA8,(int)m3->getTypeOfCell(0)); @@ -1128,7 +1129,7 @@ void MEDCouplingBasicsTest1::testExtrudedMesh3() void MEDCouplingBasicsTest1::testExtrudedMesh4() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - std::vector cells(2); cells[0]=2; cells[1]=4; + std::vector cells(2); cells[0]=2; cells[1]=4; m1->convertToPolyTypes(&cells[0],&cells[0]+cells.size()); m1->changeSpaceDimension(3); MEDCouplingUMesh *m2=buildCU1DMesh_U(); @@ -1138,8 +1139,8 @@ void MEDCouplingBasicsTest1::testExtrudedMesh4() m2->rotate(center,vector,-M_PI/2.); m1->zipCoords(); MEDCouplingUMesh *m3=m1->buildExtrudedMesh(m2,0); - const int expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; - const int rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12}; + const mcIdType expected1[15]= {1,3,2,0,6,5,7,10,11,8,12,9,14,13,4}; + const mcIdType rexpected1[15]={3, 0, 2, 1, 14, 5, 4, 6, 9, 11, 7, 8, 10, 13, 12}; m3->renumberCells(expected1,false); MEDCouplingMappedExtrudedMesh *m4=MEDCouplingMappedExtrudedMesh::New(m3,m1,0); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,m4->getTypeOfCell(0)); @@ -1174,16 +1175,16 @@ void MEDCouplingBasicsTest1::testExtrudedMesh4() void MEDCouplingBasicsTest1::testFindCommonNodes() { - DataArrayInt *comm,*commI; + DataArrayIdType *comm,*commI; MEDCouplingUMesh *targetMesh=build3DTargetMesh_1(); targetMesh->findCommonNodes(1e-10,-1,comm,commI); CPPUNIT_ASSERT_EQUAL(1,(int)commI->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(0,(int)comm->getNumberOfTuples()); - int newNbOfNodes; - DataArrayInt *o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(27,(int)newNbOfNodes); CPPUNIT_ASSERT_EQUAL(27,(int)o2n->getNumberOfTuples()); - const int o2nExp1[27]= + const mcIdType o2nExp1[27]= { 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 @@ -1195,18 +1196,18 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() targetMesh->decrRef(); // targetMesh=build3DTargetMeshMergeNode_1(); - CPPUNIT_ASSERT_EQUAL(31,targetMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(31,(int)targetMesh->getNumberOfNodes()); targetMesh->findCommonNodes(1e-10,-1,comm,commI); CPPUNIT_ASSERT_EQUAL(3,(int)commI->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(6,(int)comm->getNumberOfTuples()); - const int commExpected[6]={1,27,28,29,23,30}; - const int commIExpected[3]={0,4,6}; + const mcIdType commExpected[6]={1,27,28,29,23,30}; + const mcIdType commIExpected[3]={0,4,6}; CPPUNIT_ASSERT(std::equal(commExpected,commExpected+6,comm->getConstPointer())); CPPUNIT_ASSERT(std::equal(commIExpected,commIExpected+3,commI->getConstPointer())); o2n=targetMesh->buildNewNumberingFromCommonNodesFormat(comm,commI,newNbOfNodes); CPPUNIT_ASSERT_EQUAL(31,(int)o2n->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(27,newNbOfNodes); - const int o2nExp2[31]= + CPPUNIT_ASSERT_EQUAL(27,(int)newNbOfNodes); + const mcIdType o2nExp2[31]= { 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,1,1,1,23 @@ -1219,7 +1220,7 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() // targetMesh=build3DTargetMesh_1(); bool areNodesMerged; - unsigned int time=targetMesh->getTimeOfThis(); + std::size_t time=targetMesh->getTimeOfThis(); o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes); targetMesh->updateTime(); CPPUNIT_ASSERT(time==targetMesh->getTimeOfThis()); @@ -1233,7 +1234,7 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() targetMesh->updateTime(); CPPUNIT_ASSERT(time!=targetMesh->getTimeOfThis()); CPPUNIT_ASSERT(areNodesMerged); - int connExp[72]={18,0,1,4,3,9,10,13,12, 18,1,2,5,4,10,11,14,13, 18,3,4,7,6,12,13,16,15, + mcIdType connExp[72]={18,0,1,4,3,9,10,13,12, 18,1,2,5,4,10,11,14,13, 18,3,4,7,6,12,13,16,15, 18,4,5,8,7,13,14,17,16, 18,9,10,13,12,18,19,22,21, 18,10,11,14,13,19,20,23,22, 18,12,13,16,15,21,22,25,24, 18,13,14,17,16,22,23,26,25}; @@ -1252,13 +1253,13 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() o2n->decrRef(); //2D targetMesh=build2DTargetMeshMergeNode_1(); - CPPUNIT_ASSERT_EQUAL(18,targetMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(18,(int)targetMesh->getNumberOfNodes()); time=targetMesh->getTimeOfThis(); o2n=targetMesh->mergeNodes(1e-10,areNodesMerged,newNbOfNodes); CPPUNIT_ASSERT(time!=targetMesh->getTimeOfThis()); CPPUNIT_ASSERT(areNodesMerged); - CPPUNIT_ASSERT_EQUAL(9,targetMesh->getNumberOfNodes()); - int connExp2[23]={4,0,4,3,1, 3,1,3,2, 3,3,5,2, 4,4,6,7,3, 4,7,8,5,3}; + CPPUNIT_ASSERT_EQUAL(9,(int)targetMesh->getNumberOfNodes()); + mcIdType connExp2[23]={4,0,4,3,1, 3,1,3,2, 3,3,5,2, 4,4,6,7,3, 4,7,8,5,3}; CPPUNIT_ASSERT_EQUAL(23,(int)targetMesh->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(connExp2,connExp2+23,targetMesh->getNodalConnectivity()->getConstPointer())); double coordsExp2[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, 0.2,0.2, -0.3,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7}; @@ -1270,15 +1271,15 @@ void MEDCouplingBasicsTest1::testFindCommonNodes() void MEDCouplingBasicsTest1::testCheckButterflyCells() { - std::vector cells; + std::vector cells; MEDCouplingUMesh *sourceMesh=build2DTargetMesh_1(); sourceMesh->checkButterflyCells(cells); CPPUNIT_ASSERT(cells.empty()); - int *pt=sourceMesh->getNodalConnectivity()->getPointer(); + mcIdType *pt=sourceMesh->getNodalConnectivity()->getPointer(); std::swap(pt[15],pt[16]); sourceMesh->checkButterflyCells(cells); CPPUNIT_ASSERT_EQUAL(1,(int)cells.size()); - CPPUNIT_ASSERT_EQUAL(3,cells[0]); + CPPUNIT_ASSERT_EQUAL(3,(int)cells[0]); cells.clear(); std::swap(pt[15],pt[16]); sourceMesh->checkButterflyCells(cells); @@ -1292,7 +1293,7 @@ void MEDCouplingBasicsTest1::testCheckButterflyCells() std::swap(pt[15],pt[16]); sourceMesh->checkButterflyCells(cells); CPPUNIT_ASSERT_EQUAL(1,(int)cells.size()); - CPPUNIT_ASSERT_EQUAL(3,cells[0]); + CPPUNIT_ASSERT_EQUAL(3,(int)cells[0]); cells.clear(); std::swap(pt[15],pt[16]); sourceMesh->checkButterflyCells(cells); @@ -1314,10 +1315,10 @@ void MEDCouplingBasicsTest1::testMergeMesh1() CPPUNIT_ASSERT(m3->isEqual(m4,1.e-12)); m4->decrRef(); bool isMerged; - int newNbOfNodes; - DataArrayInt *da=m3C->mergeNodes(1.e-12,isMerged,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(11,m3C->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(11,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *da=m3C->mergeNodes(1.e-12,isMerged,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(11,(int)m3C->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(11,(int)newNbOfNodes); CPPUNIT_ASSERT(isMerged); da->decrRef(); m3->decrRef(); @@ -1329,7 +1330,7 @@ void MEDCouplingBasicsTest1::testMergeMeshOnSameCoords1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); MEDCouplingUMesh *m2=build2DTargetMesh_1(); - std::vector cells(5); + std::vector cells(5); for(int i=0;i<5;i++) cells[i]=i; m2->convertToPolyTypes(&cells[0],&cells[0]+cells.size()); @@ -1342,15 +1343,15 @@ void MEDCouplingBasicsTest1::testMergeMeshOnSameCoords1() m4->checkConsistencyLight(); CPPUNIT_ASSERT(m4->getCoords()==m1->getCoords()); CPPUNIT_ASSERT_EQUAL(15,(int)m4->getNumberOfCells()); - const int cells1[5]={0,1,2,3,4}; + const mcIdType cells1[5]={0,1,2,3,4}; MEDCouplingPointSet *m1_1=m4->buildPartOfMySelf(cells1,cells1+5,true); m1_1->setName(m1->getName().c_str()); CPPUNIT_ASSERT(m1->isEqual(m1_1,1e-12)); - const int cells2[5]={5,6,7,8,9}; + const mcIdType cells2[5]={5,6,7,8,9}; MEDCouplingPointSet *m2_1=m4->buildPartOfMySelf(cells2,cells2+5,true); m2_1->setName(m2->getName().c_str()); CPPUNIT_ASSERT(m2->isEqual(m2_1,1e-12)); - const int cells3[5]={10,11,12,13,14}; + const mcIdType cells3[5]={10,11,12,13,14}; MEDCouplingPointSet *m3_1=m4->buildPartOfMySelf(cells3,cells3+5,true); m3_1->setName(m3->getName().c_str()); CPPUNIT_ASSERT(m3->isEqual(m3_1,1e-12)); @@ -1818,7 +1819,7 @@ void MEDCouplingBasicsTest1::testOperationsOnFields3() void MEDCouplingBasicsTest1::testOperationsOnFields4() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - int 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(); @@ -1953,19 +1954,19 @@ void MEDCouplingBasicsTest1::testCheckConsecutiveCellTypes() CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypes()); CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order1,order1+2)); CPPUNIT_ASSERT(!targetMesh->checkConsecutiveCellTypesAndOrder(order2,order2+2)); - DataArrayInt *da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order1,order1+2); + DataArrayIdType *da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order1,order1+2); CPPUNIT_ASSERT_EQUAL(5,(int)da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); - const int expected1[5]={2,0,1,3,4}; + const mcIdType expected1[5]={2,0,1,3,4}; CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer())); da->decrRef(); da=targetMesh->getRenumArrForConsecutiveCellTypesSpec(order2,order2+2); CPPUNIT_ASSERT_EQUAL(5,(int)da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); - const int expected2[5]={0,3,4,1,2}; + const mcIdType expected2[5]={0,3,4,1,2}; CPPUNIT_ASSERT(std::equal(expected2,expected2+5,da->getConstPointer())); da->decrRef(); - const int renumber1[5]={4,0,1,2,3}; + const mcIdType renumber1[5]={4,0,1,2,3}; targetMesh->renumberCells(renumber1,false); CPPUNIT_ASSERT(targetMesh->checkConsecutiveCellTypes()); CPPUNIT_ASSERT(targetMesh->checkConsecutiveCellTypesAndOrder(order1,order1+2)); @@ -1978,15 +1979,15 @@ void MEDCouplingBasicsTest1::testRearrange2ConsecutiveCellTypes() { MEDCouplingUMesh *m1_1=build2DSourceMesh_1(); MEDCouplingUMesh *m2_1=build2DTargetMesh_1(); - DataArrayInt *arr1=m1_1->rearrange2ConsecutiveCellTypes(); + DataArrayIdType *arr1=m1_1->rearrange2ConsecutiveCellTypes(); MEDCouplingUMesh *m1_2=build2DSourceMesh_1(); CPPUNIT_ASSERT(m1_2->isEqual(m1_1,1e-12)); - const int expected1[2]={0,1}; + const mcIdType expected1[2]={0,1}; CPPUNIT_ASSERT_EQUAL(2,(int)arr1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected1,expected1+2,arr1->getConstPointer())); arr1->decrRef(); - const int expected2[5]={0,3,4,1,2}; + const mcIdType expected2[5]={0,3,4,1,2}; arr1=m2_1->rearrange2ConsecutiveCellTypes(); CPPUNIT_ASSERT_EQUAL(5,(int)arr1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents()); @@ -2024,55 +2025,55 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords() { std::vector meshes; MEDCouplingUMesh *m2=build2DTargetMesh_1(); - int cells1[3]={2,3,4}; + mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); meshes.push_back(m3); - int cells2[3]={1,2,4}; + mcIdType cells2[3]={1,2,4}; MEDCouplingPointSet *m4_1=m2->buildPartOfMySelf(cells2,cells2+3,true); MEDCouplingUMesh *m4=dynamic_cast(m4_1); CPPUNIT_ASSERT(m4); meshes.push_back(m4); - int cells3[2]={1,2}; + mcIdType cells3[2]={1,2}; MEDCouplingPointSet *m5_1=m2->buildPartOfMySelf(cells3,cells3+2,true); MEDCouplingUMesh *m5=dynamic_cast(m5_1); CPPUNIT_ASSERT(m5); meshes.push_back(m5); m2->decrRef(); // - std::vector corr; + std::vector corr; MEDCouplingUMesh *m7=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(4,(int)m7->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,(int)corr.size()); - const int expectedVals1[3]={3,3,2}; - const int expectedVals2[3][3]={{0,1,2},{3,0,2},{3,0,111111}}; + const mcIdType expectedVals1[3]={3,3,2}; + const mcIdType expectedVals2[3][3]={{0,1,2},{3,0,2},{3,0,111111}}; for(int i=0;i<3;i++) { - DataArrayInt *arr=corr[i]; + DataArrayIdType *arr=corr[i]; CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents()); - int nbOfVals=expectedVals1[i]; - CPPUNIT_ASSERT_EQUAL(nbOfVals,(int)arr->getNumberOfTuples()); - const int *vals=arr->getConstPointer(); - for(int j=0;jgetNumberOfTuples()); + const mcIdType *vals=arr->getConstPointer(); + for(mcIdType j=0;j > fidsOfGroups; - std::vector corr2(corr.begin(),corr.end()); - DataArrayInt *arr2=DataArrayInt::MakePartition(corr2,m7->getNumberOfCells(),fidsOfGroups); - const int fidExp[4]={5,1,3,4}; - const int fidsGrp[3][3]={{1,3,5},{3,4,5},{4,5,23344}}; + std::vector< std::vector > fidsOfGroups; + 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}}; CPPUNIT_ASSERT_EQUAL(3,(int)fidsOfGroups.size()); CPPUNIT_ASSERT_EQUAL(1,(int)arr2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(4,(int)arr2->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(fidExp,fidExp+4,arr2->getConstPointer())); for(int i=0;i<3;i++) { - int nbOfVals=expectedVals1[i]; - CPPUNIT_ASSERT_EQUAL(nbOfVals,(int)fidsOfGroups[i].size()); + 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(std::vector::iterator iter=corr.begin();iter!=corr.end();iter++) + for(std::vector::iterator iter=corr.begin();iter!=corr.end();iter++) (*iter)->decrRef(); arr2->decrRef(); m7->decrRef(); @@ -2087,21 +2088,21 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords2() MEDCouplingUMesh *m2; MEDCouplingUMesh *m1=build3DExtrudedUMesh_1(m2); m2->decrRef(); - const int part1[5]={2,3,6,4,10}; + const mcIdType part1[5]={2,3,6,4,10}; MEDCouplingUMesh *m3=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part1,part1+5,true); - const int part2[4]={5,6,4,7}; + const mcIdType part2[4]={5,6,4,7}; MEDCouplingUMesh *m4=(MEDCouplingUMesh *)m1->buildPartOfMySelf(part2,part2+4,true); std::vector meshes; meshes.push_back(m1); meshes.push_back(m3); meshes.push_back(m3); meshes.push_back(m4); - std::vector corr; + std::vector corr; MEDCouplingUMesh *m5=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(18,(int)m5->getNumberOfCells()); - std::vector::iterator it=corr.begin(); - const int exp1[4]={18,5,5,4}; - const int exp2[4][18]={ + 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}, {2,3,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, {2,3,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, @@ -2110,7 +2111,7 @@ void MEDCouplingBasicsTest1::testFuseUMeshesOnSameCoords2() int i=0; for(;it!=corr.end();it++,i++) { - int sz=(*it)->getNumberOfTuples(); + mcIdType sz=(*it)->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(exp1[i],sz); CPPUNIT_ASSERT(std::equal(exp2[i],exp2[i]+sz,(*it)->getConstPointer())); } @@ -2136,7 +2137,7 @@ void MEDCouplingBasicsTest1::testBuildOrthogonalField() targetMesh->decrRef(); // testing double targetCoords[12]={0.,0.,0.,0.5,0.,0.5,1.,0.,1.,0.,1.,0.}; - int targetConn[4]={0,1,2,3}; + mcIdType targetConn[4]={0,1,2,3}; targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(1); @@ -2162,13 +2163,13 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint() { MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); double pos[12]={0.,0.,0.4,0.4,0.,0.4,0.1,0.1,0.25,0.,0.65,0.}; - MCAuto t1,t2; + MCAuto t1,t2; //2D basic targetMesh->getCellsContainingPoints(pos,6,1e-12,t1,t2); CPPUNIT_ASSERT_EQUAL(6,(int)t1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(7,(int)t2->getNbOfElems()); - const int expectedValues1[6]={0,4,3,0,1,2}; - const int expectedValues2[7]={0,1,2,3,4,5,6}; + const mcIdType expectedValues1[6]={0,4,3,0,1,2}; + const mcIdType expectedValues2[7]={0,1,2,3,4,5,6}; CPPUNIT_ASSERT(std::equal(t1->begin(),t1->end(),expectedValues1)); CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2)); //2D with no help of bounding box. @@ -2182,50 +2183,50 @@ void MEDCouplingBasicsTest1::testGetCellsContainingPoint() CPPUNIT_ASSERT(std::equal(t2->begin(),t2->end(),expectedValues2)); //2D outside const double pos1bis[2]={-0.3303300858899107,-0.11819805153394641}; - CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos1bis,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos1bis,1e-12)); targetMesh->decrRef(); //test limits 2D targetMesh=build2DTargetMesh_1(); const double pos2[2]={0.2,-0.05}; - std::vector t11; + std::vector t11; t11.clear(); targetMesh->getCellsContainingPoint(pos2,1e-12,t11); CPPUNIT_ASSERT_EQUAL(2,(int)t11.size()); - const int expectedValues3[2]={0,1}; + const mcIdType expectedValues3[2]={0,1}; CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues3)); const double pos3[2]={0.2,0.2}; t11.clear(); targetMesh->getCellsContainingPoint(pos3,1e-12,t11); CPPUNIT_ASSERT_EQUAL(5,(int)t11.size()); - const int expectedValues4[5]={0,1,2,3,4}; + const mcIdType expectedValues4[5]={0,1,2,3,4}; CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues4)); - CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos3,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),targetMesh->getCellContainingPoint(pos3,1e-12)); targetMesh->decrRef(); //3D targetMesh=build3DTargetMesh_1(); const double pos4[3]={25.,25.,25.}; - CPPUNIT_ASSERT_EQUAL(0,targetMesh->getCellContainingPoint(pos4,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),targetMesh->getCellContainingPoint(pos4,1e-12)); const double pos5[3]={50.,50.,50.}; t11.clear(); targetMesh->getCellsContainingPoint(pos5,1e-12,t11); CPPUNIT_ASSERT_EQUAL(8,(int)t11.size()); - const int expectedValues5[8]={0,1,2,3,4,5,6,7}; + const mcIdType expectedValues5[8]={0,1,2,3,4,5,6,7}; CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues5)); const double pos6[3]={0., 50., 0.}; t11.clear(); targetMesh->getCellsContainingPoint(pos6,1e-12,t11); CPPUNIT_ASSERT_EQUAL(2,(int)t11.size()); - const int expectedValues6[2]={0,2}; + const mcIdType expectedValues6[2]={0,2}; CPPUNIT_ASSERT(std::equal(t11.begin(),t11.end(),expectedValues6)); //3D outside const double pos7[3]={-1.0,-1.0,0.}; - CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos7,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos7,1e-12)); //3D outside 2 const double center2[3]={0.,0.,0.}; const double vec2[3]={0.,-1.,0.}; targetMesh->rotate(center2,vec2,0.78539816339744830962); const double pos8[3]={-25,25.,12.}; - CPPUNIT_ASSERT_EQUAL(-1,targetMesh->getCellContainingPoint(pos8,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),targetMesh->getCellContainingPoint(pos8,1e-12)); // targetMesh->decrRef(); } @@ -2234,13 +2235,13 @@ void MEDCouplingBasicsTest1::testGetValueOn1() { MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); MEDCouplingFieldDouble *fieldOnCells=MEDCouplingFieldDouble::New(ON_CELLS); - int nbOfCells=targetMesh->getNumberOfCells(); + std::size_t nbOfCells=targetMesh->getNumberOfCells(); fieldOnCells->setMesh(targetMesh); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(nbOfCells,2); fieldOnCells->setArray(array); double *tmp=array->getPointer(); - for(int i=0;idecrRef(); // @@ -2255,7 +2256,7 @@ void MEDCouplingBasicsTest1::testGetValueOn1() // targetMesh=build2DSourceMesh_1(); MEDCouplingFieldDouble *fieldOnNodes=MEDCouplingFieldDouble::New(ON_NODES); - int nbOfNodes=targetMesh->getNumberOfNodes(); + mcIdType nbOfNodes=targetMesh->getNumberOfNodes(); fieldOnNodes->setMesh(targetMesh); array=DataArrayDouble::New(); array->alloc(nbOfNodes,2); @@ -2454,38 +2455,38 @@ void MEDCouplingBasicsTest1::testCMesh2() coordsZ1->useArray(arrZ1,false, DeallocType::CPP_DEALLOC,4,1); mesh1->setCoords(coordsX1,coordsY1,coordsZ1); - std::vector dis=mesh1->getDistributionOfTypes(); + std::vector dis=mesh1->getDistributionOfTypes(); CPPUNIT_ASSERT_EQUAL(3,(int) dis.size()); - CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,dis[0]); - CPPUNIT_ASSERT_EQUAL(27,dis[1]); - CPPUNIT_ASSERT_EQUAL(-1,dis[2]); + CPPUNIT_ASSERT_EQUAL(ToIdType(INTERP_KERNEL::NORM_HEXA8),dis[0]); + CPPUNIT_ASSERT_EQUAL(ToIdType(27),dis[1]); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),dis[2]); - std::vector idsPerType; + std::vector idsPerType; CPPUNIT_ASSERT(!(mesh1->checkTypeConsistencyAndContig(dis, idsPerType))); - dis[0]=(int) INTERP_KERNEL::NORM_QUAD4; + dis[0]=(mcIdType) INTERP_KERNEL::NORM_QUAD4; CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception); - dis[0]=(int) INTERP_KERNEL::NORM_HEXA8; + dis[0]=(mcIdType) INTERP_KERNEL::NORM_HEXA8; dis[2]=0; - DataArrayInt *ids=DataArrayInt::New(); + DataArrayIdType *ids=DataArrayIdType::New(); ids->alloc(10,1); ids->fillWithValue(23); idsPerType.push_back(ids); - DataArrayInt* check=mesh1->checkTypeConsistencyAndContig(dis, idsPerType); + DataArrayIdType* check=mesh1->checkTypeConsistencyAndContig(dis, idsPerType); CPPUNIT_ASSERT(check); CPPUNIT_ASSERT(check->isEqual(*ids)); - std::vector code; - std::vector idsInPflPerType; - std::vector pfls; + std::vector code; + std::vector idsInPflPerType; + std::vector pfls; mesh1->splitProfilePerType(ids,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(3,(int)code.size()); - CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,code[0]); - CPPUNIT_ASSERT_EQUAL(10,code[1]); - CPPUNIT_ASSERT_EQUAL(0,code[2]); + CPPUNIT_ASSERT_EQUAL(ToIdType(INTERP_KERNEL::NORM_HEXA8),code[0]); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),code[1]); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),code[2]); CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size()); CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size()); - DataArrayInt *exp=DataArrayInt::New(); exp->alloc(10,1); exp->iota(0); + DataArrayIdType *exp=DataArrayIdType::New(); exp->alloc(10,1); exp->iota(0); CPPUNIT_ASSERT(idsInPflPerType[0]->isEqual(*exp)); exp->decrRef(); CPPUNIT_ASSERT(pfls[0]->isEqual(*ids)); @@ -2494,29 +2495,29 @@ void MEDCouplingBasicsTest1::testCMesh2() ids->decrRef(); check->decrRef(); - int cells1[4]={0,1,25,26}; + mcIdType cells1[4]={0,1,25,26}; MEDCouplingUMesh *partMesh1= dynamic_cast(mesh1->buildPart(cells1,cells1+4)); CPPUNIT_ASSERT(partMesh1); CPPUNIT_ASSERT_EQUAL(4,(int)partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); - CPPUNIT_ASSERT_EQUAL(64,mesh1->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(64,partMesh1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(64,(int)mesh1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(64,(int)partMesh1->getNumberOfNodes()); - int cells2[2]={25,26}; - DataArrayInt* arr1; + mcIdType cells2[2]={25,26}; + DataArrayIdType* arr1; MEDCouplingCMesh *partMesh2= dynamic_cast(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1)); CPPUNIT_ASSERT(partMesh2); CPPUNIT_ASSERT_EQUAL(2,(int)partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); - CPPUNIT_ASSERT_EQUAL(12,partMesh2->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(12,(int)partMesh2->getNumberOfNodes()); - int cells3[2]={2,3}; - DataArrayInt* arr2; + mcIdType cells3[2]={2,3}; + DataArrayIdType* arr2; MEDCouplingUMesh *partMesh3= dynamic_cast(partMesh1->buildPartAndReduceNodes(cells3,cells3+2,arr2)); CPPUNIT_ASSERT(partMesh3); CPPUNIT_ASSERT_EQUAL(2,(int)partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); - CPPUNIT_ASSERT_EQUAL(12,partMesh3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(12,(int)partMesh3->getNumberOfNodes()); CPPUNIT_ASSERT_THROW(mesh1->simplexize(0),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(mesh1->getMeasureFieldOnNode(true),INTERP_KERNEL::Exception); @@ -2538,7 +2539,7 @@ void MEDCouplingBasicsTest1::testCMesh2() MEDCouplingFieldDouble *f1=mesh2d->buildOrthogonalField(); std::vector tinyInfoD; - std::vector tinyInfo; + std::vector tinyInfo; std::vector littleStrings; mesh2d->getTinySerializationInformation(tinyInfoD, tinyInfo, littleStrings); CPPUNIT_ASSERT_EQUAL(5,(int)tinyInfo.size()); @@ -2548,7 +2549,7 @@ void MEDCouplingBasicsTest1::testCMesh2() CPPUNIT_ASSERT_EQUAL(-1,(int)tinyInfo[3]); //it CPPUNIT_ASSERT_EQUAL(-1,(int)tinyInfo[4]); //order CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,tinyInfoD[0],1e-14); //time - DataArrayInt* d1=DataArrayInt::New(); + DataArrayIdType* d1=DataArrayIdType::New(); DataArrayDouble* d2=DataArrayDouble::New(); mesh2d->resizeForUnserialization(tinyInfo, d1, d2, littleStrings); CPPUNIT_ASSERT_EQUAL(0,(int)d1->getNumberOfTuples()); @@ -2620,17 +2621,17 @@ void MEDCouplingBasicsTest1::testTryToShareSameCoords() void MEDCouplingBasicsTest1::testFindNodeOnPlane() { MEDCouplingUMesh *mesh=build3DTargetMesh_1(); - std::vector n; + std::vector n; double pt[3]={300.,300.,0.}; double v[3]={0.,0.,2.}; mesh->findNodesOnPlane(pt,v,1e-12,n); CPPUNIT_ASSERT_EQUAL(9,(int)n.size()); MEDCouplingUMesh *m3dSurf=(MEDCouplingUMesh *)mesh->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); MEDCouplingMappedExtrudedMesh *me=MEDCouplingMappedExtrudedMesh::New(mesh,m3dSurf,0); - const DataArrayInt *da=me->getMesh3DIds(); + const DataArrayIdType *da=me->getMesh3DIds(); CPPUNIT_ASSERT_EQUAL(8,(int)me->getNumberOfCells()); - const int expected[8]={0,1,2,3,4,5,6,7}; - const int *val=da->getConstPointer(); + const mcIdType expected[8]={0,1,2,3,4,5,6,7}; + const mcIdType *val=da->getConstPointer(); for(int i=0;i<8;i++) CPPUNIT_ASSERT_EQUAL(expected[i],val[i]); me->decrRef(); @@ -2643,7 +2644,7 @@ void MEDCouplingBasicsTest1::testRenumberCells() MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); MEDCouplingUMesh *m2=build3DSurfTargetMesh_1(); CPPUNIT_ASSERT(m->isEqual(m2,0)); - const int arr[5]={12,3,25,2,26}; + const mcIdType arr[5]={12,3,25,2,26}; m->renumberCells(arr,true); CPPUNIT_ASSERT(!m->isEqual(m2,0)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(0)); @@ -2651,7 +2652,7 @@ void MEDCouplingBasicsTest1::testRenumberCells() CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(2)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_TRI3,m->getTypeOfCell(3)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_QUAD4,m->getTypeOfCell(4)); - const int arr2[5]={5,-1,-5,4,8}; + const mcIdType arr2[5]={5,-1,-5,4,8}; m->renumberCells(arr2,true); CPPUNIT_ASSERT(m->isEqual(m2,0)); m->decrRef(); @@ -2683,8 +2684,8 @@ void MEDCouplingBasicsTest1::testSetConnectivity() { MEDCouplingUMesh *m1 = build1DTargetMesh_1(); - DataArrayInt * conn = DataArrayInt::New(); - DataArrayInt * connI = DataArrayInt::New(); + DataArrayIdType * conn = DataArrayIdType::New(); + DataArrayIdType * connI = DataArrayIdType::New(); m1->setConnectivity(conn, connI, true); // was SEG-Faulting with empty arrays conn->decrRef(); connI->decrRef(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 8fdca210a..d68ab59fb 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -51,17 +51,17 @@ void MEDCouplingBasicsTest2::testGaussPointField1() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_PT,NO_TIME); CPPUNIT_ASSERT_THROW(f->getNumberOfTuples(), INTERP_KERNEL::Exception); // Sanity check! f->setMesh(m); - CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected()); - CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization()); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_TRI3,_refCoo1,_gsCoo1,_wg1); // not a bug only to check that it works well CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo1,_gsCoo1,_wg1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization()); const double refCoo2[8]={ 0.,0., 1.,0., 1.,1., 0.,1. }; std::vector _refCoo2(refCoo2,refCoo2+8); _gsCoo1.resize(4); _wg1.resize(2); f->setGaussLocalizationOnType(INTERP_KERNEL::NORM_QUAD4,_refCoo2,_gsCoo1,_wg1); - CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization()); DataArrayDouble *array=DataArrayDouble::New(); array->alloc(18,2); double *ptr=array->getPointer(); @@ -75,30 +75,30 @@ void MEDCouplingBasicsTest2::testGaussPointField1() CPPUNIT_ASSERT_DOUBLES_EQUAL(16.,f->getIJK(1,5,1),1e-14); // f->clearGaussLocalizations(); - CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization()); CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception); - int ids1[4]={0,1,3,4}; + mcIdType ids1[4]={0,1,3,4}; CPPUNIT_ASSERT_THROW(f->setGaussLocalizationOnCells(ids1,ids1+4,_refCoo2,_gsCoo1,_wg1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_EQUAL(0,f->getNbOfGaussLocalization()); - int ids2[2]={0,4}; + CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getNbOfGaussLocalization()); + mcIdType ids2[2]={0,4}; f->setGaussLocalizationOnCells(ids2,ids2+2,_refCoo2,_gsCoo1,_wg1); - CPPUNIT_ASSERT_EQUAL(1,f->getNbOfGaussLocalization()); - CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0)); CPPUNIT_ASSERT_THROW(f->getGaussLocalizationIdOfOneCell(1),INTERP_KERNEL::Exception); - int ids3[2]={1,2}; + mcIdType ids3[2]={1,2}; f->setGaussLocalizationOnCells(ids3,ids3+2,_refCoo1,_gsCoo1,_wg1); - CPPUNIT_ASSERT_EQUAL(2,f->getNbOfGaussLocalization()); - CPPUNIT_ASSERT_EQUAL(0,f->getGaussLocalizationIdOfOneCell(0)); - CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(1)); - CPPUNIT_ASSERT_EQUAL(1,f->getGaussLocalizationIdOfOneCell(2)); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),f->getNbOfGaussLocalization()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),f->getGaussLocalizationIdOfOneCell(0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(1)); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),f->getGaussLocalizationIdOfOneCell(2)); CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);//<- cell 3 has no localization - int ids4[1]={3}; + mcIdType ids4[1]={3}; std::vector _gsCoo2(_gsCoo1); std::vector _wg2(_wg1); _gsCoo2[0]=0.8888777776666; _wg2[0]=0.1234567892377; f->setGaussLocalizationOnCells(ids4,ids4+1,_refCoo2,_gsCoo2,_wg2); - CPPUNIT_ASSERT_EQUAL(3,f->getNbOfGaussLocalization()); - std::vector tmpIds; + CPPUNIT_ASSERT_EQUAL(ToIdType(3),f->getNbOfGaussLocalization()); + std::vector tmpIds; f->getCellIdsHavingGaussLocalization(0,tmpIds); CPPUNIT_ASSERT_EQUAL(2,(int)tmpIds.size()); CPPUNIT_ASSERT(std::equal(ids2,ids2+2,tmpIds.begin())); @@ -128,7 +128,7 @@ void MEDCouplingBasicsTest2::testGaussPointNEField1() MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_GAUSS_NE,NO_TIME); f->setMesh(m); - CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected()); f->setName("MyFirstFieldOnNE"); f->setDescription("MyDescriptionNE"); DataArrayDouble *array=DataArrayDouble::New(); @@ -154,7 +154,7 @@ void MEDCouplingBasicsTest2::testCellOrientation1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); double vec[3]={0.,0.,-1.}; - std::vector res1; + std::vector res1; CPPUNIT_ASSERT_THROW(m->are2DCellsNotCorrectlyOriented(vec,false,res1),INTERP_KERNEL::Exception); m->changeSpaceDimension(3); res1.clear(); @@ -167,13 +167,13 @@ void MEDCouplingBasicsTest2::testCellOrientation1() // vec[2]=-1.; // connectivity inversion - int *conn=m->getNodalConnectivity()->getPointer(); - int tmp=conn[11]; + mcIdType *conn=m->getNodalConnectivity()->getPointer(); + mcIdType tmp=conn[11]; conn[11]=conn[12]; conn[12]=tmp; m->are2DCellsNotCorrectlyOriented(vec,false,res1); CPPUNIT_ASSERT_EQUAL(1,(int)res1.size()); - CPPUNIT_ASSERT_EQUAL(2,res1[0]); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),res1[0]); res1.clear(); m->orientCorrectly2DCells(vec,false); m->are2DCellsNotCorrectlyOriented(vec,false,res1); @@ -191,7 +191,7 @@ void MEDCouplingBasicsTest2::testCellOrientation2() MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m2=build3DExtrudedUMesh_1(m1); m1->decrRef(); - std::vector res1; + std::vector res1; m2->arePolyhedronsNotCorrectlyOriented(res1); CPPUNIT_ASSERT_EQUAL(6,(int)res1.size()); m2->orientCorrectlyPolyhedrons(); @@ -200,8 +200,8 @@ void MEDCouplingBasicsTest2::testCellOrientation2() CPPUNIT_ASSERT(res1.empty()); m2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(18,(int)m2->getNumberOfCells()); - int cellIds[3]={0,6,12}; - std::vector cellIds2(cellIds,cellIds+3); + mcIdType cellIds[3]={0,6,12}; + std::vector cellIds2(cellIds,cellIds+3); m2->convertToPolyTypes(&cellIds2[0],&cellIds2[0]+cellIds2.size()); m2->orientCorrectlyPolyhedrons(); res1.clear(); @@ -212,8 +212,8 @@ void MEDCouplingBasicsTest2::testCellOrientation2() MEDCouplingUMesh *m3=build2DTargetMesh_1(); double vec[3]={0.,0.,1.}; m3->changeSpaceDimension(3); - const int ids1[5]={0,1,2,3,4}; - std::vector ids2(ids1,ids1+5); + const mcIdType ids1[5]={0,1,2,3,4}; + std::vector ids2(ids1,ids1+5); m3->convertToPolyTypes(&ids2[0],&ids2[0]+ids2.size()); m3->orientCorrectly2DCells(vec,false); MEDCouplingUMesh *m4=buildCU1DMesh_U(); @@ -271,7 +271,7 @@ void MEDCouplingBasicsTest2::testCellOrientation3() coords[4] = cos(5*M_PI/4.0); coords[5] = sin(5*M_PI/4.0); coords[6] = cos(M_PI/4.0); coords[7] = sin(M_PI/4.0); - int conn[4]= { 0,1,2,3 }; + mcIdType conn[4]= { 0,1,2,3 }; double vec[3]={0.,0.,-1.}; m->allocateCells(1); m->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,4,conn); @@ -283,7 +283,7 @@ void MEDCouplingBasicsTest2::testCellOrientation3() myCoords->decrRef(); m->changeSpaceDimension(3); - std::vector res1; + std::vector res1; m->are2DCellsNotCorrectlyOriented(vec,false,res1); CPPUNIT_ASSERT(res1.empty()); vec[2] = 1.0; @@ -298,7 +298,7 @@ void MEDCouplingBasicsTest2::testCellOrientation3() */ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() { - int connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0}; + mcIdType connN[]={0,3,2,1, -1, 4,5,6,7, -1, 0,4,7,3, -1, 3,7,6,2, -1, 2,6,5,1, -1, 1,5,4,0}; double coords[]={0.,0.,0., 1.,0.,0., 1.,1.,0., 0.,1.,0., 0.,0.,1., 1.,0.,1., 1.,1.,1., 0.,1.,1., 0.5, 0.5, 0.5}; MEDCouplingUMesh *meshN=MEDCouplingUMesh::New(); meshN->setName("ForBary"); @@ -313,7 +313,7 @@ void MEDCouplingBasicsTest2::testPolyhedronBarycenter() myCoords->decrRef(); meshN->checkConsistencyLight(); // - std::vector res1; + std::vector res1; meshN->arePolyhedronsNotCorrectlyOriented(res1); meshN->orientCorrectlyPolyhedrons(); CPPUNIT_ASSERT(res1.empty()); @@ -574,7 +574,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D() 0.167803379307 , -0.207851396623 , -0.088802726124 , 0.12868717152 , -0.230920439715 , 0.00760508389036 , -0.0372812069535 , -0.286740286332 , 0.00963701291166 }; - int connN [] = { /*polyhedron 0*/ + mcIdType connN [] = { /*polyhedron 0*/ 0 , 1 , 3 , 4 , 2 , -1 , 1 , 5 , 6 , 7 , 0 , -1 , 0 , 7 , 8 , 10 , 11 , 9 , 2 , -1 , 1 , 5 , 12 , 14 , 15 , 13 , 3 , -1 , 16 , 9 , 2 , 4 , 17 , -1 , 4 , 3 , 13 , 18 , 17 , -1 , 5 , 6 , 19 , 21 , 20 , 12 , -1 , 6 , 7 , 8 , 23 , 22 , 19 , -1 , 23 , 24 , 10 , 8 , -1 , 25 , 11 , 9 , 16 , -1 , 24 , 26 , 25 , 11 , 10 , -1 , 12 , 14 , 20 , -1 , 27 , 28 , 29 , 15 , 13 , 18 , -1 , 14 , 15 , 29 , 30 , 21 , 20 , -1 , 26 , 27 , 18 , 17 , 16 , 25 , -1 @@ -612,7 +612,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D() meshN->setCoords(myCoords); myCoords->decrRef(); meshN->checkConsistencyLight(); - std::vector res1; + std::vector res1; meshN->arePolyhedronsNotCorrectlyOriented(res1); meshN->orientCorrectlyPolyhedrons(); res1.clear(); @@ -636,13 +636,12 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - int nbOfCells=m->getNumberOfCells(); - arr->alloc(nbOfCells,3); + arr->alloc(m->getNumberOfCells(),3); f->setArray(arr); arr->decrRef(); const double values1[15]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.}; std::copy(values1,values1+15,arr->getPointer()); - const int renumber1[5]={3,1,0,4,2}; + const mcIdType renumber1[5]={3,1,0,4,2}; double res[3]; const double loc[]={-0.05,-0.05, 0.55,-0.25, 0.55,0.15, -0.05,0.45, 0.45,0.45}; for(int j=0;j<5;j++) @@ -698,7 +697,7 @@ void MEDCouplingBasicsTest2::testRenumberCellsForFields() ptr=f->getArray()->getConstPointer(); for(int i=0;i<36;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],ptr[i],1e-12); - const int renumber2[5]={2,1,4,0,3};//reverse renumber1 + const mcIdType renumber2[5]={2,1,4,0,3};//reverse renumber1 f->renumberCells(renumber2,false); CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); fCpy->decrRef(); @@ -734,16 +733,16 @@ void MEDCouplingBasicsTest2::testRenumberNodesForFields() MEDCouplingUMesh *m=build2DTargetMesh_1(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); f->setMesh(m); - CPPUNIT_ASSERT_EQUAL(9,f->getNumberOfMeshPlacesExpected()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),f->getNumberOfMeshPlacesExpected()); DataArrayDouble *arr=DataArrayDouble::New(); - int nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); arr->alloc(nbOfNodes,3); f->setArray(arr); arr->decrRef(); const double values1[27]={7.,107.,10007.,8.,108.,10008.,9.,109.,10009.,10.,110.,10010.,11.,111.,10011.,12.,112.,10012.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.}; std::copy(values1,values1+27,arr->getPointer()); f->checkConsistencyLight(); - const int renumber1[9]={0,4,1,3,5,2,6,7,8}; + const mcIdType renumber1[9]={0,4,1,3,5,2,6,7,8}; double res[3]; const double loc[]={0.5432,-0.2432, 0.5478,0.1528}; const double expected1[6]={9.0272, 109.0272, 10009.0272, 11.4124,111.4124,10011.4124}; @@ -766,7 +765,7 @@ void MEDCouplingBasicsTest2::testRenumberNodesForFields() const double expected2[27]={7.,107.,10007.,9.,109.,10009.,12.,112.,10012.,10.,110.,10010.,8.,108.,10008.,11.,111.,10011.,13.,113.,10013.,14.,114.,10014.,15.,115.,10015.}; for(int i=0;i<27;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f->getArray()->getConstPointer()[i],1e-12); - const int renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2 + const mcIdType renumber2[9]={0,2,5,3,1,4,6,7,8};//reverse of renumber2 f->renumberNodes(renumber2); CPPUNIT_ASSERT(f->isEqual(fCpy,1e-12,1e-12)); fCpy->decrRef(); @@ -785,7 +784,7 @@ void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear() std::set expected1Bis(expected1,expected1+5); CPPUNIT_ASSERT(expected1Bis==types); CPPUNIT_ASSERT(mesh->isPresenceOfQuadratic()); - CPPUNIT_ASSERT_EQUAL(62,mesh->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(62),mesh->getNodalConnectivityArrayLen()); MEDCouplingFieldDouble *f1=mesh->getMeasureField(false); // mesh->convertQuadraticCellsToLinear(); @@ -794,7 +793,7 @@ void MEDCouplingBasicsTest2::testConvertQuadraticCellsToLinear() mesh->checkConsistencyLight(); MEDCouplingFieldDouble *f2=mesh->getMeasureField(false); CPPUNIT_ASSERT(f1->getArray()->isEqual(*f2->getArray(),1e-12)); - CPPUNIT_ASSERT_EQUAL(48,mesh->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),mesh->getNodalConnectivityArrayLen()); 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}; @@ -810,7 +809,7 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() { MEDCouplingUMesh *mesh1=build2DTargetMesh_3(); MEDCouplingUMesh *mesh2=build2DTargetMesh_3(); - DataArrayInt *cellCor,*nodeCor; + DataArrayIdType *cellCor,*nodeCor; //First test mesh1 mesh1->checkGeoEquivalWith(mesh1,0,1e-12,cellCor,nodeCor);//deepEqual CPPUNIT_ASSERT(cellCor==0); @@ -832,7 +831,7 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() 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 int renum[]={0,2,1,3,4,5,6,8,7,9}; + 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==0); @@ -852,7 +851,7 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() //4th test : cell and node permutation by keeping the first the middle and the last as it is. mesh2->decrRef(); mesh2=build2DTargetMesh_3(); - const int renum2[]={0,2,1,3,4,5,6,8,7,9,10}; + const mcIdType renum2[]={0,2,1,3,4,5,6,8,7,9,10}; mesh2->renumberCells(renum,false); mesh2->renumberNodes(renum2,11); CPPUNIT_ASSERT_THROW(mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor),INTERP_KERNEL::Exception);//deepEqual fails @@ -877,19 +876,19 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith() //5th test : modification of the last cell to check fastCheck detection. mesh2->decrRef(); mesh2=build2DTargetMesh_3(); - const int renum3[]={0,2,1,3,4,5,6,8,9,7}; + const mcIdType renum3[]={0,2,1,3,4,5,6,8,9,7}; mesh2->renumberCells(renum3,false); mesh2->renumberNodes(renum2,11); bool isExcep=false; try { mesh1->checkGeoEquivalWith(mesh2,0,1e-12,cellCor,nodeCor);//deepEqual fails } - catch(INTERP_KERNEL::Exception& e) { isExcep=true; } + catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; 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& e) { isExcep=true; } + catch(INTERP_KERNEL::Exception&) { isExcep=true; } CPPUNIT_ASSERT(isExcep); isExcep=false; CPPUNIT_ASSERT(cellCor==0); CPPUNIT_ASSERT(nodeCor==0); @@ -915,11 +914,11 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith2() { MEDCouplingUMesh *mesh1=build2DTargetMesh_4(); MEDCouplingUMesh *mesh2=build2DTargetMesh_1(); - DataArrayInt *cellCor,*nodeCor; + DataArrayIdType *cellCor,*nodeCor; mesh1->checkGeoEquivalWith(mesh2,10,1e-12,cellCor,nodeCor); CPPUNIT_ASSERT(cellCor==0); CPPUNIT_ASSERT(nodeCor!=0); - const int expected1[9]={0, 1, 3, 4, 5, 6, 7, 8, 9}; + 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)); nodeCor->decrRef(); @@ -931,10 +930,10 @@ void MEDCouplingBasicsTest2::testCheckGeoEquivalWith2() void MEDCouplingBasicsTest2::testCopyTinyStringsFromOnFields() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); - CPPUNIT_ASSERT_EQUAL(5,f->getNumberOfMeshPlacesExpected()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),f->getNumberOfMeshPlacesExpected()); f->setName("a"); f->setDescription("b"); DataArrayDouble *a1=DataArrayDouble::New(); @@ -999,7 +998,7 @@ void MEDCouplingBasicsTest2::testTryToShareSameCoordsPermute() m->tryToShareSameCoordsPermute(*m2,1e-12); CPPUNIT_ASSERT(m->getCoords()==m2->getCoords()); CPPUNIT_ASSERT(m2->isEqual(m,1e-12)); - const int renum1[9]={1,2,0,5,8,7,4,3,6}; + const mcIdType renum1[9]={1,2,0,5,8,7,4,3,6}; m->renumberNodes(renum1,9); CPPUNIT_ASSERT(m->getCoords()!=m2->getCoords()); CPPUNIT_ASSERT(!m2->isEqual(m,1e-12)); @@ -1014,7 +1013,7 @@ void MEDCouplingBasicsTest2::testTryToShareSameCoordsPermute2() { MEDCouplingUMesh *m1=build2DTargetMesh_4(); double targetCoords[8]={-0.3,-0.3, 0.2,-0.3, -0.3,0.2, 0.2,0.2 }; - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; MEDCouplingUMesh *m2=MEDCouplingUMesh::New(); m2->setMeshDimension(2); m2->allocateCells(1); @@ -1069,7 +1068,7 @@ void MEDCouplingBasicsTest2::testChangeUnderlyingMesh1() f1->setArray(array); array->decrRef(); // - const int renum[]={0,2,1,3,4,5,6,8,7,9}; + const mcIdType renum[]={0,2,1,3,4,5,6,8,7,9}; mesh2->renumberCells(renum,false); CPPUNIT_ASSERT(f1->getMesh()==mesh1); f1->changeUnderlyingMesh(mesh1,10,1e-12);// nothing done only to check that nothing done. @@ -1090,7 +1089,7 @@ void MEDCouplingBasicsTest2::testChangeUnderlyingMesh1() f1->setArray(array); array->decrRef(); // - const int renum2[]={0,2,10,3,4,5,6,8,7,9,1}; + const mcIdType renum2[]={0,2,10,3,4,5,6,8,7,9,1}; mesh2->renumberNodes(renum2,11); CPPUNIT_ASSERT(f1->getMesh()==mesh1); f1->changeUnderlyingMesh(mesh2,10,1e-12); @@ -1107,7 +1106,7 @@ void MEDCouplingBasicsTest2::testChangeUnderlyingMesh1() void MEDCouplingBasicsTest2::testGetMaxValue1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,LINEAR_TIME); f->setMesh(m); DataArrayDouble *a1=DataArrayDouble::New(); @@ -1157,7 +1156,7 @@ void MEDCouplingBasicsTest2::testSubstractInPlaceDM1() CPPUNIT_ASSERT_EQUAL(2,(int)f1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(20,(int)f1->getNumberOfValues()); // - const int renum[]={0,2,3,1,4,5,6,8,7,9}; + const mcIdType renum[]={0,2,3,1,4,5,6,8,7,9}; mesh2->renumberCells(renum,false); // MEDCouplingFieldDouble *f2=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); @@ -1308,14 +1307,14 @@ void MEDCouplingBasicsTest2::testGetIdsInRange1() array->decrRef(); // f1->checkConsistencyLight(); - DataArrayInt *da=f1->findIdsInRange(2.9,7.1); - CPPUNIT_ASSERT_EQUAL((std::size_t)5,da->getNbOfElems()); - const int expected1[5]={2,3,5,7,9}; + DataArrayIdType *da=f1->findIdsInRange(2.9,7.1); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),da->getNbOfElems()); + const mcIdType expected1[5]={2,3,5,7,9}; CPPUNIT_ASSERT(std::equal(expected1,expected1+5,da->getConstPointer())); da->decrRef(); da=f1->findIdsInRange(8.,12.); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,da->getNbOfElems()); - const int expected2[4]={1,4,6,8}; + CPPUNIT_ASSERT_EQUAL(ToIdType(4),da->getNbOfElems()); + const mcIdType expected2[4]={1,4,6,8}; CPPUNIT_ASSERT(std::equal(expected2,expected2+4,da->getConstPointer())); da->decrRef(); // @@ -1336,7 +1335,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() f1->setArray(array); array->decrRef(); // - const int part1[3]={2,1,4}; + const mcIdType part1[3]={2,1,4}; MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3); f2->zipCoords(); CPPUNIT_ASSERT_EQUAL(3,(int)f2->getNumberOfTuples()); @@ -1349,7 +1348,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); + 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++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); @@ -1369,7 +1368,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() std::copy(arr2,arr2+18,array->getPointer()); f1->setArray(array); array->decrRef(); - const int part2[2]={1,2}; + const mcIdType part2[2]={1,2}; f2=f1->buildSubPart(part2,part2+2); CPPUNIT_ASSERT_EQUAL(4,(int)f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents()); @@ -1377,11 +1376,11 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() for(int i=0;i<8;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12); CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen()); for(int i=0;i<8;i++)//8 is not an error CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1389,8 +1388,8 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer())); f2->decrRef(); //idem previous because nodes of cell#4 are not fully present in part3 - const int part3[2]={1,2}; - DataArrayInt *arrr=DataArrayInt::New(); + const mcIdType part3[2]={1,2}; + DataArrayIdType *arrr=DataArrayIdType::New(); arrr->alloc(2,1); std::copy(part3,part3+2,arrr->getPointer()); f2=f1->buildSubPart(arrr); @@ -1400,11 +1399,11 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() for(int i=0;i<8;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected5[i],1e-12); CPPUNIT_ASSERT_EQUAL(2,(int)f2->getMesh()->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(4,f2->getMesh()->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(8,m2C->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(8),m2C->getNodalConnectivityArrayLen()); for(int i=0;i<8;i++)//8 is not an error CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1412,7 +1411,7 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() CPPUNIT_ASSERT(std::equal(expected4,expected4+3,m2C->getNodalConnectivityIndex()->getConstPointer())); f2->decrRef(); // - const int part4[3]={1,2,4}; + const mcIdType part4[3]={1,2,4}; f2=f1->buildSubPart(part4,part4+3); CPPUNIT_ASSERT_EQUAL(6,(int)f2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)f2->getNumberOfComponents()); @@ -1420,11 +1419,11 @@ void MEDCouplingBasicsTest2::testBuildSubPart1() for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(f2->getIJ(0,i),expected6[i],1e-12); CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(6,(int)f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(13),m2C->getNodalConnectivityArrayLen()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,m2C->getNodalConnectivity()->getConstPointer()+4)); @@ -1848,11 +1847,11 @@ void MEDCouplingBasicsTest2::testMaxPerTuple1() CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,f2->getIJ(i,0),1e-13); f2->decrRef(); // - DataArrayInt *d2I=0; + DataArrayIdType *d2I=0; DataArrayDouble *d2=array->maxPerTupleWithCompoId(d2I); CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)d2->getNumberOfTuples()); - const int expected2[5]={4,3,2,0,1}; + const mcIdType expected2[5]={4,3,2,0,1}; for(int i=0;i<5;i++) { CPPUNIT_ASSERT_DOUBLES_EQUAL(5.6,d2->getIJ(i,0),1e-13); @@ -1943,7 +1942,7 @@ void MEDCouplingBasicsTest2::testIsEqualWithoutConsideringStr1() { MEDCouplingUMesh *mesh1=build2DTargetMesh_1(); MEDCouplingUMesh *mesh2=build2DTargetMesh_1(); - DataArrayInt *da1,*da2; + DataArrayIdType *da1,*da2; // CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); @@ -1974,7 +1973,7 @@ void MEDCouplingBasicsTest2::testIsEqualWithoutConsideringStr1() mesh2->getCoords()->setIJ(0,3,tmp); CPPUNIT_ASSERT(mesh1->isEqual(mesh2,1e-12)); CPPUNIT_ASSERT(mesh1->isEqualWithoutConsideringStr(mesh2,1e-12)); - int 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)); @@ -2017,12 +2016,12 @@ void MEDCouplingBasicsTest2::testIsEqualWithoutConsideringStr1() void MEDCouplingBasicsTest2::testGetNodeIdsOfCell1() { MEDCouplingUMesh *mesh1=build2DTargetMesh_1(); - std::vector nodeIds; + std::vector nodeIds; mesh1->getNodeIdsOfCell(1,nodeIds); CPPUNIT_ASSERT_EQUAL(3,(int)nodeIds.size()); - CPPUNIT_ASSERT_EQUAL(1,nodeIds[0]); - CPPUNIT_ASSERT_EQUAL(4,nodeIds[1]); - CPPUNIT_ASSERT_EQUAL(2,nodeIds[2]); + CPPUNIT_ASSERT_EQUAL(1,(int)nodeIds[0]); + CPPUNIT_ASSERT_EQUAL(4,(int)nodeIds[1]); + CPPUNIT_ASSERT_EQUAL(2,(int)nodeIds[2]); std::vector coords; mesh1->getCoordinatesOfNode(4,coords); CPPUNIT_ASSERT_EQUAL(2,(int)coords.size()); @@ -2238,7 +2237,7 @@ void MEDCouplingBasicsTest2::testAreaBary3D2() mesh->setCoords(coo); coo->decrRef(); // - int tmpConn[8]={0,1,2,3,4,5,6,7}; + mcIdType tmpConn[8]={0,1,2,3,4,5,6,7}; mesh->allocateCells(3); mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,tmpConn); std::transform(tmpConn,tmpConn+8,tmpConn,std::bind2nd(std::plus(),8)); @@ -2248,10 +2247,10 @@ void MEDCouplingBasicsTest2::testAreaBary3D2() mesh->finishInsertingCells(); mesh->checkConsistencyLight(); bool isMerged; - int newNebOfNodes; - DataArrayInt *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes); + mcIdType newNebOfNodes; + DataArrayIdType *da=mesh->mergeNodes(1e-7,isMerged,newNebOfNodes); da->decrRef(); - CPPUNIT_ASSERT_EQUAL(12,newNebOfNodes); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),newNebOfNodes); MEDCouplingFieldDouble *vols=mesh->getMeasureField(true); CPPUNIT_ASSERT_EQUAL(3,(int)vols->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)vols->getNumberOfComponents()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx index 17a201041..52200697a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx @@ -24,6 +24,7 @@ #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingGaussLocalization.hxx" #include @@ -44,7 +45,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() m->setCoordsAt(0,da); da->decrRef(); m->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(1,m->getSpaceDimension()); MEDCouplingFieldDouble *f=m->getMeasureField(true); @@ -74,7 +75,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() m->setCoordsAt(1,da); da->decrRef(); m->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(12,m->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(12,(int)m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(6,(int)m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(2,m->getSpaceDimension()); f=m->getMeasureField(true); @@ -105,7 +106,7 @@ void MEDCouplingBasicsTest3::testGetMeasureFieldCMesh1() m->setCoordsAt(2,da); da->decrRef(); m->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(60,m->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(60,(int)m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(24,(int)m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension()); f=m->getMeasureField(true); @@ -175,7 +176,7 @@ void MEDCouplingBasicsTest3::testFieldDoubleZipConnectivity1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); MEDCouplingUMesh *m2=build2DTargetMesh_1(); - const int cells1[3]={2,3,4}; + const mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m3_1=m2->buildPartOfMySelf(cells1,cells1+3,true); MEDCouplingUMesh *m3=dynamic_cast(m3_1); CPPUNIT_ASSERT(m3); @@ -189,11 +190,11 @@ void MEDCouplingBasicsTest3::testFieldDoubleZipConnectivity1() m5->decrRef(); // CPPUNIT_ASSERT_EQUAL(10,(int)m6->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(22,m6->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(22,(int)m6->getNumberOfNodes()); bool areNodesMerged; - int newNbOfNodes; - DataArrayInt *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(9,m6->getNumberOfNodes()); + mcIdType newNbOfNodes; + DataArrayIdType *arr=m6->mergeNodes(1e-13,areNodesMerged,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(9,(int)m6->getNumberOfNodes()); arr->decrRef(); MEDCouplingFieldDouble *f=m6->fillFromAnalytic(ON_CELLS,2,"x"); MEDCouplingFieldDouble *f2=m6->fillFromAnalytic(ON_NODES,2,"x"); @@ -244,7 +245,7 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumber1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={3,1,0,6,5,4,2}; + const mcIdType arr2[7]={3,1,0,6,5,4,2}; DataArrayDouble *b=a->renumber(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); @@ -256,18 +257,18 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumber1() b->decrRef(); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); c->setInfoOnComponent(0,"toto"); c->setInfoOnComponent(1,"tata"); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); - DataArrayInt *d=c->renumber(arr2); + DataArrayIdType *d=c->renumber(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto"); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata"); - const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14}; + const mcIdType expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i)); c->decrRef(); @@ -283,7 +284,7 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberAndReduce1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={2,-1,1,-1,0,4,3}; + const mcIdType arr2[7]={2,-1,1,-1,0,4,3}; DataArrayDouble *b=a->renumberAndReduce(arr2,5); CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); @@ -295,18 +296,18 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberAndReduce1() b->decrRef(); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); c->setInfoOnComponent(0,"toto"); c->setInfoOnComponent(1,"tata"); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); - DataArrayInt *d=c->renumberAndReduce(arr2,5); + DataArrayIdType *d=c->renumberAndReduce(arr2,5); CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto"); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata"); - const int expected2[10]={5,15,3,13,1,11,7,17,6,16}; + const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16}; for(int i=0;i<10;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i)); c->decrRef(); @@ -320,7 +321,7 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberInPlace1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={3,1,0,6,5,4,2}; + const mcIdType arr2[7]={3,1,0,6,5,4,2}; a->renumberInPlace(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)a->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfComponents()); @@ -329,14 +330,14 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberInPlace1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); c->renumberInPlace(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents()); - const int expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14}; + const mcIdType expected2[14]={3, 13, 2, 12, 7, 17, 1, 11, 6, 16, 5, 15, 4, 14}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i)); c->decrRef(); @@ -351,7 +352,7 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberR1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={3,1,0,6,5,4,2}; + const mcIdType arr2[7]={3,1,0,6,5,4,2}; DataArrayDouble *b=a->renumberR(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); @@ -363,18 +364,18 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberR1() b->decrRef(); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); c->setInfoOnComponent(0,"toto"); c->setInfoOnComponent(1,"tata"); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); - DataArrayInt *d=c->renumberR(arr2); + DataArrayIdType *d=c->renumberR(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto"); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata"); - const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13}; + const mcIdType expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i)); c->decrRef(); @@ -388,7 +389,7 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberInPlaceR1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={3,1,0,6,5,4,2}; + const mcIdType arr2[7]={3,1,0,6,5,4,2}; a->renumberInPlaceR(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)a->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfComponents()); @@ -397,14 +398,14 @@ void MEDCouplingBasicsTest3::testDaDoubleRenumberInPlaceR1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a->getIJ(0,i),1e-14); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); c->renumberInPlaceR(arr2); CPPUNIT_ASSERT_EQUAL(7,(int)c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents()); - const int expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13}; + const mcIdType expected2[14]={4, 14, 2, 12, 1, 11, 7, 17, 6, 16, 5, 15, 3, 13}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],c->getIJ(0,i)); c->decrRef(); @@ -419,7 +420,7 @@ void MEDCouplingBasicsTest3::testDaDoubleSelectByTupleId1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={4,2,0,6,5}; + const mcIdType arr2[7]={4,2,0,6,5}; DataArrayDouble *b=a->selectByTupleId(arr2,arr2+5); CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); @@ -431,18 +432,18 @@ void MEDCouplingBasicsTest3::testDaDoubleSelectByTupleId1() b->decrRef(); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); c->setInfoOnComponent(0,"toto"); c->setInfoOnComponent(1,"tata"); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); - DataArrayInt *d=c->selectByTupleId(arr2,arr2+5); + DataArrayIdType *d=c->selectByTupleId(arr2,arr2+5); CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto"); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata"); - const int expected2[10]={5,15,3,13,1,11,7,17,6,16}; + const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16}; for(int i=0;i<10;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i)); c->decrRef(); @@ -455,16 +456,16 @@ void MEDCouplingBasicsTest3::testDaDoubleGetMinMaxValues1() a->alloc(9,1); const double arr1[9]={2.34,4.56,-6.77,4.55,4.56,2.24,2.34,1.02,4.56}; std::copy(arr1,arr1+9,a->getPointer()); - int where; + mcIdType where; double m=a->getMaxValue(where); - CPPUNIT_ASSERT_EQUAL(1,where); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),where); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12); - DataArrayInt *ws; + DataArrayIdType *ws; m=a->getMaxValue2(ws); CPPUNIT_ASSERT_DOUBLES_EQUAL(4.56,m,1e-12); CPPUNIT_ASSERT_EQUAL(3,(int)ws->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)ws->getNumberOfComponents()); - const int expected1[3]={1,4,8}; + const mcIdType expected1[3]={1,4,8}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0)); ws->decrRef(); @@ -475,7 +476,7 @@ void MEDCouplingBasicsTest3::testDaDoubleGetMinMaxValues1() std::copy(arr2,arr2+9,a->getPointer()); where=-2; m=a->getMinValue(where); - CPPUNIT_ASSERT_EQUAL(1,where); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),where); CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12); m=a->getMinValue2(ws); CPPUNIT_ASSERT_DOUBLES_EQUAL(-4.56,m,1e-12); @@ -505,12 +506,12 @@ void MEDCouplingBasicsTest3::testFieldDoubleGetMinMaxValues2() f->checkConsistencyLight(); double m=f->getMaxValue(); CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12); - DataArrayInt *ws; + DataArrayIdType *ws; m=f->getMaxValue2(ws); CPPUNIT_ASSERT_DOUBLES_EQUAL(8.71,m,1e-12); CPPUNIT_ASSERT_EQUAL(4,(int)ws->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)ws->getNumberOfComponents()); - const int expected1[4]={0,3,7,17}; + const mcIdType expected1[4]={0,3,7,17}; for(int i=0;i<4;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],ws->getIJ(i,0)); ws->decrRef(); @@ -545,15 +546,15 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() da->decrRef(); m->checkConsistencyLight(); double pos=2.4; - CPPUNIT_ASSERT_EQUAL(0,m->getCellContainingPoint(&pos,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),m->getCellContainingPoint(&pos,1e-12)); pos=3.7; - CPPUNIT_ASSERT_EQUAL(1,m->getCellContainingPoint(&pos,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),m->getCellContainingPoint(&pos,1e-12)); pos=5.9; - CPPUNIT_ASSERT_EQUAL(2,m->getCellContainingPoint(&pos,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),m->getCellContainingPoint(&pos,1e-12)); pos=10.3; - CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),m->getCellContainingPoint(&pos,1e-12)); pos=1.3; - CPPUNIT_ASSERT_EQUAL(-1,m->getCellContainingPoint(&pos,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(-1),m->getCellContainingPoint(&pos,1e-12)); // MEDCouplingUMesh *m2=m->buildUnstructured(); m2->checkConsistencyLight(); @@ -607,7 +608,7 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() f2->decrRef(); // double pos1[3]={5.,30.,2.}; - CPPUNIT_ASSERT_EQUAL(16,m->getCellContainingPoint(pos1,1e-12)); + CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getCellContainingPoint(pos1,1e-12)); // const double pt[3]={2.4,12.7,-3.4}; m->scale(pt,3.7); @@ -622,31 +623,31 @@ void MEDCouplingBasicsTest3::testBuildUnstructuredCMesh1() void MEDCouplingBasicsTest3::testDataArrayIntInvertO2NNO21() { - const int arr1[6]={2,0,4,1,5,3}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType arr1[6]={2,0,4,1,5,3}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(6,1); std::copy(arr1,arr1+6,da->getPointer()); - DataArrayInt *da2=da->invertArrayO2N2N2O(6); + DataArrayIdType *da2=da->invertArrayO2N2N2O(6); CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - const int expected1[6]={1,3,0,5,2,4}; + const mcIdType expected1[6]={1,3,0,5,2,4}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0)); - DataArrayInt *da3=da2->invertArrayN2O2O2N(6); + DataArrayIdType *da3=da2->invertArrayN2O2O2N(6); for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(arr1[i],da3->getIJ(i,0)); da3->decrRef(); da2->decrRef(); da->decrRef(); // - const int arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1}; - da=DataArrayInt::New(); + const mcIdType arr2[10]={3,-1,5,4,-1,0,-1,1,2,-1}; + da=DataArrayIdType::New(); da->alloc(10,1); std::copy(arr2,arr2+10,da->getPointer()); da2=da->invertArrayO2N2N2O(6); CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - const int expected2[10]={5,7,8,0,3,2}; + const mcIdType expected2[10]={5,7,8,0,3,2}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da2->getIJ(i,0)); da3=da2->invertArrayN2O2O2N(10); @@ -667,8 +668,8 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() a1->setInfoOnComponent(1,"bbbb"); a1->setInfoOnComponent(2,"cccc"); a1->setInfoOnComponent(3,"dddd"); - const int arr2[6]={1,2,1,2,0,0}; - std::vector arr2V(arr2,arr2+6); + const mcIdType arr2[6]={1,2,1,2,0,0}; + 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()); @@ -692,15 +693,15 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa"); CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa"); for(int i=0;i<30;i++) - CPPUNIT_ASSERT_EQUAL(int(expected1[i]),a4->getIJ(0,i)); + CPPUNIT_ASSERT_EQUAL((int)expected1[i],a4->getIJ(0,i)); // setSelectedComponents - const int arr3[2]={3,2}; - std::vector arr3V(arr3,arr3+2); + const mcIdType arr3[2]={3,2}; + std::vector arr3V(arr3,arr3+2); DataArrayDouble *a5=static_cast(a1->keepSelectedComponents(arr3V)); a5->setInfoOnComponent(0,"eeee"); a5->setInfoOnComponent(1,"ffff"); - const int arr4[2]={1,2}; - std::vector arr4V(arr4,arr4+2); + const mcIdType arr4[2]={1,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()); @@ -726,14 +727,14 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent1() CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa"); CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa"); for(int i=0;i<30;i++) - CPPUNIT_ASSERT_EQUAL(int(expected2[i]),a4->getIJ(0,i)); + CPPUNIT_ASSERT_EQUAL(expected2[i],(double)a4->getIJ(0,i)); // test of throw - const int arr5[3]={2,3,6}; - const int arr6[3]={2,7,5}; - const int arr7[4]={2,1,4,6}; - std::vector arr5V(arr5,arr5+3); - std::vector arr6V(arr6,arr6+3); - std::vector arr7V(arr7,arr7+4); + const mcIdType arr5[3]={2,3,6}; + const mcIdType arr6[3]={2,7,5}; + const mcIdType arr7[4]={2,1,4,6}; + 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); CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception); @@ -764,8 +765,8 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() f1->setArray(a1); f1->checkConsistencyLight(); // - const int arr2[6]={1,2,1,2,0,0}; - std::vector arr2V(arr2,arr2+6); + const mcIdType arr2[6]={1,2,1,2,0,0}; + std::vector arr2V(arr2,arr2+6); MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V); CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh()); CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME); @@ -786,15 +787,15 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() for(int i=0;i<30;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14); //setSelectedComponents - const int arr3[2]={3,2}; - std::vector arr3V(arr3,arr3+2); + const mcIdType arr3[2]={3,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 int arr4[2]={1,2}; - std::vector arr4V(arr4,arr4+2); + const mcIdType arr4[2]={1,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()); @@ -820,7 +821,7 @@ void MEDCouplingBasicsTest3::testKeepSetSelectedComponent2() void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() { - DataArrayInt *da=DataArrayInt::New(); + DataArrayIdType *da=DataArrayIdType::New(); CPPUNIT_ASSERT_THROW(da->checkAllocated(),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(da->fillWithValue(1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(da->iota(1),INTERP_KERNEL::Exception); @@ -828,7 +829,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() da->fillWithValue(11); //11,11,11,11... da->iota(10); //10,11,12,13... - DataArrayInt *db=DataArrayInt::New(); + DataArrayIdType *db=DataArrayIdType::New(); db->alloc(7,2); DataArrayDouble *dbl2=DataArrayDouble::New(); @@ -859,7 +860,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT(!dbl->isMonotonic(false, 1.1)); CPPUNIT_ASSERT(!dbl->isMonotonic(false, -1.1)); - DataArrayInt *dc=DataArrayInt::New(); + DataArrayIdType *dc=DataArrayIdType::New(); dc->alloc(14,1); DataArrayDouble *dd=DataArrayDouble::New(); @@ -878,7 +879,7 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT_THROW(db->copyStringInfoFrom(*da),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(db->copyStringInfoFrom(*da),INTERP_KERNEL::Exception); - std::vector cIds(2,2); + std::vector cIds(2,2); CPPUNIT_ASSERT_THROW(da->copyPartOfStringInfoFrom(*db,cIds),INTERP_KERNEL::Exception); cIds[0]=1; cIds[0]=-1; @@ -919,9 +920,9 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT_THROW(db->GetNumberOfItemGivenBES(10,9,1,"theMessageInThrow"),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(db->GetNumberOfItemGivenBES(0,1,-1,"theMessageInThrow"),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_EQUAL(10,db->GetNumberOfItemGivenBES(0,10,1,"theMessageInThrow")); - CPPUNIT_ASSERT_EQUAL(5,db->GetNumberOfItemGivenBES(0,10,2,"theMessageInThrow")); - CPPUNIT_ASSERT_EQUAL(6,db->GetNumberOfItemGivenBES(0,11,2,"theMessageInThrow")); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),db->GetNumberOfItemGivenBES(0,10,1,"theMessageInThrow")); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),db->GetNumberOfItemGivenBES(0,10,2,"theMessageInThrow")); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),db->GetNumberOfItemGivenBES(0,11,2,"theMessageInThrow")); //std::cout<<"\n!!!!!!!!!\n"<repr()<<"\n!!!!!!!!!\n"; CPPUNIT_ASSERT(!((da->repr().find("Number of components : 1"))==std::string::npos)); @@ -945,12 +946,12 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT_THROW(dbl->meldWith(dd),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dbl2,da),INTERP_KERNEL::Exception); //dbl dbl2 not have the same number of components - CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dd,da),INTERP_KERNEL::Exception); //da tuple selector DataArrayInt instance not have exactly 2 components + CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dd,da),INTERP_KERNEL::Exception); //da tuple selector DataArrayIdType instance not have exactly 2 components DataArrayDouble *dbl3=DataArrayDouble::New(); dbl3->alloc(6,2); dbl3->fillWithValue(11.); - int tupleId; + mcIdType tupleId; //bad number of components CPPUNIT_ASSERT_THROW(dbl3->getMaxValue(tupleId),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dd->getMaxValue(tupleId),INTERP_KERNEL::Exception); @@ -1023,14 +1024,14 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() void MEDCouplingBasicsTest3::testDAIGetIdsEqual1() { - const int tab1[7]={5,-2,-4,-2,3,2,-2}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType tab1[7]={5,-2,-4,-2,3,2,-2}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(7,1); std::copy(tab1,tab1+7,da->getPointer()); - DataArrayInt *da2=da->findIdsEqual(-2); + DataArrayIdType *da2=da->findIdsEqual(-2); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - const int expected1[3]={1,3,6}; + const mcIdType expected1[3]={1,3,6}; CPPUNIT_ASSERT(std::equal(expected1,expected1+3,da2->getConstPointer())); da2->decrRef(); da->decrRef(); @@ -1038,16 +1039,16 @@ void MEDCouplingBasicsTest3::testDAIGetIdsEqual1() void MEDCouplingBasicsTest3::testDAIGetIdsEqualList1() { - const int tab1[7]={5,-2,-4,-2,3,2,-2}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType tab1[7]={5,-2,-4,-2,3,2,-2}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(7,1); std::copy(tab1,tab1+7,da->getPointer()); - const int tab2[3]={3,-2,0}; - std::vector tab2V(tab2,tab2+3); - DataArrayInt *da2=da->findIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size()); + const mcIdType tab2[3]={3,-2,0}; + std::vector tab2V(tab2,tab2+3); + DataArrayIdType *da2=da->findIdsEqualList(&tab2V[0],&tab2V[0]+tab2V.size()); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - const int expected1[4]={1,3,4,6}; + const mcIdType expected1[4]={1,3,4,6}; CPPUNIT_ASSERT(std::equal(expected1,expected1+4,da2->getConstPointer())); da2->decrRef(); da->decrRef(); @@ -1055,12 +1056,12 @@ void MEDCouplingBasicsTest3::testDAIGetIdsEqualList1() void MEDCouplingBasicsTest3::testDAFromNoInterlace1() { - const int tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType tab1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(5,3); std::copy(tab1,tab1+15,da->getPointer()); - DataArrayInt *da2=da->fromNoInterlace(); - const int expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43}; + DataArrayIdType *da2=da->fromNoInterlace(); + const mcIdType expected1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43}; CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components ! CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer())); @@ -1077,12 +1078,12 @@ void MEDCouplingBasicsTest3::testDAFromNoInterlace1() void MEDCouplingBasicsTest3::testDAToNoInterlace1() { - const int tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType tab1[15]={1,2,3,11,12,13,21,22,23,31,32,33,41,42,43}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(5,3); std::copy(tab1,tab1+15,da->getPointer()); - DataArrayInt *da2=da->toNoInterlace(); - const int expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43}; + DataArrayIdType *da2=da->toNoInterlace(); + const mcIdType expected1[15]={1,11,21,31,41,2,12,22,32,42,3,13,23,33,43}; CPPUNIT_ASSERT_EQUAL(5,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents());// it's not a bug. Avoid to have 1 million components ! CPPUNIT_ASSERT(std::equal(expected1,expected1+15,da2->getConstPointer())); @@ -1099,8 +1100,8 @@ void MEDCouplingBasicsTest3::testDAToNoInterlace1() void MEDCouplingBasicsTest3::testDAIsUniform1() { - const int tab1[5]={1,1,1,1,1}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType tab1[5]={1,1,1,1,1}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(5,1); std::copy(tab1,tab1+5,da->getPointer()); CPPUNIT_ASSERT(da->isUniform(1)); @@ -1161,8 +1162,8 @@ void MEDCouplingBasicsTest3::testDADFromSpherToCart1() void MEDCouplingBasicsTest3::testUnPolyze1() { - const int elts[8]={0,1,2,3,4,5,6,7}; - std::vector eltsV(elts,elts+8); + const mcIdType elts[8]={0,1,2,3,4,5,6,7}; + std::vector eltsV(elts,elts+8); MEDCouplingUMesh *mesh=build3DTargetMesh_1(); mesh->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); mesh->unPolyze(); @@ -1208,7 +1209,7 @@ void MEDCouplingBasicsTest3::testUnPolyze1() void MEDCouplingBasicsTest3::testConvertDegeneratedCells1() { MEDCouplingUMesh *mesh=build3DTargetMesh_1(); - int conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1}; + mcIdType conn[32]={0,1,3,3,9,10,12,12, 0,1,3,4,9,9,9,9, 1,1,1,1,10,12,9,10, 10,11,12,9,1,1,1,1}; mesh->allocateCells(4); mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+8); @@ -1250,24 +1251,24 @@ void MEDCouplingBasicsTest3::testGetNodeIdsNearPoints1() mesh->setCoords(tmp2); tmp2->decrRef(); const double pts[6]={0.2,0.2,0.1,0.3,-0.3,0.7}; - DataArrayInt *c=mesh->getNodeIdsNearPoint(pts,1e-7); + DataArrayIdType *c=mesh->getNodeIdsNearPoint(pts,1e-7); CPPUNIT_ASSERT_EQUAL(3,(int)c->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(4,c->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(9,c->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(11,c->getIJ(2,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),c->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0)); c->decrRef(); - DataArrayInt *cI=0; + DataArrayIdType *cI=0; mesh->getNodeIdsNearPoints(pts,3,1e-7,c,cI); - CPPUNIT_ASSERT_EQUAL(4,(int)cI->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(4,(int)c->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(4,c->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(9,c->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(11,c->getIJ(2,0)); - CPPUNIT_ASSERT_EQUAL(6,c->getIJ(3,0)); - CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(3,cI->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(3,cI->getIJ(2,0)); - CPPUNIT_ASSERT_EQUAL(4,cI->getIJ(3,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),c->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),c->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(11),c->getIJ(2,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),c->getIJ(3,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),cI->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getIJ(2,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),cI->getIJ(3,0)); c->decrRef(); cI->decrRef(); mesh->decrRef(); @@ -1392,17 +1393,17 @@ void MEDCouplingBasicsTest3::testExtrudedMesh5() DataArrayDouble *h=g->fromPolarToCart(); f->setCoords(h); MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1); - CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(52,(int)i->getNumberOfNodes()); bool tmp2; - int tmp3; - DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3); + mcIdType tmp3; + DataArrayIdType *tmp=i->mergeNodes(1e-9,tmp2,tmp3); CPPUNIT_ASSERT(tmp2); - CPPUNIT_ASSERT_EQUAL(37,tmp3); + CPPUNIT_ASSERT_EQUAL(ToIdType(37),tmp3); tmp->decrRef(); i->convertDegeneratedCells(); i->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(36,(int)i->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(37,(int)i->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(12,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3)); CPPUNIT_ASSERT_EQUAL(24,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); const double expected1[3]={0.25,0.75,2.0625}; @@ -1504,12 +1505,12 @@ void MEDCouplingBasicsTest3::testExtrudedMesh7() DataArrayDouble *h=g->fromPolarToCart(); f->setCoords(h); MEDCouplingUMesh *i=c->buildExtrudedMesh(f,1); - CPPUNIT_ASSERT_EQUAL(52,i->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(52,(int)i->getNumberOfNodes()); bool tmp2; - int tmp3; - DataArrayInt *tmp=i->mergeNodes(1e-9,tmp2,tmp3); + mcIdType tmp3; + DataArrayIdType *tmp=i->mergeNodes(1e-9,tmp2,tmp3); CPPUNIT_ASSERT(tmp2); - CPPUNIT_ASSERT_EQUAL(37,tmp3); + CPPUNIT_ASSERT_EQUAL(ToIdType(37),tmp3); tmp->decrRef(); i->convertDegeneratedCells(); const double vec1[3]={10.,0.,0.}; @@ -1521,7 +1522,7 @@ void MEDCouplingBasicsTest3::testExtrudedMesh7() MEDCouplingFieldDouble *f2=i3->getMeasureField(true); tmp=i->mergeNodes(1e-9,tmp2,tmp3); CPPUNIT_ASSERT(tmp2); - CPPUNIT_ASSERT_EQUAL(444,tmp3); + CPPUNIT_ASSERT_EQUAL(ToIdType(444),tmp3); tmp->decrRef(); const double expected1[36]={1.327751058489274, 4.2942574094314701, 13.024068164857139, 1.3069177251569044, 4.1484240761012954, 12.297505664866796, 1.270833333332571, 3.8958333333309674, 11.039062499993179, 1.2291666666659207, 3.6041666666644425, 9.585937499993932, 1.1930822748415895, 3.3515759238941376, 8.3274943351204556, 1.1722489415082769, 3.2057425905609289, 7.6009318351210622, 1.1722489415082862, 3.2057425905609884, 7.6009318351213713, 1.1930822748416161, 3.3515759238943001, 8.3274943351212727, 1.2291666666659564, 3.6041666666646734, 9.5859374999950777, 1.2708333333326081, 3.8958333333311868, 11.039062499994293, 1.3069177251569224, 4.1484240761014384, 12.297505664867627, 1.3277510584902354, 4.2942574094346071, 13.024068164866796}; int kk=0; @@ -1546,13 +1547,13 @@ void MEDCouplingBasicsTest3::testExtrudedMesh7() void MEDCouplingBasicsTest3::testSimplexize1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - std::vector v(1); + std::vector v(1); v[0]=3; m->convertToPolyTypes(&v[0],&v[0]+v.size()); - DataArrayInt *da=m->simplexize(0); + DataArrayIdType *da=m->simplexize(0); CPPUNIT_ASSERT_EQUAL(7,(int)da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); - const int expected2[7]={0,0,1,2,3,4,4}; + const mcIdType expected2[7]={0,0,1,2,3,4,4}; for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da->getIJ(i,0)); m->checkConsistencyLight(); @@ -1608,7 +1609,7 @@ void MEDCouplingBasicsTest3::testSimplexize1() void MEDCouplingBasicsTest3::testSimplexize2() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - std::vector v(1); + std::vector v(1); v[0]=3; m->convertToPolyTypes(&v[0],&v[0]+v.size()); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); @@ -1688,7 +1689,7 @@ void MEDCouplingBasicsTest3::testDAMeld1() CPPUNIT_ASSERT(da4->getInfoOnComponent(4)=="c2da3"); for(int i=0;i<35;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],da4->getIJ(0,i),1e-10); - // test of static method DataArrayInt::meld + // test of static method DataArrayIdType::meld dai1=da1C->convertToIntArr(); DataArrayInt *dai4=DataArrayInt::Meld(dai1,dai3); CPPUNIT_ASSERT_EQUAL(5,(int)dai4->getNumberOfComponents()); @@ -1699,7 +1700,7 @@ void MEDCouplingBasicsTest3::testDAMeld1() CPPUNIT_ASSERT(dai4->getInfoOnComponent(3)=="c1da3"); CPPUNIT_ASSERT(dai4->getInfoOnComponent(4)=="c2da3"); for(int i=0;i<35;i++) - CPPUNIT_ASSERT_EQUAL((int)expected1[i],dai4->getIJ(0,i)); + CPPUNIT_ASSERT_EQUAL(expected1[i],(double)dai4->getIJ(0,i)); // dai4->decrRef(); da4->decrRef(); @@ -1781,9 +1782,9 @@ void MEDCouplingBasicsTest3::testMergeNodes2() tmp[1]=m2; MEDCouplingUMesh *m3=MEDCouplingUMesh::MergeUMeshes(tmp); bool b; - int newNbOfNodes; - DataArrayInt *da=m3->mergeNodesCenter(0.01,b,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL(9,m3->getNumberOfNodes()); + mcIdType newNbOfNodes; + DataArrayIdType *da=m3->mergeNodesCenter(0.01,b,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNumberOfNodes()); const double expected1[18]={-0.299,-0.3, 0.201,-0.3, 0.701,-0.3, -0.299,0.2, 0.201,0.2, 0.701,0.2, -0.299,0.7, 0.201,0.7, 0.701,0.7}; for(int i=0;i<18;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],m3->getCoords()->getIJ(0,i),1e-13); @@ -1836,14 +1837,14 @@ void MEDCouplingBasicsTest3::testMergeField2() void MEDCouplingBasicsTest3::testDAIBuildComplement1() { - DataArrayInt *a=DataArrayInt::New(); - const int tab[4]={3,1,7,8}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType tab[4]={3,1,7,8}; a->alloc(4,1); std::copy(tab,tab+4,a->getPointer()); - DataArrayInt *b=a->buildComplement(12); + DataArrayIdType *b=a->buildComplement(12); CPPUNIT_ASSERT_EQUAL(8,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents()); - const int expected1[8]={0,2,4,5,6,9,10,11}; + const mcIdType expected1[8]={0,2,4,5,6,9,10,11}; for(int i=0;i<8;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i)); b->decrRef(); @@ -1852,18 +1853,18 @@ void MEDCouplingBasicsTest3::testDAIBuildComplement1() void MEDCouplingBasicsTest3::testDAIBuildUnion1() { - DataArrayInt *a=DataArrayInt::New(); - const int tab1[4]={3,1,7,8}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType tab1[4]={3,1,7,8}; a->alloc(4,1); std::copy(tab1,tab1+4,a->getPointer()); - DataArrayInt *c=DataArrayInt::New(); - const int tab2[5]={5,3,0,18,8}; + DataArrayIdType *c=DataArrayIdType::New(); + const mcIdType tab2[5]={5,3,0,18,8}; c->alloc(5,1); std::copy(tab2,tab2+5,c->getPointer()); - DataArrayInt *b=a->buildUnion(c); + DataArrayIdType *b=a->buildUnion(c); CPPUNIT_ASSERT_EQUAL(7,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents()); - const int expected1[7]={0,1,3,5,7,8,18}; + const mcIdType expected1[7]={0,1,3,5,7,8,18}; for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i)); c->decrRef(); @@ -1873,18 +1874,18 @@ void MEDCouplingBasicsTest3::testDAIBuildUnion1() void MEDCouplingBasicsTest3::testDAIBuildIntersection1() { - DataArrayInt *a=DataArrayInt::New(); - const int tab1[4]={3,1,7,8}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType tab1[4]={3,1,7,8}; a->alloc(4,1); std::copy(tab1,tab1+4,a->getPointer()); - DataArrayInt *c=DataArrayInt::New(); - const int tab2[5]={5,3,0,18,8}; + DataArrayIdType *c=DataArrayIdType::New(); + const mcIdType tab2[5]={5,3,0,18,8}; c->alloc(5,1); std::copy(tab2,tab2+5,c->getPointer()); - DataArrayInt *b=a->buildIntersection(c); + DataArrayIdType *b=a->buildIntersection(c); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents()); - const int expected1[2]={3,8}; + const mcIdType expected1[2]={3,8}; for(int i=0;i<2;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i)); c->decrRef(); @@ -1894,14 +1895,14 @@ void MEDCouplingBasicsTest3::testDAIBuildIntersection1() void MEDCouplingBasicsTest3::testDAIDeltaShiftIndex1() { - DataArrayInt *a=DataArrayInt::New(); - const int tab[7]={1,3,6,7,7,9,15}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType tab[7]={1,3,6,7,7,9,15}; a->alloc(7,1); std::copy(tab,tab+7,a->getPointer()); - DataArrayInt *b=a->deltaShiftIndex(); + DataArrayIdType *b=a->deltaShiftIndex(); CPPUNIT_ASSERT_EQUAL(6,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents()); - const int expected1[6]={2,3,1,0,2,6}; + const mcIdType expected1[6]={2,3,1,0,2,6}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],b->getIJ(0,i)); b->decrRef(); @@ -1917,7 +1918,7 @@ void MEDCouplingBasicsTest3::testDaDoubleSelectByTupleIdSafe1() const double arr1[14]={1.1,11.1,2.1,12.1,3.1,13.1,4.1,14.1,5.1,15.1,6.1,16.1,7.1,17.1}; std::copy(arr1,arr1+14,a->getPointer()); // - const int arr2[7]={4,2,0,6,5}; + const mcIdType arr2[7]={4,2,0,6,5}; DataArrayDouble *b=a->selectByTupleIdSafe(arr2,arr2+5); CPPUNIT_ASSERT_EQUAL(5,(int)b->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); @@ -1926,25 +1927,25 @@ void MEDCouplingBasicsTest3::testDaDoubleSelectByTupleIdSafe1() const double expected1[10]={5.1,15.1,3.1,13.1,1.1,11.1,7.1,17.1,6.1,16.1}; for(int i=0;i<10;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],b->getIJ(0,i),1e-14); - const int arr4[5]={4,-1,0,6,5}; + const mcIdType arr4[5]={4,-1,0,6,5}; CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception); - const int arr5[5]={4,2,0,6,7}; + const mcIdType arr5[5]={4,2,0,6,7}; CPPUNIT_ASSERT_THROW(a->selectByTupleIdSafe(arr5,arr5+5),INTERP_KERNEL::Exception); b->decrRef(); a->decrRef(); // - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(7,2); c->setInfoOnComponent(0,"toto"); c->setInfoOnComponent(1,"tata"); - const int arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType arr3[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; std::copy(arr3,arr3+14,c->getPointer()); - DataArrayInt *d=c->selectByTupleIdSafe(arr2,arr2+5); + DataArrayIdType *d=c->selectByTupleIdSafe(arr2,arr2+5); CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(0))=="toto"); CPPUNIT_ASSERT(std::string(d->getInfoOnComponent(1))=="tata"); - const int expected2[10]={5,15,3,13,1,11,7,17,6,16}; + const mcIdType expected2[10]={5,15,3,13,1,11,7,17,6,16}; for(int i=0;i<10;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d->getIJ(0,i)); CPPUNIT_ASSERT_THROW(c->selectByTupleIdSafe(arr4,arr4+5),INTERP_KERNEL::Exception); @@ -1956,9 +1957,9 @@ void MEDCouplingBasicsTest3::testDaDoubleSelectByTupleIdSafe1() void MEDCouplingBasicsTest3::testAreCellsIncludedIn1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - const int pt[2]={1,3}; + const mcIdType pt[2]={1,3}; MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->buildPartOfMySelf(pt,pt+2,true); - DataArrayInt *tmp; + DataArrayIdType *tmp; CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp)); CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)tmp->getNumberOfComponents()); @@ -1973,19 +1974,19 @@ void MEDCouplingBasicsTest3::testAreCellsIncludedIn1() void MEDCouplingBasicsTest3::testDAIBuildSubstraction1() { - DataArrayInt *a=DataArrayInt::New(); - const int aa[]={2,3,6,8,9}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType aa[]={2,3,6,8,9}; a->alloc(5,1); std::copy(aa,aa+5,a->getPointer()); - DataArrayInt *b=DataArrayInt::New(); - const int bb[]={1,3,5,9,11}; + DataArrayIdType *b=DataArrayIdType::New(); + const mcIdType bb[]={1,3,5,9,11}; b->alloc(5,1); std::copy(bb,bb+5,b->getPointer()); // - DataArrayInt *c=a->buildSubstraction(b); + DataArrayIdType *c=a->buildSubstraction(b); CPPUNIT_ASSERT_EQUAL(3,(int)c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents()); - const int expected1[3]={2,6,8}; + const mcIdType expected1[3]={2,6,8}; CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); // c->decrRef(); @@ -1996,10 +1997,10 @@ void MEDCouplingBasicsTest3::testDAIBuildSubstraction1() void MEDCouplingBasicsTest3::testBuildOrthogonalField2() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - DataArrayInt *d1=DataArrayInt::New(); - DataArrayInt *d2=DataArrayInt::New(); - DataArrayInt *d3=DataArrayInt::New(); - DataArrayInt *d4=DataArrayInt::New(); + DataArrayIdType *d1=DataArrayIdType::New(); + DataArrayIdType *d2=DataArrayIdType::New(); + DataArrayIdType *d3=DataArrayIdType::New(); + DataArrayIdType *d4=DataArrayIdType::New(); MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4); // MEDCouplingFieldDouble *f1=m1->buildOrthogonalField(); @@ -2023,7 +2024,7 @@ void MEDCouplingBasicsTest3::testBuildOrthogonalField2() void MEDCouplingBasicsTest3::testUMInsertNextCell1() { double targetCoords[18]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7 }; - int targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->allocateCells(5); CPPUNIT_ASSERT_THROW(targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn),INTERP_KERNEL::Exception); @@ -2049,10 +2050,10 @@ void MEDCouplingBasicsTest3::testUMInsertNextCell1() void MEDCouplingBasicsTest3::testFieldOperatorDivDiffComp1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - DataArrayInt *d1=DataArrayInt::New(); - DataArrayInt *d2=DataArrayInt::New(); - DataArrayInt *d3=DataArrayInt::New(); - DataArrayInt *d4=DataArrayInt::New(); + DataArrayIdType *d1=DataArrayIdType::New(); + DataArrayIdType *d2=DataArrayIdType::New(); + DataArrayIdType *d3=DataArrayIdType::New(); + DataArrayIdType *d4=DataArrayIdType::New(); MEDCouplingUMesh *m1=m->buildDescendingConnectivity(d1,d2,d3,d4); // MEDCouplingFieldDouble *f1=m1->buildOrthogonalField(); @@ -2089,58 +2090,58 @@ void MEDCouplingBasicsTest3::testFieldOperatorDivDiffComp1() void MEDCouplingBasicsTest3::testDARearrange1() { - DataArrayInt *da1=DataArrayInt::New(); + DataArrayIdType *da1=DataArrayIdType::New(); da1->alloc(12,1); da1->iota(0); - const int *ptr=da1->getConstPointer(); + const mcIdType *ptr=da1->getConstPointer(); // - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(12,(int)da1->getNumberOfTuples()); da1->rearrange(4); CPPUNIT_ASSERT(ptr==da1->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfTuples()); - for(int i=0;i<12;i++) + for(mcIdType i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i)); // da1->rearrange(6); CPPUNIT_ASSERT(ptr==da1->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples()); - for(int i=0;i<12;i++) + for(mcIdType i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i)); // CPPUNIT_ASSERT_THROW(da1->rearrange(7),INTERP_KERNEL::Exception); // da1->rearrange(12); CPPUNIT_ASSERT(ptr==da1->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(12,(int)da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfTuples()); - for(int i=0;i<12;i++) + for(mcIdType i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i)); // da1->rearrange(3); CPPUNIT_ASSERT(ptr==da1->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da1->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples()); - for(int i=0;i<12;i++) + for(mcIdType i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(i,da1->getIJ(0,i)); //double MCAuto da2=da1->convertToDblArr(); da1->decrRef(); const double *ptr2=da2->getConstPointer(); // - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); da2->rearrange(4); CPPUNIT_ASSERT(ptr2==da2->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfTuples()); for(int i=0;i<12;i++) @@ -2148,7 +2149,7 @@ void MEDCouplingBasicsTest3::testDARearrange1() // da2->rearrange(6); CPPUNIT_ASSERT(ptr2==da2->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(2,(int)da2->getNumberOfTuples()); for(int i=0;i<12;i++) @@ -2158,7 +2159,7 @@ void MEDCouplingBasicsTest3::testDARearrange1() // da2->rearrange(1); CPPUNIT_ASSERT(ptr2==da2->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(12,(int)da2->getNumberOfTuples()); for(int i=0;i<12;i++) @@ -2166,7 +2167,7 @@ void MEDCouplingBasicsTest3::testDARearrange1() // da2->rearrange(3); CPPUNIT_ASSERT(ptr2==da2->getConstPointer()); - CPPUNIT_ASSERT_EQUAL((std::size_t)12,da2->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(12),da2->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); for(int i=0;i<12;i++) @@ -2175,12 +2176,12 @@ void MEDCouplingBasicsTest3::testDARearrange1() void MEDCouplingBasicsTest3::testGetDifferentValues1() { - DataArrayInt *da1=DataArrayInt::New(); - const int arr[12]={1,2,3,2,2,3,5,1,5,5,2,2}; + DataArrayIdType *da1=DataArrayIdType::New(); + const mcIdType arr[12]={1,2,3,2,2,3,5,1,5,5,2,2}; da1->alloc(4,3); std::copy(arr,arr+12,da1->getPointer()); - DataArrayInt *s=da1->getDifferentValues(); - const int expected1[4]={1,2,3,5}; + DataArrayIdType *s=da1->getDifferentValues(); + const mcIdType expected1[4]={1,2,3,5}; CPPUNIT_ASSERT_EQUAL(4,(int)s->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected1,expected1+4,s->begin())); da1->decrRef(); @@ -2189,16 +2190,16 @@ void MEDCouplingBasicsTest3::testGetDifferentValues1() void MEDCouplingBasicsTest3::testDAIBuildPermutationArr1() { - DataArrayInt *a=DataArrayInt::New(); - const int vala[5]={4,5,6,7,8}; + DataArrayIdType *a=DataArrayIdType::New(); + const mcIdType vala[5]={4,5,6,7,8}; a->alloc(5,1); std::copy(vala,vala+5,a->getPointer()); - DataArrayInt *b=DataArrayInt::New(); - const int valb[5]={5,4,8,6,7}; + DataArrayIdType *b=DataArrayIdType::New(); + const mcIdType valb[5]={5,4,8,6,7}; b->alloc(5,1); std::copy(valb,valb+5,b->getPointer()); - DataArrayInt *c=a->buildPermutationArr(*b); - const int expect1[5]={1,0,4,2,3}; + DataArrayIdType *c=a->buildPermutationArr(*b); + const mcIdType expect1[5]={1,0,4,2,3}; CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer())); @@ -2212,11 +2213,11 @@ void MEDCouplingBasicsTest3::testDAIBuildPermutationArr1() CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b)); c->decrRef(); c=a->buildPermutationArr(*b); - const int expect2[5]={1,3,4,2,3}; + const mcIdType expect2[5]={1,3,4,2,3}; CPPUNIT_ASSERT(std::equal(expect2,expect2+5,c->getConstPointer())); MCAuto d=b->convertToDblArr(); b->sort(); - const int expect3[5]={4,4,5,6,8}; + const mcIdType expect3[5]={4,4,5,6,8}; CPPUNIT_ASSERT(std::equal(expect3,expect3+5,b->getConstPointer())); d->sort(); CPPUNIT_ASSERT_EQUAL(5,(int)d->getNumberOfTuples()); @@ -2238,7 +2239,7 @@ void MEDCouplingBasicsTest3::testAreCellsIncludedIn2() CPPUNIT_ASSERT_EQUAL(3,m2->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,m2->getMeshDimension()); m2->setName(myName); - DataArrayInt *tmp; + DataArrayIdType *tmp; CPPUNIT_ASSERT(m->areCellsIncludedIn(m2,0,tmp)); CPPUNIT_ASSERT(std::string(myName)==tmp->getName()); CPPUNIT_ASSERT_EQUAL(0,(int)tmp->getNumberOfTuples()); @@ -2251,7 +2252,7 @@ void MEDCouplingBasicsTest3::testAreCellsIncludedIn2() void MEDCouplingBasicsTest3::testUMeshGetPartBarycenterAndOwner1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - const int part[3]={1,0,4}; + const mcIdType part[3]={1,0,4}; DataArrayDouble *b=m1->getPartBarycenterAndOwner(part,part+3); CPPUNIT_ASSERT_EQUAL(2,(int)b->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)b->getNumberOfTuples()); @@ -2265,7 +2266,7 @@ void MEDCouplingBasicsTest3::testUMeshGetPartBarycenterAndOwner1() void MEDCouplingBasicsTest3::testUMeshGetPartMeasureField1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - const int part[3]={1,0,4}; + const mcIdType part[3]={1,0,4}; DataArrayDouble *b=m1->getPartMeasureField(true,part,part+3); CPPUNIT_ASSERT_EQUAL(1,(int)b->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)b->getNumberOfTuples()); @@ -2280,7 +2281,7 @@ void MEDCouplingBasicsTest3::testUMeshBuildPartOrthogonalField1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); m1->changeSpaceDimension(3); - const int part[3]={1,0,4}; + const mcIdType part[3]={1,0,4}; MEDCouplingFieldDouble *b=m1->buildPartOrthogonalField(part,part+3); CPPUNIT_ASSERT_EQUAL(3,(int)b->getArray()->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)b->getArray()->getNumberOfTuples()); @@ -2294,16 +2295,16 @@ void MEDCouplingBasicsTest3::testUMeshBuildPartOrthogonalField1() void MEDCouplingBasicsTest3::testUMeshGetTypesOfPart1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - const int part1[]={0,3,4}; + const mcIdType part1[]={0,3,4}; std::set s; s=m1->getTypesOfPart(part1,part1+3); CPPUNIT_ASSERT(s.size()==1); CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_QUAD4); - const int part2[]={2,2,2,1}; + const mcIdType part2[]={2,2,2,1}; s=m1->getTypesOfPart(part2,part2+4); CPPUNIT_ASSERT(s.size()==1); CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3); - const int part3[]={3,2,1}; + const mcIdType part3[]={3,2,1}; s=m1->getTypesOfPart(part3,part3+3); CPPUNIT_ASSERT(s.size()==2); CPPUNIT_ASSERT(*s.begin()==INTERP_KERNEL::NORM_TRI3); @@ -2314,26 +2315,26 @@ void MEDCouplingBasicsTest3::testUMeshGetTypesOfPart1() void MEDCouplingBasicsTest3::testUMeshKeepCellIdsByType1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - const int part1[3]={0,3,4}; - DataArrayInt *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3); + const mcIdType part1[3]={0,3,4}; + DataArrayIdType *a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part1,part1+3); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(0,(int)a->getNumberOfTuples()); a->decrRef(); // - const int part2[5]={3,2,0,2,4}; + const mcIdType part2[5]={3,2,0,2,4}; a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_TRI3,part2,part2+5); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(2,(int)a->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(2,a->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(2,a->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)a->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)a->getIJ(1,0)); a->decrRef(); // a=m1->keepCellIdsByType(INTERP_KERNEL::NORM_QUAD4,part2,part2+5); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(3,(int)a->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(3,a->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(0,a->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(4,a->getIJ(2,0)); + CPPUNIT_ASSERT_EQUAL(3,(int)a->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(0,(int)a->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(4,(int)a->getIJ(2,0)); // a->decrRef(); m1->decrRef(); @@ -2341,24 +2342,24 @@ void MEDCouplingBasicsTest3::testUMeshKeepCellIdsByType1() void MEDCouplingBasicsTest3::testDAIAggregateMulti1() { - DataArrayInt *a=DataArrayInt::New(); + DataArrayIdType *a=DataArrayIdType::New(); a->setName("aa"); a->alloc(4,1); a->iota(0); a->rearrange(2); - DataArrayInt *b=DataArrayInt::New(); + DataArrayIdType *b=DataArrayIdType::New(); b->setName("bb"); b->alloc(6,1); b->iota(0); b->rearrange(2); // - std::vector v(2); + std::vector v(2); v[0]=a; v[1]=b; - DataArrayInt *c=DataArrayInt::Aggregate(v); + DataArrayIdType *c=DataArrayIdType::Aggregate(v); CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)c->getNumberOfComponents()); CPPUNIT_ASSERT(c->getName()=="aa"); - const int expect1[10]={0,1,2,3,0,1,2,3,4,5}; + const mcIdType expect1[10]={0,1,2,3,0,1,2,3,4,5}; for(int i=0;i<10;i++) CPPUNIT_ASSERT_EQUAL(expect1[i],c->getIJ(0,i)); // @@ -2373,9 +2374,9 @@ void MEDCouplingBasicsTest3::testMergeUMeshes2() MEDCouplingUMesh *m2=build3DSurfTargetMesh_1(); MEDCouplingUMesh *m3=build3DSurfTargetMesh_1(); // - const int vec1[3]={0,2,3}; + const mcIdType vec1[3]={0,2,3}; MEDCouplingUMesh *m2_2=(MEDCouplingUMesh *)m2->buildPartOfMySelf(vec1,vec1+3,false); - const int vec2[2]={1,1}; + const mcIdType vec2[2]={1,1}; MEDCouplingUMesh *m3_2=(MEDCouplingUMesh *)m3->buildPartOfMySelf(vec2,vec2+2,false); // std::vector ms(3); @@ -2386,32 +2387,32 @@ void MEDCouplingBasicsTest3::testMergeUMeshes2() MEDCouplingUMesh *m4=MEDCouplingUMesh::MergeUMeshes(ms); m4->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(10,(int)m4->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(20,m4->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(45,m4->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(20,(int)m4->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(45,(int)m4->getNodalConnectivityArrayLen()); // MEDCouplingMesh *m4bis=MEDCouplingMesh::MergeMeshes(ms2); CPPUNIT_ASSERT(m4->isEqual(m4bis,1e-12)); m4bis->decrRef(); // - const int vec3[5]={0,1,2,3,4}; + const mcIdType vec3[5]={0,1,2,3,4}; 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 int vec4[3]={5,6,7}; + const mcIdType vec4[3]={5,6,7}; MEDCouplingUMesh *m4_2=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec4,vec4+3,false); - DataArrayInt *cellCor=0; - DataArrayInt *nodeCor=0; + DataArrayIdType *cellCor=0; + DataArrayIdType *nodeCor=0; m4_2->checkGeoEquivalWith(m2_2,10,1e-12,cellCor,nodeCor); CPPUNIT_ASSERT(cellCor==0); CPPUNIT_ASSERT(nodeCor==0); m4_2->decrRef(); // - const int vec5[2]={8,9}; + const mcIdType vec5[2]={8,9}; MEDCouplingUMesh *m4_3=(MEDCouplingUMesh *)m4->buildPartOfMySelf(vec5,vec5+2,false); CPPUNIT_ASSERT_EQUAL(2,(int)m4_3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(3,m4_3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(3,(int)m4_3->getNumberOfNodes()); m3_2->zipCoords(); m4_3->setName(m3_2->getName().c_str()); CPPUNIT_ASSERT(m4_3->isEqual(m3_2,1e-12)); @@ -2434,7 +2435,7 @@ void MEDCouplingBasicsTest3::testBuild0DMeshFromCoords1() std::copy(sourceCoords,sourceCoords+12,coo->getPointer()); MEDCouplingUMesh *m=MEDCouplingUMesh::Build0DMeshFromCoords(coo); m->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(4,m->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(4,(int)m->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(3,m->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(0,m->getMeshDimension()); @@ -2443,10 +2444,10 @@ void MEDCouplingBasicsTest3::testBuild0DMeshFromCoords1() CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_POINT1,*types.begin()); for(int i=0;i<4;i++) { - std::vector conn; + std::vector conn; m->getNodeIdsOfCell(i,conn); CPPUNIT_ASSERT_EQUAL(1,(int)conn.size()); - CPPUNIT_ASSERT_EQUAL(i,conn[0]); + CPPUNIT_ASSERT_EQUAL(i,(int)conn[0]); CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POINT1==m->getTypeOfCell(i)); } CPPUNIT_ASSERT(std::string(m->getName())=="My0D"); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index 550dfd02e..7eb6e1364 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -160,30 +160,30 @@ void MEDCouplingBasicsTest4::testFieldOverTime1() void MEDCouplingBasicsTest4::testDAICheckAndPreparePermutation1() { - const int vals1[]={9,10,0,6,4,11,3,7}; - const int expect1[]={5,6,0,3,2,7,1,4}; - const int vals2[]={9,10,0,6,10,11,3,7}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType vals1[]={9,10,0,6,4,11,3,7}; + const mcIdType expect1[]={5,6,0,3,2,7,1,4}; + const mcIdType vals2[]={9,10,0,6,10,11,3,7}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(8,1); std::copy(vals1,vals1+8,da->getPointer()); - DataArrayInt *da2=da->checkAndPreparePermutation(); - CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); + DataArrayIdType *da2=da->checkAndPreparePermutation(); + CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); for(int i=0;i<8;i++) CPPUNIT_ASSERT_EQUAL(expect1[i],da2->getIJ(i,0)); da2->decrRef(); da->decrRef(); // - da=DataArrayInt::New(); + da=DataArrayIdType::New(); da->alloc(8,1); da->iota(0); da2=da->checkAndPreparePermutation(); - CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); CPPUNIT_ASSERT(da2->isIota(8)); da2->decrRef(); da->decrRef(); // - da=DataArrayInt::New(); + da=DataArrayIdType::New(); da->alloc(8,1); std::copy(vals2,vals2+8,da->getPointer()); CPPUNIT_ASSERT_THROW(da->checkAndPreparePermutation(),INTERP_KERNEL::Exception); @@ -192,14 +192,14 @@ void MEDCouplingBasicsTest4::testDAICheckAndPreparePermutation1() void MEDCouplingBasicsTest4::testDAIChangeSurjectiveFormat1() { - const int vals1[8]={0,3,2,3,2,2,1,2}; - const int expected1[5]={0,1,2,6,8}; - const int expected2[8]={0, 6, 2,4,5,7, 1,3}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType vals1[8]={0,3,2,3,2,2,1,2}; + const mcIdType expected1[5]={0,1,2,6,8}; + const mcIdType expected2[8]={0, 6, 2,4,5,7, 1,3}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(8,1); std::copy(vals1,vals1+8,da->getPointer()); // - DataArrayInt *da2,*da2I; + DataArrayIdType *da2,*da2I; da->changeSurjectiveFormat(4,da2,da2I); CPPUNIT_ASSERT_EQUAL(5,(int)da2I->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples()); @@ -216,18 +216,18 @@ void MEDCouplingBasicsTest4::testDAIChangeSurjectiveFormat1() void MEDCouplingBasicsTest4::testUMeshGetCellIdsLyingOnNodes1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - const int nodeIds1[5]={1,2,3,4,6}; - const int nodeIds2[2]={6,7}; - DataArrayInt *da=m->getCellIdsLyingOnNodes(nodeIds1,nodeIds1+5,true); - CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(1,da->getIJ(0,0)); + const mcIdType nodeIds1[5]={1,2,3,4,6}; + const mcIdType nodeIds2[2]={6,7}; + DataArrayIdType *da=m->getCellIdsLyingOnNodes(nodeIds1,nodeIds1+5,true); + CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(1,(int)da->getIJ(0,0)); da->decrRef(); da=m->getCellIdsLyingOnNodes(nodeIds2,nodeIds2+2,false); - CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(3,da->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(4,da->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(3,(int)da->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(4,(int)da->getIJ(1,0)); da->decrRef(); // m->decrRef(); @@ -236,7 +236,7 @@ void MEDCouplingBasicsTest4::testUMeshGetCellIdsLyingOnNodes1() void MEDCouplingBasicsTest4::testUMeshFindCellIdsOnBoundary1() { MEDCouplingUMesh *m=build3DSurfTargetMesh_1(); - DataArrayInt *da5=m->findCellIdsOnBoundary(); + DataArrayIdType *da5=m->findCellIdsOnBoundary(); CPPUNIT_ASSERT(da5->isIota(5)); // da5->decrRef(); @@ -406,8 +406,8 @@ void MEDCouplingBasicsTest4::testFillFromAnalyticTwo1() CPPUNIT_ASSERT_DOUBLES_EQUAL(3.4,f1->getTime(a,b),1.e-14); CPPUNIT_ASSERT_EQUAL(5,a); CPPUNIT_ASSERT_EQUAL(6,b); CPPUNIT_ASSERT_EQUAL(std::string(f1->getTimeUnit()),std::string("us")); - CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)f1->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(9,(int)f1->getNumberOfTuples()); const double expected1[9]={0.2, 0.7, 1.2, 0.7, 1.2, 1.7, 1.2, 1.7, 2.2}; for(int i=0;i<9;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f1->getArray()->getIJ(0,i),1e-12); @@ -664,7 +664,7 @@ void MEDCouplingBasicsTest4::testP2Localization1() { MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2",2); const double coords[12]={0.,2.,3.5,0.,4.5,1.5,1.2,0.32,3.4,1.,2.1,2.4}; - const int conn[6]={0,1,2,3,4,5}; + const mcIdType conn[6]={0,1,2,3,4,5}; DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(6,2); std::copy(coords,coords+12,coo->getPointer()); @@ -698,7 +698,7 @@ void MEDCouplingBasicsTest4::testP2Localization2() { MEDCouplingUMesh *m=MEDCouplingUMesh::New("testP2_2",3); const double coords[30]={0.33312787792955395, -0.35155740179580952, -0.03567564825034563, 1.307146326477638, -0.57234557776250305, -0.08608044208272235, 0.5551834466499993, 0.62324964668794192, -0.014638951108536295, 0.37761817224442129, -0.38324019806913578, 0.96283164472856886, 0.79494856035658679, -0.40628057809270046, 0.0021004190225864614, 1.023740446371799, 0.07665912970471335, -0.072889657161871096, 0.54564584619517376, 0.11132872093429744, 0.039647326652013051, 0.27164784387819052, -0.42018012100866675, 0.46563376500745146, 0.89501965094896418, -0.56148455362735061, 0.43337469695473035, 0.49118025152924394, 0.093884938060727313, 0.47216346905220891}; - const int conn[10]={0,1,2,3,4,5,6,7,8,9}; + const mcIdType conn[10]={0,1,2,3,4,5,6,7,8,9}; DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(10,3); std::copy(coords,coords+30,coo->getPointer()); @@ -734,7 +734,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME); f->setMesh(m); DataArrayDouble *arr=DataArrayDouble::New(); - int nbOfCells=m->getNumberOfCells(); + std::size_t nbOfCells=m->getNumberOfCells(); arr->alloc(nbOfCells,3); f->setArray(arr); arr->decrRef(); @@ -753,7 +753,7 @@ void MEDCouplingBasicsTest4::testGetValueOn2() f=MEDCouplingFieldDouble::New(ON_NODES,NO_TIME); f->setMesh(m); arr=DataArrayDouble::New(); - int nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); arr->alloc(nbOfNodes,3); f->setArray(arr); arr->decrRef(); @@ -775,25 +775,25 @@ void MEDCouplingBasicsTest4::testGetValueOn2() void MEDCouplingBasicsTest4::testDAIGetIdsNotEqual1() { - DataArrayInt *d=DataArrayInt::New(); - const int vals1[10]={2,3,5,6,8,5,5,6,1,-5}; + DataArrayIdType *d=DataArrayIdType::New(); + const mcIdType vals1[10]={2,3,5,6,8,5,5,6,1,-5}; d->alloc(10,1); std::copy(vals1,vals1+10,d->getPointer()); - DataArrayInt *d2=d->findIdsNotEqual(5); + DataArrayIdType *d2=d->findIdsNotEqual(5); CPPUNIT_ASSERT_EQUAL(7,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)d2->getNumberOfComponents()); - const int expected1[7]={0,1,3,4,7,8,9}; + const mcIdType expected1[7]={0,1,3,4,7,8,9}; for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],d2->getIJ(0,i)); d->rearrange(2); CPPUNIT_ASSERT_THROW(d->findIdsNotEqual(5),INTERP_KERNEL::Exception); - const int vals2[3]={-4,5,6}; - std::vector vals3(vals2,vals2+3); + const mcIdType vals2[3]={-4,5,6}; + std::vector vals3(vals2,vals2+3); d->rearrange(1); - DataArrayInt *d3=d->findIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size()); + DataArrayIdType *d3=d->findIdsNotEqualList(&vals3[0],&vals3[0]+vals3.size()); CPPUNIT_ASSERT_EQUAL(5,(int)d3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)d3->getNumberOfComponents()); - const int expected2[5]={0,1,4,8,9}; + const mcIdType expected2[5]={0,1,4,8,9}; for(int i=0;i<5;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],d3->getIJ(0,i)); d3->decrRef(); @@ -803,9 +803,9 @@ void MEDCouplingBasicsTest4::testDAIGetIdsNotEqual1() void MEDCouplingBasicsTest4::testDAIComputeOffsets1() { - DataArrayInt *d=DataArrayInt::New(); - const int vals1[6]={3,5,1,2,0,8}; - const int expected1[6]={0,3,8,9,11,11}; + DataArrayIdType *d=DataArrayIdType::New(); + const mcIdType vals1[6]={3,5,1,2,0,8}; + const mcIdType expected1[6]={0,3,8,9,11,11}; d->alloc(6,1); std::copy(vals1,vals1+6,d->getPointer()); d->computeOffsets(); @@ -822,7 +822,7 @@ void MEDCouplingBasicsTest4::testUMeshHexagonPrism1() 0.8660254037844386, 0.5, 0.0, 0.0, 1.0, 0.0, -0.8660254037844386, 0.5, 0.0, -0.8660254037844386, -0.5, 0.0, 0.0, -1.0, 0.0, 0.8660254037844386, -0.5, 0.0, 0.8660254037844386, 0.5, 2.0, 0.0, 1.0, 2.0, -0.8660254037844386, 0.5, 2.0, -0.8660254037844386, -0.5, 2.0, 0.0, -1.0, 2.0, 0.8660254037844386, -0.5, 2.0 }; - const int conn[12]={1,2,3,4,5,0,7,8,9,10,11,6}; + const mcIdType conn[12]={1,2,3,4,5,0,7,8,9,10,11,6}; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New("MyFirstHexagonalPrism",3); DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(12,3); @@ -844,19 +844,19 @@ void MEDCouplingBasicsTest4::testUMeshHexagonPrism1() const double expected1[3]={0.,0.,1.}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],bary->getIJ(0,i),1e-12); - DataArrayInt *d1=DataArrayInt::New(); - DataArrayInt *d2=DataArrayInt::New(); - DataArrayInt *d3=DataArrayInt::New(); - DataArrayInt *d4=DataArrayInt::New(); + DataArrayIdType *d1=DataArrayIdType::New(); + DataArrayIdType *d2=DataArrayIdType::New(); + DataArrayIdType *d3=DataArrayIdType::New(); + DataArrayIdType *d4=DataArrayIdType::New(); MEDCouplingUMesh *m2=mesh->buildDescendingConnectivity(d1,d2,d3,d4); CPPUNIT_ASSERT_EQUAL(8,(int)m2->getNumberOfCells()); - const int expected4[8][6]={{1,2,3,4,5,0},{7,6,11,10,9,8},{1,7,8,2},{2,8,9,3},{3,9,10,4},{4,10,11,5},{5,11,6,0},{0,6,7,1}}; + const mcIdType expected4[8][6]={{1,2,3,4,5,0},{7,6,11,10,9,8},{1,7,8,2},{2,8,9,3},{3,9,10,4},{4,10,11,5},{5,11,6,0},{0,6,7,1}}; const INTERP_KERNEL::NormalizedCellType expected2[8]={INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_QUAD4}; - const int expected3[8]={6,6,4,4,4,4,4,4}; + const mcIdType expected3[8]={6,6,4,4,4,4,4,4}; for(int i=0;i<8;i++) { CPPUNIT_ASSERT(m2->getTypeOfCell(i)==expected2[i]); - std::vector v; + std::vector v; m2->getNodeIdsOfCell(i,v); CPPUNIT_ASSERT((int)v.size()==expected3[i]); CPPUNIT_ASSERT(std::equal(expected4[i],expected4[i]+expected3[i],v.begin())); @@ -871,7 +871,7 @@ void MEDCouplingBasicsTest4::testUMeshHexagonPrism1() CPPUNIT_ASSERT(INTERP_KERNEL::NORM_POLYHED==mesh->getTypeOfCell(0)); mesh->unPolyze(); CPPUNIT_ASSERT(INTERP_KERNEL::NORM_HEXGP12==mesh->getTypeOfCell(0)); - CPPUNIT_ASSERT_EQUAL(13,mesh->getNodalConnectivityArrayLen()); + CPPUNIT_ASSERT_EQUAL(ToIdType(13),mesh->getNodalConnectivityArrayLen()); // vols->decrRef(); bary->decrRef(); @@ -915,8 +915,8 @@ void MEDCouplingBasicsTest4::testCheckCoherencyDeeper1() m->getNodalConnectivity()->setIJ(8,0,8);//OK m->checkConsistencyLight(); m->checkConsistency(); - const int elts[2]={1,5}; - std::vector eltsV(elts,elts+2); + const mcIdType elts[2]={1,5}; + std::vector eltsV(elts,elts+2); m->convertToPolyTypes(&eltsV[0],&eltsV[0]+eltsV.size()); m->checkConsistencyLight(); m->checkConsistency(); @@ -952,18 +952,18 @@ void MEDCouplingBasicsTest4::testUnPolyze2() m->setCoords(coo); coo->decrRef(); m->allocateCells(2); - const int conn[4]={0,1,2,3}; + const mcIdType conn[4]={0,1,2,3}; m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); m->finishInsertingCells(); std::vector ms(4,m); MEDCouplingUMesh *m2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms); - std::vector temp(1,2); + std::vector temp(1,2); m2->convertToPolyTypes(&temp[0],&temp[0]+temp.size()); m2->unPolyze(); CPPUNIT_ASSERT(INTERP_KERNEL::NORM_TETRA4==m2->getTypeOfCell(2)); - CPPUNIT_ASSERT_EQUAL(40,m2->getNodalConnectivityArrayLen()); - std::vector temp2; + CPPUNIT_ASSERT_EQUAL(ToIdType(40),m2->getNodalConnectivityArrayLen()); + std::vector temp2; m2->getNodeIdsOfCell(2,temp2); CPPUNIT_ASSERT(4==(int)temp2.size()); CPPUNIT_ASSERT(std::equal(conn,conn+4,temp2.begin())); @@ -1017,13 +1017,13 @@ void MEDCouplingBasicsTest4::testDACpyFrom1() void MEDCouplingBasicsTest4::testDAITransformWithIndArr1() { - const int tab1[4]={17,18,22,19}; - const int tab2[12]={0,1,1,3,3,0,1,3,2,2,3,0}; - const int expected[12]={17,18,18,19,19,17,18,19,22,22,19,17}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType tab1[4]={17,18,22,19}; + const mcIdType tab2[12]={0,1,1,3,3,0,1,3,2,2,3,0}; + const mcIdType expected[12]={17,18,18,19,19,17,18,19,22,22,19,17}; + DataArrayIdType *d=DataArrayIdType::New(); d->alloc(4,1); std::copy(tab1,tab1+4,d->getPointer()); - DataArrayInt *d1=DataArrayInt::New(); + DataArrayIdType *d1=DataArrayIdType::New(); d1->alloc(12,1); std::copy(tab2,tab2+12,d1->getPointer()); // @@ -1039,12 +1039,12 @@ void MEDCouplingBasicsTest4::testDAITransformWithIndArr1() void MEDCouplingBasicsTest4::testDAIBuildPermArrPerLevel1() { - const int arr[12]={2,0,1,1,0,1,2,0,1,1,0,0}; - const int expected1[12]={10,0,5,6,1,7,11,2,8,9,3,4}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType arr[12]={2,0,1,1,0,1,2,0,1,1,0,0}; + const mcIdType expected1[12]={10,0,5,6,1,7,11,2,8,9,3,4}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(12,1); std::copy(arr,arr+12,da->getPointer()); - DataArrayInt *da2=da->buildPermArrPerLevel(); + DataArrayIdType *da2=da->buildPermArrPerLevel(); CPPUNIT_ASSERT_EQUAL(12,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); for(int i=0;i<12;i++) @@ -1055,24 +1055,24 @@ void MEDCouplingBasicsTest4::testDAIBuildPermArrPerLevel1() void MEDCouplingBasicsTest4::testDAIOperations1() { - const int arr1[12]={-1,-2,4,7,3,2,6,6,4,3,0,1}; - DataArrayInt *da=DataArrayInt::New(); + const mcIdType arr1[12]={-1,-2,4,7,3,2,6,6,4,3,0,1}; + DataArrayIdType *da=DataArrayIdType::New(); da->alloc(4,3); std::copy(arr1,arr1+12,da->getPointer()); - DataArrayInt *da1=DataArrayInt::New(); + DataArrayIdType *da1=DataArrayIdType::New(); da1->alloc(12,1); da1->iota(2); - CPPUNIT_ASSERT_THROW(DataArrayInt::Add(da,da1),INTERP_KERNEL::Exception);//not same number of tuples/Components + CPPUNIT_ASSERT_THROW(DataArrayIdType::Add(da,da1),INTERP_KERNEL::Exception);//not same number of tuples/Components da1->rearrange(3); - DataArrayInt *da2=DataArrayInt::Add(da,da1); + DataArrayIdType *da2=DataArrayIdType::Add(da,da1); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents()); - const int expected1[12]={1,1,8,12,9,9,14,15,14,14,12,14}; + const mcIdType expected1[12]={1,1,8,12,9,9,14,15,14,14,12,14}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i)); da2->decrRef(); da1->substractEqual(da); - const int expected2[12]={3,5,0,-2,3,5,2,3,6,8,12,12}; + const mcIdType expected2[12]={3,5,0,-2,3,5,2,3,6,8,12,12}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i)); da1->rearrange(1); da1->iota(2); da1->rearrange(3); @@ -1080,17 +1080,17 @@ void MEDCouplingBasicsTest4::testDAIOperations1() for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da1->getIJ(0,i)); da1->rearrange(1); da1->iota(2); da1->rearrange(3); - da2=DataArrayInt::Multiply(da,da1); + da2=DataArrayIdType::Multiply(da,da1); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents()); - const int expected3[12]={-2,-6,16,35,18,14,48,54,40,33,0,13}; + const mcIdType expected3[12]={-2,-6,16,35,18,14,48,54,40,33,0,13}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i)); da2->decrRef(); da->divideEqual(da1); CPPUNIT_ASSERT_EQUAL(4,(int)da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da->getNumberOfComponents()); - const int expected4[12]={0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; + const mcIdType expected4[12]={0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected4[i],da->getIJ(0,i)); std::copy(arr1,arr1+12,da->getPointer()); @@ -1100,7 +1100,7 @@ void MEDCouplingBasicsTest4::testDAIOperations1() for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],da1->getIJ(0,i)); da1->rearrange(1); da1->iota(2); da1->rearrange(3); - da2=DataArrayInt::Divide(da,da1); + da2=DataArrayIdType::Divide(da,da1); CPPUNIT_ASSERT_EQUAL(4,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da2->getNumberOfComponents()); for(int i=0;i<12;i++) @@ -1109,21 +1109,21 @@ void MEDCouplingBasicsTest4::testDAIOperations1() da1->applyInv(321); CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents()); - const int expected5[12]={160,107,80,64,53,45,40,35,32,29,26,24}; + const mcIdType expected5[12]={160,107,80,64,53,45,40,35,32,29,26,24}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected5[i],da1->getIJ(0,i)); da1->applyDivideBy(2); CPPUNIT_ASSERT_EQUAL(4,(int)da1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(3,(int)da1->getNumberOfComponents()); - const int expected6[12]={80,53,40,32,26,22,20,17,16,14,13,12}; + const mcIdType expected6[12]={80,53,40,32,26,22,20,17,16,14,13,12}; for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected6[i],da1->getIJ(0,i)); - const int expected7[12]={3,4,5,4,5,1,6,3,2,0,6,5}; + const mcIdType expected7[12]={3,4,5,4,5,1,6,3,2,0,6,5}; da1->applyModulus(7); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected7[i],da1->getIJ(0,i)); da1->applyLin(1,1); - const int expected8[12]={3,3,3,3,3,1,3,3,0,0,3,3}; + const mcIdType expected8[12]={3,3,3,3,3,1,3,3,0,0,3,3}; da1->applyRModulus(3); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(expected8[i],da1->getIJ(0,i)); @@ -1136,15 +1136,15 @@ void MEDCouplingBasicsTest4::testEmulateMEDMEMBDC1() { MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); - DataArrayInt *da1=DataArrayInt::New(); - DataArrayInt *da2=DataArrayInt::New(); - DataArrayInt *da3=0; - DataArrayInt *da4=0; - DataArrayInt *da5=0; - DataArrayInt *da0=0; + DataArrayIdType *da1=DataArrayIdType::New(); + DataArrayIdType *da2=DataArrayIdType::New(); + DataArrayIdType *da3=0; + DataArrayIdType *da4=0; + DataArrayIdType *da5=0; + DataArrayIdType *da0=0; MEDCouplingUMesh *m2=m->emulateMEDMEMBDC(m1,da1,da2,da3,da4,da5,da0); - const int 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 int expected1[6]={1,32,29,23,41,36}; + 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}; CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents()); for(int i=0;i<47;i++) @@ -1153,23 +1153,23 @@ void MEDCouplingBasicsTest4::testEmulateMEDMEMBDC1() CPPUNIT_ASSERT_EQUAL(1,(int)da5->getNumberOfComponents()); for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da5->getIJ(0,i)); - const int expected2[70]={0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46}; + const mcIdType expected2[70]={0,1,2,3,4,0,5,6,7,4,8,9,1,7,10,11,12,13,14,5,15,16,17,8,18,19,20,10,21,22,23,2,13,24,25,21,16,26,27,12,19,28,29,15,22,30,31,18,36,26,28,30,24,37,32,33,34,35,38,36,39,40,41,42,37,38,43,44,45,46}; CPPUNIT_ASSERT_EQUAL(70,(int)da1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents()); for(int i=0;i<70;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],da1->getIJ(0,i)); - const int expected3[17]={0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70}; + const mcIdType expected3[17]={0,4,8,12,16,20,24,28,32,36,40,44,48,53,58,64,70}; CPPUNIT_ASSERT_EQUAL(17,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); for(int i=0;i<17;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],da2->getIJ(0,i)); - const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70}; - //const int expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70}; + const mcIdType expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,53,54,55,56,58,60,62,63,64,65,66,67,68,69,70}; + //const mcIdType expected4[48]={0,2,4,6,7,9,11,12,14,16,17,19,20,22,24,25,27,29,30,32,34,35,37,39,40,42,43,45,46,48,49,51,52,54,56,57,58,59,60,62,63,64,65,66,67,68,69,70}; CPPUNIT_ASSERT_EQUAL(48,(int)da4->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da4->getNumberOfComponents()); for(int i=0;i<48;i++) CPPUNIT_ASSERT_EQUAL(expected4[i],da4->getIJ(0,i)); - const int expected5[70]={0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15}; + const mcIdType expected5[70]={0,1,0,3,0,7,0,1,2,1,4,1,2,3,2,5,2,3,6,3,4,9,4,8,4,5,10,5,9,5,6,11,6,10,6,7,8,7,11,7,8,12,8,9,12,9,10,12,10,11,12,11,13,13,13,13,12,14,13,15,14,15,14,14,14,14,15,15,15,15}; CPPUNIT_ASSERT_EQUAL(70,(int)da3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da3->getNumberOfComponents()); for(int i=0;i<70;i++) @@ -1192,30 +1192,30 @@ void MEDCouplingBasicsTest4::testGetLevArrPerCellTypes1() MEDCouplingUMesh *m1=0; MEDCouplingUMesh *m=buildPointe_1(m1); m1->decrRef(); - DataArrayInt *d0=DataArrayInt::New(); - DataArrayInt *d1=DataArrayInt::New(); - DataArrayInt *d2=DataArrayInt::New(); - DataArrayInt *d3=DataArrayInt::New(); + DataArrayIdType *d0=DataArrayIdType::New(); + DataArrayIdType *d1=DataArrayIdType::New(); + DataArrayIdType *d2=DataArrayIdType::New(); + DataArrayIdType *d3=DataArrayIdType::New(); 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}; - DataArrayInt *da1=0; - DataArrayInt *da0=m1->getLevArrPerCellTypes(order,order+2,da1); - const int 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 int 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}; - CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents()); + 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}; + CPPUNIT_ASSERT_EQUAL(47,(int)da0->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da0->getNumberOfComponents()); for(int i=0;i<47;i++) CPPUNIT_ASSERT_EQUAL(expected0[i],da0->getIJ(0,i)); - CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(36,da1->getIJ(0,0));//36 TRI3 - CPPUNIT_ASSERT_EQUAL(11,da1->getIJ(1,0));//11 QUAD4 + CPPUNIT_ASSERT_EQUAL(2,(int)da1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da1->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(36,(int)da1->getIJ(0,0));//36 TRI3 + CPPUNIT_ASSERT_EQUAL(11,(int)da1->getIJ(1,0));//11 QUAD4 // - DataArrayInt *da2=da0->buildPermArrPerLevel(); + DataArrayIdType *da2=da0->buildPermArrPerLevel(); // - CPPUNIT_ASSERT_EQUAL(47,(int)da2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(47,(int)da2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); for(int i=0;i<47;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(0,i)); da2->decrRef(); @@ -1232,14 +1232,14 @@ void MEDCouplingBasicsTest4::testSortCellsInMEDFileFrmt1() MEDCouplingUMesh *m=buildPointe_1(m1); MEDCouplingUMesh *m2=(MEDCouplingUMesh *)m->deepCopy(); m->setCoords(0); - const int vals[16]={0,1,2,14,3,12,4,5,15,6,7,8,9,10,11,13}; - DataArrayInt *da=DataArrayInt::New(); + 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); std::copy(vals,vals+16,da->getPointer()); - DataArrayInt *daa=da->invertArrayN2O2O2N(16); + DataArrayIdType *daa=da->invertArrayN2O2O2N(16); m->renumberCells(daa->getConstPointer(),false); daa->decrRef(); - DataArrayInt *da2=m->sortCellsInMEDFileFrmt(); + DataArrayIdType *da2=m->sortCellsInMEDFileFrmt(); CPPUNIT_ASSERT(m2->isEqual(m2,1e-12)); CPPUNIT_ASSERT(da->isEqual(*da2)); m2->decrRef(); @@ -1252,10 +1252,10 @@ void MEDCouplingBasicsTest4::testSortCellsInMEDFileFrmt1() void MEDCouplingBasicsTest4::testBuildPartAndReduceNodes1() { MEDCouplingMesh *m=build2DTargetMesh_1(); - const int arr[2]={1,0}; - DataArrayInt *da; + const mcIdType arr[2]={1,0}; + DataArrayIdType *da; MEDCouplingMesh *m2=m->buildPartAndReduceNodes(arr,arr+2,da); - CPPUNIT_ASSERT_EQUAL(5,m2->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(5,(int)m2->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)m2->getNumberOfCells()); MEDCouplingFieldDouble *f=m2->getMeasureField(true); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,f->getArray()->getIJ(0,0),1e-12); @@ -1268,17 +1268,17 @@ void MEDCouplingBasicsTest4::testBuildPartAndReduceNodes1() void MEDCouplingBasicsTest4::testDAITransformWithIndArrR1() { - const int tab1[6]={2,4,5,3,6,7}; - const int tab2[12]={-1,-1,0,1,2,3,4,5,-1,-1,-1,-1}; - const int expected[6]={0,3,1,2,4,5}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType tab1[6]={2,4,5,3,6,7}; + const mcIdType tab2[12]={-1,-1,0,1,2,3,4,5,-1,-1,-1,-1}; + const mcIdType expected[6]={0,3,1,2,4,5}; + DataArrayIdType *d=DataArrayIdType::New(); d->alloc(6,1); std::copy(tab1,tab1+6,d->getPointer()); - DataArrayInt *d1=DataArrayInt::New(); + DataArrayIdType *d1=DataArrayIdType::New(); d1->alloc(12,1); std::copy(tab2,tab2+12,d1->getPointer()); // - DataArrayInt *d3=d->transformWithIndArrR(d1->getConstPointer(),d1->getConstPointer()+d1->getNbOfElems()); + DataArrayIdType *d3=d->transformWithIndArrR(d1->getConstPointer(),d1->getConstPointer()+d1->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)d3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)d3->getNumberOfComponents()); for(int i=0;i<6;i++) @@ -1291,12 +1291,12 @@ void MEDCouplingBasicsTest4::testDAITransformWithIndArrR1() void MEDCouplingBasicsTest4::testDAISplitByValueRange1() { - const int val1[9]={6,5,0,3,2,7,8,1,4}; - const int val2[3]={0,4,9}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType val1[9]={6,5,0,3,2,7,8,1,4}; + const mcIdType val2[3]={0,4,9}; + DataArrayIdType *d=DataArrayIdType::New(); d->alloc(9,1); std::copy(val1,val1+9,d->getPointer()); - DataArrayInt *ee=0,*f=0,*g=0; + 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()); @@ -1305,15 +1305,15 @@ void MEDCouplingBasicsTest4::testDAISplitByValueRange1() CPPUNIT_ASSERT_EQUAL(2,(int)g->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)g->getNumberOfComponents()); // - const int expected1[9]={1,1,0,0,0,1,1,0,1}; - const int expected2[9]={2,1,0,3,2,3,4,1,0}; + const mcIdType expected1[9]={1,1,0,0,0,1,1,0,1}; + const mcIdType expected2[9]={2,1,0,3,2,3,4,1,0}; for(int i=0;i<9;i++) { CPPUNIT_ASSERT_EQUAL(expected1[i],ee->getIJ(i,0)); CPPUNIT_ASSERT_EQUAL(expected2[i],f->getIJ(i,0)); } - CPPUNIT_ASSERT_EQUAL(0,g->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(1,g->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(0,(int)g->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)g->getIJ(1,0)); // ee->decrRef(); f->decrRef(); @@ -1327,39 +1327,39 @@ void MEDCouplingBasicsTest4::testDAISplitByValueRange1() void MEDCouplingBasicsTest4::testUMeshSplitProfilePerType1() { - const int val0[5]={2,0,1,3,4}; + const mcIdType val0[5]={2,0,1,3,4}; MEDCouplingUMesh *m=build2DTargetMesh_1(); m->renumberCells(val0,false); - std::vector code; - std::vector idsInPflPerType; - std::vector pfls; + std::vector code; + std::vector idsInPflPerType; + std::vector pfls; // - const int val1[3]={0,2,3}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType val1[3]={0,2,3}; + DataArrayIdType *d=DataArrayIdType::New(); d->alloc(3,1); d->setName("sup"); std::copy(val1,val1+3,d->getPointer()); m->splitProfilePerType(d,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size()); - const int expected1[6]={3,1,0, 4,2,1}; + const mcIdType expected1[6]={3,1,0, 4,2,1}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],code[i]); - CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(1,0)); idsInPflPerType[0]->decrRef(); idsInPflPerType[1]->decrRef(); CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size()); CPPUNIT_ASSERT(std::string("sup")==pfls[0]->getName()); - CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(0,0)); CPPUNIT_ASSERT(std::string("sup")==pfls[1]->getName()); - CPPUNIT_ASSERT_EQUAL(2,(int)pfls[1]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(1,pfls[1]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)pfls[1]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)pfls[1]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)pfls[1]->getIJ(1,0)); pfls[0]->decrRef(); pfls[1]->decrRef(); d->decrRef(); @@ -1367,55 +1367,55 @@ void MEDCouplingBasicsTest4::testUMeshSplitProfilePerType1() pfls.clear(); code.clear(); // - const int val2[4]={0,2,3,4};// all quad4 are selected here ! So no profile for Quads - d=DataArrayInt::New(); + const mcIdType val2[4]={0,2,3,4};// all quad4 are selected here ! So no profile for Quads + d=DataArrayIdType::New(); d->alloc(4,1); std::copy(val2,val2+4,d->getPointer()); m->splitProfilePerType(d,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size()); - const int expected2[6]={3,1,0, 4,3,-1}; + const mcIdType expected2[6]={3,1,0, 4,3,-1}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected2[i],code[i]); - CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[1]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(3,idsInPflPerType[1]->getIJ(2,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(3,(int)idsInPflPerType[1]->getIJ(2,0)); idsInPflPerType[0]->decrRef(); idsInPflPerType[1]->decrRef(); CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size()); - CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(0,0)); pfls[0]->decrRef(); d->decrRef(); idsInPflPerType.clear(); pfls.clear(); code.clear(); // - const int val3[3]={1,0,2};// all tri3 are selected here but not in the same order ! Profile requested for Tri3 - d=DataArrayInt::New(); + const mcIdType val3[3]={1,0,2};// all tri3 are selected here but not in the same order ! Profile requested for Tri3 + d=DataArrayIdType::New(); d->alloc(3,1); std::copy(val3,val3+3,d->getPointer()); m->splitProfilePerType(d,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType.size()); - const int expected3[6]={3,2,0, 4,1,1}; + const mcIdType expected3[6]={3,2,0, 4,1,1}; for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],code[i]); - CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(2,idsInPflPerType[1]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[1]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[1]->getIJ(0,0)); idsInPflPerType[0]->decrRef(); idsInPflPerType[1]->decrRef(); CPPUNIT_ASSERT_EQUAL(2,(int)pfls.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(0,pfls[0]->getIJ(1,0)); - CPPUNIT_ASSERT_EQUAL(0,pfls[1]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(0,(int)pfls[0]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(0,(int)pfls[1]->getIJ(0,0)); pfls[0]->decrRef(); pfls[1]->decrRef(); d->decrRef(); @@ -1423,24 +1423,24 @@ void MEDCouplingBasicsTest4::testUMeshSplitProfilePerType1() pfls.clear(); code.clear(); // - const int val4[2]={3,4};// all tri3 are selected here but not in the same order ! Profile requested for Tri3 - d=DataArrayInt::New(); + const mcIdType val4[2]={3,4};// all tri3 are selected here but not in the same order ! Profile requested for Tri3 + d=DataArrayIdType::New(); d->alloc(2,1); std::copy(val4,val4+2,d->getPointer()); m->splitProfilePerType(d,code,idsInPflPerType,pfls); CPPUNIT_ASSERT_EQUAL(3,(int)code.size()); CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType.size()); - const int expected4[3]={4,2,0}; + const mcIdType expected4[3]={4,2,0}; for(int i=0;i<3;i++) CPPUNIT_ASSERT_EQUAL(expected4[i],code[i]); - CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(0,idsInPflPerType[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(1,idsInPflPerType[0]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)idsInPflPerType[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(0,(int)idsInPflPerType[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(1,(int)idsInPflPerType[0]->getIJ(1,0)); idsInPflPerType[0]->decrRef(); CPPUNIT_ASSERT_EQUAL(1,(int)pfls.size()); - CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,pfls[0]->getIJ(0,0)); - CPPUNIT_ASSERT_EQUAL(2,pfls[0]->getIJ(1,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)pfls[0]->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(2,(int)pfls[0]->getIJ(1,0)); pfls[0]->decrRef(); d->decrRef(); idsInPflPerType.clear(); @@ -1452,19 +1452,19 @@ void MEDCouplingBasicsTest4::testUMeshSplitProfilePerType1() void MEDCouplingBasicsTest4::testDAIBuildExplicitArrByRanges1() { - DataArrayInt *d=DataArrayInt::New(); + DataArrayIdType *d=DataArrayIdType::New(); d->alloc(3,1); - const int vals1[3]={0,2,3}; + const mcIdType vals1[3]={0,2,3}; std::copy(vals1,vals1+3,d->getPointer()); - DataArrayInt *e=DataArrayInt::New(); + DataArrayIdType *e=DataArrayIdType::New(); e->alloc(6,1); - const int vals2[6]={0,3,6,10,14,20}; + const mcIdType vals2[6]={0,3,6,10,14,20}; std::copy(vals2,vals2+6,e->getPointer()); // - DataArrayInt *f=d->buildExplicitArrByRanges(e); - CPPUNIT_ASSERT_EQUAL(11,(int)f->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)f->getNumberOfComponents()); - const int expected1[11]={0,1,2,6,7,8,9,10,11,12,13}; + DataArrayIdType *f=d->buildExplicitArrByRanges(e); + CPPUNIT_ASSERT_EQUAL(11,(int)f->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)f->getNumberOfComponents()); + const mcIdType expected1[11]={0,1,2,6,7,8,9,10,11,12,13}; for(int i=0;i<11;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],f->getIJ(i,0)); // @@ -1475,14 +1475,14 @@ void MEDCouplingBasicsTest4::testDAIBuildExplicitArrByRanges1() void MEDCouplingBasicsTest4::testDAIComputeOffsets2() { - DataArrayInt *d=DataArrayInt::New(); - const int vals1[6]={3,5,1,2,0,8}; - const int expected1[7]={0,3,8,9,11,11,19}; + DataArrayIdType *d=DataArrayIdType::New(); + const mcIdType vals1[6]={3,5,1,2,0,8}; + const mcIdType expected1[7]={0,3,8,9,11,11,19}; d->alloc(6,1); std::copy(vals1,vals1+6,d->getPointer()); d->computeOffsetsFull(); - CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(7,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); for(int i=0;i<7;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],d->getIJ(0,i)); d->decrRef(); @@ -1519,17 +1519,17 @@ void MEDCouplingBasicsTest4::testMergeField3() void MEDCouplingBasicsTest4::testGetDistributionOfTypes1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - const int tab1[5]={2,0,1,3,4}; + const mcIdType tab1[5]={2,0,1,3,4}; CPPUNIT_ASSERT_THROW(m->getDistributionOfTypes(),INTERP_KERNEL::Exception); m->renumberCells(tab1,false); - std::vector code=m->getDistributionOfTypes(); + std::vector code=m->getDistributionOfTypes(); CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); - CPPUNIT_ASSERT_EQUAL(3,code[0]); - CPPUNIT_ASSERT_EQUAL(2,code[1]); - CPPUNIT_ASSERT_EQUAL(-1,code[2]); - CPPUNIT_ASSERT_EQUAL(4,code[3]); - CPPUNIT_ASSERT_EQUAL(3,code[4]); - CPPUNIT_ASSERT_EQUAL(-1,code[5]); + CPPUNIT_ASSERT_EQUAL(3,(int)code[0]); + CPPUNIT_ASSERT_EQUAL(2,(int)code[1]); + CPPUNIT_ASSERT_EQUAL(-1,(int)code[2]); + CPPUNIT_ASSERT_EQUAL(4,(int)code[3]); + CPPUNIT_ASSERT_EQUAL(3,(int)code[4]); + CPPUNIT_ASSERT_EQUAL(-1,(int)code[5]); m->decrRef(); } @@ -1591,9 +1591,9 @@ void MEDCouplingBasicsTest4::testNormMax1() void MEDCouplingBasicsTest4::testFindAndCorrectBadOriented3DExtrudedCells1() { const double coords[38*3]={0.0011180339887498999, -0.0011755705045849499, 0.0, -0.0012331070204200001, -0.0011755705045849499, 0.0, -0.00067557050458494599, -0.00145964954842536, 0.0, -0.00050000000000000001, -0.00086602540378443902, 0.0, 0.00140211303259031, -0.00061803398874989504, 0.0, 0.00086602540378443902, -0.00050000000000000001, 0.0, 0.001, 0.0, 0.0, 0.00034561537182258202, 0.000269164072574575, 0.0, 0.0, 0.001, 0.0, -0.00050000000000000001, 0.00086602540378443902, 0.0, -0.000269164072574575, 0.00034561537182258202, 0.0, -0.001, 0.0, 0.0, -0.00086602540378443902, -0.00050000000000000001, 0.0, -0.00034561537182258202, -0.000269164072574575, 0.0, 0.0, -0.001, 0.0, 0.00050000000000000001, -0.00086602540378443902, 0.0, 0.000269164072574575, -0.00034561537182258202, 0.0, 0.0015, -6.01853107621011e-36, 0.0, 0.00056049747291484397, -0.00145964954842536, 0.0, 0.0011180339887498999, -0.0011755705045849499, 0.00050000000000000001, -0.0012331070204200001, -0.0011755705045849499, 0.00050000000000000001, -0.00067557050458494599, -0.00145964954842536, 0.00050000000000000001, -0.00050000000000000001, -0.00086602540378443902, 0.00050000000000000001, 0.00140211303259031, -0.00061803398874989504, 0.00050000000000000001, 0.00086602540378443902, -0.00050000000000000001, 0.00050000000000000001, 0.001, 0.0, 0.00050000000000000001, 0.00034561537182258202, 0.000269164072574575, 0.00050000000000000001, 0.0, 0.001, 0.00050000000000000001, -0.00050000000000000001, 0.00086602540378443902, 0.00050000000000000001, -0.000269164072574575, 0.00034561537182258202, 0.00050000000000000001, -0.001, 0.0, 0.00050000000000000001, -0.00086602540378443902, -0.00050000000000000001, 0.00050000000000000001, -0.00034561537182258202, -0.000269164072574575, 0.00050000000000000001, 0.0, -0.001, 0.00050000000000000001, 0.00050000000000000001, -0.00086602540378443902, 0.00050000000000000001, 0.000269164072574575, -0.00034561537182258202, 0.00050000000000000001, 0.0015, -6.01853107621011e-36, 0.00050000000000000001, 0.00056049747291484397, -0.00145964954842536, 0.00050000000000000001}; - const int conn[56]={2, 1, 3, 21, 20, 22, 4, 0, 5, 23, 19, 24, 8, 9, 10, 27, 28, 29, 11, 12, 13, 30, 31, 32, 0, 18, 15, 5, 19, 37, 34, 24, 6, 17, 4, 5, 25, 36, 23, 24, 3, 14, 16, 13, 22, 33, 35, 32, 13, 16, 7, 10, 32, 35, 26, 29}; - const int connExp[64]={16, 2, 1, 3, 21, 20, 22, 16, 4, 0, 5, 23, 19, 24, 16, 8, 10, 9, 27, 29, 28, 16, 11, 13, 12, 30, 32, 31, 18, 0, 18, 15, 5, 19, 37, 34, 24,18, 6, 17, 4, 5, 25, 36, 23, 24, 18, 3, 13, 16, 14, 22, 32, 35, 33, 18, 13, 10, 7, 16, 32, 29, 26, 35}; - const int invalidCells[4]={2,3,6,7}; + const mcIdType conn[56]={2, 1, 3, 21, 20, 22, 4, 0, 5, 23, 19, 24, 8, 9, 10, 27, 28, 29, 11, 12, 13, 30, 31, 32, 0, 18, 15, 5, 19, 37, 34, 24, 6, 17, 4, 5, 25, 36, 23, 24, 3, 14, 16, 13, 22, 33, 35, 32, 13, 16, 7, 10, 32, 35, 26, 29}; + const mcIdType connExp[64]={16, 2, 1, 3, 21, 20, 22, 16, 4, 0, 5, 23, 19, 24, 16, 8, 10, 9, 27, 29, 28, 16, 11, 13, 12, 30, 32, 31, 18, 0, 18, 15, 5, 19, 37, 34, 24,18, 6, 17, 4, 5, 25, 36, 23, 24, 18, 3, 13, 16, 14, 22, 32, 35, 33, 18, 13, 10, 7, 16, 32, 29, 26, 35}; + const mcIdType invalidCells[4]={2,3,6,7}; MEDCouplingUMesh *m=MEDCouplingUMesh::New("Example",3); DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(38,3); @@ -1611,7 +1611,7 @@ void MEDCouplingBasicsTest4::testFindAndCorrectBadOriented3DExtrudedCells1() m->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,conn+48); m->finishInsertingCells(); // - DataArrayInt *v=m->findAndCorrectBadOriented3DExtrudedCells(); + DataArrayIdType *v=m->findAndCorrectBadOriented3DExtrudedCells(); CPPUNIT_ASSERT_EQUAL(4,(int)v->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(v->begin(),v->end(),invalidCells)); CPPUNIT_ASSERT(std::equal(connExp,connExp+64,m->getNodalConnectivity()->getConstPointer())); @@ -1622,7 +1622,7 @@ void MEDCouplingBasicsTest4::testFindAndCorrectBadOriented3DExtrudedCells1() void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1() { - const int conn[72]={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,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46, 47,48,49,50,51,52,53,54,55,56,57,58, 59,60,61,62,63,64,65,66,67,68,69,70,71,72}; + const mcIdType conn[72]={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,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46, 47,48,49,50,51,52,53,54,55,56,57,58, 59,60,61,62,63,64,65,66,67,68,69,70,71,72}; MEDCouplingUMesh *m=MEDCouplingUMesh::New("Example",3); DataArrayDouble *coo=DataArrayDouble::New(); coo->alloc(73,3); @@ -1642,12 +1642,12 @@ void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1() m->finishInsertingCells(); // m->convertExtrudedPolyhedra(); - DataArrayInt *da=m->getNodalConnectivity(); - DataArrayInt *dai=m->getNodalConnectivityIndex(); - CPPUNIT_ASSERT_EQUAL((std::size_t)10,dai->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)159,da->getNbOfElems()); + DataArrayIdType *da=m->getNodalConnectivity(); + DataArrayIdType *dai=m->getNodalConnectivityIndex(); + CPPUNIT_ASSERT_EQUAL(ToIdType(10),dai->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(159),da->getNbOfElems()); // - const int expected1[159]={14,1,2,3,4, + const mcIdType expected1[159]={14,1,2,3,4, 18,5,6,7,8,9,10,11,12, 14,13,14,15,16, 31,17,18,19,-1,20,22,21,-1,17,20,21,18,-1,18,21,22,19,-1,19,22,20,17, @@ -1656,7 +1656,7 @@ void MEDCouplingBasicsTest4::testConvertExtrudedPolyhedra1() 18,39,40,41,42,43,44,45,46, 22,47,48,49,50,51,52,53,54,55,56,57,58, 31,59,60,61,62,63,64,65,-1,66,72,71,70,69,68,67,-1,59,66,67,60,-1,60,67,68,61,-1,61,68,69,62,-1,62,69,70,63,-1,63,70,71,64,-1,64,71,72,65,-1,65,72,66,59}; - const int expected2[10]={0,5,14,19,42,49,86,95,108,159}; + const mcIdType expected2[10]={0,5,14,19,42,49,86,95,108,159}; CPPUNIT_ASSERT(std::equal(expected1,expected1+159,da->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+10,dai->getConstPointer())); m->checkConsistency(); @@ -1683,14 +1683,14 @@ void MEDCouplingBasicsTest4::testDaDSetPartOfValuesAdv1() { const double tab1[18]={3.,4.,5., 13.,14.,15., 23.,24.,25., 33.,34.,35., 43.,44.,45., 53.,54.,55.}; const double tab2[9]={6.,7.,8., 16.,17.,18., 26.,27.,28.}; - const int tab3[6]={4,1, 2,2, 3,0}; + const mcIdType tab3[6]={4,1, 2,2, 3,0}; DataArrayDouble *a=DataArrayDouble::New(); a->alloc(6,3); std::copy(tab1,tab1+18,a->getPointer()); DataArrayDouble *b=DataArrayDouble::New(); b->alloc(3,3); std::copy(tab2,tab2+9,b->getPointer()); - DataArrayInt *c=DataArrayInt::New(); + DataArrayIdType *c=DataArrayIdType::New(); c->alloc(3,2); std::copy(tab3,tab3+6,c->getPointer()); // @@ -1715,7 +1715,7 @@ void MEDCouplingBasicsTest4::testUMeshBuildSetInstanceFromThis1() // m=MEDCouplingUMesh::New("toto",2); m2=m->buildSetInstanceFromThis(3); - CPPUNIT_ASSERT_EQUAL(0,m2->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(0,(int)m2->getNumberOfCells()); m->decrRef(); m2->decrRef(); @@ -1751,15 +1751,15 @@ void MEDCouplingBasicsTest4::testChangeUnderlyingMeshWithCMesh1() coordsZ->decrRef(); MEDCouplingMesh *mesh2=mesh->deepCopy(); // - static const int ids1[9]={0,1,2,10,11,12,20,21,22}; - for(const int *myId=ids1;myId!=ids1+9;myId++) + static const mcIdType ids1[9]={0,1,2,10,11,12,20,21,22}; + for(const mcIdType *myId=ids1;myId!=ids1+9;myId++) { MEDCouplingFieldDouble *f=mesh->getMeasureField(true); f->changeUnderlyingMesh(mesh2,*myId,1e-12); f->decrRef(); } mesh2->setName("uuuu"); - for(const int *myId=ids1+1;myId!=ids1+9;myId++) + for(const mcIdType *myId=ids1+1;myId!=ids1+9;myId++) { MEDCouplingFieldDouble *f=mesh->getMeasureField(true); f->changeUnderlyingMesh(mesh2,*myId,1e-12); @@ -1776,23 +1776,23 @@ 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()); - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; // nbOftuples=1 da->findCommonTuples(1e-2,-1,c,cI); - const int expected1[3]={0,3,4}; - const int expected2[2]={0,3}; - CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); + const mcIdType expected1[3]={0,3,4}; + const mcIdType expected2[2]={0,3}; + CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); cI->decrRef(); // da->findCommonTuples(2e-1,-1,c,cI); - const int expected3[5]={0,3,4,1,2}; - const int expected4[3]={0,3,5}; - CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); + const mcIdType expected3[5]={0,3,4,1,2}; + const mcIdType expected4[3]={0,3,5}; + CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1802,16 +1802,16 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() const double array2[12]={2.3,2.3,1.2,1.2,1.3,1.3,2.3,2.3,2.301,2.301,0.8,0.8}; std::copy(array2,array2+12,da->getPointer()); da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); cI->decrRef(); // da->findCommonTuples(2e-1,-1,c,cI); - CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1821,16 +1821,16 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() const double array3[18]={2.3,2.3,2.3,1.2,1.2,1.2,1.3,1.3,1.3,2.3,2.3,2.3,2.301,2.301,2.301,0.8,0.8,0.8}; std::copy(array3,array3+18,da->getPointer()); da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+2,cI->getConstPointer())); c->decrRef(); cI->decrRef(); // da->findCommonTuples(2e-1,-1,c,cI); - CPPUNIT_ASSERT_EQUAL((std::size_t)5,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)3,cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),cI->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -1841,9 +1841,9 @@ void MEDCouplingBasicsTest4::testDADFindCommonTuples1() std::copy(array11,array11+6,da->getPointer()); // nbOftuples=1, no common groups da->findCommonTuples(1e-2,-1,c,cI); - CPPUNIT_ASSERT_EQUAL((std::size_t)0,c->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)1,cI->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(0,cI->getIJ(0,0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),c->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),cI->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),cI->getIJ(0,0)); da->alloc(6,5); //bad NumberOfComponents CPPUNIT_ASSERT_THROW(da->findCommonTuples(1e-2,-1,c,cI),INTERP_KERNEL::Exception); @@ -1866,11 +1866,11 @@ void MEDCouplingBasicsTest4::testDABack1() CPPUNIT_ASSERT_THROW(da->back(),INTERP_KERNEL::Exception); da->decrRef(); // - DataArrayInt *da2=DataArrayInt::New(); + DataArrayIdType *da2=DataArrayIdType::New(); da2->alloc(4,1); - const int array2[4]={4,7,8,2}; + const mcIdType array2[4]={4,7,8,2}; std::copy(array2,array2+4,da2->getPointer()); - CPPUNIT_ASSERT_EQUAL(2,da2->back()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),da2->back()); da2->rearrange(2); CPPUNIT_ASSERT_THROW(da2->back(),INTERP_KERNEL::Exception); da2->alloc(0,1); @@ -1887,14 +1887,14 @@ void MEDCouplingBasicsTest4::testDADGetDifferentValues1() // const double expected1[4]={2.301,1.2,1.3,0.8}; DataArrayDouble *dv=da->getDifferentValues(1e-2); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,dv->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),dv->getNbOfElems()); for(int i=0;i<4;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],dv->getIJ(i,0),1e-14); dv->decrRef(); // dv=da->getDifferentValues(2e-1); const double expected2[3]={2.301,1.3,0.8}; - CPPUNIT_ASSERT_EQUAL((std::size_t)3,dv->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),dv->getNbOfElems()); for(int i=0;i<3;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],dv->getIJ(i,0),1e-14); dv->decrRef(); @@ -1903,22 +1903,22 @@ void MEDCouplingBasicsTest4::testDADGetDifferentValues1() void MEDCouplingBasicsTest4::testDAIBuildOld2NewArrayFromSurjectiveFormat2() { - const int arr[5]={0,3, 5,7,9}; - const int arrI[3]={0,2,5}; - DataArrayInt *a=DataArrayInt::New(); + const mcIdType arr[5]={0,3, 5,7,9}; + const mcIdType arrI[3]={0,2,5}; + DataArrayIdType *a=DataArrayIdType::New(); a->alloc(5,1); std::copy(arr,arr+5,a->getPointer()); - DataArrayInt *b=DataArrayInt::New(); + DataArrayIdType *b=DataArrayIdType::New(); b->alloc(3,1); std::copy(arrI,arrI+3,b->getPointer()); - int newNbTuple=-1; - DataArrayInt *ret=DataArrayInt::ConvertIndexArrayToO2N(10,a->begin(),b->begin(),b->end(),newNbTuple); - const int expected[10]={0,1,2,0,3,4,5,4,6,4}; - CPPUNIT_ASSERT_EQUAL((std::size_t)10,ret->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(7,newNbTuple); - CPPUNIT_ASSERT_EQUAL(1,(int)ret->getNumberOfComponents()); + mcIdType newNbTuple=-1; + DataArrayIdType *ret=DataArrayIdType::ConvertIndexArrayToO2N(10,a->begin(),b->begin(),b->end(),newNbTuple); + const mcIdType expected[10]={0,1,2,0,3,4,5,4,6,4}; + CPPUNIT_ASSERT_EQUAL(ToIdType(10),ret->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(7),newNbTuple); + CPPUNIT_ASSERT_EQUAL(1,(int)ret->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected,expected+10,ret->getConstPointer())); - CPPUNIT_ASSERT_THROW(DataArrayInt::ConvertIndexArrayToO2N(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayIdType::ConvertIndexArrayToO2N(9,a->begin(),b->begin(),b->end(),newNbTuple),INTERP_KERNEL::Exception); ret->decrRef(); b->decrRef(); a->decrRef(); @@ -1926,11 +1926,11 @@ void MEDCouplingBasicsTest4::testDAIBuildOld2NewArrayFromSurjectiveFormat2() void MEDCouplingBasicsTest4::testDADIReverse1() { - const int arr[6]={0,3,5,7,9,2}; - DataArrayInt *a=DataArrayInt::New(); + const mcIdType arr[6]={0,3,5,7,9,2}; + DataArrayIdType *a=DataArrayIdType::New(); a->alloc(6,1); std::copy(arr,arr+6,a->getPointer()); - CPPUNIT_ASSERT_EQUAL(2,a->back()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),a->back()); a->reverse(); for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(arr[5-i],a->getIJ(i,0)); @@ -1960,17 +1960,17 @@ void MEDCouplingBasicsTest4::testDADIReverse1() void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() { MEDCouplingUMesh *m0=build2DTargetMesh_1(); - const int CellIds[2]={1,2}; + const mcIdType CellIds[2]={1,2}; MEDCouplingUMesh *m1=static_cast(m0->buildPartOfMySelf(CellIds,CellIds+2,true)); - int newNbOfNodes=-1; - DataArrayInt *arr=m1->getNodeIdsInUse(newNbOfNodes); - const int expected[9]={-1,0,1,-1,2,3,-1,-1,-1}; - CPPUNIT_ASSERT_EQUAL(4,newNbOfNodes); - CPPUNIT_ASSERT_EQUAL((std::size_t)9,arr->getNbOfElems()); + mcIdType newNbOfNodes=-1; + DataArrayIdType *arr=m1->getNodeIdsInUse(newNbOfNodes); + const mcIdType expected[9]={-1,0,1,-1,2,3,-1,-1,-1}; + CPPUNIT_ASSERT_EQUAL(ToIdType(4),newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(ToIdType(9),arr->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected,expected+9,arr->getConstPointer())); - DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,arr2->getNbOfElems()); - const int expected2[4]={1,2,4,5}; + DataArrayIdType *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),arr2->getNbOfElems()); + const mcIdType expected2[4]={1,2,4,5}; CPPUNIT_ASSERT(std::equal(expected2,expected2+4,arr2->getConstPointer())); arr2->decrRef(); arr->decrRef(); @@ -1981,32 +1981,32 @@ void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() void MEDCouplingBasicsTest4::testBuildDescendingConnec2() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); - DataArrayInt *desc=DataArrayInt::New(); - DataArrayInt *descIndx=DataArrayInt::New(); - DataArrayInt *revDesc=DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc=DataArrayIdType::New(); + DataArrayIdType *descIndx=DataArrayIdType::New(); + DataArrayIdType *revDesc=DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(13,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); - const int expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10}; + CPPUNIT_ASSERT_EQUAL(ToIdType(14),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,(int)revDesc->getNumberOfTuples()); + const mcIdType expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10}; CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer())); - const int expected2[6]={0,4,7,10,14,18}; + const mcIdType expected2[6]={0,4,7,10,14,18}; CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer())); - const int expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18}; + const mcIdType expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18}; CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer())); - const int expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; + const mcIdType expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; CPPUNIT_ASSERT(std::equal(expected4,expected4+18,revDesc->getConstPointer())); - DataArrayInt *conn=mesh2->getNodalConnectivity(); - DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex(); - const int expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39}; + DataArrayIdType *conn=mesh2->getNodalConnectivity(); + DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex(); + const mcIdType expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39}; CPPUNIT_ASSERT(std::equal(expected5,expected5+14,connIndex->getConstPointer())); - const int expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5}; + const mcIdType expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5}; CPPUNIT_ASSERT(std::equal(expected6,expected6+39,conn->getConstPointer())); // desc->decrRef(); @@ -2031,27 +2031,27 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp1() std::copy(arrY,arrY+4,coordY->getPointer()); m1c->setCoordsAt(1,coordY); MEDCouplingUMesh *m1=m1c->buildUnstructured(); - const int subPart1[3]={3,4,5}; + const mcIdType subPart1[3]={3,4,5}; MEDCouplingUMesh *m1bis=static_cast(m1->buildPartOfMySelf(subPart1,subPart1+3,false)); MEDCouplingUMesh *m2tmp=static_cast(m1->deepCopy()); - const int subPart2[3]={0,1,2}; + const mcIdType subPart2[3]={0,1,2}; 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 - DataArrayInt *d1=0,*d2=0; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1bis,m2,1e-10,d1,d2); - const int expected1[8]={0,0,1,1,1,2,2,2}; - const int expected2[8]={0,-1,0,1,-1,1,2,-1}; + const mcIdType expected1[8]={0,0,1,1,1,2,2,2}; + const mcIdType expected2[8]={0,-1,0,1,-1,1,2,-1}; CPPUNIT_ASSERT_EQUAL(8,(int)d1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(8,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(8,(int)m3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(22,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(22,(int)m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); CPPUNIT_ASSERT(std::equal(expected1,expected1+8,d1->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+8,d2->getConstPointer())); - const int expected3[44]={5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14}; - const int expected4[9]={0,5,12,17,22,28,33,38,44}; + const mcIdType expected3[44]={5,17,1,16,12,5,16,0,4,5,17,12,5,18,1,17,13,5,19,2,18,13,5,17,5,6,19,13,5,20,2,19,14,5,21,3,20,14,5,19,6,7,21,14}; + const mcIdType expected4[9]={0,5,12,17,22,28,33,38,44}; const double expected5[44]={-1.0,2.0,1.0,2.0,2.0,2.0,4.0,2.0,-1.0,4.0,1.0,4.0,2.0,4.0,4.0,4.0,-0.5,-1.5,1.5,-1.5,2.5,-1.5,4.5,-1.5,-0.5,2.5,1.5,2.5,2.5,2.5,4.5,2.5,-0.5,2.0,1.0,2.5,1.5,2.0,2.0,2.5,2.5,2.0,4.0,2.5}; CPPUNIT_ASSERT_EQUAL(44,(int)m3->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples()); @@ -2081,8 +2081,8 @@ void MEDCouplingBasicsTest4::testFindNodesOnLine1() const double vec[2]={0.,1.}; const double vec2[3]={1.,0.,0.}; const double vec3[3]={0.,1.,1.}; - const int expected1[3]={0,3,6}; - std::vector res; + const mcIdType expected1[3]={0,3,6}; + std::vector res; mesh->findNodesOnLine(pt,vec,1e-12,res); CPPUNIT_ASSERT_EQUAL(3,(int)res.size()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,res.begin())); @@ -2125,19 +2125,19 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp2() m2c->setCoordsAt(1,coordsY2); MEDCouplingUMesh *m2=m2c->buildUnstructured(); // - DataArrayInt *d1=0,*d2=0; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); - const int expected1[9]={0,0,1,1,2,2,3,4,5}; - const int expected2[9]={0,2,1,3,1,3,2,3,3}; + 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}; CPPUNIT_ASSERT_EQUAL(9,(int)d1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)m3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(22,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(22,(int)m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); CPPUNIT_ASSERT(std::equal(expected1,expected1+9,d1->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+9,d2->getConstPointer())); - const int expected3[45]={5,16,13,12,15,5,15,4,5,16,5,21,2,13,16,5,16,5,6,21,5,17,14,2,21,5,21,6,7,17,5,4,18,19,5,5,5,19,10,6,5,6,10,20,7}; - const int expected4[10]={0,5,10,15,20,25,30,35,40,45}; + const mcIdType expected3[45]={5,16,13,12,15,5,15,4,5,16,5,21,2,13,16,5,16,5,6,21,5,17,14,2,21,5,21,6,7,17,5,4,18,19,5,5,5,19,10,6,5,6,10,20,7}; + const mcIdType expected4[10]={0,5,10,15,20,25,30,35,40,45}; const double expected5[44]={0.0,0.0,1.0,0.0,1.5,0.0,2.0,0.0,0.0,1.5,1.0,1.5,1.5,1.5,2.0,1.5,0.0,3.0,1.0,3.0,1.5,3.0,2.0,3.0,0.0,0.0,1.0,0.0,2.0,0.0,0.0,1.0,1.0,1.0,2.0,1.0,0.0,3.0,1.0,3.0,2.0,3.0,1.5,1.0}; CPPUNIT_ASSERT_EQUAL(45,(int)m3->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(10,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples()); @@ -2162,8 +2162,8 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp2() void MEDCouplingBasicsTest4::testBuildPartOfMySelfSafe1() { MEDCouplingUMesh *mesh=build2DTargetMesh_1(); - const int input1[4]={0,-1,4,2}; - const int input2[4]={0,4,5,4}; + const mcIdType input1[4]={0,-1,4,2}; + const mcIdType input2[4]={0,4,5,4}; CPPUNIT_ASSERT_THROW(mesh->buildPartOfMySelf(input1,input1+4,true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(mesh->buildPartOfMySelf(input2,input2+4,true),INTERP_KERNEL::Exception); mesh->decrRef(); @@ -2172,7 +2172,7 @@ void MEDCouplingBasicsTest4::testBuildPartOfMySelfSafe1() void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3() { double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214}; - int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; + mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; MEDCouplingUMesh *m1=MEDCouplingUMesh::New(); m1->setMeshDimension(2); m1->allocateCells(8); @@ -2192,7 +2192,7 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3() myCoords1->decrRef(); // double m2Coords[30]={0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.}; - int m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13}; + mcIdType m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13}; MEDCouplingUMesh *m2=MEDCouplingUMesh::New(); m2->setMeshDimension(2); m2->allocateCells(8); @@ -2205,20 +2205,20 @@ void MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3() m2->setCoords(myCoords2); myCoords2->decrRef(); // - DataArrayInt *d1=0,*d2=0; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); m3->unPolyze(); - const int expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7}; - const int expected2[16]={0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1}; - CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples()); + const mcIdType expected1[16]={0,1,1,1,2,3,3,3,4,5,5,5,6,7,7,7}; + const mcIdType expected2[16]={0,0,1,-1,2,2,3,-1,4,4,5,-1,6,6,7,-1}; + CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(16,(int)m3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(104,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(104,(int)m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); CPPUNIT_ASSERT(std::equal(expected1,expected1+16,d1->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+16,d2->getConstPointer())); - const int expected3[136]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103}; - const int expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136}; + const mcIdType expected3[136]={6,28,1,25,44,45,46,8,26,1,28,27,47,48,49,50,8,40,2,26,27,51,52,53,54,8,28,4,40,27,55,56,57,58,6,28,25,5,59,60,61,8,28,5,32,31,62,63,64,65,8,32,6,41,31,66,67,68,69,8,41,4,28,31,70,71,72,73,6,25,37,5,74,75,76,8,32,5,37,36,77,78,79,80,8,42,6,32,36,81,82,83,84,8,37,8,42,36,85,86,87,88,6,1,37,25,89,90,91,8,37,1,26,38,92,93,94,95,8,26,2,43,38,96,97,98,99,8,43,8,37,38,100,101,102,103}; + const mcIdType expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136}; const double expected5[208]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,1.118033988749895,1.,-1.118033988749895,1.,-1.118033988749895,-1.,1.118033988749895,-1.,0.7071067811865477,0.7071067811865476,0.5,0.,0.,0.5,1.05,0.,0.7071067811865475,0.7071067811865477,0.55,1.,1.1,0.5,1.4012585384440737,0.535233134659635,1.3,0.,1.1,0.5,1.1090169943749475,1.,0.,1.25,0.6123724356957946,1.369306393762915,1.1090169943749475,1.,0.55,1.,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-0.7071067811865475,0.7071067811865477,-1.05,0.,-1.1,0.5,-0.55,1.,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.1090169943749475,1.,-1.1,0.5,-0.6123724356957941,1.3693063937629155,0.,1.25,-0.55,1.,-1.1090169943749475,1.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.5,0.,-1.05,0.,-0.7071067811865478,-0.7071067811865475,-0.55,-1.,-1.1,-0.5,-1.4012585384440734,-0.5352331346596354,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,0.,-1.25,-0.6123724356957945,-1.369306393762915,-1.1090169943749475,-1.,-0.55,-1.,0.7071067811865475,-0.7071067811865477,0.,-0.5,0.5,0.,0.7071067811865477,-0.7071067811865475,1.05,0.,1.1,-0.5,0.55,-1.,1.3,0.,1.4012585384440737,-0.535233134659635,1.1090169943749475,-1.,1.1,-0.5,0.6123724356957946,-1.369306393762915,0.,-1.25,0.55,-1.,1.1090169943749475,-1.0}; CPPUNIT_ASSERT_EQUAL(136,(int)m3->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(17,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index 8aa080b22..41a7cb634 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -24,6 +24,7 @@ #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingGaussLocalization.hxx" #include "MEDCouplingMultiFields.hxx" #include "MEDCouplingFieldOverTime.hxx" @@ -37,7 +38,7 @@ using namespace MEDCoupling; void MEDCouplingBasicsTest5::testUMeshTessellate2D1() { double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214}; - int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; + mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; MEDCouplingUMesh *m1=MEDCouplingUMesh::New(); m1->setMeshDimension(2); m1->allocateCells(8); @@ -59,8 +60,8 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() MEDCouplingUMesh *m11=static_cast(m1->deepCopy()); m11->tessellate2D(1.); CPPUNIT_ASSERT(m11->getCoords()->isEqual(*m11->getCoords(),1e-12)); - const int 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}; - const int expected2[9]={0,5,12,17,24,29,36,41,48}; + 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}; + const mcIdType expected2[9]={0,5,12,17,24,29,36,41,48}; CPPUNIT_ASSERT_EQUAL(48,(int)m11->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(9,(int)m11->getNodalConnectivityIndex()->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected1,expected1+48,m11->getNodalConnectivity()->getConstPointer())); @@ -69,9 +70,9 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() // MEDCouplingUMesh *m12=static_cast(m1->deepCopy()); m12->tessellate2D(0.5); - CPPUNIT_ASSERT_EQUAL(41,m12->getNumberOfNodes()); - const int 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}; - const int expected4[9]={0,6,15,21,30,36,45,51,60}; + 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}; + const mcIdType expected4[9]={0,6,15,21,30,36,45,51,60}; const double expected5[82]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,0.479425538604203,0.8775825618903728,0.8414709848078964,0.54030230586814,0.7191383079063044,1.3163738428355591,1.2622064772118446,0.8104534588022099,-0.877582561890373,0.4794255386042027,-0.5403023058681399,0.8414709848078964,-1.3163738428355596,0.7191383079063038,-0.8104534588022098,1.2622064772118446,-0.4794255386042031,-0.8775825618903728,-0.8414709848078965,-0.5403023058681399,-0.7191383079063045,-1.3163738428355591,-1.2622064772118449,-0.8104534588022098,0.8775825618903729,-0.47942553860420295,0.54030230586814,-0.8414709848078964,1.3163738428355594,-0.7191383079063043,0.8104534588022099,-1.2622064772118446}; for(int i=0;i<82;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected5[i],m12->getCoords()->getIJ(0,i),1e-12); @@ -88,7 +89,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() { // A quarter of circle: double mcoords[6] = {0.4,0.0, 0.0,-0.4, 0.283,-0.283}; - int mconnec[3] = {0,1,2}; + mcIdType mconnec[3] = {0,1,2}; MEDCouplingUMesh *m1 = MEDCouplingUMesh::New(); m1->setMeshDimension(1); @@ -114,7 +115,7 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() { double m1Coords[50]={0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1,0.,-1.5,0.5,0.,1.25,0.,0.70710678118654757,0.70710678118654757,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.70710678118654757,0.70710678118654757,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.70710678118654757,-0.70710678118654757,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.70710678118654757,-0.70710678118654757,1.0606601717798214,-1.0606601717798214}; - int m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; + mcIdType m1Conn[56]={0,3,1,13,11,9, 3,4,2,1,14,12,10,11, 5,3,0,15,13,17, 6,4,3,5,16,14,15,18, 5,0,7,17,21,19, 6,5,7,8,18,19,22,20, 0,1,7,9,23,21, 1,2,8,7,10,24,22,23}; MEDCouplingUMesh *m1=MEDCouplingUMesh::New(); m1->setMeshDimension(2); m1->allocateCells(8); @@ -134,7 +135,7 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() myCoords1->decrRef(); // double m2Coords[30]={0.,0.,1.1,0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1,-1.1,-1.,0.,-1.,1.1,-1,1.7,-1.}; - int m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13}; + mcIdType m2Conn[32]={0,3,2,1, 1,2,5,4, 7,6,3,0, 8,9,6,7, 7,0,12,11, 8,7,11,10, 0,1,13,12, 1,4,14,13}; MEDCouplingUMesh *m2=MEDCouplingUMesh::New(); m2->setMeshDimension(2); m2->allocateCells(8); @@ -147,20 +148,20 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() m2->setCoords(myCoords2); myCoords2->decrRef(); // - DataArrayInt *d1=0,*d2=0; + DataArrayIdType *d1=0,*d2=0; MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m2,m1,1e-10,d1,d2); m3->unPolyze(); - const int expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7}; - const int expected2[16]={0,1,1,-1,2,3,3,-1,4,5,5,-1,6,7,7,-1}; + const mcIdType expected1[16]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7}; + const mcIdType expected2[16]={0,1,1,-1,2,3,3,-1,4,5,5,-1,6,7,7,-1}; CPPUNIT_ASSERT_EQUAL(16,(int)d1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(16,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(16,(int)m3->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(104,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(104,(int)m3->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,m3->getSpaceDimension()); CPPUNIT_ASSERT(std::equal(expected1,expected1+16,d1->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+16,d2->getConstPointer())); - const int expected3[136]={6,16,15,18,44,45,46,8,18,2,1,16,47,48,49,50,8,17,1,2,40,51,52,53,54,8,40,5,4,17,55,56,57,58,6,18,15,20,59,60,61,8,20,7,6,18,62,63,64,65,8,41,6,7,21,66,67,68,69,8,21,8,9,41,70,71,72,73,6,20,15,22,74,75,76,8,22,11,7,20,77,78,79,80,8,21,7,11,42,81,82,83,84,8,42,10,8,21,85,86,87,88,6,22,15,16,89,90,91,8,16,1,13,22,92,93,94,95,8,43,13,1,17,96,97,98,99,8,17,4,14,43,100,101,102,103}; - const int expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136}; + const mcIdType expected3[136]={6,16,15,18,44,45,46,8,18,2,1,16,47,48,49,50,8,17,1,2,40,51,52,53,54,8,40,5,4,17,55,56,57,58,6,18,15,20,59,60,61,8,20,7,6,18,62,63,64,65,8,41,6,7,21,66,67,68,69,8,21,8,9,41,70,71,72,73,6,20,15,22,74,75,76,8,22,11,7,20,77,78,79,80,8,21,7,11,42,81,82,83,84,8,42,10,8,21,85,86,87,88,6,22,15,16,89,90,91,8,16,1,13,22,92,93,94,95,8,43,13,1,17,96,97,98,99,8,17,4,14,43,100,101,102,103}; + const mcIdType expected4[17]={0,7,16,25,34,41,50,59,68,75,84,93,102,109,118,127,136}; const double expected5[208]={0.,0.,1.1, 0.,1.1,1.,0.,1.,1.7,0.,1.7,1.,-1.1,1.,-1.1,0.,-1.7,0.,-1.7,1.,-1.7,-1.,-1.1,-1.,0.,-1.,1.1,-1.,1.7,-1.,0.,0.,1.,0.,1.5,0.,0.,1.,0.,1.5,-1.,0.,-1.5,0.,0.,-1.,0.,-1.5,0.5,0.,1.25,0.,0.7071067811865476,0.7071067811865476,1.0606601717798214,1.0606601717798214,0.,0.5,0.,1.25,-0.7071067811865476,0.7071067811865476,-1.0606601717798214,1.0606601717798214,-0.5,0.,-1.25,0.,-0.7071067811865476,-0.7071067811865476,-1.0606601717798214,-1.0606601717798214,0.,-0.5,0.,-1.25,0.7071067811865476,-0.7071067811865476,1.0606601717798214,-1.0606601717798214,1.1180339887498951,1.,-1.1180339887498951,1.,-1.1180339887498951,-1.,1.1180339887498951,-1.,0.5,0.,0.,0.5,0.7071067811865477,0.7071067811865476,0.55,1.,1.1,0.5,1.05,0.,0.7071067811865477,0.7071067811865475,1.3,0.,1.1,0.5,1.1090169943749475,1.,1.4012585384440737,0.535233134659635,1.4090169943749475,1.,1.7,0.5,1.6,0.,1.4012585384440737,0.535233134659635,0.,0.5,-0.5,0.,-0.7071067811865477,0.7071067811865476,-1.05,0.,-1.1,0.5,-0.55,1.,-0.7071067811865478,0.7071067811865475,-1.1090169943749475,1.,-1.1,0.5,-1.3,0.,-1.4012585384440737,0.5352331346596344,-1.6,0.,-1.7,0.5,-1.4090169943749475,1.,-1.4012585384440737,0.5352331346596344,-0.5,0.,0.,-0.5,-0.7071067811865475,-0.7071067811865477,-0.55,-1.,-1.1,-0.5,-1.05,0.,-0.7071067811865475,-0.7071067811865477,-1.3,0.,-1.1,-0.5,-1.1090169943749475,-1.,-1.4012585384440734,-0.5352331346596354,-1.4090169943749475,-1.,-1.7,-0.5,-1.6,0.,-1.4012585384440732,-0.5352331346596354,0.,-0.5,0.5,0.,0.7071067811865475,-0.7071067811865477,1.05,0.,1.1,-0.5,0.55,-1.,0.7071067811865475,-0.7071067811865477,1.1090169943749475,-1.,1.1,-0.5,1.3,0.,1.4012585384440737,-0.535233134659635,1.6,0.,1.7,-0.5,1.4090169943749475,-1.,1.4012585384440737,-0.535233134659635}; CPPUNIT_ASSERT_EQUAL(136,(int)m3->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(17,(int)m3->getNodalConnectivityIndex()->getNumberOfTuples()); @@ -182,13 +183,13 @@ void MEDCouplingBasicsTest5::testGetCellIdsCrossingPlane1() MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); const double vec[3]={-0.07,1.,0.07}; const double origin[3]={1.524,1.4552,1.74768}; - DataArrayInt *ids1=mesh3D->getCellIdsCrossingPlane(origin,vec,1e-10); + DataArrayIdType *ids1=mesh3D->getCellIdsCrossingPlane(origin,vec,1e-10); CPPUNIT_ASSERT_EQUAL(9,(int)ids1->getNumberOfTuples()); - const int expected1[9]={1,3,4,7,9,10,13,15,16}; + const mcIdType expected1[9]={1,3,4,7,9,10,13,15,16}; CPPUNIT_ASSERT(std::equal(expected1,expected1+9,ids1->getConstPointer())); const double vec2[3]={0.,0.,1.}; - DataArrayInt *ids2=mesh3D->getCellIdsCrossingPlane(origin,vec2,1e-10); - const int expected2[6]={6,7,8,9,10,11}; + DataArrayIdType *ids2=mesh3D->getCellIdsCrossingPlane(origin,vec2,1e-10); + const mcIdType expected2[6]={6,7,8,9,10,11}; CPPUNIT_ASSERT_EQUAL(6,(int)ids2->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected2,expected2+6,ids2->getConstPointer())); ids1->decrRef(); @@ -205,15 +206,15 @@ void MEDCouplingBasicsTest5::testBuildSlice3D1() // 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}; - DataArrayInt *ids=0; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids); - const int expected1[9]={1,3,4,7,9,10,13,15,16}; - const int 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}; - const int expected3[10]={0,6,11,17,22,27,32,37,42,47}; + 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}; + const mcIdType expected3[10]={0,6,11,17,22,27,32,37,42,47}; const double expected4[171]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,2.,2.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,2.,2.,1.,1.,1.,2.,1.,1.25,2.,1.,1.5,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,1.,1.,3.,1.,1.25,3.,1.,1.5,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,1.,1.5408576,0.,2.,1.6108576000000001,0.,2.,1.5408576,1.,1.,1.5,0.5836800000000008,1.,1.4708576,1.,3.,1.6808576,0.,3.,1.6108576000000001,1.,0.,1.4708576,0.,0.,1.4008576,1.,2.,1.4708576,2.,1.,1.4008576000000001,2.,3.,1.5408575999999998,2.,0.,1.3308575999999999,2.,2.,1.4008576,3.,1.,1.3308576,3.,3.,1.4708576,3.,0.,1.2608576,3.}; CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(57,slice1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(57,(int)slice1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(9,(int)slice1->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(9,(int)ids->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(47,(int)slice1->getNodalConnectivity()->getNumberOfTuples()); @@ -229,12 +230,12 @@ void MEDCouplingBasicsTest5::testBuildSlice3D1() const double vec2[3]={0.,3.,1.}; const double origin2[3]={2.5,1.,3.}; slice1=mesh3D->buildSlice3D(origin2,vec2,1e-10,ids); - const int expected5[49]={5,50,10,4,51,5,50,52,7,10,5,51,4,5,53,5,54,50,51,55,56,5,54,57,52,50,5,56,55,51,53,58,5,38,59,56,54,43,5,54,57,46,43,5,38,59,56,58,48}; - const int expected6[10]={0,5,10,15,21,26,32,38,43,49}; + const mcIdType expected5[49]={5,50,10,4,51,5,50,52,7,10,5,51,4,5,53,5,54,50,51,55,56,5,54,57,52,50,5,56,55,51,53,58,5,38,59,56,54,43,5,54,57,46,43,5,38,59,56,58,48}; + const mcIdType expected6[10]={0,5,10,15,21,26,32,38,43,49}; const double expected7[180]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,1.,3.,0.,2.,2.,0.,2.,3.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25,2.,1.,0.,2.,1.,1.5,2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,0.,0.,3.,1.,1.,3.,1.,1.25,3.,1.,0.,3.,1.,1.5,3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,2.,1.6666666666666667,1.,1.,1.6666666666666667,1.,3.,1.6666666666666667,1.,0.,1.6666666666666667,1.,2.,1.3333333333333335,2.,1.,1.5,1.5,1.,1.3333333333333333,2.,3.,1.3333333333333335,2.,0.,1.3333333333333335,2.,1.,1.25,2.25}; CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(60,slice1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(60,(int)slice1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(9,(int)slice1->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(9,(int)ids->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(49,(int)slice1->getNodalConnectivity()->getNumberOfTuples()); @@ -250,13 +251,13 @@ void MEDCouplingBasicsTest5::testBuildSlice3D1() const double vec3[3]={0.,0.,1.}; const double origin3[3]={2.5,1.,2.}; slice1=mesh3D->buildSlice3D(origin3,vec3,1e-10,ids); - const int expected8[12]={6,7,8,9,10,11,12,13,14,15,16,17}; - const int expected9[68]={5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28,5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28}; - const int expected10[13]={0,5,12,17,22,29,34,39,46,51,56,63,68}; + const mcIdType expected8[12]={6,7,8,9,10,11,12,13,14,15,16,17}; + const mcIdType expected9[68]={5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28,5,15,26,16,18,5,16,21,28,22,19,17,5,18,20,21,16,5,21,24,25,28,5,26,16,17,19,22,23,5,22,27,29,28}; + const mcIdType expected10[13]={0,5,12,17,22,29,34,39,46,51,56,63,68}; const double expected11[135]={0.,0.,1.,1.,1.,1.,1.,1.25, 1.,1.,0.,1.,1.,1.5, 1.,2.,0.,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25, 2.,1.,0.,2.,1.,1.5, 2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,1.,3.,2.,2.,2.,2.,2.,3.,2.,0.,0.,3.,1.,1.,3.,1.,1.25, 3.,1.,0.,3.,1.,1.5, 3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,1.,3.,3.,2.,2.,3.,2.,3.,3.}; CPPUNIT_ASSERT_EQUAL(2,slice1->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(45,slice1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(45,(int)slice1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(12,(int)slice1->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(12,(int)ids->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(68,(int)slice1->getNodalConnectivity()->getNumberOfTuples()); @@ -277,22 +278,22 @@ void MEDCouplingBasicsTest5::testBuildSlice3DSurf1() MEDCouplingUMesh *mesh2D=0; MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); mesh2D->decrRef(); - DataArrayInt *a=DataArrayInt::New(),*b=DataArrayInt::New(),*c=DataArrayInt::New(),*d=DataArrayInt::New(); + DataArrayIdType *a=DataArrayIdType::New(),*b=DataArrayIdType::New(),*c=DataArrayIdType::New(),*d=DataArrayIdType::New(); mesh2D=mesh3D->buildDescendingConnectivity(a,b,c,d); a->decrRef(); b->decrRef(); c->decrRef(); d->decrRef(); mesh3D->decrRef(); // const double vec1[3]={-0.07,1.,0.07}; const double origin1[3]={1.524,1.4552,1.74768}; - DataArrayInt *ids=0; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh2D->buildSlice3DSurf(origin1,vec1,1e-10,ids); - const int 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 int 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}; - const int expected3[26]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75}; + 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}; + const mcIdType expected3[26]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75}; const double expected4[171]={1.,1.,0.,1.,1.25,0.,1.,1.5,0.,2.,1.,0.,1.,2.,0.,0.,2.,0.,3.,1.,0.,3.,2.,0.,0.,1.,0.,2.,2.,0.,1.,1.,1.,1.,1.25,1.,1.,1.5,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,2.,2.,1.,1.,1.,2.,1.,1.25,2.,1.,1.5,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,2.,2.,2.,1.,1.,3.,1.,1.25,3.,1.,1.5,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,2.,2.,3.,1.,1.5408576,0.,2.,1.6108576000000001,0.,2.,1.5408576,1.,1.,1.5,0.5836800000000008,1.,1.4708576,1.,3.,1.6808576,0.,3.,1.6108576000000001,1.,0.,1.4708576,0.,0.,1.4008576,1.,2.,1.4708576,2.,1.,1.4008576000000001,2.,3.,1.5408575999999998,2.,0.,1.3308575999999999,2.,2.,1.4008576,3.,1.,1.3308576,3.,3.,1.4708576,3.,0.,1.2608576,3.}; CPPUNIT_ASSERT_EQUAL(1,slice1->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(57,slice1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(57,(int)slice1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(25,(int)slice1->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(25,(int)ids->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(75,(int)slice1->getNodalConnectivity()->getNumberOfTuples()); @@ -308,13 +309,13 @@ void MEDCouplingBasicsTest5::testBuildSlice3DSurf1() const double vec2[3]={0.,0.,1.}; const double origin2[3]={2.5,1.,2.}; slice1=mesh2D->buildSlice3DSurf(origin2,vec2,1e-10,ids); - const int expected5[68]={32,32,32,32,33,34,35,36,37,38,39,40,41,42,43,43,43,43,43,43,44,44,44,44,45,46,47,47,47,47,48,49,50,51,52,53,53,53,53,53,53,54,54,54,54,55,56,57,59,60,61,62,63,64,65,66,67,68,71,72,74,75,76,77,78,81,82,83}; - const int expected6[204]={1,15,18,1,18,16,1,16,26,1,26,15,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,16,21,1,21,28,1,28,22,1,22,19,1,19,17,1,17,16,1,16,18,1,18,20,1,20,21,1,21,16,1,20,21,1,18,20,1,28,21,1,21,24,1,24,25,1,25,28,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,26,16,1,16,17,1,17,19,1,19,22,1,22,23,1,23,26,1,22,28,1,28,29,1,29,27,1,27,22,1,27,22,1,29,27,1,28,29,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,20,21,1,18,20,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,27,22,1,29,27,1,28,29}; - const int expected7[69]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204}; + const mcIdType expected5[68]={32,32,32,32,33,34,35,36,37,38,39,40,41,42,43,43,43,43,43,43,44,44,44,44,45,46,47,47,47,47,48,49,50,51,52,53,53,53,53,53,53,54,54,54,54,55,56,57,59,60,61,62,63,64,65,66,67,68,71,72,74,75,76,77,78,81,82,83}; + const mcIdType expected6[204]={1,15,18,1,18,16,1,16,26,1,26,15,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,16,21,1,21,28,1,28,22,1,22,19,1,19,17,1,17,16,1,16,18,1,18,20,1,20,21,1,21,16,1,20,21,1,18,20,1,28,21,1,21,24,1,24,25,1,25,28,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,26,16,1,16,17,1,17,19,1,19,22,1,22,23,1,23,26,1,22,28,1,28,29,1,29,27,1,27,22,1,27,22,1,29,27,1,28,29,1,26,15,1,16,26,1,18,16,1,15,18,1,16,21,1,21,28,1,22,28,1,19,22,1,17,19,1,16,17,1,20,21,1,18,20,1,25,28,1,24,25,1,21,24,1,23,22,1,26,23,1,27,22,1,29,27,1,28,29}; + const mcIdType expected7[69]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204}; const double expected8[135]={0.,0.,1.,1.,1.,1.,1.,1.25, 1.,1.,0.,1.,1.,1.5, 1.,2.,0.,1.,2.,1.,1.,1.,2.,1.,0.,2.,1.,3.,1.,1.,3.,2.,1.,0.,1.,1.,1.,3.,1.,2.,2.,1.,2.,3.,1.,0.,0.,2.,1.,1.,2.,1.,1.25, 2.,1.,0.,2.,1.,1.5, 2.,2.,0.,2.,2.,1.,2.,1.,2.,2.,0.,2.,2.,3.,1.,2.,3.,2.,2.,0.,1.,2.,1.,3.,2.,2.,2.,2.,2.,3.,2.,0.,0.,3.,1.,1.,3.,1.,1.25, 3.,1.,0.,3.,1.,1.5, 3.,2.,0.,3.,2.,1.,3.,1.,2.,3.,0.,2.,3.,3.,1.,3.,3.,2.,3.,0.,1.,3.,1.,3.,3.,2.,2.,3.,2.,3.,3.}; CPPUNIT_ASSERT_EQUAL(1,slice1->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,slice1->getSpaceDimension()); - CPPUNIT_ASSERT_EQUAL(45,slice1->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(45,(int)slice1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(68,(int)slice1->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(68,(int)ids->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(204,(int)slice1->getNodalConnectivity()->getNumberOfTuples()); @@ -345,7 +346,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() CPPUNIT_ASSERT_THROW(da->setInfoAndChangeNbOfCompo(compsCpp),INTERP_KERNEL::Exception); std::copy(data1,data1+14,da->getPointer()); // - std::vector > p(3); + std::vector > p(3); p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7; tmp=dynamic_cast(da->selectByTupleRanges(p)); CPPUNIT_ASSERT(tmp->isEqual(*da,1e-14)); @@ -392,7 +393,7 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() CPPUNIT_ASSERT_DOUBLES_EQUAL(expected4[i],dac->getIJ(0,i),1e-14); dac->decrRef(); // - DataArrayInt *ids=DataArrayInt::New(); + DataArrayIdType *ids=DataArrayIdType::New(); ids->alloc(3,1); dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4); @@ -426,12 +427,12 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleAdvSetting1() void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() { - const int data1[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; - const int data2[10]={8,38,9,39,0,30,11,41,12,42}; + const mcIdType data1[14]={1,11,2,12,3,13,4,14,5,15,6,16,7,17}; + const mcIdType data2[10]={8,38,9,39,0,30,11,41,12,42}; const char *comps[2]={"comp1","comp2"}; std::vector compsCpp(comps,comps+2); - DataArrayInt *da=DataArrayInt::New(); - DataArrayInt *tmp=0; + DataArrayIdType *da=DataArrayIdType::New(); + DataArrayIdType *tmp=0; da->setInfoAndChangeNbOfCompo(compsCpp); da->setName("da"); da->alloc(7,2); @@ -439,22 +440,22 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() CPPUNIT_ASSERT_THROW(da->setInfoAndChangeNbOfCompo(compsCpp),INTERP_KERNEL::Exception); std::copy(data1,data1+14,da->getPointer()); // - std::vector > p(3); + std::vector > p(3); p[0].first=0; p[0].second=3; p[1].first=3; p[1].second=5; p[2].first=5; p[2].second=7; - tmp=dynamic_cast(da->selectByTupleRanges(p)); + tmp=dynamic_cast(da->selectByTupleRanges(p)); CPPUNIT_ASSERT(tmp->isEqual(*da)); tmp->decrRef(); p[0].first=0; p[0].second=2; p[1].first=3; p[1].second=4; p[2].first=5; p[2].second=7; - tmp=dynamic_cast(da->selectByTupleRanges(p)); - const int expected1[10]={1,11,2,12,4,14,6,16,7,17}; + tmp=dynamic_cast(da->selectByTupleRanges(p)); + const mcIdType expected1[10]={1,11,2,12,4,14,6,16,7,17}; CPPUNIT_ASSERT_EQUAL(5,(int)tmp->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfComponents()); for(int i=0;i<10;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],tmp->getIJ(0,i)); tmp->decrRef(); p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=6; - tmp=dynamic_cast(da->selectByTupleRanges(p)); - const int expected2[10]={1,11,2,12,1,11,2,12,6,16}; + tmp=dynamic_cast(da->selectByTupleRanges(p)); + const mcIdType expected2[10]={1,11,2,12,1,11,2,12,6,16}; CPPUNIT_ASSERT_EQUAL(5,(int)tmp->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,(int)tmp->getNumberOfComponents()); for(int i=0;i<10;i++) @@ -465,13 +466,13 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() p[0].first=0; p[0].second=2; p[1].first=0; p[1].second=2; p[2].first=5; p[2].second=8; CPPUNIT_ASSERT_THROW(da->selectByTupleRanges(p),INTERP_KERNEL::Exception); // - DataArrayInt *da2=DataArrayInt::New(); + DataArrayIdType *da2=DataArrayIdType::New(); da2->alloc(5,2); std::copy(data2,data2+10,da2->getPointer()); // - DataArrayInt *dac=da->deepCopy(); + DataArrayIdType *dac=da->deepCopy(); dac->setContigPartOfSelectedValuesSlice(1,da2,2,4,1); - const int expected3[14]={1,11,0,30,11,41,4,14,5,15,6,16,7,17}; + const mcIdType expected3[14]={1,11,0,30,11,41,4,14,5,15,6,16,7,17}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected3[i],dac->getIJ(0,i)); dac->decrRef(); @@ -481,17 +482,17 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(0,da2,4,6,1),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dac->setContigPartOfSelectedValuesSlice(3,da2,5,0,1),INTERP_KERNEL::Exception); dac->setContigPartOfSelectedValuesSlice(3,da2,1,5,1); - const int expected4[14]={1,11,2,12,3,13,9,39,0,30,11,41,12,42}; + const mcIdType expected4[14]={1,11,2,12,3,13,9,39,0,30,11,41,12,42}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected4[i],dac->getIJ(0,i)); dac->decrRef(); // - DataArrayInt *ids=DataArrayInt::New(); + DataArrayIdType *ids=DataArrayIdType::New(); ids->alloc(3,1); dac=da->deepCopy(); ids->setIJ(0,0,2); ids->setIJ(1,0,0); ids->setIJ(2,0,4); dac->setContigPartOfSelectedValues(2,da2,ids); - const int expected5[14]={1,11,2,12,0,30,8,38,12,42,6,16,7,17}; + const mcIdType expected5[14]={1,11,2,12,0,30,8,38,12,42,6,16,7,17}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected5[i],dac->getIJ(0,i)); dac->decrRef(); @@ -508,7 +509,7 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() ids->setIJ(0,0,2); ids->setIJ(1,0,2); ids->setIJ(2,0,1); dac=da->deepCopy(); dac->setContigPartOfSelectedValues(4,da2,ids); - const int expected6[14]={1,11,2,12,3,13,4,14,0,30,0,30,9,39}; + const mcIdType expected6[14]={1,11,2,12,3,13,4,14,0,30,0,30,9,39}; for(int i=0;i<14;i++) CPPUNIT_ASSERT_EQUAL(expected6[i],dac->getIJ(0,i)); dac->decrRef(); @@ -521,32 +522,32 @@ void MEDCouplingBasicsTest5::testDataArrayIntAdvSetting1() void MEDCouplingBasicsTest5::testBuildDescendingConnec2Of3DMesh1() { MEDCouplingUMesh *mesh=build3DSourceMesh_1(); - DataArrayInt *desc=DataArrayInt::New(); - DataArrayInt *descIndx=DataArrayInt::New(); - DataArrayInt *revDesc=DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc=DataArrayIdType::New(); + DataArrayIdType *descIndx=DataArrayIdType::New(); + DataArrayIdType *revDesc=DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); // MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); mesh2->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(2,mesh2->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(30,(int)mesh2->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL((std::size_t)31,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,(int)revDescIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)13,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,(int)descIndx->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL((std::size_t)48,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); - const int expected1[48]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,-10,15,-5,-13,16,17,-14,18,-4,19,-2,20,21,22,23,24,25,-11,26,-1,-12,-25,-22,27,28,-7,-20,-24,29,-16,-18,30,-8,-28}; + CPPUNIT_ASSERT_EQUAL(ToIdType(31),revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(31,(int)revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(13),descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(13,(int)descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(48),revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(48,(int)revDesc->getNumberOfTuples()); + const mcIdType expected1[48]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,-10,15,-5,-13,16,17,-14,18,-4,19,-2,20,21,22,23,24,25,-11,26,-1,-12,-25,-22,27,28,-7,-20,-24,29,-16,-18,30,-8,-28}; CPPUNIT_ASSERT(std::equal(expected1,expected1+48,desc->getConstPointer())); - const int expected2[13]={0,4,8,12,16,20,24,28,32,36,40,44,48}; + const mcIdType expected2[13]={0,4,8,12,16,20,24,28,32,36,40,44,48}; CPPUNIT_ASSERT(std::equal(expected2,expected2+13,descIndx->getConstPointer())); - const int expected3[31]={0,2,4,5,7,9,10,12,14,15,17,19,21,23,25,26,28,29,31,32,34,35,37,38,40,42,43,44,46,47,48}; + const mcIdType expected3[31]={0,2,4,5,7,9,10,12,14,15,17,19,21,23,25,26,28,29,31,32,34,35,37,38,40,42,43,44,46,47,48}; CPPUNIT_ASSERT(std::equal(expected3,expected3+31,revDescIndx->getConstPointer())); - const int expected4[48]={0,8,0,6,0,0,5,1,4,1,1,9,1,11,2,2,3,2,7,2,8,3,4,3,5,3,4,10,4,5,11,5,6,10,6,6,9,7,7,10,7,8,8,9,9,11,10,11}; + const mcIdType expected4[48]={0,8,0,6,0,0,5,1,4,1,1,9,1,11,2,2,3,2,7,2,8,3,4,3,5,3,4,10,4,5,11,5,6,10,6,6,9,7,7,10,7,8,8,9,9,11,10,11}; CPPUNIT_ASSERT(std::equal(expected4,expected4+48,revDesc->getConstPointer())); - DataArrayInt *conn=mesh2->getNodalConnectivity(); - DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex(); - const int expected5[31]={0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120}; + DataArrayIdType *conn=mesh2->getNodalConnectivity(); + DataArrayIdType *connIndex=mesh2->getNodalConnectivityIndex(); + const mcIdType expected5[31]={0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120}; CPPUNIT_ASSERT(std::equal(expected5,expected5+31,connIndex->getConstPointer())); - const int expected6[120]={3,8,1,7,3,8,3,1,3,1,3,7,3,7,3,8,3,6,0,8,3,6,2,0,3,0,2,8,3,8,2,6,3,7,4,5,3,7,8,4,3,4,8,5,3,5,8,7,3,6,8,4,3,6,7,8,3,4,7,6,3,8,4,0,3,0,4,6,3,6,3,8,3,7,3,6,3,8,0,1,3,1,0,3,3,3,0,8,3,4,1,5,3,4,8,1,3,1,8,5,3,1,7,5,3,0,2,3,3,3,2,8,3,1,4,0,3,3,2,6}; + const mcIdType expected6[120]={3,8,1,7,3,8,3,1,3,1,3,7,3,7,3,8,3,6,0,8,3,6,2,0,3,0,2,8,3,8,2,6,3,7,4,5,3,7,8,4,3,4,8,5,3,5,8,7,3,6,8,4,3,6,7,8,3,4,7,6,3,8,4,0,3,0,4,6,3,6,3,8,3,7,3,6,3,8,0,1,3,1,0,3,3,3,0,8,3,4,1,5,3,4,8,1,3,1,8,5,3,1,7,5,3,0,2,3,3,3,2,8,3,1,4,0,3,3,2,6}; CPPUNIT_ASSERT(std::equal(expected6,expected6+120,conn->getConstPointer())); // desc->decrRef(); @@ -560,7 +561,7 @@ void MEDCouplingBasicsTest5::testBuildDescendingConnec2Of3DMesh1() void MEDCouplingBasicsTest5::testAre2DCellsNotCorrectlyOriented1() { double m1Coords[8]={1.,1.,-1.,-1.,-1.,-1.,1.,-1.}; - int m1Conn[4]={0,3,1,2}; + mcIdType m1Conn[4]={0,3,1,2}; MEDCouplingUMesh *m1=MEDCouplingUMesh::New(); m1->setMeshDimension(2); m1->allocateCells(1); @@ -580,13 +581,13 @@ void MEDCouplingBasicsTest5::testAre2DCellsNotCorrectlyOriented1() vec2[1]=3.*sin(M_PI/9.*i); MEDCouplingUMesh *m1Cpy=static_cast(m1->deepCopy()); m1Cpy->translate(vec2); - std::vector res; + std::vector res; CPPUNIT_ASSERT_THROW(m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res),INTERP_KERNEL::Exception); res.clear(); m1Cpy->changeSpaceDimension(3); m1Cpy->are2DCellsNotCorrectlyOriented(vec1,false,res); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); - CPPUNIT_ASSERT_EQUAL(0,res[0]); + CPPUNIT_ASSERT_EQUAL(0,(int)res[0]); m1Cpy->decrRef(); } delete [] vec2; @@ -607,10 +608,10 @@ void MEDCouplingBasicsTest5::testDataArrayAbs1() for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],d1->getIJ(0,i),1e-14); // - const int expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15}; + const mcIdType expected2[12]={2,3,5,6,7,8,9,10,11,12,13,15}; d2->abs(); for(int i=0;i<12;i++) - CPPUNIT_ASSERT_EQUAL(expected2[i],d2->getIJ(0,i)); + CPPUNIT_ASSERT_EQUAL((int)expected2[i],d2->getIJ(0,i)); // d1->decrRef(); } @@ -621,15 +622,15 @@ void MEDCouplingBasicsTest5::testGetValueOn3() const double v2[5]={0.7,1.25,0.,2.,1.5}; const double disp[12]={5.,50.,500.,6.,60.,600.,7.,70.,700.,8.,80.,800.}; MEDCouplingUMesh *m=MEDCouplingUMesh::New("myMesh",1); - const int nbNodes=4; - const int nbCells=nbNodes-1; + const mcIdType nbNodes=4; + const mcIdType nbCells=nbNodes-1; m->allocateCells(nbCells); DataArrayDouble *coords=DataArrayDouble::New(); coords->alloc(nbNodes,1); std::copy(v,v+nbNodes,coords->getPointer()); m->setCoords(coords); coords->decrRef(); - const int conn[6]={0,1,2,1,2,3}; + const mcIdType conn[6]={0,1,2,1,2,3}; m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+2); m->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn+4); @@ -667,10 +668,10 @@ void MEDCouplingBasicsTest5::testGetNodeIdsOfCell2() // test in 1D m1c->setCoordsAt(0,coordsX); CPPUNIT_ASSERT_EQUAL(4,(int)m1c->getNumberOfCells()); - const int expected1[4][2]={{0,1},{1,2},{2,3},{3,4}}; + const mcIdType expected1[4][2]={{0,1},{1,2},{2,3},{3,4}}; for(int i=0;i<4;i++) { - std::vector v; + std::vector v; m1c->getNodeIdsOfCell(i,v); CPPUNIT_ASSERT((int)v.size()==2); std::equal(v.begin(),v.end(),expected1[i]); @@ -678,10 +679,10 @@ void MEDCouplingBasicsTest5::testGetNodeIdsOfCell2() // test in 2D m1c->setCoordsAt(1,coordsY); CPPUNIT_ASSERT_EQUAL(12,(int)m1c->getNumberOfCells()); - const int expected2[12][4]={{0,1,6,5},{1,2,7,6},{2,3,8,7},{3,4,9,8},{4,5,11,10},{5,6,12,11},{6,7,13,12},{7,8,14,13},{8,9,16,15},{9,10,17,16},{10,11,18,17},{11,12,19,18}}; + const mcIdType expected2[12][4]={{0,1,6,5},{1,2,7,6},{2,3,8,7},{3,4,9,8},{4,5,11,10},{5,6,12,11},{6,7,13,12},{7,8,14,13},{8,9,16,15},{9,10,17,16},{10,11,18,17},{11,12,19,18}}; for(int i=0;i<12;i++) { - std::vector v; + std::vector v; m1c->getNodeIdsOfCell(i,v); CPPUNIT_ASSERT((int)v.size()==4); std::equal(v.begin(),v.end(),expected2[i]); @@ -689,10 +690,10 @@ void MEDCouplingBasicsTest5::testGetNodeIdsOfCell2() // test in 3D m1c->setCoordsAt(2,coordsZ); CPPUNIT_ASSERT_EQUAL(24,(int)m1c->getNumberOfCells()); - const int expected3[24][8]={{0,1,6,5,20,21,26,25},{1,2,7,6,21,22,27,26},{2,3,8,7,22,23,28,27},{3,4,9,8,23,24,29,28},{4,5,11,10,24,25,31,30},{5,6,12,11,25,26,32,31},{6,7,13,12,26,27,33,32},{7,8,14,13,27,28,34,33},{8,9,16,15,28,29,36,35},{9,10,17,16,29,30,37,36},{10,11,18,17,30,31,38,37},{11,12,19,18,31,32,39,38},{20,21,26,25,40,41,46,45},{21,22,27,26,41,42,47,46},{22,23,28,27,42,43,48,47},{23,24,29,28,43,44,49,48},{24,25,31,30,44,45,51,50},{25,26,32,31,45,46,52,51},{26,27,33,32,46,47,53,52},{27,28,34,33,47,48,54,53},{28,29,36,35,48,49,56,55},{29,30,37,36,49,50,57,56},{30,31,38,37,50,51,58,57},{31,32,39,38,51,52,59,58}}; + const mcIdType expected3[24][8]={{0,1,6,5,20,21,26,25},{1,2,7,6,21,22,27,26},{2,3,8,7,22,23,28,27},{3,4,9,8,23,24,29,28},{4,5,11,10,24,25,31,30},{5,6,12,11,25,26,32,31},{6,7,13,12,26,27,33,32},{7,8,14,13,27,28,34,33},{8,9,16,15,28,29,36,35},{9,10,17,16,29,30,37,36},{10,11,18,17,30,31,38,37},{11,12,19,18,31,32,39,38},{20,21,26,25,40,41,46,45},{21,22,27,26,41,42,47,46},{22,23,28,27,42,43,48,47},{23,24,29,28,43,44,49,48},{24,25,31,30,44,45,51,50},{25,26,32,31,45,46,52,51},{26,27,33,32,46,47,53,52},{27,28,34,33,47,48,54,53},{28,29,36,35,48,49,56,55},{29,30,37,36,49,50,57,56},{30,31,38,37,50,51,58,57},{31,32,39,38,51,52,59,58}}; for(int i=0;i<12;i++) { - std::vector v; + std::vector v; m1c->getNodeIdsOfCell(i,v); CPPUNIT_ASSERT((int)v.size()==8); std::equal(v.begin(),v.end(),expected3[i]); @@ -707,7 +708,7 @@ void MEDCouplingBasicsTest5::testGetNodeIdsOfCell2() void MEDCouplingBasicsTest5::testRenumberNodesInConn1() { double mesh2DCoords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. }; - int mesh2DConn[18]={1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType mesh2DConn[18]={1,4,2, 4,5,2, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2); mesh2D->allocateCells(5); mesh2D->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,mesh2DConn); @@ -724,7 +725,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() mesh2D->checkConsistencyLight(); // double mesh3DCoords[24]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1. }; - int mesh3DConn[8]={0,1,2,3,4,5,6,7}; + mcIdType mesh3DConn[8]={0,1,2,3,4,5,6,7}; MEDCouplingUMesh *mesh3D=MEDCouplingUMesh::New("mesh",3); mesh3D->allocateCells(1); mesh3D->insertNextCell(INTERP_KERNEL::NORM_HEXA8,8,mesh3DConn); @@ -740,8 +741,8 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() MEDCouplingUMesh *mesh2D_2=dynamic_cast(mesh2D->deepCopy()); MEDCouplingUMesh *mesh3D_4=dynamic_cast(mesh3D->deepCopy()); MEDCouplingUMesh *mesh2D_4=dynamic_cast(mesh2D->deepCopy()); - DataArrayInt *renumNodes=DataArrayInt::New(); - int oldNbOf3DNodes=mesh3D->getNumberOfNodes(); + DataArrayIdType *renumNodes=DataArrayIdType::New(); + mcIdType oldNbOf3DNodes=mesh3D->getNumberOfNodes(); renumNodes->alloc(mesh2D->getNumberOfNodes(),1); renumNodes->iota(oldNbOf3DNodes); DataArrayDouble *coo=DataArrayDouble::Aggregate(mesh3D->getCoords(),mesh2D->getCoords()); @@ -755,12 +756,12 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() CPPUNIT_ASSERT(mesh2D_3->isEqual(mesh2D,1e-12)); mesh2D_3->decrRef(); // - DataArrayInt *da1,*da2; + DataArrayIdType *da1,*da2; mesh3D->checkGeoEquivalWith(mesh3D_2,10,1e-12,da1,da2); CPPUNIT_ASSERT(da1==0); CPPUNIT_ASSERT_EQUAL(8,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - const int expected1[8]={8,11,12,9,4,5,6,7}; + const mcIdType expected1[8]={8,11,12,9,4,5,6,7}; for(int i=0;i<8;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0)); da2->decrRef(); @@ -769,7 +770,7 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() CPPUNIT_ASSERT(da1==0); CPPUNIT_ASSERT_EQUAL(9,(int)da2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da2->getNumberOfComponents()); - for(int i=0;i<9;i++) + for(mcIdType i=0;i<9;i++) CPPUNIT_ASSERT_EQUAL(8+i,da2->getIJ(i,0)); da2->decrRef(); // @@ -782,14 +783,14 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords()); CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords()); mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight(); - CPPUNIT_ASSERT_EQUAL(26,mesh3D_4->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(26,(int)mesh3D_4->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(9,(int)mesh3D_4->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_4->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_5->getNodalConnectivity()->getNumberOfTuples()); - const int expected2[9]={18,0,1,2,3,4,5,6,7}; - const int expected3[23]={3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12}; - const int expected4[23]={3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21}; + const mcIdType expected2[9]={18,0,1,2,3,4,5,6,7}; + const mcIdType expected3[23]={3,9,12,10, 3,12,13,10, 4,8,11,12,9, 4,14,15,12,11, 4,15,16,13,12}; + const mcIdType expected4[23]={3,18,21,19, 3,21,22,19, 4,17,20,21,18, 4,23,24,21,20, 4,24,25,22,21}; const double expected5[78]={-0.3,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.2,-0.3,0., -0.3,-0.3,1., -0.3,0.2,1., 0.2,0.2,1., 0.2,-0.3,1., -0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0., 0.7, -0.3, 0.0, 1.2, -0.3, 0.0, 1.7, -0.3, 0.0, 0.7, 0.2, 0.0, 1.2, 0.2, 0.0, 1.7, 0.2, 0.0, 0.7, 0.7, 0.0, 1.2, 0.7, 0.0, 1.7, 0.7, 0.0}; CPPUNIT_ASSERT(std::equal(expected2,expected2+9,mesh3D_4->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected3,expected3+23,mesh2D_4->getNodalConnectivity()->getConstPointer())); @@ -801,14 +802,14 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() mesh3D_4->checkConsistencyLight(); mesh2D_4->checkConsistencyLight(); mesh2D_5->checkConsistencyLight(); CPPUNIT_ASSERT(mesh3D_4->getCoords()==mesh2D_4->getCoords()); CPPUNIT_ASSERT(mesh2D_4->getCoords()==mesh2D_5->getCoords()); - CPPUNIT_ASSERT_EQUAL(19,mesh3D_4->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(19,(int)mesh3D_4->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh3D_4->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(9,(int)mesh3D_4->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_4->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(23,(int)mesh2D_5->getNodalConnectivity()->getNumberOfTuples()); - const int expected6[9]={18,0,1,2,3,4,5,6,7}; - const int expected7[23]={3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2}; - const int expected8[23]={3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15}; + const mcIdType expected6[9]={18,0,1,2,3,4,5,6,7}; + const mcIdType expected7[23]={3,3,2,8, 3,2,9,8, 4,0,1,2,3, 4,10,11,2,1, 4,11,12,9,2}; + const mcIdType expected8[23]={3,13,15,14, 3,15,16,14, 4,8,9,15,13, 4,12,17,15,9, 4,17,18,16,15}; const double expected9[57]={-0.3, -0.3, 0., -0.3, 0.2, 0., 0.2, 0.2, 0., 0.2, -0.3, 0., -0.3, -0.3, 1., -0.3, 0.2, 1., 0.2, 0.2, 1., 0.2, -0.3, 1., 0.7, -0.3, 0., 0.7, 0.2, 0., -0.3, 0.7, 0., 0.2, 0.7, 0., 0.7, 0.7, 0., 1.2, -0.3, 0., 1.7, -0.3, 0., 1.2, 0.2, 0., 1.7, 0.2, 0., 1.2, 0.7, 0., 1.7, 0.7, 0.}; @@ -831,12 +832,12 @@ void MEDCouplingBasicsTest5::testRenumberNodesInConn1() void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - DataArrayInt *d1=0,*d2=0; + DataArrayIdType *d1=0,*d2=0; m->computeNeighborsOfCells(d1,d2); CPPUNIT_ASSERT_EQUAL(6,(int)d2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(10,(int)d1->getNumberOfTuples()); - const int expected1[6]={0,2,4,6,8,10}; - const int expected2[10]={3,1,0,2,4,1,4,0,2,3}; + const mcIdType expected1[6]={0,2,4,6,8,10}; + const mcIdType expected2[10]={3,1,0,2,4,1,4,0,2,3}; CPPUNIT_ASSERT(std::equal(expected1,expected1+6,d2->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected2,expected2+10,d1->getConstPointer())); d1->decrRef(); @@ -847,7 +848,7 @@ void MEDCouplingBasicsTest5::testComputeNeighborsOfCells1() void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1() { double mesh2DCoords[10]={323.85,120.983748908684,317.5,131.982271536747,336.55,120.983748908686,330.2,131.982271536751,323.85,142.98079416481}; - int mesh2DConn[5]={4,1,0,2,3}; + mcIdType mesh2DConn[5]={4,1,0,2,3}; MEDCouplingUMesh *mesh2D=MEDCouplingUMesh::New("mesh",2); mesh2D->allocateCells(1); mesh2D->insertNextCell(INTERP_KERNEL::NORM_POLYGON,5,mesh2DConn); @@ -859,7 +860,7 @@ void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1() myCoords->decrRef(); mesh2D->checkConsistencyLight(); // - std::vector v; + std::vector v; mesh2D->checkButterflyCells(v); CPPUNIT_ASSERT_EQUAL(0,(int)v.size()); // @@ -868,66 +869,66 @@ void MEDCouplingBasicsTest5::testCheckButterflyCellsBug1() void MEDCouplingBasicsTest5::testDataArrayIntRange1() { - DataArrayInt *d=DataArrayInt::Range(2,17,7); - const int expected1[3]={2,9,16}; - CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + DataArrayIdType *d=DataArrayIdType::Range(2,17,7); + const mcIdType expected1[3]={2,9,16}; + CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer())); d->decrRef(); // - d=DataArrayInt::Range(2,23,7); - CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(2,23,7); + CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected1,expected1+3,d->getConstPointer())); d->decrRef(); // - d=DataArrayInt::Range(2,24,7); - const int expected2[4]={2,9,16,23}; - CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(2,24,7); + const mcIdType expected2[4]={2,9,16,23}; + CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected2,expected2+4,d->getConstPointer())); d->decrRef(); // - d=DataArrayInt::Range(24,2,-7); - const int expected3[4]={24,17,10,3}; - CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(24,2,-7); + const mcIdType expected3[4]={24,17,10,3}; + CPPUNIT_ASSERT_EQUAL(4,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected3,expected3+4,d->getConstPointer())); d->decrRef(); // - d=DataArrayInt::Range(23,2,-7); - const int expected4[3]={23,16,9}; - CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(23,2,-7); + const mcIdType expected4[3]={23,16,9}; + CPPUNIT_ASSERT_EQUAL(3,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,d->getConstPointer())); d->decrRef(); // - d=DataArrayInt::Range(23,22,-7); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(23,d->getIJ(0,0)); + d=DataArrayIdType::Range(23,22,-7); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(23,(int)d->getIJ(0,0)); d->decrRef(); // - d=DataArrayInt::Range(22,23,7); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(22,d->getIJ(0,0)); + d=DataArrayIdType::Range(22,23,7); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(22,(int)d->getIJ(0,0)); d->decrRef(); // - d=DataArrayInt::Range(22,22,7); - CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(22,22,7); + CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); d->decrRef(); // - d=DataArrayInt::Range(22,22,-7); - CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); + d=DataArrayIdType::Range(22,22,-7); + CPPUNIT_ASSERT_EQUAL(0,(int)d->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(1,(int)d->getNumberOfComponents()); d->decrRef(); // - CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,-7),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,7),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(DataArrayInt::Range(23,22,0),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(DataArrayInt::Range(22,23,0),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(22,23,-7),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(23,22,7),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(23,22,0),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(DataArrayIdType::Range(22,23,0),INTERP_KERNEL::Exception); } void MEDCouplingBasicsTest5::testDataArrayDoubleGetMinMaxPerComponent1() @@ -964,13 +965,13 @@ void MEDCouplingBasicsTest5::testDataArrayDoubleGetMinMaxPerComponent1() void MEDCouplingBasicsTest5::testDataArrayIntGetHashCode1() { - DataArrayInt *d1=DataArrayInt::New(); d1->alloc(3545,1); d1->iota(0); - DataArrayInt *d2=DataArrayInt::New(); d2->alloc(3545,1); d2->iota(0); + DataArrayIdType *d1=DataArrayIdType::New(); d1->alloc(3545,1); d1->iota(0); + DataArrayIdType *d2=DataArrayIdType::New(); d2->alloc(3545,1); d2->iota(0); // CPPUNIT_ASSERT_EQUAL(d1->getHashCode(),d2->getHashCode()); - CPPUNIT_ASSERT_EQUAL(232341068,d1->getHashCode()); + CPPUNIT_ASSERT_EQUAL(ToIdType(232341068),d1->getHashCode()); d1->setIJ(886,0,6); - CPPUNIT_ASSERT_EQUAL(232340188,d1->getHashCode()); + CPPUNIT_ASSERT_EQUAL(ToIdType(232340188),d1->getHashCode()); // d1->decrRef(); d2->decrRef(); @@ -979,10 +980,10 @@ void MEDCouplingBasicsTest5::testDataArrayIntGetHashCode1() void MEDCouplingBasicsTest5::testZipConnectivityPol1() { MEDCouplingUMesh *m1=build2DTargetMesh_1(); - const int cells1[3]={2,3,4}; + const mcIdType cells1[3]={2,3,4}; MEDCouplingPointSet *m2_1=m1->buildPartOfMySelf(cells1,cells1+3,true); MEDCouplingUMesh *m2=dynamic_cast(m2_1); - DataArrayInt *arr=0; + DataArrayIdType *arr=0; CPPUNIT_ASSERT(m2); // no permutation policy 0 CPPUNIT_ASSERT(m1->areCellsIncludedIn(m2,0,arr)); @@ -1003,10 +1004,10 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer())); arr->decrRef(); // some modification into m2 - const int modif1[3]={2,4,5}; + const mcIdType modif1[3]={2,4,5}; std::copy(modif1,modif1+3,m2->getNodalConnectivity()->getPointer()+1); //policy 0 fails because cell0 in m2 has same orientation be not same connectivity - const int expected1[3]={5,3,4}; + const mcIdType expected1[3]={5,3,4}; CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr)); CPPUNIT_ASSERT_EQUAL(3,(int)arr->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents()); @@ -1025,7 +1026,7 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() CPPUNIT_ASSERT(std::equal(cells1,cells1+3,arr->getConstPointer())); arr->decrRef(); //some new modification into m2 - const int modif2[3]={2,5,4}; + const mcIdType modif2[3]={2,5,4}; std::copy(modif2,modif2+3,m2->getNodalConnectivity()->getPointer()+1); //policy 0 fails because cell0 in m2 has not exactly the same conn CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr)); @@ -1048,7 +1049,7 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() m1->decrRef(); m2->decrRef(); // Now 1D - const int cells2[2]={3,2}; + const mcIdType cells2[2]={3,2}; m1=build1DSourceMesh_2(); m2_1=m1->buildPartOfMySelf(cells2,cells2+2,true); m2=dynamic_cast(m2_1); @@ -1073,10 +1074,10 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() CPPUNIT_ASSERT(std::equal(cells2,cells2+2,arr->getConstPointer())); arr->decrRef(); // some modification into m2 - const int modif3[2]={4,3}; + const mcIdType modif3[2]={4,3}; std::copy(modif3,modif3+2,m2->getNodalConnectivity()->getPointer()+1); //policy 0 fails because cell0 in m2 has not exactly the same conn - const int expected2[2]={4,2}; + const mcIdType expected2[2]={4,2}; CPPUNIT_ASSERT(!m1->areCellsIncludedIn(m2,0,arr)); CPPUNIT_ASSERT_EQUAL(2,(int)arr->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr->getNumberOfComponents()); @@ -1101,8 +1102,8 @@ void MEDCouplingBasicsTest5::testZipConnectivityPol1() void MEDCouplingBasicsTest5::testConvexEnvelop2D1() { const double coords[662]={7.54758495819e-14,-1.12270326253e-12,8.43143594193,-1.02835845055e-12,4.21571797096,7.30183771609,-4.21571797097,7.30183771609,-8.43143594193,-1.09439981894e-12,-4.21571797097,-7.30183771609,4.21571797097,-7.30183771609,16.8628718839,-1.02835845055e-12,12.6471539129,7.30183771609,8.43143594193,14.6036754322,2.26427548746e-13,14.6036754322,-8.43143594193,14.6036754322,-12.6471539129,7.30183771609,-16.8628718839,-1.39630321727e-12,-12.6471539129,-7.30183771609,-8.43143594193,-14.6036754322,3.7737924791e-14,-14.6036754322,8.43143594193,-14.6036754322,12.6471539129,-7.30183771609,25.2943078258,-1.07553085654e-12,21.0785898548,7.30183771609,16.8628718839,14.6036754322,12.6471539129,21.9055131483,4.21571797096,21.9055131483,-4.21571797097,21.9055131483,-12.6471539129,21.9055131483,-16.8628718839,14.6036754322,-21.0785898548,7.30183771609,-25.2943078258,-1.02835845055e-12,-21.0785898548,-7.30183771609,-16.8628718839,-14.6036754322,-12.6471539129,-21.9055131483,-4.21571797097,-21.9055131483,4.21571797097,-21.9055131483,12.6471539129,-21.9055131483,16.8628718839,-14.6036754322,21.0785898548,-7.30183771609,33.7257437677,-7.45324014622e-13,29.5100257968,7.30183771609,25.2943078258,14.6036754322,21.0785898548,21.9055131483,16.8628718839,29.2073508644,8.43143594193,29.2073508644,-1.20761359331e-12,29.2073508644,-8.43143594193,29.2073508644,-16.8628718839,29.2073508644,-21.0785898548,21.9055131483,-25.2943078258,14.6036754322,-29.5100257968,7.30183771609,-33.7257437677,-7.26455052226e-13,-29.5100257968,-7.30183771609,-25.2943078258,-14.6036754322,-21.0785898548,-21.9055131483,-16.8628718839,-29.2073508644,-8.43143594193,-29.2073508644,4.15117172701e-13,-29.2073508644,8.43143594193,-29.2073508644,16.8628718839,-29.2073508644,21.0785898548,-21.9055131483,25.2943078258,-14.6036754322,29.5100257968,-7.30183771609,42.1571797097,-1.86802727715e-12,37.9414617387,7.30183771609,33.7257437677,14.6036754322,29.5100257968,21.9055131483,25.2943078258,29.2073508644,21.0785898548,36.5091885805,12.6471539129,36.5091885805,4.21571797096,36.5091885805,-4.21571797096,36.5091885805,-12.6471539129,36.5091885805,-21.0785898548,36.5091885805,-25.2943078258,29.2073508644,-29.5100257968,21.9055131483,-33.7257437677,14.6036754322,-37.9414617387,7.30183771609,-42.1571797097,-9.81186044565e-13,-37.9414617387,-7.30183771609,-33.7257437677,-14.6036754322,-29.5100257968,-21.9055131483,-25.2943078258,-29.2073508644,-21.0785898548,-36.5091885805,-12.6471539129,-36.5091885805,-4.21571797097,-36.5091885805,4.21571797097,-36.5091885805,12.6471539129,-36.5091885805,21.0785898548,-36.5091885805,25.2943078258,-29.2073508644,29.5100257968,-21.9055131483,33.7257437677,-14.6036754322,37.9414617387,-7.30183771609,50.5886156516,-6.98151608633e-13,46.3728976806,7.30183771609,42.1571797097,14.6036754322,37.9414617387,21.9055131483,33.7257437677,29.2073508644,29.5100257968,36.5091885805,25.2943078258,43.8110262966,16.8628718839,43.8110262966,8.43143594193,43.8110262966,-1.84915831476e-12,43.8110262966,-8.43143594193,43.8110262966,-16.8628718839,43.8110262966,-25.2943078258,43.8110262966,-29.5100257968,36.5091885805,-33.7257437677,29.2073508644,-37.9414617387,21.9055131483,-42.1571797097,14.6036754322,-46.3728976806,7.30183771609,-50.5886156516,-1.47177906685e-12,-46.3728976806,-7.30183771609,-42.1571797097,-14.6036754322,-37.9414617387,-21.9055131483,-33.7257437677,-29.2073508644,-29.5100257968,-36.5091885805,-25.2943078258,-43.8110262966,-16.8628718839,-43.8110262966,-8.43143594193,-43.8110262966,7.54758495819e-14,-43.8110262966,8.43143594193,-43.8110262966,16.8628718839,-43.8110262966,25.2943078258,-43.8110262966,29.5100257968,-36.5091885805,33.7257437677,-29.2073508644,37.9414617387,-21.9055131483,42.1571797097,-14.6036754322,46.3728976806,-7.30183771609,59.0200515935,-7.9249642061e-13,54.8043336225,7.30183771609,50.5886156516,14.6036754322,46.3728976806,21.9055131483,42.1571797097,29.2073508644,37.9414617387,36.5091885805,33.7257437677,43.8110262966,29.5100257968,51.1128640127,21.0785898548,51.1128640127,12.6471539129,51.1128640127,4.21571797096,51.1128640127,-4.21571797096,51.1128640127,-12.6471539129,51.1128640127,-21.0785898548,51.1128640127,-29.5100257968,51.1128640127,-33.7257437677,43.8110262966,-37.9414617387,36.5091885805,-42.1571797097,29.2073508644,-46.3728976806,21.9055131483,-50.5886156516,14.6036754322,-54.8043336226,7.30183771609,-59.0200515935,-1.31139288649e-12,-54.8043336226,-7.30183771609,-50.5886156516,-14.6036754322,-46.3728976806,-21.9055131483,-42.1571797097,-29.2073508644,-37.9414617387,-36.5091885805,-33.7257437677,-43.8110262966,-29.5100257968,-51.1128640127,-21.0785898548,-51.1128640127,-12.6471539129,-51.1128640127,-4.21571797097,-51.1128640127,4.21571797097,-51.1128640127,12.6471539129,-51.1128640127,21.0785898548,-51.1128640127,29.5100257968,-51.1128640127,33.7257437677,-43.8110262966,37.9414617387,-36.5091885805,42.1571797097,-29.2073508644,46.3728976806,-21.9055131483,50.5886156516,-14.6036754322,54.8043336225,-7.30183771609,67.4514875354,-2.14162723189e-12,63.2357695645,7.30183771609,59.0200515935,14.6036754322,54.8043336226,21.9055131483,50.5886156516,29.2073508644,46.3728976806,36.5091885805,42.1571797097,43.8110262966,37.9414617387,51.1128640127,33.7257437677,58.4147017287,25.2943078258,58.4147017287,16.8628718839,58.4147017287,8.43143594193,58.4147017287,6.79282646237e-13,58.4147017287,-8.43143594193,58.4147017287,-16.8628718839,58.4147017287,-25.2943078258,58.4147017287,-33.7257437677,58.4147017287,-37.9414617387,51.1128640127,-42.1571797097,43.8110262966,-46.3728976806,36.5091885805,-50.5886156516,29.2073508644,-54.8043336226,21.9055131483,-59.0200515935,14.6036754322,-63.2357695645,7.30183771609,-67.4514875354,-1.16044118732e-12,-63.2357695645,-7.30183771609,-59.0200515935,-14.6036754322,-54.8043336226,-21.9055131483,-50.5886156516,-29.2073508644,-46.3728976806,-36.5091885805,-42.1571797097,-43.8110262966,-37.9414617387,-51.1128640127,-33.7257437677,-58.4147017287,-25.2943078258,-58.4147017287,-16.8628718839,-58.4147017287,-8.43143594193,-58.4147017287,-5.66068871864e-14,-58.4147017287,8.43143594193,-58.4147017287,16.8628718839,-58.4147017287,25.2943078258,-58.4147017287,33.7257437677,-58.4147017287,37.9414617387,-51.1128640127,42.1571797097,-43.8110262966,46.3728976806,-36.5091885805,50.5886156516,-29.2073508644,54.8043336226,-21.9055131483,59.0200515935,-14.6036754322,63.2357695645,-7.30183771609,75.8829234774,-2.29257893105e-12,71.6672055064,7.30183771609,67.4514875354,14.6036754322,63.2357695645,21.9055131483,59.0200515935,29.2073508644,54.8043336226,36.5091885805,50.5886156516,43.8110262966,46.3728976806,51.1128640127,42.1571797097,58.4147017287,37.9414617387,65.7165394448,29.5100257968,65.7165394448,21.0785898548,65.7165394448,12.6471539129,65.7165394448,4.21571797097,65.7165394448,-4.21571797096,65.7165394448,-12.6471539129,65.7165394448,-21.0785898548,65.7165394448,-29.5100257968,65.7165394448,-37.9414617387,65.7165394448,-42.1571797097,58.4147017287,-46.3728976806,51.1128640127,-50.5886156516,43.8110262966,-54.8043336226,36.5091885805,-59.0200515935,29.2073508644,-63.2357695645,21.9055131483,-67.4514875354,14.6036754322,-71.6672055064,7.30183771609,-75.8829234774,-1.31139288649e-12,-71.6672055064,-7.30183771609,-67.4514875354,-14.6036754322,-63.2357695645,-21.9055131483,-59.0200515935,-29.2073508644,-54.8043336226,-36.5091885805,-50.5886156516,-43.8110262966,-46.3728976806,-51.1128640127,-42.1571797097,-58.4147017287,-37.9414617387,-65.7165394448,-29.5100257968,-65.7165394448,-21.0785898548,-65.7165394448,-12.6471539129,-65.7165394448,-4.21571797097,-65.7165394448,4.21571797097,-65.7165394448,12.6471539129,-65.7165394448,21.0785898548,-65.7165394448,29.5100257968,-65.7165394448,37.9414617387,-65.7165394448,42.1571797097,-58.4147017287,46.3728976806,-51.1128640127,50.5886156516,-43.8110262966,54.8043336226,-36.5091885805,59.0200515935,-29.2073508644,63.2357695645,-21.9055131483,67.4514875354,-14.6036754322,71.6672055064,-7.30183771609,84.3143594193,-1.49064802924e-12,80.0986414483,7.30183771609,75.8829234774,14.6036754322,71.6672055064,21.9055131483,67.4514875354,29.2073508644,63.2357695645,36.5091885805,59.0200515935,43.8110262966,54.8043336226,51.1128640127,50.5886156516,58.4147017287,46.3728976806,65.7165394448,42.1571797097,73.0183771609,33.7257437677,73.0183771609,25.2943078258,73.0183771609,16.8628718839,73.0183771609,8.43143594193,73.0183771609,2.0755858635e-12,73.0183771609,-8.43143594193,73.0183771609,-16.8628718839,73.0183771609,-25.2943078258,73.0183771609,-33.7257437677,73.0183771609,-42.1571797097,73.0183771609,-46.3728976806,65.7165394448,-50.5886156516,58.4147017287,-54.8043336226,51.1128640127,-59.0200515935,43.8110262966,-63.2357695645,36.5091885805,-67.4514875354,29.2073508644,-71.6672055064,21.9055131483,-75.8829234774,14.6036754322,-80.0986414483,7.30183771609,-84.3143594193,-1.11326878133e-12,-80.0986414483,-7.30183771609,-75.8829234774,-14.6036754322,-71.6672055064,-21.9055131483,-67.4514875354,-29.2073508644,-63.2357695645,-36.5091885805,-59.0200515935,-43.8110262966,-54.8043336226,-51.1128640127,-50.5886156516,-58.4147017287,-46.3728976806,-65.7165394448,-42.1571797097,-73.0183771609,-33.7257437677,-73.0183771609,-25.2943078258,-73.0183771609,-16.8628718839,-73.0183771609,-8.43143594193,-73.0183771609,-5.66068871864e-14,-73.0183771609,8.43143594193,-73.0183771609,16.8628718839,-73.0183771609,25.2943078258,-73.0183771609,33.7257437677,-73.0183771609,42.1571797097,-73.0183771609,46.3728976806,-65.7165394448,50.5886156516,-58.4147017287,54.8043336226,-51.1128640127,59.0200515935,-43.8110262966,63.2357695645,-36.5091885805,67.4514875354,-29.2073508644,71.6672055064,-21.9055131483,75.8829234774,-14.6036754322,80.0986414483,-7.3018377161}; - const int conn[2137]={0,2,3,4,5,6,1,1,8,2,0,6,18,7,2,9,10,3,0,1,8,3,10,11,12,4,0,2,4,3,12,13,14,5,0,5,0,4,14,15,16,6,6,1,0,5,16,17,18,7,20,8,1,18,36,19,8,21,9,2,1,7,20,9,22,23,10,2,8,21,10,23,24,11,3,2,9,11,24,25,26,12,3,10,12,11,26,27,13,4,3,13,12,27,28,29,14,4,14,4,13,29,30,15,5,15,5,14,30,31,32,16,16,6,5,15,32,33,17,17,18,6,16,33,34,35,18,7,1,6,17,35,36,19,38,20,7,36,60,37,20,39,21,8,7,19,38,21,40,22,9,8,20,39,22,41,42,23,9,21,40,23,42,43,24,10,9,22,24,43,44,25,11,10,23,25,44,45,46,26,11,24,26,25,46,47,27,12,11,27,26,47,48,28,13,12,28,27,48,49,50,29,13,29,13,28,50,51,30,14,30,14,29,51,52,31,15,31,15,30,52,53,54,32,32,16,15,31,54,55,33,33,17,16,32,55,56,34,34,35,17,33,56,57,58,35,36,18,17,34,58,59,36,19,7,18,35,59,60,37,62,38,19,60,90,61,38,63,39,20,19,37,62,39,64,40,21,20,38,63,40,65,41,22,21,39,64,41,66,67,42,22,40,65,42,67,68,43,23,22,41,43,68,69,44,24,23,42,44,69,70,45,25,24,43,45,70,71,72,46,25,44,46,45,72,73,47,26,25,47,46,73,74,48,27,26,48,47,74,75,49,28,27,49,48,75,76,77,50,28,50,28,49,77,78,51,29,51,29,50,78,79,52,30,52,30,51,79,80,53,31,53,31,52,80,81,82,54,54,32,31,53,82,83,55,55,33,32,54,83,84,56,56,34,33,55,84,85,57,57,58,34,56,85,86,87,58,59,35,34,57,87,88,59,60,36,35,58,88,89,60,37,19,36,59,89,90,61,92,62,37,90,126,91,62,93,63,38,37,61,92,63,94,64,39,38,62,93,64,95,65,40,39,63,94,65,96,66,41,40,64,95,66,97,98,67,41,65,96,67,98,99,68,42,41,66,68,99,100,69,43,42,67,69,100,101,70,44,43,68,70,101,102,71,45,44,69,71,102,103,104,72,45,70,72,71,104,105,73,46,45,73,72,105,106,74,47,46,74,73,106,107,75,48,47,75,74,107,108,76,49,48,76,75,108,109,110,77,49,77,49,76,110,111,78,50,78,50,77,111,112,79,51,79,51,78,112,113,80,52,80,52,79,113,114,81,53,81,53,80,114,115,116,82,82,54,53,81,116,117,83,83,55,54,82,117,118,84,84,56,55,83,118,119,85,85,57,56,84,119,120,86,86,87,57,85,120,121,122,87,88,58,57,86,122,123,88,89,59,58,87,123,124,89,90,60,59,88,124,125,90,61,37,60,89,125,126,91,128,92,61,126,168,127,92,129,93,62,61,91,128,93,130,94,63,62,92,129,94,131,95,64,63,93,130,95,132,96,65,64,94,131,96,133,97,66,65,95,132,97,134,135,98,66,96,133,98,135,136,99,67,66,97,99,136,137,100,68,67,98,100,137,138,101,69,68,99,101,138,139,102,70,69,100,102,139,140,103,71,70,101,103,140,141,142,104,71,102,104,103,142,143,105,72,71,105,104,143,144,106,73,72,106,105,144,145,107,74,73,107,106,145,146,108,75,74,108,107,146,147,109,76,75,109,108,147,148,149,110,76,110,76,109,149,150,111,77,111,77,110,150,151,112,78,112,78,111,151,152,113,79,113,79,112,152,153,114,80,114,80,113,153,154,115,81,115,81,114,154,155,156,116,116,82,81,115,156,157,117,117,83,82,116,157,158,118,118,84,83,117,158,159,119,119,85,84,118,159,160,120,120,86,85,119,160,161,121,121,122,86,120,161,162,163,122,123,87,86,121,163,164,123,124,88,87,122,164,165,124,125,89,88,123,165,166,125,126,90,89,124,166,167,126,91,61,90,125,167,168,127,170,128,91,168,216,169,128,171,129,92,91,127,170,129,172,130,93,92,128,171,130,173,131,94,93,129,172,131,174,132,95,94,130,173,132,175,133,96,95,131,174,133,176,134,97,96,132,175,134,177,178,135,97,133,176,135,178,179,136,98,97,134,136,179,180,137,99,98,135,137,180,181,138,100,99,136,138,181,182,139,101,100,137,139,182,183,140,102,101,138,140,183,184,141,103,102,139,141,184,185,186,142,103,140,142,141,186,187,143,104,103,143,142,187,188,144,105,104,144,143,188,189,145,106,105,145,144,189,190,146,107,106,146,145,190,191,147,108,107,147,146,191,192,148,109,108,148,147,192,193,194,149,109,149,109,148,194,195,150,110,150,110,149,195,196,151,111,151,111,150,196,197,152,112,152,112,151,197,198,153,113,153,113,152,198,199,154,114,154,114,153,199,200,155,115,155,115,154,200,201,202,156,156,116,115,155,202,203,157,157,117,116,156,203,204,158,158,118,117,157,204,205,159,159,119,118,158,205,206,160,160,120,119,159,206,207,161,161,121,120,160,207,208,162,162,163,121,161,208,209,210,163,164,122,121,162,210,211,164,165,123,122,163,211,212,165,166,124,123,164,212,213,166,167,125,124,165,213,214,167,168,126,125,166,214,215,168,127,91,126,167,215,216,169,218,170,127,216,270,217,170,219,171,128,127,169,218,171,220,172,129,128,170,219,172,221,173,130,129,171,220,173,222,174,131,130,172,221,174,223,175,132,131,173,222,175,224,176,133,132,174,223,176,225,177,134,133,175,224,177,226,227,178,134,176,225,178,227,228,179,135,134,177,179,228,229,180,136,135,178,180,229,230,181,137,136,179,181,230,231,182,138,137,180,182,231,232,183,139,138,181,183,232,233,184,140,139,182,184,233,234,185,141,140,183,185,234,235,236,186,141,184,186,185,236,237,187,142,141,187,186,237,238,188,143,142,188,187,238,239,189,144,143,189,188,239,240,190,145,144,190,189,240,241,191,146,145,191,190,241,242,192,147,146,192,191,242,243,193,148,147,193,192,243,244,245,194,148,194,148,193,245,246,195,149,195,149,194,246,247,196,150,196,150,195,247,248,197,151,197,151,196,248,249,198,152,198,152,197,249,250,199,153,199,153,198,250,251,200,154,200,154,199,251,252,201,155,201,155,200,252,253,254,202,202,156,155,201,254,255,203,203,157,156,202,255,256,204,204,158,157,203,256,257,205,205,159,158,204,257,258,206,206,160,159,205,258,259,207,207,161,160,206,259,260,208,208,162,161,207,260,261,209,209,210,162,208,261,262,263,210,211,163,162,209,263,264,211,212,164,163,210,264,265,212,213,165,164,211,265,266,213,214,166,165,212,266,267,214,215,167,166,213,267,268,215,216,168,167,214,268,269,216,169,127,168,215,269,270,217,272,218,169,270,330,271,218,273,219,170,169,217,272,219,274,220,171,170,218,273,220,275,221,172,171,219,274,221,276,222,173,172,220,275,222,277,223,174,173,221,276,223,278,224,175,174,222,277,224,279,225,176,175,223,278,225,280,226,177,176,224,279,226,281,282,227,177,225,280,227,282,283,228,178,177,226,228,283,284,229,179,178,227,229,284,285,230,180,179,228,230,285,286,231,181,180,229,231,286,287,232,182,181,230,232,287,288,233,183,182,231,233,288,289,234,184,183,232,234,289,290,235,185,184,233,235,290,291,292,236,185,234,236,235,292,293,237,186,185,237,236,293,294,238,187,186,238,237,294,295,239,188,187,239,238,295,296,240,189,188,240,239,296,297,241,190,189,241,240,297,298,242,191,190,242,241,298,299,243,192,191,243,242,299,300,244,193,192,244,243,300,301,302,245,193,245,193,244,302,303,246,194,246,194,245,303,304,247,195,247,195,246,304,305,248,196,248,196,247,305,306,249,197,249,197,248,306,307,250,198,250,198,249,307,308,251,199,251,199,250,308,309,252,200,252,200,251,309,310,253,201,253,201,252,310,311,312,254,254,202,201,253,312,313,255,255,203,202,254,313,314,256,256,204,203,255,314,315,257,257,205,204,256,315,316,258,258,206,205,257,316,317,259,259,207,206,258,317,318,260,260,208,207,259,318,319,261,261,209,208,260,319,320,262,262,263,209,261,320,321,322,263,264,210,209,262,322,323,264,265,211,210,263,323,324,265,266,212,211,264,324,325,266,267,213,212,265,325,326,267,268,214,213,266,326,327,268,269,215,214,267,327,328,269,270,216,215,268,328,329,270,217,169,216,269,329,330,271,272,217,330,273,218,217,271,274,219,218,272,275,220,219,273,276,221,220,274,277,222,221,275,278,223,222,276,279,224,223,277,280,225,224,278,281,226,225,279,281,282,226,280,283,227,226,281,284,228,227,282,285,229,228,283,286,230,229,284,287,231,230,285,288,232,231,286,289,233,232,287,290,234,233,288,291,235,234,289,291,292,235,290,291,293,236,235,292,294,237,236,293,295,238,237,294,296,239,238,295,297,240,239,296,298,241,240,297,299,242,241,298,300,243,242,299,301,244,243,301,300,302,244,244,301,303,245,245,302,304,246,246,303,305,247,247,304,306,248,248,305,307,249,249,306,308,250,250,307,309,251,251,308,310,252,252,309,311,253,311,253,310,312,254,253,311,313,255,254,312,314,256,255,313,315,257,256,314,316,258,257,315,317,259,258,316,318,260,259,317,319,261,260,318,320,262,261,319,321,321,322,262,320,323,263,262,321,324,264,263,322,325,265,264,323,326,266,265,324,327,267,266,325,328,268,267,326,329,269,268,327,330,270,269,328,271,217,270,329}; - const int connI[332]={0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378,385,392,399,406,413,420,427,434,441,448,455,462,469,476,483,490,497,504,511,518,525,532,539,546,553,560,567,574,581,588,595,602,609,616,623,630,637,644,651,658,665,672,679,686,693,700,707,714,721,728,735,742,749,756,763,770,777,784,791,798,805,812,819,826,833,840,847,854,861,868,875,882,889,896,903,910,917,924,931,938,945,952,959,966,973,980,987,994,1001,1008,1015,1022,1029,1036,1043,1050,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1225,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1400,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1575,1582,1589,1596,1603,1610,1617,1624,1631,1638,1645,1652,1659,1666,1673,1680,1687,1694,1701,1708,1715,1722,1729,1736,1743,1750,1757,1764,1771,1778,1785,1792,1799,1806,1813,1820,1827,1834,1841,1848,1855,1862,1869,1876,1883,1890,1897,1901,1905,1909,1913,1917,1921,1925,1929,1933,1937,1941,1945,1949,1953,1957,1961,1965,1969,1973,1977,1981,1985,1989,1993,1997,2001,2005,2009,2013,2017,2021,2025,2029,2033,2037,2041,2045,2049,2053,2057,2061,2065,2069,2073,2077,2081,2085,2089,2093,2097,2101,2105,2109,2113,2117,2121,2125,2129,2133,2137}; + const mcIdType conn[2137]={0,2,3,4,5,6,1,1,8,2,0,6,18,7,2,9,10,3,0,1,8,3,10,11,12,4,0,2,4,3,12,13,14,5,0,5,0,4,14,15,16,6,6,1,0,5,16,17,18,7,20,8,1,18,36,19,8,21,9,2,1,7,20,9,22,23,10,2,8,21,10,23,24,11,3,2,9,11,24,25,26,12,3,10,12,11,26,27,13,4,3,13,12,27,28,29,14,4,14,4,13,29,30,15,5,15,5,14,30,31,32,16,16,6,5,15,32,33,17,17,18,6,16,33,34,35,18,7,1,6,17,35,36,19,38,20,7,36,60,37,20,39,21,8,7,19,38,21,40,22,9,8,20,39,22,41,42,23,9,21,40,23,42,43,24,10,9,22,24,43,44,25,11,10,23,25,44,45,46,26,11,24,26,25,46,47,27,12,11,27,26,47,48,28,13,12,28,27,48,49,50,29,13,29,13,28,50,51,30,14,30,14,29,51,52,31,15,31,15,30,52,53,54,32,32,16,15,31,54,55,33,33,17,16,32,55,56,34,34,35,17,33,56,57,58,35,36,18,17,34,58,59,36,19,7,18,35,59,60,37,62,38,19,60,90,61,38,63,39,20,19,37,62,39,64,40,21,20,38,63,40,65,41,22,21,39,64,41,66,67,42,22,40,65,42,67,68,43,23,22,41,43,68,69,44,24,23,42,44,69,70,45,25,24,43,45,70,71,72,46,25,44,46,45,72,73,47,26,25,47,46,73,74,48,27,26,48,47,74,75,49,28,27,49,48,75,76,77,50,28,50,28,49,77,78,51,29,51,29,50,78,79,52,30,52,30,51,79,80,53,31,53,31,52,80,81,82,54,54,32,31,53,82,83,55,55,33,32,54,83,84,56,56,34,33,55,84,85,57,57,58,34,56,85,86,87,58,59,35,34,57,87,88,59,60,36,35,58,88,89,60,37,19,36,59,89,90,61,92,62,37,90,126,91,62,93,63,38,37,61,92,63,94,64,39,38,62,93,64,95,65,40,39,63,94,65,96,66,41,40,64,95,66,97,98,67,41,65,96,67,98,99,68,42,41,66,68,99,100,69,43,42,67,69,100,101,70,44,43,68,70,101,102,71,45,44,69,71,102,103,104,72,45,70,72,71,104,105,73,46,45,73,72,105,106,74,47,46,74,73,106,107,75,48,47,75,74,107,108,76,49,48,76,75,108,109,110,77,49,77,49,76,110,111,78,50,78,50,77,111,112,79,51,79,51,78,112,113,80,52,80,52,79,113,114,81,53,81,53,80,114,115,116,82,82,54,53,81,116,117,83,83,55,54,82,117,118,84,84,56,55,83,118,119,85,85,57,56,84,119,120,86,86,87,57,85,120,121,122,87,88,58,57,86,122,123,88,89,59,58,87,123,124,89,90,60,59,88,124,125,90,61,37,60,89,125,126,91,128,92,61,126,168,127,92,129,93,62,61,91,128,93,130,94,63,62,92,129,94,131,95,64,63,93,130,95,132,96,65,64,94,131,96,133,97,66,65,95,132,97,134,135,98,66,96,133,98,135,136,99,67,66,97,99,136,137,100,68,67,98,100,137,138,101,69,68,99,101,138,139,102,70,69,100,102,139,140,103,71,70,101,103,140,141,142,104,71,102,104,103,142,143,105,72,71,105,104,143,144,106,73,72,106,105,144,145,107,74,73,107,106,145,146,108,75,74,108,107,146,147,109,76,75,109,108,147,148,149,110,76,110,76,109,149,150,111,77,111,77,110,150,151,112,78,112,78,111,151,152,113,79,113,79,112,152,153,114,80,114,80,113,153,154,115,81,115,81,114,154,155,156,116,116,82,81,115,156,157,117,117,83,82,116,157,158,118,118,84,83,117,158,159,119,119,85,84,118,159,160,120,120,86,85,119,160,161,121,121,122,86,120,161,162,163,122,123,87,86,121,163,164,123,124,88,87,122,164,165,124,125,89,88,123,165,166,125,126,90,89,124,166,167,126,91,61,90,125,167,168,127,170,128,91,168,216,169,128,171,129,92,91,127,170,129,172,130,93,92,128,171,130,173,131,94,93,129,172,131,174,132,95,94,130,173,132,175,133,96,95,131,174,133,176,134,97,96,132,175,134,177,178,135,97,133,176,135,178,179,136,98,97,134,136,179,180,137,99,98,135,137,180,181,138,100,99,136,138,181,182,139,101,100,137,139,182,183,140,102,101,138,140,183,184,141,103,102,139,141,184,185,186,142,103,140,142,141,186,187,143,104,103,143,142,187,188,144,105,104,144,143,188,189,145,106,105,145,144,189,190,146,107,106,146,145,190,191,147,108,107,147,146,191,192,148,109,108,148,147,192,193,194,149,109,149,109,148,194,195,150,110,150,110,149,195,196,151,111,151,111,150,196,197,152,112,152,112,151,197,198,153,113,153,113,152,198,199,154,114,154,114,153,199,200,155,115,155,115,154,200,201,202,156,156,116,115,155,202,203,157,157,117,116,156,203,204,158,158,118,117,157,204,205,159,159,119,118,158,205,206,160,160,120,119,159,206,207,161,161,121,120,160,207,208,162,162,163,121,161,208,209,210,163,164,122,121,162,210,211,164,165,123,122,163,211,212,165,166,124,123,164,212,213,166,167,125,124,165,213,214,167,168,126,125,166,214,215,168,127,91,126,167,215,216,169,218,170,127,216,270,217,170,219,171,128,127,169,218,171,220,172,129,128,170,219,172,221,173,130,129,171,220,173,222,174,131,130,172,221,174,223,175,132,131,173,222,175,224,176,133,132,174,223,176,225,177,134,133,175,224,177,226,227,178,134,176,225,178,227,228,179,135,134,177,179,228,229,180,136,135,178,180,229,230,181,137,136,179,181,230,231,182,138,137,180,182,231,232,183,139,138,181,183,232,233,184,140,139,182,184,233,234,185,141,140,183,185,234,235,236,186,141,184,186,185,236,237,187,142,141,187,186,237,238,188,143,142,188,187,238,239,189,144,143,189,188,239,240,190,145,144,190,189,240,241,191,146,145,191,190,241,242,192,147,146,192,191,242,243,193,148,147,193,192,243,244,245,194,148,194,148,193,245,246,195,149,195,149,194,246,247,196,150,196,150,195,247,248,197,151,197,151,196,248,249,198,152,198,152,197,249,250,199,153,199,153,198,250,251,200,154,200,154,199,251,252,201,155,201,155,200,252,253,254,202,202,156,155,201,254,255,203,203,157,156,202,255,256,204,204,158,157,203,256,257,205,205,159,158,204,257,258,206,206,160,159,205,258,259,207,207,161,160,206,259,260,208,208,162,161,207,260,261,209,209,210,162,208,261,262,263,210,211,163,162,209,263,264,211,212,164,163,210,264,265,212,213,165,164,211,265,266,213,214,166,165,212,266,267,214,215,167,166,213,267,268,215,216,168,167,214,268,269,216,169,127,168,215,269,270,217,272,218,169,270,330,271,218,273,219,170,169,217,272,219,274,220,171,170,218,273,220,275,221,172,171,219,274,221,276,222,173,172,220,275,222,277,223,174,173,221,276,223,278,224,175,174,222,277,224,279,225,176,175,223,278,225,280,226,177,176,224,279,226,281,282,227,177,225,280,227,282,283,228,178,177,226,228,283,284,229,179,178,227,229,284,285,230,180,179,228,230,285,286,231,181,180,229,231,286,287,232,182,181,230,232,287,288,233,183,182,231,233,288,289,234,184,183,232,234,289,290,235,185,184,233,235,290,291,292,236,185,234,236,235,292,293,237,186,185,237,236,293,294,238,187,186,238,237,294,295,239,188,187,239,238,295,296,240,189,188,240,239,296,297,241,190,189,241,240,297,298,242,191,190,242,241,298,299,243,192,191,243,242,299,300,244,193,192,244,243,300,301,302,245,193,245,193,244,302,303,246,194,246,194,245,303,304,247,195,247,195,246,304,305,248,196,248,196,247,305,306,249,197,249,197,248,306,307,250,198,250,198,249,307,308,251,199,251,199,250,308,309,252,200,252,200,251,309,310,253,201,253,201,252,310,311,312,254,254,202,201,253,312,313,255,255,203,202,254,313,314,256,256,204,203,255,314,315,257,257,205,204,256,315,316,258,258,206,205,257,316,317,259,259,207,206,258,317,318,260,260,208,207,259,318,319,261,261,209,208,260,319,320,262,262,263,209,261,320,321,322,263,264,210,209,262,322,323,264,265,211,210,263,323,324,265,266,212,211,264,324,325,266,267,213,212,265,325,326,267,268,214,213,266,326,327,268,269,215,214,267,327,328,269,270,216,215,268,328,329,270,217,169,216,269,329,330,271,272,217,330,273,218,217,271,274,219,218,272,275,220,219,273,276,221,220,274,277,222,221,275,278,223,222,276,279,224,223,277,280,225,224,278,281,226,225,279,281,282,226,280,283,227,226,281,284,228,227,282,285,229,228,283,286,230,229,284,287,231,230,285,288,232,231,286,289,233,232,287,290,234,233,288,291,235,234,289,291,292,235,290,291,293,236,235,292,294,237,236,293,295,238,237,294,296,239,238,295,297,240,239,296,298,241,240,297,299,242,241,298,300,243,242,299,301,244,243,301,300,302,244,244,301,303,245,245,302,304,246,246,303,305,247,247,304,306,248,248,305,307,249,249,306,308,250,250,307,309,251,251,308,310,252,252,309,311,253,311,253,310,312,254,253,311,313,255,254,312,314,256,255,313,315,257,256,314,316,258,257,315,317,259,258,316,318,260,259,317,319,261,260,318,320,262,261,319,321,321,322,262,320,323,263,262,321,324,264,263,322,325,265,264,323,326,266,265,324,327,267,266,325,328,268,267,326,329,269,268,327,330,270,269,328,271,217,270,329}; + const mcIdType connI[332]={0,7,14,21,28,35,42,49,56,63,70,77,84,91,98,105,112,119,126,133,140,147,154,161,168,175,182,189,196,203,210,217,224,231,238,245,252,259,266,273,280,287,294,301,308,315,322,329,336,343,350,357,364,371,378,385,392,399,406,413,420,427,434,441,448,455,462,469,476,483,490,497,504,511,518,525,532,539,546,553,560,567,574,581,588,595,602,609,616,623,630,637,644,651,658,665,672,679,686,693,700,707,714,721,728,735,742,749,756,763,770,777,784,791,798,805,812,819,826,833,840,847,854,861,868,875,882,889,896,903,910,917,924,931,938,945,952,959,966,973,980,987,994,1001,1008,1015,1022,1029,1036,1043,1050,1057,1064,1071,1078,1085,1092,1099,1106,1113,1120,1127,1134,1141,1148,1155,1162,1169,1176,1183,1190,1197,1204,1211,1218,1225,1232,1239,1246,1253,1260,1267,1274,1281,1288,1295,1302,1309,1316,1323,1330,1337,1344,1351,1358,1365,1372,1379,1386,1393,1400,1407,1414,1421,1428,1435,1442,1449,1456,1463,1470,1477,1484,1491,1498,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1575,1582,1589,1596,1603,1610,1617,1624,1631,1638,1645,1652,1659,1666,1673,1680,1687,1694,1701,1708,1715,1722,1729,1736,1743,1750,1757,1764,1771,1778,1785,1792,1799,1806,1813,1820,1827,1834,1841,1848,1855,1862,1869,1876,1883,1890,1897,1901,1905,1909,1913,1917,1921,1925,1929,1933,1937,1941,1945,1949,1953,1957,1961,1965,1969,1973,1977,1981,1985,1989,1993,1997,2001,2005,2009,2013,2017,2021,2025,2029,2033,2037,2041,2045,2049,2053,2057,2061,2065,2069,2073,2077,2081,2085,2089,2093,2097,2101,2105,2109,2113,2117,2121,2125,2129,2133,2137}; // MEDCouplingUMesh *m=MEDCouplingUMesh::New("convexhull",2); m->allocateCells(331); @@ -1116,13 +1117,13 @@ void MEDCouplingBasicsTest5::testConvexEnvelop2D1() coordsDa->decrRef(); m->checkConsistencyLight(); // - DataArrayInt *da=m->convexEnvelop2D(); + DataArrayIdType *da=m->convexEnvelop2D(); m->checkConsistencyLight(); CPPUNIT_ASSERT(coordsDa==m->getCoords()); - DataArrayInt *daC=da->buildComplement(331); + DataArrayIdType *daC=da->buildComplement(331); da->decrRef(); - const int expected[58]={271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330}; - DataArrayInt *expected2=DataArrayInt::New(); + const mcIdType expected[58]={271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,302,303,304,305,306,307,308,309,310,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330}; + DataArrayIdType *expected2=DataArrayIdType::New(); expected2->alloc(58,1); std::copy(expected,expected+58,expected2->getPointer()); CPPUNIT_ASSERT(expected2->isEqual(*daC)); @@ -1137,7 +1138,7 @@ void MEDCouplingBasicsTest5::testConvexEnvelop2D1() vals->substractEqual(ref2); ref2->decrRef(); vals->abs(); - DataArrayInt *theTest=vals->findIdsInRange(-1.,1e-7); + DataArrayIdType *theTest=vals->findIdsInRange(-1.,1e-7); CPPUNIT_ASSERT(theTest->isIota(331)); theTest->decrRef(); valsF->decrRef(); @@ -1147,24 +1148,24 @@ void MEDCouplingBasicsTest5::testConvexEnvelop2D1() void MEDCouplingBasicsTest5::testDataArraySort1() { - DataArrayInt *arr=DataArrayInt::New(); + DataArrayIdType *arr=DataArrayIdType::New(); CPPUNIT_ASSERT_THROW(arr->sort(true),INTERP_KERNEL::Exception);//no allocation CPPUNIT_ASSERT_THROW(arr->sort(false),INTERP_KERNEL::Exception);//no allocation - const int values[6]={2,1,6,5,4,7}; + const mcIdType values[6]={2,1,6,5,4,7}; arr->alloc(3,2); CPPUNIT_ASSERT_THROW(arr->sort(true),INTERP_KERNEL::Exception);//no one component CPPUNIT_ASSERT_THROW(arr->sort(false),INTERP_KERNEL::Exception);//no one component arr->rearrange(1); std::copy(values,values+6,arr->getPointer()); - DataArrayInt *arr1=arr->deepCopy(); - DataArrayInt *arr2=arr->deepCopy(); + DataArrayIdType *arr1=arr->deepCopy(); + DataArrayIdType *arr2=arr->deepCopy(); arr1->sort(true); - const int expected1[6]={1,2,4,5,6,7}; + const mcIdType expected1[6]={1,2,4,5,6,7}; CPPUNIT_ASSERT_EQUAL(6,(int)arr1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr1->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected1,expected1+6,arr1->begin())); arr2->sort(false); - const int expected2[6]={7,6,5,4,2,1}; + const mcIdType expected2[6]={7,6,5,4,2,1}; CPPUNIT_ASSERT_EQUAL(6,(int)arr2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)arr2->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected2,expected2+6,arr2->begin())); @@ -1203,20 +1204,20 @@ void MEDCouplingBasicsTest5::testDataArraySort1() void MEDCouplingBasicsTest5::testPartitionBySpreadZone1() { MEDCouplingUMesh *m=build2DTargetMesh_1(); - const int part0[3]={2,3,4}; - const int part1[2]={0,1}; + const mcIdType part0[3]={2,3,4}; + const mcIdType part1[2]={0,1}; 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 int renum[10]={5,2,9,6,4,7,0,1,3,8}; + const mcIdType renum[10]={5,2,9,6,4,7,0,1,3,8}; m4->renumberCells(renum); // - std::vector v2=m4->partitionBySpreadZone(); + std::vector v2=m4->partitionBySpreadZone(); CPPUNIT_ASSERT_EQUAL(3,(int)v2.size()); - const int expected0[3]={0,1,7}; - const int expected1[5]={2,4,5,6,9}; - const int expected2[2]={3,8}; + const mcIdType expected0[3]={0,1,7}; + const mcIdType expected1[5]={2,4,5,6,9}; + const mcIdType expected2[2]={3,8}; CPPUNIT_ASSERT_EQUAL(3,(int)v2[0]->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)v2[0]->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(5,(int)v2[1]->getNumberOfTuples()); @@ -1234,8 +1235,8 @@ void MEDCouplingBasicsTest5::testPartitionBySpreadZone1() MEDCouplingUMesh *m5=m4->buildSpreadZonesWithPoly(); CPPUNIT_ASSERT_EQUAL(3,(int)m5->getNumberOfCells()); CPPUNIT_ASSERT(m5->getCoords()==m4->getCoords()); - const int expected3[23]={5,15,16,17,14,11,13,12,5,2,1,0,3,6,7,8,5,5,18,21,22,20,19}; - const int expected4[4]={0,8,17,23}; + const mcIdType expected3[23]={5,15,16,17,14,11,13,12,5,2,1,0,3,6,7,8,5,5,18,21,22,20,19}; + const mcIdType expected4[4]={0,8,17,23}; CPPUNIT_ASSERT_EQUAL(23,(int)m5->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected3,expected3+23,m5->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT_EQUAL(4,(int)m5->getNodalConnectivityIndex()->getNumberOfTuples()); @@ -1250,10 +1251,10 @@ void MEDCouplingBasicsTest5::testPartitionBySpreadZone1() void MEDCouplingBasicsTest5::testGiveCellsWithType1() { - const int expected0[2]={1,2}; - const int expected1[3]={0,3,4}; + const mcIdType expected0[2]={1,2}; + const mcIdType expected1[3]={0,3,4}; MEDCouplingUMesh *m=build2DTargetMesh_1(); - DataArrayInt *da=m->giveCellsWithType(INTERP_KERNEL::NORM_TRI3); + DataArrayIdType *da=m->giveCellsWithType(INTERP_KERNEL::NORM_TRI3); CPPUNIT_ASSERT_EQUAL(2,(int)da->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)da->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected0,expected0+2,da->getConstPointer())); @@ -1284,7 +1285,7 @@ void MEDCouplingBasicsTest5::testBuildSlice3D2() // 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}; - DataArrayInt *ids=0; + DataArrayIdType *ids=0; MEDCouplingUMesh *slice1=mesh3D->buildSlice3D(origin1,vec1,1e-10,ids); // MEDCouplingFieldDouble *f=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); @@ -1293,8 +1294,8 @@ void MEDCouplingBasicsTest5::testBuildSlice3D2() arr->rearrange(1); arr->iota(2.); arr->rearrange(2); f->setArray(arr); f->checkConsistencyLight(); - const int exp1[9]={1,3,4,7,9,10,13,15,16}; - DataArrayInt *expected1=DataArrayInt::New(); expected1->alloc(9,1); std::copy(exp1,exp1+9,expected1->getPointer()); + const mcIdType exp1[9]={1,3,4,7,9,10,13,15,16}; + DataArrayIdType *expected1=DataArrayIdType::New(); expected1->alloc(9,1); std::copy(exp1,exp1+9,expected1->getPointer()); CPPUNIT_ASSERT(expected1->isEqual(*ids)); DataArrayDouble *arr2=arr->selectByTupleIdSafe(expected1->begin(),expected1->end()); // @@ -1325,14 +1326,14 @@ void MEDCouplingBasicsTest5::testComputeTupleIdsToSelectFromCellIds1() DataArrayDouble *arr=DataArrayDouble::New(); arr->alloc(52,2) ; arr->rearrange(1) ; arr->iota(7.); arr->rearrange(2); f->setArray(arr); // - const int subPart1[3]={1,5,9}; + const mcIdType subPart1[3]={1,5,9}; MEDCouplingFieldDouble *f2=f->buildSubPart(subPart1,subPart1+3); f2->checkConsistencyLight(); - DataArrayInt *cI=m->computeNbOfNodesPerCell(); + DataArrayIdType *cI=m->computeNbOfNodesPerCell(); cI->computeOffsetsFull(); - const int sel1[3]={1,5,9}; - DataArrayInt *sel=DataArrayInt::New(); sel->useArray(sel1,false,DeallocType::CPP_DEALLOC,3,1); - DataArrayInt *res=sel->buildExplicitArrByRanges(cI); + const mcIdType sel1[3]={1,5,9}; + DataArrayIdType *sel=DataArrayIdType::New(); sel->useArray(sel1,false,DeallocType::CPP_DEALLOC,3,1); + DataArrayIdType *res=sel->buildExplicitArrByRanges(cI); DataArrayDouble *arr2=arr->selectByTupleIdSafe(res->begin(),res->end()); const double expected1[30]={13.,14.,15.,16.,17.,18.,19.,20.,59.,60.,61.,62.,63.,64.,95.,96.,97.,98.,99.,100.,101.,102.,103.,104.,105.,106.,107.,108.,109.,110.}; DataArrayDouble *arr3=DataArrayDouble::New(); arr3->useArray(expected1,false,DeallocType::CPP_DEALLOC,15,2); @@ -1364,29 +1365,29 @@ void MEDCouplingBasicsTest5::testComputeSkin1() CPPUNIT_ASSERT_EQUAL(18,(int)skin->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(1,skin->getMeshDimension()); CPPUNIT_ASSERT(skin->getCoords()==umesh->getCoords()); - const int expected1[19]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54}; - const int expected2[54]={1,1,0,1,0,5,1,2,1,1,3,2,1,4,3,1,9,4,1,5,10,1,14,9,1,10,15,1,19,14,1,15,20,1,24,19,1,20,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,24}; - CPPUNIT_ASSERT_EQUAL((std::size_t)19,skin->getNodalConnectivityIndex()->getNbOfElems()); + const mcIdType expected1[19]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54}; + const mcIdType expected2[54]={1,1,0,1,0,5,1,2,1,1,3,2,1,4,3,1,9,4,1,5,10,1,14,9,1,10,15,1,19,14,1,15,20,1,24,19,1,20,25,1,25,26,1,26,27,1,27,28,1,28,29,1,29,24}; + CPPUNIT_ASSERT_EQUAL(ToIdType(19),skin->getNodalConnectivityIndex()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected1,expected1+19,skin->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)54,skin->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(54),skin->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT(std::equal(expected2,expected2+54,skin->getNodalConnectivity()->getConstPointer())); - DataArrayInt *ids=skin->computeFetchedNodeIds(); - const int expected3[18]={0,1,2,3,4,5,9,10,14,15,19,20,24,25,26,27,28,29}; - CPPUNIT_ASSERT_EQUAL((std::size_t)18,ids->getNbOfElems()); + DataArrayIdType *ids=skin->computeFetchedNodeIds(); + 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())); MEDCouplingUMesh *part=dynamic_cast(umesh->buildFacePartOfMySelfNode(ids->begin(),ids->end(),true)); part->setName(skin->getName().c_str()); CPPUNIT_ASSERT(part->isEqual(skin,1e-12)); MEDCouplingUMesh *part2=dynamic_cast(part->buildPartOfMySelfSlice(1,18,2,true)); - DataArrayInt *ids2=DataArrayInt::Range(0,18,2); + DataArrayIdType *ids2=DataArrayIdType::Range(0,18,2); part->setPartOfMySelf(ids2->begin(),ids2->end(),*part2); ids2->decrRef(); CPPUNIT_ASSERT(!part->isEqual(skin,1e-12)); - DataArrayInt *trad=part->zipConnectivityTraducer(0); + DataArrayIdType *trad=part->zipConnectivityTraducer(0); CPPUNIT_ASSERT_EQUAL(9,(int)part->getNumberOfCells()); - const int expected4[18]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8}; + const mcIdType expected4[18]={0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8}; CPPUNIT_ASSERT(std::equal(expected4,expected4+18,trad->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)18,trad->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(18),trad->getNbOfElems()); trad->decrRef(); part->decrRef(); part2->decrRef(); @@ -1402,18 +1403,18 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() MEDCouplingUMesh *m=build2DTargetMesh_1(); std::set s; s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); - const int ids1[3]={0,3,4}; + const mcIdType ids1[3]={0,3,4}; MEDCouplingUMesh *part=static_cast(m->buildPartOfMySelf(ids1,ids1+3,true)); part->simplexize(0)->decrRef(); - const int ids2[3]={1,2,5}; + const mcIdType ids2[3]={1,2,5}; MEDCouplingUMesh *part2=static_cast(part->buildPartOfMySelf(ids2,ids2+3,true)); m->setPartOfMySelf(ids1,ids1+3,*part2); - const int expected1[20]={3,0,4,1,3,1,4,2,3,4,5,2,3,6,7,4,3,7,5,4}; + 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())); - CPPUNIT_ASSERT_EQUAL((std::size_t)20,m->getNodalConnectivity()->getNbOfElems()); - const int expected2[6]={0,4,8,12,16,20}; + CPPUNIT_ASSERT_EQUAL(ToIdType(20),m->getNodalConnectivity()->getNbOfElems()); + const mcIdType expected2[6]={0,4,8,12,16,20}; CPPUNIT_ASSERT(std::equal(expected2,expected2+6,m->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems()); s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); m->decrRef(); part->decrRef(); part2->decrRef(); @@ -1422,12 +1423,12 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() part=static_cast(m->buildPartOfMySelf(ids1,ids1+2,true)); part->convertAllToPoly(); m->setPartOfMySelf(ids1+1,ids1+3,*part); - const int expected3[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; + const mcIdType expected3[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; CPPUNIT_ASSERT(std::equal(expected3,expected3+23,m->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems()); - const int expected4[6]={0,5,9,13,18,23}; + CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems()); + const mcIdType expected4[6]={0,5,9,13,18,23}; CPPUNIT_ASSERT(std::equal(expected4,expected4+6,m->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems()); s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); m->decrRef(); part->decrRef(); @@ -1435,12 +1436,12 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() m=build2DTargetMesh_1(); part=static_cast(m->buildPartOfMySelfSlice(3,5,1,true)); m->setPartOfMySelfSlice(1,3,1,*part); - const int expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4}; + const mcIdType expected5[25]={4,0,3,4,1,4,6,7,4,3,4,7,8,5,4,4,6,7,4,3,4,7,8,5,4}; CPPUNIT_ASSERT(std::equal(expected5,expected5+25,m->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)25,m->getNodalConnectivity()->getNbOfElems()); - const int expected6[6]={0,5,10,15,20,25}; + CPPUNIT_ASSERT_EQUAL(ToIdType(25),m->getNodalConnectivity()->getNbOfElems()); + const mcIdType expected6[6]={0,5,10,15,20,25}; CPPUNIT_ASSERT(std::equal(expected6,expected6+6,m->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems()); s.clear(); s.insert(INTERP_KERNEL::NORM_QUAD4); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); m->decrRef(); part->decrRef(); @@ -1449,12 +1450,12 @@ void MEDCouplingBasicsTest5::testUMeshSetPartOfMySelf2() part=static_cast(m->buildPartOfMySelfSlice(0,5,3,true)); part->convertAllToPoly(); m->setPartOfMySelfSlice(3,5,1,*part); - const int expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; + const mcIdType expected7[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; CPPUNIT_ASSERT(std::equal(expected7,expected7+23,m->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems()); - const int expected8[6]={0,5,9,13,18,23}; + CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems()); + const mcIdType expected8[6]={0,5,9,13,18,23}; CPPUNIT_ASSERT(std::equal(expected8,expected8+6,m->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems()); s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); m->decrRef(); part->decrRef(); @@ -1463,12 +1464,12 @@ s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD part=static_cast(m->buildPartOfMySelfSlice(3,-1,-3,true)); part->convertAllToPoly(); m->setPartOfMySelfSlice(4,2,-1,*part); - const int expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; + const mcIdType expected9[23]={4,0,3,4,1,3,1,4,2,3,4,5,2,5,0,3,4,1,5,6,7,4,3}; CPPUNIT_ASSERT(std::equal(expected9,expected9+23,m->getNodalConnectivity()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)23,m->getNodalConnectivity()->getNbOfElems()); - const int expected10[6]={0,5,9,13,18,23}; + CPPUNIT_ASSERT_EQUAL(ToIdType(23),m->getNodalConnectivity()->getNbOfElems()); + const mcIdType expected10[6]={0,5,9,13,18,23}; CPPUNIT_ASSERT(std::equal(expected10,expected10+6,m->getNodalConnectivityIndex()->getConstPointer())); - CPPUNIT_ASSERT_EQUAL((std::size_t)6,m->getNodalConnectivityIndex()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),m->getNodalConnectivityIndex()->getNbOfElems()); s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD4); s.insert(INTERP_KERNEL::NORM_POLYGON); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); part->decrRef(); @@ -1478,7 +1479,7 @@ s.clear(); s.insert(INTERP_KERNEL::NORM_TRI3); s.insert(INTERP_KERNEL::NORM_QUAD void MEDCouplingBasicsTest5::testUnPolyze3() { const double coord[18]={0.0,0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.0,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5}; - const int conn[22]={1,2,5,4,-1,4,3,0,1,-1,2,0,3,5,-1,0,2,1,-1,4,5,3}; + const mcIdType conn[22]={1,2,5,4,-1,4,3,0,1,-1,2,0,3,5,-1,0,2,1,-1,4,5,3}; MEDCouplingUMesh *m=MEDCouplingUMesh::New("a mesh",3); m->allocateCells(1); m->insertNextCell(INTERP_KERNEL::NORM_POLYHED,22,conn); @@ -1500,8 +1501,8 @@ void MEDCouplingBasicsTest5::testUnPolyze3() std::set s; s.insert(INTERP_KERNEL::NORM_PENTA6); CPPUNIT_ASSERT(s==m->getAllGeoTypes()); // - const int expected1[2]={0,7}; - const int expected2[7]={16,0,2,1,3,5,4}; + const mcIdType expected1[2]={0,7}; + const mcIdType expected2[7]={16,0,2,1,3,5,4}; CPPUNIT_ASSERT_EQUAL(2,(int)m->getNodalConnectivityIndex()->getNumberOfTuples()); CPPUNIT_ASSERT(std::equal(expected1,expected1+2,m->getNodalConnectivityIndex()->getConstPointer())); CPPUNIT_ASSERT_EQUAL(7,(int)m->getNodalConnectivity()->getNumberOfTuples()); @@ -1567,11 +1568,11 @@ void MEDCouplingBasicsTest5::testDuplicateEachTupleNTimes1() d->decrRef(); d2->decrRef(); // - const int vals2[4]={9,8,7,6}; - DataArrayInt *d4=DataArrayInt::New(); d4->useArray(vals2,false,DeallocType::CPP_DEALLOC,4,1); d4->setInfoOnComponent(0,"mass [kg]") ; d4->setName("aname"); - DataArrayInt *d5=d4->duplicateEachTupleNTimes(3); - const int vals3[12]={9,9,9,8,8,8,7,7,7,6,6,6}; - DataArrayInt *d6=DataArrayInt::New(); d6->useArray(vals3,false,DeallocType::CPP_DEALLOC,4*3,1); d6->setName("aname"); d6->setInfoOnComponent(0,"mass [kg]"); + const mcIdType vals2[4]={9,8,7,6}; + DataArrayIdType *d4=DataArrayIdType::New(); d4->useArray(vals2,false,DeallocType::CPP_DEALLOC,4,1); d4->setInfoOnComponent(0,"mass [kg]") ; d4->setName("aname"); + DataArrayIdType *d5=d4->duplicateEachTupleNTimes(3); + const mcIdType vals3[12]={9,9,9,8,8,8,7,7,7,6,6,6}; + DataArrayIdType *d6=DataArrayIdType::New(); d6->useArray(vals3,false,DeallocType::CPP_DEALLOC,4*3,1); d6->setName("aname"); d6->setInfoOnComponent(0,"mass [kg]"); CPPUNIT_ASSERT(d5->isEqual(*d6)); d6->decrRef(); d4->decrRef(); d5->decrRef(); @@ -1584,12 +1585,12 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp5() const double coordsData[376]={41,0,42,0,0,42,0,41,41.5,0,29.698484809834998,29.698484809834994,0,41.5,28.991378028648452,28.991378028648445,-42,0,-41,0,-29.698484809834994,29.698484809834998,-41.5,0,-28.991378028648445,28.991378028648452,0,-42,0,-41,-29.698484809835001,-29.698484809834994,0,-41.5,-28.991378028648455,-28.991378028648445,29.698484809834987,-29.698484809835001,28.991378028648441,-28.991378028648455,43,0,0,43,42.5,0,30.405591591021544,30.40559159102154,0,42.5,-43,0,-30.40559159102154,30.405591591021544,-42.5,0,0,-43,-30.405591591021551,-30.40559159102154,0,-42.5,30.405591591021537,-30.405591591021551,44,0,0,44,43.5,0,31.112698372208094,31.112698372208087,0,43.5,-44,0,-31.112698372208087,31.112698372208094,-43.5,0,0,-44,-31.112698372208097,-31.112698372208087,0,-43.5,31.112698372208083,-31.112698372208097,45,0,0,45,44.5,0,31.81980515339464,31.819805153394636,0,44.5,-45,0,-31.819805153394636,31.81980515339464,-44.5,0,0,-45,-31.819805153394647,-31.819805153394636,0,-44.5,31.819805153394629,-31.819805153394647,47,0,0,47,46,0,33.234018715767739,33.234018715767732,0,46,-47,0,-33.234018715767732,33.234018715767739,-46,0,0,-47,-33.234018715767739,-33.234018715767732,0,-46,33.234018715767725,-33.234018715767739,49,0,0,49,48,0,34.648232278140831,34.648232278140824,0,48,-49,0,-34.648232278140824,34.648232278140831,-48,0,0,-49,-34.648232278140839,-34.648232278140824,0,-48,34.648232278140817,-34.648232278140839,51,0,0,51,50,0,36.062445840513924,36.062445840513924,0,50,-51,0,-36.062445840513924,36.062445840513924,-50,0,0,-51,-36.062445840513931,-36.062445840513924,0,-50,36.062445840513917,-36.062445840513931,53,0,0,53,52,0,37.476659402887023,37.476659402887016,0,52,-53,0,-37.476659402887016,37.476659402887023,-52,0,0,-53,-37.47665940288703,-37.476659402887016,0,-52,37.476659402887009,-37.47665940288703,55,0,0,55,54,0,38.890872965260115,38.890872965260108,0,54,-55,0,-38.890872965260108,38.890872965260115,-54,0,0,-55,-38.890872965260122,-38.890872965260108,0,-54,38.890872965260101,-38.890872965260122,59,0,0,59,57,0,41.719300090006307,41.7193000900063,0,57,-59,0,-41.7193000900063,41.719300090006307,-57,0,0,-59,-41.719300090006314,-41.7193000900063,0,-57,41.719300090006293,-41.719300090006314,63,0,0,63,61,0,44.547727214752499,44.547727214752491,0,61,-63,0,-44.547727214752491,44.547727214752499,-61,0,0,-63,-44.547727214752506,-44.547727214752491,0,-61,44.547727214752484,-44.547727214752506,67,0,0,67,65,0,47.37615433949869,47.376154339498683,0,65,-67,0,-47.376154339498683,47.37615433949869,-65,0,0,-67,-47.376154339498697,-47.376154339498683,0,-65,47.376154339498676,-47.376154339498697,71,0,0,71,69,0,50.204581464244875,50.204581464244868,0,69,-71,0,-50.204581464244868,50.204581464244875,-69,0,0,-71,-50.204581464244889,-50.204581464244868,0,-69,50.20458146424486,-50.204581464244889,75,0,0,75,73,0,53.033008588991066,53.033008588991059,0,73,-75,0,-53.033008588991059,53.033008588991066,-73,0,0,-75,-53.033008588991073,-53.033008588991059,0,-73,53.033008588991052,-53.033008588991073,80,0,0,80,77.5,0,56.568542494923804,56.568542494923797,0,77.5,-80,0,-56.568542494923797,56.568542494923804,-77.5,0,0,-80,-56.568542494923818,-56.568542494923797,0,-77.5,56.56854249492379,-56.568542494923818}; coords->useArray(coordsData,false,DeallocType::CPP_DEALLOC,188,2); coords->setName(""); - DataArrayInt *conn=DataArrayInt::New(); - const int connData[540]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12,8,9,8,13,14,11,15,16,17,8,14,13,1,0,16,18,4,19,8,1,20,21,2,22,23,24,5,8,2,21,25,8,24,26,27,10,8,8,25,28,13,27,29,30,15,8,13,28,20,1,30,31,22,18,8,20,32,33,21,34,35,36,23,8,21,33,37,25,36,38,39,26,8,25,37,40,28,39,41,42,29,8,28,40,32,20,42,43,34,31,8,32,44,45,33,46,47,48,35,8,33,45,49,37,48,50,51,38,8,37,49,52,40,51,53,54,41,8,40,52,44,32,54,55,46,43,8,44,56,57,45,58,59,60,47,8,45,57,61,49,60,62,63,50,8,49,61,64,52,63,65,66,53,8,52,64,56,44,66,67,58,55,8,56,68,69,57,70,71,72,59,8,57,69,73,61,72,74,75,62,8,61,73,76,64,75,77,78,65,8,64,76,68,56,78,79,70,67,8,68,80,81,69,82,83,84,71,8,69,81,85,73,84,86,87,74,8,73,85,88,76,87,89,90,77,8,76,88,80,68,90,91,82,79,8,80,92,93,81,94,95,96,83,8,81,93,97,85,96,98,99,86,8,85,97,100,88,99,101,102,89,8,88,100,92,80,102,103,94,91,8,92,104,105,93,106,107,108,95,8,93,105,109,97,108,110,111,98,8,97,109,112,100,111,113,114,101,8,100,112,104,92,114,115,106,103,8,104,116,117,105,118,119,120,107,8,105,117,121,109,120,122,123,110,8,109,121,124,112,123,125,126,113,8,112,124,116,104,126,127,118,115,8,116,128,129,117,130,131,132,119,8,117,129,133,121,132,134,135,122,8,121,133,136,124,135,137,138,125,8,124,136,128,116,138,139,130,127,8,128,140,141,129,142,143,144,131,8,129,141,145,133,144,146,147,134,8,133,145,148,136,147,149,150,137,8,136,148,140,128,150,151,142,139,8,140,152,153,141,154,155,156,143,8,141,153,157,145,156,158,159,146,8,145,157,160,148,159,161,162,149,8,148,160,152,140,162,163,154,151,8,152,164,165,153,166,167,168,155,8,153,165,169,157,168,170,171,158,8,157,169,172,160,171,173,174,161,8,160,172,164,152,174,175,166,163,8,164,176,177,165,178,179,180,167,8,165,177,181,169,180,182,183,170,8,169,181,184,172,183,185,186,173,8,172,184,176,164,186,187,178,175}; + DataArrayIdType *conn=DataArrayIdType::New(); + const mcIdType connData[540]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12,8,9,8,13,14,11,15,16,17,8,14,13,1,0,16,18,4,19,8,1,20,21,2,22,23,24,5,8,2,21,25,8,24,26,27,10,8,8,25,28,13,27,29,30,15,8,13,28,20,1,30,31,22,18,8,20,32,33,21,34,35,36,23,8,21,33,37,25,36,38,39,26,8,25,37,40,28,39,41,42,29,8,28,40,32,20,42,43,34,31,8,32,44,45,33,46,47,48,35,8,33,45,49,37,48,50,51,38,8,37,49,52,40,51,53,54,41,8,40,52,44,32,54,55,46,43,8,44,56,57,45,58,59,60,47,8,45,57,61,49,60,62,63,50,8,49,61,64,52,63,65,66,53,8,52,64,56,44,66,67,58,55,8,56,68,69,57,70,71,72,59,8,57,69,73,61,72,74,75,62,8,61,73,76,64,75,77,78,65,8,64,76,68,56,78,79,70,67,8,68,80,81,69,82,83,84,71,8,69,81,85,73,84,86,87,74,8,73,85,88,76,87,89,90,77,8,76,88,80,68,90,91,82,79,8,80,92,93,81,94,95,96,83,8,81,93,97,85,96,98,99,86,8,85,97,100,88,99,101,102,89,8,88,100,92,80,102,103,94,91,8,92,104,105,93,106,107,108,95,8,93,105,109,97,108,110,111,98,8,97,109,112,100,111,113,114,101,8,100,112,104,92,114,115,106,103,8,104,116,117,105,118,119,120,107,8,105,117,121,109,120,122,123,110,8,109,121,124,112,123,125,126,113,8,112,124,116,104,126,127,118,115,8,116,128,129,117,130,131,132,119,8,117,129,133,121,132,134,135,122,8,121,133,136,124,135,137,138,125,8,124,136,128,116,138,139,130,127,8,128,140,141,129,142,143,144,131,8,129,141,145,133,144,146,147,134,8,133,145,148,136,147,149,150,137,8,136,148,140,128,150,151,142,139,8,140,152,153,141,154,155,156,143,8,141,153,157,145,156,158,159,146,8,145,157,160,148,159,161,162,149,8,148,160,152,140,162,163,154,151,8,152,164,165,153,166,167,168,155,8,153,165,169,157,168,170,171,158,8,157,169,172,160,171,173,174,161,8,160,172,164,152,174,175,166,163,8,164,176,177,165,178,179,180,167,8,165,177,181,169,180,182,183,170,8,169,181,184,172,183,185,186,173,8,172,184,176,164,186,187,178,175}; conn->useArray(connData,false,DeallocType::CPP_DEALLOC,540,1); conn->setName(""); - DataArrayInt *connI=DataArrayInt::New(); - const int connIData[61]={0,9,18,27,36,45,54,63,72,81,90,99,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,261,270,279,288,297,306,315,324,333,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540}; + DataArrayIdType *connI=DataArrayIdType::New(); + const mcIdType connIData[61]={0,9,18,27,36,45,54,63,72,81,90,99,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,261,270,279,288,297,306,315,324,333,342,351,360,369,378,387,396,405,414,423,432,441,450,459,468,477,486,495,504,513,522,531,540}; connI->useArray(connIData,false,DeallocType::CPP_DEALLOC,61,1); connI->setName(""); // @@ -1600,15 +1601,15 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp5() // coords=DataArrayDouble::New(); const double coordsData2[84]={46.5,-2.5,53.5,-2.5,53.5,2.5,46.5,2.5,50,-2.5,53.5,0,50,2.5,46.5,0,60.5,-2.5,60.5,2.5,57,-2.5,60.5,0,57,2.5,53.5,7.5,46.5,7.5,53.5,5,50,7.5,46.5,5,60.5,7.5,60.5,5,57,7.5,-2,47,2,47,2,53,-2,53,0,47,2,50,0,53,-2,50,6,47,6,53,4,47,6,50,4,53,2,59,-2,59,2,56,0,59,-2,56,6,59,6,56,4,59}; - coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,42,2); + coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,42,2); coords->setName(""); // connectivity - conn=DataArrayInt::New(); - const int connData2[72]={8,0,1,2,3,4,5,6,7,8,1,8,9,2,10,11,12,5,8,3,2,13,14,6,15,16,17,8,2,9,18,13,12,19,20,15,8,21,22,23,24,25,26,27,28,8,22,29,30,23,31,32,33,26,8,24,23,34,35,27,36,37,38,8,23,30,39,34,33,40,41,36}; + conn=DataArrayIdType::New(); + const mcIdType connData2[72]={8,0,1,2,3,4,5,6,7,8,1,8,9,2,10,11,12,5,8,3,2,13,14,6,15,16,17,8,2,9,18,13,12,19,20,15,8,21,22,23,24,25,26,27,28,8,22,29,30,23,31,32,33,26,8,24,23,34,35,27,36,37,38,8,23,30,39,34,33,40,41,36}; conn->useArray(connData2,false,DeallocType::CPP_DEALLOC,72,1); conn->setName(""); - connI=DataArrayInt::New(); - const int connIData2[9]={0,9,18,27,36,45,54,63,72}; + connI=DataArrayIdType::New(); + const mcIdType connIData2[9]={0,9,18,27,36,45,54,63,72}; connI->useArray(connIData2,false,DeallocType::CPP_DEALLOC,9,1); connI->setName(""); MEDCouplingUMesh *m2=MEDCouplingUMesh::New("Mobile",2); @@ -1616,16 +1617,16 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp5() m2->setConnectivity(conn,connI,true); coords->decrRef(); conn->decrRef(); connI->decrRef(); // - DataArrayInt *d1=0,*d2=0; + 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()); - CPPUNIT_ASSERT_EQUAL(105,(int)d2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(704,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(105,(int)d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(105,(int)d2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(704,(int)m3->getNumberOfNodes()); // const double areaExpected[105]={-65.18804756198824,-65.18804756198824,-65.18804756198824,-65.18804756198824,-66.75884388878285,-66.75884388878285,-66.7588438887833,-66.75884388878308,-68.32964021557768,-68.32964021557768,-68.32964021557814,-68.32964021557791,-69.9004365423732,-69.9004365423732,-69.90043654237297,-69.90043654237297,-1.194568659706448,-1.0869994447159463,-142.2316939607081,-144.51326206513068,-144.5132620651309,-1.1945686597064424,-143.3186934054243,-5.002264310862817,-10.0261332846393,-3.9727823117092953,-7.290862524642649,-124.504404940456,-3.9727823117093237,-146.82366506060032,-150.79644737231024,-5.002264310862776,-145.79418306144626,-5.00208651738126,-10.054764051268958,-4.001067863263231,-8.027932154428669,-129.99378209314813,-4.001067863263216,-153.07856481622616,-157.0796326794898,-5.0020865173811915,-152.07754616210832,-5.001928880064381,-10.050590216368969,-4.00098721602491,-8.025810856794209,-136.28350081741684,-4.000987216024939,-159.36183077064402,-163.36281798667005,-5.0019288800643285,-158.36088910660442,-1.2991516319851801,-3.702636830195414,-3.7815130030068254,-6.265364371195623,-0.02516260900254963,-0.6553944641345026,-3.975752765070567,-7.368528340442765,-142.57249927881398,-0.02516260900254963,-3.9757527650706095,-165.64508791977525,-169.64600329384803,-1.299151631985167,-3.7026368301953885,-164.6442148316677,-10.00321285677458,-20.08414323176165,-8.001644468035863,-16.042954878437143,-304.0096070742277,-8.00164446803587,-350.1399180412005,-358.1415625092368,-10.003212856774468,-348.13834965246224,-3.794150313030109,-8.65049239704272,-0.02260276689354157,-0.5885167811200915,-370.2185414798688,-0.022602766893559393,-383.2517009710623,-383.2743037379555,-3.7941503130300576,-379.48015342492505,-408.40704496667513,-408.4070449666742,-408.4070449666742,-408.4070449666742,-433.53978619538975,-433.5397861953902,-433.5397861953911,-433.53978619539066,-458.67252742410983,-458.6725274241094,-458.67252742410983,-458.6725274241089,-608.6835766330232,-608.6835766330232,-608.6835766330232,-608.6835766330241}; - const int expected1[105]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,16,16,17,18,19,19,20,20,20,20,20,21,21,22,23,23,24,24,24,24,24,25,25,26,27,27,28,28,28,28,28,29,29,30,31,31,32,32,32,32,32,32,32,32,32,33,33,33,34,35,35,35,36,36,36,36,36,37,37,38,39,39,40,40,40,40,40,41,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59}; - const int expected2[105]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,2,-1,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,1,2,3,4,5,6,7,-1,4,6,-1,-1,0,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; + const mcIdType expected1[105]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,16,16,17,18,19,19,20,20,20,20,20,21,21,22,23,23,24,24,24,24,24,25,25,26,27,27,28,28,28,28,28,29,29,30,31,31,32,32,32,32,32,32,32,32,32,33,33,33,34,35,35,35,36,36,36,36,36,37,37,38,39,39,40,40,40,40,40,41,41,42,43,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59}; + const mcIdType expected2[105]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,2,-1,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,2,4,5,-1,4,-1,-1,0,-1,0,1,2,3,4,5,6,7,-1,4,6,-1,-1,0,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,1,3,6,7,-1,6,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}; MEDCouplingFieldDouble *f3f=m3->getMeasureField(ON_CELLS); const double *f3=f3f->getArray()->getConstPointer(); for(int i=0;i<105;i++) @@ -1645,12 +1646,12 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp5() void MEDCouplingBasicsTest5::testDAIBuildUnique1() { - DataArrayInt *d=DataArrayInt::New(); - const int dData[14]={1,2,2,3,3,3,3,4,5,5,7,7,7,19}; + DataArrayIdType *d=DataArrayIdType::New(); + const mcIdType dData[14]={1,2,2,3,3,3,3,4,5,5,7,7,7,19}; d->useArray(dData,false,DeallocType::CPP_DEALLOC,14,1); - const int expectedData[7]={1,2,3,4,5,7,19}; + const mcIdType expectedData[7]={1,2,3,4,5,7,19}; // - DataArrayInt *e=d->buildUnique(); + DataArrayIdType *e=d->buildUnique(); CPPUNIT_ASSERT_EQUAL(7,(int)e->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)e->getNumberOfComponents()); for(int i=0;i<7;i++) @@ -1662,32 +1663,32 @@ void MEDCouplingBasicsTest5::testDAIBuildUnique1() void MEDCouplingBasicsTest5::testDAIPartitionByDifferentValues1() { - const int data[9]={1,0,1,2,0,2,2,-3,2}; - const int expected1[4]={-3,0,1,2}; - const int expected2_0[1]={7}; - const int expected2_1[2]={1,4}; - const int expected2_2[2]={0,2}; - const int expected2_3[4]={3,5,6,8}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType data[9]={1,0,1,2,0,2,2,-3,2}; + const mcIdType expected1[4]={-3,0,1,2}; + const mcIdType expected2_0[1]={7}; + const mcIdType expected2_1[2]={1,4}; + const mcIdType expected2_2[2]={0,2}; + const mcIdType expected2_3[4]={3,5,6,8}; + DataArrayIdType *d=DataArrayIdType::New(); d->useArray(data,false,DeallocType::CPP_DEALLOC,9,1); - std::vector f; + std::vector f; static const int nbOfOutputsExpected=4; - std::vector e=d->partitionByDifferentValues(f); + std::vector e=d->partitionByDifferentValues(f); d->decrRef(); CPPUNIT_ASSERT_EQUAL(nbOfOutputsExpected,(int)e.size()); CPPUNIT_ASSERT_EQUAL(nbOfOutputsExpected,(int)f.size()); for(int i=0;igetNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[1]->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)2,e[2]->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL((std::size_t)4,e[3]->getNbOfElems()); - CPPUNIT_ASSERT_EQUAL(1,(int)e[0]->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(1,(int)e[1]->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(1,(int)e[2]->getNumberOfComponents()); - CPPUNIT_ASSERT_EQUAL(1,(int)e[3]->getNumberOfComponents()); + { + CPPUNIT_ASSERT_EQUAL(expected1[i],f[i]); + } + CPPUNIT_ASSERT_EQUAL(ToIdType(1),e[0]->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),e[1]->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),e[2]->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(4),e[3]->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(1,(int)e[0]->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(1,(int)e[1]->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(1,(int)e[2]->getNumberOfComponents()); + CPPUNIT_ASSERT_EQUAL(1,(int)e[3]->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expected2_0,expected2_0+1,e[0]->begin())); CPPUNIT_ASSERT(std::equal(expected2_1,expected2_1+2,e[1]->begin())); CPPUNIT_ASSERT(std::equal(expected2_2,expected2_2+2,e[2]->begin())); @@ -1697,11 +1698,11 @@ void MEDCouplingBasicsTest5::testDAIPartitionByDifferentValues1() void MEDCouplingBasicsTest5::testDAICheckMonotonic1() { - const int data1[6]={-1,0,2,2,4,5}; - const int data2[6]={6,2,0,-8,-9,-56}; - const int data3[6]={-1,0,3,2,4,6}; - const int data4[6]={7,5,2,3,0,-6}; - DataArrayInt *d=DataArrayInt::New(); + const mcIdType data1[6]={-1,0,2,2,4,5}; + const mcIdType data2[6]={6,2,0,-8,-9,-56}; + const mcIdType data3[6]={-1,0,3,2,4,6}; + const mcIdType data4[6]={7,5,2,3,0,-6}; + DataArrayIdType *d=DataArrayIdType::New(); d->useArray(data1,false,DeallocType::CPP_DEALLOC,6,1); CPPUNIT_ASSERT(d->isMonotonic(true)); CPPUNIT_ASSERT(!d->isMonotonic(false)); @@ -1742,11 +1743,11 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() const double coordsData[16]={2.7554552980815448e-15,45,-45,5.5109105961630896e-15,-31.819805153394636,31.81980515339464,2.8779199779962799e-15,47,2.8166876380389124e-15,46,-47,5.7558399559925599e-15,-33.234018715767732,33.234018715767739,-46,5.6333752760778247e-15}; coords->useArray(coordsData,false,DeallocType::CPP_DEALLOC,8,2); // connectivity - DataArrayInt *conn=DataArrayInt::New(); - const int connData[9]={8,0,3,5,1,4,6,7,2}; + DataArrayIdType *conn=DataArrayIdType::New(); + const mcIdType connData[9]={8,0,3,5,1,4,6,7,2}; conn->useArray(connData,false,DeallocType::CPP_DEALLOC,9,1); - DataArrayInt *connI=DataArrayInt::New(); - const int connIData[2]={0,9}; + DataArrayIdType *connI=DataArrayIdType::New(); + const mcIdType connIData[2]={0,9}; connI->useArray(connIData,false,DeallocType::CPP_DEALLOC,2,1); MEDCouplingUMesh *m1=MEDCouplingUMesh::New("Fixe",2); m1->setCoords(coords); @@ -1757,11 +1758,11 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() const double coordsData2[26]={-7.3800475508445391,41.854329503018846,-3.7041190667754655,42.338274668899189,-3.7041190667754655,45.338274668899189,-7.3800475508445382,44.854329503018839,-5.5473631693521845,42.136406608386956,-3.7041190667754655,43.838274668899189,-5.5420833088100014,45.09630208595901,-7.3800475508445382,43.354329503018839,-3.7041190667754651,52.338274668899189,-7.3800475508445382,51.854329503018839,-3.7041190667754655,48.838274668899189,-5.5420833088100014,52.09630208595901,-7.3800475508445382,48.354329503018839}; coords->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,13,2); // connectivity - conn=DataArrayInt::New(); - const int connData2[18]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12}; + conn=DataArrayIdType::New(); + const mcIdType connData2[18]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12}; conn->useArray(connData2,false,DeallocType::CPP_DEALLOC,18,1); - connI=DataArrayInt::New(); - const int connIData2[3]={0,9,18}; + connI=DataArrayIdType::New(); + const mcIdType connIData2[3]={0,9,18}; connI->useArray(connIData2,false,DeallocType::CPP_DEALLOC,3,1); // MEDCouplingUMesh *m2=MEDCouplingUMesh::New("Mobile",2); @@ -1769,18 +1770,18 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() m2->setConnectivity(conn,connI,true); coords->decrRef(); conn->decrRef(); connI->decrRef(); // - DataArrayInt *d1=0,*d2=0; + 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()); - CPPUNIT_ASSERT_EQUAL(4,(int)d2->getNumberOfTuples()); - CPPUNIT_ASSERT_EQUAL(43,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(4,(int)d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(4,(int)d2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(43,(int)m3->getNumberOfNodes()); bool areMerged=false; - int newNbOfNodes=-1; + mcIdType newNbOfNodes=-1; m3->mergeNodes(1e-12,areMerged,newNbOfNodes)->decrRef(); - CPPUNIT_ASSERT_EQUAL(35,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(35,(int)m3->getNumberOfNodes()); m3->zipCoords(); - CPPUNIT_ASSERT_EQUAL(23,m3->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(23,(int)m3->getNumberOfNodes()); // MEDCouplingFieldDouble *f=m3->getMeasureField(true); const double *vals=f->getArray()->getConstPointer(); @@ -1804,11 +1805,11 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() const double coordsData1[16]={0.5328427124746189, -0.08284271247461905, -0.03284271247461901, 0.4828427124746191, -0.03284271247461906, -0.082842712474619, 0.5328427124746191, 0.482842712474619}; coords1->useArray(coordsData1,false,DeallocType::CPP_DEALLOC,8,2); // connectivity - DataArrayInt *conn1=DataArrayInt::New(); - const int connData1[5]={INTERP_KERNEL::NORM_QPOLYG,0,1,2,3}; + DataArrayIdType *conn1=DataArrayIdType::New(); + const mcIdType connData1[5]={INTERP_KERNEL::NORM_QPOLYG,0,1,2,3}; conn1->useArray(connData1,false,DeallocType::CPP_DEALLOC,5,1); - DataArrayInt *connI1=DataArrayInt::New(); - const int connIData1[2]={0,5}; + DataArrayIdType *connI1=DataArrayIdType::New(); + const mcIdType connIData1[2]={0,5}; connI1->useArray(connIData1,false,DeallocType::CPP_DEALLOC,2,1); MEDCouplingUMesh *m1=MEDCouplingUMesh::New("circle",2); m1->setCoords(coords1); @@ -1820,18 +1821,18 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() const double coordsData2[8]={-0.5,-0.5, -0.5, 0.5, 0.5, 0.5, 0.5,-0.5}; coords2->useArray(coordsData2,false,DeallocType::CPP_DEALLOC,4,2); // connectivity - DataArrayInt *conn2=DataArrayInt::New(); - const int connData2[5]={INTERP_KERNEL::NORM_POLYGON, 0,1,2,3}; + DataArrayIdType *conn2=DataArrayIdType::New(); + const mcIdType connData2[5]={INTERP_KERNEL::NORM_POLYGON, 0,1,2,3}; conn2->useArray(connData2,false,DeallocType::CPP_DEALLOC,5,1); - DataArrayInt *connI2=DataArrayInt::New(); - const int connIData2[2]={0,5}; + DataArrayIdType *connI2=DataArrayIdType::New(); + const mcIdType connIData2[2]={0,5}; connI2->useArray(connIData2,false,DeallocType::CPP_DEALLOC,2,1); MEDCouplingUMesh *m2=MEDCouplingUMesh::New("square",2); m2->setCoords(coords2); m2->setConnectivity(conn2,connI2,true); coords2->decrRef(); conn2->decrRef(); connI2->decrRef(); - DataArrayInt * resToM1 = 0, * resToM2 = 0; + DataArrayIdType * resToM1 = 0, * resToM2 = 0; MEDCouplingUMesh *m_intersec=MEDCouplingUMesh::Intersect2DMeshes(m2, m1, eps, resToM1, resToM2); m_intersec->zipCoords(); @@ -1839,10 +1840,10 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() -0.014575131106459124, 0.5000000000000001, 0.5, -0.11224989991991996, 0.24271243444677046, 0.5, 0.5, 0.19387505004004, \ -0.04799910280454185, -0.06682678787499614, -0.023843325638122054, 0.4915644577163915, 0.5, -0.30612494995996, 0.0, -0.5,\ -0.5, 0.0, -0.25728756555322957, 0.5, -0.023843325638122026, 0.49156445771639157, -0.04799910280454181, -0.06682678787499613}; - const int conn_tgt[22]={32, 5, 2, 6, 4, 7, 8, 9, 10, 32, 6, 3, 0, 1, 5, 4, 11, 12, 13, 14, 15, 16}; - const int connI_tgt[3]={0, 9, 22}; - const int res1_tgt[2] = {0, 0}; - const int res2_tgt[2] = {0, -1}; + const mcIdType conn_tgt[22]={32, 5, 2, 6, 4, 7, 8, 9, 10, 32, 6, 3, 0, 1, 5, 4, 11, 12, 13, 14, 15, 16}; + const mcIdType connI_tgt[3]={0, 9, 22}; + const mcIdType res1_tgt[2] = {0, 0}; + const mcIdType res2_tgt[2] = {0, -1}; CPPUNIT_ASSERT(std::equal(conn_tgt,conn_tgt+22,m_intersec->getNodalConnectivity()->getConstPointer())); CPPUNIT_ASSERT(std::equal(connI_tgt,connI_tgt+3,m_intersec->getNodalConnectivityIndex()->getConstPointer())); @@ -1856,26 +1857,26 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp7() void MEDCouplingBasicsTest5::testDAIBuildSubstractionOptimized1() { - const int tab1[7]={1,3,5,6,7,9,13}; - const int tab2[3]={3,5,9}; - const int tab3[3]={1,3,5}; - DataArrayInt *da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); - DataArrayInt *da2=DataArrayInt::New(); da2->useArray(tab2,false,DeallocType::CPP_DEALLOC,3,1); - DataArrayInt *da3=DataArrayInt::New(); da3->useArray(tab3,false,DeallocType::CPP_DEALLOC,3,1); - DataArrayInt *da4=DataArrayInt::New(); da4->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); - // - DataArrayInt *a=0; + const mcIdType tab1[7]={1,3,5,6,7,9,13}; + const mcIdType tab2[3]={3,5,9}; + const mcIdType tab3[3]={1,3,5}; + DataArrayIdType *da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); + DataArrayIdType *da2=DataArrayIdType::New(); da2->useArray(tab2,false,DeallocType::CPP_DEALLOC,3,1); + 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=0; a=da1->buildSubstractionOptimized(da2); CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); - const int expected1_0[4]={1,6,7,13}; + const mcIdType expected1_0[4]={1,6,7,13}; CPPUNIT_ASSERT(std::equal(expected1_0,expected1_0+4,a->begin())); a->decrRef(); // a=da1->buildSubstractionOptimized(da3); CPPUNIT_ASSERT_EQUAL(4,(int)a->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)a->getNumberOfComponents()); - const int expected2_0[4]={6,7,9,13}; + const mcIdType expected2_0[4]={6,7,9,13}; CPPUNIT_ASSERT(std::equal(expected2_0,expected2_0+4,a->begin())); a->decrRef(); // @@ -1892,8 +1893,8 @@ void MEDCouplingBasicsTest5::testDAIBuildSubstractionOptimized1() void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() { - const int tab1[7]={1,3,5,6,7,9,13}; - DataArrayInt *da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); + const mcIdType tab1[7]={1,3,5,6,7,9,13}; + DataArrayIdType *da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true)); da1->checkStrictlyMonotonic(true); CPPUNIT_ASSERT(da1->isMonotonic(true)); @@ -1904,8 +1905,8 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception); da1->decrRef(); // - int tab2[7]={1,3,5,6,6,9,13}; - da1=DataArrayInt::New(); da1->useArray(tab2,false,DeallocType::CPP_DEALLOC,7,1); + mcIdType tab2[7]={1,3,5,6,6,9,13}; + da1=DataArrayIdType::New(); da1->useArray(tab2,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true)); CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT(da1->isMonotonic(true)); @@ -1916,8 +1917,8 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception); da1->decrRef(); // - const int tab3[7]={1,3,5,6,5,9,13}; - da1=DataArrayInt::New(); da1->useArray(tab3,false,DeallocType::CPP_DEALLOC,7,1); + const mcIdType tab3[7]={1,3,5,6,5,9,13}; + da1=DataArrayIdType::New(); da1->useArray(tab3,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true)); CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT(!da1->isMonotonic(true)); @@ -1928,8 +1929,8 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception); da1->decrRef(); // - const int tab4[7]={13,9,7,6,5,3,1}; - da1=DataArrayInt::New(); da1->useArray(tab4,false,DeallocType::CPP_DEALLOC,7,1); + const mcIdType tab4[7]={13,9,7,6,5,3,1}; + da1=DataArrayIdType::New(); da1->useArray(tab4,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true)); CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT(!da1->isMonotonic(true)); @@ -1940,8 +1941,8 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() da1->checkMonotonic(false); da1->decrRef(); // - const int tab5[7]={13,9,6,6,5,3,1}; - da1=DataArrayInt::New(); da1->useArray(tab5,false,DeallocType::CPP_DEALLOC,7,1); + const mcIdType tab5[7]={13,9,6,6,5,3,1}; + da1=DataArrayIdType::New(); da1->useArray(tab5,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true)); CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT(!da1->isMonotonic(true)); @@ -1952,8 +1953,8 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() da1->checkMonotonic(false); da1->decrRef(); // - const int tab6[7]={13,9,5,6,5,3,1}; - da1=DataArrayInt::New(); da1->useArray(tab6,false,DeallocType::CPP_DEALLOC,7,1); + const mcIdType tab6[7]={13,9,5,6,5,3,1}; + da1=DataArrayIdType::New(); da1->useArray(tab6,false,DeallocType::CPP_DEALLOC,7,1); CPPUNIT_ASSERT(!da1->isStrictlyMonotonic(true)); CPPUNIT_ASSERT_THROW(da1->checkStrictlyMonotonic(true),INTERP_KERNEL::Exception); CPPUNIT_ASSERT(!da1->isMonotonic(true)); @@ -1964,7 +1965,7 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() CPPUNIT_ASSERT_THROW(da1->checkMonotonic(false),INTERP_KERNEL::Exception); da1->decrRef(); // - da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,0,1); + da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,0,1); CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true)); da1->checkStrictlyMonotonic(true); CPPUNIT_ASSERT(da1->isMonotonic(true)); @@ -1975,7 +1976,7 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() da1->checkMonotonic(false); da1->decrRef(); // - da1=DataArrayInt::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,1,1); + da1=DataArrayIdType::New(); da1->useArray(tab1,false,DeallocType::CPP_DEALLOC,1,1); CPPUNIT_ASSERT(da1->isStrictlyMonotonic(true)); da1->checkStrictlyMonotonic(true); CPPUNIT_ASSERT(da1->isMonotonic(true)); @@ -1989,7 +1990,7 @@ void MEDCouplingBasicsTest5::testDAIIsStrictlyMonotonic1() void MEDCouplingBasicsTest5::testSimplexize3() { - const int conn[24]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; + const mcIdType conn[24]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23}; MEDCouplingUMesh *m=MEDCouplingUMesh::New("toto",3); m->allocateCells(0); m->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn+0); @@ -2004,7 +2005,7 @@ void MEDCouplingBasicsTest5::testSimplexize3() m->checkConsistency(); // MEDCouplingUMesh *m1=static_cast(m->deepCopy()); - DataArrayInt *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5); + DataArrayIdType *d1=m1->simplexize(INTERP_KERNEL::PLANAR_FACE_5); m1->checkConsistency(); MEDCouplingFieldDouble *f1=m1->getMeasureField(ON_CELLS); const double vol1Expected[12]={1./6, 1./6, 1./6,1./6, 1./6, 1./3,1./6, 1./6, 1./6, 1./6, 1./3, 1./6}; @@ -2012,9 +2013,9 @@ void MEDCouplingBasicsTest5::testSimplexize3() CPPUNIT_ASSERT_EQUAL(12,(int)f1->getArray()->getNumberOfTuples()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(vol1Expected[i],f1->getIJ(i,0),1e-12); - const int connExpected1[60]={14,0,1,2,3,14,4,9,5,6,14,4,8,9,11,14,4,7,11,6,14,9,11,10,6,14,4,9,6,11,14,12,17,13,14,14,12,16,17,19,14,12,15,19,14,14,17,19,18,14,14,12,17,14,19,14,20,21,22,23}; - const int connIExpected1[13]={0,5,10,15,20,25,30,35,40,45,50,55,60}; - const int n2o1[12]={0,1,1,1,1,1,2,2,2,2,2,3}; + const mcIdType connExpected1[60]={14,0,1,2,3,14,4,9,5,6,14,4,8,9,11,14,4,7,11,6,14,9,11,10,6,14,4,9,6,11,14,12,17,13,14,14,12,16,17,19,14,12,15,19,14,14,17,19,18,14,14,12,17,14,19,14,20,21,22,23}; + const mcIdType connIExpected1[13]={0,5,10,15,20,25,30,35,40,45,50,55,60}; + const mcIdType n2o1[12]={0,1,1,1,1,1,2,2,2,2,2,3}; CPPUNIT_ASSERT_EQUAL(1,(int)m1->getNodalConnectivity()->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(60,(int)m1->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)m1->getNodalConnectivityIndex()->getNumberOfComponents()); @@ -2029,7 +2030,7 @@ void MEDCouplingBasicsTest5::testSimplexize3() d1->decrRef(); // MEDCouplingUMesh *m2=static_cast(m->deepCopy()); - DataArrayInt *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6); + DataArrayIdType *d2=m2->simplexize(INTERP_KERNEL::PLANAR_FACE_6); m2->checkConsistency(); MEDCouplingFieldDouble *f2=m2->getMeasureField(ON_CELLS); const double vol2Expected[14]={1./6, 1./6, 1./6,1./6, 1./6, 1./6,1./6,1./6, 1./6, 1./6, 1./6, 1./6,1./6,1./6}; @@ -2037,9 +2038,9 @@ void MEDCouplingBasicsTest5::testSimplexize3() CPPUNIT_ASSERT_EQUAL(14,(int)f2->getArray()->getNumberOfTuples()); for(int i=0;i<14;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(vol2Expected[i],f2->getIJ(i,0),1e-12); - const int connExpected2[70]={14,0,1,2,3,14,4,9,5,10,14,4,5,6,10,14,4,8,9,10,14,4,11,8,10,14,4,6,7,10,14,4,7,11,10,14,12,17,13,18,14,12,13,14,18,14,12,16,17,18,14,12,19,16,18,14,12,14,15,18,14,12,15,19,18,14,20,21,22,23}; - const int connIExpected2[15]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70}; - const int n2o2[14]={0,1,1,1,1,1,1,2,2,2,2,2,2,3}; + const mcIdType connExpected2[70]={14,0,1,2,3,14,4,9,5,10,14,4,5,6,10,14,4,8,9,10,14,4,11,8,10,14,4,6,7,10,14,4,7,11,10,14,12,17,13,18,14,12,13,14,18,14,12,16,17,18,14,12,19,16,18,14,12,14,15,18,14,12,15,19,18,14,20,21,22,23}; + const mcIdType connIExpected2[15]={0,5,10,15,20,25,30,35,40,45,50,55,60,65,70}; + const mcIdType n2o2[14]={0,1,1,1,1,1,1,2,2,2,2,2,2,3}; CPPUNIT_ASSERT_EQUAL(1,(int)m2->getNodalConnectivity()->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(70,(int)m2->getNodalConnectivity()->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)m2->getNodalConnectivityIndex()->getNumberOfComponents()); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx index 52ee9b15e..756736d00 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestData1.hxx @@ -18,7 +18,7 @@ // // Author : Anthony Geay (CEA/DEN) -int 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, +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, 2624, 2653, 2682, 2711, 2740, 2769, 2798, 2827, 2856, 2885, 2914, 2943, 2972, 3001, 3030, 3059, 3088, 3117, 3146, 3175, 3204, 3233, 3262, 3291, @@ -27,7 +27,7 @@ int connITT[201]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 4712, 4741, 4770, 4799, 4828, 4857, 4886, 4915, 4944, 4973, 5002, 5031, 5060, 5089, 5118, 5147, 5176, 5205, 5234, 5263, 5292, 5321, 5350, 5379, 5408, 5437, 5466, 5495, 5524, 5553, 5582, 5611, 5640, 5669, 5698, 5727, 5756, 5785, 5814, 5843, 5872, 5901, 5930, 5959, 5988, 6017, 6046, 6075, 6104, 6133, 6162, 6191, 6220}; - int connTT[6220]={0, 1, 2, 3, 4, 5, 6, -1, 0, 7, 8, 1, -1, 1, 8, 9, 2, -1, 2, 9, 10, 3, -1, 3, 10, 11, 4, -1, 4, 11, 12, 5, -1, 5, 12, 13, 6, -1, 6, 13, 7, 0, -1, 7, 13, 12, 11, 10, 9, 8, 14, 15, 16, 17, 18, 19, + mcIdType connTT[6220]={0, 1, 2, 3, 4, 5, 6, -1, 0, 7, 8, 1, -1, 1, 8, 9, 2, -1, 2, 9, 10, 3, -1, 3, 10, 11, 4, -1, 4, 11, 12, 5, -1, 5, 12, 13, 6, -1, 6, 13, 7, 0, -1, 7, 13, 12, 11, 10, 9, 8, 14, 15, 16, 17, 18, 19, 20, -1, 14, 21, 22, 15, -1, 15, 22, 23, 16, -1, 16, 23, 24, 17, -1, 17, 24, 25, 18, -1, 18, 25, 26, 19, -1, 19, 26, 27, 20, -1, 20, 27, 21, 14, -1, 21, 27, 26, 25, 24, 23, 22, 28, 29, 30, 31, 32, 33, 34, -1, 28, 35, 36, 29, -1, 29, 36, 37, 30, -1, 30, 37, 38, 31, -1, 31, 38, 39, 32, -1, 32, 39, 40, 33, -1, 33, 40, 41, 34, -1, 34, 41, 35, 28, -1, 35, 41, 40, 39, 38, 37, 36, 42, 43, 44, 45, 46, 47, 48, -1, 42, 49, 50, 43, -1, 43, 50, 51, 44, -1, 44, 51, 52, 45, -1, 45, 52, 53, 46, -1, 46, 53, 54, 47, -1, 47, 54, 55, 48, -1, 48, 55, 49, 42, -1, 49, 55, 54, 53, 52, 51, 50, 56, 57, 58, @@ -906,7 +906,7 @@ double coordsTT[5160]={ }; -const int connTFH8[2560]={ +const mcIdType connTFH8[2560]={ 1, 2, 7, 6, 28, 29, 34, 33, 2, 3, 8, 7, 29, 30, 35, 34, 3, 4, 9, 8, 30, 31, 36, 35, 4, 5, 10, 9, 31, 32, 37, 36, 6, 7, 12, 11, 33, 34, 39, 38, 7, 8, 13, 12, 34, 35, 40, 39, 8, 9, 14, 13, 35, 36, 41, 40, 9, 10, 15, 14, 36, 37, 42, 41, 11, 12, 17, 16, 38, 39, 44, 43, 12, 13, 18, 17, 39, 40, 45, 44, 13, 14, 19, 18, 40, 41, 46, 45, 14, 15, 20, 19, 41, 42, 47, 46, 16, 17, 21, 26, 43, 44, 48, 53, 17, 18, 22, 21, 44, 45, 49, 48, 18, 19, 23, 22, 45, 46, 50, 49, 19, 20, 24, 23, 46, 47, 51, 50, 28, 29, 34, 33, 55, 56, 61, 60, @@ -966,7 +966,7 @@ const int connTFH8[2560]={ 526, 531, 530, 552, 553, 558, 557, 526, 527, 532, 531, 553, 554, 559, 558, 527, 528, 533, 532, 554, 555, 560, 559, 529, 530, 534, 539, 556, 557, 561, 566, 530, 531, 535, 534, 557, 558, 562, 561, 531, 532, 536, 535, 558, 559, 563, 562, 532, 533, 537, 536, 559, 560, 564, 563}; -const int connTFPOLH[1000]={ +const mcIdType connTFPOLH[1000]={ 0, 25, 26, 16, 11, 6, 1, -1, 27, 28, 33, 38, 43, 53, 52, -1, 0, 1, 28, 27, -1, 1, 6, 33, 28, -1, 6, 11, 38, 33, -1, 11, 16, 43, 38, -1, 16, 26, 53, 43, -1, 26, 25, 52, 53, -1, 25, 0, 27, 52, 27, 52, 53, 43, 38, 33, 28, -1, 54, 55, 60, 65, 70, 80, 79, -1, 27, 28, 55, 54, -1, 28, 33, 60, 55, -1, 33, 38, 65, 60, -1, 38, 43, 70, 65, -1, 43, 53, 80, 70, -1, 53, 52, 79, 80, -1, 52, 27, 54, 79, 54, 79, 80, 70, 65, 60, 55, -1, 81, 82, 87, 92, 97, 107, 106, -1, 54, 55, 82, 81, -1, 55, 60, 87, 82, -1, 60, 65, 92, 87, -1, 65, 70, 97, 92, -1, 70, 80, 107, 97, -1, 80, 79, 106, 107, -1, 79, 54, 81, 106, 81, 106, 107, 97, 92, 87, 82, -1, 108, 109, 114, 119, 124, 134, 133, -1, 81, 82, 109, 108, -1, @@ -1164,4 +1164,4 @@ const double coordsTF[1701]={ 4.2729999999999997, 0, 0.21606, 4.2729999999999997, 0.21606, 0.21606, 4.2729999999999997 }; -const int connTFPOLH_I[21]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; +const mcIdType connTFPOLH_I[21]={0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx index cc96fe9a6..3c5e3c858 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx @@ -41,7 +41,7 @@ using namespace MEDCoupling; -typedef std::vector > IntersectionMatrix; +typedef std::vector > IntersectionMatrix; void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1() { @@ -51,7 +51,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Convex, INTERP_KERNEL::Geometric2D}; for(int i=0;i<3;i++) { @@ -82,7 +82,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0PL_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; // myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -105,15 +105,15 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0PL_2() MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); // - std::vector cellsIds(targetMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + std::vector cellsIds(targetMesh->getNumberOfCells()); + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; // myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -136,15 +136,15 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0PL_3() MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); // - std::vector cellsIds(sourceMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + std::vector cellsIds(sourceMesh->getNumberOfCells()); + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; // myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -167,19 +167,19 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P0PL_4() MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); // - std::vector cellsIds(sourceMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + std::vector cellsIds(sourceMesh->getNumberOfCells()); + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); cellsIds.resize(targetMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; // myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -205,7 +205,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P1_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -241,7 +241,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P1PL_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); @@ -270,20 +270,20 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0P1PL_2() MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); // - std::vector cellsIds(sourceMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + std::vector cellsIds(sourceMesh->getNumberOfCells()); + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // cellsIds.resize(targetMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); @@ -315,9 +315,9 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; - for(int i=0;i<2;i++) + for(mcIdType i=0;i<2;i++) { myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(types[i]); @@ -348,7 +348,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0PL_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); @@ -382,15 +382,15 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0PL_2() MEDCouplingUMesh *sourceMesh=build2DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build2DTargetMesh_1(); // - std::vectorcellsIds(targetMesh->getNumberOfCells()); - for(int i=0;igetNumberOfCells();i++) + std::vectorcellsIds(targetMesh->getNumberOfCells()); + for(mcIdType i=0;igetNumberOfCells();i++) cellsIds[i]=i; targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); // MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); @@ -427,7 +427,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P1_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -466,7 +466,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P1PL_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); @@ -500,7 +500,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[3]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -531,7 +531,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0PL_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -558,7 +558,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P1_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -594,7 +594,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P1PL_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); @@ -626,7 +626,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -659,7 +659,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0PL_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); @@ -696,7 +696,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P1_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D}; for(int i=0;i<2;i++) { @@ -735,7 +735,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P1PL_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); @@ -769,7 +769,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_2() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::Triangulation); { @@ -832,7 +832,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_2() void MEDCouplingBasicsTestInterp::test3DSurfInterpP0P0_3() { INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; double vecTrans[3]={0.,0.,1.e-10}; double vec[3]={0.,-1.,0.}; double pt[3]={-0.3,-0.3,5.e-11}; @@ -927,7 +927,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + 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 ( int i = 0; i < 4; ++i ) @@ -995,7 +995,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1037,7 +1037,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_2() { MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build3DTargetMesh_1(); - std::vector cellsIds(targetMesh->getNumberOfCells()); + std::vector cellsIds(targetMesh->getNumberOfCells()); for(int i=0;igetNumberOfCells();i++) cellsIds[i]=i; targetMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); @@ -1045,7 +1045,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_2() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1087,7 +1087,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_3() { MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build3DTargetMesh_1(); - std::vector cellsIds(sourceMesh->getNumberOfCells()); + std::vector cellsIds(sourceMesh->getNumberOfCells()); for(int i=0;igetNumberOfCells();i++) cellsIds[i]=i; sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); @@ -1095,7 +1095,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_3() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1137,7 +1137,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_4() { MEDCouplingUMesh *sourceMesh=build3DSourceMesh_1(); MEDCouplingUMesh *targetMesh=build3DTargetMesh_1(); - std::vector cellsIds(sourceMesh->getNumberOfCells()); + std::vector cellsIds(sourceMesh->getNumberOfCells()); for(int i=0;igetNumberOfCells();i++) cellsIds[i]=i; sourceMesh->convertToPolyTypes(&cellsIds[0],&cellsIds[0]+cellsIds.size()); @@ -1149,7 +1149,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0PL_4() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1195,7 +1195,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P1_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + 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 ( int i = 0; i < 4; ++i ) @@ -1251,7 +1251,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P1PL_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1285,7 +1285,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + 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 ( int i = 0; i < 4; ++i ) @@ -1341,7 +1341,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0PL_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; 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 }; @@ -1389,7 +1389,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P1_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); @@ -1404,12 +1404,12 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P1_1() int i=0; double sum = 0; //cout.precision(18); - for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) + for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) { //cout<< "res3D[" <::const_iterator iter2=(*iter1).find(j); + std::map::const_iterator iter2=(*iter1).find(j); if(iter2!=(*iter1).end()) { //cout<< iter2->second<< ", "; @@ -1439,7 +1439,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P1PL_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); @@ -1479,7 +1479,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0Empty() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); //clean up @@ -1512,7 +1512,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCC() CPPUNIT_ASSERT_THROW( sourceWrapper.nbCellsAlongAxis(3), INTERP_KERNEL::Exception); INTERP_KERNEL::InterpolationCC myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL(8,int( res.size())); @@ -1521,7 +1521,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCC() std::set vals; double sum = 0; for ( int i = 0; i < (int)res.size(); ++i ) - for ( std::map::iterator s_v = res[i].begin(); s_v != res[i].end(); ++s_v) + for ( std::map::iterator s_v = res[i].begin(); s_v != res[i].end(); ++s_v) { sum += s_v->second; double vvv; @@ -1568,7 +1568,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCU1D() MEDCouplingNormalizedCartesianMesh<1> sourceWrapper(meshC); MEDCouplingNormalizedUnstructuredMesh<1,1> targetWrapper(meshU); INTERP_KERNEL::InterpolationCU myInterpolator; - std::vector > res; + std::vector > res; const double precis = 1e-13; myInterpolator.setPrecision(precis); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -1606,7 +1606,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCU2D() MEDCouplingNormalizedCartesianMesh<2> sourceWrapper(meshC); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(meshU); INTERP_KERNEL::InterpolationCU myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -1675,7 +1675,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCU3D() MEDCouplingNormalizedCartesianMesh<3> sourceWrapper(meshC); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(meshU); INTERP_KERNEL::InterpolationCU myInterpolator; - std::vector > res; + std::vector > res; const double precis = 1e-13; myInterpolator.setPrecision(precis); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -1759,8 +1759,8 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0IntegralUniform() // MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; - CPPUNIT_ASSERT_EQUAL(5,myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); + std::vector > res; + CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][1],1e-12); @@ -1769,7 +1769,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0IntegralUniform() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][4],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.,sumAll(res),1e-12); res.clear(); - CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); + CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[1][0],1e-12); @@ -1784,7 +1784,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0IntegralUniform() MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper2(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator2; CPPUNIT_ASSERT(myInterpolator2.getMeasureAbsStatus()); - CPPUNIT_ASSERT_EQUAL(5,myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0")); + CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125,res[0][1],1e-12); @@ -1795,7 +1795,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP0IntegralUniform() res.clear(); myInterpolator2.setMeasureAbsStatus(false); CPPUNIT_ASSERT(!myInterpolator2.getMeasureAbsStatus()); - CPPUNIT_ASSERT_EQUAL(5,myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0")); + CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator2.toIntegralUniform(targetWrapper2,res,"P0")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.125,res[0][1],1e-12); @@ -1811,8 +1811,8 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0IntegralUniform() MEDCouplingUMesh *targetMesh=build3DSurfTargetMesh_1(); INTERP_KERNEL::Interpolation3DSurf myInterpolator; MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); - std::vector > res; - CPPUNIT_ASSERT_EQUAL(5,myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); + std::vector > res; + CPPUNIT_ASSERT_EQUAL(5,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[0][1],1e-12); @@ -1821,7 +1821,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP0IntegralUniform() CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][4],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(1.*sqrt(2.),sumAll(res),1e-12); res.clear(); - CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); + CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(5,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.25*sqrt(2.),res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.125*sqrt(2.),res[1][0],1e-12); @@ -1837,8 +1837,8 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0IntegralUniform() MEDCouplingUMesh *targetMesh=build3DTargetMesh_1(); INTERP_KERNEL::Interpolation3D myInterpolator; MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); - std::vector > res; - CPPUNIT_ASSERT_EQUAL(8,myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); + std::vector > res; + CPPUNIT_ASSERT_EQUAL(8,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(125000.,res[0][0],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(375000.,res[0][1],1e-6); @@ -1850,7 +1850,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0IntegralUniform() CPPUNIT_ASSERT_DOUBLES_EQUAL(3375000.,res[0][7],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000.,sumAll(res),1e-6); res.clear(); - CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); + CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P0")); CPPUNIT_ASSERT_EQUAL(8,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(125000.,res[0][0],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(375000.,res[1][0],1e-6); @@ -1871,15 +1871,15 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1IntegralUniform() // MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; - CPPUNIT_ASSERT_EQUAL(4,myInterpolator.toIntegralUniform(targetWrapper,res,"P1")); + std::vector > res; + CPPUNIT_ASSERT_EQUAL(4,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P1")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[0][1],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[0][2],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][3],1e-12); res.clear(); - CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P1")); + CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P1")); CPPUNIT_ASSERT_EQUAL(4,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.33333333333333331,res[0][0],1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.16666666666666666,res[1][0],1e-12); @@ -1895,8 +1895,8 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1IntegralUniform() // MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(sourceMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; - CPPUNIT_ASSERT_EQUAL(9,myInterpolator.toIntegralUniform(targetWrapper,res,"P1")); + std::vector > res; + CPPUNIT_ASSERT_EQUAL(9,(int)myInterpolator.toIntegralUniform(targetWrapper,res,"P1")); CPPUNIT_ASSERT_EQUAL(1,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][0],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][1],1e-6); @@ -1909,7 +1909,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1IntegralUniform() CPPUNIT_ASSERT_DOUBLES_EQUAL(2000000.,res[0][8],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(8000000.,sumAll(res),1e-6); res.clear(); - CPPUNIT_ASSERT_EQUAL(1,myInterpolator.fromIntegralUniform(targetWrapper,res,"P1")); + CPPUNIT_ASSERT_EQUAL(1,(int)myInterpolator.fromIntegralUniform(targetWrapper,res,"P1")); CPPUNIT_ASSERT_EQUAL(9,(int)res.size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[0][0],1e-6); CPPUNIT_ASSERT_DOUBLES_EQUAL(833333.333333333,res[1][0],1e-6); @@ -1932,7 +1932,7 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation2D myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; for(int i=0;i<2;i++) { @@ -1973,7 +1973,7 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3DSurf myInterpolator; - std::vector > res; + std::vector > res; INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D}; for(int i=0;i<2;i++) { @@ -2015,7 +2015,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::Barycentric); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); @@ -2029,11 +2029,11 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1() double sum = 0; int i=0; - for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) + for(std::vector >::const_iterator iter1=res.begin();iter1!=res.end();iter1++,i++) { for(int j=0;j<28;j++) { - std::map::const_iterator iter2=(*iter1).find(j); + std::map::const_iterator iter2=(*iter1).find(j); if(iter2!=(*iter1).end()) { sum += iter2->second; @@ -2059,7 +2059,7 @@ void MEDCouplingBasicsTestInterp::test3DTo1DInterpP0P0PL_1() MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh); INTERP_KERNEL::Interpolation3D myInterpolator; - std::vector > res; + std::vector > res; myInterpolator.setPrecision(1e-12); myInterpolator.setIntersectionType(INTERP_KERNEL::PointLocator); myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); @@ -2097,7 +2097,7 @@ void MEDCouplingBasicsTestInterp::test1DInterp_1() myInterpolator.setPrecision(precis); // P0P0 - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL( 3, int( res.size()) ); CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.5, res[0][0], precis); @@ -2154,7 +2154,7 @@ void MEDCouplingBasicsTestInterp::test2DCurveInterpP0P0_1() INTERP_KERNEL::Interpolation2DCurve myInterpolator; const double precis = 1e-13; myInterpolator.setPrecision(precis); - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); CPPUNIT_ASSERT_EQUAL( 2, int( res.size()) ); @@ -2178,7 +2178,7 @@ void MEDCouplingBasicsTestInterp::test2DCurveInterpP0P0_2() const double precis = 1e-13; myInterpolator.setPrecision(precis); myInterpolator.setMedianPlane(1.);// median line on target - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P0"); double tolInters = myInterpolator.getBoundingBoxAdjustmentAbs() * sqrt(2.); @@ -2203,7 +2203,7 @@ void MEDCouplingBasicsTestInterp::test2DCurveInterpP0P1_1() INTERP_KERNEL::Interpolation2DCurve myInterpolator; const double precis = 1e-13; myInterpolator.setPrecision(precis); - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P0P1"); const double len1 = 1., len0 = sqrt(2.); @@ -2229,7 +2229,7 @@ void MEDCouplingBasicsTestInterp::test2DCurveInterpP1P0_1() INTERP_KERNEL::Interpolation2DCurve myInterpolator; const double precis = 1e-13; myInterpolator.setPrecision(precis); - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0"); const double len1 = 1., len0 = sqrt(2.); @@ -2255,7 +2255,7 @@ void MEDCouplingBasicsTestInterp::test2DCurveInterpP1P1_1() INTERP_KERNEL::Interpolation2DCurve myInterpolator; const double precis = 1e-13; myInterpolator.setPrecision(precis); - std::vector > res; + std::vector > res; myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P1"); const double len1 = 1., len0 = sqrt(2.); @@ -2306,7 +2306,7 @@ void MEDCouplingBasicsTestInterp::test2D1DBasicInterpP0P0() CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size()); INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces; - std::set face6; + std::set face6; face6.insert(0); face6.insert(1); correctDuplicateFaces[6] = face6; @@ -2467,15 +2467,15 @@ void MEDCouplingBasicsTestInterp::test3D2DBasicInterpP0P0() CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size()); INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces; - std::set face2; + std::set face2; face2.insert(0); face2.insert(1); correctDuplicateFaces[2] = face2; - std::set face5; + std::set face5; face5.insert(1); face5.insert(2); correctDuplicateFaces[5] = face5; - std::set face6; + std::set face6; face6.insert(0); face6.insert(1); face6.insert(2); diff --git a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx index dfd3751af..7e305f219 100644 --- a/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingExamplesTest.cxx @@ -24,6 +24,7 @@ #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingMultiFields.hxx" @@ -592,7 +593,7 @@ void CppExample_MEDCouplingFieldDouble_renumberNodes() CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *nodeCoords, 1e-13 )); //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_2] //! [CppSnippet_MEDCouplingFieldDouble_renumberNodes_3] - const int renumber[9] = { 8, 7, 6, 5, 4, 3, 2, 1, 0 }; + const mcIdType renumber[9] = { 8, 7, 6, 5, 4, 3, 2, 1, 0 }; field->renumberNodes(renumber,false); const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh values = field->getArray(); @@ -620,7 +621,7 @@ void CppExample_MEDCouplingFieldDouble_renumberCells() CPPUNIT_ASSERT( values->isEqualWithoutConsideringStr( *bc, 1e-13 )); //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_2] //! [CppSnippet_MEDCouplingFieldDouble_renumberCells_3] - const int renumber[4] = { 3, 2, 1, 0 }; + const mcIdType renumber[4] = { 3, 2, 1, 0 }; field->renumberCells(renumber,false); const MEDCouplingMesh* mesh2 = field->getMesh(); // field now refers to another mesh values = field->getArray(); @@ -776,7 +777,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() MCAuto mesh1=MEDCouplingUMesh::New(); mesh1->setMeshDimension(2); mesh1->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh1->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // #0 mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // #1 mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // #2 @@ -790,13 +791,13 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() mesh1->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_1] //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2] - const int cells2[3] = { 4,2,0 }; // even cells selected + const mcIdType cells2[3] = { 4,2,0 }; // even cells selected MCAuto mesh2 = (MEDCouplingUMesh*) mesh1->buildPartOfMySelf( cells2, cells2+3, true ); //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_2] //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_3] int compType = 0; // the strongest policy - DataArrayInt *corr2to1, *corr1to2; + DataArrayIdType *corr2to1, *corr1to2; // a larger mesh1 includes a smaller mesh2 CPPUNIT_ASSERT( mesh1->areCellsIncludedIn( mesh2, compType, corr2to1 )); CPPUNIT_ASSERT( std::equal( cells2, cells2+3, corr2to1->getConstPointer() )); @@ -804,7 +805,7 @@ void CppExample_MEDCouplingUMesh_areCellsIncludedIn() //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_4] // the smaller mesh2 does NOT include the larger mesh1 CPPUNIT_ASSERT( ! mesh2->areCellsIncludedIn( mesh1, compType, corr1to2 )); - const int corr1to2Expected[5] = {2, 3, 1, 4, 0}; + const mcIdType corr1to2Expected[5] = {2, 3, 1, 4, 0}; CPPUNIT_ASSERT(std::equal( corr1to2Expected, corr1to2Expected+5, corr1to2->getConstPointer() )); //! [CppSnippet_MEDCouplingUMesh_areCellsIncludedIn_4] corr2to1->decrRef(); @@ -831,13 +832,13 @@ void CppExample_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells() mesh->setMeshDimension(3); mesh->allocateCells(2); // connectivity of reversed HEXA8 and PENTA6 - const int conn[8+6]={0,1,4,3, 5,6,9,8, 1,2,4, 6,7,9}; + const mcIdType conn[8+6]={0,1,4,3, 5,6,9,8, 1,2,4, 6,7,9}; mesh->insertNextCell(INTERP_KERNEL::NORM_HEXA8, 8,conn+0); mesh->insertNextCell(INTERP_KERNEL::NORM_PENTA6,6,conn+8); mesh->finishInsertingCells(); //! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_1] //! [CppSnippet_MEDCouplingUMesh_findAndCorrectBadOriented3DExtrudedCells_2] - MCAuto fixedCells = + MCAuto fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells(); CPPUNIT_ASSERT( fixedCells->getNumberOfTuples() == 2 ); // 2 cells fixed fixedCells = mesh->findAndCorrectBadOriented3DExtrudedCells(); @@ -865,7 +866,7 @@ void CppExample_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented() mesh->setMeshDimension(3); mesh->allocateCells(2); // connectivity of a HEXA8 + a reversed PENTA6 - const int conn[8+6]={0,3,4,1, 5,8,9,6, 1,2,4, 6,7,9}; + const mcIdType conn[8+6]={0,3,4,1, 5,8,9,6, 1,2,4, 6,7,9}; mesh->insertNextCell(INTERP_KERNEL::NORM_POLYHED,8,conn); // "extruded" polyhedron mesh->insertNextCell(INTERP_KERNEL::NORM_POLYHED,6,conn+8); mesh->finishInsertingCells(); @@ -873,7 +874,7 @@ void CppExample_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented() mesh->convertExtrudedPolyhedra(); //! [CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_1] //! [CppSnippet_MEDCouplingUMesh_arePolyhedronsNotCorrectlyOriented_2] - std::vector badCellIds; + std::vector badCellIds; mesh->arePolyhedronsNotCorrectlyOriented( badCellIds ); CPPUNIT_ASSERT( badCellIds.size() == 1 ); // one polyhedron is KO // fix invalid rolyherdons @@ -892,7 +893,7 @@ void CppExample_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -908,7 +909,7 @@ void CppExample_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented() //! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_1] //! [CppSnippet_MEDCouplingUMesh_are2DCellsNotCorrectlyOriented_2] const double vec[3] = {0.,0.,-1.}; - std::vector badCellIds; + std::vector badCellIds; mesh->are2DCellsNotCorrectlyOriented( vec, false, badCellIds ); CPPUNIT_ASSERT( badCellIds.size() == 1 ); // one cell is reversed // fix orientation @@ -927,7 +928,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -945,10 +946,10 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoints() 0.3, 0.3, // point located somewhere inside the mesh coords[2], coords[3]}; // point at the node #1 const double eps = 1e-4; // ball radius - MCAuto cells, cellsIndex; + MCAuto cells, cellsIndex; mesh->getCellsContainingPoints( pos, 3, eps, cells, cellsIndex ); - const int cellsExpected[3]={4, 0, 1}; - const int cellsIndexExpected[4]={0, 0, 1, 3}; + const mcIdType cellsExpected[3]={4, 0, 1}; + const mcIdType cellsIndexExpected[4]={0, 0, 1, 3}; CPPUNIT_ASSERT(std::equal( cellsExpected, cellsExpected+3, cells->begin())); CPPUNIT_ASSERT(std::equal( cellsIndexExpected, cellsIndexExpected+4, cellsIndex->begin())); //! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoints_2] @@ -961,7 +962,7 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoint() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -978,9 +979,9 @@ void CppExample_MEDCouplingUMesh_getCellsContainingPoint() const double* coords4 = coords + 4*2; // coordinates of the node #4 const double eps = 1e-4; // ball radius const double pos[2] = { coords4[0] + eps, coords4[1] - eps }; // ball center - std::vector cellIds; + std::vector cellIds; mesh->getCellsContainingPoint( pos, eps, cellIds ); - CPPUNIT_ASSERT ( (int)cellIds.size() == mesh->getNumberOfCells() ); + CPPUNIT_ASSERT ( ToIdType(cellIds.size()) == mesh->getNumberOfCells() ); //! [CppSnippet_MEDCouplingUMesh_getCellsContainingPoint_2] } @@ -991,7 +992,7 @@ void CppExample_MEDCouplingUMesh_buildPartOrthogonalField() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1005,7 +1006,7 @@ void CppExample_MEDCouplingUMesh_buildPartOrthogonalField() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_1] //! [CppSnippet_MEDCouplingUMesh_buildPartOrthogonalField_2] - const int part[4] = {1,2,3,4}; // cell #0 is omitted + const mcIdType part[4] = {1,2,3,4}; // cell #0 is omitted MCAuto vecField= mesh->buildPartOrthogonalField( part, part+4 ); CPPUNIT_ASSERT ( vecField->getArray()->getNumberOfTuples() == 4 ); @@ -1020,7 +1021,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,2,4, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1035,7 +1036,7 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_1] //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2] const bool isAbs = true; - const int part[4] = {1,2,3,4}; // cell #0 is omitted + const mcIdType part[4] = {1,2,3,4}; // cell #0 is omitted MCAuto areaArr= mesh->getPartMeasureField( isAbs, part, part+4 ); CPPUNIT_ASSERT( areaArr->getIJ(0,0) > 0 ); // orientation ignored @@ -1044,11 +1045,11 @@ void CppExample_MEDCouplingUMesh_getPartMeasureField() CPPUNIT_ASSERT ( areaArr->getNumberOfTuples() == 4 ); //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_2] //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3] - const int cellIds[4] = {1,2,3,4}; // cell #0 is omitted + const mcIdType cellIds[4] = {1,2,3,4}; // cell #0 is omitted MCAuto baryCenters= mesh->getPartBarycenterAndOwner( cellIds, cellIds+4 ); CPPUNIT_ASSERT( baryCenters->getNumberOfTuples() == 4 ); - CPPUNIT_ASSERT( baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() ); + CPPUNIT_ASSERT( (int)baryCenters->getNumberOfComponents() == mesh->getSpaceDimension() ); //! [CppSnippet_MEDCouplingUMesh_getPartMeasureField_3] } @@ -1064,13 +1065,13 @@ void CppExample_MEDCouplingUMesh_getCellsInBoundingBox() coordsArr->useExternalArrayWithRWAccess(coords, 3,2); mesh->setCoords(coordsArr); mesh->allocateCells(1); - const int conn[3]={0,1,2}; + const mcIdType conn[3]={0,1,2}; mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn); mesh->finishInsertingCells(); //! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_1] //! [CppSnippet_MEDCouplingUMesh_getCellsInBoundingBox_2] const double bbox[] = {1., 1., 1.001,1.001}; // xMin, xMax, yMin, yMax - MCAuto cellIdsArr = + MCAuto cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.0 ); CPPUNIT_ASSERT( cellIdsArr->getNumberOfTuples() == 0 ); cellIdsArr = mesh->getCellsInBoundingBox( bbox, 0.1 ); @@ -1085,15 +1086,15 @@ void CppExample_MEDCouplingUMesh_renumberNodesInConn() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(1); - const int conn[4]={4,3,2,1}; + const mcIdType conn[4]={4,3,2,1}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->finishInsertingCells(); //! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_1] //! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_2] - const int old2newIds[] = {-1,3,2,1,0}; + const mcIdType old2newIds[] = {-1,3,2,1,0}; mesh->renumberNodesInConn( old2newIds ); - const int nodes0Expected[] = {0,1,2,3}; - std::vector nodes0; + const mcIdType nodes0Expected[] = {0,1,2,3}; + std::vector nodes0; mesh->getNodeIdsOfCell( 0, nodes0 ); CPPUNIT_ASSERT(std::equal( nodes0Expected, nodes0Expected+4, &nodes0[0] )); //! [CppSnippet_MEDCouplingUMesh_renumberNodesInConn_2] @@ -1113,7 +1114,7 @@ void CppExample_MEDCouplingUMesh_renumberNodes() mesh->finishInsertingCells(); //! [CppSnippet_MEDCouplingUMesh_renumberNodes_1] //! [CppSnippet_MEDCouplingUMesh_renumberNodes_2] - const int newIds[] = { 2,1,0,-1 }; + const mcIdType newIds[] = { 2,1,0,-1 }; mesh->renumberNodes(newIds, 3); coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array const double coordsExpected[3*2]={0.7,-0.3, 0.2,-0.3, -0.3,-0.3}; @@ -1123,7 +1124,7 @@ void CppExample_MEDCouplingUMesh_renumberNodes() //! [CppSnippet_MEDCouplingUMesh_renumberNodes_2] //! [CppSnippet_MEDCouplingUMesh_renumberNodes_3] coordsArr->useExternalArrayWithRWAccess(coords, 4,2); // restore old nodes - const int newIds2[] = { 2,1,0,2 }; + const mcIdType newIds2[] = { 2,1,0,2 }; mesh->renumberNodesCenter(newIds2, 3); coordsArr = mesh->getCoordinatesAndOwner(); // get a shorten array const double coordsExpected2[3*2]={0.7,-0.3, 0.2,-0.3, -0.3, 0.0}; @@ -1140,7 +1141,7 @@ void CppExample_MEDCouplingUMesh_findBoundaryNodes() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1154,7 +1155,7 @@ void CppExample_MEDCouplingUMesh_findBoundaryNodes() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_1] //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2] - MCAuto nodeIdsArr=mesh->findBoundaryNodes(); + MCAuto nodeIdsArr=mesh->findBoundaryNodes(); CPPUNIT_ASSERT( nodeIdsArr->getNumberOfTuples() == mesh->getNumberOfNodes() - 1 ); //! [CppSnippet_MEDCouplingUMesh_findBoundaryNodes_2] } @@ -1166,7 +1167,7 @@ void CppExample_MEDCouplingUMesh_buildBoundaryMesh() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1194,7 +1195,7 @@ void CppExample_MEDCouplingUMesh_buildFacePartOfMySelfNode() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1208,7 +1209,7 @@ void CppExample_MEDCouplingUMesh_buildFacePartOfMySelfNode() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_1] //! [CppSnippet_MEDCouplingUMesh_buildFacePartOfMySelfNode_2] - std::vector nodes; + std::vector nodes; mesh->getNodeIdsOfCell( 0, nodes ); const bool allNodes = true; MCAuto mesh1 = @@ -1227,7 +1228,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelfNode() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1241,14 +1242,14 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelfNode() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_1] //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_2] - std::vector nodes; + std::vector nodes; mesh->getNodeIdsOfCell( 0, nodes ); const bool allNodes = true; MCAuto mesh1 = (MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(), allNodes); MCAuto mesh2 = (MEDCouplingUMesh*)mesh->buildPartOfMySelfNode( &nodes[0], &nodes[0]+nodes.size(),!allNodes); - CPPUNIT_ASSERT_EQUAL( (int)mesh1->getNumberOfCells(), 1 ); + CPPUNIT_ASSERT_EQUAL( mesh1->getNumberOfCells(), ToIdType( 1 )); CPPUNIT_ASSERT_EQUAL( mesh2->getNumberOfCells(), mesh->getNumberOfCells() ); //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelfNode_2] } @@ -1260,7 +1261,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsLyingOnNodes() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1274,13 +1275,13 @@ void CppExample_MEDCouplingUMesh_getCellIdsLyingOnNodes() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_1] //! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_2] - std::vector nodes; + std::vector nodes; mesh->getNodeIdsOfCell( 0, nodes ); const bool allNodes = true; - DataArrayInt* cellIdsArr1 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(), allNodes); - DataArrayInt* cellIdsArr2 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(),!allNodes); - CPPUNIT_ASSERT_EQUAL( (int)cellIdsArr1->getNumberOfTuples(), 1 ); - CPPUNIT_ASSERT_EQUAL( (int)cellIdsArr2->getNumberOfTuples(), (int)mesh->getNumberOfCells() ); + DataArrayIdType* cellIdsArr1 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(), allNodes); + DataArrayIdType* cellIdsArr2 = mesh->getCellIdsLyingOnNodes( &nodes[0], &nodes[0]+nodes.size(),!allNodes); + CPPUNIT_ASSERT_EQUAL( cellIdsArr1->getNumberOfTuples(), ToIdType( 1 )); + CPPUNIT_ASSERT_EQUAL( cellIdsArr2->getNumberOfTuples(), mesh->getNumberOfCells() ); //! [CppSnippet_MEDCouplingUMesh_getCellIdsLyingOnNodes_2] cellIdsArr1->decrRef(); cellIdsArr2->decrRef(); @@ -1293,7 +1294,7 @@ void CppExample_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1307,11 +1308,11 @@ void CppExample_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_1] //! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_2] - const int cellIds[2]={1,2}; - std::vector nodes; + const mcIdType cellIds[2]={1,2}; + std::vector nodes; mesh->getNodeIdsOfCell( cellIds[0], nodes ); mesh->getNodeIdsOfCell( cellIds[1], nodes ); - DataArrayInt* cellIdsArr = mesh->getCellIdsFullyIncludedInNodeIds( &nodes[0], &nodes[0]+nodes.size()); + DataArrayIdType* cellIdsArr = mesh->getCellIdsFullyIncludedInNodeIds( &nodes[0], &nodes[0]+nodes.size()); CPPUNIT_ASSERT(std::equal( cellIds, cellIds+2, cellIdsArr->getPointer() )); //! [CppSnippet_MEDCouplingUMesh_getCellIdsFullyIncludedInNodeIds_2] cellIdsArr->decrRef(); @@ -1324,7 +1325,7 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelf() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1338,14 +1339,14 @@ void CppExample_MEDCouplingUMesh_buildPartOfMySelf() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_1] //! [CppSnippet_MEDCouplingUMesh_buildPartOfMySelf_2] - const int cellIds[2]={1,2}; + const mcIdType cellIds[2]={1,2}; 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 ( int i = 0; i < 2; ++i ) + for ( mcIdType i = 0; i < 2; ++i ) { - std::vector nodes1, nodes2; + std::vector nodes1, nodes2; mesh ->getNodeIdsOfCell(cellIds[i], nodes1); mesh2->getNodeIdsOfCell(i, nodes2); CPPUNIT_ASSERT( nodes1 == nodes2 ); // cell #cellIds[i] was copied @@ -1362,7 +1363,7 @@ void CppExample_MEDCouplingUMesh_mergeNodes() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1379,13 +1380,13 @@ void CppExample_MEDCouplingUMesh_mergeNodes() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_mergeNodes_1] //! [CppSnippet_MEDCouplingUMesh_mergeNodes_2] - bool areNodesMerged; int newNbOfNodes; - MCAuto arr= + bool areNodesMerged; mcIdType newNbOfNodes; + MCAuto arr= mesh->mergeNodes(0.004,areNodesMerged,newNbOfNodes); - const int idsExpected[6] = {0, 1, 0, 2, 2, 0}; + const mcIdType idsExpected[6] = {0, 1, 0, 2, 2, 0}; CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+6,arr->getPointer())); CPPUNIT_ASSERT( areNodesMerged ); - CPPUNIT_ASSERT_EQUAL( 3, newNbOfNodes ); + CPPUNIT_ASSERT_EQUAL( ToIdType( 3 ), newNbOfNodes ); //! [CppSnippet_MEDCouplingUMesh_mergeNodes_2] //! [CppSnippet_MEDCouplingUMesh_mergeNodes_3] const double* baryCoords2 = coords + 2*2; // initial coordinates of node #2 @@ -1409,7 +1410,7 @@ void CppExample_MEDCouplingUMesh_zipConnectivityTraducer() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[11]={0,3,4,1, 1,4,2, 4,1,0,3}; + const mcIdType conn[11]={0,3,4,1, 1,4,2, 4,1,0,3}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+0); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 2 == 1 @@ -1423,10 +1424,10 @@ void CppExample_MEDCouplingUMesh_zipConnectivityTraducer() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_1] //! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_2] - const int oldNbCells = mesh->getNumberOfCells(); - DataArrayInt *arr = mesh->zipConnectivityTraducer(0); - CPPUNIT_ASSERT_EQUAL( oldNbCells-2, (int)mesh->getNumberOfCells() ); - const int idsExpected[5] = {0, 1, 1, 0, 2}; + const mcIdType oldNbCells = mesh->getNumberOfCells(); + DataArrayIdType *arr = mesh->zipConnectivityTraducer(0); + CPPUNIT_ASSERT_EQUAL( oldNbCells-2, mesh->getNumberOfCells() ); + const mcIdType idsExpected[5] = {0, 1, 1, 0, 2}; CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+5,arr->getPointer())); //! [CppSnippet_MEDCouplingUMesh_zipConnectivityTraducer_2] arr->decrRef(); @@ -1439,7 +1440,7 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1453,12 +1454,12 @@ void CppExample_MEDCouplingUMesh_zipCoordsTraducer() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_1] //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2] - const int cellIds[2]={1,2}; + const mcIdType cellIds[2]={1,2}; MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); - DataArrayInt *arr=mesh2->zipCoordsTraducer(); - CPPUNIT_ASSERT_EQUAL( 4, mesh2->getNumberOfNodes() ); // nb of nodes decreased - CPPUNIT_ASSERT_EQUAL( (int)mesh->getNumberOfNodes(), (int)arr->getNumberOfTuples() ); - const int idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; // -1 for unused nodes + DataArrayIdType *arr=mesh2->zipCoordsTraducer(); + CPPUNIT_ASSERT_EQUAL( ToIdType(4), mesh2->getNumberOfNodes() ); // nb of nodes decreased + CPPUNIT_ASSERT_EQUAL( mesh->getNumberOfNodes(), arr->getNumberOfTuples() ); + const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; // -1 for unused nodes CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+9,arr->getPointer())); //! [CppSnippet_MEDCouplingUMesh_zipCoordsTraducer_2] mesh2->decrRef(); @@ -1472,7 +1473,7 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); @@ -1486,16 +1487,16 @@ void CppExample_MEDCouplingUMesh_getNodeIdsInUse() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_1] //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2] - const int cellIds[2]={1,2}; + const mcIdType cellIds[2]={1,2}; MEDCouplingUMesh* mesh2=(MEDCouplingUMesh*)mesh->buildPartOfMySelf(cellIds,cellIds+2,true); - int newNbOfNodes = 0; - DataArrayInt *arr=mesh2->getNodeIdsInUse( newNbOfNodes ); - const int idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; + mcIdType newNbOfNodes = 0; + DataArrayIdType *arr=mesh2->getNodeIdsInUse( newNbOfNodes ); + const mcIdType idsExpected[9] = {-1,0,1,-1,2,3,-1,-1,-1}; CPPUNIT_ASSERT(std::equal(idsExpected,idsExpected+9,arr->getPointer())); //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_2] //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_3] - DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); - const int idsExpected2[4] = {1,2,4,5}; + DataArrayIdType *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); + const mcIdType idsExpected2[4] = {1,2,4,5}; CPPUNIT_ASSERT(std::equal(idsExpected2,idsExpected2+4,arr2->getPointer())); //! [CppSnippet_MEDCouplingUMesh_getNodeIdsInUse_3] mesh2->decrRef(); @@ -1510,7 +1511,7 @@ void CppExample_MEDCouplingUMesh_convertToPolyTypes() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1524,7 +1525,7 @@ void CppExample_MEDCouplingUMesh_convertToPolyTypes() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_1] //! [CppSnippet_MEDCouplingUMesh_convertToPolyTypes_2] - const int cells[2]={1,3}; + const mcIdType cells[2]={1,3}; mesh->convertToPolyTypes(cells, cells+2); CPPUNIT_ASSERT( mesh->getTypeOfCell(0) == INTERP_KERNEL::NORM_QUAD4 ); CPPUNIT_ASSERT( mesh->getTypeOfCell(1) == INTERP_KERNEL::NORM_POLYGON ); @@ -1540,7 +1541,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity2() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1554,23 +1555,23 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity2() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_1] //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_2] - DataArrayInt *desc =DataArrayInt::New(); - DataArrayInt *descIndx =DataArrayInt::New(); - DataArrayInt *revDesc =DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc =DataArrayIdType::New(); + DataArrayIdType *descIndx =DataArrayIdType::New(); + DataArrayIdType *revDesc =DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); MEDCouplingUMesh * mesh2 = mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); - const int descExpected[] = {1,2,3,4,-3,5,6,7,8,-5,9,10,-2,11,12,13,-7,-10}; - const int descIndxExpected[] = {0,4,7,10,14,18}; - const int revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; - const int revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18}; + const mcIdType descExpected[] = {1,2,3,4,-3,5,6,7,8,-5,9,10,-2,11,12,13,-7,-10}; + const mcIdType descIndxExpected[] = {0,4,7,10,14,18}; + const mcIdType revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; + const mcIdType revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18}; CPPUNIT_ASSERT(std::equal(descExpected,descExpected+18,desc->getPointer())); CPPUNIT_ASSERT(std::equal(descIndxExpected,descIndxExpected+6,descIndx->getPointer())); CPPUNIT_ASSERT(std::equal(revDescExpected,revDescExpected+18,revDesc->getPointer())); CPPUNIT_ASSERT(std::equal(revDescIndxExpected,revDescIndxExpected+14,revDescIndx->getPointer())); //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_2] //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_3] - const int cell2ConnExpect[] = {4,1}; - std::vector cell2Conn; + const mcIdType cell2ConnExpect[] = {4,1}; + std::vector cell2Conn; mesh2->getNodeIdsOfCell( 3-1, cell2Conn ); // cell #3 in FORTRAN mode CPPUNIT_ASSERT(std::equal(cell2ConnExpect,cell2ConnExpect+2,&cell2Conn[0])); //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity2_3] @@ -1588,7 +1589,7 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1602,15 +1603,15 @@ void CppExample_MEDCouplingUMesh_buildDescendingConnectivity() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_1] //! [CppSnippet_MEDCouplingUMesh_buildDescendingConnectivity_2] - DataArrayInt *desc =DataArrayInt::New(); - DataArrayInt *descIndx =DataArrayInt::New(); - DataArrayInt *revDesc =DataArrayInt::New(); - DataArrayInt *revDescIndx=DataArrayInt::New(); + DataArrayIdType *desc =DataArrayIdType::New(); + DataArrayIdType *descIndx =DataArrayIdType::New(); + DataArrayIdType *revDesc =DataArrayIdType::New(); + DataArrayIdType *revDescIndx=DataArrayIdType::New(); MEDCouplingUMesh * mesh2 = mesh->buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); - const int descExpected[] = {0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9}; - const int descIndxExpected[] = {0,4,7,10,14,18}; - const int revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; - const int revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18}; + const mcIdType descExpected[] = {0,1,2,3, 2,4,5, 6,7,4, 8,9,1,10, 11,12,6,9}; + const mcIdType descIndxExpected[] = {0,4,7,10,14,18}; + const mcIdType revDescExpected[] = {0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; + const mcIdType revDescIndxExpected[] = {0,1,3,5,6,8,9,11,12,13,15,16,17,18}; CPPUNIT_ASSERT(std::equal(descExpected,descExpected+18,desc->getPointer())); CPPUNIT_ASSERT(std::equal(descIndxExpected,descIndxExpected+6,descIndx->getPointer())); CPPUNIT_ASSERT(std::equal(revDescExpected,revDescExpected+18,revDesc->getPointer())); @@ -1630,7 +1631,7 @@ void CppExample_MEDCouplingUMesh_getReverseNodalConnectivity() MCAuto mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); mesh->allocateCells(5); - const int conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + const mcIdType conn[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); // 0 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+4); // 1 mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+7); // 2 @@ -1644,11 +1645,11 @@ void CppExample_MEDCouplingUMesh_getReverseNodalConnectivity() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_1] //! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_2] - DataArrayInt *revNodal=DataArrayInt::New(); - DataArrayInt *revNodalIndx=DataArrayInt::New(); + DataArrayIdType *revNodal=DataArrayIdType::New(); + DataArrayIdType *revNodalIndx=DataArrayIdType::New(); mesh->getReverseNodalConnectivity(revNodal,revNodalIndx); - const int revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4}; - const int revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18}; + const mcIdType revNodalExpected[18]={0,0,1,1,2,0,3,0,1,2,3,4,2,4,3,3,4,4}; + const mcIdType revNodalIndexExpected[10]={0,1,3,5,7,12,14,15,17,18}; CPPUNIT_ASSERT(std::equal(revNodalExpected,revNodalExpected+18,revNodal->getPointer())); CPPUNIT_ASSERT(std::equal(revNodalIndexExpected,revNodalIndexExpected+10,revNodalIndx->getPointer())); //! [CppSnippet_MEDCouplingUMesh_getReverseNodalConnectivity_2] @@ -1672,7 +1673,7 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() coordsArr->useExternalArrayWithRWAccess( coords, 4, 2 ); mesh1->setCoords(coordsArr); mesh1->allocateCells(2); - const int conn[6]={0,1,2, 1,2,3}; + const mcIdType conn[6]={0,1,2, 1,2,3}; mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+0); // #0 mesh1->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+3); // #1 mesh1->finishInsertingCells(); @@ -1689,7 +1690,7 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() coordsArr->useExternalArrayWithRWAccess( coords2, 4, 2 ); mesh2->setCoords(coordsArr); mesh2->allocateCells(2); - const int conn[6]={2,3,0, 3,1,2}; + const mcIdType conn[6]={2,3,0, 3,1,2}; mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+0); // #0 = #1 mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3, conn+3); // #1 ~ #0 mesh2->finishInsertingCells(); @@ -1697,10 +1698,10 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() //! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_1] //! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_2] int cellCompPol = 1; // "permuted same orientation" - policy of medium severity - DataArrayInt *nOld2New, *cOld2New; + DataArrayIdType *nOld2New, *cOld2New; mesh1->checkDeepEquivalWith( mesh2, cellCompPol, 0.002, cOld2New, nOld2New ); - const int nOld2NewExpected[4] = { 3, 0, 1, 2 }; - const int cOld2NewExpected[2] = { 1, 0 }; + const mcIdType nOld2NewExpected[4] = { 3, 0, 1, 2 }; + const mcIdType cOld2NewExpected[2] = { 1, 0 }; CPPUNIT_ASSERT(std::equal(nOld2NewExpected,nOld2NewExpected+4,nOld2New->getConstPointer())); CPPUNIT_ASSERT(std::equal(cOld2NewExpected,cOld2NewExpected+2,cOld2New->getConstPointer())); //! [CppSnippet_MEDCouplingUMesh_checkDeepEquivalWith_2] @@ -1709,7 +1710,7 @@ void CppExample_MEDCouplingUMesh_checkDeepEquivalWith() CPPUNIT_ASSERT_THROW ( mesh1->checkDeepEquivalOnSameNodesWith( mesh2, cellCompPol, 0.002, cOld2New ), INTERP_KERNEL::Exception ); mesh2->setCoords( mesh1->getCoords() ); // make meshes share the same coordinates array mesh2->allocateCells(2); - const int conn[6]={1,2,3, 1,0,2}; + const mcIdType conn[6]={1,2,3, 1,0,2}; mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+0); // #0 = #1 mesh2->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3); // #1 ~ #0 mesh2->finishInsertingCells(); @@ -1816,8 +1817,8 @@ void CppExample_MEDCouplingPointSet_getBoundingBox() mesh->getBoundingBox( (double*) bbox ); // check the returned coordinates of extremum points of the bounding box - for ( int i = 0; i < 2; ++i ) // point id - for ( int j = 0; j < 3; ++j ) // component + for ( mcIdType i = 0; i < 2; ++i ) // point id + for ( mcIdType j = 0; j < 3; ++j ) // component CPPUNIT_ASSERT_DOUBLES_EQUAL( cc[ i*3 + j ], bbox[j][i], 1e-13); //! [CppSnippet_MEDCouplingPointSet_getBoundingBox_2] } @@ -1839,12 +1840,12 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoint() //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_1] //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoint_2] double point [2]={0.3, -0.3}; // point close to nodes #0, #2 and #4 - DataArrayInt *ids = mesh->getNodeIdsNearPoint(point, 1e-2); + DataArrayIdType *ids = mesh->getNodeIdsNearPoint(point, 1e-2); // check found ids - const int expectedIDs[3] = {0,2,4}; - DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+3 ); - CPPUNIT_ASSERT_EQUAL(3, (int)okIDs->getNumberOfTuples()); + const mcIdType expectedIDs[3] = {0,2,4}; + DataArrayIdType * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+3 ); + CPPUNIT_ASSERT_EQUAL(ToIdType(3), okIDs->getNumberOfTuples()); // release data ids->decrRef(); @@ -1869,17 +1870,17 @@ void CppExample_MEDCouplingPointSet_getNodeIdsNearPoints() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_1] //! [CppSnippet_MEDCouplingPointSet_getNodeIdsNearPoints_2] - const int nbOfPoints = 3; + const mcIdType nbOfPoints = 3; double points [nbOfPoints*2]={0.2,-0.30001, // ~ node #1 0.0, 0.0, 1.1, 0.002}; // ~ nodes #3, #4 and #5 - DataArrayInt *ids, *idsIndex; + DataArrayIdType *ids, *idsIndex; mesh->getNodeIdsNearPoints(points, nbOfPoints, 1e-1,ids,idsIndex); // check found ids (i.e. contents of 'ids' array) - const int expectedIDs[4] = {1, 3, 4, 5}; - DataArrayInt * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+4 ); - CPPUNIT_ASSERT_EQUAL(4, (int)okIDs->getNumberOfTuples()); + const mcIdType expectedIDs[4] = {1, 3, 4, 5}; + DataArrayIdType * okIDs = ids->findIdsEqualList ( expectedIDs, expectedIDs+4 ); + CPPUNIT_ASSERT_EQUAL(ToIdType(4), okIDs->getNumberOfTuples()); // release data ids->decrRef(); @@ -1904,12 +1905,12 @@ void CppExample_MEDCouplingPointSet_findCommonNodes() mesh->setCoords(coordsArr); //! [CppSnippet_MEDCouplingPointSet_findCommonNodes_1] //! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2] - DataArrayInt *com, *comI; + DataArrayIdType *com, *comI; mesh->findCommonNodes(1e-13,-1,com,comI); - CPPUNIT_ASSERT_EQUAL(2, (int)com->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2),com->getNumberOfTuples()); com->decrRef(); comI->decrRef(); mesh->findCommonNodes(0.004,-1,com,comI); - CPPUNIT_ASSERT_EQUAL(5, (int)com->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(ToIdType(5), com->getNumberOfTuples()); //! [CppSnippet_MEDCouplingPointSet_findCommonNodes_2] com->decrRef(); comI->decrRef(); } @@ -1937,17 +1938,17 @@ void CppExample_DataArrayInt_buildPermutationArr() using namespace MEDCoupling; //! [CppSnippet_DataArrayInt_buildPermutationArr_1] DataArrayInt *a=DataArrayInt::New(); - const int vala[5]={4,5,6,7,8}; + const mcIdType vala[5]={4,5,6,7,8}; a->alloc(5,1); std::copy(vala,vala+5,a->getPointer()); DataArrayInt *b=DataArrayInt::New(); - const int valb[5]={5,4,8,6,7}; + const mcIdType valb[5]={5,4,8,6,7}; b->alloc(5,1); std::copy(valb,valb+5,b->getPointer()); - DataArrayInt *c=a->buildPermutationArr(*b); + DataArrayIdType *c=a->buildPermutationArr(*b); //! [CppSnippet_DataArrayInt_buildPermutationArr_1] - const int expect1[5]={1,0,4,2,3}; - CPPUNIT_ASSERT_EQUAL(5,(int)c->getNumberOfTuples()); + const mcIdType expect1[5]={1,0,4,2,3}; + CPPUNIT_ASSERT_EQUAL(ToIdType(5),c->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(1,(int)c->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(expect1,expect1+5,c->getConstPointer())); CPPUNIT_ASSERT(a->isEqualWithoutConsideringStrAndOrder(*b)); @@ -1960,13 +1961,13 @@ void CppExample_DataArrayInt_invertArrayO2N2N2O() { using namespace MEDCoupling; //! [CppSnippet_DataArrayInt_invertArrayO2N2N2O_1] - const int arr1[6]={2,0,4,1,5,3}; + const mcIdType arr1[6]={2,0,4,1,5,3}; DataArrayInt *da=DataArrayInt::New(); da->alloc(6,1); std::copy(arr1,arr1+6,da->getPointer()); - DataArrayInt *da2=da->invertArrayO2N2N2O(6); - const int expected1[6]={1,3,0,5,2,4}; - for(int i=0;i<6;i++) + DataArrayIdType *da2=da->invertArrayO2N2N2O(6); + const mcIdType expected1[6]={1,3,0,5,2,4}; + for(mcIdType i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0)); //! [CppSnippet_DataArrayInt_invertArrayO2N2N2O_1] da->decrRef(); @@ -1977,13 +1978,13 @@ void CppExample_DataArrayInt_invertArrayN2O2O2N() { using namespace MEDCoupling; //! [CppSnippet_DataArrayInt_invertArrayN2O2O2N_1] - const int arr1[6]={2,0,4,1,5,3}; + const mcIdType arr1[6]={2,0,4,1,5,3}; DataArrayInt *da=DataArrayInt::New(); da->alloc(6,1); std::copy(arr1,arr1+6,da->getPointer()); - DataArrayInt *da2=da->invertArrayN2O2O2N(6); - const int expected1[6]={1,3,0,5,2,4}; - for(int i=0;i<6;i++) + DataArrayIdType *da2=da->invertArrayN2O2O2N(6); + const mcIdType expected1[6]={1,3,0,5,2,4}; + for(mcIdType i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(expected1[i],da2->getIJ(i,0)); //! [CppSnippet_DataArrayInt_invertArrayN2O2O2N_1] da->decrRef(); @@ -1998,7 +1999,7 @@ void CppExample_DataArrayDouble_getIdsInRange() da->alloc(10,1); da->iota(); - DataArrayInt* da2 = da->findIdsInRange( 2.5, 6 ); + DataArrayIdType* da2 = da->findIdsInRange( 2.5, 6 ); //! [CppSnippet_DataArrayDouble_getIdsInRange_1] da->decrRef(); da2->decrRef(); @@ -2020,11 +2021,11 @@ void CppExample_DataArrayDouble_findCommonTuples() std::copy(array2,array2+12,da->getPointer()); //! [CppSnippet_DataArrayDouble_findCommonTuples1] //! [CppSnippet_DataArrayDouble_findCommonTuples2] - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; da->findCommonTuples(1.01e-1,-1,c,cI); - const int expected3[5]={0,3,4,1,2}; - const int expected4[3]={0,3,5}; + const mcIdType expected3[5]={0,3,4,1,2}; + const mcIdType expected4[3]={0,3,5}; CPPUNIT_ASSERT(std::equal(expected3,expected3+5,c->getConstPointer())); CPPUNIT_ASSERT(std::equal(expected4,expected4+3,cI->getConstPointer())); c->decrRef(); @@ -2037,7 +2038,7 @@ void CppExample_DataArrayDouble_Meld1() { using namespace MEDCoupling; //! [CppSnippet_DataArrayDouble_Meld1_1] - const int sameNbTuples = 7; + const mcIdType sameNbTuples = 7; DataArrayDouble *da1=DataArrayDouble::New(); da1->alloc(sameNbTuples,2); @@ -2062,7 +2063,7 @@ void CppExample_DataArrayInt_Meld1() { using namespace MEDCoupling; //! [CppSnippet_DataArrayInt_Meld1_1] - const int sameNbTuples = 7; + const mcIdType sameNbTuples = 7; DataArrayInt *da1=DataArrayInt::New(); da1->alloc(sameNbTuples,2); @@ -2098,18 +2099,18 @@ void CppExampleFieldDoubleBuildSubPart1() array->decrRef(); //! [CppSnippetFieldDoubleBuildSubPart1_1] //! [CppSnippetFieldDoubleBuildSubPart1_2] - const int part1[3]={2,1,4}; + const mcIdType part1[3]={2,1,4}; MEDCoupling::MEDCouplingFieldDouble *f2=f1->buildSubPart(part1,part1+3); //! [CppSnippetFieldDoubleBuildSubPart1_2] f2->zipCoords(); - CPPUNIT_ASSERT_EQUAL(3,(int)f2->getMesh()->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(6,f2->getMesh()->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(3),f2->getMesh()->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(6),f2->getMesh()->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,f2->getMesh()->getMeshDimension()); MEDCoupling::MEDCouplingUMesh *m2C=dynamic_cast(const_cast(f2->getMesh())); - CPPUNIT_ASSERT_EQUAL(13,m2C->getNodalConnectivityArrayLen()); + 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++) + for(mcIdType i=0;i<12;i++) CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],m2C->getCoords()->getIJ(0,i),1.e-12); const double expected3[13]={3,2,3,1,3,0,2,1,4,4,5,3,2}; CPPUNIT_ASSERT(std::equal(expected3,expected3+13,m2C->getNodalConnectivity()->getConstPointer())); @@ -2129,20 +2130,20 @@ void CppExampleFieldDoubleBuildSubPart1() array->decrRef(); //! [CppSnippetFieldDoubleBuildSubPart1_3] //! [CppSnippetFieldDoubleBuildSubPart1_4] - const int part2[2]={1,2}; + const mcIdType part2[2]={1,2}; f2=f1->buildSubPart(part2,part2+2); //! [CppSnippetFieldDoubleBuildSubPart1_4] f2->decrRef(); //idem previous because nodes of cell#4 are not fully present in part3 - const int part3[2]={1,2}; - MEDCoupling::DataArrayInt *arrr=MEDCoupling::DataArrayInt::New(); + const mcIdType part3[2]={1,2}; + MEDCoupling::DataArrayIdType *arrr=MEDCoupling::DataArrayIdType::New(); arrr->alloc(2,1); std::copy(part3,part3+2,arrr->getPointer()); f2=f1->buildSubPart(arrr); arrr->decrRef(); f2->decrRef(); // - const int part4[3]={1,2,4}; + const mcIdType part4[3]={1,2,4}; f2=f1->buildSubPart(part4,part4+3); f2->decrRef(); // @@ -2156,7 +2157,7 @@ void CppSnippetUMeshStdBuild1() //! [CppSnippetUMeshStdBuild1_1] double coords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. }; - int nodalConnPerCell[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType nodalConnPerCell[18]={0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4}; //! [CppSnippetUMeshStdBuild1_1] //! [CppSnippetUMeshStdBuild1_2] MEDCoupling::MEDCouplingUMesh *mesh=MEDCoupling::MEDCouplingUMesh::New("My2DMesh",2); @@ -2204,8 +2205,8 @@ void CppSnippetCMeshStdBuild1() arrY->decrRef(); //! [CppSnippetCMeshStdBuild1_2] //! [CppSnippetCMeshStdBuild1_3] - CPPUNIT_ASSERT_EQUAL(8*6,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(9*7,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(8*6),mesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9*7),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); //! [CppSnippetCMeshStdBuild1_3] @@ -2219,8 +2220,8 @@ void CppSnippetCMeshStdBuild1() mesh->setCoordsAt(1,arrY); arrY->decrRef(); //! [CppSnippetCMeshStdBuild1_2bis] - CPPUNIT_ASSERT_EQUAL(8*6,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(9*7,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(8*6),mesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(9*7),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); //! [CppSnippetCMeshStdBuild1_4] @@ -2233,22 +2234,22 @@ void CppSnippetUMeshAdvBuild1() //! [CppSnippetUMeshAdvBuild1_1] double coords[27]={-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. }; - int nodalConnPerCell[23]={4,0,3,4,1, 3,1,4,2, 3,4,5,2, 4,6,7,4,3, 4,7,8,5,4}; - int nodalConnPerCellIndex[6]={0,5,9,13,18,23}; + mcIdType nodalConnPerCell[23]={4,0,3,4,1, 3,1,4,2, 3,4,5,2, 4,6,7,4,3, 4,7,8,5,4}; + mcIdType nodalConnPerCellIndex[6]={0,5,9,13,18,23}; //! [CppSnippetUMeshAdvBuild1_1] //! [CppSnippetUMeshAdvBuild1_2] MEDCoupling::MEDCouplingUMesh *mesh=MEDCoupling::MEDCouplingUMesh::New("My2DMesh",2); //! [CppSnippetUMeshAdvBuild1_2] //! [CppSnippetUMeshAdvBuild1_3] - MEDCoupling::DataArrayInt *nodalConn=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType *nodalConn=MEDCoupling::DataArrayIdType::New(); nodalConn->alloc(23,1); std::copy(nodalConnPerCell,nodalConnPerCell+23,nodalConn->getPointer()); - MEDCoupling::DataArrayInt *nodalConnI=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType *nodalConnI=MEDCoupling::DataArrayIdType::New(); nodalConnI->alloc(6,1); std::copy(nodalConnPerCellIndex,nodalConnPerCellIndex+6,nodalConnI->getPointer()); mesh->setConnectivity(nodalConn,nodalConnI,true); - nodalConn->decrRef();// nodalConn DataArrayInt instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef() - nodalConnI->decrRef();// nodalConnI DataArrayInt instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef() + nodalConn->decrRef();// nodalConn DataArrayIdType instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef() + nodalConnI->decrRef();// nodalConnI DataArrayIdType instance is owned by mesh after call to setConnectivity method. No more need here -> decrRef() //! [CppSnippetUMeshAdvBuild1_3] //! [CppSnippetUMeshAdvBuild1_4] MEDCoupling::DataArrayDouble *coordsArr=MEDCoupling::DataArrayDouble::New(); @@ -2266,7 +2267,7 @@ void CppSnippetUMeshAdvBuild1() void CppSnippetDataArrayBuild1() { //! [CppSnippetDataArrayBuild1_0] - const int nbOfNodes=12; + 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=0; diff --git a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx index 7b6a72e81..7c004b2bd 100644 --- a/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx +++ b/src/MEDCoupling/Test/MEDCouplingRemapperTest.cxx @@ -628,8 +628,8 @@ void MEDCouplingRemapperTest::testMultiDimCombi() sourceMesh->decrRef(); targetMesh->decrRef(); //------------- 1D -> 2D - const int conn[8]={0,1,1,2,2,3,3,0}; - const int conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1}; + const mcIdType conn[8]={0,1,1,2,2,3,3,0}; + const mcIdType conn2[12]={6,7,5,4,2,7,6,3,0,4,5,1}; const double coords1[]={0.17,0.93,0.56,0.93,0.56,0.25,0.17,0.52}; const double coords2[]={0.,0.,1.,0.,1.,1.,0.,1.,0.,0.5,1.,0.5,0.,0.8,1.,0.8}; sourceMesh=MEDCouplingUMesh::New("src1D",1); @@ -914,15 +914,15 @@ void MEDCouplingRemapperTest::testExtruded2() { MEDCouplingUMesh *meshN,*meshTT,*meshTF; MEDCouplingBasicsTest::build3DExtrudedUMesh_2(meshN,meshTT,meshTF); - std::vector n; + std::vector n; double pt[3]={300.,300.,0.}; double v[3]={0.,0.,2.}; meshN->findNodesOnPlane(pt,v,1e-12,n); MEDCouplingUMesh *meshN2D=(MEDCouplingUMesh *)meshN->buildFacePartOfMySelfNode(&n[0],&n[0]+n.size(),true); n.clear(); bool b=false; - int newNbOfNodes; - DataArrayInt *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *da=meshTT->mergeNodes(1e-12,b,newNbOfNodes); CPPUNIT_ASSERT(b); da->decrRef(); meshTT->findNodesOnPlane(pt,v,1e-12,n); @@ -1125,7 +1125,7 @@ MEDCouplingUMesh *MEDCouplingRemapperTest::build1DTargetMesh_2() 0.59,0.09, 0.69,0.19, 0.21,-0.29,0.31,-0.19, 0.45,0.25,0.65,0.45, -0.2,-0.2,0.11,0.11, 0.25,0.25, 0.45,0.45 }; - int targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9}; + mcIdType targetConn[10]={0,1, 2,3, 4,5, 6,7, 8,9}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New("my name of mesh 1D 2",1); targetMesh->allocateCells(5); @@ -1145,7 +1145,7 @@ MEDCouplingUMesh *MEDCouplingRemapperTest::build2DTargetMesh_3() double targetCoords[20]={-0.6,-0.4, -0.1,-0.4, 1.1,-0.4, 2.1,-0.4, -0.6,0.1, -0.1,0.1, 1.1,0.1, 2.1,0.1, -0.6,1.1, -0.1,1.1}; - int targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5}; + mcIdType targetConn[16]={0,4,5,1, 1,5,6,2, 2,6,7,3, 4,8,9,5}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(4); @@ -1172,7 +1172,7 @@ MEDCouplingUMesh *MEDCouplingRemapperTest::build3DExtrudedUMesh_1(MEDCouplingUMe 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3., 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.}; - int conn[354]={ + mcIdType conn[354]={ // 0 0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17, 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21, @@ -1189,7 +1189,7 @@ MEDCouplingUMesh *MEDCouplingRemapperTest::build3DExtrudedUMesh_1(MEDCouplingUMe 41,38,37,34,32,31,-1,41,56,46,31,-1,31,46,47,32,-1,32,47,49,34,-1,34,49,52,37,-1,37,38,53,52,-1,38,41,56,53,-1,56,46,47,49,52,53, 37,42,44,43,52,57,59,58 }; - int conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3}; + mcIdType conn2[28]={7,12,14,13, 11,8,7,4,2,1, 13,10,9,6, 1,6,5,3, 1,2,4,7,13,6, 0,11,1,3}; // MEDCouplingUMesh *ret=MEDCouplingUMesh::New(); ret->setMeshDimension(3); @@ -1250,7 +1250,7 @@ void MEDCouplingRemapperTest::testPartialTransfer1() array->alloc(sourceMesh->getNumberOfCells(),1); srcField->setArray(array); double *ptr=array->getPointer(); - for(int i=0;igetNumberOfCells();i++) + for(mcIdType i=0;igetNumberOfCells();i++) ptr[i]=(double)(i+7); array->decrRef(); MEDCouplingFieldDouble *trgField=MEDCouplingFieldDouble::New(ON_CELLS); @@ -1279,10 +1279,10 @@ void MEDCouplingRemapperTest::testBugNonRegression1() DataArrayDouble *coordsSrc(DataArrayDouble::New()); const double coordsSrcData[18]={-6.25,3.6084391824351605,264.85199999999998,-6.25,3.6084391824351605,289.05200000000002,-6.2499999999999991,-3.6084391824351618,264.85199999999998,-6.2499999999999991,-3.6084391824351618,289.05200000000002,-1.7763568394002505e-15,4.4408920985006262e-15,264.85199999999998,-1.7763568394002505e-15,4.4408920985006262e-15,289.05200000000002}; coordsSrc->useArray(coordsSrcData,false,DeallocType::CPP_DEALLOC,6,3); - DataArrayInt *connSrc(DataArrayInt::New()),*connISrc(DataArrayInt::New()); - const int connSrcData[7]={16,2,0,4,3,1,5}; + DataArrayIdType *connSrc(DataArrayIdType::New()),*connISrc(DataArrayIdType::New()); + const mcIdType connSrcData[7]={16,2,0,4,3,1,5}; connSrc->useArray(connSrcData,false,DeallocType::CPP_DEALLOC,7,1); - const int connISrcData[2]={0,7}; + const mcIdType connISrcData[2]={0,7}; connISrc->useArray(connISrcData,false,DeallocType::CPP_DEALLOC,2,1); MEDCouplingUMesh *srcMesh(MEDCouplingUMesh::New("source",3)); srcMesh->setCoords(coordsSrc); @@ -1292,11 +1292,11 @@ void MEDCouplingRemapperTest::testBugNonRegression1() DataArrayDouble *coordsTrg(DataArrayDouble::New()); const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57735026918962618,264.85199999999998,-2.5,0.2886751345948132,264.85199999999998,-2.5,1.443375672974065,264.85199999999998,-3.0000000000000004,1.1547005383792526,264.85199999999998,-3.0000000000000004,0.57735026918962662,264.85199999999998,-2,1.1547005383792521,289.05200000000002,-2,0.57735026918962618,289.05200000000002,-2.5,0.2886751345948132,289.05200000000002,-2.5,1.443375672974065,289.05200000000002,-3.0000000000000004,1.1547005383792526,289.05200000000002,-3.0000000000000004,0.57735026918962662,289.05200000000002}; coordsTrg->useArray(coordsTrgData,false,DeallocType::CPP_DEALLOC,12,3); - DataArrayInt *connTrg=DataArrayInt::New(); - const int connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1}; + DataArrayIdType *connTrg=DataArrayIdType::New(); + const mcIdType connTrgData[44]={31,0,1,2,5,4,3,-1,7,6,9,10,11,8,-1,3,9,6,0,-1,4,10,9,3,-1,5,11,10,4,-1,2,8,11,5,-1,1,7,8,2,-1,0,6,7,1}; connTrg->useArray(connTrgData,false,DeallocType::CPP_DEALLOC,44,1); - DataArrayInt *connITrg=DataArrayInt::New(); - const int connITrgData[2]={0,44}; + DataArrayIdType *connITrg=DataArrayIdType::New(); + const mcIdType connITrgData[2]={0,44}; connITrg->useArray(connITrgData,false,DeallocType::CPP_DEALLOC,2,1); MEDCouplingUMesh *trgMesh=MEDCouplingUMesh::New("target",3); trgMesh->setCoords(coordsTrg); @@ -1308,7 +1308,7 @@ const double coordsTrgData[36]={-2,1.1547005383792521,264.85199999999998,-2,0.57 remapper.setPrecision(1e-12); remapper.setIntersectionType(INTERP_KERNEL::Triangulation); CPPUNIT_ASSERT_EQUAL(1,remapper.prepare(srcMesh,trgMesh,"P0P0")); - std::vector > matrx(remapper.getCrudeMatrix()); + std::vector > matrx(remapper.getCrudeMatrix()); CPPUNIT_ASSERT_EQUAL(1,(int)matrx.size()); CPPUNIT_ASSERT_EQUAL(1,(int)matrx[0].size()); CPPUNIT_ASSERT_DOUBLES_EQUAL(valExpected,matrx[0][0],1e-13); diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 12254ca51..5050f27c2 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -23,6 +23,10 @@ INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_FLAGS "-py3") @@ -30,10 +34,14 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDCoupling.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDCoupling_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDCoupling_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDCoupling_SWIG_DPYS_FILES MEDCouplingCommon.i MEDCouplingMemArray.i + DataArrayInt.i MEDCouplingFieldDiscretization.i MEDCouplingFinalize.i MEDCouplingTypemaps.i) @@ -49,6 +57,7 @@ SET (MC_Swig_interf MEDCouplingRemapperCommon.i MEDCouplingRefCountObject.i MEDCouplingMemArray.i + DataArrayInt.i MEDCouplingFieldDiscretization.i MEDCouplingTimeDiscretization.i MEDCouplingFinalize.i @@ -118,6 +127,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) # _ABR_ Ensure dependency mechanism on all SWIG files and headers SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} diff --git a/src/MEDCoupling_Swig/DataArrayInt.i b/src/MEDCoupling_Swig/DataArrayInt.i new file mode 100644 index 000000000..6017f1559 --- /dev/null +++ b/src/MEDCoupling_Swig/DataArrayInt.i @@ -0,0 +1,2613 @@ +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// Author : Anthony Geay (EDF R&D) + +%include "MEDCouplingMemArray.i" + +%define ARRAYDEF( ARRAY, INT ) + +// namespace MEDCoupling +// { +// class ARRAY ## Iterator; + +// class ARRAY : public DataArray -- #ifdef doesn't work inside +// { + public: + static ARRAY *New(); + INT intValue() const; + INT getHashCode() const; + bool empty() const; + void aggregate(const ARRAY *other); + ARRAY *performCopyOrIncrRef(bool deepCopy) const; + void deepCopyFrom(const ARRAY& other); + void reserve(std::size_t nbOfElems); + void pushBackSilent(INT val); + INT popBackSilent(); + void pack() const; + void allocIfNecessary(INT nbOfTuple, INT nbOfCompo); + bool isEqual(const ARRAY& other) const; + bool isEqualWithoutConsideringStr(const ARRAY& other) const; + bool isEqualWithoutConsideringStrAndOrder(const ARRAY& other) const; + DataArrayIdType *buildPermutationArr(const ARRAY& other) const; + ARRAY *sumPerTuple() const; + void sort(bool asc=true); + void reverse(); + void checkMonotonic(bool increasing) const; + bool isMonotonic(bool increasing) const; + void checkStrictlyMonotonic(bool increasing) const; + bool isStrictlyMonotonic(bool increasing) const; + void fillWithZero(); + void fillWithValue(INT val); + void iota(INT init=0); + std::string repr() const; + std::string reprZip() const; + std::string reprNotTooLong() const; + ARRAY *invertArrayO2N2N2O(mcIdType newNbOfElem) const; + ARRAY *invertArrayN2O2O2N(mcIdType oldNbOfElem) const; + ARRAY *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const; + DataArrayIdType *indicesOfSubPart(const ARRAY& partOfThis) const; + ARRAY *fromNoInterlace() const; + ARRAY *toNoInterlace() const; + ARRAY *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end, mcIdType step) const; + DataArrayIdType *checkAndPreparePermutation() const; + DataArrayIdType *buildPermArrPerLevel() const; + bool isIota(mcIdType sizeExpected) const; + bool isUniform(INT val) const; + INT checkUniformAndGuess() const; + bool hasUniqueValues() const; + ARRAY *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; + void transpose(); + ARRAY *changeNbOfComponents(std::size_t newNbOfComp, INT dftValue) const; + void meldWith(const ARRAY *other); + void setPartOfValues1(const ARRAY *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); + void setPartOfValuesSimple1(INT a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + void setPartOfValuesAdv(const ARRAY *a, const DataArrayIdType *tuplesSelec); + void getTuple(mcIdType tupleId, INT *res) const; + INT getIJ(std::size_t tupleId, std::size_t compoId) const; + INT getIJSafe(std::size_t tupleId, std::size_t compoId) const; + INT front() const; + INT back() const; + void setIJ(mcIdType tupleId, mcIdType compoId, INT newVal); + void setIJSilent(mcIdType tupleId, mcIdType compoId, INT newVal); + INT *getPointer(); + const INT *getConstPointer() const; + ARRAY ## Iterator *iterator(); + const INT *begin() const; + const INT *end() const; + DataArrayIdType *findIdsEqual(INT val) const; + DataArrayIdType *findIdsNotEqual(INT val) const; + mcIdType changeValue(INT oldValue, INT newValue); + mcIdType findIdFirstEqualTuple(const std::vector& tupl) const; + mcIdType findIdFirstEqual(INT value) const; + mcIdType findIdFirstEqual(const std::vector& vals) const; + mcIdType findIdSequence(const std::vector& vals) const; + bool presenceOfTuple(const std::vector& tupl) const; + bool presenceOfValue(INT value) const; + bool presenceOfValue(const std::vector& vals) const; + INT count(INT value) const; + INT accumulate(INT compId) const; + INT getMaxValueInArray() const; + INT getMaxAbsValueInArray() const; + INT getMinValueInArray() const; + void abs(); + ARRAY *computeAbs() const; + void applyLin(INT a, INT b, INT compoId); + void applyLin(INT a, INT b); + void applyInv(INT numerator); + ARRAY *negate() const; + void applyDivideBy(INT val); + void applyModulus(INT val); + void applyRModulus(INT val); + void applyPow(INT val); + void applyRPow(INT val); + ARRAY *findIdsInRange(INT vmin, INT vmax) const; + ARRAY *findIdsNotInRange(INT vmin, INT vmax) const; + ARRAY *findIdsStrictlyNegative() const; + bool checkAllIdsInRange(INT vmin, INT vmax) const; + static ARRAY *Aggregate(const ARRAY *a1, const ARRAY *a2, INT offsetA2); + static ARRAY *Meld(const ARRAY *a1, const ARRAY *a2); + static DataArrayIdType *MakePartition(const std::vector& groups, mcIdType newNb, std::vector< std::vector >& fidsOfGroups); + static ARRAY *BuildUnion(const std::vector& arr); + static ARRAY *BuildIntersection(const std::vector& arr); + static DataArrayIdType *FindPermutationFromFirstToSecond(const ARRAY *ids1, const ARRAY *ids2); + DataArrayIdType *buildComplement(mcIdType nbOfElement) const; + ARRAY *buildSubstraction(const ARRAY *other) const; + ARRAY *buildSubstractionOptimized(const ARRAY *other) const; + ARRAY *buildUnion(const ARRAY *other) const; + ARRAY *buildIntersection(const ARRAY *other) const; + ARRAY *buildUnique() const; + ARRAY *buildUniqueNotSorted() const; + ARRAY *deltaShiftIndex() const; + void computeOffsets(); + void computeOffsetsFull(); + ARRAY *buildExplicitArrByRanges(const ARRAY *offsets) const; + DataArrayIdType *findRangeIdForEachTuple(const ARRAY *ranges) const; + ARRAY *findIdInRangeForEachTuple(const ARRAY *ranges) const; + void sortEachPairToMakeALinkedList(); + ARRAY *duplicateEachTupleNTimes(mcIdType nbTimes) const; + ARRAY *getDifferentValues() const; + static ARRAY *Add(const ARRAY *a1, const ARRAY *a2); + void addEqual(const ARRAY *other); + static ARRAY *Substract(const ARRAY *a1, const ARRAY *a2); + void substractEqual(const ARRAY *other); + static ARRAY *Multiply(const ARRAY *a1, const ARRAY *a2); + void multiplyEqual(const ARRAY *other); + static ARRAY *Divide(const ARRAY *a1, const ARRAY *a2); + void divideEqual(const ARRAY *other); + static ARRAY *Modulus(const ARRAY *a1, const ARRAY *a2); + void modulusEqual(const ARRAY *other); + static ARRAY *Pow(const ARRAY *a1, const ARRAY *a2); + void powEqual(const ARRAY *other); + MCAuto fromLinkedListOfPairToList() const; + MCAuto findIdsGreaterOrEqualTo(INT val) const; + MCAuto findIdsGreaterThan(INT val) const; + MCAuto findIdsLowerOrEqualTo(INT val) const; + MCAuto findIdsLowerThan(INT val) const; + MCAuto selectPartDef(const PartDefinition* pd) const; + MCAuto convertToDblArr() const; + MCAuto convertToFloatArr() const; + public: + static ARRAY *Range(INT begin, INT end, INT step); + %extend + { + ARRAY() + { + return ARRAY::New(); + } + + static ARRAY *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + const char *msgBase="MEDCoupling::ARRAY::New : Available API are : \n-ARRAY.New()\n-ARRAY.New([1,3,4])\n-ARRAY.New([1,3,4],3)\n-ARRAY.New([1,3,4,5],2,2)\n-ARRAY.New([1,3,4,5,7,8],3,2)\n-ARRAY.New([(1,3),(4,5),(7,8)])\n-ARRAY.New(5)\n-ARRAY.New(5,2)"; + std::string msg(msgBase); + if ( MEDCouplingHasNumPyBindings() ) + msg+="\n-ARRAY.New(numpy array with dtype=int32)"; + + msg+=" !"; + if(PyList_Check(elt0) || PyTuple_Check(elt0)) + { + if(nbOfTuples) + { + if(PyInt_Check(nbOfTuples)) + { + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !"); + if(nbOfComp) + { + if(PyInt_Check(nbOfComp)) + {//ARRAY.New([1,3,4,5],2,2) + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp)); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !"); + MCAuto ret=ARRAY::New(); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//ARRAY.New([1,3,4],3) + MCAuto ret=ARRAY::New(); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {// ARRAY.New([1,3,4]) + MCAuto ret=ARRAY::New(); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); + return ret.retn(); + } + } + else if(PyInt_Check(elt0)) + { + INT nbOfTuples1=(INT)PyInt_AS_LONG(elt0); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !"); + if(nbOfTuples) + { + if(!nbOfComp) + { + if(PyInt_Check(nbOfTuples)) + {//ARRAY.New(5,2) + INT nbOfCompo=(INT)PyInt_AS_LONG(nbOfTuples); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !"); + MCAuto ret=ARRAY::New(); + ret->alloc(nbOfTuples1,nbOfCompo); + return ret.retn(); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + } + else + {//ARRAY.New(5) + MCAuto ret=ARRAY::New(); + ret->alloc(nbOfTuples1,1); + return ret.retn(); + } + } + else if(MEDCouplingHasNumPyBindings() && PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) + {//ARRAY.New(numpyArray) + return BuildNewInstance(elt0,NPYTraits::NPYObjectType,NPYTraits::NPYFunc,MEDCoupling::Traits::NPYStr); + } + else + throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy + } + + ARRAY(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + return MEDCoupling_ ## ARRAY ## _New__SWIG_1(elt0,nbOfTuples,nbOfComp); + } + + std::string __str__() const + { + return self->reprNotTooLong(); + } + + mcIdType __len__() const + { + if(self->isAllocated()) + { + return self->getNumberOfTuples(); + } + else + { + throw INTERP_KERNEL::Exception("ARRAY::__len__ : Instance is NOT allocated !"); + } + } + + INT __int__() const + { + return self->intValue(); + } + + ARRAY ## Iterator *__iter__() + { + return self->iterator(); + } + + PyObject *accumulate() const + { + mcIdType sz=ToIdType(self->getNumberOfComponents()); + INTERP_KERNEL::AutoPtr tmp=new INT[sz]; + self->accumulate((INT *)tmp); + return convertIntArrToPyList((const INT *)tmp,sz); + } + + ARRAY *accumulatePerChunck(PyObject *indexArr) const + { + mcIdType sw,sz,val; + std::vector val2; + const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); + return self->accumulatePerChunck(bg,bg+sz); + } + + DataArrayIdType *findIdsEqualTuple(PyObject *inputTuple) const + { + mcIdType sw,sz; + INT val; + std::vector val2; + const INT *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2)); + return self->findIdsEqualTuple(bg,bg+sz); + } + + DataArrayIdType *findIdForEach(PyObject *vals) const + { + mcIdType sw,sz; + INT val; + std::vector val2; + const INT *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2)); + MCAuto ret(self->findIdForEach(bg,bg+sz)); + return ret.retn(); + } + + PyObject *splitInBalancedSlices(mcIdType nbOfSlices) const + { + std::vector< std::pair > slcs(self->splitInBalancedSlices(nbOfSlices)); + PyObject *ret=PyList_New(slcs.size()); + for(std::size_t i=0;i::max() || stp==std::numeric_limits::max()) + throw INTERP_KERNEL::Exception("ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !"); + return self->buildExplicitArrOfSliceOnScaledArr((INT)strt,(INT)stp,(INT)step); + } + + PyObject *getMinMaxValues() const + { + INT a,b; + self->getMinMaxValues(a,b); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,PyInt_FromLong(a)); + PyTuple_SetItem(ret,1,PyInt_FromLong(b)); + return ret; + } + + static PyObject *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, PyObject *arr, PyObject *arrI) + { + mcIdType newNbOfTuples=-1; + mcIdType szArr,szArrI,sw,iTypppArr,iTypppArrI; + std::vector stdvecTyyppArr; + std::vector stdvecTyyppArrI; + const mcIdType *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr); + const mcIdType *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI); + DataArrayIdType *ret0=MEDCoupling::ARRAY::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples)); + return ret; + } + + static DataArrayIdType *CheckAndPreparePermutation(PyObject *arr) + { + MCAuto ret(DataArrayIdType::New()); + mcIdType szArr,sw; + INT iTypppArr; + std::vector stdvecTyyppArr; + const INT *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType *pt(MEDCoupling::ARRAY::CheckAndPreparePermutation(arrPtr,arrPtr+szArr)); + ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1); + return ret.retn(); + } + + void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + { + const char *msg="MEDCoupling::ARRAY::setValues : Available API are : \n-ARRAY.setValues([1,3,4])\n-ARRAY.setValues([1,3,4],3)\n-ARRAY.setValues([1,3,4,5],2,2)\n-ARRAY.New(5)\n !"; + if(PyList_Check(li) || PyTuple_Check(li)) + { + if(nbOfTuples && nbOfTuples != Py_None) + { + if(PyInt_Check(nbOfTuples)) + { + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); + if(nbOfTuples1<0) + throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive set of allocated memory !"); + if(nbOfComp && nbOfComp != Py_None) + { + if(PyInt_Check(nbOfComp)) + {//ARRAY.setValues([1,3,4,5],2,2) + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp)); + if(nbOfCompo<0) + throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive number of components !"); + std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo); + self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + else + throw INTERP_KERNEL::Exception(msg); + } + else + {//ARRAY.setValues([1,3,4],3) + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1); + self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + } + else + throw INTERP_KERNEL::Exception(msg); + } + else + {// ARRAY.setValues([1,3,4]) + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2); + self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); + } + } + else + throw INTERP_KERNEL::Exception(msg); + } + + PyObject *getValues() const + { + const INT *vals=self->getConstPointer(); + return convertIntArrToPyList(vals,self->getNbOfElems()); + } + + PyObject *isEqualIfNotWhy(const ARRAY& other) const + { + std::string ret1; + bool ret0=self->isEqualIfNotWhy(other,ret1); + PyObject *ret=PyTuple_New(2); + PyObject *ret0Py=ret0?Py_True:Py_False; + Py_XINCREF(ret0Py); + PyTuple_SetItem(ret,0,ret0Py); + PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); + return ret; + } + + PyObject *getValuesAsTuple() const + { + const INT *vals=self->getConstPointer(); + mcIdType nbOfComp=ToIdType(self->getNumberOfComponents()); + mcIdType nbOfTuples=self->getNumberOfTuples(); + return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); + } + + static PyObject *MakePartition(PyObject *gps, mcIdType newNb) + { + std::vector groups; + std::vector< std::vector > fidsOfGroups; + convertFromPyObjVectorOfObj(gps,SWIGTITraits::TI,"ARRAY",groups); + DataArrayIdType *ret0=MEDCoupling::ARRAY::MakePartition(groups,newNb,fidsOfGroups); + PyObject *ret = PyList_New(2); + PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + std::size_t sz=fidsOfGroups.size(); + PyObject *ret1 = PyList_New(sz); + for(std::size_t i=0;i multiVal; + std::pair > slic; + ARRAY *daIntTyypp=0; + convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return self->findIdsEqualList(&singleVal,&singleVal+1); + case 2: + return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + case 4: + return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); + default: + throw INTERP_KERNEL::Exception("ARRAY::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + } + + DataArrayIdType *findIdsNotEqualList(PyObject *obj) + { + mcIdType sw; + INT singleVal; + std::vector multiVal; + std::pair > slic; + ARRAY *daIntTyypp=0; + convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return self->findIdsNotEqualList(&singleVal,&singleVal+1); + case 2: + return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); + case 4: + return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); + default: + throw INTERP_KERNEL::Exception("ARRAY::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + } + + PyObject *splitByValueRange(PyObject *li) const + { + ARRAY *ret0=0,*ret1=0,*ret2=0; + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->splitByValueRange(tmp,(INT *)tmp+size,ret0,ret1,ret2); + } + else + { + ARRAY *da2=reinterpret_cast< ARRAY * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null ARRAY instance expected !"); + da2->checkAllocated(); + self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2); + } + PyObject *ret = PyList_New(3); + PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + DataArrayIdType *transformWithIndArrR(PyObject *li) const + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->transformWithIndArrR(tmp,tmp+size); + } + else + { + ARRAY *da2=reinterpret_cast< ARRAY * >(da); + return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); + } + } + + ARRAY *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberAndReduce(tmp,newNbOfTuple); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple); + } + } + + ARRAY *renumber(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumber(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumber(da2->getConstPointer()); + } + } + + ARRAY *renumberR(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberR(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberR(da2->getConstPointer()); + } + } + + void setSelectedComponents(const ARRAY *a, PyObject *li) + { + std::vector tmp; + convertPyToNewIntArr3(li,tmp); + self->setSelectedComponents(a,tmp); + } + + PyObject *explodeComponents() const + { + std::vector< MCAuto > retCpp(self->explodeComponents()); + std::size_t sz(retCpp.size()); + PyObject *res(PyList_New(sz)); + for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); + return res; + } + + PyObject *getTuple(mcIdType tupleId) + { + mcIdType sz=ToIdType(self->getNumberOfComponents()); + INTERP_KERNEL::AutoPtr tmp=new INT[sz]; + self->getTuple(tupleId,tmp); + return convertIntArrToPyList((const INT*)tmp,sz); + } + + PyObject *changeSurjectiveFormat(INT targetNb) const + { + DataArrayIdType *arr=0; + DataArrayIdType *arrI=0; + self->changeSurjectiveFormat(targetNb,arr,arrI); + PyObject *res = PyList_New(2); + PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); + return res; + } + + static ARRAY *Meld(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"ARRAY",tmp); + return ARRAY::Meld(tmp); + } + + static ARRAY *Aggregate(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"ARRAY",tmp); + return ARRAY::Aggregate(tmp); + } + + static ARRAY *AggregateIndexes(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"ARRAY",tmp); + return ARRAY::AggregateIndexes(tmp); + } + + static ARRAY *BuildUnion(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"ARRAY",tmp); + return ARRAY::BuildUnion(tmp); + } + + static ARRAY *BuildIntersection(PyObject *li) + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"ARRAY",tmp); + return ARRAY::BuildIntersection(tmp); + } + + PyObject *getMaxValue() const + { + mcIdType tmp; + INT r1=self->getMaxValue(tmp); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); + PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); + return ret; + } + + PyObject *getMaxAbsValue(std::size_t& tupleId) const + { + std::size_t tmp; + INT r1=self->getMaxAbsValue(tmp); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); + PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); + return ret; + } + + PyObject *getMinValue() const + { + mcIdType tmp; + INT r1=self->getMinValue(tmp); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); + PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); + return ret; + } + + mcIdType index(PyObject *obj) const + { + std::size_t nbOfCompo=self->getNumberOfComponents(); + switch(nbOfCompo) + { + case 1: + { + if(PyInt_Check(obj)) + { + INT val=(INT)PyInt_AS_LONG(obj); + return self->findIdFirstEqual(val); + } + else + throw INTERP_KERNEL::Exception("ARRAY::index : 'this' contains one component and trying to find an element which is not an integer !"); + } + default: + { + std::vector arr; + convertPyToNewIntArr3(obj,arr); + return self->findIdFirstEqualTuple(arr); + } + } + } + + bool __contains__(PyObject *obj) const + { + std::size_t nbOfCompo=self->getNumberOfComponents(); + switch(nbOfCompo) + { + case 0: + return false; + case 1: + { + if(PyInt_Check(obj)) + { + INT val=(INT)PyInt_AS_LONG(obj); + return self->presenceOfValue(val); + } + else + throw INTERP_KERNEL::Exception("ARRAY::__contains__ : 'this' contains one component and trying to find an element which is not an integer !"); + } + default: + { + std::vector arr; + convertPyToNewIntArr3(obj,arr); + return self->presenceOfTuple(arr); + } + } + } + + PyObject *__getitem__(PyObject *obj) + { + const char msg[]="Unexpected situation in ARRAY::__getitem__ !"; + const char msg2[]="ARRAY::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; + self->checkAllocated(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + std::size_t nbOfComponents=self->getNumberOfComponents(); + mcIdType it1; + std::size_t ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; + mcIdType sw; + convertObjToPossibleCpp3(obj,nbOfTuples,(int)nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); + MCAuto ret; + switch(sw) + { + case 1: + { + if(nbOfComponents==1) + return PyInt_FromLong(self->getIJSafe(it1,0)); + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 2: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + case 3: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + case 4: + return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + case 5: + return PyInt_FromLong(self->getIJSafe(it1,ic1)); + case 6: + { + ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); + std::vector v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 7: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + std::vector v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 8: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + std::vector v2(1,ic1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 9: + { + ret=self->selectByTupleIdSafe(&it1,&it1+1); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 10: + { + ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 11: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 12: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 13: + { + ret=self->selectByTupleIdSafe(&it1,&it1+1); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(INT i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 14: + { + ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(INT i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 15: + { + ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(mcIdType i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + case 16: + { + ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); + mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); + std::vector v2(nbOfComp); + for(INT i=0;ikeepSelectedComponents(v2)),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__setitem__(PyObject *obj, PyObject *value) + { + self->checkAllocated(); + const char msg[]="Unexpected situation in __setitem__ !"; + mcIdType nbOfTuples=self->getNumberOfTuples(); + int nbOfComponents=(int)self->getNumberOfComponents(); + mcIdType sw1,sw2; + INT i1; + std::vector v1; + ARRAY *d1=0; + ARRAY ## Tuple *dd1=0; + convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); + mcIdType it1,ic1; + std::vector vt1,vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; + convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); + MCAuto tmp; + switch(sw2) + { + case 1: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 2: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 3: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 4: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false); + return self; + case 3: + self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 5: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 6: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 7: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 8: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false); + return self; + case 3: + self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 9: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 10: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 11: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 12: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false); + return self; + case 3: + self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 13: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 14: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 15: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + case 16: + { + switch(sw1) + { + case 1: + self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 2: + tmp=ARRAY::New(); + tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false); + return self; + case 3: + self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); + return self; + case 4: + tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); + self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); + return self; + default: + throw INTERP_KERNEL::Exception(msg); + } + break; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + return self; + } + + ARRAY *__neg__() const + { + return self->negate(); + } + + ARRAY *__add__(PyObject *obj) + { + const char msg[]="Unexpected situation in __add__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Add(self,aaaa); + } + case 3: + { + return ARRAY::Add(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Add(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__radd__(PyObject *obj) + { + const char msg[]="Unexpected situation in __radd__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Add(self,aaaa); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Add(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __iadd__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(1,val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->addEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->addEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->addEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__sub__(PyObject *obj) + { + const char msg[]="Unexpected situation in __sub__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(1,-val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Substract(self,aaaa); + } + case 3: + { + return ARRAY::Substract(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Substract(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__rsub__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rsub__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(-1,val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Substract(aaaa,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Substract(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___isub___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __isub__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(1,-val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->substractEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->substractEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->substractEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__mul__(PyObject *obj) + { + const char msg[]="Unexpected situation in __mul__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(val,0); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Multiply(self,aaaa); + } + case 3: + { + return ARRAY::Multiply(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Multiply(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__rmul__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rmul__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyLin(val,0); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Multiply(self,aaaa); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Multiply(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___imul___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __imul__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyLin(val,0); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->multiplyEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->multiplyEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->multiplyEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__div__(PyObject *obj) + { + const char msg[]="Unexpected situation in __div__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyDivideBy(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Divide(self,aaaa); + } + case 3: + { + return ARRAY::Divide(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Divide(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__rdiv__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rdiv__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyInv(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Divide(aaaa,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Divide(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __idiv__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyDivideBy(val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 2: + { + MCAuto bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + self->divideEqual(bb); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->divideEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->divideEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__mod__(PyObject *obj) + { + const char msg[]="Unexpected situation in __mod__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyModulus(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Modulus(self,aaaa); + } + case 3: + { + return ARRAY::Modulus(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Modulus(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__rmod__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rmod__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyRModulus(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Modulus(aaaa,self); + } + case 3: + { + return ARRAY::Modulus(a,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Modulus(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___imod___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __imod__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyModulus(val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->modulusEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->modulusEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__pow__(PyObject *obj) + { + const char msg[]="Unexpected situation in __pow__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyPow(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Pow(self,aaaa); + } + case 3: + { + return ARRAY::Pow(self,a); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Pow(self,aaaa); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + ARRAY *__rpow__(PyObject *obj) + { + const char msg[]="Unexpected situation in __rpow__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + MCAuto ret=self->deepCopy(); + ret->applyRPow(val); + return ret.retn(); + } + case 2: + { + MCAuto aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size()); + return ARRAY::Pow(aaaa,self); + } + case 3: + { + return ARRAY::Pow(a,self); + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + return ARRAY::Pow(aaaa,self); + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) + { + const char msg[]="Unexpected situation in __ipow__ !"; + INT val; + ARRAY *a; + std::vector aa; + ARRAY ## Tuple *aaa; + mcIdType sw; + convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); + switch(sw) + { + case 1: + { + self->applyPow(val); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 3: + { + self->powEqual(a); + Py_XINCREF(trueSelf); + return trueSelf; + } + case 4: + { + MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); + self->powEqual(aaaa); + Py_XINCREF(trueSelf); + return trueSelf; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + + std::string __repr__() const + { + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); + } + + void pushBackValsSilent(PyObject *li) + { + mcIdType szArr,sw; + INT iTypppArr; + std::vector stdvecTyyppArr; + const INT *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + self->pushBackValsSilent(tmp,tmp+szArr); + } + + PyObject *partitionByDifferentValues() const + { + std::vector ret1; + std::vector ret0=self->partitionByDifferentValues(ret1); + std::size_t sz=ret0.size(); + PyObject *pyRet=PyTuple_New(2); + PyObject *pyRet0=PyList_New((INT)sz); + PyObject *pyRet1=PyList_New((INT)sz); + for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i])); + } + PyTuple_SetItem(pyRet,0,pyRet0); + PyTuple_SetItem(pyRet,1,pyRet1); + return pyRet; + } + + PyObject *findIdsRangesInListOfIds(const ARRAY *listOfIds) const + { + DataArrayIdType *ret0=0; + ARRAY *ret1=0; + self->findIdsRangesInListOfIds(listOfIds,ret0,ret1); + PyObject *pyRet=PyTuple_New(2); + PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return pyRet; + } + + PyObject *isRange() const + { + INT a(0),b(0),c(0); + bool ret(self->isRange(a,b,c)); + PyObject *pyRet=PyTuple_New(2); + PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0); + Py_XINCREF(ret0Py); + PyTuple_SetItem(pyRet,0,ret0Py); + if(ret) + ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); + else + { + ret1Py=Py_None; + Py_XINCREF(ret1Py); + } + PyTuple_SetItem(pyRet,1,ret1Py); + return pyRet; + } + + static bool RemoveIdsFromIndexedArrays(PyObject *li, ARRAY *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0) throw(INTERP_KERNEL::Exception) + { + mcIdType sw; + INT singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::ARRAY *daIntTyypp=0; + if(!arrIndx) + throw INTERP_KERNEL::Exception("ARRAY::RemoveIdsFromIndexedArrays : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + return ARRAY::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval); + case 2: + return ARRAY::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval); + case 4: + return ARRAY::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval); + default: + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + } + + static PyObject *ExtractFromIndexedArrays(PyObject *li, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + ARRAY *arrOut=0; + DataArrayIdType *arrIndexOut=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : null pointer as arrIndxIn !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + ARRAY::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + case 2: + { + ARRAY::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + case 4: + { + ARRAY::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut); + break; + } + default: + throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *ExtractFromIndexedArraysSlice(mcIdType strt, mcIdType stp, mcIdType step, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + ARRAY *arrOut=0; + DataArrayIdType *arrIndexOut=0; + ARRAY::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception) + { + if(!PySlice_Check(slic)) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !"); + Py_ssize_t strt=2,stp=2,step=2; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); + arrIndxIn->checkAllocated(); + if(arrIndxIn->getNumberOfComponents()!=1) + throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); + GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); + ARRAY *arrOut=0; + DataArrayIdType *arrIndexOut=0; + ARRAY::ExtractFromIndexedArraysSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),arrIn,arrIndxIn,arrOut,arrIndexOut); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static PyObject *SetPartOfIndexedArrays(PyObject *li, + const ARRAY *arrIn, const DataArrayIdType *arrIndxIn, + const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception) + { + ARRAY *arrOut=0; + DataArrayIdType *arrIndexOut=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + ARRAY::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + case 2: + { + ARRAY::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + case 4: + { + ARRAY::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); + break; + } + default: + throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + return ret; + } + + static void SetPartOfIndexedArraysSameIdx(PyObject *li, ARRAY *arrIn, const DataArrayIdType *arrIndxIn, + const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception) + { + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + if(!arrIndxIn) + throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !"); + convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + ARRAY::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + case 2: + { + ARRAY::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + case 4: + { + ARRAY::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex); + break; + } + default: + throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or ARRAY !"); + } + } + + } // end extent + }; + + class ARRAY ## Tuple; + + class ARRAY ## Iterator + { + public: + ARRAY ## Iterator(ARRAY *da); + ~ARRAY ## Iterator(); + %extend + { + PyObject *next() + { + ARRAY ## Tuple *ret=self->nextt(); + if(ret) + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__ ## ARRAY ## Tuple,SWIG_POINTER_OWN | 0); + else + { + PyErr_SetString(PyExc_StopIteration,"No more data."); + return 0; + } + } + } + }; + + class ARRAY ## Tuple + { + public: + std::size_t getNumberOfCompo() const; + ARRAY *buildDAInt(INT nbOfTuples, INT nbOfCompo) const; + %extend + { + std::string __str__() const + { + return self->repr(); + } + + INT __int__() const + { + return self->intValue(); + } + + ARRAY *buildDAInt() + { + return self->buildDAInt(1,self->getNumberOfCompo()); + } + + PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_ ## ARRAY ## ____iadd___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___isub___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_ ## ARRAY ## ____isub___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___imul___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_ ## ARRAY ## ____imul___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_ ## ARRAY ## ____idiv___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *___imod___(PyObject *trueSelf, PyObject *obj) + { + MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); + MEDCoupling_ ## ARRAY ## ____imod___(ret,0,obj); + Py_XINCREF(trueSelf); + return trueSelf; + } + + PyObject *__len__() + { + return PyInt_FromLong(self->getNumberOfCompo()); + } + + PyObject *__getitem__(PyObject *obj) + { + const char msg2[]="ARRAY ## Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; + mcIdType sw; + INT singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + const INT *pt=self->getConstPointer(); + INT nbc=(INT)self->getNumberOfCompo(); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,ToIdType(nbc),sw,singleVal,multiVal,slic,daIntTyypp); + switch(sw) + { + case 1: + { + if(singleVal>=(INT)nbc) + { + std::ostringstream oss; + oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; + PyErr_SetString(PyExc_StopIteration,oss.str().c_str()); + return 0; + } + if(singleVal>=0) + return PyInt_FromLong(pt[singleVal]); + else + { + if(nbc+singleVal>0) + return PyInt_FromLong(pt[nbc+singleVal]); + else + { + std::ostringstream oss; + oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + } + } + case 2: + { + PyObject *t=PyTuple_New(multiVal.size()); + for(std::size_t j=0;j=(INT)nbc) + { + std::ostringstream oss; + oss << "Requesting for id #" << cid << " having only " << nbc << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid])); + } + return t; + } + case 3: + { + mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + PyObject *t=PyTuple_New(sz); + for(INT j=0;j multiValV; + std::pair > slicV; + MEDCoupling::ARRAY ## Tuple *daIntTyyppV=0; + mcIdType nbc=ToIdType(self->getNumberOfCompo()); + convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV); + INT singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::ARRAY *daIntTyypp=0; + INT *pt=self->getPointer(); + convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp); + switch(sw2) + { + case 1: + { + if(singleVal>=nbc) + { + std::ostringstream oss; + oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + switch(sw1) + { + case 1: + { + pt[singleVal]=(INT)singleValV; + return self; + } + case 2: + { + if(multiValV.size()!=1) + { + std::ostringstream oss; + oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! "; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + pt[singleVal]=(INT)multiValV[0]; + return self; + } + case 4: + { + pt[singleVal]=daIntTyyppV->getConstPointer()[0]; + return self; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + case 2: + { + switch(sw1) + { + case 1: + { + for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) + { + if(*it>=nbc) + { + std::ostringstream oss; + oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + pt[*it]=(INT)singleValV; + } + return self; + } + case 2: + { + if(multiVal.size()!=multiValV.size()) + { + std::ostringstream oss; + oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + for(INT i=0;i<(INT)multiVal.size();i++) + { + INT pos=multiVal[i]; + if(pos>=nbc) + { + std::ostringstream oss; + oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + pt[multiVal[i]]=(INT)multiValV[i]; + } + return self; + } + case 4: + { + const INT *ptV=daIntTyyppV->getConstPointer(); + if(nbc>(INT)daIntTyyppV->getNumberOfCompo()) + { + std::ostringstream oss; + oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + std::copy(ptV,ptV+nbc,pt); + return self; + } + default: + throw INTERP_KERNEL::Exception(msg); + } + } + case 3: + { + std::size_t sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + switch(sw1) + { + case 1: + { + for(std::size_t j=0;jgetConstPointer(); + if(sz>daIntTyyppV->getNumberOfCompo()) + { + std::ostringstream oss; + oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + for(std::size_t j=0;j::TI, 0 | 0 )); + if (!SWIG_IsOK(res1)) + { + int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 )); + if(SWIG_IsOK(res2)) + { + MapII *m=reinterpret_cast(da); + self->transformWithIndArr(*m); + } + else + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->transformWithIndArr(tmp,tmp+size); + } + } + else + { + ARRAY *da2=reinterpret_cast< ARRAY * >(da); + self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); + } +} +%enddef + +namespace MEDCoupling +{ + typedef int Int32; + typedef long int Int64; + + + class DataArrayInt32Iterator; + + class DataArrayInt32 : public DataArray + { + ARRAYDEF( DataArrayInt32, Int32 ) + }; + %extend DataArrayInt32 { +#ifdef WITH_NUMPY + PyObject *toNumPyArray() // not const. It is not a bug ! + { + return ToNumPyArray(self,NPY_INT32,"DataArrayInt32"); + } +#endif +#ifndef MEDCOUPLING_USE_64BIT_IDS + MCAuto< MapII > invertArrayN2O2O2NOptimized() + { + return self->invertArrayN2O2O2NOptimized(); + } + MCAuto< MapII > giveN2OOptimized() + { + return self->giveN2OOptimized(); + } + TRANSFORMWITHINDARR( DataArrayInt32, Int32 ) +#endif + }; + + class DataArrayInt64Iterator; + + class DataArrayInt64 : public DataArray + { + ARRAYDEF( DataArrayInt64, Int64 ) + }; + %extend DataArrayInt64 { +#ifdef WITH_NUMPY + PyObject *toNumPyArray() // not const. It is not a bug ! + { + return ToNumPyArray(self,NPY_INT64,"DataArrayInt64"); + } +#endif +#ifdef MEDCOUPLING_USE_64BIT_IDS + MCAuto< MapII > invertArrayN2O2O2NOptimized() + { + return self->invertArrayN2O2O2NOptimized(); + } + MCAuto< MapII > giveN2OOptimized() + { + return self->giveN2OOptimized(); + } + TRANSFORMWITHINDARR( DataArrayInt64, Int64 ) +#endif + }; + +} diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 57ae1cd48..7c2ef3baf 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -56,24 +56,42 @@ def MEDCouplingFieldDoubleIdiv(self,*args): def MEDCouplingFieldDoubleIpow(self,*args): import _MEDCoupling return _MEDCoupling.MEDCouplingFieldDouble____ipow___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDCoupling.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDCoupling.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDCoupling.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDCoupling.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDCoupling.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayInt____ipow___(self, self, *args) + return _MEDCoupling.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayFloatIadd(self,*args): import _MEDCoupling return _MEDCoupling.DataArrayFloat____iadd___(self, self, *args) @@ -98,21 +116,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDCoupling return _MEDCoupling.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): + import _MEDCoupling + return _MEDCoupling.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDCoupling.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDCoupling.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDCoupling.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDCoupling.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): import _MEDCoupling - return _MEDCoupling.DataArrayIntTuple____imod___(self, self, *args) + return _MEDCoupling.DataArrayInt64Tuple____imod___(self, self, *args) def MEDCouplingDenseMatrixIadd(self,*args): import _MEDCoupling return _MEDCoupling.DenseMatrix____iadd___(self, self, *args) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index 332270c83..188dcf5f9 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -2404,8 +2404,8 @@ class MEDCouplingBasicsTest2(unittest.TestCase): pass # test of static method DataArrayInt::meld dai1=da1C.convertToIntArr(); - dai4=DataArrayInt.Meld(dai1,dai3); - tmp=DataArrayInt.Meld([dai1,dai3]); + dai4=DataArrayInt32.Meld(dai1,dai3); + tmp=DataArrayInt32.Meld([dai1,dai3]); self.assertTrue(dai4.isEqual(tmp)) self.assertEqual(5,dai4.getNumberOfComponents()); self.assertEqual(7,dai4.getNumberOfTuples()); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index 94ec01b73..0ad6b8421 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -1499,7 +1499,7 @@ class MEDCouplingBasicsTest3(unittest.TestCase): self.assertTrue(d.isEqual(d1,1e-12)); # d2=d.convertToIntArr(); - d4=DataArrayInt.New(); + d4=DataArrayInt32.New(); self.assertTrue(not d2.isEqual(d4)); d4.deepCopyFrom(d2); self.assertTrue(d2.isEqual(d4)); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index 3bca65eeb..cea4720db 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -2809,7 +2809,7 @@ class MEDCouplingBasicsTest4(unittest.TestCase): @unittest.skipUnless(checkFreeMemory((223456789*16)/(1024)), "Not enough memory") def testSwig2BigMem(self): - if MEDCouplingSizeOfVoidStar()==64: + if MEDCouplingSizeOfVoidStar()==64 and MEDCouplingSizeOfIDs()==32: d=DataArrayAsciiChar(223456789,16) self.assertTrue(d.getNumberOfTuples(),223456789) self.assertTrue(d.getNumberOfComponents(),16) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index f8cb7ca8f..b1dc1d3bd 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -606,7 +606,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m=MEDCoupling1SGTUMesh("m",NORM_QUAD4) mem_m=m.getHeapMemorySize() m.allocateCells(5) - self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * 4, 5 * 4 * 4 + 32))) + self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * MEDCouplingSizeOfIDs()//8, 5 * 4 * MEDCouplingSizeOfIDs()//8 + 32))) self.assertEqual(m.getNodalConnectivity().getNbOfElemAllocated(),20) m.setCoords(um.getCoords()) m.insertNextCell([1,0,6,7]) @@ -1019,7 +1019,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(d.getInfoOnComponents(),["aa","bbb"]) ref=d.getHeapMemorySize() d.desallocate() - self.assertEqual(ref-d.getHeapMemorySize(),6*4) + self.assertEqual(ref-d.getHeapMemorySize(),6*MEDCouplingSizeOfIDs()//8) self.assertTrue(not d.isAllocated()) self.assertEqual(d.getInfoOnComponents(),["aa","bbb"]) self.assertRaises(InterpKernelException,d.checkAllocated) @@ -3885,9 +3885,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m.setCoords(arrX,arrX) f=MEDCouplingFieldInt(ON_CELLS) f.setMesh(m) - arr=DataArrayInt(8) ; arr.iota() ;f.setArray(arr) + arr=DataArrayInt32(8) ; arr.iota() ;f.setArray(arr) self.assertRaises(InterpKernelException,f.checkConsistencyLight) - arr=DataArrayInt(9) ; arr.iota() ;f.setArray(arr) + arr=DataArrayInt32(9) ; arr.iota() ;f.setArray(arr) f.checkConsistencyLight() f.setTimeUnit("ms") self.assertEqual(f.getTimeUnit(),"ms") @@ -3935,13 +3935,13 @@ class MEDCouplingBasicsTest5(unittest.TestCase): m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4])) m1=m1.buildUnstructured() ; m1.setName("mesh") f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setMesh(m1) - arr1=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"]) + arr1=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"]) f1.setArray(arr1) ; f1.setName("f1") ; f1.setTime(2.,3,4) # m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4])) m2=m2.buildUnstructured() ; m2.setName("mesh") f2=MEDCouplingFieldInt(ON_CELLS) ; f2.setMesh(m2) - arr2=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"]) + arr2=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"]) f2.setArray(arr2) ; f2.setName("f1") ; f2.setTime(2.,3,4) # self.assertTrue(f1.isEqual(f2,1e-12,0)) @@ -3967,7 +3967,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): # for fd,expected in ((ON_NODES,False),(ON_CELLS,True)): f4=MEDCouplingFieldInt(fd) ; f4.setMesh(m2) ; f4.setTime(2.,3,4) - arr4=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"]) + arr4=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"]) f4.setArray(arr4) ; f4.setName("f1") self.assertEqual(f1.isEqual(f4,1e-12,0),expected) pass @@ -4687,14 +4687,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase): """Test focused of new wrapped methods for MEDCouplingFieldInt thanks to code factorization.""" d=DataArrayDouble(7) ; d.iota() m=MEDCouplingUMesh.Build1DMeshFromCoords(d) - f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight() + f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt32(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight() f_0=f[::2] # test is here - self.assertTrue(f_0.getArray().isEqual(DataArrayInt([0,2,4]))) + self.assertTrue(f_0.getArray().isEqual(DataArrayInt32([0,2,4]))) self.assertTrue(f_0.getMesh().isEqual(m[[0,2,4]],1e-12)) # - f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight() + f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt32(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight() f_1=f2[::2] # test is here - self.assertTrue(f_1.getArray().isEqual(DataArrayInt([0,1,2,3,4,5]))) + self.assertTrue(f_1.getArray().isEqual(DataArrayInt32([0,1,2,3,4,5]))) m_1=m[[0,2,4]] ; m_1.zipCoords() self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12)) pass diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py new file mode 100644 index 000000000..1b655eb78 --- /dev/null +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest7.py @@ -0,0 +1,724 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from medcoupling import * +import unittest +from math import pi,e,sqrt,cos,sin +from datetime import datetime +from MEDCouplingDataForTest import MEDCouplingDataForTest +import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr + +class MEDCouplingBasicsTest7(unittest.TestCase): + + def testDAIGetIdsEqual1(self): + tab1=[5,-2,-4,-2,3,2,-2]; + da=DataArrayInt64.New(); + da.setValues(tab1,7,1); + da2=da.findIdsEqual(-2); + self.assertEqual(3,da2.getNumberOfTuples()); + self.assertEqual(1,da2.getNumberOfComponents()); + expected1=[1,3,6]; + self.assertEqual(expected1,da2.getValues()); + pass + + def testDAIGetIdsEqualList1(self): + tab1=[5,-2,-4,-2,3,2,-2]; + da=DataArrayInt64.New(); + da.setValues(tab1,7,1); + da2=da.findIdsEqualList([3,-2,0]); + self.assertEqual(4,da2.getNumberOfTuples()); + self.assertEqual(1,da2.getNumberOfComponents()); + expected1=[1,3,4,6]; + self.assertEqual(expected1,da2.getValues()); + pass + + def testDAIsUniform1(self): + tab1=[1,1,1,1,1] + da=DataArrayInt64.New(); + da.setValues(tab1,5,1); + self.assertTrue(da.isUniform(1)); + da.setIJ(2,0,2); + self.assertTrue(not da.isUniform(1)); + da.setIJ(2,0,1); + self.assertTrue(da.isUniform(1)); + da2=da.convertToDblArr(); + self.assertTrue(da2.isUniform(1.,1.e-12)); + da2.setIJ(1,0,1.+1.e-13); + self.assertTrue(da2.isUniform(1.,1.e-12)); + da2.setIJ(1,0,1.+1.e-11); + self.assertTrue(not da2.isUniform(1.,1.e-12)); + pass + + def testDAIBuildComplement1(self): + a=DataArrayInt64.New(); + tab=[3,1,7,8] + a.setValues(tab,4,1); + b=a.buildComplement(12); + self.assertEqual(8,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[0,2,4,5,6,9,10,11] + for i in range(8): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + pass + + def testDAIBuildUnion1(self): + a=DataArrayInt64.New(); + tab1=[3,1,7,8] + a.setValues(tab1,4,1); + c=DataArrayInt64.New(); + tab2=[5,3,0,18,8] + c.setValues(tab2,5,1); + b=a.buildUnion(c); + self.assertEqual(7,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[0,1,3,5,7,8,18] + for i in range(7): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + b=DataArrayInt64.BuildUnion([a,c]); + self.assertEqual(7,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[0,1,3,5,7,8,18] + for i in range(7): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + pass + + def testDAIBuildIntersection1(self): + a=DataArrayInt64.New(); + tab1=[3,1,7,8] + a.setValues(tab1,4,1); + c=DataArrayInt64.New(); + tab2=[5,3,0,18,8] + c.setValues(tab2,5,1); + b=a.buildIntersection(c); + self.assertEqual(2,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[3,8] + for i in range(2): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + b=DataArrayInt64.BuildIntersection([a,c]); + self.assertEqual(2,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[3,8] + for i in range(2): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + pass + + def testDAIDeltaShiftIndex1(self): + a=DataArrayInt64.New(); + tab=[1,3,6,7,7,9,15] + a.setValues(tab,7,1); + b=a.deltaShiftIndex(); + self.assertEqual(6,b.getNumberOfTuples()); + self.assertEqual(1,b.getNumberOfComponents()); + expected1=[2,3,1,0,2,6] + for i in range(6): + self.assertEqual(expected1[i],b.getIJ(0,i)); + pass + pass + + def testDAIBuildSubstraction1(self): + a=DataArrayInt64.New() + aa=[2,3,6,8,9] + a.setValues(aa,5,1) + b=DataArrayInt64.New() + bb=[1,3,5,9,11] + b.setValues(bb,5,1) + self.assertEqual([2,6,8],a.buildSubstraction(b).getValues()) + pass + + def testDAIBuildPermutationArr1(self): + a=DataArrayInt64.New() + a.setValues([4,5,6,7,8],5,1) + b=DataArrayInt64.New() + b.setValues([5,4,8,6,7],5,1) + c=a.buildPermutationArr(b) + self.assertEqual([1,0,4,2,3],c.getValues()) + self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b)) + b.setIJ(0,0,9) + self.assertTrue(not a.isEqualWithoutConsideringStrAndOrder(b)) + self.assertRaises(InterpKernelException,a.buildPermutationArr,b) + a.setIJ(3,0,4) + b.setIJ(0,0,5) + b.setIJ(4,0,4)#a==[4,5,6,4,8] and b==[5,4,8,6,4] + self.assertTrue(a.isEqualWithoutConsideringStrAndOrder(b)) + c=a.buildPermutationArr(b) + self.assertEqual([1,3,4,2,3],c.getValues()) + d=b.convertToDblArr() + expect3=[4,4,5,6,8] + b.sort() + self.assertEqual(expect3,b.getValues()) + d.sort() + self.assertEqual(5,d.getNumberOfTuples()); + self.assertEqual(1,d.getNumberOfComponents()); + for i in range(5): + self.assertAlmostEqual(float(expect3[i]),d.getIJ(i,0),14); + pass + pass + + def testDAIAggregateMulti1(self): + a=DataArrayInt64.New() + a.setValues(list(range(4)), 2, 2) + a.setName("aa") + b=DataArrayInt64.New() + b.setValues(list(range(6)), 3, 2) + c=DataArrayInt64.Aggregate([a,b]) + self.assertEqual(list(range(4)) + list(range(6)), c.getValues()) + self.assertEqual("aa",c.getName()) + self.assertEqual(5,c.getNumberOfTuples()) + self.assertEqual(2,c.getNumberOfComponents()) + pass + + def testDAICheckAndPreparePermutation1(self): + vals1=[9,10,0,6,4,11,3,7]; + expect1=[5,6,0,3,2,7,1,4]; + vals2=[9,10,0,6,10,11,3,7]; + da=DataArrayInt64.New(); + da.setValues(vals1,8,1); + da2=da.checkAndPreparePermutation(); + self.assertEqual(8,da2.getNumberOfTuples()); + self.assertEqual(1,da2.getNumberOfComponents()); + for i in range(8): + self.assertEqual(expect1[i],da2.getIJ(i,0)); + pass + # + da=DataArrayInt64.New(); + da.alloc(8,1); + da.iota(0); + da2=da.checkAndPreparePermutation(); + self.assertEqual(1,da2.getNumberOfComponents()); + self.assertTrue(da2.isIota(8)); + # + da=DataArrayInt64.New(); + da.alloc(8,1); + da.setValues(vals2,8,1); + self.assertRaises(InterpKernelException,da.checkAndPreparePermutation); + pass + + def testDAIChangeSurjectiveFormat1(self): + vals1=[0,3,2,3,2,2,1,2] + expected1=[0,1,2,6,8] + expected2=[0, 6, 2,4,5,7, 1,3] + da=DataArrayInt64.New(); + da.setValues(vals1,8,1); + # + da2,da2I=da.changeSurjectiveFormat(4); + self.assertEqual(5,da2I.getNumberOfTuples()); + self.assertEqual(8,da2.getNumberOfTuples()); + self.assertEqual(expected1,da2I.getValues()); + self.assertEqual(expected2,da2.getValues()); + # + self.assertRaises(InterpKernelException,da.changeSurjectiveFormat,3); + # + pass + + def testDAIGetIdsNotEqual1(self): + d=DataArrayInt64.New(); + vals1=[2,3,5,6,8,5,5,6,1,-5] + d.setValues(vals1,10,1); + d2=d.findIdsNotEqual(5); + self.assertEqual(7,d2.getNumberOfTuples()); + self.assertEqual(1,d2.getNumberOfComponents()); + expected1=[0,1,3,4,7,8,9] + for i in range(7): + self.assertEqual(expected1[i],d2.getIJ(0,i)); + pass + d.rearrange(2); + self.assertRaises(InterpKernelException,d.findIdsNotEqual,5); + vals2=[-4,5,6] + vals3=vals2; + d.rearrange(1); + d3=d.findIdsNotEqualList(vals3); + self.assertEqual(5,d3.getNumberOfTuples()); + self.assertEqual(1,d3.getNumberOfComponents()); + expected2=[0,1,4,8,9] + for i in range(5): + self.assertEqual(expected2[i],d3.getIJ(0,i)); + pass + pass + + def testDAIComputeOffsets1(self): + d=DataArrayInt64.New(); + vals1=[3,5,1,2,0,8] + expected1=[0,3,8,9,11,11] + d.setValues(vals1,6,1); + d.computeOffsets(); + self.assertEqual(6,d.getNumberOfTuples()); + self.assertEqual(1,d.getNumberOfComponents()); + for i in range(6): + self.assertEqual(expected1[i],d.getIJ(0,i)); + pass + pass + + def testDAITransformWithIndArr1(self): + if not MEDCouplingUse64BitIDs(): + return + tab1=[17,18,22,19] + tab2=[0,1,1,3,3,0,1,3,2,2,3,0] + expected=[17,18,18,19,19,17,18,19,22,22,19,17] + d=DataArrayInt64.New(); + d.setValues(tab1,4,1); + d1=DataArrayInt64.New(); + d1.setValues(tab2,12,1); + d2=d1[:] + # + d1.transformWithIndArr(d); + self.assertEqual(12,d1.getNumberOfTuples()); + self.assertEqual(1,d1.getNumberOfComponents()); + for i in range(12): + self.assertEqual(expected[i],d1.getIJ(i,0)); + pass + # + d1=d2 + d1.transformWithIndArr(tab1) + self.assertEqual(12,d1.getNumberOfTuples()); + self.assertEqual(1,d1.getNumberOfComponents()); + for i in range(12): + self.assertEqual(expected[i],d1.getIJ(i,0)); + pass + pass + + def testDAIBuildPermArrPerLevel1(self): + arr=[2,0,1,1,0,1,2,0,1,1,0,0] + expected1=[10,0,5,6,1,7,11,2,8,9,3,4] + da=DataArrayInt64.New(); + da.setValues(arr,12,1); + da2=da.buildPermArrPerLevel(); + self.assertEqual(12,da2.getNumberOfTuples()); + self.assertEqual(1,da2.getNumberOfComponents()); + for i in range(12): + self.assertEqual(expected1[i],da2.getIJ(i,0)); + pass + pass + + def testDAIOperations1(self): + arr1=[-1,-2,4,7,3,2,6,6,4,3,0,1] + da=DataArrayInt64.New(); + da.setValues(arr1,4,3); + da1=DataArrayInt64.New(); + da1.alloc(12,1); + da1.iota(2); + self.assertRaises(InterpKernelException,DataArrayInt64.Add,da,da1);#not same number of tuples/Components + da1.rearrange(3); + da2=DataArrayInt64.Add(da,da1); + self.assertEqual(4,da2.getNumberOfTuples()); + self.assertEqual(3,da2.getNumberOfComponents()); + expected1=[1,1,8,12,9,9,14,15,14,14,12,14] + for i in range(12): + self.assertEqual(expected1[i],da2.getIJ(0,i)); + pass + da1.substractEqual(da); + expected2=[3,5,0,-2,3,5,2,3,6,8,12,12] + for i in range(12): + self.assertEqual(expected2[i],da1.getIJ(0,i)); + pass + da1.rearrange(1); da1.iota(2); da1.rearrange(3); + da1.addEqual(da); + for i in range(12): + self.assertEqual(expected1[i],da1.getIJ(0,i)); + pass + da1.rearrange(1); da1.iota(2); da1.rearrange(3); + da2=DataArrayInt64.Multiply(da,da1); + self.assertEqual(4,da2.getNumberOfTuples()); + self.assertEqual(3,da2.getNumberOfComponents()); + expected3=[-2,-6,16,35,18,14,48,54,40,33,0,13] + for i in range(12): + self.assertEqual(expected3[i],da2.getIJ(0,i)); + pass + da.divideEqual(da1); + self.assertEqual(4,da.getNumberOfTuples()); + self.assertEqual(3,da.getNumberOfComponents()); + expected4=[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0] + for i in range(12): + self.assertEqual(expected4[i],da.getIJ(0,i)); + pass + da.setValues(arr1,4,3); + da1.multiplyEqual(da); + self.assertEqual(4,da1.getNumberOfTuples()); + self.assertEqual(3,da1.getNumberOfComponents()); + for i in range(12): + self.assertEqual(expected3[i],da1.getIJ(0,i)); + pass + da1.rearrange(1); da1.iota(2); da1.rearrange(3); + da2=DataArrayInt64.Divide(da,da1); + self.assertEqual(4,da2.getNumberOfTuples()); + self.assertEqual(3,da2.getNumberOfComponents()); + for i in range(12): + self.assertEqual(expected4[i],da2.getIJ(0,i)); + pass + da1.applyInv(321); + self.assertEqual(4,da1.getNumberOfTuples()); + self.assertEqual(3,da1.getNumberOfComponents()); + expected5=[160,107,80,64,53,45,40,35,32,29,26,24] + for i in range(12): + self.assertEqual(expected5[i],da1.getIJ(0,i)); + pass + da1.applyDivideBy(2); + self.assertEqual(4,da1.getNumberOfTuples()); + self.assertEqual(3,da1.getNumberOfComponents()); + expected6=[80,53,40,32,26,22,20,17,16,14,13,12] + for i in range(12): + self.assertEqual(expected6[i],da1.getIJ(0,i)); + pass + expected7=[3,4,5,4,5,1,6,3,2,0,6,5] + da1.applyModulus(7); + for i in range(12): + self.assertEqual(expected7[i],da1.getIJ(0,i)); + pass + da1.applyLin(1,1); + expected8=[3,3,3,3,3,1,3,3,0,0,3,3] + da1.applyRModulus(3); + for i in range(12): + self.assertEqual(expected8[i],da1.getIJ(0,i)); + pass + pass + + def testDAITransformWithIndArrR1(self): + tab1=[2,4,5,3,6,7] + tab2=[-1,-1,0,1,2,3,4,5,-1,-1,-1,-1] + expected=[0,3,1,2,4,5] + d=DataArrayInt64.New(); + d.setValues(tab1,6,1); + d1=DataArrayInt64.New(); + d1.setValues(tab2,12,1); + d2=d1[:] + # + d3=d.transformWithIndArrR(d1); + self.assertEqual(6,d3.getNumberOfTuples()); + self.assertEqual(1,d3.getNumberOfComponents()); + for i in range(6): + self.assertEqual(expected[i],d3.getIJ(i,0)); + pass + # + d1=d2 + d3=d.transformWithIndArrR(tab2) + self.assertEqual(6,d3.getNumberOfTuples()); + self.assertEqual(1,d3.getNumberOfComponents()); + for i in range(6): + self.assertEqual(expected[i],d3.getIJ(i,0)); + pass + pass + + def testDAISplitByValueRange1(self): + val1=[6,5,0,3,2,7,8,1,4] + val2=[0,4,9] + d=DataArrayInt64.New(); + d.setValues(val1,9,1); + e,f,g=d.splitByValueRange(val2); + self.assertEqual(9,e.getNumberOfTuples()); + self.assertEqual(1,e.getNumberOfComponents()); + self.assertEqual(9,f.getNumberOfTuples()); + self.assertEqual(1,f.getNumberOfComponents()); + self.assertEqual(2,g.getNumberOfTuples()); + self.assertEqual(1,g.getNumberOfComponents()); + # + expected1=[1,1,0,0,0,1,1,0,1] + expected2=[2,1,0,3,2,3,4,1,0] + for i in range(9): + self.assertEqual(expected1[i],e.getIJ(i,0)); + self.assertEqual(expected2[i],f.getIJ(i,0)); + pass + self.assertEqual(0,g.getIJ(0,0)); + self.assertEqual(1,g.getIJ(1,0)); + # + d.setIJ(6,0,9); + self.assertRaises(InterpKernelException,d.splitByValueRange,val2); + # non regression test in python wrapping + rg=DataArrayInt64([0,10,29,56,75,102,121,148,167,194,213,240,259,286,305,332,351,378,397,424,443,470,489,516]) + a,b,c=DataArrayInt64([75]).splitByValueRange(rg) + assert(a.isEqual(DataArrayInt64([4]))) + assert(b.isEqual(DataArrayInt64([0]))) + assert(c.isEqual(DataArrayInt64([4]))) + pass + + def testDAIBuildExplicitArrByRanges1(self): + d=DataArrayInt64.New(); + vals1=[0,2,3] + d.setValues(vals1,3,1); + e=DataArrayInt64.New(); + vals2=[0,3,6,10,14,20] + e.setValues(vals2,6,1); + # + f=d.buildExplicitArrByRanges(e); + self.assertEqual(11,f.getNumberOfTuples()); + self.assertEqual(1,f.getNumberOfComponents()); + expected1=[0,1,2,6,7,8,9,10,11,12,13] + for i in range(11): + self.assertEqual(expected1[i],f.getIJ(i,0)); + pass + pass + + def testDAIComputeOffsets2(self): + d=DataArrayInt64.New(); + vals1=[3,5,1,2,0,8] + expected1=[0,3,8,9,11,11,19] + d.setValues(vals1,6,1); + d.computeOffsetsFull(); + self.assertEqual(7,d.getNumberOfTuples()); + self.assertEqual(1,d.getNumberOfComponents()); + for i in range(7): + self.assertEqual(expected1[i],d.getIJ(0,i)); + pass + pass + + def testDAIBuildOld2NewArrayFromSurjectiveFormat2(self): + arr=[0,3, 5,7,9] + arrI=[0,2,5] + a=DataArrayInt.New(); + a.setValues(arr,5,1); + b=DataArrayInt.New(); + b.setValues(arrI,3,1); + ret,newNbTuple=DataArrayInt64.ConvertIndexArrayToO2N(10,a,b); + expected=[0,1,2,0,3,4,5,4,6,4] + self.assertEqual(10,ret.getNbOfElems()); + self.assertEqual(7,newNbTuple); + self.assertEqual(1,ret.getNumberOfComponents()); + self.assertEqual(expected,ret.getValues()); + self.assertRaises(InterpKernelException,DataArrayInt64.ConvertIndexArrayToO2N,9,a,b); + pass + + def testDAIBuildUnique1(self): + d=DataArrayInt64([1,2,2,3,3,3,3,4,5,5,7,7,7,19]) + e=d.buildUnique() + self.assertTrue(e.isEqual(DataArrayInt64([1,2,3,4,5,7,19]))) + pass + + def testDAIPartitionByDifferentValues1(self): + d=DataArrayInt64([1,0,1,2,0,2,2,-3,2]) + expected=[[-3,[7]],[0,[1,4]],[1,[0,2]],[2,[3,5,6,8]]] + for i,elt in enumerate(zip(*d.partitionByDifferentValues())): + self.assertEqual(expected[i][0],elt[1]) + self.assertEqual(expected[i][1],elt[0].getValues()) + pass + pass + + def testDAICheckMonotonic1(self): + data1=[-1,0,2,2,4,5] + data2=[6,2,0,-8,-9,-56] + data3=[-1,0,3,2,4,6] + data4=[7,5,2,3,0,-6] + d=DataArrayInt64.New(data1); + self.assertTrue(d.isMonotonic(True)); + self.assertTrue(not d.isMonotonic(False)); + d.checkMonotonic(True); + self.assertRaises(InterpKernelException,d.checkMonotonic,False) + d=DataArrayInt64.New(data2); + self.assertTrue(d.isMonotonic(False)); + self.assertTrue(not d.isMonotonic(True)); + d.checkMonotonic(False); + self.assertRaises(InterpKernelException,d.checkMonotonic,True) + d=DataArrayInt64.New(data3); + self.assertTrue(not d.isMonotonic(False)); + self.assertTrue(not d.isMonotonic(True)); + self.assertRaises(InterpKernelException,d.checkMonotonic,True) + self.assertRaises(InterpKernelException,d.checkMonotonic,False) + d=DataArrayInt64.New(data4); + self.assertTrue(not d.isMonotonic(False)); + self.assertTrue(not d.isMonotonic(True)); + self.assertRaises(InterpKernelException,d.checkMonotonic,True) + self.assertRaises(InterpKernelException,d.checkMonotonic,False) + d=DataArrayInt64.New(0,1) + self.assertTrue(d.isMonotonic(True)); + self.assertTrue(d.isMonotonic(False)); + d.checkMonotonic(True); + d.checkMonotonic(False); + d=DataArrayInt64.New(data4,3,2);#throw because nbComp!=1 + self.assertRaises(InterpKernelException,d.isMonotonic,True) + self.assertRaises(InterpKernelException,d.isMonotonic,False) + self.assertRaises(InterpKernelException,d.checkMonotonic,True) + self.assertRaises(InterpKernelException,d.checkMonotonic,False) + pass + + def testDAIBuildSubstractionOptimized1(self): + da1=DataArrayInt64.New([1,3,5,6,7,9,13]) + da2=DataArrayInt64.New([3,5,9]) + da3=DataArrayInt64.New([1,3,5]) + da4=DataArrayInt64.New([1,3,5,6,7,9,13]) + # + a=da1.buildSubstractionOptimized(da2); + self.assertTrue(a.isEqual(DataArrayInt64([1,6,7,13]))); + # + a=da1.buildSubstractionOptimized(da3); + self.assertTrue(a.isEqual(DataArrayInt64([6,7,9,13]))); + # + a=da1.buildSubstractionOptimized(da4); + self.assertTrue(a.isEqual(DataArrayInt64([]))); + pass + + def testDAIIsStrictlyMonotonic1(self): + da1=DataArrayInt64.New([1,3,5,6,7,9,13]) + self.assertTrue(da1.isStrictlyMonotonic(True)); + da1.checkStrictlyMonotonic(True); + self.assertTrue(da1.isMonotonic(True)); + da1.checkMonotonic(True); + self.assertTrue(not da1.isStrictlyMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False) + self.assertTrue(not da1.isMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,False) + # + da1=DataArrayInt64.New([1,3,5,6,6,9,13]) + self.assertTrue(not da1.isStrictlyMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True) + self.assertTrue(da1.isMonotonic(True)); + da1.checkMonotonic(True); + self.assertTrue(not da1.isStrictlyMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False) + self.assertTrue(not da1.isMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,False) + # + da1=DataArrayInt64.New([1,3,5,6,5,9,13]) + self.assertTrue(not da1.isStrictlyMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True) + self.assertTrue(not da1.isMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,True) + self.assertTrue(not da1.isStrictlyMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False) + self.assertTrue(not da1.isMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,False) + # + da1=DataArrayInt64.New([13,9,7,6,5,3,1]) + self.assertTrue(not da1.isStrictlyMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True) + self.assertTrue(not da1.isMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,True) + self.assertTrue(da1.isStrictlyMonotonic(False)); + da1.checkStrictlyMonotonic(False); + self.assertTrue(da1.isMonotonic(False)); + da1.checkMonotonic(False); + # + da1=DataArrayInt64.New([13,9,6,6,5,3,1]) + self.assertTrue(not da1.isStrictlyMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True) + self.assertTrue(not da1.isMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,True) + self.assertTrue(not da1.isStrictlyMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False) + self.assertTrue(da1.isMonotonic(False)); + da1.checkMonotonic(False); + # + da1=DataArrayInt64.New([13,9,5,6,5,3,1]) + self.assertTrue(not da1.isStrictlyMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,True) + self.assertTrue(not da1.isMonotonic(True)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,True) + self.assertTrue(not da1.isStrictlyMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkStrictlyMonotonic,False) + self.assertTrue(not da1.isMonotonic(False)); + self.assertRaises(InterpKernelException,da1.checkMonotonic,False) + # + da1=DataArrayInt64.New([]) + self.assertTrue(da1.isStrictlyMonotonic(True)); + da1.checkStrictlyMonotonic(True); + self.assertTrue(da1.isMonotonic(True)); + da1.checkMonotonic(True); + self.assertTrue(da1.isStrictlyMonotonic(False)); + da1.checkStrictlyMonotonic(False); + self.assertTrue(da1.isMonotonic(False)); + da1.checkMonotonic(False); + # + da1=DataArrayInt64.New([13]) + self.assertTrue(da1.isStrictlyMonotonic(True)); + da1.checkStrictlyMonotonic(True); + self.assertTrue(da1.isMonotonic(True)); + da1.checkMonotonic(True); + self.assertTrue(da1.isStrictlyMonotonic(False)); + da1.checkStrictlyMonotonic(False); + self.assertTrue(da1.isMonotonic(False)); + da1.checkMonotonic(False); + pass + + def testDAIIndicesOfSubPart(self): + a=DataArrayInt64([9,10,0,6,4,11,3,8]) + b=DataArrayInt64([6,0,11,8]) + c=a.indicesOfSubPart(b) + self.assertTrue(c.isEqual(DataArrayInt([3,2,5,7]))) + # + d=DataArrayInt64([9,10,0,6,4,11,0,8]) + self.assertRaises(InterpKernelException,d.indicesOfSubPart,b) # 0 appears twice in the d array + f=DataArrayInt64([6,0,11,8,12]) + self.assertRaises(InterpKernelException,a.indicesOfSubPart,f) # 12 in f does not exist in a + pass + + def testDAIFromLinkedListOfPairToList1(self): + d=DataArrayInt64([(5,7),(7,3),(3,12),(12,17)]) + zeRes=DataArrayInt64([5,7,3,12,17]) + self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes)) + d.rearrange(1) + self.assertRaises(InterpKernelException,d.fromLinkedListOfPairToList) + d.rearrange(2) + self.assertTrue(d.fromLinkedListOfPairToList().isEqual(zeRes)) + d2=DataArrayInt64([(5,7)]) + self.assertTrue(d2.fromLinkedListOfPairToList().isEqual(DataArrayInt64([5,7]))) + d3=DataArrayInt64([(5,7),(7,3),(4,12),(12,17)]) + self.assertRaises(InterpKernelException,d3.fromLinkedListOfPairToList) # not a linked list of pair + d4=DataArrayInt64([(5,7),(7,3),(12,3),(12,17)]) + self.assertRaises(InterpKernelException,d4.fromLinkedListOfPairToList) # not a linked list of pair, but can be repaired ! + d4.sortEachPairToMakeALinkedList() + self.assertTrue(d4.fromLinkedListOfPairToList().isEqual(zeRes)) + pass + + def testDAIfindIdsExt1(self): + d=DataArrayInt64([4,6,-2,3,7,0,10]) + self.assertTrue(d.findIdsGreaterOrEqualTo(3).isEqual(DataArrayInt([0,1,3,4,6]))) + self.assertTrue(d.findIdsGreaterThan(3).isEqual(DataArrayInt([0,1,4,6]))) + self.assertTrue(d.findIdsLowerThan(3).isEqual(DataArrayInt([2,5]))) + self.assertTrue(d.findIdsLowerOrEqualTo(3).isEqual(DataArrayInt([2,3,5]))) + pass + + def testDAICheckUniformAndGuess1(self): + d=DataArrayInt64([3,3],1,2) + self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non single compo + d=DataArrayInt64([]) + self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# empty + d=DataArrayInt64() + self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non allocated + d=DataArrayInt64([3,3,3]) + self.assertEqual(3,d.checkUniformAndGuess()) + d=DataArrayInt64([7]) + self.assertEqual(7,d.checkUniformAndGuess()) + d=DataArrayInt64([3,4,3]) + self.assertRaises(InterpKernelException,d.checkUniformAndGuess)# non uniform + pass + + def testDAIFindIdForEach1(self): + a1=DataArrayInt64([17,27,2,10,-4,3,12,27,16]) + b1=DataArrayInt64([3,16,-4,27,17]) + ret=a1.findIdForEach(b1) + self.assertTrue(ret.isEqual(DataArrayInt([5,8,4,7,0]))) + self.assertTrue(a1[ret].isEqual(b1)) + b2=DataArrayInt64([3,16,22,27,17]) + self.assertRaises(InterpKernelException,a1.findIdForEach,b2) # 22 not in a1 ! + a1.rearrange(3) + self.assertRaises(InterpKernelException,a1.findIdForEach,b1) # a1 is not single component + pass + + pass + +if __name__ == '__main__': + unittest.main() diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 830a4c888..a79ce8306 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -27,6 +27,7 @@ %{ #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" @@ -60,10 +61,26 @@ using namespace INTERP_KERNEL; %} -%template(ivec) std::vector; %template(dvec) std::vector; %template(svec) std::vector; +//%include stdint.i + +#ifndef MEDCOUPLING_USE_64BIT_IDS +//typedef std::int32_t mcIdType; +typedef int mcIdType; +typedef DataArrayInt32 DataArrayIdType; +%template(ivec) std::vector; +%template(i64vec) std::vector; +#else +//typedef std::int64_t mcIdType; +typedef long int mcIdType; +typedef DataArrayInt64 DataArrayIdType; +%template(ivec) std::vector; +%template(i32vec) std::vector; +#endif + + //////////////////// %typemap(out) MEDCoupling::MEDCouplingMesh* { @@ -499,10 +516,12 @@ using namespace INTERP_KERNEL; {// AGY : here initialization of C++ traits in MEDCouplingDataArrayTypemaps.i for code factorization. Awful, I know, but no other solutions. SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayDouble; SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayFloat; - SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt; + SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt32; + SWIGTITraits::TI=SWIGTYPE_p_MEDCoupling__DataArrayInt64; SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple; SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple; - SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayIntTuple; + SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt32Tuple; + SWIGTITraits::TI_TUPLE=SWIGTYPE_p_MEDCoupling__DataArrayInt64Tuple; } %} @@ -524,9 +543,9 @@ using namespace INTERP_KERNEL; Py_ssize_t sz(sizeof(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER)/sizeof(decltype(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[0]))); auto maxElt(*std::max_element(MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER,MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz)); auto szOut(maxElt+1); - std::vector< int > retCpp(szOut,-1); + std::vector< mcIdType > retCpp(szOut,-1); mcIdType id(0); - for(const int *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++) + for(const mcIdType *it=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER;it!=MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER+sz;it++,id++) { if(*it!=-1) retCpp[*it]=id; @@ -603,7 +622,8 @@ namespace MEDCoupling IMAGE_GRID = 12 } MEDCouplingMeshType; - class DataArrayInt; + class DataArrayInt32; + class DataArrayInt64; class DataArrayDouble; class MEDCouplingUMesh; class MEDCouplingCMesh; @@ -663,10 +683,10 @@ namespace MEDCoupling virtual DataArrayDouble *getCoordinatesAndOwner() const; virtual DataArrayDouble *computeCellCenterOfMass() const; virtual DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; - virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; - virtual DataArrayInt *computeNbOfNodesPerCell() const; - virtual DataArrayInt *computeNbOfFacesPerCell() const; - virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const; + virtual DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + virtual DataArrayIdType *computeNbOfNodesPerCell() const; + virtual DataArrayIdType *computeNbOfFacesPerCell() const; + virtual DataArrayIdType *computeEffectiveNbOfNodesPerCell() const; virtual MEDCouplingMesh *buildPartRange(int beginCellIds, int endCellIds, int stepCellIds) const; virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; @@ -685,8 +705,8 @@ namespace MEDCoupling virtual MEDCouplingUMesh *buildUnstructured() const; virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const; virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; - virtual DataArrayInt *simplexize(int policy); - virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); + virtual DataArrayIdType *simplexize(int policy); + virtual void unserialization(const std::vector& tinyInfoD, const std::vector& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector& littleStrings); static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); static bool IsStaticGeometricType(INTERP_KERNEL::NormalizedCellType type); static bool IsLinearGeometricType(INTERP_KERNEL::NormalizedCellType type); @@ -721,13 +741,13 @@ namespace MEDCoupling return ret2; } - int getCellContainingPoint(PyObject *p, double eps) const + mcIdType getCellContainingPoint(PyObject *p, double eps) const { double val; DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -740,15 +760,15 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPoints(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -758,27 +778,27 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingMesh::getCellsContainingPointsLinearPartOnlyOnNonDynType : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); - MCAuto elts,eltsIndex; + MCAuto elts,eltsIndex; self->getCellsContainingPointsLinearPartOnlyOnNonDynType(pos,nbOfPoints,eps,elts,eltsIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getCellsContainingPoints(PyObject *p, double eps) const { - auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPoints(a,b,c,d,e); }; + auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPoints(a,b,c,d,e); }; return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc); } PyObject *getCellsContainingPointsLinearPartOnlyOnNonDynType(PyObject *p, double eps) const { - auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); }; + auto getCellsContainingPointsFunc=[self](const double *a, int b,double c, MCAuto& d, MCAuto& e) { self->getCellsContainingPointsLinearPartOnlyOnNonDynType(a,b,c,d,e); }; return Mesh_getCellsContainingPointsLike(p,eps,self,getCellsContainingPointsFunc); } @@ -788,91 +808,91 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::getCellsContainingPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(p,sw,val,a,aa,bb,msg,1,spaceDim,true); - std::vector elts; + std::vector elts; self->getCellsContainingPoint(pos,eps,elts); - DataArrayInt *ret=DataArrayInt::New(); + DataArrayIdType *ret=DataArrayIdType::New(); ret->alloc((int)elts.size(),1); std::copy(elts.begin(),elts.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } virtual PyObject *getReverseNodalConnectivity() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); self->getReverseNodalConnectivity(d0,d1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } void renumberCells(PyObject *li, bool check=true) { - int sw,sz(-1); - int v0; std::vector v1; - const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); self->renumberCells(ids,check); } PyObject *checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec) const { - DataArrayInt *cellCor, *nodeCor; + DataArrayIdType *cellCor, *nodeCor; self->checkGeoEquivalWith(other,levOfCheck,prec,cellCor,nodeCor); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits::TI, cellCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits::TI, nodeCor?SWIG_POINTER_OWN | 0:0 )); return res; } PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const { - DataArrayInt *cellCor=0,*nodeCor=0; + DataArrayIdType *cellCor=0,*nodeCor=0; self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_MEDCoupling__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTITraits::TI, cellCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTITraits::TI, nodeCor?SWIG_POINTER_OWN | 0:0 )); return res; } - DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const + DataArrayIdType *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const { - DataArrayInt *cellCor=0; + DataArrayIdType *cellCor=0; self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor); return cellCor; } - DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const + DataArrayIdType *getCellIdsFullyIncludedInNodeIds(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->getCellIdsFullyIncludedInNodeIds(tmp,((const int *)tmp)+size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->getCellIdsFullyIncludedInNodeIds(tmp,((const mcIdType *)tmp)+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); return self->getCellIdsFullyIncludedInNodeIds(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); } } PyObject *getNodeIdsOfCell(int cellId) const { - std::vector conn; + std::vector conn; self->getNodeIdsOfCell(cellId,conn); return convertIntArrToPyList2(conn); } - PyObject *getCoordinatesOfNode(int nodeId) const + PyObject *getCoordinatesOfNode(mcIdType nodeId) const { std::vector coo; self->getCoordinatesOfNode(nodeId,coo); @@ -885,7 +905,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::scale : "; const double *pointPtr=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -915,14 +935,14 @@ namespace MEDCoupling PyObject *buildPart(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingMesh *ret=self->buildPart(tmp,tmp+szArr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -932,15 +952,15 @@ namespace MEDCoupling PyObject *buildPartAndReduceNodes(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - DataArrayInt *arr=0; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + DataArrayIdType *arr=0; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingMesh *ret=self->buildPartAndReduceNodes(tmp,tmp+szArr,arr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -948,22 +968,22 @@ namespace MEDCoupling // PyObject *res = PyList_New(2); PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 ); - PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + PyObject *obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); PyList_SetItem(res,0,obj0); PyList_SetItem(res,1,obj1); return res; } - PyObject *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds) const + PyObject *buildPartRangeAndReduceNodes(mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds) const { - int a,b,c; - DataArrayInt *arr=0; + mcIdType a,b,c; + DataArrayIdType *arr=0; MEDCouplingMesh *ret=self->buildPartRangeAndReduceNodes(beginCellIds,endCellIds,stepCellIds,a,b,c,arr); PyObject *res = PyTuple_New(2); PyObject *obj0=convertMesh(ret, SWIG_POINTER_OWN | 0 ); PyObject *obj1=0; if(arr) - obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + obj1=SWIG_NewPointerObj(SWIG_as_voidptr(arr),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); else obj1=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(b)); PyTuple_SetItem(res,0,obj0); @@ -973,59 +993,59 @@ namespace MEDCoupling PyObject *getDistributionOfTypes() const { - std::vector vals=self->getDistributionOfTypes(); + std::vector vals=self->getDistributionOfTypes(); if(vals.size()%3!=0) throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::getDistributionOfTypes is not so that %3==0 !"); - PyObject *ret=PyList_New((int)vals.size()/3); - for(int j=0;j<(int)vals.size()/3;j++) + PyObject *ret=PyList_New((mcIdType)vals.size()/3); + for(std::size_t j=0;j code; - std::vector idsPerType; - convertFromPyObjVectorOfObj(li2,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",idsPerType); + std::vector code; + std::vector idsPerType; + convertFromPyObjVectorOfObj(li2,SWIGTITraits::TI,"DataArrayIdType",idsPerType); convertPyToNewIntArr4(li,1,3,code); return self->checkTypeConsistencyAndContig(code,idsPerType); } - PyObject *splitProfilePerType(const DataArrayInt *profile, bool smartPflKiller=true) const + PyObject *splitProfilePerType(const DataArrayIdType *profile, bool smartPflKiller=true) const { - std::vector code; - std::vector idsInPflPerType; - std::vector idsPerType; + std::vector code; + std::vector idsInPflPerType; + std::vector idsPerType; self->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); PyObject *ret=PyTuple_New(3); // if(code.size()%3!=0) throw INTERP_KERNEL::Exception("Internal Error detected in wrap python ! code returned by MEDCouplingMesh::splitProfilePerType is not so that %3==0 !"); - PyObject *ret0=PyList_New((int)code.size()/3); - for(int j=0;j<(int)code.size()/3;j++) + PyObject *ret0=PyList_New((mcIdType)code.size()/3); + for(std::size_t j=0;j::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1); - int n=idsPerType.size(); + std::size_t n=idsPerType.size(); PyObject *ret2=PyList_New(n); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,ret2); return ret; } @@ -1036,7 +1056,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::translate : "; const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -1050,7 +1070,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true); self->rotate(centerPtr,0,alpha); @@ -1063,7 +1083,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,spaceDim,false);//vectorPtr can be null in case of space dim 2 @@ -1083,16 +1103,16 @@ namespace MEDCoupling virtual PyObject *getTinySerializationInformation() const { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; self->getTinySerializationInformation(a0,a1,a2); PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1)); - int sz(a2.size()); + std::size_t sz(a2.size()); PyObject *ret2(PyList_New(sz)); { - for(int i=0;iserialize(a0Tmp,a1Tmp); PyObject *ret(PyTuple_New(2)); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(a0Tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(a1Tmp),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); return ret; } - void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2) const + void resizeForUnserialization(const std::vector& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2) const { std::vector littleStrings; self->resizeForUnserialization(tinyInfo,a1,a2,littleStrings); @@ -1131,21 +1151,21 @@ namespace MEDCoupling static const char MSG[]="MEDCouplingMesh.__setstate__ : expected input is a tuple of size 2 !"; if(!PyTuple_Check(inp)) throw INTERP_KERNEL::Exception(MSG); - int sz(PyTuple_Size(inp)); + std::size_t sz(PyTuple_Size(inp)); if(sz!=2) throw INTERP_KERNEL::Exception(MSG); PyObject *elt0(PyTuple_GetItem(inp,0)); PyObject *elt1(PyTuple_GetItem(inp,1)); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - DataArrayInt *b0(0); + DataArrayIdType *b0(0); DataArrayDouble *b1(0); { if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3) throw INTERP_KERNEL::Exception(MSG); PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -1155,10 +1175,10 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception(MSG); PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1)); void *argp(0); - int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0)); + int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits::TI,0|0)); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); - b0=reinterpret_cast(argp); + b0=reinterpret_cast(argp); status=SWIG_ConvertPtr(b1py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); @@ -1248,10 +1268,10 @@ namespace MEDCoupling class MEDCouplingSkyLineArray { public: - static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayInt* c, const DataArrayInt* cI ); + static MEDCouplingSkyLineArray *BuildFromPolyhedronConn( const DataArrayIdType* c, const DataArrayIdType* cI ); - void set( DataArrayInt* index, DataArrayInt* value ); - void set3( DataArrayInt* superIndex, DataArrayInt* index, DataArrayInt* value ); + void set( DataArrayIdType* index, DataArrayIdType* value ); + void set3( DataArrayIdType* superIndex, DataArrayIdType* index, DataArrayIdType* value ); int getSuperNumberOf() const; int getNumberOf() const; @@ -1260,7 +1280,7 @@ namespace MEDCoupling void deletePack(const int i, const int j); void deleteSimplePack(const int i); - void deleteSimplePacks(const DataArrayInt* idx); + void deleteSimplePacks(const DataArrayIdType* idx); %extend { @@ -1269,12 +1289,12 @@ namespace MEDCoupling return MEDCouplingSkyLineArray::New(); } - MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value) + MEDCouplingSkyLineArray( const std::vector& index, const std::vector& value) { return MEDCouplingSkyLineArray::New(index, value); } - MEDCouplingSkyLineArray( DataArrayInt* index, DataArrayInt* value ) + MEDCouplingSkyLineArray( DataArrayIdType* index, DataArrayIdType* value ) { return MEDCouplingSkyLineArray::New(index, value); } @@ -1289,40 +1309,40 @@ namespace MEDCoupling return self->simpleRepr(); } - DataArrayInt *getSuperIndexArray() const + DataArrayIdType *getSuperIndexArray() const { - DataArrayInt *ret(self->getSuperIndexArray()); + DataArrayIdType *ret(self->getSuperIndexArray()); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getIndexArray() const + DataArrayIdType *getIndexArray() const { - DataArrayInt *ret(self->getIndexArray()); + DataArrayIdType *ret(self->getIndexArray()); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getValuesArray() const + DataArrayIdType *getValuesArray() const { - DataArrayInt *ret(self->getValuesArray()); + DataArrayIdType *ret(self->getValuesArray()); if(ret) ret->incrRef(); return ret; } - PyObject *getSimplePackSafe(int absolutePackId) const + PyObject *getSimplePackSafe(mcIdType absolutePackId) const { - std::vector ret; + std::vector ret; self->getSimplePackSafe(absolutePackId,ret); return convertIntArrToPyList2(ret); } PyObject *findPackIds(PyObject *superPackIndices, PyObject *pack) const { - std::vector vpack, vspIdx, out; + std::vector vpack, vspIdx, out; convertPyToNewIntArr3(superPackIndices,vspIdx); convertPyToNewIntArr3(pack,vpack); @@ -1331,42 +1351,42 @@ namespace MEDCoupling return convertIntArrToPyList2(out); } - void pushBackPack(const int i, PyObject *pack) + void pushBackPack(const mcIdType i, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->pushBackPack(i,vpack.data(), vpack.data()+vpack.size()); } - void replaceSimplePack(const int idx, PyObject *pack) + void replaceSimplePack(const mcIdType idx, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->replaceSimplePack(idx, vpack.data(), vpack.data()+vpack.size()); } - void replaceSimplePacks(const DataArrayInt* idx, PyObject *listePacks) + void replaceSimplePacks(const DataArrayIdType* idx, PyObject *listePacks) { - std::vector packs; - convertFromPyObjVectorOfObj(listePacks,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",packs); + std::vector packs; + convertFromPyObjVectorOfObj(listePacks,SWIGTITraits::TI,"DataArrayIdType",packs); self->replaceSimplePacks(idx, packs); } - void replacePack(const int superIdx, const int idx, PyObject *pack) + void replacePack(const mcIdType superIdx, const mcIdType idx, PyObject *pack) { - std::vector vpack; + std::vector vpack; convertPyToNewIntArr3(pack,vpack); self->replacePack(superIdx, idx, vpack.data(), vpack.data()+vpack.size()); } PyObject *convertToPolyhedronConn() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); self->convertToPolyhedronConn(d0,d1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -1395,17 +1415,17 @@ namespace MEDCoupling virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon); static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type); - static DataArrayInt *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); - virtual DataArrayInt *computeFetchedNodeIds() const; + static DataArrayIdType *ComputeNbOfInteractionsWithSrcCells(const MEDCouplingPointSet *srcMesh, const MEDCouplingPointSet *trgMesh, double eps); + virtual DataArrayIdType *computeFetchedNodeIds() const; virtual int getNumberOfNodesInCell(int cellId) const; virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const; - virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); - virtual DataArrayInt *zipCoordsTraducer(); - virtual DataArrayInt *findBoundaryNodes() const; - virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0); + virtual DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps); + virtual DataArrayIdType *zipCoordsTraducer(); + virtual DataArrayIdType *findBoundaryNodes() const; + virtual DataArrayIdType *zipConnectivityTraducer(int compType, int startCellId=0); virtual MEDCouplingPointSet *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const; virtual void checkFullyDefined() const; - virtual bool isEmptyMesh(const std::vector& tinyInfo) const; + virtual bool isEmptyMesh(const std::vector& tinyInfo) const; virtual MEDCouplingPointSet *deepCopyConnectivityOnly() const; virtual DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const; virtual void renumberNodesWithOffsetInConn(int offset); @@ -1419,23 +1439,23 @@ namespace MEDCoupling return self->simpleRepr(); } - PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayInt *comm, const DataArrayInt *commIndex) const + PyObject *buildNewNumberingFromCommonNodesFormat(const DataArrayIdType *comm, const DataArrayIdType *commIndex) const { - int newNbOfNodes; - DataArrayInt *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *ret0=self->buildNewNumberingFromCommonNodesFormat(comm,commIndex,newNbOfNodes); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_From_int(newNbOfNodes)); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,PyInt_FromLong(newNbOfNodes)); return res; } - PyObject *findCommonNodes(double prec, int limitTupleId=-1) const + PyObject *findCommonNodes(double prec, mcIdType limitTupleId=-1) const { - DataArrayInt *comm, *commIndex; + DataArrayIdType *comm, *commIndex; self->findCommonNodes(prec,limitTupleId,comm,commIndex); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1449,14 +1469,14 @@ namespace MEDCoupling PyObject *buildPartOfMySelf(PyObject *li, bool keepCoords=true) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelf(tmp,tmp+szArr,keepCoords); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1466,14 +1486,14 @@ namespace MEDCoupling PyObject *buildPartOfMySelfNode(PyObject *li, bool fullyIn) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelfNode(tmp,tmp+szArr,fullyIn); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1483,14 +1503,14 @@ namespace MEDCoupling virtual PyObject *buildPartOfMySelfKeepCoords(PyObject *li) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoords(tmp,tmp+szArr); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1498,7 +1518,7 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - virtual PyObject *buildPartOfMySelfKeepCoordsSlice(int start, int end, int step) const + virtual PyObject *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const { MEDCouplingPointSet *ret=self->buildPartOfMySelfKeepCoordsSlice(start,end,step); return convertMesh(ret, SWIG_POINTER_OWN | 0 ); @@ -1506,14 +1526,14 @@ namespace MEDCoupling PyObject *buildFacePartOfMySelfNode(PyObject *li, bool fullyIn) const { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); MEDCouplingPointSet *ret=self->buildFacePartOfMySelfNode(tmp,tmp+szArr,fullyIn); - if(sw==3)//DataArrayInt + if(sw==3)//DataArrayIdType { - void *argp; SWIG_ConvertPtr(li,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); - DataArrayInt *argpt=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + void *argp; SWIG_ConvertPtr(li,&argp,SWIGTITraits::TI,0|0); + DataArrayIdType *argpt=reinterpret_cast< MEDCoupling::DataArrayIdType * >(argp); std::string name=argpt->getName(); if(!name.empty()) ret->setName(name.c_str()); @@ -1521,19 +1541,19 @@ namespace MEDCoupling return convertMesh(ret, SWIG_POINTER_OWN | 0 ); } - void renumberNodes(PyObject *li, int newNbOfNodes) + void renumberNodes(PyObject *li, mcIdType newNbOfNodes) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodes(tmp,newNbOfNodes); } - void renumberNodesCenter(PyObject *li, int newNbOfNodes) + void renumberNodesCenter(PyObject *li, mcIdType newNbOfNodes) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodesCenter(tmp,newNbOfNodes); } @@ -1544,17 +1564,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 1st parameter for point."; const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnLine : 2nd parameter for vector."; const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); - std::vector nodes; + std::vector nodes; self->findNodesOnLine(p,v,eps,nodes); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)nodes.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(nodes.size(),1); std::copy(nodes.begin(),nodes.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *findNodesOnPlane(PyObject *pt, PyObject *vec, double eps) const { @@ -1563,17 +1583,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 1st parameter for point."; const char msg2[]="Python wrap of MEDCouplingPointSet::findNodesOnPlane : 2nd parameter for vector."; const double *p=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); - std::vector nodes; + std::vector nodes; self->findNodesOnPlane(p,v,eps,nodes); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)nodes.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(nodes.size(),1); std::copy(nodes.begin(),nodes.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const @@ -1582,49 +1602,49 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : "; const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true); - DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + DataArrayIdType *ret=self->getNodeIdsNearPoint(pos,eps); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } - PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfPoints, double eps) const + PyObject *getNodeIdsNearPoints(PyObject *pt, mcIdType nbOfPoints, double eps) const { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; // double val; DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoints : "; const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfPoints,spaceDim,true); self->getNodeIdsNearPoints(pos,nbOfPoints,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; int spaceDim=self->getSpaceDimension(); double val; DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int nbOfTuples=-1; + mcIdType sw; + mcIdType nbOfTuples=-1; const double *ptPtr=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::getNodeIdsNearPoints",spaceDim,true,nbOfTuples); self->getNodeIdsNearPoints(ptPtr,nbOfTuples,eps,c,cI); // PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1634,22 +1654,22 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingPointSet::getCellsInBoundingBox : "; const double *tmp=convertObjToPossibleCpp5_Safe(bbox,sw,val,a,aa,bb,msg,spaceDim,2,true); // - DataArrayInt *elems=self->getCellsInBoundingBox(tmp,eps); - return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + DataArrayIdType *elems=self->getCellsInBoundingBox(tmp,eps); + return SWIG_NewPointerObj(SWIG_as_voidptr(elems),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } void duplicateNodesInCoords(PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -1660,17 +1680,17 @@ namespace MEDCoupling case 4: return self->duplicateNodesInCoords(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingPointSet::duplicateNodesInCoords : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } - virtual PyObject *findCommonCells(int compType, int startCellId=0) const + virtual PyObject *findCommonCells(int compType, mcIdType startCellId=0) const { - DataArrayInt *v0(nullptr),*v1(nullptr); + DataArrayIdType *v0(nullptr),*v1(nullptr); self->findCommonCells(compType,startCellId,v0,v1); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1687,18 +1707,18 @@ namespace MEDCoupling return ; } } - int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 )); + int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 )); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); self->renumberNodesInConn(tmp); } else { - DataArrayInt *da2(reinterpret_cast< DataArrayInt * >(da)); + DataArrayIdType *da2(reinterpret_cast< DataArrayIdType * >(da)); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->renumberNodesInConn(da2->getConstPointer()); } @@ -1706,21 +1726,21 @@ namespace MEDCoupling virtual PyObject *getNodeIdsInUse() const { - int ret1=-1; - DataArrayInt *ret0=self->getNodeIdsInUse(ret1); + mcIdType ret1=-1; + DataArrayIdType *ret0=self->getNodeIdsInUse(ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,PyInt_FromLong(ret1)); return ret; } - virtual DataArrayInt *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const + virtual DataArrayIdType *fillCellIdsToKeepFromNodeIds(PyObject *li, bool fullyIn) const { - DataArrayInt *ret(nullptr); + DataArrayIdType *ret(nullptr); // - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->fillCellIdsToKeepFromNodeIds(tmp,tmp+szArr,fullyIn,ret); return ret; } @@ -1728,42 +1748,42 @@ namespace MEDCoupling virtual PyObject *mergeNodes(double precision) { bool ret1; - int ret2; - DataArrayInt *ret0=self->mergeNodes(precision,ret1,ret2); + mcIdType ret2; + DataArrayIdType *ret0=self->mergeNodes(precision,ret1,ret2); PyObject *res = PyList_New(3); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); - PyList_SetItem(res,2,SWIG_From_int(ret2)); + PyList_SetItem(res,2,PyInt_FromLong(ret2)); return res; } virtual PyObject *mergeNodesCenter(double precision) { bool ret1; - int ret2; - DataArrayInt *ret0=self->mergeNodesCenter(precision,ret1,ret2); + mcIdType ret2; + DataArrayIdType *ret0=self->mergeNodesCenter(precision,ret1,ret2); PyObject *res = PyList_New(3); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(res,1,SWIG_From_bool(ret1)); - PyList_SetItem(res,2,SWIG_From_int(ret2)); + PyList_SetItem(res,2,PyInt_FromLong(ret2)); return res; } - DataArrayInt *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const + DataArrayIdType *getCellIdsLyingOnNodes(PyObject *li, bool fullyIn) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->getCellIdsLyingOnNodes(tmp,((const int *)tmp)+size,fullyIn); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + return self->getCellIdsLyingOnNodes(tmp,((const mcIdType *)tmp)+size,fullyIn); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); return self->getCellIdsLyingOnNodes(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),fullyIn); } @@ -1771,12 +1791,12 @@ namespace MEDCoupling MEDCouplingPointSet *__getitem__(PyObject *listOrDataArrI) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(listOrDataArrI,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -1794,7 +1814,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; return self->buildPartOfMySelf(&tmp,&tmp+1,true); } else @@ -1821,25 +1841,25 @@ namespace MEDCoupling return self->buildPartOfMySelf(daIntTyypp->begin(),daIntTyypp->end(),true); } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__getitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } - static void Rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) + static void Rotate2DAlg(PyObject *center, double angle, mcIdType nbNodes, PyObject *coords) { - int sz; + mcIdType sz; INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,coo); - for(int i=0;i c=convertPyToNewDblArr2(center,&sz); - int sw,nbNodes=0; + mcIdType sw,nbNodes=0; double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0; std::vector val3; const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3, @@ -1849,22 +1869,22 @@ namespace MEDCoupling MEDCoupling::DataArrayDouble::Rotate2DAlg(c,angle,nbNodes,coo,const_cast(coo)); } - static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, int nbNodes, PyObject *coords) + static void Rotate3DAlg(PyObject *center, PyObject *vect, double angle, mcIdType nbNodes, PyObject *coords) { - int sz,sz2; + mcIdType sz,sz2; INTERP_KERNEL::AutoCPtr c=convertPyToNewDblArr2(center,&sz); INTERP_KERNEL::AutoCPtr coo=convertPyToNewDblArr2(coords,&sz); INTERP_KERNEL::AutoCPtr v=convertPyToNewDblArr2(vect,&sz2); MEDCoupling::DataArrayDouble::Rotate3DAlg(c,v,angle,nbNodes,coo,coo); - for(int i=0;i c=convertPyToNewDblArr2(center,&sz); - int sw,nbNodes=0; + mcIdType sw,nbNodes=0; double val0; MEDCoupling::DataArrayDouble *val1=0; MEDCoupling::DataArrayDoubleTuple *val2=0; std::vector val3; const double *coo=convertObjToPossibleCpp5_Safe2(coords,sw,val0,val1,val2,val3, @@ -1892,10 +1912,10 @@ namespace MEDCoupling PyObject *getAllConn() const { - int ret2; - const int *r=self->getAllConn(ret2); + mcIdType ret2; + const mcIdType *r=self->getAllConn(ret2); PyObject *ret=PyTuple_New(ret2); - for(int i=0;i getQuadraticStatus() const; - DataArrayInt *findCellIdsOnBoundary() const; + DataArrayIdType *findCellIdsOnBoundary() const; MEDCouplingUMesh *computeSkin() const; bool checkConsecutiveCellTypes() const; bool checkConsecutiveCellTypesForMEDFileFrmt() const; - DataArrayInt *rearrange2ConsecutiveCellTypes(); - DataArrayInt *sortCellsInMEDFileFrmt(); - DataArrayInt *getRenumArrForMEDFileFrmt() const; - DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const; - MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; - MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const; + DataArrayIdType *rearrange2ConsecutiveCellTypes(); + DataArrayIdType *sortCellsInMEDFileFrmt(); + DataArrayIdType *getRenumArrForMEDFileFrmt() const; + DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const; + MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; + MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const; void orientCorrectlyPolyhedrons(); bool isPresenceOfQuadratic() const; bool isFullyQuadratic() const; @@ -2013,9 +2033,9 @@ namespace MEDCoupling bool isContiguous1D() const; void tessellate2D(double eps); void convertQuadraticCellsToLinear(); - DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0); + DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0); void convertDegeneratedCells(); - DataArrayInt *convertDegeneratedCellsAndRemoveFlatOnes(); + DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes(); bool removeDegenerated1DCells(); bool areOnlySimplexCells() const; MEDCouplingFieldDouble *getEdgeRatioField() const; @@ -2023,27 +2043,27 @@ namespace MEDCoupling MEDCouplingFieldDouble *getWarpField() const; MEDCouplingFieldDouble *getSkewField() const; DataArrayDouble *computePlaneEquationOf3DFaces() const; - DataArrayInt *convexEnvelop2D(); + DataArrayIdType *convexEnvelop2D(); std::string cppRepr() const; - DataArrayInt *findAndCorrectBadOriented3DExtrudedCells(); - DataArrayInt *findAndCorrectBadOriented3DCells(); + DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells(); + DataArrayIdType *findAndCorrectBadOriented3DCells(); MEDCoupling::MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const; MEDCouplingSkyLineArray *generateGraph() const; - DataArrayInt *convertNodalConnectivityToStaticGeoTypeMesh() const; - DataArrayInt *buildUnionOf2DMesh() const; - DataArrayInt *buildUnionOf3DMesh() const; - DataArrayInt *orderConsecutiveCells1D() const; + DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const; + DataArrayIdType *buildUnionOf2DMesh() const; + DataArrayIdType *buildUnionOf3DMesh() const; + DataArrayIdType *orderConsecutiveCells1D() const; DataArrayDouble *getBoundingBoxForBBTreeFast() const; DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const; DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const; void changeOrientationOfCells(); DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps); - int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0); + int split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0); static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da); static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2); - static DataArrayInt *ComputeSpreadZoneGradually(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn); - static DataArrayInt *ComputeRangesFromTypeDistribution(const std::vector& code); + static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn); + static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector& code); %extend { MEDCouplingUMesh() { @@ -2090,12 +2110,12 @@ namespace MEDCoupling void setPartOfMySelf(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2116,7 +2136,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis); break; } @@ -2142,18 +2162,18 @@ namespace MEDCoupling break; } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::setPartOfMySelf : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } void __setitem__(PyObject *li, const MEDCouplingUMesh& otherOnSameCoordsThanThis) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbc=self->getNumberOfCells(); + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbc=self->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2174,7 +2194,7 @@ namespace MEDCoupling { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; self->setPartOfMySelf(&tmp,&tmp+1,otherOnSameCoordsThanThis); break; } @@ -2205,15 +2225,15 @@ namespace MEDCoupling break; } default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::__setitem__ : unrecognized type in input ! Possibilities are : int, list or tuple of int, slice, DataArrayIdType instance !"); } } - void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, PyObject *li) + void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); if(size>szArr) { std::ostringstream oss; oss << "Wrap of MEDCouplingUMesh::insertNextCell : request of connectivity with length " << size << " whereas the length of input is " << szArr << " !"; @@ -2224,47 +2244,47 @@ namespace MEDCoupling void insertNextCell(INTERP_KERNEL::NormalizedCellType type, PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->insertNextCell(type,szArr,tmp); } - DataArrayInt *getNodalConnectivity() + DataArrayIdType *getNodalConnectivity() { - DataArrayInt *ret=self->getNodalConnectivity(); + DataArrayIdType *ret=self->getNodalConnectivity(); if(ret) ret->incrRef(); return ret; } - DataArrayInt *getNodalConnectivityIndex() + DataArrayIdType *getNodalConnectivityIndex() { - DataArrayInt *ret=self->getNodalConnectivityIndex(); + DataArrayIdType *ret=self->getNodalConnectivityIndex(); if(ret) ret->incrRef(); return ret; } - static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, int nbOfDepthPeeling=-1) + static PyObject *ComputeSpreadZoneGraduallyFromSeed(PyObject *seed, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling=-1) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr); - int nbOfDepthPeelingPerformed=0; - DataArrayInt *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *seedPtr=convertIntStarLikePyObjToCppIntStar(seed,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType nbOfDepthPeelingPerformed=0; + DataArrayIdType *ret0=MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeed(seedPtr,seedPtr+szArr,arrIn,arrIndxIn,nbOfDepthPeeling,nbOfDepthPeelingPerformed); PyObject *res=PyTuple_New(2); - PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(res,1,PyInt_FromLong(nbOfDepthPeelingPerformed)); return res; } - static PyObject *FindCommonCellsAlg(int compType, int startCellId, const DataArrayInt *nodal, const DataArrayInt *nodalI, const DataArrayInt *revNodal, const DataArrayInt *revNodalI) + static PyObject *FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI) { - DataArrayInt *v0=0,*v1=0; + DataArrayIdType *v0=0,*v1=0; MEDCouplingUMesh::FindCommonCellsAlg(compType,startCellId,nodal,nodalI,revNodal,revNodalI,v0,v1); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -2274,11 +2294,11 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int nbOfCompo=self->getSpaceDimension(); const double *pt=convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,"Python wrap of MEDCouplingUMesh::distanceToPoint",1,nbOfCompo,true); // - int cellId=-1; + mcIdType cellId=-1; double ret0=self->distanceToPoint(pt,pt+nbOfCompo,cellId); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0)); @@ -2288,118 +2308,118 @@ namespace MEDCoupling PyObject *distanceToPoints(const DataArrayDouble *pts) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->distanceToPoints(pts,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *tetrahedrize(int policy) { - int ret2(-1); - DataArrayInt *ret1(0); + mcIdType ret2(-1); + DataArrayIdType *ret1(0); MEDCoupling1SGTUMesh *ret0(self->tetrahedrize(policy,ret1,ret2)); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCoupling1SGTUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,PyInt_FromLong(ret2)); return ret; } PyObject *checkButterflyCells(double eps=1e-12) { - std::vector cells; + std::vector cells; self->checkButterflyCells(cells,eps); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *splitByType() const { std::vector ms=self->splitByType(); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *ret = PyList_New(sz); - for(int i=0;i retCpp=self->partitionBySpreadZone(); - int sz=retCpp.size(); + std::vector retCpp=self->partitionBySpreadZone(); + std::size_t sz=retCpp.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); return ret; } - static PyObject *PartitionBySpreadZone(const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) + static PyObject *PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn) { - std::vector retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn)); - int sz=retCpp.size(); + std::vector retCpp(MEDCouplingUMesh::PartitionBySpreadZone(arrIn,arrIndxIn)); + std::size_t sz=retCpp.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, PyObject *ids) const { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(ids,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(ids,&size); MEDCouplingUMesh *ret=self->keepSpecifiedCells(type,tmp,tmp+size); return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 ); } bool checkConsecutiveCellTypesAndOrder(PyObject *li) const { - int sz; - INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); + mcIdType sz; + INTERP_KERNEL::AutoPtr order=convertPyToNewIntArr2(li,&sz); bool ret=self->checkConsecutiveCellTypesAndOrder(order,order+sz); return ret; } - DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const + DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(PyObject *li) const { - int sz; - INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); - DataArrayInt *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz); + mcIdType sz; + INTERP_KERNEL::AutoPtr order=convertPyToNewIntArr2(li,&sz); + DataArrayIdType *ret=self->getRenumArrForConsecutiveCellTypesSpec(order,(INTERP_KERNEL::NormalizedCellType *)order+sz); return ret; } PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const { - DataArrayInt *tmp0=0,*tmp1=0,*tmp2=0; + DataArrayIdType *tmp0=0,*tmp1=0,*tmp2=0; self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1,tmp2); PyObject *ret=PyTuple_New(3); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(tmp2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const { - DataArrayInt *tmp0=0,*tmp1=0; + DataArrayIdType *tmp0=0,*tmp1=0; self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } void duplicateNodes(PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2410,17 +2430,17 @@ namespace MEDCoupling case 4: return self->duplicateNodes(daIntTyypp->begin(),daIntTyypp->end()); default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodes : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } - void duplicateNodesInConn(PyObject *li, int offset) + void duplicateNodesInConn(PyObject *li, mcIdType offset) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCpp(li,self->getNumberOfNodes(),sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2431,37 +2451,37 @@ namespace MEDCoupling case 4: return self->duplicateNodesInConn(daIntTyypp->begin(),daIntTyypp->end(),offset); default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::duplicateNodesInConn : unrecognized type entered, expected list of int, tuple of int or DataArrayIdType !"); } } void attractSeg3MidPtsAroundNodes(double ratio, PyObject *nodeIds) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *nodeIdsPtr(convertIntStarLikePyObjToCppIntStar(nodeIds,sw,szArr,iTypppArr,stdvecTyyppArr)); self->attractSeg3MidPtsAroundNodes(ratio,nodeIdsPtr,nodeIdsPtr+szArr); } PyObject *getLevArrPerCellTypes(PyObject *li) const { - int sz; - INTERP_KERNEL::AutoPtr order=(INTERP_KERNEL::NormalizedCellType *)convertPyToNewIntArr2(li,&sz); - DataArrayInt *tmp0,*tmp1=0; + mcIdType sz; + INTERP_KERNEL::AutoPtr order=convertPyToNewIntArr2(li,&sz); + DataArrayIdType *tmp0,*tmp1=0; tmp0=self->getLevArrPerCellTypes(order,(INTERP_KERNEL::NormalizedCellType *)order+sz,tmp1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *convertNodalConnectivityToDynamicGeoTypeMesh() const { - DataArrayInt *ret0=0,*ret1=0; + DataArrayIdType *ret0=0,*ret1=0; self->convertNodalConnectivityToDynamicGeoTypeMesh(ret0,ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2469,12 +2489,12 @@ namespace MEDCoupling { std::vector meshes; convertFromPyObjVectorOfObj(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes); - DataArrayInt *ret1=0,*ret2=0; + DataArrayIdType *ret1=0,*ret2=0; MEDCouplingUMesh *ret0=MEDCouplingUMesh::AggregateSortedByTypeMeshesOnSameCoords(meshes,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2488,15 +2508,15 @@ namespace MEDCoupling static PyObject *FuseUMeshesOnSameCoords(PyObject *ms, int compType) { - int sz; + std::size_t sz; std::vector meshes; convertFromPyObjVectorOfObj(ms,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",meshes); - std::vector corr; + std::vector corr; MEDCouplingUMesh *um=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,compType,corr); sz=corr.size(); PyObject *ret1=PyList_New(sz); - for(int i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyObject *ret=PyList_New(2); PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(um),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); PyList_SetItem(ret,1,ret1); @@ -2523,17 +2543,17 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::are2DCellsNotCorrectlyOriented : "; const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true); // - std::vector cells; + std::vector cells; self->are2DCellsNotCorrectlyOriented(v,polyOnly,cells); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } void orientCorrectly2DCells(PyObject *vec, bool polyOnly) @@ -2542,7 +2562,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; int spaceDim=self->getSpaceDimension(); const char msg[]="Python wrap of MEDCouplingUMesh::orientCorrectly2DCells : "; const double *v=convertObjToPossibleCpp5_Safe(vec,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -2551,12 +2571,12 @@ namespace MEDCoupling PyObject *arePolyhedronsNotCorrectlyOriented() const { - std::vector cells; + std::vector cells; self->arePolyhedronsNotCorrectlyOriented(cells); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)cells.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(cells.size(),1); std::copy(cells.begin(),cells.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getFastAveragePlaneOfThis() const @@ -2579,200 +2599,200 @@ namespace MEDCoupling PyObject *areCellsIncludedIn(const MEDCouplingUMesh *other, int compType) const { - DataArrayInt *ret1; + DataArrayIdType *ret1; bool ret0=self->areCellsIncludedIn(other,compType,ret1); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *areCellsIncludedInPolicy7(const MEDCouplingUMesh *other) const { - DataArrayInt *ret1; + DataArrayIdType *ret1; bool ret0=self->areCellsIncludedInPolicy7(other,ret1); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explode3DMeshTo1D() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->explode3DMeshTo1D(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explodeIntoEdges() const { - MCAuto desc,descIndex,revDesc,revDescIndx; + MCAuto desc,descIndex,revDesc,revDescIndx; MCAuto m(self->explodeIntoEdges(desc,descIndex,revDesc,revDescIndx)); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(desc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(descIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(revDesc.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(revDescIndx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *explodeMeshIntoMicroEdges() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->explodeMeshIntoMicroEdges(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *buildDescendingConnectivity() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *buildDescendingConnectivity2() const { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - MCAuto d2=DataArrayInt::New(); - MCAuto d3=DataArrayInt::New(); + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + MCAuto d2=DataArrayIdType::New(); + MCAuto d3=DataArrayIdType::New(); MEDCouplingUMesh *m=self->buildDescendingConnectivity2(d0,d1,d2,d3); PyObject *ret=PyTuple_New(5); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(m),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeNeighborsOfCells() const { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; self->computeNeighborsOfCells(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeNeighborsOfNodes() const { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; self->computeNeighborsOfNodes(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *computeEnlargedNeighborsOfNodes() const { - MCAuto neighbors,neighborsIdx; + MCAuto neighbors,neighborsIdx; self->computeEnlargedNeighborsOfNodes(neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayInt *nodeNeigh, const DataArrayInt *nodeNeighI) const + PyObject *computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI) const { - MCAuto cellNeigh,cellNeighIndex; + MCAuto cellNeigh,cellNeighIndex; self->computeCellNeighborhoodFromNodesOne(nodeNeigh,nodeNeighI,cellNeigh,cellNeighIndex); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeigh.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNeighIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) + static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI) { - DataArrayInt *neighbors=0,*neighborsIdx=0; + DataArrayIdType *neighbors=0,*neighborsIdx=0; MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh) { - MCAuto d0=DataArrayInt::New(); - MCAuto d1=DataArrayInt::New(); - DataArrayInt *d2,*d3,*d4,*dd5; + MCAuto d0=DataArrayIdType::New(); + MCAuto d1=DataArrayIdType::New(); + DataArrayIdType *d2,*d3,*d4,*dd5; MEDCouplingUMesh *mOut=self->emulateMEDMEMBDC(nM1LevMesh,d0,d1,d2,d3,d4,dd5); PyObject *ret=PyTuple_New(7); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mOut),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(d2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(d3),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(d4),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(dd5),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - DataArrayDouble *getPartBarycenterAndOwner(DataArrayInt *da) const + DataArrayDouble *getPartBarycenterAndOwner(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->getPartBarycenterAndOwner(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayInt *da) const + DataArrayDouble *getPartMeasureField(bool isAbs, DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->getPartMeasureField(isAbs,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayInt *da) const + MEDCouplingFieldDouble *buildPartOrthogonalField(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); return self->buildPartOrthogonalField(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); } - PyObject *getTypesOfPart(DataArrayInt *da) const + PyObject *getTypesOfPart(DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); std::set result=self->getTypesOfPart(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); std::set::const_iterator iL=result.begin(); @@ -2782,37 +2802,37 @@ namespace MEDCoupling return res; } - DataArrayInt *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da) const + DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, DataArrayIdType *da) const { if(!da) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da->checkAllocated(); - DataArrayInt *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + DataArrayIdType *ret=self->keepCellIdsByType(type,da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); ret->setName(da->getName().c_str()); return ret; } static PyObject *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps) { - DataArrayInt *cellNb1=0,*cellNb2=0; + DataArrayIdType *cellNb1=0,*cellNb2=0; MEDCouplingUMesh *mret=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,eps,cellNb1,cellNb2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(mret),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellNb2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } static PyObject *Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D, double eps) { MEDCouplingUMesh *splitMesh2D(0),*splitMesh1D(0); - DataArrayInt *cellIdInMesh2D(0),*cellIdInMesh1D(0); + DataArrayIdType *cellIdInMesh2D(0),*cellIdInMesh1D(0); MEDCouplingUMesh::Intersect2DMeshWith1DLine(mesh2D,mesh1D,eps,splitMesh2D,splitMesh1D,cellIdInMesh2D,cellIdInMesh1D); PyObject *ret(PyTuple_New(4)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh2D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(splitMesh1D),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh2D),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellIdInMesh1D),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2825,17 +2845,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3D : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); // - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MEDCouplingUMesh *ret0=self->buildSlice3D(orig,vect,eps,cellIds); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2848,17 +2868,17 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::buildSlice3DSurf : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); const double *vect=convertObjToPossibleCpp5_Safe(vec,sw,val2,a2,aa2,bb2,msg2,1,spaceDim,true); // - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; MEDCouplingUMesh *ret0=self->buildSlice3DSurf(orig,vect,eps,cellIds); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2868,7 +2888,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::clipSingle3DCellByPlane : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,3,true); @@ -2877,7 +2897,7 @@ namespace MEDCoupling return ret.retn(); } - DataArrayInt *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const + DataArrayIdType *getCellIdsCrossingPlane(PyObject *origin, PyObject *vec, double eps) const { int spaceDim=self->getSpaceDimension(); if(spaceDim!=3) @@ -2886,7 +2906,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const char msg[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingUMesh::getCellIdsCrossingPlane : 2nd parameter for vector."; const double *orig=convertObjToPossibleCpp5_Safe(origin,sw,val,a,aa,bb,msg,1,spaceDim,true); @@ -2896,11 +2916,11 @@ namespace MEDCoupling void convertToPolyTypes(PyObject *li) { - int sw; - int pos1; - std::vector pos2; - DataArrayInt *pos3=0; - DataArrayIntTuple *pos4=0; + mcIdType sw; + mcIdType pos1; + std::vector pos2; + DataArrayIdType *pos3=0; + DataArrayIdTypeTuple *pos4=0; convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4); switch(sw) { @@ -2946,7 +2966,7 @@ namespace MEDCoupling MEDCouplingUMesh *build3DUnstructuredMesh() const; int get2DCellIdForExtrusion() const; %extend { - MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, int cell2DId) + MEDCouplingMappedExtrudedMesh(const MEDCouplingUMesh *mesh3D, const MEDCouplingUMesh *mesh2D, mcIdType cell2DId) { return MEDCouplingMappedExtrudedMesh::New(mesh3D,mesh2D,cell2DId); } @@ -2989,10 +3009,10 @@ namespace MEDCoupling } PyObject *getMesh3DIds() const { - DataArrayInt *ret=self->getMesh3DIds(); + DataArrayIdType *ret=self->getMesh3DIds(); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } } }; @@ -3012,15 +3032,15 @@ namespace MEDCoupling { virtual void insertNextCell(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->insertNextCell(tmp,tmp+szArr); } - virtual DataArrayInt *getNodalConnectivity() const + virtual DataArrayIdType *getNodalConnectivity() const { - DataArrayInt *ret=self->getNodalConnectivity(); + DataArrayIdType *ret=self->getNodalConnectivity(); if(ret) ret->incrRef(); return ret; } @@ -3041,13 +3061,13 @@ namespace MEDCoupling public: static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m); - void setNodalConnectivity(DataArrayInt *nodalConn); + void setNodalConnectivity(DataArrayIdType *nodalConn); int getNumberOfNodesPerCell() const; static MEDCoupling1SGTUMesh *Merge1SGTUMeshes(const MEDCoupling1SGTUMesh *mesh1, const MEDCoupling1SGTUMesh *mesh2); MEDCoupling1SGTUMesh *buildSetInstanceFromThis(int spaceDim) const; MEDCoupling1GTUMesh *computeDualMesh() const; MEDCoupling1SGTUMesh *explodeEachHexa8To6Quad4() const; - DataArrayInt *sortHexa8EachOther(); + DataArrayIdType *sortHexa8EachOther(); %extend { MEDCoupling1SGTUMesh() @@ -3079,12 +3099,12 @@ namespace MEDCoupling PyObject *structurizeMe(double eps=1e-12) const { - DataArrayInt *cellPerm(0),*nodePerm(0); + DataArrayIdType *cellPerm(0),*nodePerm(0); MEDCouplingCMesh *retCpp(self->structurizeMe(cellPerm,nodePerm,eps)); PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp),SWIGTYPE_p_MEDCoupling__MEDCouplingCMesh, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cellPerm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(nodePerm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3113,7 +3133,7 @@ namespace MEDCoupling public: static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type); static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m); - void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex); + void setNodalConnectivity(DataArrayIdType *nodalConn, DataArrayIdType *nodalConnIndex); MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const; bool isPacked() const; %extend @@ -3144,23 +3164,23 @@ namespace MEDCoupling return oss.str(); } - DataArrayInt *getNodalConnectivityIndex() const + DataArrayIdType *getNodalConnectivityIndex() const { - DataArrayInt *ret=self->getNodalConnectivityIndex(); + DataArrayIdType *ret=self->getNodalConnectivityIndex(); if(ret) ret->incrRef(); return ret; } PyObject *retrievePackedNodalConnectivity() const { - DataArrayInt *ret1=0,*ret2=0; + DataArrayIdType *ret1=0,*ret2=0; bool ret0=self->retrievePackedNodalConnectivity(ret1,ret2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3189,10 +3209,10 @@ namespace MEDCoupling return MEDCoupling1DGTUMesh::Merge1DGTUMeshesOnSameCoords(tmp); } - static DataArrayInt *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector& offsetInNodeIdsPerElt) + static DataArrayIdType *AggregateNodalConnAndShiftNodeIds(PyObject *li, const std::vector& offsetInNodeIdsPerElt) { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayIdType",tmp); return MEDCoupling1DGTUMesh::AggregateNodalConnAndShiftNodeIds(tmp,offsetInNodeIdsPerElt); } } @@ -3203,32 +3223,32 @@ namespace MEDCoupling class MEDCouplingStructuredMesh : public MEDCoupling::MEDCouplingMesh { public: - int getCellIdFromPos(int i, int j, int k) const; - int getNodeIdFromPos(int i, int j, int k) const; - int getNumberOfCellsOfSubLevelMesh() const; + mcIdType getCellIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + mcIdType getNodeIdFromPos(mcIdType i, mcIdType j, mcIdType k) const; + mcIdType getNumberOfCellsOfSubLevelMesh() const; int getSpaceDimensionOnNodeStruct() const; double computeSquareness() const; - virtual std::vector getNodeGridStructure() const; - std::vector getCellGridStructure() const; + virtual std::vector getNodeGridStructure() const; + std::vector getCellGridStructure() const; MEDCoupling1SGTUMesh *build1SGTUnstructured() const; - std::vector getLocationFromCellId(int cellId) const; - std::vector getLocationFromNodeId(int cellId) const; + std::vector getLocationFromCellId(mcIdType cellId) const; + std::vector getLocationFromNodeId(mcIdType cellId) const; static INTERP_KERNEL::NormalizedCellType GetGeoTypeGivenMeshDimension(int meshDim); MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const; - static int DeduceNumberOfGivenStructure(const std::vector& st); - static DataArrayInt *ComputeCornersGhost(const std::vector& st, int ghostLev); - static std::vector GetSplitVectFromStruct(const std::vector& strct); + static mcIdType DeduceNumberOfGivenStructure(const std::vector& st); + static DataArrayIdType *ComputeCornersGhost(const std::vector& st, mcIdType ghostLev); + static std::vector GetSplitVectFromStruct(const std::vector& strct); %extend { virtual MEDCouplingStructuredMesh *buildStructuredSubPart(PyObject *cellPart) const { - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2); - std::vector< std::pair > inp; + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(cellPart,tmpp1,tmpp2); + std::vector< std::pair > inp; if(tmpp2==2) { inp.resize(tmpp1); - for(int i=0;ibuildStructuredSubPart(inp); } - static DataArrayInt *BuildExplicitIdsFrom(PyObject *st, PyObject *part) + static DataArrayIdType *BuildExplicitIdsFrom(PyObject *st, PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); // - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr); - std::vector tmp5(tmp4,tmp4+szArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp4=convertIntStarLikePyObjToCppIntStar(st,sw,szArr,iTypppArr,stdvecTyyppArr); + std::vector tmp5(tmp4,tmp4+szArr); // return MEDCouplingStructuredMesh::BuildExplicitIdsFrom(tmp5,inp); } - static void MultiplyPartOf(const std::vector& st, PyObject *part, double factor, DataArrayDouble *da) + static void MultiplyPartOf(const std::vector& st, PyObject *part, double factor, DataArrayDouble *da) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); MEDCouplingStructuredMesh::MultiplyPartOf(st,inp,factor,da); } - static void MultiplyPartOfByGhost(const std::vector& st, PyObject *part, int ghostSize, double factor, DataArrayDouble *da) + static void MultiplyPartOfByGhost(const std::vector& st, PyObject *part, mcIdType ghostSize, double factor, DataArrayDouble *da) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); MEDCouplingStructuredMesh::MultiplyPartOfByGhost(st,inp,ghostSize,factor,da); } - static PyObject *PutInGhostFormat(int ghostSize, const std::vector& st, PyObject *part) + static PyObject *PutInGhostFormat(mcIdType ghostSize, const std::vector& st, PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); - std::vector stWithGhost; - std::vector< std::pair > partWithGhost; + std::vector stWithGhost; + std::vector< std::pair > partWithGhost; MEDCouplingStructuredMesh::PutInGhostFormat(ghostSize,st,inp,stWithGhost,partWithGhost); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,convertIntArrToPyList2(stWithGhost)); @@ -3284,53 +3304,53 @@ namespace MEDCoupling return ret; } - static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) + static DataArrayDouble *ExtractFieldOfDoubleFrom(const std::vector& st, const DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); return MEDCouplingStructuredMesh::ExtractFieldOfDoubleFrom(st,fieldOfDbl,inp); } - static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other) + static void AssignPartOfFieldOfDoubleUsing(const std::vector& st, DataArrayDouble *fieldOfDbl, PyObject *partCompactFormat, const DataArrayDouble *other) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); MEDCouplingStructuredMesh::AssignPartOfFieldOfDoubleUsing(st,fieldOfDbl,inp,other); } - static int DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) + static mcIdType DeduceNumberOfGivenRangeInCompactFrmt(PyObject *part) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(part,inp); return MEDCouplingStructuredMesh::DeduceNumberOfGivenRangeInCompactFrmt(inp); } - static DataArrayInt *Build1GTNodalConnectivity(PyObject *li) + static DataArrayIdType *Build1GTNodalConnectivity(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); return MEDCouplingStructuredMesh::Build1GTNodalConnectivity(tmp,tmp+szArr); } - static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) + static DataArrayIdType *Build1GTNodalConnectivityOfSubLevelMesh(PyObject *li) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr)); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp(convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr)); return MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh(tmp,tmp+szArr); } - static std::vector GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) + static std::vector GetDimensionsFromCompactFrmt(PyObject *partCompactFormat) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(partCompactFormat,inp); return MEDCouplingStructuredMesh::GetDimensionsFromCompactFrmt(inp); } - static PyObject *GetCompactFrmtFromDimensions(const std::vector& dims) + static PyObject *GetCompactFrmtFromDimensions(const std::vector& dims) { - std::vector< std::pair > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::GetCompactFrmtFromDimensions(dims)); PyObject *retPy=PyList_New(ret.size()); for(std::size_t i=0;i > r1Cpp,r2Cpp; + std::vector< std::pair > r1Cpp,r2Cpp; convertPyToVectorPairInt(r1,r1Cpp); convertPyToVectorPairInt(r2,r2Cpp); - std::vector< std::pair > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::IntersectRanges(r1Cpp,r2Cpp)); PyObject *retPy=PyList_New(ret.size()); for(std::size_t i=0;i > r1Cpp,r2Cpp; + std::vector< std::pair > r1Cpp,r2Cpp; convertPyToVectorPairInt(r1,r1Cpp); convertPyToVectorPairInt(r2,r2Cpp); return MEDCouplingStructuredMesh::AreRangesIntersect(r1Cpp,r2Cpp); @@ -3369,14 +3389,14 @@ namespace MEDCoupling static PyObject *IsPartStructured(PyObject *li, PyObject *st) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); - int szArr2,sw2,iTypppArr2; - std::vector stdvecTyyppArr2; - const int *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2); - std::vector tmp3(tmp2,tmp2+szArr2); - std::vector< std::pair > partCompactFormat; + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr2,sw2,iTypppArr2; + std::vector stdvecTyyppArr2; + const mcIdType *tmp2=convertIntStarLikePyObjToCppIntStar(st,sw2,szArr2,iTypppArr2,stdvecTyyppArr2); + std::vector tmp3(tmp2,tmp2+szArr2); + std::vector< std::pair > partCompactFormat; bool ret0=MEDCouplingStructuredMesh::IsPartStructured(tmp,tmp+szArr,tmp3,partCompactFormat); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -3395,7 +3415,7 @@ namespace MEDCoupling static PyObject *ChangeReferenceFromGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigInAbs, bool check=true) { - std::vector< std::pair > param0,param1,ret; + std::vector< std::pair > param0,param1,ret; convertPyToVectorPairInt(bigInAbs,param0); convertPyToVectorPairInt(partOfBigInAbs,param1); MEDCouplingStructuredMesh::ChangeReferenceFromGlobalOfCompactFrmt(param0,param1,ret,check); @@ -3410,11 +3430,11 @@ namespace MEDCoupling return retPy; } - static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector& translation) + static PyObject *TranslateCompactFrmt(PyObject *part, const std::vector& translation) { - std::vector< std::pair > param0; + std::vector< std::pair > param0; convertPyToVectorPairInt(part,param0); - std::vector< std::pair > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation)); + std::vector< std::pair > ret(MEDCouplingStructuredMesh::TranslateCompactFrmt(param0,translation)); PyObject *retPy(PyList_New(ret.size())); for(std::size_t i=0;i FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) + static std::vector FindTranslationFrom(PyObject *startingFrom, PyObject *goingTo) { - std::vector< std::pair > param0,param1; + std::vector< std::pair > param0,param1; convertPyToVectorPairInt(startingFrom,param0); convertPyToVectorPairInt(goingTo,param1); return MEDCouplingStructuredMesh::FindTranslationFrom(param0,param1); @@ -3436,7 +3456,7 @@ namespace MEDCoupling static PyObject *ChangeReferenceToGlobalOfCompactFrmt(PyObject *bigInAbs, PyObject *partOfBigRelativeToBig, bool check=true) { - std::vector< std::pair > param0,param1,ret; + std::vector< std::pair > param0,param1,ret; convertPyToVectorPairInt(bigInAbs,param0); convertPyToVectorPairInt(partOfBigRelativeToBig,param1); MEDCouplingStructuredMesh::ChangeReferenceToGlobalOfCompactFrmt(param0,param1,ret,check); @@ -3534,9 +3554,9 @@ namespace MEDCoupling } void setNodeGridStructure(PyObject *gridStruct) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(gridStruct,sw,szArr,iTypppArr,stdvecTyyppArr); self->setNodeGridStructure(tmp,tmp+szArr); } } @@ -3552,16 +3572,16 @@ namespace MEDCoupling static MEDCouplingIMesh *New(); // void setSpaceDimension(int spaceDim); - std::vector getNodeStruct() const; + std::vector getNodeStruct() const; std::vector getOrigin() const; std::vector getDXYZ() const; void setAxisUnit(const std::string& unitName); std::string getAxisUnit() const; double getMeasureOfAnyCell() const; MEDCouplingCMesh *convertToCartesian() const; - void refineWithFactor(const std::vector& factors); + void refineWithFactor(const std::vector& factors); MEDCouplingIMesh *asSingleCell() const; - MEDCouplingIMesh *buildWithGhost(int ghostLev) const; + MEDCouplingIMesh *buildWithGhost(mcIdType ghostLev) const; %extend { MEDCouplingIMesh() @@ -3572,15 +3592,15 @@ namespace MEDCoupling { static const char msg0[]="MEDCouplingIMesh::New : error on 'origin' parameter !"; static const char msg1[]="MEDCouplingIMesh::New : error on 'dxyz' parameter !"; - const int *nodeStrctPtr(0); + const mcIdType *nodeStrctPtr(0); const double *originPtr(0),*dxyzPtr(0); - int sw,sz,val0; - std::vector bb0; + mcIdType sw,sz,val0; + std::vector bb0; nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0); // double val,val2; std::vector bb,bb2; - int sz1,sz2; + mcIdType sz1,sz2; originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); // @@ -3594,9 +3614,9 @@ namespace MEDCoupling void setNodeStruct(PyObject *nodeStrct) { - int sw,sz,val0; - std::vector bb0; - const int *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0)); + mcIdType sw,sz,val0; + std::vector bb0; + const mcIdType *nodeStrctPtr(convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0)); self->setNodeStruct(nodeStrctPtr,nodeStrctPtr+sz); } @@ -3604,10 +3624,8 @@ namespace MEDCoupling { static const char msg[]="MEDCouplingIMesh::setOrigin : invalid input 'origin' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !"; double val; - DataArrayDouble *a; - DataArrayDoubleTuple *aa; std::vector bb; - int sw,nbTuples; + mcIdType sw,nbTuples; const double *originPtr(convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg,false,nbTuples)); self->setOrigin(originPtr,originPtr+nbTuples); } @@ -3616,45 +3634,43 @@ namespace MEDCoupling { static const char msg[]="MEDCouplingIMesh::setDXYZ : invalid input 'dxyz' parameter ! integer, float, list/tuple of float, DataArrayDouble or DataArrayDoubleTuple supported !"; double val; - DataArrayDouble *a; - DataArrayDoubleTuple *aa; std::vector bb; - int sw,nbTuples; + mcIdType sw,nbTuples; const double *originPtr(convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val,bb,msg,false,nbTuples)); self->setDXYZ(originPtr,originPtr+nbTuples); } - static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) + static void CondenseFineToCoarse(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::CondenseFineToCoarse(coarseSt,fineDA,inp,facts,coarseDA); } - static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, int ghostSize) + static void CondenseFineToCoarseGhost(const std::vector& coarseSt, const DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, DataArrayDouble *coarseDA, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::CondenseFineToCoarseGhost(coarseSt,fineDA,inp,facts,coarseDA,ghostSize); } - static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts) + static void SpreadCoarseToFine(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFine(coarseDA,coarseSt,fineDA,inp,facts); } - static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, int ghostSize) + static void SpreadCoarseToFineGhost(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFineGhost(coarseDA,coarseSt,fineDA,inp,facts,ghostSize); } - static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, int ghostSize) + static void SpreadCoarseToFineGhostZone(const DataArrayDouble *coarseDA, const std::vector& coarseSt, DataArrayDouble *fineDA, PyObject *fineLocInCoarse, const std::vector& facts, mcIdType ghostSize) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(fineLocInCoarse,inp); MEDCouplingIMesh::SpreadCoarseToFineGhostZone(coarseDA,coarseSt,fineDA,inp,facts,ghostSize); } @@ -3694,16 +3710,16 @@ namespace MEDCoupling virtual void setNature(NatureOfField nat); DataArrayDouble *getLocalizationOfDiscr() const; MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const; - int getNumberOfTuplesExpected() const; - int getNumberOfMeshPlacesExpected() const; + mcIdType getNumberOfTuplesExpected() const; + mcIdType getNumberOfMeshPlacesExpected() const; void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg); void clearGaussLocalizations(); MEDCouplingGaussLocalization& getGaussLocalization(int locId); - int getNbOfGaussLocalization() const; - int getGaussLocalizationIdOfOneCell(int cellId) const; + mcIdType getNbOfGaussLocalization() const; + mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; - int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; void setDiscretization(MEDCouplingFieldDiscretization *newDisc); %extend { PyObject *getMesh() const @@ -3724,45 +3740,45 @@ namespace MEDCoupling PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set ret=self->getGaussLocalizationIdsOfOneType(type); + std::set ret=self->getGaussLocalizationIdsOfOneType(type); return convertIntArrToPyList3(ret); } PyObject *buildSubMeshData(PyObject *li) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; MEDCouplingMesh *ret0=0; void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); ret0=self->buildSubMeshData(tmp,tmp+size,ret1); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); ret0=self->buildSubMeshData(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),ret1); } PyObject *res = PyList_New(2); PyList_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyList_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); return res; } - PyObject *buildSubMeshDataRange(int begin, int end, int step) const + PyObject *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step) const { - DataArrayInt *ret1=0; - int bb,ee,ss; + DataArrayIdType *ret1=0; + mcIdType bb,ee,ss; MEDCouplingMesh *ret0=self->buildSubMeshDataRange(begin,end,step,bb,ee,ss,ret1); PyObject *res=PyTuple_New(2); PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); if(ret1) - PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); else { PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss)); @@ -3771,11 +3787,11 @@ namespace MEDCoupling return res; } - DataArrayInt *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const + DataArrayIdType *computeTupleIdsToSelectFromCellIds(PyObject *cellIds) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); return self->computeTupleIdsToSelectFromCellIds(cellIdsBg,cellIdsBg+sz); } @@ -3783,18 +3799,18 @@ namespace MEDCoupling const std::vector& gsCoo, const std::vector& wg) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->setGaussLocalizationOnCells(tmp,((int *)tmp)+size,refCoo,gsCoo,wg); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->setGaussLocalizationOnCells(tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->setGaussLocalizationOnCells(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg); } @@ -3802,20 +3818,20 @@ namespace MEDCoupling PyObject *getCellIdsHavingGaussLocalization(int locId) const { - std::vector tmp; + std::vector tmp; self->getCellIdsHavingGaussLocalization(locId,tmp); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)tmp.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc((mcIdType)tmp.size(),1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } - int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const + mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const { - std::vector inp0; + std::vector inp0; convertPyToNewIntArr4(code,1,3,inp0); - std::vector inp1; - convertFromPyObjVectorOfObj(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1); + std::vector inp1; + convertFromPyObjVectorOfObj(idsPerType,SWIGTITraits::TI,"DataArrayIdType",inp1); return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1); } } @@ -3957,7 +3973,7 @@ namespace MEDCoupling MEDCouplingFieldDouble *deviator() const; MEDCouplingFieldDouble *magnitude() const; MEDCouplingFieldDouble *maxPerTuple() const; - void changeNbOfComponents(int newNbOfComp, double dftValue=0.); + void changeNbOfComponents(std::size_t newNbOfComp, double dftValue=0.); void sortPerTuple(bool asc); MEDCouplingFieldDouble &operator=(double value); void fillFromAnalytic(int nbOfComp, const std::string& func); @@ -3981,7 +3997,7 @@ namespace MEDCoupling double normL1(int compId) const; double normL2(int compId) const; double normMax(int compId) const; - DataArrayInt *findIdsInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsInRange(double vmin, double vmax) const; MEDCouplingFieldDouble *buildSubPartRange(int begin, int end, int step) const; static MEDCouplingFieldDouble *MergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); static MEDCouplingFieldDouble *MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2); @@ -4052,7 +4068,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true); return self->computeVectorFieldCyl(centerPtr,vectorPtr); @@ -4072,9 +4088,9 @@ namespace MEDCoupling for(std::vector::iterator it=arrs.begin();it!=arrs.end();it++) if(*it) (*it)->incrRef(); - int sz=arrs.size(); + std::size_t sz=arrs.size(); PyObject *ret=PyTuple_New(sz); - for(int i=0;i tmp; convertFromPyObjVectorOfObj(ls,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp); - int sz=tmp.size(); + std::size_t sz=tmp.size(); std::vector arrs(sz); - for(int i=0;i(tmp[i]); self->setArrays(arrs); } @@ -4109,7 +4125,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; const MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !"); @@ -4117,15 +4133,15 @@ namespace MEDCoupling const char msg[]="Python wrap of MEDCouplingFieldDouble::getValueOn : "; const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true); // - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr res=new double[sz]; self->getValueOn(spaceLoc,res); return convertDblArrToPyList(res,sz); } - PyObject *getValueOnPos(int i, int j, int k) const + PyObject *getValueOnPos(mcIdType i, mcIdType j, mcIdType k) const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr res=new double[sz]; self->getValueOnPos(i,j,k,res); return convertDblArrToPyList(res,sz); @@ -4137,11 +4153,11 @@ namespace MEDCoupling if(!mesh) throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDouble::getValueOnMulti : lying on a null mesh !"); // - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti", mesh->getSpaceDimension(),true,nbPts); - return self->getValueOnMulti(inp,nbPts); + return self->getValueOnMulti(inp,(int)nbPts); } PyObject *getValueOn(PyObject *sl, double time) const @@ -4150,7 +4166,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; const MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDouble::getValueOn : no underlying mesh !"); @@ -4159,7 +4175,7 @@ namespace MEDCoupling const double *spaceLoc=convertObjToPossibleCpp5_Safe(sl,sw,val,a,aa,bb,msg,1,spaceDim,true); // // - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr res=new double[sz]; self->getValueOn(spaceLoc,time,res); return convertDblArrToPyList(res,sz); @@ -4211,75 +4227,75 @@ namespace MEDCoupling } PyObject *accumulate() const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->accumulate(tmp); return convertDblArrToPyList(tmp,sz); } PyObject *integral(bool isWAbs) const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->integral(isWAbs,tmp); return convertDblArrToPyList(tmp,sz); } PyObject *getWeightedAverageValue(bool isWAbs=true) const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->getWeightedAverageValue(tmp,isWAbs); return convertDblArrToPyList(tmp,sz); } PyObject *normL1() const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->normL1(tmp); return convertDblArrToPyList(tmp,sz); } PyObject *normL2() const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->normL2(tmp); return convertDblArrToPyList(tmp,sz); } PyObject *normMax() const { - int sz=self->getNumberOfComponents(); + mcIdType sz=ToIdType(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->normMax(tmp); return convertDblArrToPyList(tmp,sz); } void renumberCells(PyObject *li, bool check=true) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberCells(tmp,check); } void renumberCellsWithoutMesh(PyObject *li, bool check=true) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberCellsWithoutMesh(tmp,check); } void renumberNodes(PyObject *li, double eps=1e-15) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodes(tmp,eps); } - void renumberNodesWithoutMesh(PyObject *li, int newNbOfNodes, double eps=1e-15) + void renumberNodesWithoutMesh(PyObject *li, mcIdType newNbOfNodes, double eps=1e-15) { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); + mcIdType szArr,sw,iTypppArr; + std::vector stdvecTyyppArr; + const mcIdType *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); self->renumberNodesWithoutMesh(tmp,newNbOfNodes,eps); } @@ -4295,34 +4311,34 @@ namespace MEDCoupling PyObject *getMaxValue2() const { - DataArrayInt *tmp; + DataArrayIdType *tmp; double r1=self->getMaxValue2(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinValue2() const { - DataArrayInt *tmp; + DataArrayIdType *tmp; double r1=self->getMinValue2(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); return self->keepSelectedComponents(tmp); } void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(f,tmp); } @@ -4333,7 +4349,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; int spaceDim=3; const char msg[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 1st parameter for origin."; const char msg2[]="Python wrap of MEDCouplingFieldDouble::extractSlice3D : 2nd parameter for vector."; @@ -4372,7 +4388,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4409,7 +4425,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Substract(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4454,7 +4470,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4493,7 +4509,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Divide(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4528,7 +4544,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4565,7 +4581,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); MCAuto ret=DataArrayDouble::Pow(self->getArray(),aaa); MCAuto ret2=self->clone(false); ret2->setArray(ret); @@ -4604,7 +4620,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4637,7 +4653,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4670,7 +4686,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4703,7 +4719,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4736,7 +4752,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4802,7 +4818,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4837,7 +4853,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4870,7 +4886,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -4903,7 +4919,7 @@ namespace MEDCoupling { if(!self->getArray()) throw INTERP_KERNEL::Exception(msg2); - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->getArray()->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -4969,9 +4985,9 @@ namespace MEDCoupling { std::vector tmp; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp); - int sz=tmp.size(); + std::size_t sz=tmp.size(); std::vector fs(sz); - for(int i=0;i(tmp[i]); return MEDCouplingMultiFields::New(fs); } @@ -4979,18 +4995,18 @@ namespace MEDCoupling { std::vector tmp; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp); - int sz=tmp.size(); + std::size_t sz=tmp.size(); std::vector fs(sz); - for(int i=0;i(tmp[i]); return MEDCouplingMultiFields::New(fs); } PyObject *getFields() const { std::vector fields=self->getFields(); - int sz=fields.size(); + std::size_t sz=fields.size(); PyObject *res = PyList_New(sz); - for(int i=0;i ms=self->getMeshes(); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *res = PyList_New(sz); - for(int i=0;i refs; std::vector ms=self->getDifferentMeshes(refs); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *res = PyList_New(sz); - for(int i=0;i ms=self->getArrays(); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *res = PyList_New(sz); - for(int i=0;i > refs; std::vector ms=self->getDifferentArrays(refs); - int sz=ms.size(); + std::size_t sz=ms.size(); PyObject *res = PyList_New(sz); PyObject *res2 = PyList_New(sz); - for(int i=0;igetArray(); + DataArrayInt32 *ret=self->getArray(); if(ret) ret->incrRef(); return ret; @@ -5365,9 +5381,9 @@ namespace MEDCoupling { std::vector tmp; convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp); - int sz=tmp.size(); + std::size_t sz=tmp.size(); std::vector fs(sz); - for(int i=0;i(tmp[i]); return MEDCouplingFieldOverTime::New(fs); } @@ -5376,15 +5392,15 @@ namespace MEDCoupling return self->simpleRepr(); } static MEDCouplingFieldOverTime *New(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp); - int sz=tmp.size(); - std::vector fs(sz); - for(int i=0;i(tmp[i]); - return MEDCouplingFieldOverTime::New(fs); - } + { + std::vector tmp; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,"MEDCouplingFieldDouble",tmp); + std::size_t sz=tmp.size(); + std::vector fs(sz); + for(std::size_t i=0;i(tmp[i]); + return MEDCouplingFieldOverTime::New(fs); + } } }; @@ -5413,29 +5429,29 @@ namespace MEDCoupling public: int getNumberOfOverlapedCellsForFather() const; bool isInMyNeighborhood(const MEDCouplingCartesianAMRPatch *other, int ghostLev) const; - std::vector computeCellGridSt() const; + std::vector computeCellGridSt() const; %extend { PyObject *getBLTRRange() const { - const std::vector< std::pair >& ret(self->getBLTRRange()); + const std::vector< std::pair >& ret(self->getBLTRRange()); return convertFromVectorPairInt(ret); } PyObject *getBLTRRangeRelativeToGF() const { - std::vector< std::pair > ret(self->getBLTRRangeRelativeToGF()); + std::vector< std::pair > ret(self->getBLTRRangeRelativeToGF()); return convertFromVectorPairInt(ret); } - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) + void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(bottomLeftTopRight,inp); self->addPatch(inp,factors); } - MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const + MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const { const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) @@ -5453,7 +5469,7 @@ namespace MEDCoupling return ret; } - void __delitem__(int patchId) + void __delitem__(mcIdType patchId) { MEDCouplingCartesianAMRMeshGen *mesh(const_cast(self->getMesh())); if(!mesh) @@ -5461,7 +5477,7 @@ namespace MEDCoupling mesh->removePatch(patchId); } - int __len__() const + mcIdType __len__() const { const MEDCouplingCartesianAMRMeshGen *mesh(self->getMesh()); if(!mesh) @@ -5478,45 +5494,45 @@ namespace MEDCoupling class MEDCouplingCartesianAMRMeshGen : public RefCountObject, public TimeLabel { public: - int getAbsoluteLevel() const; - int getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; - std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + mcIdType getAbsoluteLevel() const; + mcIdType getAbsoluteLevelRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; + std::vector getPositionRelativeTo(const MEDCouplingCartesianAMRMeshGen *ref) const; int getSpaceDimension() const; - const std::vector& getFactors() const; - void setFactors(const std::vector& newFactors); - int getMaxNumberOfLevelsRelativeToThis() const; - int getNumberOfCellsAtCurrentLevel() const; - int getNumberOfCellsAtCurrentLevelGhost(int ghostLev) const; - int getNumberOfCellsRecursiveWithOverlap() const; - int getNumberOfCellsRecursiveWithoutOverlap() const; - bool isPatchInNeighborhoodOf(int patchId1, int patchId2, int ghostLev) const; + const std::vector& getFactors() const; + void setFactors(const std::vector& newFactors); + mcIdType getMaxNumberOfLevelsRelativeToThis() const; + mcIdType getNumberOfCellsAtCurrentLevel() const; + mcIdType getNumberOfCellsAtCurrentLevelGhost(mcIdType ghostLev) const; + mcIdType getNumberOfCellsRecursiveWithOverlap() const; + mcIdType getNumberOfCellsRecursiveWithoutOverlap() const; + bool isPatchInNeighborhoodOf(mcIdType patchId1, mcIdType patchId2, mcIdType ghostLev) const; virtual void detachFromFather(); // - int getNumberOfPatches() const; - int getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; + mcIdType getNumberOfPatches() const; + mcIdType getPatchIdFromChildMesh(const MEDCouplingCartesianAMRMeshGen *mesh) const; MEDCouplingUMesh *buildUnstructured() const; - DataArrayDouble *extractGhostFrom(int ghostSz, const DataArrayDouble *arr) const; - std::vector getPatchIdsInTheNeighborhoodOf(int patchId, int ghostLev) const; + DataArrayDouble *extractGhostFrom(mcIdType ghostSz, const DataArrayDouble *arr) const; + std::vector getPatchIdsInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; MEDCoupling1SGTUMesh *buildMeshFromPatchEnvelop() const; MEDCoupling1SGTUMesh *buildMeshOfDirectChildrenOnly() const; void removeAllPatches(); - void removePatch(int patchId); - void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); - void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); - DataArrayDouble *createCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis) const; - void fillCellFieldOnPatch(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; - void fillCellFieldOnPatchGhost(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev, bool isConservative=true) const; - void fillCellFieldOnPatchOnlyOnGhostZone(int patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, int ghostLev) const; - void fillCellFieldOnPatchOnlyOnGhostZoneWith(int ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; - void fillCellFieldComingFromPatch(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; - void fillCellFieldComingFromPatchGhost(int patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, int ghostLev, bool isConservative=true) const; - DataArrayInt *findPatchesInTheNeighborhoodOf(int patchId, int ghostLev) const; + void removePatch(mcIdType patchId); + void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayByte *criterion, const std::vector& factors); + void createPatchesFromCriterion(const INTERP_KERNEL::BoxSplittingOptions& bso, const DataArrayDouble *criterion, const std::vector& factors, double eps); + DataArrayDouble *createCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis) const; + void fillCellFieldOnPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, bool isConservative=true) const; + void fillCellFieldOnPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev, bool isConservative=true) const; + void fillCellFieldOnPatchOnlyOnGhostZone(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, DataArrayDouble *cellFieldOnPatch, mcIdType ghostLev) const; + void fillCellFieldOnPatchOnlyOnGhostZoneWith(mcIdType ghostLev, const MEDCouplingCartesianAMRPatch *patchToBeModified, const MEDCouplingCartesianAMRPatch *neighborPatch, DataArrayDouble *cellFieldOnPatch, const DataArrayDouble *cellFieldNeighbor) const; + void fillCellFieldComingFromPatch(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, bool isConservative=true) const; + void fillCellFieldComingFromPatchGhost(mcIdType patchId, const DataArrayDouble *cellFieldOnPatch, DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, bool isConservative=true) const; + DataArrayIdType *findPatchesInTheNeighborhoodOf(mcIdType patchId, mcIdType ghostLev) const; std::string buildPythonDumpOfThis() const; %extend { - void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) + void addPatch(PyObject *bottomLeftTopRight, const std::vector& factors) { - std::vector< std::pair > inp; + std::vector< std::pair > inp; convertPyToVectorPairInt(bottomLeftTopRight,inp); self->addPatch(inp,factors); } @@ -5524,9 +5540,9 @@ namespace MEDCoupling PyObject *getPatches() const { std::vector< const MEDCouplingCartesianAMRPatch *> ps(self->getPatches()); - int sz(ps.size()); + std::size_t sz(ps.size()); PyObject *ret = PyList_New(sz); - for(int i=0;i(ps[i])); if(elt) @@ -5542,7 +5558,7 @@ namespace MEDCoupling return convertCartesianAMRMesh(self->deepCopy(father), SWIG_POINTER_OWN | 0 ); } - MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const + MEDCouplingCartesianAMRPatch *getPatchAtPosition(const std::vector& pos) const { const MEDCouplingCartesianAMRPatch *ret(self->getPatchAtPosition(pos)); MEDCouplingCartesianAMRPatch *ret2(const_cast(ret)); @@ -5551,7 +5567,7 @@ namespace MEDCoupling return ret2; } - MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const + MEDCouplingCartesianAMRMeshGen *getMeshAtPosition(const std::vector& pos) const { const MEDCouplingCartesianAMRMeshGen *ret(self->getMeshAtPosition(pos)); MEDCouplingCartesianAMRMeshGen *ret2(const_cast(ret)); @@ -5562,25 +5578,25 @@ namespace MEDCoupling virtual PyObject *positionRelativeToGodFather() const { - std::vector out1; - std::vector< std::pair > out0(self->positionRelativeToGodFather(out1)); + std::vector out1; + std::vector< std::pair > out0(self->positionRelativeToGodFather(out1)); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,convertFromVectorPairInt(out0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(out1)); return ret; } - virtual PyObject *retrieveGridsAt(int absoluteLev) const + virtual PyObject *retrieveGridsAt(mcIdType absoluteLev) const { std::vector ps(self->retrieveGridsAt(absoluteLev)); - int sz(ps.size()); + std::size_t sz(ps.size()); PyObject *ret = PyList_New(sz); - for(int i=0;i inp; convertFromPyObjVectorOfObj(recurseArrs,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",inp); @@ -5603,7 +5619,7 @@ namespace MEDCoupling return ret; } - MEDCouplingCartesianAMRPatch *getPatch(int patchId) const + MEDCouplingCartesianAMRPatch *getPatch(mcIdType patchId) const { MEDCouplingCartesianAMRPatch *ret(const_cast(self->getPatch(patchId))); if(ret) @@ -5619,7 +5635,7 @@ namespace MEDCoupling return const_cast(ret); } - MEDCouplingCartesianAMRPatch *__getitem__(int patchId) const + MEDCouplingCartesianAMRPatch *__getitem__(mcIdType patchId) const { if(patchId==self->getNumberOfPatches()) { @@ -5634,26 +5650,26 @@ namespace MEDCoupling return ret; } - void fillCellFieldOnPatchGhostAdv(int patchId, const DataArrayDouble *cellFieldOnThis, int ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const + void fillCellFieldOnPatchGhostAdv(mcIdType patchId, const DataArrayDouble *cellFieldOnThis, mcIdType ghostLev, PyObject *arrsOnPatches, bool isConservative=true) const { std::vector arrsOnPatches2; convertFromPyObjVectorOfObj(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2); self->fillCellFieldOnPatchGhostAdv(patchId,cellFieldOnThis,ghostLev,arrsOnPatches2,isConservative); } - void fillCellFieldOnPatchOnlyGhostAdv(int patchId, int ghostLev, PyObject *arrsOnPatches) const + void fillCellFieldOnPatchOnlyGhostAdv(mcIdType patchId, mcIdType ghostLev, PyObject *arrsOnPatches) const { std::vector arrsOnPatches2; convertFromPyObjVectorOfObj(arrsOnPatches,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",arrsOnPatches2); self->fillCellFieldOnPatchOnlyGhostAdv(patchId,ghostLev,arrsOnPatches2); } - void __delitem__(int patchId) + void __delitem__(mcIdType patchId) { self->removePatch(patchId); } - int __len__() const + mcIdType __len__() const { return self->getNumberOfPatches(); } @@ -5674,15 +5690,15 @@ namespace MEDCoupling { static const char msg0[]="MEDCouplingCartesianAMRMesh::New : error on 'origin' parameter !"; static const char msg1[]="MEDCouplingCartesianAMRMesh::New : error on 'dxyz' parameter !"; - const int *nodeStrctPtr(0); + const mcIdType *nodeStrctPtr(0); const double *originPtr(0),*dxyzPtr(0); - int sw,sz,val0; - std::vector bb0; + mcIdType sw,sz,val0; + std::vector bb0; nodeStrctPtr=convertIntStarLikePyObjToCppIntStar(nodeStrct,sw,sz,val0,bb0); // double val,val2; std::vector bb,bb2; - int sz1,sz2; + mcIdType sz1,sz2; originPtr=convertObjToPossibleCpp5_SingleCompo(origin,sw,val,bb,msg0,false,sz1); dxyzPtr=convertObjToPossibleCpp5_SingleCompo(dxyz,sw,val2,bb2,msg1,false,sz2); // @@ -5693,7 +5709,7 @@ namespace MEDCoupling { std::vector inp0; convertFromPyObjVectorOfObj(bso,SWIGTYPE_p_INTERP_KERNEL__BoxSplittingOptions,"BoxSplittingOptions",inp0); - std::vector< std::vector > inp2; + std::vector< std::vector > inp2; convertPyToVectorOfVectorOfInt(factors,inp2); self->createPatchesFromCriterionML(inp0,criterion,inp2,eps); } @@ -5714,13 +5730,13 @@ namespace MEDCoupling { public: virtual void synchronizeFineToCoarse(); - virtual void synchronizeFineToCoarseBetween(int fromLev, int toLev); + virtual void synchronizeFineToCoarseBetween(mcIdType fromLev, mcIdType toLev); virtual void synchronizeCoarseToFine(); - virtual void synchronizeCoarseToFineBetween(int fromLev, int toLev); + virtual void synchronizeCoarseToFineBetween(mcIdType fromLev, mcIdType toLev); virtual void synchronizeAllGhostZones(); virtual void synchronizeAllGhostZonesOfDirectChidrenOf(const MEDCouplingCartesianAMRMeshGen *mesh); - virtual void synchronizeAllGhostZonesAtASpecifiedLevel(int level); - virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(int level); + virtual void synchronizeAllGhostZonesAtASpecifiedLevel(mcIdType level); + virtual void synchronizeAllGhostZonesAtASpecifiedLevelUsingOnlyFather(mcIdType level); virtual void alloc(); virtual void dealloc(); %extend @@ -5738,7 +5754,7 @@ namespace MEDCoupling class MEDCouplingAMRAttribute : public MEDCouplingDataForGodFather, public TimeLabel { public: - int getNumberOfLevels() const; + mcIdType getNumberOfLevels() const; MEDCouplingAMRAttribute *deepCopy() const; MEDCouplingAMRAttribute *deepCpyWithoutGodFather() const; MEDCouplingFieldDouble *buildCellFieldOnRecurseWithoutOverlapWithoutGhost(MEDCouplingCartesianAMRMeshGen *mesh, const std::string& fieldName) const; @@ -5749,7 +5765,7 @@ namespace MEDCoupling std::string writeVTHB(const std::string& fileName) const; %extend { - static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) + static MEDCouplingAMRAttribute *New(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev) { std::vector< std::pair > fieldNamesCpp0; std::vector< std::pair > > fieldNamesCpp1; @@ -5767,7 +5783,7 @@ namespace MEDCoupling return ret; } - MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, int ghostLev) + MEDCouplingAMRAttribute(MEDCouplingCartesianAMRMesh *gf, PyObject *fieldNames, mcIdType ghostLev) { return MEDCoupling_MEDCouplingAMRAttribute_New(gf,fieldNames,ghostLev); } @@ -5790,7 +5806,7 @@ namespace MEDCoupling void spillNatures(PyObject *nfs) { - std::vector inp0; + std::vector inp0; if(!fillIntVector(nfs,inp0)) throw INTERP_KERNEL::Exception("wrap of MEDCouplingAMRAttribute::spillNatures : vector of NatureOfField enum expected !"); std::size_t sz(inp0.size()); @@ -5803,9 +5819,9 @@ namespace MEDCoupling PyObject *retrieveFieldsOn(MEDCouplingCartesianAMRMeshGen *mesh) const { std::vector ret(self->retrieveFieldsOn(mesh)); - int sz((int)ret.size()); + std::size_t sz(ret.size()); PyObject *retPy(PyList_New(sz)); - for(int i=0;i PyCallBackDataArrayChar; -typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt32; +typedef struct PyCallBackDataArraySt PyCallBackDataArrayInt64; typedef struct PyCallBackDataArraySt PyCallBackDataArrayFloat; typedef struct PyCallBackDataArraySt PyCallBackDataArrayDouble; @@ -85,9 +86,15 @@ extern "C" return (PyObject *)self; } - static PyObject *callbackmcdataarrayint___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) + static PyObject *callbackmcdataarrayint32___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - PyCallBackDataArrayInt *self = (PyCallBackDataArrayInt *) ( 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) + { + PyCallBackDataArrayInt64 *self = (PyCallBackDataArrayInt64 *) ( type->tp_alloc(type, 0) ); return (PyObject *)self; } @@ -124,7 +131,7 @@ extern "C" // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed. // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients. - static PyObject *callbackmcdataarrayint_call(PyCallBackDataArrayInt *self, PyObject *args, PyObject *kw) + static PyObject *callbackmcdataarrayint32_call(PyCallBackDataArrayInt32 *self, PyObject *args, PyObject *kw) { if(self->_pt_mc) { @@ -135,6 +142,19 @@ extern "C" return Py_None; } + // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed. + // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients. + static PyObject *callbackmcdataarrayint64_call(PyCallBackDataArrayInt64 *self, PyObject *args, PyObject *kw) + { + if(self->_pt_mc) + { + MEDCoupling::MemArray& mma=self->_pt_mc->accessToMemArray(); + mma.destroy(); + } + Py_XINCREF(Py_None); + return Py_None; + } + // real callback called when a numpy arr having more than one DataArray instance client on it is destroyed. // In this case, all the "weak" clients, except the first one, invoke this call back that desable the content of these "weak" clients. static PyObject *callbackmcdataarrayfloat_call(PyCallBackDataArrayFloat *self, PyObject *args, PyObject *kw) @@ -205,10 +225,10 @@ PyTypeObject PyCallBackDataArrayChar_RefType = { }; -PyTypeObject PyCallBackDataArrayInt_RefType = { +PyTypeObject PyCallBackDataArrayInt32_RefType = { PyVarObject_HEAD_INIT(&PyType_Type, 0) - "callbackmcdataarrayint", - sizeof(PyCallBackDataArrayInt), + "callbackmcdataarrayint32", + sizeof(PyCallBackDataArrayInt32), 0, callbackmcdataarray_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -220,7 +240,7 @@ PyTypeObject PyCallBackDataArrayInt_RefType = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - (ternaryfunc)callbackmcdataarrayint_call, /*tp_call*/ + (ternaryfunc)callbackmcdataarrayint32_call, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ @@ -243,7 +263,50 @@ PyTypeObject PyCallBackDataArrayInt_RefType = { 0, /*tp_dictoffset*/ callbackmcdataarray___init__, /*tp_init*/ PyType_GenericAlloc, /*tp_alloc*/ - callbackmcdataarrayint___new__, /*tp_new*/ + callbackmcdataarrayint32___new__, /*tp_new*/ + PyObject_GC_Del, /*tp_free*/ +}; + + +PyTypeObject PyCallBackDataArrayInt64_RefType = { + PyVarObject_HEAD_INIT(&PyType_Type, 0) + "callbackmcdataarrayint64", + sizeof(PyCallBackDataArrayInt64), + 0, + callbackmcdataarray_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + (ternaryfunc)callbackmcdataarrayint64_call, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + 0, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + callbackmcdataarray___init__, /*tp_init*/ + PyType_GenericAlloc, /*tp_alloc*/ + callbackmcdataarrayint64___new__, /*tp_new*/ PyObject_GC_Del, /*tp_free*/ }; @@ -352,6 +415,22 @@ struct NPYTraits static PyTypeObject *NPYFunc; static PyObject *Array_SWIGTYPE; }; + +template<> +struct NPYTraits +{ + static const int NPYObjectType=NPY_INT32; + static PyTypeObject *NPYFunc; + static PyObject *Array_SWIGTYPE; +}; + +template<> +struct NPYTraits +{ + static const int NPYObjectType=NPY_INT64; + static PyTypeObject *NPYFunc; + static PyObject *Array_SWIGTYPE; +}; #endif #endif diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index 29049764b..cc99dc9bb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -27,9 +27,41 @@ #include "InterpKernelAutoPtr.hxx" #include "MEDCouplingDataArrayTraits.hxx" +#include "MCType.hxx" #include +using namespace MEDCoupling; + +template +struct SWIGTITraits +{ }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +template<> +struct SWIGTITraits +{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; + +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt32 is null when called here ! Postpone initialization at inlined initializeMe() +swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayInt64 is null when called here ! Postpone initialization at inlined initializeMe() + static PyObject *convertArray(MEDCoupling::DataArray *array, int owner) { PyObject *ret(NULL); @@ -40,8 +72,10 @@ static PyObject *convertArray(MEDCoupling::DataArray *array, int owner) } if(dynamic_cast(array)) ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); - if(dynamic_cast(array)) - ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner); + if(dynamic_cast(array)) + ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner); if(dynamic_cast(array)) ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner); if(!ret) @@ -92,11 +126,11 @@ void GetIndicesOfSliceExplicitely(PyObject *slice, Py_ssize_t *start, Py_ssize_t throw INTERP_KERNEL::Exception(msgInCaseOfFailure); } -int InterpreteNegativeInt(int val, int nbelem) +int InterpreteNegativeInt(long val, mcIdType nbelem) { if(val<0) { - int newVal(nbelem+val); + int newVal((int)(nbelem+val)); if(newVal<0) { std::ostringstream oss; oss << "interpreteNegativeInt : request for negative int=" << val << " but number of elems is equal to " << nbelem << " !"; @@ -105,7 +139,7 @@ int InterpreteNegativeInt(int val, int nbelem) return newVal; } else - return val; + return (int)val; } #ifdef WITH_NUMPY @@ -133,6 +167,9 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype if(PyArray_DESCR(elt0)->type_num != npyObjectType) { std::ostringstream oss; oss << "Input numpy array has not the type " << msg << "!"; +#ifdef _DEBUG_ + oss << " type_num == " << PyArray_DESCR(elt0)->type_num; +#endif throw INTERP_KERNEL::Exception(oss.str().c_str()); } npy_intp sz0=PyArray_DIM(elt0,0); @@ -195,7 +232,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype void **objs=new void *[2]; objs[0]=cb; objs[1]=ref; mma.setParameterForDeallocator(objs); mma.setSpecificDeallocator(numarrdeal2); - //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayInt instance) ! Release it, or perform a copy on the input array !"); + //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayIdType instance) ! Release it, or perform a copy on the input array !"); } else { @@ -289,7 +326,7 @@ int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj) } template -PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, int nbTuples, int nbComp) +PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, mcIdType nbTuples, std::size_t nbComp) { if(!self->isAllocated()) { @@ -304,7 +341,7 @@ PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *M } int nbDims=nbComp==1?1:2; npy_intp dim[2]; - dim[0]=(npy_intp)nbTuples; dim[1]=nbComp; + dim[0]=(npy_intp)nbTuples; dim[1]=(npy_intp)nbComp; const T *bg=self->getConstPointer(); PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast(bg))); if(mem.isDeallocatorCalled()) @@ -346,35 +383,40 @@ PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr) return ToNumPyArrayUnderground(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents()); } -SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayInt32_toNumPyArray(MEDCoupling::DataArrayInt32 *self); +SWIGINTERN PyObject *MEDCoupling_DataArrayInt64_toNumPyArray(MEDCoupling::DataArrayInt64 *self); SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self); #endif #ifdef WITH_SCIPY -PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) +PyObject *ToCSRMatrix(const std::vector >& m, mcIdType nbCols) { - int nbRows((int)m.size()); - MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New()); + mcIdType nbRows((mcIdType)m.size()); + MEDCoupling::MCAuto indPtr(MEDCoupling::DataArrayIdType::New()),indices(MEDCoupling::DataArrayIdType::New()); MEDCoupling::MCAuto data(MEDCoupling::DataArrayDouble::New()); indPtr->alloc(nbRows+1,1); - int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; - int sz2(0); - for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++) + mcIdType *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++; + mcIdType sz2(0); + for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++) { - sz2+=(int)(*it0).size(); + sz2+=(mcIdType)(*it0).size(); *intPtr_ptr=sz2; } indices->alloc(sz2,1); data->alloc(sz2,1); - int *indices_ptr(indices->getPointer()); + mcIdType *indices_ptr(indices->getPointer()); double *data_ptr(data->getPointer()); - for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++) - for(std::map::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++) + for(std::vector >::const_iterator it0=m.begin();it0!=m.end();it0++) + for(std::map::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++) { *indices_ptr=(*it1).first; *data_ptr=(*it1).second; } - PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt_toNumPyArray(indPtr)); +#ifndef MEDCOUPLING_USE_64BIT_IDS + PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt32_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt32_toNumPyArray(indPtr)); +#else + PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt64_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt64_toNumPyArray(indPtr)); +#endif // PyObject *args(PyTuple_New(1)),*args0(PyTuple_New(3)),*kw(PyDict_New()),*kw1(PyTuple_New(2)); PyTuple_SetItem(args0,0,a); PyTuple_SetItem(args0,1,b); PyTuple_SetItem(args0,2,c); PyTuple_SetItem(args,0,args0); @@ -423,8 +465,10 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) } if(dynamic_cast(dac)) ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner); - if(dynamic_cast(dac)) - ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt32,owner); + if(dynamic_cast(dac)) + ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt64,owner); if(dynamic_cast(dac)) ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner); if(dynamic_cast(dac)) @@ -436,29 +480,32 @@ static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) return ret; } -static PyObject *convertIntArrToPyList(const int *ptr, int size) +template +static PyObject *convertIntArrToPyList(const T *ptr, mcIdType size) { PyObject *ret=PyList_New(size); - for(int i=0;i& v) +template +static PyObject *convertIntArrToPyList2(const std::vector& v) { - int size=v.size(); + std::size_t size=v.size(); PyObject *ret=PyList_New(size); - for(int i=0;i& v) +template +static PyObject *convertIntArrToPyList3(const std::set& v) { - int size=v.size(); + std::size_t size=v.size(); PyObject *ret=PyList_New(size); - std::set::const_iterator it=v.begin(); - for(int i=0;i::const_iterator it=v.begin(); + for(std::size_t i=0;i +static PyObject *convertIntArrToPyListOfTuple(const T *vals, mcIdType nbOfComp, mcIdType nbOfTuples) { PyObject *ret=PyList_New(nbOfTuples); - for(int i=0;i +static T *convertPyToNewIntArr2(PyObject *pyLi, mcIdType *size) { if(PyList_Check(pyLi)) { - *size=PyList_Size(pyLi); - int *tmp=new int[*size]; - for(int i=0;i<*size;i++) + *size=ToIdType(PyList_Size(pyLi)); + T *tmp=new T[*size]; + for(mcIdType i=0;i<*size;i++) { PyObject *o=PyList_GetItem(pyLi,i); if(PyInt_Check(o)) { - int val=(int)PyInt_AS_LONG(o); + T val=(T)PyInt_AS_LONG(o); tmp[i]=val; } else @@ -538,14 +587,14 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) } else if(PyTuple_Check(pyLi)) { - *size=PyTuple_Size(pyLi); - int *tmp=new int[*size]; - for(int i=0;i<*size;i++) + *size=ToIdType(PyTuple_Size(pyLi)); + T *tmp=new T[*size]; + for(mcIdType i=0;i<*size;i++) { PyObject *o=PyTuple_GetItem(pyLi,i); if(PyInt_Check(o)) { - int val=(int)PyInt_AS_LONG(o); + T val=(T)PyInt_AS_LONG(o); tmp[i]=val; } else @@ -562,7 +611,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) } } -static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) +static PyObject *convertFromVectorPairInt(const std::vector< std::pair >& arr) { PyObject *ret=PyList_New(arr.size()); for(std::size_t i=0;i return ret; } -static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) +static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair >& arr) { const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) +template +static void convertPyToNewIntArr3(PyObject *pyLi, std::vector& arr) { if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); + std::size_t size=PyTuple_Size(pyLi); arr.resize(size); - for(int i=0;i& arr) } } -static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector& arr) +static void convertPyToNewIntArr4(PyObject *pyLi, mcIdType recurseLev, mcIdType nbOfSubPart, std::vector& arr) { if(recurseLev<0) throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !"); arr.clear(); if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); - for(int i=0;i arr2; + std::vector arr2; convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2); - if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size()) + if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size()) { std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -756,20 +806,20 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); - for(int i=0;i arr2; + std::vector arr2; convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2); - if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size()) + if(nbOfSubPart>=1 && nbOfSubPart!=(mcIdType)arr2.size()) { std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " << recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -782,7 +832,7 @@ static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPar throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !"); } -static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) +static void checkFillArrayWithPyList(mcIdType size1, mcIdType size2, mcIdType& nbOfTuples, mcIdType& nbOfComp) { if(nbOfTuples==-1) { @@ -822,12 +872,13 @@ static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& } } -static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector& ret) +template< class T > +static void fillArrayWithPyListInt3(PyObject *pyLi, mcIdType& nbOfElt, std::vector& ret) { static const char MSG[]="fillArrayWithPyListInt3 : It appears that the input list or tuple is composed by elts having different sizes !"; if(PyInt_Check(pyLi)) { - long val=PyInt_AS_LONG(pyLi); + T val=(T)PyInt_AS_LONG(pyLi); if(nbOfElt==-1) nbOfElt=1; else @@ -837,12 +888,12 @@ static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) +template< class T = mcIdType > +static std::vector fillArrayWithPyListInt2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp) { - std::vector ret; - int size1=-1,size2=-1; + std::vector ret; + mcIdType size1=-1,size2=-1; if(PyList_Check(pyLi)) { - size1=PyList_Size(pyLi); - for(int i=0;i fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, } else if(PyTuple_Check(pyLi)) { - size1=PyTuple_Size(pyLi); - for(int i=0;i& vec) { Py_ssize_t sz=PyList_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) { Py_ssize_t sz=PyTuple_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) +static bool fillIntVector(PyObject *pyLi, std::vector& vec) { if(PyList_Check(pyLi)) { Py_ssize_t sz=PyList_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) { Py_ssize_t sz=PyTuple_Size(pyLi); vec.resize(sz); - for(int i=0;i& vec) return false; } -static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) +static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector >& arr) { const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !"; if(PyList_Check(pyLi)) { Py_ssize_t sz=PyList_Size(pyLi); arr.resize(sz); - for(int i=0;i > item; @@ -1062,12 +1114,12 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st { Py_ssize_t sz=PyTuple_Size(pyLi); arr.resize(sz); - for(int i=0;i > item; @@ -1087,42 +1139,42 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st } template -PyObject *convertDblArrToPyList(const T *ptr, int size) +PyObject *convertDblArrToPyList(const T *ptr, std::size_t size) { PyObject *ret(PyList_New(size)); - for(int i=0;i& v) { - int size(v.size()); + std::size_t size(v.size()); PyObject *ret(PyList_New(size)); - for(int i=0;i -PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples) +PyObject *convertDblArrToPyListOfTuple(const T *vals, std::size_t nbOfComp, mcIdType nbOfTuples) { PyObject *ret(PyList_New(nbOfTuples)); - for(int i=0;i tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0'; - for(int i=0;i& ret) +static void fillArrayWithPyListDbl3(PyObject *pyLi, mcIdType& nbOfElt, std::vector& ret) { static const char MSG[]="fillArrayWithPyListDbl3 : It appears that the input list or tuple is composed by elts having different sizes !"; if(PyFloat_Check(pyLi)) @@ -1203,8 +1255,8 @@ static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) +static std::vector fillArrayWithPyListDbl2(PyObject *pyLi, mcIdType& nbOfTuples, mcIdType& nbOfComp) { std::vector ret; - int size1=-1,size2=-1; + std::size_t size1=-1; + mcIdType size2=-1; if(PyList_Check(pyLi)) { size1=PyList_Size(pyLi); - for(int i=0;i fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTupl else if(PyTuple_Check(pyLi)) { size1=PyTuple_Size(pyLi); - for(int i=0;i fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTupl else throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl2 : Unrecognized type ! Should be a tuple or a list !"); // - checkFillArrayWithPyList(size1,size2,nbOfTuples,nbOfComp); + checkFillArrayWithPyList(ToIdType(size1),ToIdType(size2),nbOfTuples,nbOfComp); return ret; } @@ -1294,9 +1347,9 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons void *argp=0; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i cpp int sw=1 * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 - * if python DataArrayInt -> cpp DataArrayInt sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 + * if python DataArrayIdType -> cpp DataArrayIdType sw=3 + * if python DataArrayIntTuple -> cpp DataArrayIdTypeTuple sw=4 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) +template< class T, class ARRAY > +static void convertIntStarLikePyObjToCpp(PyObject *value, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, ARRAY *& daIntTyypp, typename MEDCoupling::Traits< T >::ArrayTuple *&daIntTuple) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(T)PyInt_AS_LONG(value); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< ARRAY * >(argp); sw=3; return; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + daIntTuple=reinterpret_cast< typename MEDCoupling::Traits< T >::ArrayTuple * >(argp); sw=4; return ; } - throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); + throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple"); } /*! * if python int -> cpp int sw=1 * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 - * if python DataArrayInt -> cpp DataArrayInt sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 + * if python DataArrayIdType -> cpp DataArrayIdType sw=3 + * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector& stdvecTyypp) +template< class T > +static const T *convertIntStarLikePyObjToCppIntStar(PyObject *value, mcIdType& sw, mcIdType& sz, T& iTyypp, std::vector& stdvecTyypp) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(T)PyInt_AS_LONG(value); sw=1; sz=1; return &iTyypp; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + typedef typename MEDCoupling::Traits< T >::ArrayType ARRAY; + ARRAY *daIntTyypp=reinterpret_cast< ARRAY * >(argp); if(daIntTyypp) { sw=3; sz=daIntTyypp->getNbOfElems(); @@ -1478,14 +1534,15 @@ static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, return 0; } } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); - sw=4; sz=daIntTuple->getNumberOfCompo(); + typedef typename MEDCoupling::Traits< T >::ArrayTuple ARRAYTUPLE; + ARRAYTUPLE *daIntTuple=reinterpret_cast< ARRAYTUPLE * >(argp); + sw=4; sz=ToIdType(daIntTuple->getNumberOfCompo()); return daIntTuple->getConstPointer(); } - throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple"); + throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayIdType, DataArrayIdTypeTuple"); } /*! @@ -1497,10 +1554,10 @@ static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, * if python tuple[int] -> cpp vector sw=2 * if python DataArrayDouble -> cpp DataArrayDouble sw=3 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ template -void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) +void considerPyObjAsATStarLikeObject(PyObject *value, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, typename MEDCoupling::Traits::ArrayType *& daIntTyypp, swig_type_info *ti) { sw=-1; if(PyFloat_Check(value)) @@ -1517,9 +1574,9 @@ void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::v } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i cpp vector sw=2 * if python DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) +static void convertDoubleStarLikePyObjToCpp(PyObject *value, mcIdType& sw, double& iTyypp, std::vector& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) { sw=-1; if(PyFloat_Check(value)) @@ -1591,9 +1648,9 @@ static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iT } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i -void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits::ArrayType *&d, typename MEDCoupling::Traits::ArrayTuple *&e, std::vector& f, swig_type_info *ti_da, swig_type_info *ti_tuple) +void convertFPStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, T& val, typename MEDCoupling::Traits::ArrayType *&d, typename MEDCoupling::Traits::ArrayTuple *&e, std::vector& f, swig_type_info *ti_da, swig_type_info *ti_tuple) { sw=-1; if(PyFloat_Check(value)) { - val=PyFloat_AS_DOUBLE(value); + val=(T)PyFloat_AS_DOUBLE(value); sw=1; return; } @@ -1655,13 +1712,13 @@ void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename ME } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); f.resize(size); - for(int i=0;i cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) +static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f) { convertFPStarLikePyObjToCpp_2(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple); } @@ -1732,7 +1789,7 @@ static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector& f) +static void convertFloatStarLikePyObjToCpp_2(PyObject *value, mcIdType& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector& f) { convertFPStarLikePyObjToCpp_2(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple); } @@ -1742,29 +1799,30 @@ static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& va * if python list[int] -> cpp vector sw=2 * if python tuple[int] -> cpp vector sw=2 * if python slicp -> cpp pair sw=3 (begin,end,step) - * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown. + * if python DataArrayIdType -> cpp DataArrayIdType sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown. * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) +template +static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ARRAY *& daIntTyypp) { - const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple"; + const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdType, DataArrayIdTypeTuple"; sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=(T)PyInt_AS_LONG(value); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI,0|0); if(SWIG_IsOK(status)) { - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp); + daIntTyypp=reinterpret_cast< ARRAY * >(argp); if(!daIntTyypp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1815,10 +1873,11 @@ static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int sw=4; return ; } - status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0); + status=SWIG_ConvertPtr(value,&argp,SWIGTITraits< typename ARRAY::Type >::TI_TUPLE,0|0); if(SWIG_IsOK(status)) { - MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + typedef typename MEDCoupling::Traits< typename ARRAY::Type >::ArrayTuple ARRAYTUPLE; + ARRAYTUPLE *tmp=reinterpret_cast< ARRAYTUPLE * >(argp); if(!tmp) { std::ostringstream oss; oss << msg << " Instance in null !"; @@ -1835,12 +1894,13 @@ static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int /*! * Idem than convertIntStarOrSliceLikePyObjToCpp */ -static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayInt *& daIntTyypp) +template +static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, mcIdType nbelem, mcIdType& sw, T& iTyypp, std::vector& stdvecTyypp, std::pair >& p, ARRAY *& daIntTyypp) { convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp); if(sw==1) { - iTyypp=InterpreteNegativeInt(iTyypp,nbelem); + iTyypp=(T)InterpreteNegativeInt(iTyypp,nbelem); } } @@ -1849,26 +1909,27 @@ static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, * if python tuple[int] -> cpp vector sw=2 * if python list[int] -> cpp vector sw=2 * if python slice -> cpp pair sw=3 - * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer ! + * if python DataArrayIdTypeTuple -> cpp DataArrayIdTypeTuple sw=4 . WARNING The returned pointer can be the null pointer ! */ -static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector& stdvecTyypp, std::pair >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) +template< class TUPLE_T > +static void convertObjToPossibleCpp22(PyObject *value, mcIdType nbelem, mcIdType& sw, mcIdType& iTyypp, std::vector& stdvecTyypp, std::pair >& p, typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple *& daIntTyypp) { sw=-1; if(PyInt_Check(value)) { - iTyypp=(int)PyInt_AS_LONG(value); + iTyypp=ToIdType(PyInt_AS_LONG(value)); sw=1; return; } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); stdvecTyypp.resize(size); - for(int i=0;i::TI_TUPLE,0|0); if(!SWIG_IsOK(status)) - throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIntTuple"); - daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp); + throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIdTypeTuple"); + daIntTyypp=reinterpret_cast< typename MEDCoupling::Traits< TUPLE_T >::ArrayTuple * >(argp); sw=4; } @@ -1921,7 +1982,7 @@ static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4 * switch between (int,string,vector,DataArrayChar) */ -static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) +static void convertObjToPossibleCpp6(PyObject *value, mcIdType& sw, char& cTyp, std::string& sType, std::vector& vsType, MEDCoupling::DataArrayChar *& dacType) { const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance."; sw=-1; @@ -1963,9 +2024,9 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: #endif if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); vsType.resize(size); - for(int i=0;i vt sw=2 * if value tuple[int] -> vt sw=2 * if value slice -> pt sw=3 - * if value DataArrayInt -> dt sw=4 + * if value DataArrayIdType -> dt sw=4 * if value tuple [int,int] -> cpp it,ip sw=5 * if value tuple [list[int],int] -> cpp vt,ip sw=6 * if value tuple [tuple[int],int] -> cpp vt,ip sw=6 @@ -2044,11 +2105,12 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std:: * if value tuple [slice,slice] -> cpp pt,pc sw=15 * if value tuple [DaI,slice] -> cpp dt,pc sw=16 * - * switch between (int,vector,DataArrayInt) + * switch between (int,vector,DataArrayIdType) */ -static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector& vt, std::vector& vc, - std::pair >& pt, std::pair >& pc, - MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) +template +static void convertObjToPossibleCpp3(PyObject *value, mcIdType nbTuple, int nbCompo, mcIdType& sw, mcIdType& it, TC& ic, std::vector& vt, std::vector& vc, + std::pair >& pt, std::pair >& pc, + MEDCoupling::DataArrayIdType *&dt, MEDCoupling::DataArrayIdType *&dc) { if(!PyTuple_Check(value)) { @@ -2057,11 +2119,11 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, } else { - int sz=PyTuple_Size(value); + std::size_t sz=PyTuple_Size(value); if(sz!=2) throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !"); PyObject *ob0=PyTuple_GetItem(value,0); - int sw1,sw2; + mcIdType sw1,sw2; convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt); PyObject *ob1=PyTuple_GetItem(value,1); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc); @@ -2077,8 +2139,8 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) +static const double *convertObjToPossibleCpp5_Safe(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, + const char *msg, mcIdType nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) { sw=-1; if(PyFloat_Check(value)) @@ -2107,7 +2169,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { try { - int tmp1=nbTuplesExpected,tmp2=nbCompExpected; + mcIdType tmp1=nbTuplesExpected,tmp2=nbCompExpected; std::vector ret=fillArrayWithPyListDbl2(value,tmp1,tmp2); sw=4; f=ret; @@ -2125,7 +2187,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { if(d->getNumberOfTuples()==nbTuplesExpected) { - if(d->getNumberOfComponents()==nbCompExpected) + if(ToIdType(d->getNumberOfComponents())==nbCompExpected) { return d->getConstPointer(); } @@ -2157,7 +2219,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou { e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp); sw=3; - if(e->getNumberOfCompo()==nbCompExpected) + if(ToIdType(e->getNumberOfCompo())==nbCompExpected) { if(nbTuplesExpected==1) return e->getConstPointer(); @@ -2184,8 +2246,8 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, - const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) +static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, mcIdType& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector& f, + const char *msg, int nbCompExpected, bool throwIfNullPt, mcIdType& nbTuples) { sw=-1; if(PyFloat_Check(value)) @@ -2214,9 +2276,9 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); f.resize(size); - for(int i=0;igetNumberOfComponents()==nbCompExpected) + if(ToIdType(d->getNumberOfComponents())==nbCompExpected) { nbTuples=d->getNumberOfTuples(); return d->getConstPointer(); @@ -2301,7 +2363,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do sw=3; if(e) { - if(e->getNumberOfCompo()==nbCompExpected) + if(ToIdType(e->getNumberOfCompo())==nbCompExpected) { nbTuples=1; return e->getConstPointer(); @@ -2334,8 +2396,8 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do * if value list[int,double] -> cpp std::vector sw=4 * if value tuple[int,double] -> cpp std::vector sw=4 */ -static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector& f, - const char *msg, bool throwIfNullPt, int& nbTuples) +static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, mcIdType& sw, double& val, std::vector& f, + const char *msg, bool throwIfNullPt, mcIdType& nbTuples) { MEDCoupling::DataArrayDouble *d=0; MEDCoupling::DataArrayDoubleTuple *e=0; @@ -2356,9 +2418,9 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& } if(PyTuple_Check(value)) { - int size=PyTuple_Size(value); + std::size_t size=PyTuple_Size(value); f.resize(size); - for(int i=0;igetNumberOfCompo(); + nbTuples=ToIdType(e->getNumberOfCompo()); return e->getConstPointer(); } else @@ -2459,15 +2521,19 @@ static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt32,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt64,0|0); if(!SWIG_IsOK(status)) { - status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0); - std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0); + if(!SWIG_IsOK(status)) + { + status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0); + std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayIdType, DataArrayAsciiChar, DataArrayByte !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } } } } @@ -2505,14 +2571,14 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !"); if(elt2) { if(PyInt_Check(elt2)) {//DataArrayDouble.New([1.,3.,4.,5.],2,2) - int nbOfCompo=PyInt_AS_LONG(elt2); + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(elt2)); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); @@ -2526,7 +2592,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 else {//DataArrayDouble.New([1.,3.,4.],3) MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); - int tmpp1(-1); + mcIdType tmpp1(-1); std::vector tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1)); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -2538,7 +2604,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 else {// DataArrayDouble.New([1.,3.,4.]) MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); - int tmpp1(-1),tmpp2(-1); + mcIdType tmpp1(-1),tmpp2(-1); std::vector tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); @@ -2546,7 +2612,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 } else if(PyInt_Check(elt0)) { - int nbOfTuples1(PyInt_AS_LONG(elt0)); + mcIdType nbOfTuples1(ToIdType(PyInt_AS_LONG(elt0))); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !"); if(nbOfTuples) @@ -2555,7 +2621,7 @@ static typename MEDCoupling::Traits::ArrayType *DataArrayT_New(PyObject *elt0 { if(PyInt_Check(nbOfTuples)) {//DataArrayDouble.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !"); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > ret(MEDCoupling::Traits::ArrayType::New()); @@ -2591,16 +2657,18 @@ typename MEDCoupling::Traits::ArrayType *DataArrayT__setitem__internal(typena { self->checkAllocated(); const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !"; - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int sw1,sw2; + mcIdType nbOfTuples(self->getNumberOfTuples()); + int nbOfComponents((int)(self->getNumberOfComponents())); + mcIdType sw1,sw2; T i1; std::vector v1; typename MEDCoupling::Traits::ArrayType *d1=0; considerPyObjAsATStarLikeObject(value,sw1,i1,v1,d1,ti); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - MEDCoupling::DataArrayInt *dt1=0,*dc1=0; + mcIdType it1,ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + MEDCoupling::DataArrayIdType *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > tmp; switch(sw2) @@ -2937,12 +3005,15 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !"; const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; self->checkAllocated(); - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - MEDCoupling::DataArrayInt *dt1=0,*dc1=0; - int sw; + mcIdType nbOfTuples(self->getNumberOfTuples()); + int nbOfComponents((int)(self->getNumberOfComponents())); + mcIdType it1; + std::size_t ic1; + std::vector vt1; + std::vector vc1; + std::pair > pt1,pc1; + MEDCoupling::DataArrayIdType *dt1=0,*dc1=0; + mcIdType sw; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); MEDCoupling::MCAuto::ArrayType > ret; switch(sw) @@ -2962,19 +3033,19 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A case 6: { ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 7: { ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 8: { ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - std::vector v2(1,ic1); + std::vector v2(1,ic1); return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 9: @@ -3000,17 +3071,17 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A case 13: { ret=self->selectByTupleIdSafe(&it1,&it1+1); - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); - for(int i=0;i v2(nbOfComp); + for(mcIdType i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); } case 14: { ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3018,8 +3089,8 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A case 15: { ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3027,8 +3098,8 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits::A case 16: { ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); - std::vector v2(nbOfComp); + mcIdType nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2)); + std::vector v2(nbOfComp); for(int i=0;ikeepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 ); @@ -3057,7 +3128,7 @@ bool isCSRMatrix(PyObject *m) #endif } -void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptrPtr, const MEDCoupling::DataArrayInt *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector >& mCpp) +void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt32 *indptrPtr, const MEDCoupling::DataArrayInt32 *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector >& mCpp) { auto nbOfRows(indptrPtr->getNumberOfTuples()-1); if(nbOfRows<0) @@ -3076,7 +3147,7 @@ void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptr } } -void convertToVectMapIntDouble(PyObject *pyobj, std::vector >& mCpp) +void convertToVectMapIntDouble(PyObject *pyobj, std::vector >& mCpp) { if(!PyList_Check(pyobj)) throw INTERP_KERNEL::Exception("convertToVectMapIntDouble : input is not a python list !"); @@ -3093,7 +3164,7 @@ void convertToVectMapIntDouble(PyObject *pyobj, std::vector } PyObject *key, *value; Py_ssize_t pos(0); - std::map& mapCpp(mCpp[i]); + std::map& mapCpp(mCpp[i]); while(PyDict_Next(elt,&pos,&key,&value)) { if(!PyInt_Check(key)) @@ -3106,7 +3177,7 @@ void convertToVectMapIntDouble(PyObject *pyobj, std::vector std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist the dict contains at pos " << pos << " the value not mappable to pyfloat !"; throw INTERP_KERNEL::Exception(oss.str()); } - mapCpp[(int)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value); + mapCpp[ToIdType(PyInt_AS_LONG(key))]=PyFloat_AS_DOUBLE(value); } } } @@ -3119,7 +3190,7 @@ PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3144,7 +3215,7 @@ PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->multiplyEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3162,7 +3233,7 @@ PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3170,7 +3241,7 @@ PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename { if(val==0.) throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !"); - self->applyLin(1./val,0.); + self->applyLin((T)(1./val),(T)0.); Py_XINCREF(trueSelf); return trueSelf; } @@ -3189,7 +3260,7 @@ PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->divideEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3207,7 +3278,7 @@ PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3232,7 +3303,7 @@ PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->addEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3250,7 +3321,7 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,ti_da,ti_tuple); switch(sw) { @@ -3275,7 +3346,7 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename } case 4: { - MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); self->substractEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -3285,33 +3356,14 @@ PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename } } -template -struct SWIGTITraits -{ }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -template<> -struct SWIGTITraits -{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; }; - -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() -swig_type_info *SWIGTITraits::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe() - #ifdef WITH_NUMPY PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayDouble_RefType; PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayFloat_RefType; + +PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayInt32_RefType; + +PyTypeObject *NPYTraits::NPYFunc=&PyCallBackDataArrayInt64_RefType; #endif template @@ -3358,7 +3410,7 @@ typename MEDCoupling::Traits::ArrayType *DataArrayFPT_rmul(typename MEDCoupli typename MEDCoupling::Traits::ArrayType *a; typename MEDCoupling::Traits::ArrayTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertFPStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb,SWIGTITraits::TI,SWIGTITraits::TI_TUPLE); switch(sw) { @@ -3375,7 +3427,7 @@ typename MEDCoupling::Traits::ArrayType *DataArrayFPT_rmul(typename MEDCoupli } case 4: { - typename MEDCoupling::MCAuto::ArrayType> aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size()); + typename MEDCoupling::MCAuto::ArrayType> aaa(MEDCoupling::Traits::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,bb.size()); return MEDCoupling::Traits::ArrayType::Multiply(self,aaa); } default: diff --git a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i index 4b973f257..c70d046f7 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i @@ -50,7 +50,7 @@ namespace MEDCoupling virtual const char *getRepr() const; virtual int getNumberOfTuples(const MEDCouplingMesh *mesh) const; virtual int getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const; - virtual DataArrayInt *getOffsetArr(const MEDCouplingMesh *mesh) const; + virtual DataArrayIdType *getOffsetArr(const MEDCouplingMesh *mesh) const; virtual DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const; virtual void checkCompatibilityWithNature(NatureOfField nat) const; virtual double getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da, int cellId, int nodeIdInCell, int compoId) const; @@ -67,21 +67,21 @@ namespace MEDCoupling { virtual MEDCouplingFieldDiscretization *clonePart(PyObject *li) { - int sz=0,sw=-1,val1=-1; - std::vector val2; - const int *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2); + mcIdType sz=0,sw=-1,val1=-1; + std::vector val2; + const mcIdType *inp=convertIntStarLikePyObjToCppIntStar(li,sw,sz,val1,val2); return self->clonePart(inp,inp+sz); } - virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const + virtual PyObject *buildSubMeshDataRange(const MEDCouplingMesh *mesh, mcIdType beginCellIds, mcIdType endCellIds, mcIdType stepCellIds, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const { - DataArrayInt *ret1=0; - int bb,ee,ss; + DataArrayIdType *ret1=0; + mcIdType bb,ee,ss; MEDCouplingMesh *ret0=self->buildSubMeshDataRange(mesh,beginCellIds,endCellIds,stepCellIds,bb,ee,ss,ret1); PyObject *res=PyTuple_New(2); PyTuple_SetItem(res,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); if(ret1) - PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); + PyTuple_SetItem(res,1,SWIG_NewPointerObj((void*)ret1,SWIGTITraits::TI,SWIG_POINTER_OWN | 0)); else { PyObject *res1=PySlice_New(PyInt_FromLong(bb),PyInt_FromLong(ee),PyInt_FromLong(ss)); @@ -90,27 +90,27 @@ namespace MEDCoupling return res; } - virtual int getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const + virtual mcIdType getNumberOfTuplesExpectedRegardingCode(PyObject *code, PyObject *idsPerType) const { - std::vector inp0; + std::vector inp0; convertPyToNewIntArr4(code,1,3,inp0); - std::vector inp1; - convertFromPyObjVectorOfObj(idsPerType,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",inp1); + std::vector inp1; + convertFromPyObjVectorOfObj(idsPerType,SWIGTITraits::TI,"DataArrayIdType",inp1); return self->getNumberOfTuplesExpectedRegardingCode(inp0,inp1); } virtual PyObject *computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, PyObject *tupleIds) const { - std::vector vVal; int iVal=-1; - int sz=-1,sw=0; - const int *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal); + std::vector vVal; mcIdType iVal=-1; + mcIdType sz=-1,sw=0; + const mcIdType *tupleIdsBg=convertIntStarLikePyObjToCppIntStar(tupleIds,sw,sz,iVal,vVal); if(sw==0) throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::computeMeshRestrictionFromTupleIds : none parameter in input !"); - DataArrayInt *ret0=0,*ret1=0; + DataArrayIdType *ret0=0,*ret1=0; self->computeMeshRestrictionFromTupleIds(mesh,tupleIdsBg,tupleIdsBg+sz,ret0,ret1); PyObject *pyRet=PyTuple_New(2); - PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return pyRet; } @@ -118,7 +118,7 @@ namespace MEDCoupling { if(!arr) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL1 : input array is null !"); - int sz(arr->getNumberOfComponents()); + std::size_t sz(arr->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->normL1(mesh,arr,tmp); return convertDblArrToPyList(tmp,sz); @@ -128,7 +128,7 @@ namespace MEDCoupling { if(!arr) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::normL2 : input array is null !"); - int sz(arr->getNumberOfComponents()); + std::size_t sz(arr->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->normL2(mesh,arr,tmp); return convertDblArrToPyList(tmp,sz); @@ -138,38 +138,38 @@ namespace MEDCoupling { if(!arr) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::integral : input array is null !"); - int sz(arr->getNumberOfComponents()); + std::size_t sz(arr->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->integral(mesh,arr,isWAbs,tmp); return convertDblArrToPyList(tmp,sz); } - virtual PyObject *getCellIdsHavingGaussLocalization(int locId) const + virtual PyObject *getCellIdsHavingGaussLocalization(mcIdType locId) const { - std::vector tmp; + std::vector tmp; self->getCellIdsHavingGaussLocalization(locId,tmp); - DataArrayInt *ret=DataArrayInt::New(); - ret->alloc((int)tmp.size(),1); + DataArrayIdType *ret=DataArrayIdType::New(); + ret->alloc(tmp.size(),1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } virtual void setGaussLocalizationOnCells(const MEDCouplingMesh *m, PyObject *li, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& wg) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->setGaussLocalizationOnCells(m,tmp,((int *)tmp)+size,refCoo,gsCoo,wg); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + self->setGaussLocalizationOnCells(m,tmp,((mcIdType *)tmp)+size,refCoo,gsCoo,wg); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); da2->checkAllocated(); self->setGaussLocalizationOnCells(m,da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems(),refCoo,gsCoo,wg); } @@ -177,7 +177,7 @@ namespace MEDCoupling virtual PyObject *getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const { - std::set ret=self->getGaussLocalizationIdsOfOneType(type); + std::set ret=self->getGaussLocalizationIdsOfOneType(type); return convertIntArrToPyList3(ret); } @@ -187,7 +187,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; if(!mesh) throw INTERP_KERNEL::Exception("Python wrap of MEDCouplingFieldDiscretization::getValueOn : no underlying mesh !"); int spaceDim=mesh->getSpaceDimension(); @@ -199,22 +199,22 @@ namespace MEDCoupling return convertDblArrToPyList(res,spaceDim); } - virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, int i, int j, int k) const + virtual PyObject *getValueOnPos(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, mcIdType i, mcIdType j, mcIdType k) const { if(!arr) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretization::getValueOnPos : input array is null !"); - int sz(arr->getNumberOfComponents()); - INTERP_KERNEL::AutoPtr res=new double[sz]; - self->getValueOnPos(arr,mesh,i,j,k,res); - return convertDblArrToPyList(res,sz); - } + std::size_t sz(arr->getNumberOfComponents()); + INTERP_KERNEL::AutoPtr res=new double[sz]; + self->getValueOnPos(arr,mesh,i,j,k,res); + return convertDblArrToPyList(res,sz); + } virtual DataArrayDouble *getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, PyObject *loc) const { if(!mesh) throw INTERP_KERNEL::Exception("Python wrap MEDCouplingFieldDiscretization::getValueOnMulti : null input mesh !"); // - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(loc,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDouble::getValueOnMulti", mesh->getSpaceDimension(),true,nbPts); @@ -223,9 +223,9 @@ namespace MEDCoupling virtual void renumberCells(PyObject *li, bool check=true) { - int sw,sz(-1); - int v0; std::vector v1; - const int *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *ids(convertIntStarLikePyObjToCppIntStar(li,sw,sz,v0,v1)); self->renumberCells(ids,check); } @@ -235,55 +235,55 @@ namespace MEDCoupling std::vector input1; convertFromPyObjVectorOfObj(arrays,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",input1); // - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); // self->renumberArraysForCell(mesh,input1,old2NewBg,check); } - virtual DataArrayInt *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const + virtual DataArrayIdType *computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, PyObject *cellIds) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *cellIdsBg(convertIntStarLikePyObjToCppIntStar(cellIds,sw,sz,v0,v1)); return self->computeTupleIdsToSelectFromCellIds(mesh,cellIdsBg,cellIdsBg+sz); } virtual PyObject *buildSubMeshData(const MEDCouplingMesh *mesh, PyObject *ids) { - int sw,sz(-1); - int v0; std::vector v1; - const int *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1)); - DataArrayInt *di(0); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *idsBg(convertIntStarLikePyObjToCppIntStar(ids,sw,sz,v0,v1)); + DataArrayIdType *di(0); MEDCouplingMesh *ret0=self->buildSubMeshData(mesh,idsBg,idsBg+sz,di); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,convertMesh(ret0, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(di),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, int newNbOfNodes, DataArrayDouble *arr) const + virtual void renumberValuesOnNodes(double epsOnVals, PyObject *old2New, mcIdType newNbOfNodes, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); self->renumberValuesOnNodes(epsOnVals,old2NewBg,newNbOfNodes,arr); } - virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, int newSz, DataArrayDouble *arr) const + virtual void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, PyObject *old2New, mcIdType newSz, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *old2NewBg(convertIntStarLikePyObjToCppIntStar(old2New,sw,sz,v0,v1)); self->renumberValuesOnCells(epsOnVals,mesh,old2NewBg,newSz,arr); } - virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, int newSz, DataArrayDouble *arr) const + virtual void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, PyObject *new2old, mcIdType newSz, DataArrayDouble *arr) const { - int sw,sz(-1); - int v0; std::vector v1; - const int *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1)); + mcIdType sw,sz(-1); + mcIdType v0; std::vector v1; + const mcIdType *new2oldBg(convertIntStarLikePyObjToCppIntStar(new2old,sw,sz,v0,v1)); self->renumberValuesOnCellsR(mesh,new2oldBg,newSz,arr); } } @@ -304,29 +304,29 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationPerCell : public MEDCouplingFieldDiscretization { public: - void setArrayOfDiscIds(const DataArrayInt *adids); + void setArrayOfDiscIds(const DataArrayIdType *adids); void checkNoOrphanCells() const; %extend { PyObject *getArrayOfDiscIds() const { - DataArrayInt *ret=const_cast(self->getArrayOfDiscIds()); + DataArrayIdType *ret=const_cast(self->getArrayOfDiscIds()); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *splitIntoSingleGaussDicrPerCellType() const { - std::vector ret1; - std::vector ret0=self->splitIntoSingleGaussDicrPerCellType(ret1); + std::vector ret1; + std::vector ret0=self->splitIntoSingleGaussDicrPerCellType(ret1); std::size_t sz=ret0.size(); PyObject *pyRet=PyTuple_New(2); - PyObject *pyRet0=PyList_New((int)sz); - PyObject *pyRet1=PyList_New((int)sz); + PyObject *pyRet0=PyList_New((mcIdType)sz); + PyObject *pyRet1=PyList_New((mcIdType)sz); for(std::size_t i=0;i::TI, SWIG_POINTER_OWN | 0 )); PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i])); } PyTuple_SetItem(pyRet,0,pyRet0); @@ -353,21 +353,21 @@ namespace MEDCoupling { std::size_t sz(0); const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(geoType,sz)); - return convertDblArrToPyList(ret,sz); + return convertDblArrToPyList(ret,ToIdType(sz)); } static PyObject *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) { std::size_t sz(0); const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(geoType,sz)); - return convertDblArrToPyList(ret,sz); + return convertDblArrToPyList(ret,ToIdType(sz)); } static PyObject *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) { std::size_t sz(0); const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(geoType,sz)); - return convertDblArrToPyList(ret,sz); + return convertDblArrToPyList(ret,ToIdType(sz)); } } }; @@ -375,12 +375,12 @@ namespace MEDCoupling class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes { public: - static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, int isDrift); + static DataArrayDouble *PerformDriftOfVec(const DataArrayDouble *arr, mcIdType isDrift); %extend { PyObject *computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr) const { - int ret1; + mcIdType ret1; DataArrayDouble *ret0=self->computeVectorOfCoefficients(mesh,arr,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -390,7 +390,7 @@ namespace MEDCoupling PyObject *computeInverseMatrix(const MEDCouplingMesh *mesh) const { - int ret1(-1),ret2(-1); + mcIdType ret1(-1),ret2(-1); DataArrayDouble *ret0=self->computeInverseMatrix(mesh,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -401,7 +401,7 @@ namespace MEDCoupling PyObject *computeMatrix(const MEDCouplingMesh *mesh) const { - int ret1(-1),ret2(-1); + mcIdType ret1(-1),ret2(-1); DataArrayDouble *ret0=self->computeMatrix(mesh,ret1,ret2); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -414,12 +414,12 @@ namespace MEDCoupling { if(!mesh) throw INTERP_KERNEL::Exception("wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts : input mesh is empty !"); - int sw,nbPts; + mcIdType sw,nbPts; double v0; MEDCoupling::DataArrayDouble *v1(0); MEDCoupling::DataArrayDoubleTuple *v2(0); std::vector v3; const double *inp=convertObjToPossibleCpp5_Safe2(locs,sw,v0,v1,v2,v3,"wrap of MEDCouplingFieldDiscretizationKriging::computeEvaluationMatrixOnGivenPts", mesh->getSpaceDimension(),true,nbPts); // - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0=self->computeEvaluationMatrixOnGivenPts(mesh,inp,nbPts,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); @@ -436,7 +436,7 @@ namespace MEDCoupling PyObject *performDrift(const DataArrayDouble *matr, const DataArrayDouble *arr) const { - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0(self->performDrift(matr,arr,ret1)); PyObject *res(PyTuple_New(2)); PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0)); @@ -446,7 +446,7 @@ namespace MEDCoupling static PyObject *PerformDriftRect(const DataArrayDouble *matr, const DataArrayDouble *arr) { - int ret1(-1); + mcIdType ret1(-1); DataArrayDouble *ret0(MEDCouplingFieldDiscretizationKriging::PerformDriftRect(matr,arr,ret1)); PyObject *res(PyTuple_New(2)); PyTuple_SetItem(res,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN | 0)); diff --git a/src/MEDCoupling_Swig/MEDCouplingFinalize.i b/src/MEDCoupling_Swig/MEDCouplingFinalize.i index 1cc2bfab0..801152b81 100644 --- a/src/MEDCoupling_Swig/MEDCouplingFinalize.i +++ b/src/MEDCoupling_Swig/MEDCouplingFinalize.i @@ -33,19 +33,33 @@ DataArrayDouble.__floordiv__=DataArrayDouble.__div__ DataArrayDouble.__ifloordiv__=MEDCouplingDataArrayDoubleIdiv DataArrayDouble.__rfloordiv__=DataArrayDouble.__rdiv__ -DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce -DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd -DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub -DataArrayInt.__imul__=MEDCouplingDataArrayIntImul -DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__imod__=MEDCouplingDataArrayIntImod -DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow -DataArrayInt.__truediv__=DataArrayInt.__div__ -DataArrayInt.__itruediv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__rtruediv__=DataArrayInt.__rdiv__ -DataArrayInt.__floordiv__=DataArrayInt.__div__ -DataArrayInt.__ifloordiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__rfloordiv__=DataArrayInt.__rdiv__ +DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce +DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd +DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub +DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul +DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv +DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod +DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow +DataArrayInt32.__truediv__=DataArrayInt32.__div__ +DataArrayInt32.__itruediv__=MEDCouplingDataArrayInt32Idiv +DataArrayInt32.__rtruediv__=DataArrayInt32.__rdiv__ +DataArrayInt32.__floordiv__=DataArrayInt32.__div__ +DataArrayInt32.__ifloordiv__=MEDCouplingDataArrayInt32Idiv +DataArrayInt32.__rfloordiv__=DataArrayInt32.__rdiv__ + +DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce +DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd +DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub +DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul +DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv +DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod +DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow +DataArrayInt64.__truediv__=DataArrayInt64.__div__ +DataArrayInt64.__itruediv__=MEDCouplingDataArrayInt64Idiv +DataArrayInt64.__rtruediv__=DataArrayInt64.__rdiv__ +DataArrayInt64.__floordiv__=DataArrayInt64.__div__ +DataArrayInt64.__ifloordiv__=MEDCouplingDataArrayInt64Idiv +DataArrayInt64.__rfloordiv__=DataArrayInt64.__rdiv__ DataArrayByte.__reduce__=MEDCouplingDataArrayByteReduce @@ -83,13 +97,21 @@ DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv DataArrayDoubleTuple.__itruediv__=MEDCouplingDataArrayDoubleTupleIdiv DataArrayDoubleTuple.__ifloordiv__=MEDCouplingDataArrayDoubleTupleIdiv -DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd -DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub -DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul -DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__itruediv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__ifloordiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod +DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd +DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub +DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul +DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod + +DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd +DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub +DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul +DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod DenseMatrix.__iadd__=MEDCouplingDenseMatrixIadd DenseMatrix.__isub__=MEDCouplingDenseMatrixIsub @@ -103,54 +125,69 @@ MEDCouplingIMesh.__reduce__=MEDCouplingIMeshReduce MEDCouplingMappedExtrudedMesh.__reduce__=MEDCouplingMappedExtrudedMeshReduce DataArrayAsciiCharIterator.__next__ = DataArrayAsciiCharIterator.next -DataArrayIntIterator.__next__ = DataArrayIntIterator.next +DataArrayInt32Iterator.__next__ = DataArrayInt32Iterator.next +DataArrayInt64Iterator.__next__ = DataArrayInt64Iterator.next DataArrayDoubleIterator.__next__ = DataArrayDoubleIterator.next MEDCouplingUMeshCellIterator.__next__ = MEDCouplingUMeshCellIterator.next MEDCouplingUMeshCellByTypeIterator.__next__ = MEDCouplingUMeshCellByTypeIterator.next + del INTERPKERNELExceptionReduce -del MEDCouplingDataArrayDoubleReduce -del MEDCouplingDataArrayFloatReduce -del MEDCouplingDataArrayIntReduce -del MEDCouplingDataArrayByteReduce -del MEDCouplingUMeshReduce +del MEDCoupling1SGTUMeshReduce del MEDCouplingCMeshReduce -del MEDCouplingIMeshReduce -del MEDCouplingMappedExtrudedMeshReduce del MEDCouplingCurveLinearMeshReduce -del MEDCoupling1SGTUMeshReduce -del MEDCoupling1DGTUMeshReduce -del MEDCouplingFieldDoubleReduce -del MEDCouplingFieldFloatReduce -del MEDCouplingFieldIntReduce -del MEDCouplingFieldTemplateReduce +del MEDCouplingDataArrayByteReduce del MEDCouplingDataArrayDoubleIadd -del MEDCouplingDataArrayDoubleIsub -del MEDCouplingDataArrayDoubleImul del MEDCouplingDataArrayDoubleIdiv -del MEDCouplingFieldDoubleIadd -del MEDCouplingFieldDoubleIsub -del MEDCouplingFieldDoubleImul -del MEDCouplingFieldDoubleIdiv -del MEDCouplingFieldDoubleIpow -del MEDCouplingDataArrayIntIadd -del MEDCouplingDataArrayIntIsub -del MEDCouplingDataArrayIntImul -del MEDCouplingDataArrayIntIdiv -del MEDCouplingDataArrayIntImod -del MEDCouplingDataArrayFloatIadd -del MEDCouplingDataArrayFloatIsub -del MEDCouplingDataArrayFloatImul -del MEDCouplingDataArrayFloatIdiv +del MEDCouplingDataArrayDoubleImul +del MEDCouplingDataArrayDoubleIpow +del MEDCouplingDataArrayDoubleIsub +del MEDCouplingDataArrayDoubleReduce del MEDCouplingDataArrayDoubleTupleIadd -del MEDCouplingDataArrayDoubleTupleIsub -del MEDCouplingDataArrayDoubleTupleImul del MEDCouplingDataArrayDoubleTupleIdiv -del MEDCouplingDataArrayIntTupleIadd -del MEDCouplingDataArrayIntTupleIsub -del MEDCouplingDataArrayIntTupleImul -del MEDCouplingDataArrayIntTupleIdiv -del MEDCouplingDataArrayIntTupleImod +del MEDCouplingDataArrayDoubleTupleImul +del MEDCouplingDataArrayDoubleTupleIsub +del MEDCouplingDataArrayFloatIadd +del MEDCouplingDataArrayFloatIdiv +del MEDCouplingDataArrayFloatImul +del MEDCouplingDataArrayFloatIsub +del MEDCouplingDataArrayFloatReduce +del MEDCouplingDataArrayInt32Iadd +del MEDCouplingDataArrayInt32Idiv +del MEDCouplingDataArrayInt32Imod +del MEDCouplingDataArrayInt32Imul +del MEDCouplingDataArrayInt32Ipow +del MEDCouplingDataArrayInt32Isub +del MEDCouplingDataArrayInt32Reduce +del MEDCouplingDataArrayInt32TupleIadd +del MEDCouplingDataArrayInt32TupleIdiv +del MEDCouplingDataArrayInt32TupleImod +del MEDCouplingDataArrayInt32TupleImul +del MEDCouplingDataArrayInt32TupleIsub +del MEDCouplingDataArrayInt64Iadd +del MEDCouplingDataArrayInt64Idiv +del MEDCouplingDataArrayInt64Imod +del MEDCouplingDataArrayInt64Imul +del MEDCouplingDataArrayInt64Ipow +del MEDCouplingDataArrayInt64Isub +del MEDCouplingDataArrayInt64Reduce +del MEDCouplingDataArrayInt64TupleIadd +del MEDCouplingDataArrayInt64TupleIdiv +del MEDCouplingDataArrayInt64TupleImod +del MEDCouplingDataArrayInt64TupleImul +del MEDCouplingDataArrayInt64TupleIsub del MEDCouplingDenseMatrixIadd del MEDCouplingDenseMatrixIsub +del MEDCouplingFieldDoubleIadd +del MEDCouplingFieldDoubleIdiv +del MEDCouplingFieldDoubleImul +del MEDCouplingFieldDoubleIpow +del MEDCouplingFieldDoubleIsub +del MEDCouplingFieldDoubleReduce +del MEDCouplingFieldFloatReduce +del MEDCouplingFieldIntReduce +del MEDCouplingFieldTemplateReduce +del MEDCouplingIMeshReduce +del MEDCouplingMappedExtrudedMeshReduce +del MEDCouplingUMeshReduce %} diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index f096deb75..4c988d334 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -41,9 +41,19 @@ $result=convertDataArrayChar($1,$owner); } -%typemap(out) MCAuto +%typemap(out) MCAuto { - $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0); + $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt32,SWIG_POINTER_OWN|0); +} + +%typemap(out) MCAuto +{ + $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt64,SWIG_POINTER_OWN|0); +} + +%typemap(out) MCAuto +{ + $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTITraits::TI,SWIG_POINTER_OWN|0); } %typemap(out) MCAuto @@ -74,78 +84,150 @@ %newobject MEDCoupling::DataArrayFloat::__iter__; %newobject MEDCoupling::DataArrayFloat::Meld; %newobject MEDCoupling::DataArrayFloat::__rmul__; -%newobject MEDCoupling::DataArrayInt::New; -%newobject MEDCoupling::DataArrayInt::__iter__; -%newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef; -%newobject MEDCoupling::DataArrayInt::subArray; -%newobject MEDCoupling::DataArrayInt::changeNbOfComponents; -%newobject MEDCoupling::DataArrayInt::accumulatePerChunck; -%newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation; -%newobject MEDCoupling::DataArrayInt::transformWithIndArrR; -%newobject MEDCoupling::DataArrayInt::renumber; -%newobject MEDCoupling::DataArrayInt::renumberR; -%newobject MEDCoupling::DataArrayInt::renumberAndReduce; -%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O; -%newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N; -%newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis; -%newobject MEDCoupling::DataArrayInt::findIdsEqual; -%newobject MEDCoupling::DataArrayInt::findIdsNotEqual; -%newobject MEDCoupling::DataArrayInt::findIdsEqualList; -%newobject MEDCoupling::DataArrayInt::findIdsNotEqualList; -%newobject MEDCoupling::DataArrayInt::findIdsEqualTuple; -%newobject MEDCoupling::DataArrayInt::findIdForEach; -%newobject MEDCoupling::DataArrayInt::sumPerTuple; -%newobject MEDCoupling::DataArrayInt::negate; -%newobject MEDCoupling::DataArrayInt::computeAbs; -%newobject MEDCoupling::DataArrayInt::findIdsInRange; -%newobject MEDCoupling::DataArrayInt::findIdsNotInRange; -%newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative; -%newobject MEDCoupling::DataArrayInt::Aggregate; -%newobject MEDCoupling::DataArrayInt::AggregateIndexes; -%newobject MEDCoupling::DataArrayInt::Meld; -%newobject MEDCoupling::DataArrayInt::Add; -%newobject MEDCoupling::DataArrayInt::Substract; -%newobject MEDCoupling::DataArrayInt::Multiply; -%newobject MEDCoupling::DataArrayInt::Divide; -%newobject MEDCoupling::DataArrayInt::Pow; -%newobject MEDCoupling::DataArrayInt::BuildUnion; -%newobject MEDCoupling::DataArrayInt::BuildIntersection; -%newobject MEDCoupling::DataArrayInt::Range; -%newobject MEDCoupling::DataArrayInt::indicesOfSubPart; -%newobject MEDCoupling::DataArrayInt::fromNoInterlace; -%newobject MEDCoupling::DataArrayInt::toNoInterlace; -%newobject MEDCoupling::DataArrayInt::buildComplement; -%newobject MEDCoupling::DataArrayInt::buildUnion; -%newobject MEDCoupling::DataArrayInt::buildSubstraction; -%newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized; -%newobject MEDCoupling::DataArrayInt::buildIntersection; -%newobject MEDCoupling::DataArrayInt::buildUnique; -%newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted; -%newobject MEDCoupling::DataArrayInt::deltaShiftIndex; -%newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges; -%newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr; -%newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple; -%newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple; -%newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes; -%newobject MEDCoupling::DataArrayInt::buildPermutationArr; -%newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel; -%newobject MEDCoupling::DataArrayInt::getDifferentValues; -%newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond; -%newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation; -%newobject MEDCoupling::DataArrayInt::__neg__; -%newobject MEDCoupling::DataArrayInt::__add__; -%newobject MEDCoupling::DataArrayInt::__radd__; -%newobject MEDCoupling::DataArrayInt::__sub__; -%newobject MEDCoupling::DataArrayInt::__rsub__; -%newobject MEDCoupling::DataArrayInt::__mul__; -%newobject MEDCoupling::DataArrayInt::__rmul__; -%newobject MEDCoupling::DataArrayInt::__div__; -%newobject MEDCoupling::DataArrayInt::__rdiv__; -%newobject MEDCoupling::DataArrayInt::__mod__; -%newobject MEDCoupling::DataArrayInt::__rmod__; -%newobject MEDCoupling::DataArrayInt::__pow__; -%newobject MEDCoupling::DataArrayInt::__rpow__; -%newobject MEDCoupling::DataArrayIntTuple::buildDAInt; +%newobject MEDCoupling::DataArrayInt32::New; +%newobject MEDCoupling::DataArrayInt32::__iter__; +%newobject MEDCoupling::DataArrayInt32::performCopyOrIncrRef; +%newobject MEDCoupling::DataArrayInt32::subArray; +%newobject MEDCoupling::DataArrayInt32::changeNbOfComponents; +%newobject MEDCoupling::DataArrayInt32::accumulatePerChunck; +%newobject MEDCoupling::DataArrayInt32::checkAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt32::transformWithIndArrR; +%newobject MEDCoupling::DataArrayInt32::renumber; +%newobject MEDCoupling::DataArrayInt32::renumberR; +%newobject MEDCoupling::DataArrayInt32::renumberAndReduce; +%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2O; +%newobject MEDCoupling::DataArrayInt32::invertArrayN2O2O2N; +%newobject MEDCoupling::DataArrayInt32::invertArrayO2N2N2OBis; +%newobject MEDCoupling::DataArrayInt32::findIdsEqual; +%newobject MEDCoupling::DataArrayInt32::findIdsNotEqual; +%newobject MEDCoupling::DataArrayInt32::findIdsEqualList; +%newobject MEDCoupling::DataArrayInt32::findIdsNotEqualList; +%newobject MEDCoupling::DataArrayInt32::findIdsEqualTuple; +%newobject MEDCoupling::DataArrayInt32::findIdForEach; +%newobject MEDCoupling::DataArrayInt32::sumPerTuple; +%newobject MEDCoupling::DataArrayInt32::negate; +%newobject MEDCoupling::DataArrayInt32::computeAbs; +%newobject MEDCoupling::DataArrayInt32::findIdsInRange; +%newobject MEDCoupling::DataArrayInt32::findIdsNotInRange; +%newobject MEDCoupling::DataArrayInt32::findIdsStrictlyNegative; +%newobject MEDCoupling::DataArrayInt32::Aggregate; +%newobject MEDCoupling::DataArrayInt32::AggregateIndexes; +%newobject MEDCoupling::DataArrayInt32::Meld; +%newobject MEDCoupling::DataArrayInt32::Add; +%newobject MEDCoupling::DataArrayInt32::Substract; +%newobject MEDCoupling::DataArrayInt32::Multiply; +%newobject MEDCoupling::DataArrayInt32::Divide; +%newobject MEDCoupling::DataArrayInt32::Pow; +%newobject MEDCoupling::DataArrayInt32::BuildUnion; +%newobject MEDCoupling::DataArrayInt32::BuildIntersection; +%newobject MEDCoupling::DataArrayInt32::Range; +%newobject MEDCoupling::DataArrayInt32::indicesOfSubPart; +%newobject MEDCoupling::DataArrayInt32::fromNoInterlace; +%newobject MEDCoupling::DataArrayInt32::toNoInterlace; +%newobject MEDCoupling::DataArrayInt32::buildComplement; +%newobject MEDCoupling::DataArrayInt32::buildUnion; +%newobject MEDCoupling::DataArrayInt32::buildSubstraction; +%newobject MEDCoupling::DataArrayInt32::buildSubstractionOptimized; +%newobject MEDCoupling::DataArrayInt32::buildIntersection; +%newobject MEDCoupling::DataArrayInt32::buildUnique; +%newobject MEDCoupling::DataArrayInt32::buildUniqueNotSorted; +%newobject MEDCoupling::DataArrayInt32::deltaShiftIndex; +%newobject MEDCoupling::DataArrayInt32::buildExplicitArrByRanges; +%newobject MEDCoupling::DataArrayInt32::buildExplicitArrOfSliceOnScaledArr; +%newobject MEDCoupling::DataArrayInt32::findRangeIdForEachTuple; +%newobject MEDCoupling::DataArrayInt32::findIdInRangeForEachTuple; +%newobject MEDCoupling::DataArrayInt32::duplicateEachTupleNTimes; +%newobject MEDCoupling::DataArrayInt32::buildPermutationArr; +%newobject MEDCoupling::DataArrayInt32::buildPermArrPerLevel; +%newobject MEDCoupling::DataArrayInt32::getDifferentValues; +%newobject MEDCoupling::DataArrayInt32::FindPermutationFromFirstToSecond; +%newobject MEDCoupling::DataArrayInt32::CheckAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt32::__neg__; +%newobject MEDCoupling::DataArrayInt32::__add__; +%newobject MEDCoupling::DataArrayInt32::__radd__; +%newobject MEDCoupling::DataArrayInt32::__sub__; +%newobject MEDCoupling::DataArrayInt32::__rsub__; +%newobject MEDCoupling::DataArrayInt32::__mul__; +%newobject MEDCoupling::DataArrayInt32::__rmul__; +%newobject MEDCoupling::DataArrayInt32::__div__; +%newobject MEDCoupling::DataArrayInt32::__rdiv__; +%newobject MEDCoupling::DataArrayInt32::__mod__; +%newobject MEDCoupling::DataArrayInt32::__rmod__; +%newobject MEDCoupling::DataArrayInt32::__pow__; +%newobject MEDCoupling::DataArrayInt32::__rpow__; +%newobject MEDCoupling::DataArrayInt32Tuple::buildDAInt; +%newobject MEDCoupling::DataArrayInt64::New; +%newobject MEDCoupling::DataArrayInt64::__iter__; +%newobject MEDCoupling::DataArrayInt64::performCopyOrIncrRef; +%newobject MEDCoupling::DataArrayInt64::subArray; +%newobject MEDCoupling::DataArrayInt64::changeNbOfComponents; +%newobject MEDCoupling::DataArrayInt64::accumulatePerChunck; +%newobject MEDCoupling::DataArrayInt64::checkAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt64::transformWithIndArrR; +%newobject MEDCoupling::DataArrayInt64::renumber; +%newobject MEDCoupling::DataArrayInt64::renumberR; +%newobject MEDCoupling::DataArrayInt64::renumberAndReduce; +%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2O; +%newobject MEDCoupling::DataArrayInt64::invertArrayN2O2O2N; +%newobject MEDCoupling::DataArrayInt64::invertArrayO2N2N2OBis; +%newobject MEDCoupling::DataArrayInt64::findIdsEqual; +%newobject MEDCoupling::DataArrayInt64::findIdsNotEqual; +%newobject MEDCoupling::DataArrayInt64::findIdsEqualList; +%newobject MEDCoupling::DataArrayInt64::findIdsNotEqualList; +%newobject MEDCoupling::DataArrayInt64::findIdsEqualTuple; +%newobject MEDCoupling::DataArrayInt64::findIdForEach; +%newobject MEDCoupling::DataArrayInt64::sumPerTuple; +%newobject MEDCoupling::DataArrayInt64::negate; +%newobject MEDCoupling::DataArrayInt64::computeAbs; +%newobject MEDCoupling::DataArrayInt64::findIdsInRange; +%newobject MEDCoupling::DataArrayInt64::findIdsNotInRange; +%newobject MEDCoupling::DataArrayInt64::findIdsStrictlyNegative; +%newobject MEDCoupling::DataArrayInt64::Aggregate; +%newobject MEDCoupling::DataArrayInt64::AggregateIndexes; +%newobject MEDCoupling::DataArrayInt64::Meld; +%newobject MEDCoupling::DataArrayInt64::Add; +%newobject MEDCoupling::DataArrayInt64::Substract; +%newobject MEDCoupling::DataArrayInt64::Multiply; +%newobject MEDCoupling::DataArrayInt64::Divide; +%newobject MEDCoupling::DataArrayInt64::Pow; +%newobject MEDCoupling::DataArrayInt64::BuildUnion; +%newobject MEDCoupling::DataArrayInt64::BuildIntersection; +%newobject MEDCoupling::DataArrayInt64::Range; +%newobject MEDCoupling::DataArrayInt64::indicesOfSubPart; +%newobject MEDCoupling::DataArrayInt64::fromNoInterlace; +%newobject MEDCoupling::DataArrayInt64::toNoInterlace; +%newobject MEDCoupling::DataArrayInt64::buildComplement; +%newobject MEDCoupling::DataArrayInt64::buildUnion; +%newobject MEDCoupling::DataArrayInt64::buildSubstraction; +%newobject MEDCoupling::DataArrayInt64::buildSubstractionOptimized; +%newobject MEDCoupling::DataArrayInt64::buildIntersection; +%newobject MEDCoupling::DataArrayInt64::buildUnique; +%newobject MEDCoupling::DataArrayInt64::buildUniqueNotSorted; +%newobject MEDCoupling::DataArrayInt64::deltaShiftIndex; +%newobject MEDCoupling::DataArrayInt64::buildExplicitArrByRanges; +%newobject MEDCoupling::DataArrayInt64::buildExplicitArrOfSliceOnScaledArr; +%newobject MEDCoupling::DataArrayInt64::findRangeIdForEachTuple; +%newobject MEDCoupling::DataArrayInt64::findIdInRangeForEachTuple; +%newobject MEDCoupling::DataArrayInt64::duplicateEachTupleNTimes; +%newobject MEDCoupling::DataArrayInt64::buildPermutationArr; +%newobject MEDCoupling::DataArrayInt64::buildPermArrPerLevel; +%newobject MEDCoupling::DataArrayInt64::getDifferentValues; +%newobject MEDCoupling::DataArrayInt64::FindPermutationFromFirstToSecond; +%newobject MEDCoupling::DataArrayInt64::CheckAndPreparePermutation; +%newobject MEDCoupling::DataArrayInt64::__neg__; +%newobject MEDCoupling::DataArrayInt64::__add__; +%newobject MEDCoupling::DataArrayInt64::__radd__; +%newobject MEDCoupling::DataArrayInt64::__sub__; +%newobject MEDCoupling::DataArrayInt64::__rsub__; +%newobject MEDCoupling::DataArrayInt64::__mul__; +%newobject MEDCoupling::DataArrayInt64::__rmul__; +%newobject MEDCoupling::DataArrayInt64::__div__; +%newobject MEDCoupling::DataArrayInt64::__rdiv__; +%newobject MEDCoupling::DataArrayInt64::__mod__; +%newobject MEDCoupling::DataArrayInt64::__rmod__; +%newobject MEDCoupling::DataArrayInt64::__pow__; +%newobject MEDCoupling::DataArrayInt64::__rpow__; +%newobject MEDCoupling::DataArrayInt64Tuple::buildDAInt; %newobject MEDCoupling::DataArrayChar::convertToIntArr; %newobject MEDCoupling::DataArrayChar::renumber; %newobject MEDCoupling::DataArrayChar::renumberR; @@ -238,7 +320,8 @@ %feature("unref") DataArray "$this->decrRef();" %feature("unref") DataArrayDouble "$this->decrRef();" -%feature("unref") DataArrayInt "$this->decrRef();" +%feature("unref") DataArrayInt32 "$this->decrRef();" +%feature("unref") DataArrayInt64 "$this->decrRef();" %feature("unref") DataArrayChar "$this->decrRef();" %feature("unref") DataArrayAsciiChar "$this->decrRef();" %feature("unref") DataArrayByte "$this->decrRef();" @@ -257,7 +340,16 @@ namespace MEDCoupling AX_SPHER = 5 } MEDCouplingAxisType; - class DataArrayInt; + class DataArrayInt32; + class DataArrayInt64; + +#ifndef MEDCOUPLING_USE_64BIT_IDS +typedef DataArrayInt32 DataArrayIdType; +#define DataArrayIdType DataArrayInt32 +#else +typedef DataArrayInt64 DataArrayIdType; +#define DataArrayIdType DataArrayInt64 +#endif class MapII : public RefCountObject, public TimeLabel { @@ -269,8 +361,8 @@ namespace MEDCoupling { public: static PartDefinition *New(int start, int stop, int step); - static PartDefinition *New(DataArrayInt *listOfIds); - virtual DataArrayInt *toDAI() const; + static PartDefinition *New(DataArrayIdType *listOfIds); + virtual DataArrayIdType *toDAI() const; virtual int getNumberOfElems() const; virtual std::string getRepr() const; virtual PartDefinition *composeWith(const PartDefinition *other) const; @@ -307,10 +399,10 @@ namespace MEDCoupling class DataArrayPartDefinition : public PartDefinition { public: - static DataArrayPartDefinition *New(DataArrayInt *listOfIds); + static DataArrayPartDefinition *New(DataArrayIdType *listOfIds); %extend { - DataArrayPartDefinition(DataArrayInt *listOfIds) + DataArrayPartDefinition(DataArrayIdType *listOfIds) { return DataArrayPartDefinition::New(listOfIds); } @@ -338,14 +430,14 @@ namespace MEDCoupling int getEffectiveStop() const; %extend { - SlicePartDefinition(int start, int stop, int step) + SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step) { return SlicePartDefinition::New(start,stop,step); } PyObject *getSlice() const { - int a,b,c; + mcIdType a,b,c; self->getSlice(a,b,c); return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); } @@ -371,8 +463,8 @@ namespace MEDCoupling public: void setName(const std::string& name); void copyStringInfoFrom(const DataArray& other); - void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); - void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); + void copyPartOfStringInfoFrom(const DataArray& other, const std::vector& compoIds); + void copyPartOfStringInfoFrom2(const std::vector& compoIds, const DataArray& other); bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const; bool areInfoEquals(const DataArray& other) const; std::string cppRepr(const std::string& varName) const; @@ -405,7 +497,7 @@ namespace MEDCoupling void checkNbOfComps(int nbOfCompo, const std::string& msg) const; void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const; void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const; - void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const; + void checkNbOfElems(mcIdType nbOfElems, const std::string& msg) const; static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg); static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg); static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step); @@ -419,22 +511,22 @@ namespace MEDCoupling PyObject *getInfoOnComponents() const { const std::vector& comps=self->getInfoOnComponents(); - PyObject *ret=PyList_New((int)comps.size()); - for(int i=0;i<(int)comps.size();i++) + PyObject *ret=PyList_New((mcIdType)comps.size()); + for(std::size_t i=0;i tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->copyPartOfStringInfoFrom(other,tmp); } void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->copyPartOfStringInfoFrom2(tmp,other); } @@ -442,11 +534,11 @@ namespace MEDCoupling virtual void renumberInPlace(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -455,11 +547,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -471,11 +563,11 @@ namespace MEDCoupling virtual void renumberInPlaceR(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -484,11 +576,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -498,22 +590,22 @@ namespace MEDCoupling } //tuplesSelec in PyObject * because DataArrayInt is not already existing ! - virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) + virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) { static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt"; DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray"); DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg); - DataArrayInt *tuplesSelecPtr2=0; + DataArrayIdType *tuplesSelecPtr2=0; if(tuplesSelecPtr) { - tuplesSelecPtr2=dynamic_cast(tuplesSelecPtr); + tuplesSelecPtr2=dynamic_cast(tuplesSelecPtr); if(!tuplesSelecPtr2) throw INTERP_KERNEL::Exception(msg); } self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2); } - virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) + virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, PyObject *aBase, mcIdType bg, mcIdType end2, mcIdType step) { DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray"); self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step); @@ -521,7 +613,7 @@ namespace MEDCoupling virtual DataArray *selectByTupleRanges(PyObject *li) const { - std::vector > ranges; + std::vector > ranges; convertPyToVectorPairInt(li,ranges); return self->selectByTupleRanges(ranges); } @@ -529,16 +621,16 @@ namespace MEDCoupling virtual DataArray *selectByTupleId(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); return self->selectByTupleId(tmp,tmp+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); @@ -549,16 +641,16 @@ namespace MEDCoupling virtual DataArray *selectByTupleIdSafe(PyObject *li) const { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); return self->selectByTupleIdSafe(tmp,tmp+size); } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); @@ -568,50 +660,50 @@ namespace MEDCoupling virtual PyObject *keepSelectedComponents(PyObject *li) const { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); DataArray *ret=self->keepSelectedComponents(tmp); return convertDataArray(ret,SWIG_POINTER_OWN | 0 ); } - static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) + static PyObject *GetSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !"); - int a,b; - DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b); + mcIdType a,b; + DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b); return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); } - PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const + PyObject *getSlice(PyObject *slic, mcIdType sliceId, mcIdType nbOfSlices) const { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !"); - int a,b; - DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b); + mcIdType a,b; + DataArray::GetSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),sliceId,nbOfSlices,a,b); return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step)); } - static int GetNumberOfItemGivenBES(PyObject *slic) + static mcIdType GetNumberOfItemGivenBES(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !"); - return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); + return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),""); } - static int GetNumberOfItemGivenBESRelative(PyObject *slic) + static mcIdType GetNumberOfItemGivenBESRelative(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !"); - return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,""); + return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),""); } static DataArray *Aggregate(PyObject *arrs) @@ -621,22 +713,22 @@ namespace MEDCoupling return DataArray::Aggregate(tmp); } - int getNumberOfItemGivenBES(PyObject *slic) const + mcIdType getNumberOfItemGivenBES(PyObject *slic) const { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !"); - return DataArray::GetNumberOfItemGivenBES(strt,stp,step,""); + return DataArray::GetNumberOfItemGivenBES(ToIdType(strt),ToIdType(stp),ToIdType(step),""); } - int getNumberOfItemGivenBESRelative(PyObject *slic) + mcIdType getNumberOfItemGivenBESRelative(PyObject *slic) { if(!PySlice_Check(slic)) throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !"); Py_ssize_t strt=2,stp=2,step=2; GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !"); - return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,""); + return DataArray::GetNumberOfItemGivenBESRelative(ToIdType(strt),ToIdType(stp),ToIdType(step),""); } PyObject *__getstate__() const @@ -646,9 +738,9 @@ namespace MEDCoupling const std::vector &a1(self->getInfoOnComponents()); PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str())); // - int sz(a1.size()); + std::size_t sz(a1.size()); PyObject *ret1(PyList_New(sz)); - for(int i=0;ireprNotTooLong(); } - int __len__() const + mcIdType __len__() const { if(self->isAllocated()) { @@ -744,7 +836,8 @@ namespace MEDCoupling PyObject *getValuesAsTuple() const { const float *vals(self->begin()); - int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); + std::size_t nbOfComp(self->getNumberOfComponents()); + mcIdType nbOfTuples(self->getNumberOfTuples()); return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); } @@ -830,8 +923,8 @@ namespace MEDCoupling class DataArrayFloatTuple { public: - int getNumberOfCompo() const; - DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const; + std::size_t getNumberOfCompo() const; + DataArrayFloat *buildDAFloat(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -864,7 +957,6 @@ namespace MEDCoupling } }; - class DataArrayInt; class DataArrayDoubleIterator; class DataArrayDouble : public DataArray @@ -898,15 +990,15 @@ namespace MEDCoupling DataArrayDouble *toNoInterlace() const; DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const; void transpose(); - DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const; + DataArrayDouble *changeNbOfComponents(std::size_t newNbOfComp, double dftValue) const; void meldWith(const DataArrayDouble *other); DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const; DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const; - DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const; - DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; + DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const; + DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec); + void setPartOfValuesSimple1(double a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayIdType *tuplesSelec); double getIJ(int tupleId, int compoId) const; double front() const; double back() const; @@ -962,9 +1054,9 @@ namespace MEDCoupling DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector& varsOrder, const std::string& func, bool isSafe=true) const; void applyFuncFast32(const std::string& func); void applyFuncFast64(const std::string& func); - DataArrayInt *findIdsInRange(double vmin, double vmax) const; - DataArrayInt *findIdsNotInRange(double vmin, double vmax) const; - DataArrayInt *findIdsStrictlyNegative() const; + DataArrayIdType *findIdsInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const; + DataArrayIdType *findIdsStrictlyNegative() const; static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2); static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -981,11 +1073,11 @@ namespace MEDCoupling void divideEqual(const DataArrayDouble *other); static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2); void powEqual(const DataArrayDouble *other); - MCAuto findIdsGreaterOrEqualTo(double val) const; - MCAuto findIdsGreaterThan(double val) const; - MCAuto findIdsLowerOrEqualTo(double val) const; - MCAuto findIdsLowerThan(double val) const; - MCAuto convertToIntArr() const; + MCAuto findIdsGreaterOrEqualTo(double val) const; + MCAuto findIdsGreaterThan(double val) const; + MCAuto findIdsLowerOrEqualTo(double val) const; + MCAuto findIdsLowerThan(double val) const; + MCAuto convertToIntArr() const; MCAuto selectPartDef(const PartDefinition* pd) const; MCAuto cumSum() const; MCAuto convertToFloatArr() const; @@ -1010,7 +1102,7 @@ namespace MEDCoupling { double val; std::vector bb; - int sw,nbTuples=-1; + mcIdType sw; mcIdType nbTuples=-1; const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : "; const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples); self->pushBackValsSilent(tmp,tmp+nbTuples); @@ -1033,7 +1125,7 @@ namespace MEDCoupling return self->doubleValue(); } - int __len__() const + mcIdType __len__() const { if(self->isAllocated()) { @@ -1075,14 +1167,14 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !"); if(nbOfComp && nbOfComp != Py_None) { if(PyInt_Check(nbOfComp)) {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp)); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !"); std::vector tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo); @@ -1093,7 +1185,7 @@ namespace MEDCoupling } else {//DataArrayDouble.setValues([1.,3.,4.],3) - int tmpp1=-1; + mcIdType tmpp1=-1; std::vector tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1); self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); } @@ -1103,7 +1195,7 @@ namespace MEDCoupling } else {// DataArrayDouble.setValues([1.,3.,4.]) - int tmpp1=-1,tmpp2=-1; + mcIdType tmpp1=-1,tmpp2=-1; std::vector tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2); self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); } @@ -1140,7 +1232,8 @@ namespace MEDCoupling PyObject *getValuesAsTuple() const { const double *vals(self->begin()); - int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples()); + std::size_t nbOfComp(self->getNumberOfComponents()); + mcIdType nbOfTuples(self->getNumberOfTuples()); return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); } @@ -1151,7 +1244,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *seg2Ptr(convertObjToPossibleCpp5_Safe(seg2,sw,val,a,aa,bb,msg,2,2,true)); const double *tri3Ptr(convertObjToPossibleCpp5_Safe(tri3,sw,val2,a2,aa2,bb2,msg,3,2,true)); // @@ -1173,7 +1266,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true)); const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true)); MCAuto ret(self->symmetry3DPlane(centerPtr,vectorPtr)); @@ -1183,11 +1276,11 @@ namespace MEDCoupling static PyObject *GiveBaseForPlane(PyObject *normalVector) { const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : "; - double val,val2; - DataArrayDouble *a,*a2; - DataArrayDoubleTuple *aa,*aa2; + double val; + DataArrayDouble *a; + DataArrayDoubleTuple *aa; std::vector bb,bb2; - int sw; + mcIdType sw; const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true)); double res[9]; DataArrayDouble::GiveBaseForPlane(vectorPtr,res); @@ -1201,7 +1294,7 @@ namespace MEDCoupling DataArrayDouble *a,*a2; DataArrayDoubleTuple *aa,*aa2; std::vector bb,bb2; - int sw; + mcIdType sw; const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true); const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true); return self->fromCartToCylGiven(coords,centerPtr,vectorPtr); @@ -1210,11 +1303,11 @@ namespace MEDCoupling DataArrayDouble *renumber(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1223,11 +1316,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1239,11 +1332,11 @@ namespace MEDCoupling DataArrayDouble *renumberR(PyObject *li) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1252,11 +1345,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1265,14 +1358,14 @@ namespace MEDCoupling } } - DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) + DataArrayDouble *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) { void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1281,11 +1374,11 @@ namespace MEDCoupling } else { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); if(!da2) throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); da2->checkAllocated(); - int size=self->getNumberOfTuples(); + mcIdType size=self->getNumberOfTuples(); if(size!=self->getNumberOfTuples()) { throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); @@ -1296,7 +1389,7 @@ namespace MEDCoupling PyObject *minimalDistanceTo(const DataArrayDouble *other) const { - int thisTupleId,otherTupleId; + mcIdType thisTupleId,otherTupleId; double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId); PyObject *ret=PyTuple_New(3); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0)); @@ -1307,7 +1400,7 @@ namespace MEDCoupling PyObject *getMaxValue() const { - int tmp; + mcIdType tmp; double r1=self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); @@ -1327,17 +1420,17 @@ namespace MEDCoupling PyObject *getMaxValue2() const { - DataArrayInt *tmp; + DataArrayIdType *tmp; double r1=self->getMaxValue2(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinValue() const { - int tmp; + mcIdType tmp; double r1=self->getMinValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); @@ -1347,54 +1440,54 @@ namespace MEDCoupling PyObject *getMinValue2() const { - DataArrayInt *tmp; + DataArrayIdType *tmp; double r1=self->getMinValue2(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1)); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *getMinMaxPerComponent() const { - int nbOfCompo(self->getNumberOfComponents()); + std::size_t nbOfCompo(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp(new double[2*nbOfCompo]); self->getMinMaxPerComponent(tmp); - PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo); + PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,ToIdType(nbOfCompo)); return ret; } PyObject *normMaxPerComponent() const { - int nbOfCompo(self->getNumberOfComponents()); + std::size_t nbOfCompo(self->getNumberOfComponents()); INTERP_KERNEL::AutoPtr tmp(new double[nbOfCompo]); self->normMaxPerComponent(tmp); - return convertDblArrToPyList(tmp,nbOfCompo); + return convertDblArrToPyList(tmp,ToIdType(nbOfCompo)); } PyObject *accumulate() const { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->accumulate(tmp); - return convertDblArrToPyList(tmp,sz); + return convertDblArrToPyList(tmp,ToIdType(sz)); } DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const { - int sw,sz,val; - std::vector val2; - const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); + mcIdType sw, sz,val; + std::vector val2; + const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); return self->accumulatePerChunck(bg,bg+sz); } - PyObject *findCommonTuples(double prec, int limitNodeId=-1) const + PyObject *findCommonTuples(double prec, mcIdType limitNodeId=-1) const { - DataArrayInt *comm, *commIndex; + DataArrayIdType *comm, *commIndex; self->findCommonTuples(prec,limitNodeId,comm,commIndex); PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return res; } @@ -1404,9 +1497,10 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int tupleId=-1,nbOfCompo=self->getNumberOfComponents(); - const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true); + mcIdType sw; + mcIdType tupleId=-1; + std::size_t nbOfCompo=self->getNumberOfComponents(); + const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,(int)nbOfCompo,true); // double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId); PyObject *ret=PyTuple_New(2); @@ -1417,7 +1511,7 @@ namespace MEDCoupling void setSelectedComponents(const DataArrayDouble *a, PyObject *li) { - std::vector tmp; + std::vector tmp; convertPyToNewIntArr3(li,tmp); self->setSelectedComponents(a,tmp); } @@ -1432,12 +1526,12 @@ namespace MEDCoupling return res; } - PyObject *getTuple(int tupleId) + PyObject *getTuple(mcIdType tupleId) { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new double[sz]; self->getTuple(tupleId,tmp); - return convertDblArrToPyList(tmp,sz); + return convertDblArrToPyList(tmp,ToIdType(sz)); } static DataArrayDouble *Aggregate(PyObject *li) @@ -1460,28 +1554,29 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; - int nbComp=self->getNumberOfComponents(),nbTuples=-1; + mcIdType sw; + std::size_t nbComp=self->getNumberOfComponents(); + mcIdType nbTuples=-1; const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : "; - const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples); + const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,(int)nbComp,true,nbTuples); MCAuto inpu=DataArrayDouble::New(); inpu->useArray(pos,false,DeallocType::CPP_DEALLOC,nbTuples,nbComp); - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; self->computeTupleIdsNearTuples(inpu,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; bool ret0=self->areIncludedInMe(other,prec,ret1); PyObject *ret=PyTuple_New(2); PyObject *ret0Py=ret0?Py_True:Py_False; Py_XINCREF(ret0Py); PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1507,7 +1602,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1546,7 +1641,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1561,7 +1656,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1578,7 +1673,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Add(self,aaa); } default: @@ -1598,7 +1693,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1637,7 +1732,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1652,7 +1747,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1669,7 +1764,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Substract(aaa,self); } default: @@ -1689,7 +1784,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1728,7 +1823,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1753,7 +1848,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; // #ifndef WITHOUT_AUTOFIELD void *argp; @@ -1794,7 +1889,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ); } default: @@ -1809,7 +1904,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1826,7 +1921,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Divide(aaa,self); } default: @@ -1846,7 +1941,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1867,7 +1962,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Pow(self,aaa); } default: @@ -1882,7 +1977,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1899,7 +1994,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); return DataArrayDouble::Pow(aaa,self); } default: @@ -1914,7 +2009,7 @@ namespace MEDCoupling DataArrayDouble *a; DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -1939,7 +2034,7 @@ namespace MEDCoupling } case 4: { - MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,(int)bb.size()); + MCAuto aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,DeallocType::CPP_DEALLOC,1,bb.size()); self->powEqual(aaa); Py_XINCREF(trueSelf); return trueSelf; @@ -1951,22 +2046,22 @@ namespace MEDCoupling PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps) { - DataArrayInt *c=0,*cI=0; + DataArrayIdType *c=0,*cI=0; // self->computeTupleIdsNearTuples(other,eps,c,cI); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } PyObject *maxPerTupleWithCompoId() const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -1998,7 +2093,7 @@ namespace MEDCoupling class DataArrayDoubleTuple { public: - int getNumberOfCompo() const; + std::size_t getNumberOfCompo() const; DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const; %extend { @@ -2057,13 +2152,13 @@ namespace MEDCoupling PyObject *__getitem__(PyObject *obj) { const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; const double *pt=self->getConstPointer(); - int nbc=self->getNumberOfCompo(); + mcIdType nbc=ToIdType(self->getNumberOfCompo()); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -2093,9 +2188,9 @@ namespace MEDCoupling case 2: { PyObject *t=PyTuple_New(multiVal.size()); - for(int j=0;j<(int)multiVal.size();j++) + for(std::size_t j=0;j=nbc) { std::ostringstream oss; @@ -2108,9 +2203,9 @@ namespace MEDCoupling } case 3: { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); PyObject *t=PyTuple_New(sz); - for(int j=0;j multiValV; MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0; - int nbc=self->getNumberOfCompo(); + mcIdType nbc=ToIdType(self->getNumberOfCompo()); convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV); - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; double *pt=self->getPointer(); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp); switch(sw2) @@ -2178,7 +2273,7 @@ namespace MEDCoupling { case 1: { - for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) + for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) { if(*it>=nbc) { @@ -2198,9 +2293,9 @@ namespace MEDCoupling oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int i=0;i<(int)multiVal.size();i++) + for(std::size_t i=0;i=nbc) { std::ostringstream oss; @@ -2214,7 +2309,7 @@ namespace MEDCoupling case 3: { const double *ptV=daIntTyyppV->getConstPointer(); - if(nbc>daIntTyyppV->getNumberOfCompo()) + if(nbc>(mcIdType)daIntTyyppV->getNumberOfCompo()) { std::ostringstream oss; oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; @@ -2229,37 +2324,37 @@ namespace MEDCoupling } case 3: { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); + mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); switch(sw1) { case 1: { - for(int j=0;jgetConstPointer(); - if(sz>daIntTyyppV->getNumberOfCompo()) + if(sz>(mcIdType)daIntTyyppV->getNumberOfCompo()) { std::ostringstream oss; oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - for(int j=0;j invertArrayN2O2O2NOptimized() const; - MCAuto< MapII > giveN2OOptimized() const; - DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const; - DataArrayInt *fromNoInterlace() const; - DataArrayInt *toNoInterlace() const; - DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const; - DataArrayInt *checkAndPreparePermutation() const; - DataArrayInt *buildPermArrPerLevel() const; - bool isIota(int sizeExpected) const; - bool isUniform(int val) const; - int checkUniformAndGuess() const; - bool hasUniqueValues() const; - DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const; - void transpose(); - DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const; - void meldWith(const DataArrayInt *other); - void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec); - void getTuple(int tupleId, int *res) const; - int getIJ(int tupleId, int compoId) const; - int getIJSafe(int tupleId, int compoId) const; - int front() const; - int back() const; - void setIJ(int tupleId, int compoId, int newVal); - void setIJSilent(int tupleId, int compoId, int newVal); - int *getPointer(); - const int *getConstPointer() const; - DataArrayIntIterator *iterator(); - const int *begin() const; - const int *end() const; - DataArrayInt *findIdsEqual(int val) const; - DataArrayInt *findIdsNotEqual(int val) const; - int changeValue(int oldValue, int newValue); - int findIdFirstEqualTuple(const std::vector& tupl) const; - int findIdFirstEqual(int value) const; - int findIdFirstEqual(const std::vector& vals) const; - int findIdSequence(const std::vector& vals) const; - bool presenceOfTuple(const std::vector& tupl) const; - bool presenceOfValue(int value) const; - bool presenceOfValue(const std::vector& vals) const; - int count(int value) const; - int accumulate(int compId) const; - int getMaxValueInArray() const; - int getMaxAbsValueInArray() const; - int getMinValueInArray() const; - void abs(); - DataArrayInt *computeAbs() const; - void applyLin(int a, int b, int compoId); - void applyLin(int a, int b); - void applyInv(int numerator); - DataArrayInt *negate() const; - void applyDivideBy(int val); - void applyModulus(int val); - void applyRModulus(int val); - void applyPow(int val); - void applyRPow(int val); - DataArrayInt *findIdsInRange(int vmin, int vmax) const; - DataArrayInt *findIdsNotInRange(int vmin, int vmax) const; - DataArrayInt *findIdsStrictlyNegative() const; - bool checkAllIdsInRange(int vmin, int vmax) const; - static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2); - static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2); - static DataArrayInt *MakePartition(const std::vector& groups, int newNb, std::vector< std::vector >& fidsOfGroups); - static DataArrayInt *BuildUnion(const std::vector& arr); - static DataArrayInt *BuildIntersection(const std::vector& arr); - static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2); - DataArrayInt *buildComplement(int nbOfElement) const; - DataArrayInt *buildSubstraction(const DataArrayInt *other) const; - DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const; - DataArrayInt *buildUnion(const DataArrayInt *other) const; - DataArrayInt *buildIntersection(const DataArrayInt *other) const; - DataArrayInt *buildUnique() const; - DataArrayInt *buildUniqueNotSorted() const; - DataArrayInt *deltaShiftIndex() const; - void computeOffsets(); - void computeOffsetsFull(); - DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const; - DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const; - DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const; - void sortEachPairToMakeALinkedList(); - DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const; - DataArrayInt *getDifferentValues() const; - static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2); - void addEqual(const DataArrayInt *other); - static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2); - void substractEqual(const DataArrayInt *other); - static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2); - void multiplyEqual(const DataArrayInt *other); - static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2); - void divideEqual(const DataArrayInt *other); - static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2); - void modulusEqual(const DataArrayInt *other); - static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2); - void powEqual(const DataArrayInt *other); - MCAuto fromLinkedListOfPairToList() const; - MCAuto findIdsGreaterOrEqualTo(int val) const; - MCAuto findIdsGreaterThan(int val) const; - MCAuto findIdsLowerOrEqualTo(int val) const; - MCAuto findIdsLowerThan(int val) const; - MCAuto selectPartDef(const PartDefinition* pd) const; - MCAuto convertToDblArr() const; - MCAuto convertToFloatArr() const; + DataArrayInt *convertToIntArr() const; + DataArrayChar *renumber(const mcIdType *old2New) const; + DataArrayChar *renumberR(const mcIdType *new2Old) const; + DataArrayChar *renumberAndReduce(const mcIdType *old2NewBg, mcIdType newNbOfTuple) const; + bool isUniform(char val) const; + void sort(bool asc=true); + DataArrayChar *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; + DataArrayChar *changeNbOfComponents(std::size_t newNbOfComp, char dftValue) const; + void meldWith(const DataArrayChar *other); + void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayIdType *tuplesSelec); + char front() const; + char back() const; + void setIJ(mcIdType tupleId, int compoId, char newVal); + void setIJSilent(mcIdType tupleId, int compoId, char newVal); + char *getPointer(); + DataArrayIdType *findIdsEqual(char val) const; + DataArrayIdType *findIdsNotEqual(char val) const; + int findIdFirstEqualTuple(const std::vector& tupl) const; + bool presenceOfTuple(const std::vector& tupl) const; + char getMaxValue(mcIdType& tupleId) const; + char getMaxValueInArray() const; + char getMinValue(mcIdType& tupleId) const; + char getMinValueInArray() const; + DataArrayIdType *findIdsInRange(char vmin, char vmax) const; + static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); + static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); + %extend + { + mcIdType __len__() const + { + if(self->isAllocated()) + { + return self->getNumberOfTuples(); + } + else + { + throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !"); + } + } + + PyObject *isEqualIfNotWhy(const DataArrayChar& other) const + { + std::string ret1; + bool ret0=self->isEqualIfNotWhy(other,ret1); + PyObject *ret=PyTuple_New(2); + PyObject *ret0Py=ret0?Py_True:Py_False; + Py_XINCREF(ret0Py); + PyTuple_SetItem(ret,0,ret0Py); + PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); + return ret; + } + + DataArrayChar *renumber(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumber(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumber(da2->getConstPointer()); + } + } + + DataArrayChar *renumberR(PyObject *li) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberR(tmp); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberR(da2->getConstPointer()); + } + } + + DataArrayChar *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple) + { + void *da=0; + int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits::TI, 0 | 0 ); + if (!SWIG_IsOK(res1)) + { + mcIdType size; + INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberAndReduce(tmp,newNbOfTuple); + } + else + { + DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da); + if(!da2) + throw INTERP_KERNEL::Exception("Not null DataArrayIdType instance expected !"); + da2->checkAllocated(); + mcIdType size=self->getNumberOfTuples(); + if(size!=self->getNumberOfTuples()) + { + throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); + } + return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple); + } + } + + static DataArrayChar *Aggregate(PyObject *dachs) + { + std::vector tmp; + convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); + return DataArrayChar::Aggregate(tmp); + } + + static DataArrayChar *Meld(PyObject *dachs) + { + std::vector tmp; + convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); + return DataArrayChar::Meld(tmp); + } + } + }; + + class DataArrayByteIterator; + + class DataArrayByte : public DataArrayChar + { public: - static DataArrayInt *Range(int begin, int end, int step); + static DataArrayByte *New(); + DataArrayByteIterator *iterator(); + DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; + char byteValue() const; %extend { - DataArrayInt() + DataArrayByte() { - return DataArrayInt::New(); + return DataArrayByte::New(); } - static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) { - const char *msgBase="MEDCoupling::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)"; - std::string msg(msgBase); -#ifdef WITH_NUMPY - msg+="\n-DataArrayInt.New(numpy array with dtype=int32)"; -#endif - msg+=" !"; + const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !"; if(PyList_Check(elt0) || PyTuple_Check(elt0)) { if(nbOfTuples) { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !"); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); if(nbOfComp) { if(PyInt_Check(nbOfComp)) - {//DataArrayInt.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + {//DataArrayByte.New([1,3,4,5],2,2) + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp)); if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MCAuto ret=DataArrayInt::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); + MCAuto ret=DataArrayByte::New(); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {//DataArrayInt.New([1,3,4],3) - MCAuto ret=DataArrayInt::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + {//DataArrayByte.New([1,3,4],3) + MCAuto ret=DataArrayByte::New(); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {// DataArrayInt.New([1,3,4]) - MCAuto ret=DataArrayInt::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + {// DataArrayByte.New([1,3,4]) + MCAuto ret=DataArrayByte::New(); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } } else if(PyInt_Check(elt0)) { - int nbOfTuples1=PyInt_AS_LONG(elt0); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0)); if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !"); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); if(nbOfTuples) { if(!nbOfComp) { if(PyInt_Check(nbOfTuples)) - {//DataArrayInt.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + {//DataArrayByte.New(5,2) + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !"); - MCAuto ret=DataArrayInt::New(); + throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,nbOfCompo); return ret.retn(); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - throw INTERP_KERNEL::Exception(msg.c_str()); + throw INTERP_KERNEL::Exception(msg); } else - {//DataArrayInt.New(5) - MCAuto ret=DataArrayInt::New(); + {//DataArrayByte.New(5) + MCAuto ret=DataArrayByte::New(); ret->alloc(nbOfTuples1,1); return ret.retn(); } } #ifdef WITH_NUMPY else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) - {//DataArrayInt.New(numpyArray) - return BuildNewInstance(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32"); + {//DataArrayDouble.New(numpyArray) + return BuildNewInstance(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8"); } #endif else - throw INTERP_KERNEL::Exception(msg.c_str()); - throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy + throw INTERP_KERNEL::Exception(msg); } - DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) { - return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp); + return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp); } - - std::string __str__() const + + std::string __repr__() const { - return self->reprNotTooLong(); + std::ostringstream oss; + self->reprQuickOverview(oss); + return oss.str(); } - - int __len__() const + + int __int__() const { - if(self->isAllocated()) - { - return self->getNumberOfTuples(); - } - else - { - throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !"); - } + return (int) self->byteValue(); } - int __int__() const + DataArrayByteIterator *__iter__() { - return self->intValue(); + return self->iterator(); } - DataArrayIntIterator *__iter__() + mcIdType getIJ(mcIdType tupleId, mcIdType compoId) const { - return self->iterator(); + return (mcIdType)self->getIJ(tupleId,compoId); } - - PyObject *accumulate() const + + mcIdType getIJSafe(mcIdType tupleId, mcIdType compoId) const { - int sz=self->getNumberOfComponents(); - INTERP_KERNEL::AutoPtr tmp=new int[sz]; - self->accumulate(tmp); - return convertIntArrToPyList(tmp,sz); + return (mcIdType)self->getIJSafe(tupleId,compoId); } - DataArrayInt *accumulatePerChunck(PyObject *indexArr) const + std::string __str__() const { - int sw,sz,val; - std::vector val2; - const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2); - return self->accumulatePerChunck(bg,bg+sz); + return self->repr(); } - DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const + PyObject *toStrList() const { - int sw,sz,val; - std::vector val2; - const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2)); - return self->findIdsEqualTuple(bg,bg+sz); + const char *vals=self->getConstPointer(); + std::size_t nbOfComp=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples); } - - DataArrayInt *findIdForEach(PyObject *vals) const + + bool presenceOfTuple(PyObject *tupl) const { - int sw,sz,val; - std::vector val2; - const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2)); - MCAuto ret(self->findIdForEach(bg,bg+sz)); - return ret.retn(); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->presenceOfTuple(vals); } - PyObject *splitInBalancedSlices(int nbOfSlices) const + bool presenceOfValue(PyObject *vals) const { - std::vector< std::pair > slcs(self->splitInBalancedSlices(nbOfSlices)); - PyObject *ret=PyList_New(slcs.size()); - for(std::size_t i=0;i ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); + std::vector vals2(sz); + std::copy(pt,pt+sz,vals2.begin()); + return self->presenceOfValue(vals2); } - DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const + mcIdType findIdFirstEqual(PyObject *vals) const { - if(!PySlice_Check(slic)) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !"); - Py_ssize_t strt=2,stp=2,step=2; - GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !"); - if(strt==std::numeric_limits::max() || stp==std::numeric_limits::max()) - throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !"); - return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); + std::vector vals2(sz); + std::copy(pt,pt+sz,vals2.begin()); + return self->findIdFirstEqual(vals2); } - PyObject *getMinMaxValues() const + mcIdType findIdFirstEqualTuple(PyObject *tupl) const { - int a,b; - self->getMinMaxValues(a,b); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,PyInt_FromLong(a)); - PyTuple_SetItem(ret,1,PyInt_FromLong(b)); - return ret; - } - - static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) - { - int newNbOfTuples=-1; - int szArr,szArrI,sw,iTypppArr,iTypppArrI; - std::vector stdvecTyyppArr,stdvecTyyppArrI; - const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr); - const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI); - DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples)); - return ret; + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->findIdFirstEqualTuple(vals); } - static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) + mcIdType findIdSequence(PyObject *strOrListOfInt) const { - MCAuto ret(DataArrayInt::New()); - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr)); - int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr)); - ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1); - return ret.retn(); + mcIdType sz=-1,sw=-1; + mcIdType ival=-1; std::vector ivval; + const mcIdType *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval); + std::vector vals(sz); + std::copy(pt,pt+sz,vals.begin()); + return self->findIdSequence(vals); } - void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) + PyObject *getTuple(mcIdType tupleId) { - const char *msg="MEDCoupling::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !"; - if(PyList_Check(li) || PyTuple_Check(li)) - { - if(nbOfTuples && nbOfTuples != Py_None) - { - if(PyInt_Check(nbOfTuples)) - { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !"); - if(nbOfComp && nbOfComp != Py_None) - { - if(PyInt_Check(nbOfComp)) - {//DataArrayInt.setValues([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !"); - std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo); - self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayInt.setValues([1,3,4],3) - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1); - self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {// DataArrayInt.setValues([1,3,4]) - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2); - self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer()); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - - PyObject *getValues() const - { - const int *vals=self->getConstPointer(); - return convertIntArrToPyList(vals,self->getNbOfElems()); - } - -#ifdef WITH_NUMPY - PyObject *toNumPyArray() // not const. It is not a bug ! - { - return ToNumPyArray(self,NPY_INT32,"DataArrayInt"); - } -#endif - - PyObject *isEqualIfNotWhy(const DataArrayInt& other) const - { - std::string ret1; - bool ret0=self->isEqualIfNotWhy(other,ret1); - PyObject *ret=PyTuple_New(2); - PyObject *ret0Py=ret0?Py_True:Py_False; - Py_XINCREF(ret0Py); - PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); - return ret; - } - - PyObject *getValuesAsTuple() const - { - const int *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); - return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); - } - - static PyObject *MakePartition(PyObject *gps, int newNb) - { - std::vector groups; - std::vector< std::vector > fidsOfGroups; - convertFromPyObjVectorOfObj(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups); - MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups); - PyObject *ret = PyList_New(2); - PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - int sz=fidsOfGroups.size(); - PyObject *ret1 = PyList_New(sz); - for(int i=0;i(da); - self->transformWithIndArr(*m); - } - else - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->transformWithIndArr(tmp,tmp+size); - } - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); - } - } - - DataArrayInt *findIdsEqualList(PyObject *obj) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return self->findIdsEqualList(&singleVal,&singleVal+1); - case 2: - return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); - case 4: - return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end()); - default: - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - DataArrayInt *findIdsNotEqualList(PyObject *obj) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return self->findIdsNotEqualList(&singleVal,&singleVal+1); - case 2: - return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size()); - case 4: - return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end()); - default: - throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - PyObject *splitByValueRange(PyObject *li) const - { - DataArrayInt *ret0=0,*ret1=0,*ret2=0; - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2); - } - PyObject *ret = PyList_New(3); - PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - DataArrayInt *transformWithIndArrR(PyObject *li) const - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - return self->transformWithIndArrR(tmp,tmp+size); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems()); - } - } - - DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberAndReduce(tmp,newNbOfTuple); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple); - } - } - - DataArrayInt *renumber(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumber(tmp); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumber(da2->getConstPointer()); - } - } - - DataArrayInt *renumberR(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberR(tmp); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberR(da2->getConstPointer()); - } - } - - void setSelectedComponents(const DataArrayInt *a, PyObject *li) - { - std::vector tmp; - convertPyToNewIntArr3(li,tmp); - self->setSelectedComponents(a,tmp); - } - - PyObject *explodeComponents() const - { - std::vector< MCAuto > retCpp(self->explodeComponents()); - std::size_t sz(retCpp.size()); - PyObject *res(PyList_New(sz)); - for(std::size_t i=0;igetNumberOfComponents(); - INTERP_KERNEL::AutoPtr tmp=new int[sz]; - self->getTuple(tupleId,tmp); - return convertIntArrToPyList(tmp,sz); - } - - PyObject *changeSurjectiveFormat(int targetNb) const - { - DataArrayInt *arr=0; - DataArrayInt *arrI=0; - self->changeSurjectiveFormat(targetNb,arr,arrI); - PyObject *res = PyList_New(2); - PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0)); - return res; - } - - static DataArrayInt *Meld(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::Meld(tmp); - } - - static DataArrayInt *Aggregate(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::Aggregate(tmp); - } - - static DataArrayInt *AggregateIndexes(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::AggregateIndexes(tmp); - } - - static DataArrayInt *BuildUnion(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::BuildUnion(tmp); - } - - static DataArrayInt *BuildIntersection(PyObject *li) - { - std::vector tmp; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp); - return DataArrayInt::BuildIntersection(tmp); - } - - PyObject *getMaxValue() const - { - int tmp; - int r1=self->getMaxValue(tmp); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); - PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); - return ret; - } - - PyObject *getMaxAbsValue(std::size_t& tupleId) const - { - std::size_t tmp; - int r1=self->getMaxAbsValue(tmp); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); - PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); - return ret; - } - - PyObject *getMinValue() const - { - int tmp; - int r1=self->getMinValue(tmp); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); - PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); - return ret; - } - - int index(PyObject *obj) const - { - int nbOfCompo=self->getNumberOfComponents(); - switch(nbOfCompo) - { - case 1: - { - if(PyInt_Check(obj)) - { - int val=(int)PyInt_AS_LONG(obj); - return self->findIdFirstEqual(val); - } - else - throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !"); - } - default: - { - std::vector arr; - convertPyToNewIntArr3(obj,arr); - return self->findIdFirstEqualTuple(arr); - } - } - } - - bool __contains__(PyObject *obj) const - { - int nbOfCompo=self->getNumberOfComponents(); - switch(nbOfCompo) - { - case 0: - return false; - case 1: - { - if(PyInt_Check(obj)) - { - int val=(int)PyInt_AS_LONG(obj); - return self->presenceOfValue(val); - } - else - throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !"); - } - default: - { - std::vector arr; - convertPyToNewIntArr3(obj,arr); - return self->presenceOfTuple(arr); - } - } - } - - PyObject *__getitem__(PyObject *obj) - { - const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !"; - const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - self->checkAllocated(); - int nbOfTuples=self->getNumberOfTuples(); - int nbOfComponents=self->getNumberOfComponents(); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; - int sw; - convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto ret; - switch(sw) - { - case 1: - { - if(nbOfComponents==1) - return PyInt_FromLong(self->getIJSafe(it1,0)); - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 2: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 3: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 4: - return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - case 5: - return PyInt_FromLong(self->getIJSafe(it1,ic1)); - case 6: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 7: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 8: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - std::vector v2(1,ic1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 9: - { - ret=self->selectByTupleIdSafe(&it1,&it1+1); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 10: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 11: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 12: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 13: - { - ret=self->selectByTupleIdSafe(&it1,&it1+1); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 14: - { - ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size()); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 15: - { - ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - case 16: - { - ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems()); - int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2); - std::vector v2(nbOfComp); - for(int i=0;ikeepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__setitem__(PyObject *obj, PyObject *value) - { - self->checkAllocated(); - const char msg[]="Unexpected situation in __setitem__ !"; - int nbOfTuples=self->getNumberOfTuples(); - int nbOfComponents=self->getNumberOfComponents(); - int sw1,sw2; - int i1; - std::vector v1; - DataArrayInt *d1=0; - DataArrayIntTuple *dd1=0; - convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; - convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto tmp; - switch(sw2) - { - case 1: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 2: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 3: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 4: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false); - return self; - case 3: - self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 5: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 6: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 7: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 8: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false); - return self; - case 3: - self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 9: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 10: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 11: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 12: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false); - return self; - case 3: - self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size()); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 13: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 14: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 15: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - case 16: - { - switch(sw1) - { - case 1: - self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 2: - tmp=DataArrayInt::New(); - tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false); - return self; - case 3: - self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); - return self; - case 4: - tmp=dd1->buildDAInt(1,self->getNumberOfComponents()); - self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second); - return self; - default: - throw INTERP_KERNEL::Exception(msg); - } - break; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - return self; - } - - DataArrayInt *__neg__() const - { - return self->negate(); - } - - DataArrayInt *__add__(PyObject *obj) - { - const char msg[]="Unexpected situation in __add__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Add(self,aaaa); - } - case 3: - { - return DataArrayInt::Add(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Add(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__radd__(PyObject *obj) - { - const char msg[]="Unexpected situation in __radd__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Add(self,aaaa); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Add(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __iadd__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(1,val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->addEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->addEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->addEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__sub__(PyObject *obj) - { - const char msg[]="Unexpected situation in __sub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(1,-val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Substract(self,aaaa); - } - case 3: - { - return DataArrayInt::Substract(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Substract(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rsub__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rsub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(-1,val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Substract(aaaa,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Substract(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___isub___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __isub__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(1,-val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->substractEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->substractEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->substractEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__mul__(PyObject *obj) - { - const char msg[]="Unexpected situation in __mul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(val,0); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Multiply(self,aaaa); - } - case 3: - { - return DataArrayInt::Multiply(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Multiply(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rmul__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rmul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyLin(val,0); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Multiply(self,aaaa); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Multiply(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___imul___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __imul__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyLin(val,0); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->multiplyEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->multiplyEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->multiplyEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__div__(PyObject *obj) - { - const char msg[]="Unexpected situation in __div__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyDivideBy(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Divide(self,aaaa); - } - case 3: - { - return DataArrayInt::Divide(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Divide(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rdiv__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rdiv__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyInv(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Divide(aaaa,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Divide(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __idiv__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyDivideBy(val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 2: - { - MCAuto bb=DataArrayInt::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - self->divideEqual(bb); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->divideEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->divideEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__mod__(PyObject *obj) - { - const char msg[]="Unexpected situation in __mod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyModulus(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Modulus(self,aaaa); - } - case 3: - { - return DataArrayInt::Modulus(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Modulus(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rmod__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rmod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyRModulus(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Modulus(aaaa,self); - } - case 3: - { - return DataArrayInt::Modulus(a,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Modulus(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___imod___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __imod__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyModulus(val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->modulusEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->modulusEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__pow__(PyObject *obj) - { - const char msg[]="Unexpected situation in __pow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyPow(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Pow(self,aaaa); - } - case 3: - { - return DataArrayInt::Pow(self,a); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Pow(self,aaaa); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - DataArrayInt *__rpow__(PyObject *obj) - { - const char msg[]="Unexpected situation in __rpow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - MCAuto ret=self->deepCopy(); - ret->applyRPow(val); - return ret.retn(); - } - case 2: - { - MCAuto aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,(int)aa.size()); - return DataArrayInt::Pow(aaaa,self); - } - case 3: - { - return DataArrayInt::Pow(a,self); - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - return DataArrayInt::Pow(aaaa,self); - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) - { - const char msg[]="Unexpected situation in __ipow__ !"; - int val; - DataArrayInt *a; - std::vector aa; - DataArrayIntTuple *aaa; - int sw; - convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa); - switch(sw) - { - case 1: - { - self->applyPow(val); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 3: - { - self->powEqual(a); - Py_XINCREF(trueSelf); - return trueSelf; - } - case 4: - { - MCAuto aaaa=aaa->buildDAInt(1,self->getNumberOfComponents()); - self->powEqual(aaaa); - Py_XINCREF(trueSelf); - return trueSelf; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - - std::string __repr__() const - { - std::ostringstream oss; - self->reprQuickOverview(oss); - return oss.str(); - } - - void pushBackValsSilent(PyObject *li) - { - int szArr,sw,iTypppArr; - std::vector stdvecTyyppArr; - const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr); - self->pushBackValsSilent(tmp,tmp+szArr); - } - - PyObject *partitionByDifferentValues() const - { - std::vector ret1; - std::vector ret0=self->partitionByDifferentValues(ret1); - std::size_t sz=ret0.size(); - PyObject *pyRet=PyTuple_New(2); - PyObject *pyRet0=PyList_New((int)sz); - PyObject *pyRet1=PyList_New((int)sz); - for(std::size_t i=0;ifindIdsRangesInListOfIds(listOfIds,ret0,ret1); - PyObject *pyRet=PyTuple_New(2); - PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return pyRet; - } - - PyObject *isRange() const - { - int a(0),b(0),c(0); - bool ret(self->isRange(a,b,c)); - PyObject *pyRet=PyTuple_New(2); - PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0); - Py_XINCREF(ret0Py); - PyTuple_SetItem(pyRet,0,ret0Py); - if(ret) - ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c)); - else - { - ret1Py=Py_None; - Py_XINCREF(ret1Py); - } - PyTuple_SetItem(pyRet,1,ret1Py); - return pyRet; - } - - static bool RemoveIdsFromIndexedArrays(PyObject *li, DataArrayInt *arr, DataArrayInt *arrIndx, int offsetForRemoval=0) throw(INTERP_KERNEL::Exception) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndx) - throw INTERP_KERNEL::Exception("DataArrayInt::RemoveIdsFromIndexedArrays : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - return DataArrayInt::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval); - case 2: - return DataArrayInt::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval); - case 4: - return DataArrayInt::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval); - default: - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - static PyObject *ExtractFromIndexedArrays(PyObject *li, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : null pointer as arrIndxIn !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - case 2: - { - DataArrayInt::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - case 4: - { - DataArrayInt::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *ExtractFromIndexedArraysSlice(int strt, int stp, int step, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn) throw(INTERP_KERNEL::Exception) - { - if(!PySlice_Check(slic)) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !"); - Py_ssize_t strt=2,stp=2,step=2; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !"); - arrIndxIn->checkAllocated(); - if(arrIndxIn->getNumberOfComponents()!=1) - throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !"); - GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !"); - DataArrayInt *arrOut=0,*arrIndexOut=0; - DataArrayInt::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static PyObject *SetPartOfIndexedArrays(PyObject *li, - const DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception) - { - DataArrayInt *arrOut=0,*arrIndexOut=0; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - case 2: - { - DataArrayInt::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - case 4: - { - DataArrayInt::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - static void SetPartOfIndexedArraysSameIdx(PyObject *li, DataArrayInt *arrIn, const DataArrayInt *arrIndxIn, - const DataArrayInt *srcArr, const DataArrayInt *srcArrIndex) throw(INTERP_KERNEL::Exception) - { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - if(!arrIndxIn) - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !"); - convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - case 2: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - case 4: - { - DataArrayInt::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex); - break; - } - default: - throw INTERP_KERNEL::Exception("DataArrayInt::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !"); - } - } - - } // end extent - }; - - class DataArrayIntTuple; - - class DataArrayIntIterator - { - public: - DataArrayIntIterator(DataArrayInt *da); - ~DataArrayIntIterator(); - %extend - { - PyObject *next() - { - DataArrayIntTuple *ret=self->nextt(); - if(ret) - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0); - else - { - PyErr_SetString(PyExc_StopIteration,"No more data."); - return 0; - } - } - } - }; - - class DataArrayIntTuple - { - public: - int getNumberOfCompo() const; - DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const; - %extend - { - std::string __str__() const - { - return self->repr(); - } - - int __int__() const - { - return self->intValue(); - } - - DataArrayInt *buildDAInt() - { - return self->buildDAInt(1,self->getNumberOfCompo()); - } - - PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____iadd___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___isub___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____isub___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___imul___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____imul___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____idiv___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *___imod___(PyObject *trueSelf, PyObject *obj) - { - MCAuto ret=self->buildDAInt(1,self->getNumberOfCompo()); - MEDCoupling_DataArrayInt____imod___(ret,0,obj); - Py_XINCREF(trueSelf); - return trueSelf; - } - - PyObject *__len__() - { - return PyInt_FromLong(self->getNumberOfCompo()); - } - - PyObject *__getitem__(PyObject *obj) - { - const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !"; - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - const int *pt=self->getConstPointer(); - int nbc=self->getNumberOfCompo(); - convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp); - switch(sw) - { - case 1: - { - if(singleVal>=nbc) - { - std::ostringstream oss; - oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; - PyErr_SetString(PyExc_StopIteration,oss.str().c_str()); - return 0; - } - if(singleVal>=0) - return PyInt_FromLong(pt[singleVal]); - else - { - if(nbc+singleVal>0) - return PyInt_FromLong(pt[nbc+singleVal]); - else - { - std::ostringstream oss; - oss << "Requesting for id " << singleVal << " having only " << nbc << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - } - } - case 2: - { - PyObject *t=PyTuple_New(multiVal.size()); - for(int j=0;j<(int)multiVal.size();j++) - { - int cid=multiVal[j]; - if(cid>=nbc) - { - std::ostringstream oss; - oss << "Requesting for id #" << cid << " having only " << nbc << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid])); - } - return t; - } - case 3: - { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); - PyObject *t=PyTuple_New(sz); - for(int j=0;j multiValV; - std::pair > slicV; - MEDCoupling::DataArrayIntTuple *daIntTyyppV=0; - int nbc=self->getNumberOfCompo(); - convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV); - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int *pt=self->getPointer(); - convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp); - switch(sw2) - { - case 1: - { - if(singleVal>=nbc) - { - std::ostringstream oss; - oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - switch(sw1) - { - case 1: - { - pt[singleVal]=singleValV; - return self; - } - case 2: - { - if(multiValV.size()!=1) - { - std::ostringstream oss; - oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - pt[singleVal]=multiValV[0]; - return self; - } - case 4: - { - pt[singleVal]=daIntTyyppV->getConstPointer()[0]; - return self; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - case 2: - { - switch(sw1) - { - case 1: - { - for(std::vector::const_iterator it=multiVal.begin();it!=multiVal.end();it++) - { - if(*it>=nbc) - { - std::ostringstream oss; - oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - pt[*it]=singleValV; - } - return self; - } - case 2: - { - if(multiVal.size()!=multiValV.size()) - { - std::ostringstream oss; - oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - for(int i=0;i<(int)multiVal.size();i++) - { - int pos=multiVal[i]; - if(pos>=nbc) - { - std::ostringstream oss; - oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - pt[multiVal[i]]=multiValV[i]; - } - return self; - } - case 4: - { - const int *ptV=daIntTyyppV->getConstPointer(); - if(nbc>daIntTyyppV->getNumberOfCompo()) - { - std::ostringstream oss; - oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - std::copy(ptV,ptV+nbc,pt); - return self; - } - default: - throw INTERP_KERNEL::Exception(msg); - } - } - case 3: - { - int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2); - switch(sw1) - { - case 1: - { - for(int j=0;jgetConstPointer(); - if(sz>daIntTyyppV->getNumberOfCompo()) - { - std::ostringstream oss; - oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); - } - for(int j=0;j& tupl) const; - bool presenceOfTuple(const std::vector& tupl) const; - char getMaxValue(int& tupleId) const; - char getMaxValueInArray() const; - char getMinValue(int& tupleId) const; - char getMinValueInArray() const; - DataArrayInt *findIdsInRange(char vmin, char vmax) const; - static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); - static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); - %extend - { - int __len__() const - { - if(self->isAllocated()) - { - return self->getNumberOfTuples(); - } - else - { - throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !"); - } - } - - PyObject *isEqualIfNotWhy(const DataArrayChar& other) const - { - std::string ret1; - bool ret0=self->isEqualIfNotWhy(other,ret1); - PyObject *ret=PyTuple_New(2); - PyObject *ret0Py=ret0?Py_True:Py_False; - Py_XINCREF(ret0Py); - PyTuple_SetItem(ret,0,ret0Py); - PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str())); - return ret; - } - - DataArrayChar *renumber(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumber(tmp); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumber(da2->getConstPointer()); - } - } - - DataArrayChar *renumberR(PyObject *li) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberR(tmp); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberR(da2->getConstPointer()); - } - } - - DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) - { - void *da=0; - int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ); - if (!SWIG_IsOK(res1)) - { - int size; - INTERP_KERNEL::AutoPtr tmp=convertPyToNewIntArr2(li,&size); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberAndReduce(tmp,newNbOfTuple); - } - else - { - DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da); - if(!da2) - throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !"); - da2->checkAllocated(); - int size=self->getNumberOfTuples(); - if(size!=self->getNumberOfTuples()) - { - throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !"); - } - return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple); - } - } - - static DataArrayChar *Aggregate(PyObject *dachs) - { - std::vector tmp; - convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); - return DataArrayChar::Aggregate(tmp); - } - - static DataArrayChar *Meld(PyObject *dachs) - { - std::vector tmp; - convertFromPyObjVectorOfObj(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp); - return DataArrayChar::Meld(tmp); - } - } - }; - - class DataArrayByteIterator; - - class DataArrayByte : public DataArrayChar - { - public: - static DataArrayByte *New(); - DataArrayByteIterator *iterator(); - DataArrayByte *performCopyOrIncrRef(bool deepCopy) const; - char byteValue() const; - %extend - { - DataArrayByte() - { - return DataArrayByte::New(); - } - - static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) - { - const char *msg="MEDCoupling::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !"; - if(PyList_Check(elt0) || PyTuple_Check(elt0)) - { - if(nbOfTuples) - { - if(PyInt_Check(nbOfTuples)) - { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); - if(nbOfComp) - { - if(PyInt_Check(nbOfComp)) - {//DataArrayByte.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MCAuto ret=DataArrayByte::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); - ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayByte.New([1,3,4],3) - MCAuto ret=DataArrayByte::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); - ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {// DataArrayByte.New([1,3,4]) - MCAuto ret=DataArrayByte::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); - ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); - return ret.retn(); - } - } - else if(PyInt_Check(elt0)) - { - int nbOfTuples1=PyInt_AS_LONG(elt0); - if(nbOfTuples1<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !"); - if(nbOfTuples) - { - if(!nbOfComp) - { - if(PyInt_Check(nbOfTuples)) - {//DataArrayByte.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); - if(nbOfCompo<0) - throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !"); - MCAuto ret=DataArrayByte::New(); - ret->alloc(nbOfTuples1,nbOfCompo); - return ret.retn(); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - throw INTERP_KERNEL::Exception(msg); - } - else - {//DataArrayByte.New(5) - MCAuto ret=DataArrayByte::New(); - ret->alloc(nbOfTuples1,1); - return ret.retn(); - } - } -#ifdef WITH_NUMPY - else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL) - {//DataArrayDouble.New(numpyArray) - return BuildNewInstance(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8"); - } -#endif - else - throw INTERP_KERNEL::Exception(msg); - } - - DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) - { - return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp); - } - - std::string __repr__() const - { - std::ostringstream oss; - self->reprQuickOverview(oss); - return oss.str(); - } - - int __int__() const - { - return (int) self->byteValue(); - } - - DataArrayByteIterator *__iter__() - { - return self->iterator(); - } - - int getIJ(int tupleId, int compoId) const - { - return (int)self->getIJ(tupleId,compoId); - } - - int getIJSafe(int tupleId, int compoId) const - { - return (int)self->getIJSafe(tupleId,compoId); - } - - std::string __str__() const - { - return self->repr(); - } - - PyObject *toStrList() const - { - const char *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); - return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); - } - - bool presenceOfTuple(PyObject *tupl) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->presenceOfTuple(vals); - } - - bool presenceOfValue(PyObject *vals) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); - std::vector vals2(sz); - std::copy(pt,pt+sz,vals2.begin()); - return self->presenceOfValue(vals2); - } - - int findIdFirstEqual(PyObject *vals) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval); - std::vector vals2(sz); - std::copy(pt,pt+sz,vals2.begin()); - return self->findIdFirstEqual(vals2); - } - - int findIdFirstEqualTuple(PyObject *tupl) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->findIdFirstEqualTuple(vals); - } - - int findIdSequence(PyObject *strOrListOfInt) const - { - int sz=-1,sw=-1; - int ival=-1; std::vector ivval; - const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval); - std::vector vals(sz); - std::copy(pt,pt+sz,vals.begin()); - return self->findIdSequence(vals); - } - - PyObject *getTuple(int tupleId) - { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new char[sz]; self->getTuple(tupleId,tmp); PyObject *ret=PyTuple_New(sz); - for(int i=0;igetMaxValue(tmp); + mcIdType tmp; + mcIdType r1=(mcIdType)self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); @@ -5192,24 +2765,24 @@ namespace MEDCoupling PyObject *getMinValue() const { - int tmp; - int r1=(int)self->getMinValue(tmp); + mcIdType tmp; + mcIdType r1=(mcIdType)self->getMinValue(tmp); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,PyInt_FromLong(r1)); PyTuple_SetItem(ret,1,PyInt_FromLong(tmp)); return ret; } - int index(PyObject *obj) const + mcIdType index(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + std::size_t nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 1: { if(PyInt_Check(obj)) { - int val=(int)PyInt_AS_LONG(obj); + char val=(char)PyInt_AS_LONG(obj); return self->findIdFirstEqual(val); } else @@ -5222,7 +2795,7 @@ namespace MEDCoupling bool __contains__(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + std::size_t nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 0: @@ -5231,7 +2804,7 @@ namespace MEDCoupling { if(PyInt_Check(obj)) { - int val=(int)PyInt_AS_LONG(obj); + char val=(char)PyInt_AS_LONG(obj); return self->presenceOfValue(val); } else @@ -5253,19 +2826,21 @@ namespace MEDCoupling { self->checkAllocated(); const char msg[]="Unexpected situation in __setitem__ !"; - int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents()); - int sw1,sw2; - int i1; + mcIdType nbOfTuples(self->getNumberOfTuples()); + int nbOfComponents((int)self->getNumberOfComponents()); + mcIdType sw1,sw2; + int int1; std::vector v1; - DataArrayInt *d1=0; + DataArrayIdType *d1=0; DataArrayIntTuple *dd1=0; - convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1); - int it1,ic1; - std::vector vt1,vc1; - std::pair > pt1,pc1; - DataArrayInt *dt1=0,*dc1=0; + convertIntStarLikePyObjToCpp(value,sw1,int1,v1,d1,dd1); + mcIdType it1,ic1; + std::vector vt1,vc1; + std::pair > pt1,pc1; + DataArrayIdType *dt1=0,*dc1=0; convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1); - MCAuto tmp; + MCAuto tmp; + char i1 = (char)int1; switch(sw2) { case 1: @@ -5481,7 +3056,7 @@ namespace MEDCoupling { public: std::string repr() const; - DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const; + DataArrayByte *buildDAByte(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -5526,18 +3101,18 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) { - int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !"); if(nbOfComp) { if(PyInt_Check(nbOfComp)) {//DataArrayAsciiChar.New([1,3,4,5],2,2) - int nbOfCompo=PyInt_AS_LONG(nbOfComp); + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp)); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); MCAuto ret=DataArrayAsciiChar::New(); - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo); ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5547,8 +3122,8 @@ namespace MEDCoupling else {//DataArrayAsciiChar.New([1,3,4],3) MCAuto ret=DataArrayAsciiChar::New(); - int tmpp1=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); + mcIdType tmpp1=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1); ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5590,8 +3165,8 @@ namespace MEDCoupling { // DataArrayAsciiChar.New([1,3,4]) MCAuto ret=DataArrayAsciiChar::New(); - int tmpp1=-1,tmpp2=-1; - std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); + mcIdType tmpp1=-1,tmpp2=-1; + std::vector tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2); ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer()); return ret.retn(); } @@ -5599,7 +3174,7 @@ namespace MEDCoupling } else if(PyInt_Check(elt0)) { - int nbOfTuples1=PyInt_AS_LONG(elt0); + mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(elt0)); if(nbOfTuples1<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !"); if(nbOfTuples) @@ -5608,7 +3183,7 @@ namespace MEDCoupling { if(PyInt_Check(nbOfTuples)) {//DataArrayAsciiChar.New(5,2) - int nbOfCompo=PyInt_AS_LONG(nbOfTuples); + mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfTuples)); if(nbOfCompo<0) throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !"); MCAuto ret=DataArrayAsciiChar::New(); @@ -5649,14 +3224,14 @@ namespace MEDCoupling return self->iterator(); } - std::string getIJ(int tupleId, int compoId) const + std::string getIJ(mcIdType tupleId, mcIdType compoId) const { char tmp[2]; tmp[1]='\0'; tmp[0]=self->getIJ(tupleId,compoId); return std::string(tmp); } - std::string getIJSafe(int tupleId, int compoId) const + std::string getIJSafe(mcIdType tupleId, mcIdType compoId) const { char tmp[2]; tmp[1]='\0'; tmp[0]=self->getIJSafe(tupleId,compoId); @@ -5671,9 +3246,9 @@ namespace MEDCoupling PyObject *toStrList() const { const char *vals=self->getConstPointer(); - int nbOfComp=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); - return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples); + std::size_t nbOfComp=self->getNumberOfComponents(); + mcIdType nbOfTuples=self->getNumberOfTuples(); + return convertCharArrToPyListOfTuple(vals,(int)nbOfComp,nbOfTuples); } bool presenceOfTuple(PyObject *tupl) const @@ -5720,7 +3295,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !"); } - int findIdFirstEqual(PyObject *vals) const + mcIdType findIdFirstEqual(PyObject *vals) const { if(PyString_Check(vals)) { @@ -5742,7 +3317,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !"); } - int findIdFirstEqualTuple(PyObject *tupl) const + mcIdType findIdFirstEqualTuple(PyObject *tupl) const { if(PyString_Check(tupl)) { @@ -5764,7 +3339,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !"); } - int findIdSequence(PyObject *strOrListOfInt) const + mcIdType findIdSequence(PyObject *strOrListOfInt) const { if(PyString_Check(strOrListOfInt)) { @@ -5786,9 +3361,9 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !"); } - PyObject *getTuple(int tupleId) const + PyObject *getTuple(mcIdType tupleId) const { - int sz=self->getNumberOfComponents(); + std::size_t sz=self->getNumberOfComponents(); INTERP_KERNEL::AutoPtr tmp=new char[sz+1]; tmp[sz]='\0'; self->getTuple(tupleId,tmp); return PyString_FromString(tmp); @@ -5796,7 +3371,7 @@ namespace MEDCoupling PyObject *getMaxValue() const { - int tmp; + mcIdType tmp; char tmp2[2]; tmp2[1]='\0'; tmp2[0]=self->getMaxValue(tmp); PyObject *ret=PyTuple_New(2); @@ -5807,7 +3382,7 @@ namespace MEDCoupling PyObject *getMinValue() const { - int tmp; + mcIdType tmp; char tmp2[2]; tmp2[1]='\0'; tmp2[0]=self->getMinValue(tmp); PyObject *ret=PyTuple_New(2); @@ -5816,9 +3391,9 @@ namespace MEDCoupling return ret; } - int index(PyObject *obj) const + mcIdType index(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + std::size_t nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 1: @@ -5853,7 +3428,7 @@ namespace MEDCoupling bool __contains__(PyObject *obj) const { - int nbOfCompo=self->getNumberOfComponents(); + std::size_t nbOfCompo=self->getNumberOfComponents(); switch(nbOfCompo) { case 0: @@ -5890,10 +3465,10 @@ namespace MEDCoupling PyObject *__getitem__(PyObject *obj) const { - int sw,iTypppArr; - std::vector stdvecTyyppArr; - std::pair > sTyyppArr; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw,iTypppArr; + std::vector stdvecTyyppArr; + std::pair > sTyyppArr; + MEDCoupling::DataArrayIdType *daIntTyypp=0; convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp); switch(sw) { @@ -5906,21 +3481,21 @@ namespace MEDCoupling case 4: return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 ); default: - throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !"); + throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input !"); } } DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) { - static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance."; - int sw1,iTypppArr; - std::vector stdvecTyyppArr; - std::pair > sTyyppArr; - MEDCoupling::DataArrayInt *daIntTyypp=0; - int nbOfCompo=self->getNumberOfComponents(); - int nbOfTuples=self->getNumberOfTuples(); + static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayIdType and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance."; + mcIdType sw1,iTypppArr; + std::vector stdvecTyyppArr; + std::pair > sTyyppArr; + MEDCoupling::DataArrayIdType *daIntTyypp=0; + mcIdType nbOfCompo=ToIdType(self->getNumberOfComponents()); + mcIdType nbOfTuples=self->getNumberOfTuples(); convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp); - int sw2; + mcIdType sw2; char vc; std::string sc; std::vector vsc; DataArrayChar *dacc=0; convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc); switch(sw1) @@ -6029,7 +3604,7 @@ namespace MEDCoupling } } case 4: - {//DataArrayInt + {//DataArrayIdType switch(sw2) { {//value char @@ -6096,8 +3671,8 @@ namespace MEDCoupling class DataArrayAsciiCharTuple { public: - int getNumberOfCompo() const; - DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const; + std::size_t getNumberOfCompo() const; + DataArrayAsciiChar *buildDAAsciiChar(mcIdType nbOfTuples, mcIdType nbOfCompo) const; %extend { std::string __str__() const @@ -6113,6 +3688,8 @@ namespace MEDCoupling }; } +%include "DataArrayInt.i" + %pythoncode %{ def MEDCouplingStdReduceFunct(cls,params): a,b=params @@ -6126,10 +3703,15 @@ def MEDCouplingDataArrayDoubleReduce(self): raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),)) -def MEDCouplingDataArrayIntReduce(self): +def MEDCouplingDataArrayInt32Reduce(self): if not MEDCouplingHasNumPyBindings(): - raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") - return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),)) + raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") + return MEDCouplingStdReduceFunct,(DataArrayInt32,((self.toNumPyArray(),),(self.__getstate__()),)) + +def MEDCouplingDataArrayInt64Reduce(self): + if not MEDCouplingHasNumPyBindings(): + raise InterpKernelException("PyWrap of DataArrayIdType.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") + return MEDCouplingStdReduceFunct,(DataArrayInt64,((self.toNumPyArray(),),(self.__getstate__()),)) def MEDCouplingDataArrayByteReduce(self): if not MEDCouplingHasNumPyBindings(): @@ -6140,4 +3722,11 @@ def MEDCouplingDataArrayFloatReduce(self): if not MEDCouplingHasNumPyBindings(): raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !") return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),)) + +if MEDCouplingUse64BitIDs(): + DataArrayInt=DataArrayInt64 +else: + DataArrayInt=DataArrayInt32 +pass + %} diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py index a76432a4a..b35f9ecdb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py @@ -46,10 +46,10 @@ class MEDCouplingNumPyTest(unittest.TestCase): a=a.cumsum(dtype=int32) a=array(a,dtype=int64) ; a=array(a,dtype=int32) self.assertEqual(getrefcount(a),2) - d=DataArrayInt(a) + d=DataArrayInt32(a) d[:]=2 # - e=DataArrayInt(sz) ; e.fillWithValue(2) + e=DataArrayInt32(sz) ; e.fillWithValue(2) self.assertTrue(d.isEqual(e)) # a[:]=4 ; e.fillWithValue(4) @@ -66,9 +66,9 @@ class MEDCouplingNumPyTest(unittest.TestCase): self.assertEqual(getrefcount(a),3) self.assertEqual(getrefcount(b),2) b[:]=5 - d=DataArrayInt(b) + d=DataArrayInt32(b) # - e=DataArrayInt(sz*2) ; e.fillWithValue(5) + e=DataArrayInt32(sz*2) ; e.fillWithValue(5) self.assertTrue(d.isEqual(e)) pass @@ -81,16 +81,16 @@ class MEDCouplingNumPyTest(unittest.TestCase): c=a.reshape(2,sz) b[:]=6 b[7:17]=7 - d=DataArrayInt(b) - self.assertTrue(d.isEqual(DataArrayInt([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6]))) + d=DataArrayInt32(b) + self.assertTrue(d.isEqual(DataArrayInt32([6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,6,6,6]))) # a=zeros((10,2),dtype=int32) b=a.T c=b.view() a.shape=20 a[3:]=10. - d=DataArrayInt(a) - self.assertTrue(d.isEqual(DataArrayInt([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]))) + d=DataArrayInt32(a) + self.assertTrue(d.isEqual(DataArrayInt32([0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]))) pass @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") @@ -104,7 +104,7 @@ class MEDCouplingNumPyTest(unittest.TestCase): def test5(self): a=arange(20,dtype=int32) self.assertEqual(weakref.getweakrefcount(a),0) - d=DataArrayInt(a) + d=DataArrayInt32(a) self.assertEqual(weakref.getweakrefcount(a),1) self.assertTrue(not a.flags["OWNDATA"]) self.assertTrue(d.isIota(20)) @@ -116,14 +116,14 @@ class MEDCouplingNumPyTest(unittest.TestCase): gc.collect() self.assertTrue(a.flags["OWNDATA"]) a[:]=4 # a can be used has usual - self.assertTrue(DataArrayInt(a).isUniform(4)) + self.assertTrue(DataArrayInt32(a).isUniform(4)) pass @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test6(self): a=arange(20,dtype=int32) - d=DataArrayInt(a) # d owns data of a - e=DataArrayInt(a) # a not owned -> e only an access to chunk of a + d=DataArrayInt32(a) # d owns data of a + e=DataArrayInt32(a) # a not owned -> e only an access to chunk of a self.assertTrue(d.isIota(d.getNumberOfTuples())) self.assertTrue(e.isIota(e.getNumberOfTuples())) a[:]=6 @@ -142,9 +142,9 @@ class MEDCouplingNumPyTest(unittest.TestCase): a=array(0,dtype=int32) ; a.resize(10,2) b=a.reshape(20) c=a.reshape(2,10) - d=DataArrayInt(b) # d owns data of a - e=DataArrayInt(b) # a not owned -> e only an access to chunk of a - f=DataArrayInt(b) # a not owned -> e only an access to chunk of a + d=DataArrayInt32(b) # d owns data of a + e=DataArrayInt32(b) # a not owned -> e only an access to chunk of a + f=DataArrayInt32(b) # a not owned -> e only an access to chunk of a del d # d removed -> a ownes again data ##@@ Ensure a pass of the garbage collector so that the de-allocator of d is called import gc @@ -177,11 +177,11 @@ class MEDCouplingNumPyTest(unittest.TestCase): def test8(self): a=arange(20,dtype=int32) self.assertTrue(a.flags["OWNDATA"]) - d=DataArrayInt(a) # d owns data of a + d=DataArrayInt32(a) # d owns data of a self.assertTrue(not a.flags["OWNDATA"]) d.pushBackSilent(20)# d pushBack so release of chunk of data -> a becomes owner of its data again self.assertTrue(a.flags["OWNDATA"]) - self.assertTrue(d.isEqual(DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))) + self.assertTrue(d.isEqual(DataArrayInt32([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))) self.assertEqual(a.tolist(),[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) pass @@ -394,13 +394,13 @@ class MEDCouplingNumPyTest(unittest.TestCase): a.resize(sz//2,2) a[:]=4 self.assertEqual(getrefcount(a),2) - d=DataArrayInt(a) + d=DataArrayInt32(a) self.assertEqual(10,d.getNumberOfTuples()) self.assertEqual(2,d.getNumberOfComponents()) self.assertEqual(sz,d.getNbOfElems()) - self.assertTrue(d.isEqual(DataArrayInt([(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4)]))) + self.assertTrue(d.isEqual(DataArrayInt32([(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4),(4,4)]))) a[:]=7 - self.assertTrue(d.isEqual(DataArrayInt([(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7)]))) + self.assertTrue(d.isEqual(DataArrayInt32([(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7),(7,7)]))) # b=a.reshape((2,5,2)) self.assertRaises(InterpKernelException,DataArrayInt.New,b) # b has not dimension in [0,1] ! @@ -430,7 +430,7 @@ class MEDCouplingNumPyTest(unittest.TestCase): #tests that only DataArray*(npArray) constructor is available a=array(0,dtype=int32) a.resize(20) - DataArrayInt(a) + DataArrayInt32(a) self.assertRaises(InterpKernelException,DataArrayInt.New,a,20) self.assertRaises(InterpKernelException,DataArrayInt.New,a,20,1) a=array(0,dtype=float64) @@ -564,9 +564,9 @@ class MEDCouplingNumPyTest(unittest.TestCase): @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy") def test25(self): a=arange(10,dtype=int32) - b=DataArrayInt(a) - c=DataArrayInt(a) - d=DataArrayInt(a) + b=DataArrayInt32(a) + c=DataArrayInt32(a) + d=DataArrayInt32(a) self.assertTrue(b.isIota(10)) self.assertTrue(c.isIota(10)) self.assertTrue(d.isIota(10)) @@ -584,8 +584,8 @@ class MEDCouplingNumPyTest(unittest.TestCase): self.assertTrue(c.isIota(11)) # a=arange(10,dtype=int32) - b=DataArrayInt(a) - c=DataArrayInt(a) + b=DataArrayInt32(a) + c=DataArrayInt32(a) self.assertTrue(b.isIota(10)) self.assertTrue(c.isIota(10)) b.pushBackSilent(10) # c and a,b are dissociated @@ -644,9 +644,9 @@ class MEDCouplingNumPyTest(unittest.TestCase): self.assertEqual(a.ndim,2) self.assertEqual(a.size,15) self.assertEqual(a.shape,(5,3)) - self.assertEqual(a.strides,(12,4)) - self.assertEqual(a.nbytes,60) - self.assertEqual(a.itemsize,4) + self.assertEqual(a.strides,(3*MEDCouplingSizeOfIDs()//8,MEDCouplingSizeOfIDs()//8)) + self.assertEqual(a.nbytes,15*MEDCouplingSizeOfIDs()//8) + self.assertEqual(a.itemsize,MEDCouplingSizeOfIDs()//8) self.assertEqual(a.tolist(),[[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14]]) # d2=d.convertToDblArr() diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index e5f6bb732..c0c633e1a 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -347,7 +347,7 @@ class MEDCouplingPickleTest(unittest.TestCase): f.setName("aname") a=f.getArray() b=a[:] ; b.iota(7000) - f.setArray(DataArrayInt.Meld(a,b)) + f.setArray(DataArrayInt32.Meld(a,b)) f.getArray().setInfoOnComponents(["u1","vv2"]) f.checkConsistencyLight(); # diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index 665c95f50..7f9bdad56 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -187,6 +187,15 @@ namespace MEDCoupling return false; #endif } + + bool MEDCouplingUse64BitIDs() + { +#ifndef MEDCOUPLING_USE_64BIT_IDS + return false; +#else + return true; +#endif + } std::string MEDCouplingCompletionScript() { diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapper.i b/src/MEDCoupling_Swig/MEDCouplingRemapper.i index 5b8e041ed..ecd4a7ff7 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapper.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapper.i @@ -66,24 +66,42 @@ def MEDCouplingDataArrayFloatImul(self,*args): def MEDCouplingDataArrayFloatIdiv(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayFloat____idiv___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDCouplingRemapper.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDCouplingRemapper.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDCouplingRemapper.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDCouplingRemapper.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDCouplingRemapper.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayInt____ipow___(self, self, *args) + return _MEDCouplingRemapper.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayDoubleTupleIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayDoubleTuple____iadd___(self, self, *args) @@ -96,21 +114,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): + import _MEDCouplingRemapper + return _MEDCouplingRemapper.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDCouplingRemapper.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDCouplingRemapper.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDCouplingRemapper.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDCouplingRemapper.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): import _MEDCouplingRemapper - return _MEDCouplingRemapper.DataArrayIntTuple____imod___(self, self, *args) + return _MEDCouplingRemapper.DataArrayInt64Tuple____imod___(self, self, *args) def MEDCouplingDenseMatrixIadd(self,*args): import _MEDCouplingRemapper return _MEDCouplingRemapper.DenseMatrix____iadd___(self, self, *args) diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i b/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i index 1a7364d69..4c0c0188b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperCommon.i @@ -69,14 +69,14 @@ namespace MEDCoupling { PyObject *getCrudeMatrix() const { - const std::vector >& m=self->getCrudeMatrix(); + const std::vector >& m=self->getCrudeMatrix(); std::size_t sz=m.size(); PyObject *ret=PyList_New(sz); for(std::size_t i=0;i& row=m[i]; + const std::map& row=m[i]; PyObject *ret0=PyDict_New(); - for(std::map::const_iterator it=row.begin();it!=row.end();it++) + for(std::map::const_iterator it=row.begin();it!=row.end();it++) PyDict_SetItem(ret0,PyInt_FromLong((*it).first),PyFloat_FromDouble((*it).second)); PyList_SetItem(ret,i,ret0); } @@ -90,15 +90,22 @@ namespace MEDCoupling #endif void setCrudeMatrix(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method, PyObject *m) { - std::vector > mCpp; + std::vector > mCpp; if(isCSRMatrix(m)) { #if defined(WITH_NUMPY) && defined(WITH_SCIPY) PyObject *indptr(PyObject_GetAttrString(m,"indptr")); PyObject *indices(PyObject_GetAttrString(m,"indices")); PyObject *data(PyObject_GetAttrString(m,"data")); - MCAuto indptrPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indptr,NULL,NULL)); - MCAuto indicesPtr(MEDCoupling_DataArrayInt_New__SWIG_1(indices,NULL,NULL)); + MCAuto indptrPtr, indicesPtr; + // csr_matrix.indptr and csr_matrix.indices are always dtype==int32 +// #if defined(MEDCOUPLING_USE_64BIT_IDS) +// indptrPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indptr,NULL,NULL); +// indicesPtr = MEDCoupling_DataArrayInt64_New__SWIG_1(indices,NULL,NULL); +// #else + indptrPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indptr,NULL,NULL); + indicesPtr = MEDCoupling_DataArrayInt32_New__SWIG_1(indices,NULL,NULL); +//#endif MCAuto dataPtr(MEDCoupling_DataArrayDouble_New__SWIG_1(data,NULL,NULL)); convertCSR_MCDataToVectMapIntDouble(indptrPtr,indicesPtr,dataPtr,mCpp); Py_XDECREF(data); Py_XDECREF(indptr); Py_XDECREF(indices); @@ -113,7 +120,7 @@ namespace MEDCoupling void setCrudeMatrixEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target, PyObject *m) { - std::vector > mCpp; + std::vector > mCpp; convertToVectMapIntDouble(m,mCpp); self->setCrudeMatrixEx(src,target,mCpp); } diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py index e6aedde61..58054d519 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py @@ -806,8 +806,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): vals*=1e-5 eps0=DataArrayDouble(m0.data)-vals ; eps0.abs() self.assertTrue(eps0.findIdsInRange(1e-17,1e300).empty()) - self.assertTrue(DataArrayInt(m0.indices).isEqual(DataArrayInt([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27]))) - self.assertTrue(DataArrayInt(m0.indptr).isEqual(DataArrayInt([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312]))) + self.assertTrue(DataArrayInt32(m0.indices).isEqual(DataArrayInt32([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27]))) + self.assertTrue(DataArrayInt32(m0.indptr).isEqual(DataArrayInt32([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312]))) # rem2=MEDCouplingRemapper() ; rem2.setIntersectionType(Barycentric) rem2.prepare(b,a,"P0P1") @@ -839,7 +839,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): rem.setMinDotBtwPlane3DSurfIntersect(0.99)# this line is important it is to tell to remapper to select only cells with very close orientation rem.prepare(skinAndNonConformCells,skinAndNonConformCells,"P0P0") mat=rem.getCrudeCSRMatrix() - indptr=DataArrayInt(mat.indptr) + indptr=DataArrayInt32(mat.indptr) #not depend on MEDCouplingUse64BitIDs() indptr2=indptr.deltaShiftIndex() cellIdsOfNonConformCells=indptr2.findIdsNotEqual(1) cellIdsOfSkin=indptr2.findIdsEqual(1) diff --git a/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i b/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i index 16dc0a7b1..52c3fd5b2 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i +++ b/src/MEDCoupling_Swig/MEDCouplingTimeDiscretization.i @@ -104,8 +104,8 @@ namespace MEDCoupling virtual MEDCouplingTimeDiscretization *negate() const; virtual MEDCouplingTimeDiscretization *maxPerTuple() const; virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector& compoIds) const; - virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds); - virtual void changeNbOfComponents(int newNbOfComp, double dftValue); + virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector& compoIds); + virtual void changeNbOfComponents(std::size_t newNbOfComp, double dftValue); virtual void sortPerTuple(bool asc); virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value); virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value); diff --git a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i index 31de2db56..080def392 100644 --- a/src/MEDCoupling_Swig/MEDCouplingTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingTypemaps.i @@ -186,7 +186,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -258,7 +258,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -325,7 +325,7 @@ static MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -397,7 +397,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ MEDCoupling::DataArrayDouble *a; MEDCoupling::DataArrayDoubleTuple *aa; std::vector bb; - int sw; + mcIdType sw; convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb); switch(sw) { @@ -448,15 +448,15 @@ MEDCoupling::MEDCouplingFieldDouble *MEDCoupling_MEDCouplingFieldDouble___rdiv__ template typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCoupling::MEDCouplingFieldT *self, PyObject *li) { - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + mcIdType singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; const MEDCoupling::MEDCouplingMesh *mesh=self->getMesh(); if(!mesh) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : field lies on a null mesh !"); - int nbc=mesh->getNumberOfCells(); + mcIdType nbc=mesh->getNumberOfCells(); convertIntStarOrSliceLikePyObjToCpp(li,nbc,sw,singleVal,multiVal,slic,daIntTyypp); switch(sw) { @@ -474,7 +474,7 @@ typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCouplin { if(nbc+singleVal>0) { - int tmp=nbc+singleVal; + mcIdType tmp=nbc+singleVal; return self->buildSubPart(&tmp,&tmp+1); } else @@ -501,29 +501,29 @@ typename MEDCoupling::Traits::FieldType *fieldT_buildSubPart(const MEDCouplin return self->buildSubPart(daIntTyypp->begin(),daIntTyypp->end()); } default: - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayInt instance !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : unrecognized type in input ! Possibilities are : int, list or tuple of int DataArrayIdType instance !"); } } template typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling::MEDCouplingFieldT *self, PyObject *li) { - const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[dataArrayInt]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[dataArrayInt,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n"; + const char msg[]="MEDCouplingFieldDouble::__getitem__ : invalid call Available API are : \n-myField[DataArrayIdType]\n-myField[slice]\n-myField[pythonListOfCellIds]\n-myField[integer]\n-myField[DataArrayIdType,1]\n-myField[slice,1]\n-myField[pythonListOfCellIds,1]\n-myField[integer,1]\n"; if(PyTuple_Check(li)) { Py_ssize_t sz=PyTuple_Size(li); if(sz!=2) throw INTERP_KERNEL::Exception(msg); PyObject *elt0=PyTuple_GetItem(li,0),*elt1=PyTuple_GetItem(li,1); - int sw; - int singleVal; - std::vector multiVal; - std::pair > slic; - MEDCoupling::DataArrayInt *daIntTyypp=0; + mcIdType sw; + std::size_t singleVal; + std::vector multiVal; + std::pair > slic; + MEDCoupling::DataArrayIdType *daIntTyypp=0; if(!self->getArray()) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::__getitem__ : no array set on field to deduce number of components !"); try - { convertIntStarOrSliceLikePyObjToCpp(elt1,self->getArray()->getNumberOfComponents(),sw,singleVal,multiVal,slic,daIntTyypp); } + { convertIntStarOrSliceLikePyObjToCpp(elt1,ToIdType(self->getArray()->getNumberOfComponents()),sw,singleVal,multiVal,slic,daIntTyypp); } catch(INTERP_KERNEL::Exception& e) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::__getitem__ : invalid type in 2nd parameter (compo) !" << e.what(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } typename MEDCoupling::MCAuto< typename MEDCoupling::Traits::FieldType > ret0(fieldT_buildSubPart(self,elt0)); @@ -534,7 +534,7 @@ typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling: { case 1: { - std::vector v2(1,singleVal); + std::vector v2(1,singleVal); MEDCoupling::MCAuto< typename MEDCoupling::Traits::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); return ret0.retn(); @@ -547,9 +547,9 @@ typename MEDCoupling::Traits::FieldType *fieldT__getitem__(const MEDCoupling: } case 3: { - int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(slic.first,slic.second.first,slic.second.second,"MEDCouplingFieldDouble::__getitem__ : invalid range in 2nd parameter (components) !")); - std::vector v2(nbOfComp); - for(int i=0;i v2(nbOfComp); + for(mcIdType i=0;i::ArrayType > aarr(ret0Arr->keepSelectedComponents(v2)); ret0->setArray(aarr); @@ -567,7 +567,7 @@ template PyObject *field_getTinySerializationInformation(const FIELDT *self) { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; self->getTinySerializationDbleInformation(a0); self->getTinySerializationIntInformation(a1); @@ -576,10 +576,10 @@ PyObject *field_getTinySerializationInformation(const FIELDT *self) PyObject *ret(PyTuple_New(3)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1)); - int sz(a2.size()); + std::size_t sz(a2.size()); PyObject *ret2(PyList_New(sz)); { - for(int i=0;i PyObject *field_serialize(const typename MEDCoupling::Traits::FieldType *self) { - MEDCoupling::DataArrayInt *ret0(0); + MEDCoupling::DataArrayIdType *ret0(0); std::vector::ArrayType *> ret1; self->serialize(ret0,ret1); if(ret0) ret0->incrRef(); std::size_t sz(ret1.size()); PyObject *ret(PyTuple_New(2)); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyObject *ret1Py(PyList_New(sz)); for(std::size_t i=0;i::FieldType *self, PyObjec static const char MSG[]="MEDCouplingFieldDouble.__setstate__ : expected input is a tuple of size 3 !"; if(!PyTuple_Check(inp)) throw INTERP_KERNEL::Exception(MSG); - int sz(PyTuple_Size(inp)); + std::size_t sz(PyTuple_Size(inp)); if(sz!=3) throw INTERP_KERNEL::Exception(MSG); // mesh @@ -660,15 +660,15 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec PyObject *elt0(PyTuple_GetItem(inp,0)); PyObject *elt1(PyTuple_GetItem(inp,1)); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - MEDCoupling::DataArrayInt *b0(0); + MEDCoupling::DataArrayIdType *b0(0); std::vector::ArrayType *>b1; { if(!PyTuple_Check(elt0) && PyTuple_Size(elt0)!=3) throw INTERP_KERNEL::Exception(MSG); PyObject *a0py(PyTuple_GetItem(elt0,0)),*a1py(PyTuple_GetItem(elt0,1)),*a2py(PyTuple_GetItem(elt0,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -678,10 +678,10 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec throw INTERP_KERNEL::Exception(MSG); PyObject *b0py(PyTuple_GetItem(elt1,0)),*b1py(PyTuple_GetItem(elt1,1)); void *argp(0); - int status(SWIG_ConvertPtr(b0py,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0)); + int status(SWIG_ConvertPtr(b0py,&argp,SWIGTITraits::TI,0|0)); if(!SWIG_IsOK(status)) throw INTERP_KERNEL::Exception(MSG); - b0=reinterpret_cast(argp); + b0=reinterpret_cast(argp); convertFromPyObjVectorOfObj::ArrayType *>(b1py,SWIGTITraits::TI,MEDCoupling::Traits::ArrayTypeName,b1); } self->checkForUnserialization(a1,b0,b1); @@ -689,17 +689,17 @@ void field__setstate__(typename MEDCoupling::Traits::FieldType *self, PyObjec self->finishUnserialization(a1,a0,a2); } -PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function&,MEDCoupling::MCAuto&)> func) +PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCoupling::MEDCouplingMesh *self, std::function&,MEDCoupling::MCAuto&)> func) { - MEDCoupling::MCAuto elts,eltsIndex; + MEDCoupling::MCAuto elts,eltsIndex; int spaceDim=self->getSpaceDimension(); void *da=0; int res1=SWIG_ConvertPtr(p,&da,SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 ); if (!SWIG_IsOK(res1)) { - int size; + mcIdType size; INTERP_KERNEL::AutoCPtr tmp=convertPyToNewDblArr2(p,&size); - int nbOfPoints=size/spaceDim; + mcIdType nbOfPoints=size/spaceDim; if(size%spaceDim!=0) { throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid list length ! Must be a multiple of self.getSpaceDimension() !"); @@ -712,8 +712,8 @@ PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCo if(!da2) throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Not null DataArrayDouble instance expected !"); da2->checkAllocated(); - int size=da2->getNumberOfTuples(); - int nbOfCompo=da2->getNumberOfComponents(); + mcIdType size=da2->getNumberOfTuples(); + mcIdType nbOfCompo=ToIdType(da2->getNumberOfComponents()); if(nbOfCompo!=spaceDim) { throw INTERP_KERNEL::Exception("MEDCouplingMesh::getCellsContainingPoints : Invalid DataArrayDouble nb of components ! Expected same as self.getSpaceDimension() !"); @@ -721,8 +721,8 @@ PyObject *Mesh_getCellsContainingPointsLike(PyObject *p, double eps, const MEDCo func(da2->getConstPointer(),size,eps,elts,eltsIndex); } PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elts.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(eltsIndex.retn()),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py index 6ad489506..cdca7ec5f 100644 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py @@ -35,7 +35,7 @@ else: # NumPy is an optional pre-requisite! assert(MEDCoupling.MEDCouplingHasNumPyBindings()) a=numpy.arange(20,dtype=numpy.int32) -d=DataArrayInt(a) # d owns data of a -e=DataArrayInt(a) # a not owned -> e only an access to chunk of a +d=DataArrayInt32(a) # d owns data of a +e=DataArrayInt32(a) # a not owned -> e only an access to chunk of a a1=d.toNumPyArray() #! [UG_DataArrayNumpy_0] diff --git a/src/MEDCoupling_Swig/tests.set b/src/MEDCoupling_Swig/tests.set index 6fd1864ed..bebcc3a95 100644 --- a/src/MEDCoupling_Swig/tests.set +++ b/src/MEDCoupling_Swig/tests.set @@ -24,6 +24,7 @@ SET(BASE_TESTS MEDCouplingBasicsTest4.py MEDCouplingBasicsTest5.py MEDCouplingBasicsTest6.py + MEDCouplingBasicsTest7.py MEDCouplingIntersectTest.py MEDCouplingExamplesTest.py MEDCouplingRemapperTest.py diff --git a/src/MEDLoader/CMakeLists.txt b/src/MEDLoader/CMakeLists.txt index c5150e7d3..41cbe3ec7 100644 --- a/src/MEDLoader/CMakeLists.txt +++ b/src/MEDLoader/CMakeLists.txt @@ -20,6 +20,10 @@ ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${XDR_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + IF(MEDCOUPLING_ENABLE_PYTHON) ADD_SUBDIRECTORY(Swig) ENDIF(MEDCOUPLING_ENABLE_PYTHON) diff --git a/src/MEDLoader/MEDFileBasis.hxx b/src/MEDLoader/MEDFileBasis.hxx index 6d6c1e39f..22b772f00 100644 --- a/src/MEDLoader/MEDFileBasis.hxx +++ b/src/MEDLoader/MEDFileBasis.hxx @@ -22,10 +22,13 @@ #define __MEDFILEBASIS_HXX__ #include "InterpKernelException.hxx" +#include "MEDCouplingMemArray.hxx" #include #include +#include + namespace MEDCoupling { class MEDFileString @@ -60,4 +63,113 @@ namespace MEDCoupling }; } +namespace MEDCoupling +{ + + class DataArrayMedInt : public DataArrayDiscreteSigned< med_int > + { + friend class DataArrayDiscrete; + public: + template + static DataArrayMedInt *Copy( const INTARRAY* array ); + static DataArrayMedInt *New() { return new DataArrayMedInt(); } + DataArrayMedInt *deepCopy() const { return new DataArrayMedInt(*this); } + //DataArrayMedInt *buildNewEmptyInstance() const { return new DataArrayMedInt(); }//ko + DataArray *buildNewEmptyInstance() const { if ( sizeof(med_int)==sizeof(long)) return DataArrayInt64::New(); return DataArrayInt32::New(); } + public: + DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } + DataArray *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } + DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + DataArray *keepSelectedComponents(const std::vector& compoIds) const { return this->myKeepSelectedComponents(compoIds); } + DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return this->mySelectByTupleIdSafeSlice(bg,end2,step); } + DataArray *selectByTupleRanges(const std::vector >& ranges) const { return this->mySelectByTupleRanges(ranges); } + private: + ~DataArrayMedInt() { } + DataArrayMedInt() { } + }; + + template< class T1, class T2 > + MCAuto StaticCast( const MCAuto< T2 >& array ) + { + DataArray *src = const_cast< T2* >((const T2*) array ); + T1* tgt = static_cast( src ); + if ( tgt ) + tgt->incrRef(); + return tgt; + } + + template< class INTARRAY > + MCAuto ToMedIntArray(const MCAuto& intArray ) + { + if ( sizeof( med_int ) == sizeof( typename INTARRAY::Type )) + return StaticCast< DataArrayMedInt >( intArray ); + return DataArrayMedInt::Copy((const INTARRAY*) intArray ); + } + + template< class INT > + MCAuto ToMedIntArray(const typename MEDCoupling::Traits::ArrayType* intArray ) + { + if ( sizeof( med_int ) == sizeof( INT )) + { + typedef typename MEDCoupling::Traits::ArrayType INTARRAY; + MCAuto< INTARRAY > ia = const_cast< INTARRAY* >( intArray ); + ia->incrRef(); + return StaticCast< DataArrayMedInt >( ia ); + } + return DataArrayMedInt::Copy( intArray ); + } + + template< class INT > + MCAuto< typename MEDCoupling::Traits::ArrayType> FromMedIntArray(MCAuto& medIntArray ) + { + typedef typename MEDCoupling::Traits::ArrayType INTARRAY; + if ( sizeof( med_int ) == sizeof( INT )) + return StaticCast< INTARRAY >( medIntArray ); + + INTARRAY* intArray = INTARRAY::New(); + intArray->alloc( medIntArray->getNumberOfTuples(), medIntArray->getNumberOfComponents() ); + intArray->copyStringInfoFrom( * medIntArray.operator->() ); + std::copy( medIntArray->begin(), medIntArray->end(), intArray->getPointer() ); + return intArray; + } + + template< class INT > + MCAuto ToMedIntArray(const std::vector& intVec ) + { + DataArrayMedInt* medIntArray = DataArrayMedInt::New(); + if ( sizeof( med_int ) == sizeof( INT )) + { + medIntArray->useArray( reinterpret_cast(intVec.data()), /*owner=*/false, DeallocType::CPP_DEALLOC, intVec.size(), /*nbComp=*/1 ); + } + else + { + medIntArray->alloc( intVec.size(), 1 ); + std::copy( intVec.begin(), intVec.end(), medIntArray->getPointer() ); + } + return medIntArray; + } + + template< class INT > + med_int ToMedInt( INT i ) + { + return static_cast< med_int >( i ); + } + + template< class INT > + INT FromMedInt( med_int mi ) + { + return static_cast< INT >( mi ); + } + + template + DataArrayMedInt * DataArrayMedInt::Copy( const INTARRAY* intArray ) + { + DataArrayMedInt* medIntArray = DataArrayMedInt::New(); + medIntArray->alloc( intArray->getNumberOfTuples(), intArray->getNumberOfComponents() ); + medIntArray->copyStringInfoFrom( *intArray ); + std::copy( intArray->begin(), intArray->end(), medIntArray->getPointer() ); + return medIntArray; + } +} + #endif diff --git a/src/MEDLoader/MEDFileBlowStrEltUp.cxx b/src/MEDLoader/MEDFileBlowStrEltUp.cxx index 91eb35f74..2ca90a99a 100644 --- a/src/MEDLoader/MEDFileBlowStrEltUp.cxx +++ b/src/MEDLoader/MEDFileBlowStrEltUp.cxx @@ -95,36 +95,35 @@ MCAuto MEDFileBlowStrEltUp::dealWithMEDBALLInMesh(const M const DataArrayDouble *coo(mesh->getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null coords !"); - MCAuto conn(zeStr->getConn()); + MCAuto conn(zeStr->getConn()); if(conn.isNull()) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null connectivity !"); conn->checkAllocated(); if(conn->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : excepted to be single compo !"); - int nbCells(conn->getNumberOfTuples()); MCAuto connOut(coo->selectByTupleIdSafe(conn->begin(),conn->end())); MCAuto mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut)); mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR)); mOut->setMeshAtLevel(0,mcOut); - const DataArrayInt *ff1(mesh->getFamilyFieldAtLevel(1)); + const DataArrayIdType *ff1(mesh->getFamilyFieldAtLevel(1)); if(ff1) { - MCAuto ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end())); + MCAuto ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end())); mOut->setFamilyFieldArr(1,ff1o); } - const DataArrayInt *nf1(mesh->getNumberFieldAtLevel(1)); + const DataArrayIdType *nf1(mesh->getNumberFieldAtLevel(1)); if(nf1) { - MCAuto nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end())); + MCAuto nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end())); mOut->setRenumFieldArr(1,nf1o); } MCAuto md(zeStr->getMeshDef()); - const DataArrayInt *ff0(md->getFam()); + const DataArrayIdType *ff0(md->getFam()); if(ff0) - mOut->setFamilyFieldArr(0,const_cast(ff0)); - const DataArrayInt *nf0(md->getNum()); + mOut->setFamilyFieldArr(0,const_cast(ff0)); + const DataArrayIdType *nf0(md->getNum()); if(nf0) - mOut->setRenumFieldArr(0,const_cast(nf0)); + mOut->setRenumFieldArr(0,const_cast(nf0)); mOut->copyFamGrpMapsFrom(*mesh); const std::vector< MCAuto >& vars(zeStr->getVars()); for(std::vector< MCAuto >::const_iterator it=vars.begin();it!=vars.end();it++) @@ -223,7 +222,7 @@ void MEDFileBlowStrEltUp::dealWithMEDBALLSInFields(const MEDFileFields *fs, cons std::vector pfls(zeGuideForPfl->getPflsReallyUsed()); if(pfls.size()>=2) throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : drink less coffee"); - MCAuto pflMyLove; + MCAuto pflMyLove; if(pfls.size()==1) pflMyLove.takeRef(zeGuideForPfl->getProfile(pfls[0])); // Yeah we have pfls @@ -386,7 +385,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 conn(zeStr->getConn()); + MCAuto conn(zeStr->getConn()); conn=conn->deepCopy(); conn->rearrange(1); MCAuto geoMesh; { @@ -398,7 +397,7 @@ MCAuto LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellT // if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true); } // @@ -418,7 +417,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali MCConstAuto angleVrille; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } else @@ -426,12 +425,12 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali // MCAuto dir(geoMesh->buildDirectionVectorField()); MCAuto rot(dir->getArray()->fromCartToSpher()); - int nbCompo(ptsForLoc->getNumberOfComponents()); + std::size_t nbCompo(ptsForLoc->getNumberOfComponents()); MCAuto secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.)); - int nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); { const int TAB[3]={2,0,1}; - std::vector 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.}; @@ -449,7 +448,7 @@ MCAuto LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::Normali for(int l=0;l p2(p->deepCopy()); - for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); arrs[j*nbg+l]=p2; } @@ -463,11 +462,11 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize { MCAuto ptsForLoc; MCAuto geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); - int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); MCConstAuto zeThickness; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); zeThickness=thickness->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } else @@ -477,11 +476,11 @@ MCAuto LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::Normalize MCAuto ortho(geoMesh->buildOrthogonalField()); orthoArr.takeRef(ortho->getArray()); } - int nbCompo(orthoArr->getNumberOfComponents()); + mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents())); MCAuto secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo)); secPts->rearrange(nbCompo); std::vector< MCAuto > arrs(nbCells*nbg); - for(int j=0;jgetIJ(j,0)),eccentricity(zeThickness->getIJ(j,1)); MCAuto fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo); @@ -509,11 +508,11 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, static const char MSG1[]="BuildMeshPipeSEG3 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !"; MCAuto ptsForLoc; MCAuto geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG3,pfl,loc,zeStr,mesh,section,globs,ptsForLoc)); - int nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(loc.getGaussWeights().size()); + mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size())); MCConstAuto zeAngle,zeScale; if(!pfl.empty()) { - const DataArrayInt *pflArr(globs->getProfile(pfl)); + const DataArrayIdType *pflArr(globs->getProfile(pfl)); zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end()); } @@ -531,17 +530,17 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, dir=geoMesh2->buildDirectionVectorField(); } MCAuto rot(dir->getArray()->fromCartToSpher()); - int 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 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.}; double AX1[3]; AX1[2]=0.; std::vector< MCAuto > arrs(nbCells*nbg); - for(int j=0;j p(secPts->deepCopy()); @@ -566,7 +565,7 @@ MCAuto LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, MCAuto p3(p->deepCopy()); DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer()); MCAuto p2(p3->deepCopy()); - for(int k=0;kapplyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k); arrs[j*nbg+l]=p2; } @@ -648,11 +647,11 @@ MCAuto LocInfo::generateNonClassicalData(int zePos, const MEDFileU if(um->getNumberOfCells()!=1) throw INTERP_KERNEL::Exception(MSG1); gt=um->getTypeOfCell(0); - std::vector v; + std::vector v; um->getNodeIdsOfCell(0,v); std::size_t sz2(v.size()); for(std::size_t j=0;j >& strs(mesh->getAccessOfUndergroundEltStrs()); diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index 8c3c17173..28e075017 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -203,16 +203,16 @@ bool MEDFileData::unPolyzeMeshes() if(!ms) return false; std::vector< MEDFileMesh * > meshesImpacted; - std::vector< DataArrayInt * > renumParamsOfMeshImpacted;//same size as meshesImpacted - std::vector< std::vector > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted - std::vector > memSaverIfThrow;//same size as meshesImpacted + std::vector< DataArrayIdType * > renumParamsOfMeshImpacted;//same size as meshesImpacted + std::vector< std::vector > oldCodeOfMeshImpacted,newCodeOfMeshImpacted;//same size as meshesImpacted + std::vector > memSaverIfThrow;//same size as meshesImpacted for(int i=0;igetNumberOfMeshes();i++) { MEDFileMesh *m=ms->getMeshAtPos(i); if(m) { - std::vector oldCode,newCode; - DataArrayInt *o2nRenumCell=0; + std::vector oldCode,newCode; + DataArrayIdType *o2nRenumCell=0; bool modif=m->unPolyze(oldCode,newCode,o2nRenumCell); if(!modif) continue; @@ -252,7 +252,7 @@ MCAuto MEDFileData::Aggregate(const std::vector ret(MEDFileData::New()); std::vector ms(sz); - std::vector< std::vector< std::pair > > dts(sz); + std::vector< std::vector< std::pair > > dts(sz); for(std::vector::const_iterator it=mfds.begin();it!=mfds.end();it++,i++) { const MEDFileData *elt(*it); diff --git a/src/MEDLoader/MEDFileEquivalence.cxx b/src/MEDLoader/MEDFileEquivalence.cxx index 10fe80b86..bbc44b6df 100644 --- a/src/MEDLoader/MEDFileEquivalence.cxx +++ b/src/MEDLoader/MEDFileEquivalence.cxx @@ -21,6 +21,7 @@ #include "MEDFileEquivalence.hxx" #include "MEDFileSafeCaller.txx" #include "MEDCouplingMemArray.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDLoaderBase.hxx" #include "MEDFileMesh.hxx" #include "InterpKernelAutoPtr.hxx" @@ -206,12 +207,12 @@ void MEDFileEquivalencePair::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),_name.c_str(),dt,it,MED_NODE,MED_NONE,&ncor)); if(ncor>0) { - MCAuto da(DataArrayInt::New()); + MCAuto da(DataArrayMedInt::New()); da->alloc(ncor*2); 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 node(new MEDFileEquivalenceNode(this,da)); + MCAuto node(new MEDFileEquivalenceNode(this,FromMedIntArray(da))); _node=node; } _cell=MEDFileEquivalenceCell::Load(fid,this); @@ -280,7 +281,7 @@ MEDFileEquivalencePair *MEDFileEquivalences::getEquivalenceWithName(const std::s int MEDFileEquivalences::size() const { - return _equ.size(); + return (int)_equ.size(); } std::vector MEDFileEquivalences::getEquivalenceNames() const @@ -405,7 +406,7 @@ void MEDFileEquivalences::writeLL(med_idt fid) const int MEDFileEquivalences::PresenceOfEquivalences(med_idt fid, const std::string& meshName) { med_int nequ(MEDnEquivalence(fid,meshName.c_str())); - return nequ; + return FromMedInt(nequ); } MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileMesh *owner) @@ -418,7 +419,7 @@ MEDFileEquivalences *MEDFileEquivalences::Load(med_idt fid, int nbOfEq, MEDFileM { INTERP_KERNEL::AutoPtr equ(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr desc(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); - int nstep,nocstpncor; + med_int nstep,nocstpncor; MEDFILESAFECALLERRD0(MEDequivalenceInfo,(fid,meshName.c_str(),i+1,equ,desc,&nstep,&nocstpncor)); std::string eqName(MEDLoaderBase::buildStringFromFortran(equ,MED_NAME_SIZE)),eqDescName(MEDLoaderBase::buildStringFromFortran(desc,MED_COMMENT_SIZE)); MCAuto eqv(MEDFileEquivalencePair::Load(ret,fid,eqName,eqDescName)); @@ -510,8 +511,8 @@ void MEDFileEquivalenceData::writeAdvanced(med_idt fid, med_entity_type medtype, INTERP_KERNEL::AutoPtr name(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); MEDLoaderBase::safeStrCpy(meshName.c_str(),MED_NAME_SIZE,meshName2,getFather()->getMesh()->getTooLongStrPolicy()); MEDLoaderBase::safeStrCpy(equName.c_str(),MED_NAME_SIZE,name,getFather()->getMesh()->getTooLongStrPolicy()); - MCAuto da2(da->deepCopy()); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); - MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,da2->getNumberOfTuples(),da2->begin())); + MCAuto da2(DataArrayMedInt::Copy(da)); da2->rearrange(1); da2->applyLin(1,1); da2->rearrange(2); + MEDFILESAFECALLERWR0(MEDequivalenceCorrespondenceWr,(fid,meshName2,name,dt,it,medtype,medgt,ToMedInt(da2->getNumberOfTuples()),da2->begin())); } std::size_t MEDFileEquivalenceCellType::getHeapMemorySizeWithoutChildren() const @@ -661,7 +662,7 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) return ; MEDFileEquivalences::CheckDataArray(da); MEDFileMesh *mm(getMesh()); - int totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); + mcIdType totalNbOfCells(mm->getNumberOfCellsAtLevel(meshDimRelToMax)); // MCAuto tmp(da->deepCopy()); tmp->rearrange(1); int maxv,minv; @@ -674,12 +675,12 @@ void MEDFileEquivalenceCell::setArray(int meshDimRelToMax, DataArrayInt *da) // std::vector gts(mm->getGeoTypesAtLevel(meshDimRelToMax)); int startId(0),endId; - std::vector compS(1,0); + std::vector compS(1,0); for(std::vector::const_iterator it=gts.begin();it!=gts.end();it++) { - endId=startId+mm->getNumberOfCellsWithType(*it); + endId=startId+(int)mm->getNumberOfCellsWithType(*it); MCAuto da0(da->keepSelectedComponents(compS)); - MCAuto ids(da0->findIdsInRange(startId,endId)); + MCAuto ids(da0->findIdsInRange(startId,endId)); MCAuto da1(da->selectByTupleIdSafe(ids->begin(),ids->end())); da1->applyLin(1,-startId); setArrayForType(*it,da1); @@ -725,12 +726,12 @@ void MEDFileEquivalenceCell::load(med_idt fid) MEDFILESAFECALLERRD0(MEDequivalenceCorrespondenceSize,(fid,meshName.c_str(),name.c_str(),dt,it,MED_CELL,typmai[i],&ncor)); if(ncor>0) { - MCAuto da(DataArrayInt::New()); + MCAuto da(DataArrayMedInt::New()); da->alloc(ncor*2); 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 ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],da)); + MCAuto ct(new MEDFileEquivalenceCellType(getFather(),typmai2[i],FromMedIntArray(da))); _types.push_back(ct); } } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index e18ca59cb..61bceea4a 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -169,7 +169,7 @@ std::vector< std::pair > MEDFileFields::getCommonIterations(bool& areTh int MEDFileFields::getNumberOfFields() const { - return _fields.size(); + return (int)_fields.size(); } std::vector MEDFileFields::getFieldsNames() const @@ -256,7 +256,7 @@ MEDFileFields::MEDFileFields() MEDFileFields::MEDFileFields(med_idt fid, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities) try:MEDFileFieldGlobsReal(fid) { - int nbFields(MEDnField(fid)); + med_int nbFields(MEDnField(fid)); _fields.resize(nbFields); med_field_type typcha; for(int i=0;i b(_fields.size(),true); int k=bg; for(int i=0;i& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N) +bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N) { bool ret(false); for(std::vector< MCAuto >::iterator it=_fields.begin();it!=_fields.end();it++) @@ -576,7 +576,7 @@ bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, con * * \return A new object that the caller is responsible to deallocate. */ -MEDFileFields *MEDFileFields::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const +MEDFileFields *MEDFileFields::extractPart(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileFields::extractPart : input mesh is NULL !"); @@ -611,15 +611,15 @@ class PFLData { public: PFLData():_add_pts_in_pfl(0) { } - PFLData(const MCAuto& mat, const MCAuto& pfl, int nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { } + PFLData(const MCAuto& mat, const MCAuto& pfl, mcIdType nbOfNewPts):_matrix(mat),_pfl(pfl),_add_pts_in_pfl(nbOfNewPts) { } std::string getPflName() const { if(_pfl.isNull()) { return std::string(); } else { return _pfl->getName(); } } - int getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; } - MCAuto getProfile() const { return _pfl; } - MCAuto getMatrix() const { return _matrix; } + mcIdType getNbOfAddPtsInPfl() const { return _add_pts_in_pfl; } + MCAuto getProfile() const { return _pfl; } + MCAuto getMatrix() const { return _matrix; } private: - MCAuto _matrix; - MCAuto _pfl; - int _add_pts_in_pfl; + MCAuto _matrix; + MCAuto _pfl; + mcIdType _add_pts_in_pfl; }; class MEDFileFieldLin2QuadVisitor : public MEDFileFieldVisitor @@ -640,7 +640,7 @@ public: // void newPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd); private: - void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes); + void updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes); private: const MEDFileUMesh *_lin; const MEDFileUMesh *_quad; @@ -674,48 +674,48 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer updateData(pmtdToModify,(*itCache).second.getNbOfAddPtsInPfl()); return ; } - MCAuto pfl; + MCAuto pfl; if(pflName.empty()) - pfl=DataArrayInt::Range(0,pmptpd->getNumberOfVals(),1); + pfl=DataArrayIdType::Range(0,pmptpd->getNumberOfVals(),1); else pfl=_lin_globs->getProfile(pflName)->deepCopy(); // MCAuto mesh3D(_lin->getMeshAtLevel(0)),mesh3DQuadratic(_quad->getMeshAtLevel(0)); - MCAuto cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true)); + MCAuto cellIds(mesh3D->getCellIdsLyingOnNodes(pfl->begin(),pfl->end(),true)); MCAuto mesh3DQuadraticRestricted(mesh3DQuadratic->buildPartOfMySelf(cellIds->begin(),cellIds->end(),true)); - MCAuto mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds()); + MCAuto mesh3DQuadraticRestrictedNodeIds(mesh3DQuadraticRestricted->computeFetchedNodeIds()); mesh3DQuadraticRestrictedNodeIds->checkMonotonic(true); - MCAuto newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl)); + MCAuto newPtsIds(mesh3DQuadraticRestrictedNodeIds->buildSubstraction(pfl)); MCAuto allSeg3; { - MCAuto a,b,c,d; + MCAuto a,b,c,d; MCAuto seg3Tmp(mesh3DQuadraticRestricted->explodeIntoEdges(a,b,c,d)); allSeg3=MEDCoupling1SGTUMesh::New(seg3Tmp); } if(allSeg3->getCellModelEnum()!=INTERP_KERNEL::NORM_SEG3) throw INTERP_KERNEL::Exception("MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc : invalid situation where SEG3 expected !"); - MCAuto midPts,cellSeg3Ids,matrix; + MCAuto midPts,cellSeg3Ids,matrix; { - DataArrayInt *nodeConn(allSeg3->getNodalConnectivity()); + DataArrayIdType *nodeConn(allSeg3->getNodalConnectivity()); nodeConn->rearrange(3); { - std::vector v(1,2); + std::vector v(1,2); midPts=nodeConn->keepSelectedComponents(v); } - cellSeg3Ids=DataArrayInt::FindPermutationFromFirstToSecond(midPts,newPtsIds); + cellSeg3Ids=DataArrayIdType::FindPermutationFromFirstToSecond(midPts,newPtsIds); { - std::vector v(2); v[0]=0; v[1]=1; - MCAuto tmp(nodeConn->keepSelectedComponents(v)); + std::vector v(2); v[0]=0; v[1]=1; + MCAuto tmp(nodeConn->keepSelectedComponents(v)); matrix=tmp->selectByTupleId(cellSeg3Ids->begin(),cellSeg3Ids->end()); } nodeConn->rearrange(1); } - MCAuto pflq; + MCAuto pflq; if(!pflName.empty()) { - std::vector vs(2); + std::vector vs(2); vs[0]=pfl; vs[1]=newPtsIds; - pflq=DataArrayInt::Aggregate(vs); + pflq=DataArrayIdType::Aggregate(vs); pflq->setName(pflName); } PFLData pdata(matrix,pflq,newPtsIds->getNumberOfTuples()); @@ -723,7 +723,7 @@ void MEDFileFieldLin2QuadVisitor::newPerMeshPerTypePerDisc(const MEDFileFieldPer updateData(pmtdToModify,pdata.getNbOfAddPtsInPfl()); } -void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, int deltaNbNodes) +void MEDFileFieldLin2QuadVisitor::updateData(MEDFileFieldPerMeshPerTypePerDisc *pmtd, mcIdType deltaNbNodes) { pmtd->incrementNbOfVals(deltaNbNodes); } @@ -766,7 +766,7 @@ void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSW return ; if(_1ts_update_requested) { - MCAuto matrix,oldPfl; + MCAuto matrix,oldPfl; 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 it2(_cache.find(*it)); @@ -786,9 +786,9 @@ void MEDFileFieldLin2QuadVisitor::endTimeStepEntry(const MEDFileAnyTypeField1TSW DataArrayDouble *arr(_cur_f1ts->getUndergroundDataArray()); MCAuto res; { - std::vector v(1,0),v2(1,1); - MCAuto pts0(matrix->keepSelectedComponents(v)); - MCAuto pts1(matrix->keepSelectedComponents(v2)); + std::vector v(1,0),v2(1,1); + MCAuto pts0(matrix->keepSelectedComponents(v)); + MCAuto pts1(matrix->keepSelectedComponents(v2)); if(oldPfl.isNotNull()) { pts0=oldPfl->findIdForEach(pts0->begin(),pts0->end()); @@ -1110,7 +1110,7 @@ int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const { std::string tmp(fieldName); std::vector poss; - for(std::size_t i=0;i<_fields.size();i++) + for(unsigned int i=0;i<_fields.size();i++) { const MEDFileAnyTypeFieldMultiTSWithoutSDA *f(_fields[i]); if(f) diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index f79c2a870..7897ccc81 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -121,11 +121,11 @@ namespace MEDCoupling MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds); MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step); MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; MEDLOADER_EXPORT MCAuto linearToQuadratic(const MEDFileMeshes *oldLin, const MEDFileMeshes *newQuad) const; public: - MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; + MEDLOADER_EXPORT MEDFileFields *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const; public: MEDLOADER_EXPORT std::vector getPflsReallyUsed() const; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; diff --git a/src/MEDLoader/MEDFileField.txx b/src/MEDLoader/MEDFileField.txx index d08370c77..c78b010f9 100644 --- a/src/MEDLoader/MEDFileField.txx +++ b/src/MEDLoader/MEDFileField.txx @@ -127,7 +127,7 @@ namespace MEDCoupling * \sa getUndergroundDataArrayTemplate() */ template - typename Traits::ArrayType *MEDFileField1TSTemplateWithoutSDA::getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileField1TSTemplateWithoutSDA::getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const { if(this->_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -151,7 +151,7 @@ namespace MEDCoupling } template - void MEDFileField1TSTemplateWithoutSDA::aggregate(const std::vector::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) + void MEDFileField1TSTemplateWithoutSDA::aggregate(const std::vector::F1TSWSDAType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) { if(f1tss.empty()) throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : empty vector !"); @@ -174,15 +174,15 @@ namespace MEDCoupling setName(refPt->getName()); const DataArray *arr(refPt->getUndergroundDataArray()); - int nbCompo(arr->getNumberOfComponents()); + std::size_t nbCompo(arr->getNumberOfComponents()); for(typename std::vector::F1TSWSDAType const *>::const_iterator it=f1tss.begin();it!=f1tss.end();it++) { const typename Traits::ArrayType *myArr((*it)->getUndergroundDataArrayTemplate()); if(myArr->getNumberOfComponents()!=nbCompo) throw INTERP_KERNEL::Exception("MEDFileField1TSTemplateWithoutSDA::aggregate : arrays must have same number of components !"); } - std::vector > > extractInfo; - int start(0); + std::vector > > extractInfo; + mcIdType start(0); MCAuto fpm(MEDFileFieldPerMesh::Aggregate(start,pms,dts,this,extractInfo)); _field_per_mesh.push_back(fpm); int iteration,order; @@ -191,7 +191,7 @@ namespace MEDCoupling _arr=Traits::ArrayType::New(); _arr->alloc(start,nbCompo); _arr->copyStringInfoFrom(*arr); start=0; - for(std::vector > >::const_iterator it=extractInfo.begin();it!=extractInfo.end();it++) + 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); @@ -401,7 +401,7 @@ namespace MEDCoupling * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ template - typename Traits::ArrayType *MEDFileTemplateField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const + typename Traits::ArrayType *MEDFileTemplateField1TS::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const { MCAuto arr(contentNotNull()->getFieldWithProfile(type,meshDimRelToMax,mesh,pfl,this,*contentNotNull())); return ReturnSafelyTypedDataArray(arr); @@ -420,7 +420,7 @@ namespace MEDCoupling } template - typename Traits::ArrayType *MEDFileTemplateField1TS::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileTemplateField1TS::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return contentNotNull()->getUndergroundDataArrayTemplateExt(entries); } @@ -685,7 +685,7 @@ namespace MEDCoupling * \sa setFieldNoProfileSBT, setFieldProfileFlatly */ template - void MEDFileTemplateField1TS::setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateField1TS::setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); } @@ -695,13 +695,13 @@ namespace MEDCoupling * \sa setFieldProfile */ template - void MEDFileTemplateField1TS::setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateField1TS::setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { setFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); } template - void MEDFileTemplateField1TS::setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) + void MEDFileTemplateField1TS::setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller) { setFileName(""); MCAuto ft(MEDCouplingFieldTemplate::NewWithoutCheck(*field)); @@ -716,7 +716,7 @@ namespace MEDCoupling * \sa MEDFileUMesh::deduceNodeSubPartFromCellSubPart , MEDFileUMesh::extractPart */ template - typename MLFieldTraits::F1TSType *MEDFileTemplateField1TS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const + typename MLFieldTraits::F1TSType *MEDFileTemplateField1TS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileField1TS::extractPart : input mesh is NULL !"); @@ -730,10 +730,10 @@ namespace MEDCoupling getNonEmptyLevels(mm->getName(),levs); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { - std::map >::const_iterator it2(extractDef.find(*lev)); + std::map >::const_iterator it2(extractDef.find(*lev)); if(it2!=extractDef.end()) { - MCAuto t((*it2).second); + 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)); @@ -744,10 +744,10 @@ namespace MEDCoupling } else { - std::map >::const_iterator 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); + 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_NODES,0,mm)); @@ -888,7 +888,7 @@ namespace MEDCoupling * \return A new object that the caller is responsible to deallocate. */ template - typename MLFieldTraits::FMTSType *MEDFileTemplateFieldMultiTS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const + typename MLFieldTraits::FMTSType *MEDFileTemplateFieldMultiTS::extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const { if(!mm) throw INTERP_KERNEL::Exception("MEDFileTemplateFieldMultiTS::extractPart : mesh is null !"); @@ -1175,7 +1175,7 @@ namespace MEDCoupling * \param [in] order - the iteration order number of required time step. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. * \param [in] mesh - the supporting mesh. - * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the * field of interest lies on. If the field lies on all entities of the given * dimension, all ids in \a pfl are zero. The caller is to delete this array * using decrRef() as it is no more needed. @@ -1187,7 +1187,7 @@ namespace MEDCoupling * \throw If no field values of the required parameters are available. */ template - typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const + typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); const typename MLFieldTraits::F1TSWSDAType *myF1TSC(dynamic_cast::F1TSWSDAType *>(&myF1TS)); @@ -1241,7 +1241,7 @@ namespace MEDCoupling * \sa setFieldNoProfileSBT, appendFieldProfileFlatly */ template - void MEDFileTemplateFieldMultiTS::appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateFieldMultiTS::appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,true); } @@ -1250,13 +1250,13 @@ namespace MEDCoupling * same as appendFieldProfile except that here profile is created unconditionaly */ template - void MEDFileTemplateFieldMultiTS::appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) + void MEDFileTemplateFieldMultiTS::appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile) { appendFieldProfileGeneral(field,mesh,meshDimRelToMax,profile,false); } template - void MEDFileTemplateFieldMultiTS::appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller) + void MEDFileTemplateFieldMultiTS::appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller) { const typename Traits::ArrayType *arr(NULL); if(field) @@ -1332,7 +1332,7 @@ namespace MEDCoupling } template - typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const + typename Traits::ArrayType *MEDFileTemplateFieldMultiTS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const { DataArray *ret(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries)); if(!ret) diff --git a/src/MEDLoader/MEDFileField1TS.cxx b/src/MEDLoader/MEDFileField1TS.cxx index 36f517561..dc51ad550 100644 --- a/src/MEDLoader/MEDFileField1TS.cxx +++ b/src/MEDLoader/MEDFileField1TS.cxx @@ -135,12 +135,12 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi const DataArray *arr(getUndergroundDataArray()); if(!arr) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::splitComponents : no array defined !"); - int nbOfCompo=arr->getNumberOfComponents(); + std::size_t nbOfCompo=arr->getNumberOfComponents(); std::vector< MCAuto > ret(nbOfCompo); - for(int i=0;i v(1,i); + std::vector v(1,i); MCAuto arr2=arr->keepSelectedComponents(v); ret[i]->setArray(arr2); } @@ -368,7 +368,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 !"); @@ -450,7 +450,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::convertMedBallIntoClassic() (*it)->convertMedBallIntoClassic(); } -void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl) +void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl) { if(!pfl) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : null pfl !"); @@ -468,9 +468,9 @@ void MEDFileAnyTypeField1TSWithoutSDA::makeReduction(INTERP_KERNEL::NormalizedCe MEDFileFieldPerMeshPerTypePerDisc *disc(fpm->getLeafGivenTypeAndLocId(ct,0)); if(disc->getType()!=tof) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : error !"); - int s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples()); + mcIdType s(disc->getStart()),e(disc->getEnd()),nt(pfl->getNumberOfTuples()); DataArray *arr(getUndergroundDataArray()); - int nt2(arr->getNumberOfTuples()),delta((e-s)-nt); + mcIdType nt2(arr->getNumberOfTuples()),delta((e-s)-nt); if(delta<0) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::makeReduction : internal error !"); MCAuto arr0(arr->selectByTupleIdSafeSlice(0,s,1)),arr1(arr->selectByTupleIdSafeSlice(s,e,1)),arr2(arr->selectByTupleIdSafeSlice(e,nt2,1)); @@ -551,13 +551,13 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe if((*it)->getMeshName()==tmp) return i; } - int 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 sz; + return (int)sz; } -bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -581,7 +581,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > 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(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++) @@ -590,9 +590,9 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::set::const_iterator it3(allEnt.begin()); for(std::size_t i=0;i > its; + std::vector< std::pair > its; ret[i]=shallowCpy(); - int newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); + mcIdType newLgth(ret[i]->keepOnlySpatialDiscretization(*it3,its)); ret[i]->updateData(newLgth,its); } return ret; @@ -609,7 +609,7 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector types; std::vector< std::vector > typesF; std::vector< std::vector > pfls,locs; - std::vector< std::vector > > 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++) @@ -631,31 +631,31 @@ std::vector< MCAuto > MEDFileAnyTypeField1TSWi std::vector< MCAuto > ret(nbOfMDPGT); for(std::size_t i=0;i > its; + std::vector< std::pair > its; ret[i]=shallowCpy(); - int newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); + mcIdType newLgth(ret[i]->keepOnlyGaussDiscretization(i,its)); ret[i]->updateData(newLgth,its); } return ret; } -int MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its) { - int globalCounter(0); + mcIdType globalCounter(0); for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlySpatialDiscretization(tof,globalCounter,its); return globalCounter; } -int MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its) { - int globalCounter(0); + mcIdType globalCounter(0); for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++) (*it)->keepOnlyGaussDiscretization(idOfDisc,globalCounter,its); return globalCounter; } -void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector< std::pair >& oldStartStops) +void MEDFileAnyTypeField1TSWithoutSDA::updateData(mcIdType newLgth, const std::vector< std::pair >& oldStartStops) { if(_nb_of_tuples_to_be_allocated>=0) { @@ -681,8 +681,8 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector newArr->alloc(newLgth,getNumberOfComponents()); if(oldArr) newArr->copyStringInfoFrom(*oldArr); - int pos=0; - for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) + mcIdType pos=0; + for(std::vector< std::pair >::const_iterator it=oldStartStops.begin();it!=oldStartStops.end();it++) { if((*it).second<(*it).first) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : the range in the leaves was invalid !"); @@ -762,7 +762,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_id mm=ms->getMeshWithName(getMeshName()); } // - _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,meshnumdt,meshnumit,nasc,mm,entities); + _field_per_mesh[0]=MEDFileFieldPerMesh::NewOnRead(fid,this,0,FromMedInt(meshnumdt),FromMedInt(meshnumit),nasc,mm,entities); _nb_of_tuples_to_be_allocated=0; _field_per_mesh[0]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc); } @@ -832,14 +832,14 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th const MEDCouplingMesh *mesh(field->getMesh()); // TypeOfField type(field->getTypeOfField()); - std::vector dummy; + std::vector dummy; if(mesh) setMeshName(mesh->getName()); - int start(copyTinyInfoFrom(th,field,arr)); + mcIdType start(copyTinyInfoFrom(th,field,arr)); int pos(addNewEntryIfNecessary(mesh)); if(type!=ON_NODES) { - std::vector code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); + std::vector code=MEDFileField1TSWithoutSDA::CheckSBTMesh(mesh); _field_per_mesh[pos]->assignFieldNoProfileNoRenum(start,code,field,arr,glob,nasc); } else @@ -871,52 +871,52 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldNoProfileSBT(const TimeHolder *th * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. * \sa setFieldNoProfileSBT() */ -void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller) +void MEDFileAnyTypeField1TSWithoutSDA::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) { if(!field) 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 type=field->getTypeOfField(); - std::vector idsInPflPerType; - std::vector idsPerType; - std::vector code,code2; + std::vector idsInPflPerType; + std::vector idsPerType; + std::vector code,code2; MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); if(type!=ON_NODES) { m->splitProfilePerType(profile,code,idsInPflPerType,idsPerType,smartPflKiller); - std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); - std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); - std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); + std::vector< MCAuto > idsInPflPerType2(idsInPflPerType.size()); std::copy(idsInPflPerType.begin(),idsInPflPerType.end(),idsInPflPerType2.begin()); + std::vector< MCAuto > idsPerType2(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType2.begin()); + std::vector idsPerType3(idsPerType.size()); std::copy(idsPerType.begin(),idsPerType.end(),idsPerType3.begin()); // start of check MCAuto field2=field->clone(false); - int 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() << " !"; throw INTERP_KERNEL::Exception(oss.str()); } // end of check - int start(copyTinyInfoFrom(th,field,arrOfVals)); + mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); code2=m->getDistributionOfTypes(); // - int pos=addNewEntryIfNecessary(m); + mcIdType pos=addNewEntryIfNecessary(m); _field_per_mesh[pos]->assignFieldProfile(start,profile,code,code2,idsInPflPerType,idsPerType,field,arrOfVals,m,glob,nasc); } else { if(!profile || !profile->isAllocated() || profile->getNumberOfComponents()!=1) 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; - int nbOfTuplesExp=field->getNumberOfTuplesExpectedRegardingCode(v,idsPerType3); + std::vector v(3); v[0]=-1; v[1]=profile->getNumberOfTuples(); v[2]=0; + std::vector idsPerType3(1); idsPerType3[0]=profile; + 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()); } - int start(copyTinyInfoFrom(th,field,arrOfVals)); - int pos(addNewEntryIfNecessary(m)); + mcIdType start(copyTinyInfoFrom(th,field,arrOfVals)); + mcIdType pos(addNewEntryIfNecessary(m)); _field_per_mesh[pos]->assignNodeFieldProfile(start,profile,field,arrOfVals,glob,nasc); } } @@ -924,7 +924,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const TimeHolder *th, con /*! * \param [in] newNbOfTuples - The new nb of tuples to be allocated. */ -void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples) +void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(mcIdType newNbOfTuples) { if(_nb_of_tuples_to_be_allocated>=0) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile : the object is expected to be appended to a data coming from a file but not loaded ! Load before appending data !"); @@ -945,7 +945,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples) * \throw If \a this->_arr is already allocated but has different number of components * than \a field. */ -int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) { if(!field) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom : input field is NULL !"); @@ -969,8 +969,8 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, con } else { - int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples(); - int 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; @@ -981,7 +981,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::copyTinyInfoFrom(const TimeHolder *th, con * Returns number of components in \a this field * \return int - the number of components. */ -int MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const +std::size_t MEDFileAnyTypeField1TSWithoutSDA::getNumberOfComponents() const { return getOrCreateAndGetArray()->getNumberOfComponents(); } @@ -1162,7 +1162,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOf MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax,false)); - const DataArrayInt *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1)); + const DataArrayIdType *d(mesh->getNumberFieldAtLevel(meshDimRelToMax)),*e(mesh->getNumberFieldAtLevel(1)); if(meshDimRelToMax==1) (static_cast((MEDCouplingMesh *)m))->setMeshDimension(0); return MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(type,renumPol,glob,m,d,e,arrOut,nasc); @@ -1222,7 +1222,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type or given \a meshDimRelToMax are available. */ -MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const +MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !"; bool isPfl=false; @@ -1271,7 +1271,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( oss << "\"" << nasc.getName() << "\" not defined on all nodes !"; throw INTERP_KERNEL::Exception(oss.str()); } - MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); + MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); if(!dynamic_cast((DataArray *)arrOut)) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : node renumbering not implemented for not double DataArrays !"); ret->renumberNodes(nodeRenumSafe->getConstPointer()); @@ -1288,7 +1288,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \param [in] type - a spatial discretization of the field. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. * \param [in] mesh - the supporting mesh. - * \param [out] pfl - a new instance of DataArrayInt holding ids of mesh entities the + * \param [out] pfl - a new instance of DataArrayIdType holding ids of mesh entities the * field of interest lies on. If the field lies on all entities of the given * dimension, all ids in \a pfl are zero. The caller is to delete this array * using decrRef() as it is no more needed. @@ -1299,7 +1299,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the given \a type are available. */ -DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const +DataArray *MEDFileAnyTypeField1TSWithoutSDA::getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { MCAuto m(mesh->getMeshAtLevel(meshDimRelToMax)); MCAuto ret=_field_per_mesh[0]->getFieldOnMeshAtLevelWithPfl(type,m,pfl,glob,nasc); @@ -1330,32 +1330,32 @@ void MEDFileField1TSWithoutSDA::CheckMeshDimRel(int meshDimRelToMax) * These values are in full-interlace mode. * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. */ -std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) +std::vector MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *mesh) { if(!mesh) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::CheckSBTMesh : input mesh is NULL !"); std::set geoTypes=mesh->getAllGeoTypes(); - int nbOfTypes=geoTypes.size(); - std::vector code(3*nbOfTypes); - MCAuto arr1=DataArrayInt::New(); + std::size_t nbOfTypes=geoTypes.size(); + std::vector code(3*nbOfTypes); + MCAuto arr1=DataArrayIdType::New(); arr1->alloc(nbOfTypes,1); - int *arrPtr=arr1->getPointer(); + mcIdType *arrPtr=arr1->getPointer(); std::set::const_iterator it=geoTypes.begin(); - for(int i=0;i arr2=arr1->checkAndPreparePermutation(); - const int *arrPtr2=arr2->getConstPointer(); + for(std::size_t i=0;i arr2=arr1->checkAndPreparePermutation(); + const mcIdType *arrPtr2=arr2->getConstPointer(); int i=0; for(it=geoTypes.begin();it!=geoTypes.end();it++,i++) { - int pos=arrPtr2[i]; - int nbCells=mesh->getNumberOfCellsWithType(*it); - code[3*pos]=(int)(*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 idsPerType;//no profiles - DataArrayInt *da=mesh->checkTypeConsistencyAndContig(code,idsPerType); + std::vector idsPerType;//no profiles + DataArrayIdType *da=mesh->checkTypeConsistencyAndContig(code,idsPerType); if(da) { da->decrRef(); @@ -1408,15 +1408,15 @@ std::vector< std::vector > MEDFileField1TSWithoutSDA::getFiel if(mname.empty()) 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); - int nbOfRet=ret0.size(); + std::vector< std::vector< std::pair > > ret0=_field_per_mesh[0]->getFieldSplitedByType(types,typesF,pfls,locs); + std::size_t nbOfRet=ret0.size(); std::vector< std::vector > ret(nbOfRet); - for(int i=0;i >& p=ret0[i]; - int nbOfRet1=p.size(); + const std::vector< std::pair >& p=ret0[i]; + std::size_t nbOfRet1=p.size(); ret[i].resize(nbOfRet1); - for(int j=0;jselectByTupleIdSafeSlice(p[j].first,p[j].second,1); ret[i][j]=tmp; @@ -1460,7 +1460,7 @@ MEDFileIntField1TSWithoutSDA *MEDFileField1TSWithoutSDA::convertToInt() const * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayTemplateExt(entries); } @@ -1504,7 +1504,7 @@ MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA() MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(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) { - DataArrayInt *arr(getOrCreateAndGetArrayTemplate()); + DataArrayInt32 *arr(getOrCreateAndGetArrayTemplate()); arr->setInfoAndChangeNbOfCompo(infos); } @@ -1514,9 +1514,9 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const } /*! - * Returns a pointer to the underground DataArrayInt instance and a + * Returns a pointer to the underground DataArrayIdType instance and a * sequence describing parameters of a support of each part of \a this field. The - * caller should not decrRef() the returned DataArrayInt. This method allows for a + * caller should not decrRef() the returned DataArrayIdType. This method allows for a * direct access to the field values. This method is intended for the field lying on one * mesh only. * \param [in,out] entries - the sequence describing parameters of a support of each @@ -1524,12 +1524,12 @@ const char *MEDFileIntField1TSWithoutSDA::getTypeStr() const * first part describes a type of mesh entity and an id of discretization of a * current field part. The second part describes a range of values [begin,end) * within the returned array relating to the current field part. - * \return DataArrayInt * - the pointer to the field values array. + * \return DataArrayIdType * - the pointer to the field values array. * \throw If the number of underlying meshes is not equal to 1. * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayIntExt(entries); } @@ -1537,7 +1537,7 @@ DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< /*! * Returns a pointer to the underground DataArrayInt instance and a * sequence describing parameters of a support of each part of \a this field. The - * caller should not decrRef() the returned DataArrayInt. This method allows for a + * caller should not decrRef() the returned DataArrayIdType. This method allows for a * direct access to the field values. This method is intended for the field lying on one * mesh only. * \param [in,out] entries - the sequence describing parameters of a support of each @@ -1550,7 +1550,7 @@ DataArray *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const +DataArrayInt *MEDFileIntField1TSWithoutSDA::getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -1614,7 +1614,7 @@ const char *MEDFileFloatField1TSWithoutSDA::getTypeStr() const * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { return getUndergroundDataArrayFloatExt(entries); } @@ -1635,7 +1635,7 @@ DataArray *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayExt(std::vecto * \throw If no field values are available. * \sa getUndergroundDataArray() */ -DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const +DataArrayFloat *MEDFileFloatField1TSWithoutSDA::getUndergroundDataArrayFloatExt(std::vector< std::pair,std::pair > >& entries) const { if(_field_per_mesh.size()!=1) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); @@ -1711,7 +1711,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i med_int numdt,numit; med_float dt; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt)); - ret->setTime(numdt,numit,dt); + ret->setTime(FromMedInt(numdt),FromMedInt(numit),dt); ret->_csit=1; if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities); @@ -1786,7 +1786,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i med_int numdt,numit; med_float dt; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt)); - ret->setTime(numdt,numit,dt); + ret->setTime(FromMedInt(numdt),FromMedInt(numit),dt); ret->_csit=1; if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,entities); @@ -2000,21 +2000,21 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c { if(checkFieldId) { - int 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()); } } - int 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)); INTERP_KERNEL::AutoPtr nomcha(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr nomMaa(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_bool localMesh; - int nbOfStep; + med_int nbOfStep; MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep)); fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE); dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE); @@ -2022,7 +2022,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, int fieldIdCFormat, bool c infos.clear(); infos.resize(ncomp); for(int j=0;j(nbOfStep); } /*! @@ -2033,7 +2033,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) { - int nbFields=MEDnField(fid); + med_int nbFields=MEDnField(fid); bool found=false; std::vector fns(nbFields); int nbOfStep2(-1); @@ -2082,11 +2082,11 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTE MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldPflName=disc->getProfile(); std::vector vv=getPflsReallyUsedMulti(); - int 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); - DataArrayInt *pfl=getProfile(oldPflName.c_str()); + DataArrayIdType *pfl=getProfile(oldPflName.c_str()); pfl->setName(newPflName); } else @@ -2120,7 +2120,7 @@ void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_K MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId); std::string oldLocName=disc->getLocalization(); std::vector vv=getLocsReallyUsedMulti(); - int 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); @@ -2209,10 +2209,10 @@ void MEDFileAnyTypeField1TS::unloadArraysWithoutDataLoss() void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const { - int 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(int i=0;iwriteLL(fid,*this,*contentNotNullBase()); } @@ -2373,7 +2373,7 @@ int MEDFileAnyTypeField1TS::getMeshOrder() const return contentNotNullBase()->getMeshOrder(); } -int MEDFileAnyTypeField1TS::getNumberOfComponents() const +std::size_t MEDFileAnyTypeField1TS::getNumberOfComponents() const { return contentNotNullBase()->getNumberOfComponents(); } @@ -2437,7 +2437,7 @@ void MEDFileAnyTypeField1TS::convertMedBallIntoClassic() return contentNotNullBase()->convertMedBallIntoClassic(); } -void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl) +void MEDFileAnyTypeField1TS::makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl) { return contentNotNullBase()->makeReduction(ct,tof,pfl); } @@ -2447,7 +2447,7 @@ std::vector MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() cons return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, +std::vector< std::vector > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const { return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs); @@ -2523,13 +2523,13 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::deepCopy() const return ret.retn(); } -int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr) { MCAuto ft(MEDCouplingFieldTemplate::New(*field)); return copyTinyInfoFrom(field->timeDiscrSafe(),ft,arr); } -int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) +mcIdType MEDFileAnyTypeField1TS::copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr) { return contentNotNullBase()->copyTinyInfoFrom(th,field,arr); } diff --git a/src/MEDLoader/MEDFileField1TS.hxx b/src/MEDLoader/MEDFileField1TS.hxx index 9190fb40b..7d7e874d0 100644 --- a/src/MEDLoader/MEDFileField1TS.hxx +++ b/src/MEDLoader/MEDFileField1TS.hxx @@ -64,15 +64,15 @@ namespace MEDCoupling // MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void convertMedBallIntoClassic(); - MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(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 void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl); + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(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 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; public: - MEDLOADER_EXPORT int getNumberOfComponents() const; + MEDLOADER_EXPORT std::size_t getNumberOfComponents() const; MEDLOADER_EXPORT const std::vector& getInfo() const; MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const; @@ -85,16 +85,16 @@ namespace MEDCoupling MEDLOADER_EXPORT void setInfo(const std::vector& infos); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); + 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 DataArrayInt *profile, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc, bool smartPflKiller=true); + 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); MEDLOADER_EXPORT virtual void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const = 0; MEDLOADER_EXPORT virtual std::vector< MCAuto > splitComponents() const; MEDLOADER_EXPORT virtual const char *getTypeStr() const = 0; MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArray() const = 0; - MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const = 0; + MEDLOADER_EXPORT virtual DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const = 0; MEDLOADER_EXPORT virtual void setArray(DataArray *arr) = 0; MEDLOADER_EXPORT virtual DataArray *createNewEmptyDataArrayInstance() const = 0; MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0; @@ -104,16 +104,16 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; + MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayIdType *cellRenum, const DataArrayIdType *nodeRenum, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; public: - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT std::vector< MCAuto > splitDiscretizations() const; MEDLOADER_EXPORT std::vector< MCAuto > splitMultiDiscrPerGeoTypes() const; - MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); - MEDLOADER_EXPORT int keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its); + MEDLOADER_EXPORT mcIdType keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair >& its); + MEDLOADER_EXPORT mcIdType keepOnlyGaussDiscretization(std::size_t idOfDisc, std::vector< std::pair >& its); public: - MEDLOADER_EXPORT void allocNotFromFile(int newNbOfTuples); + MEDLOADER_EXPORT void allocNotFromFile(mcIdType newNbOfTuples); MEDLOADER_EXPORT bool allocIfNecessaryTheArrayToReceiveDataFromFile(); MEDLOADER_EXPORT void loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); @@ -125,7 +125,7 @@ namespace MEDCoupling protected: int getMeshIdFromMeshName(const std::string& mName) const; int addNewEntryIfNecessary(const MEDCouplingMesh *mesh); - void updateData(int newLgth, const std::vector< std::pair >& oldStartStops); + void updateData(mcIdType newLgth, const std::vector< std::pair >& oldStartStops); protected: std::vector< MCAuto< MEDFileFieldPerMesh > > _field_per_mesh; int _iteration; @@ -138,7 +138,7 @@ namespace MEDCoupling // -2 means allocated and read from a file // -1 means not allocated and build from scratch // >=0 means not allocated and read from a file - mutable int _nb_of_tuples_to_be_allocated; + mutable mcIdType _nb_of_tuples_to_be_allocated; }; class MEDFileIntField1TSWithoutSDA; @@ -155,11 +155,11 @@ namespace MEDCoupling 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 typename Traits::ArrayType *getUndergroundDataArrayTemplateExt(std::vector< std::pair,std::pair > >& entries) const; 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 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: MCAuto< typename Traits::ArrayType > _arr; @@ -172,10 +172,10 @@ namespace MEDCoupling { public: MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + 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); + MEDLOADER_EXPORT static std::vector CheckSBTMesh(const MEDCouplingMesh *mesh); MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(); @@ -208,8 +208,8 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const; MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const; MEDLOADER_EXPORT const char *getTypeStr() const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair,std::pair > >& entries) const; protected: MEDFileIntField1TSWithoutSDA(const std::string& fieldName, const std::string& meshName, int csit, int iteration, int order, const std::vector& infos); public: @@ -227,8 +227,8 @@ namespace MEDCoupling 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; + 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); public: @@ -278,7 +278,7 @@ namespace MEDCoupling MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair >& modifTab); MEDLOADER_EXPORT int getMeshIteration() const; MEDLOADER_EXPORT int getMeshOrder() const; - MEDLOADER_EXPORT int getNumberOfComponents() const; + MEDLOADER_EXPORT std::size_t getNumberOfComponents() const; MEDLOADER_EXPORT bool isDealingTS(int iteration, int order) const; MEDLOADER_EXPORT std::pair getDtIt() const; MEDLOADER_EXPORT void fillIteration(std::pair& p) const; @@ -288,14 +288,14 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector& getInfo(); MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const; MEDLOADER_EXPORT std::vector getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(const std::string& mname, std::vector& types, std::vector< std::vector >& typesF, + MEDLOADER_EXPORT std::vector< std::vector > > getFieldSplitedByType(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 MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId); MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const; MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void convertMedBallIntoClassic(); - MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayInt *pfl); - MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; + MEDLOADER_EXPORT void makeReduction(INTERP_KERNEL::NormalizedCellType ct, TypeOfField tof, const DataArrayIdType *pfl); + MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *extractPart(const std::map >& extractDef, MEDFileMesh *mm) const = 0; MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0; public: MEDLOADER_EXPORT void loadArrays(); @@ -306,8 +306,8 @@ namespace MEDCoupling MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitDiscretizations() const; MEDLOADER_EXPORT std::vector< MCAuto< MEDFileAnyTypeField1TS > > splitMultiDiscrPerGeoTypes() const; MEDLOADER_EXPORT MEDFileAnyTypeField1TS *deepCopy() const; - MEDLOADER_EXPORT int copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); - MEDLOADER_EXPORT int copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); + MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const MEDCouplingFieldDouble *field, const DataArray *arr); + MEDLOADER_EXPORT mcIdType copyTinyInfoFrom(const TimeHolder *th, const MEDCouplingFieldTemplate *field, const DataArray *arr); public: //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); @@ -349,10 +349,10 @@ namespace MEDCoupling MEDLOADER_EXPORT static typename MLFieldTraits::F1TSType *New(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent); public: MEDLOADER_EXPORT static typename Traits::ArrayType *ReturnSafelyTypedDataArray(MCAuto& arr); - MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const; MEDLOADER_EXPORT void setArray(DataArray *arr); MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArray() const; - MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; MEDLOADER_EXPORT static MCAuto::FieldType> SetDataArrayInField(MEDCouplingFieldDouble *f, MCAuto& arr); MEDLOADER_EXPORT static MCAuto ToFieldTemplateWithTime(const typename Traits::FieldType *f); public: @@ -364,10 +364,10 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT void setFieldNoProfileSBT(const typename Traits::FieldType *field); - MEDLOADER_EXPORT void setFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void setFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *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 { return this->extractPartImpl(extractDef,mm); } + 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 { return this->extractPartImpl(extractDef,mm); } protected: ~MEDFileTemplateField1TS() { } MEDFileTemplateField1TS(); @@ -377,7 +377,7 @@ namespace MEDCoupling MEDFileTemplateField1TS(const typename MLFieldTraits::F1TSWSDAType& other, bool shallowCopyOfContent):MEDFileAnyTypeField1TS(other,shallowCopyOfContent) { } const typename MLFieldTraits::F1TSWSDAType *contentNotNull() const; typename MLFieldTraits::F1TSWSDAType *contentNotNull(); - void setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); + void setFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller); }; /*! diff --git a/src/MEDLoader/MEDFileFieldGlobs.cxx b/src/MEDLoader/MEDFileFieldGlobs.cxx index af727fc7b..1a8791fc0 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.cxx +++ b/src/MEDLoader/MEDFileFieldGlobs.cxx @@ -28,6 +28,7 @@ #include "MEDFileBlowStrEltUp.hxx" #include "MEDFileFieldVisitor.hxx" +#include "MEDCouplingMemArray.txx" #include "MEDCouplingFieldDiscretization.hxx" #include "MCType.hxx" @@ -43,50 +44,52 @@ void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string { if(id>=(int)_pfls.size()) _pfls.resize(id+1); - _pfls[id]=DataArrayInt::New(); - int lgth(MEDprofileSizeByName(fid,pflName.c_str())); - _pfls[id]->setName(pflName); - _pfls[id]->alloc(lgth,1); - MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),_pfls[id]->getPointer())); + MCAuto miPfl=DataArrayMedInt::New(); + med_int lgth(MEDprofileSizeByName(fid,pflName.c_str())); + miPfl->setName(pflName); + miPfl->alloc(lgth,1); + MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),miPfl->getPointer())); + _pfls[id]=FromMedIntArray(miPfl); _pfls[id]->applyLin(1,-1,0);//Converting into C format } void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int i) { INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - int sz; + med_int sz; MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz)); std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE); if(i>=(int)_pfls.size()) _pfls.resize(i+1); - _pfls[i]=DataArrayInt::New(); - _pfls[i]->alloc(sz,1); - _pfls[i]->setName(pflCpp.c_str()); - MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,_pfls[i]->getPointer())); + MCAuto miPfl=DataArrayMedInt::New(); + miPfl->alloc(sz,1); + miPfl->setName(pflCpp.c_str()); + MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,miPfl->getPointer())); + _pfls[i]=FromMedIntArray(miPfl); _pfls[i]->applyLin(1,-1,0);//Converting into C format } void MEDFileFieldGlobs::writeGlobals(med_idt fid, const MEDFileWritable& opt) const { - int nbOfPfls=_pfls.size(); - for(int i=0;i cpy=_pfls[i]->deepCopy(); + MCAuto cpy=DataArrayMedInt::Copy((const DataArrayIdType*)_pfls[i]); cpy->applyLin(1,1,0); INTERP_KERNEL::AutoPtr pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy()); - MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer())); + MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,ToMedInt(_pfls[i]->getNumberOfTuples()),cpy->getConstPointer())); } // - int nbOfLocs=_locs.size(); - for(int i=0;iwriteLL(fid); } void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) { std::vector pfls=getPfls(); - for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=other._pfls.begin();it!=other._pfls.end();it++) { std::vector::iterator it2=std::find(pfls.begin(),pfls.end(),(*it)->getName()); if(it2==pfls.end()) @@ -95,7 +98,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } else { - int id=std::distance(pfls.begin(),it2); + std::size_t id=std::distance(pfls.begin(),it2); if(!(*it)->isEqual(*_pfls[id])) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; @@ -113,7 +116,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) } else { - int id=std::distance(locs.begin(),it2); + std::size_t id=std::distance(locs.begin(),it2); if(!(*it)->isEqual(*_locs[id],eps)) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; @@ -138,24 +141,24 @@ void MEDFileFieldGlobs::checkGlobsLocsPartCoherency(const std::vector profiles=real.getPflsReallyUsed(); - int sz=profiles.size(); + std::size_t sz=profiles.size(); _pfls.resize(sz); - for(int i=0;i locs=real.getLocsReallyUsed(); sz=locs.size(); _locs.resize(sz); - for(int i=0;i MEDFileFieldGlobs::getDirectChildrenWithNull() const { std::vector ret; - for(std::vector< MCAuto< DataArrayInt > >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) - ret.push_back((const DataArrayInt *)*it); + 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; @@ -192,9 +195,9 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCopy() const { MCAuto ret=new MEDFileFieldGlobs(*this); std::size_t i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { - if((const DataArrayInt *)*it) + if((const DataArrayIdType *)*it) ret->_pfls[i]=(*it)->deepCopy(); } i=0; @@ -216,11 +219,11 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::shallowCpyPart(const std::vector ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayInt *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 pfl2(pfl); + MCAuto pfl2(pfl); ret->_pfls.push_back(pfl2); } for(std::vector::const_iterator it2=locs.begin();it2!=locs.end();it2++) @@ -246,7 +249,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector MCAuto ret=MEDFileFieldGlobs::New(); for(std::vector::const_iterator it1=pfls.begin();it1!=pfls.end();it1++) { - DataArrayInt *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()); @@ -281,7 +284,7 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const for(std::size_t i=0;igetName() << "\"\n"; else @@ -302,9 +305,9 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const void MEDFileFieldGlobs::changePflsNamesInStruct(const std::vector< std::pair, std::string > >& mapOfModif) { - for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::iterator it=_pfls.begin();it!=_pfls.end();it++) { - DataArrayInt *elt(*it); + DataArrayIdType *elt(*it); if(elt) { std::string name(elt->getName()); @@ -375,7 +378,7 @@ namespace MEDCouplingImpl { public: PflFinder(const std::string& pfl):_pfl(pfl) { } - bool operator() (const MCAuto& loc) { return loc->getName()==_pfl; } + bool operator() (const MCAuto& loc) { return loc->getName()==_pfl; } private: const std::string _pfl; }; @@ -392,12 +395,12 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const oss << "\"" << (*it)->getName() << "\", "; throw INTERP_KERNEL::Exception(oss.str()); } - return std::distance(_locs.begin(),it); + return (int)std::distance(_locs.begin(),it); } int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const { - std::vector< MCAuto >::const_iterator 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 : "; @@ -405,18 +408,18 @@ int MEDFileFieldGlobs::getProfileId(const std::string& pfl) const oss << "\"" << (*it)->getName() << "\", "; throw INTERP_KERNEL::Exception(oss.str()); } - return std::distance(_pfls.begin(),it); + return (int)std::distance(_pfls.begin(),it); } /*! * The returned value is never null. */ -const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const +const DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) const { return getProfileFromId(getProfileId(pflName)); } -const DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) const +const DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) const { if(pflId<0 || pflId>=(int)_pfls.size()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !"); @@ -438,10 +441,10 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) /*! * The returned value is never null. Borrowed reference returned. */ -DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) +DataArrayIdType *MEDFileFieldGlobs::getProfile(const std::string& pflName) { std::string pflNameCpp(pflName); - std::vector< MCAuto >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),MEDCouplingImpl::PflFinder(pflNameCpp)); + 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 : "; @@ -452,7 +455,7 @@ DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) return *it; } -DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) +DataArrayIdType *MEDFileFieldGlobs::getProfileFromId(int pflId) { if(pflId<0 || pflId>=(int)_pfls.size()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::getProfileFromId : Invalid profile id !"); @@ -461,9 +464,9 @@ DataArrayInt *MEDFileFieldGlobs::getProfileFromId(int pflId) void MEDFileFieldGlobs::killProfileIds(const std::vector& pflIds) { - std::vector< MCAuto > newPfls; + std::vector< MCAuto > newPfls; int i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { if(std::find(pflIds.begin(),pflIds.end(),i)==pflIds.end()) newPfls.push_back(*it); @@ -498,18 +501,18 @@ void MEDFileFieldGlobs::killStructureElementsInGlobs() std::vector MEDFileFieldGlobs::getPfls() const { - int sz=_pfls.size(); + std::size_t sz=_pfls.size(); std::vector ret(sz); - for(int i=0;igetName(); return ret; } std::vector MEDFileFieldGlobs::getLocs() const { - int sz=_locs.size(); + std::size_t sz=_locs.size(); std::vector ret(sz); - for(int i=0;igetName(); return ret; } @@ -530,18 +533,18 @@ bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualProfiles() const { - std::map > m; + std::map > m; int i=0; - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++,i++) { - const DataArrayInt *tmp=(*it); + const DataArrayIdType *tmp=(*it); if(tmp) { m[tmp->getHashCode()].push_back(i); } } std::vector< std::vector > ret; - for(std::map >::const_iterator it2=m.begin();it2!=m.end();it2++) + for(std::map >::const_iterator it2=m.begin();it2!=m.end();it2++) { if((*it2).second.size()>1) { @@ -573,12 +576,12 @@ std::vector< std::vector > MEDFileFieldGlobs::whichAreEqualLocs(double eps) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::whichAreEqualLocs : no implemented yet ! Sorry !"); } -void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) +void MEDFileFieldGlobs::appendProfile(DataArrayIdType *pfl) { std::string name(pfl->getName()); if(name.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldGlobs::appendProfile : unsupported profiles with no name !"); - for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) + for(std::vector< MCAuto >::const_iterator it=_pfls.begin();it!=_pfls.end();it++) if(name==(*it)->getName()) { if(!pfl->isEqual(*(*it))) @@ -1088,10 +1091,10 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) c /*! * Returns a profile array by its name. * \param [in] pflName - the name of the profile of interest. - * \return const DataArrayInt * - the profile array having the name \a pflName. + * \return const DataArrayIdType * - the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const +const DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const { return contentNotNull()->getProfile(pflName); } @@ -1099,10 +1102,10 @@ const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName /*! * Returns a profile array by its id. * \param [in] pflId - the id of the profile of interest. - * \return const DataArrayInt * - the profile array having the id \a pflId. + * \return const DataArrayIdType * - the profile array having the id \a pflId. * \throw If there is no a profile with id \a pflId. */ -const DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const +const DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) const { return contentNotNull()->getProfileFromId(pflId); } @@ -1134,10 +1137,10 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locNa /*! * Returns a profile array, apt for modification, by its name. * \param [in] pflName - the name of the profile of interest. - * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName. + * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the name \a pflName. * \throw If there is no a profile named \a pflName. */ -DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) +DataArrayIdType *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) { return contentNotNull()->getProfile(pflName); } @@ -1145,10 +1148,10 @@ DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) /*! * Returns a profile array, apt for modification, by its id. * \param [in] pflId - the id of the profile of interest. - * \return DataArrayInt * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId. + * \return DataArrayIdType * - Borrowed reference - a non-const pointer to the profile array having the id \a pflId. * \throw If there is no a profile with id \a pflId. */ -DataArrayInt *MEDFileFieldGlobsReal::getProfileFromId(int pflId) +DataArrayIdType *MEDFileFieldGlobsReal::getProfileFromId(int pflId) { return contentNotNull()->getProfileFromId(pflId); } @@ -1178,7 +1181,7 @@ void MEDFileFieldGlobsReal::killLocalizationIds(const std::vector& locIds) * \throw If a profile with the same name as that of \a pfl already exists but contains * different ids. */ -void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl) +void MEDFileFieldGlobsReal::appendProfile(DataArrayIdType *pfl) { contentNotNull()->appendProfile(pfl); } diff --git a/src/MEDLoader/MEDFileFieldGlobs.hxx b/src/MEDLoader/MEDFileFieldGlobs.hxx index c39e19895..5744392ee 100644 --- a/src/MEDLoader/MEDFileFieldGlobs.hxx +++ b/src/MEDLoader/MEDFileFieldGlobs.hxx @@ -72,17 +72,17 @@ namespace MEDCoupling std::string getFileName() const { return _file_name; } const MEDFileFieldLoc& getLocalizationFromId(int locId) const; const MEDFileFieldLoc& getLocalization(const std::string& locName) const; - const DataArrayInt *getProfileFromId(int pflId) const; - const DataArrayInt *getProfile(const std::string& pflName) const; + const DataArrayIdType *getProfileFromId(int pflId) const; + const DataArrayIdType *getProfile(const std::string& pflName) const; MEDFileFieldLoc& getLocalizationFromId(int locId); MEDFileFieldLoc& getLocalization(const std::string& locName); - DataArrayInt *getProfile(const std::string& pflName); - DataArrayInt *getProfileFromId(int pflId); + DataArrayIdType *getProfile(const std::string& pflName); + DataArrayIdType *getProfileFromId(int pflId); void killProfileIds(const std::vector& pflIds); void killLocalizationIds(const std::vector& locIds); void killStructureElementsInGlobs(); // - void appendProfile(DataArrayInt *pfl); + void appendProfile(DataArrayIdType *pfl); void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); // static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector& namesToAvoid); @@ -91,7 +91,7 @@ namespace MEDCoupling MEDFileFieldGlobs(); ~MEDFileFieldGlobs(); protected: - std::vector< MCAuto > _pfls; + std::vector< MCAuto > _pfls; std::vector< MCAuto > _locs; std::string _file_name; }; @@ -154,14 +154,14 @@ namespace MEDCoupling MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const; MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId); MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName); - MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const; - MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const; - MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName); - MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId); + MEDLOADER_EXPORT const DataArrayIdType *getProfile(const std::string& pflName) const; + MEDLOADER_EXPORT const DataArrayIdType *getProfileFromId(int pflId) const; + MEDLOADER_EXPORT DataArrayIdType *getProfile(const std::string& pflName); + MEDLOADER_EXPORT DataArrayIdType *getProfileFromId(int pflId); MEDLOADER_EXPORT void killProfileIds(const std::vector& pflIds); MEDLOADER_EXPORT void killLocalizationIds(const std::vector& locIds); // - MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl); + MEDLOADER_EXPORT void appendProfile(DataArrayIdType *pfl); MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w); protected: MEDFileFieldGlobs *contentNotNull(); diff --git a/src/MEDLoader/MEDFileFieldInternal.cxx b/src/MEDLoader/MEDFileFieldInternal.cxx index c365fdff8..1d687b19d 100644 --- a/src/MEDLoader/MEDFileFieldInternal.cxx +++ b/src/MEDLoader/MEDFileFieldInternal.cxx @@ -121,10 +121,12 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const std::string& locName):_name( { med_geometry_type geotype; med_geometry_type sectiongeotype; - int nsectionmeshcell; + med_int nsectionmeshcell, dim, nb_gauss_pt; INTERP_KERNEL::AutoPtr geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); + MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype); + _dim=FromMedInt(dim); + _nb_gauss_pt=FromMedInt(nb_gauss_pt); _gt=new MEDFileGTKeeperSta((INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)))); const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _nb_node_per_cell=cm.getNumberOfNodes(); @@ -138,11 +140,13 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent { med_geometry_type geotype; med_geometry_type sectiongeotype; - int nsectionmeshcell; + med_int nsectionmeshcell,dim,nb_gauss_pt; INTERP_KERNEL::AutoPtr locName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr geointerpname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr sectionmeshname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype)); + MEDFILESAFECALLERRD0(MEDlocalizationInfo,(fid,id+1,locName,&geotype,&dim,&nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype)); + _dim=FromMedInt(dim); + _nb_gauss_pt=FromMedInt(nb_gauss_pt); _name=locName; std::string sectionName(MEDLoaderBase::buildStringFromFortran(sectionmeshname,MED_NAME_SIZE)); if(sectionName.empty()) @@ -164,8 +168,9 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent const MEDFileUMesh *section(entities2->getSupMeshWithName(sectionName)); _gt=new MEDFileGTKeeperDyn(um,section,se); { - int dummy; - MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&_nb_node_per_cell)); + med_int dummy, nb_node_per_cell; + MEDFILESAFECALLERRD0(MEDmeshGeotypeParameter,(fid,geotype,&dummy,&nb_node_per_cell)); + _nb_node_per_cell=FromMedInt(nb_node_per_cell); } } _ref_coo.resize(_dim*_nb_node_per_cell); @@ -175,12 +180,12 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id, const MEDFileEntities *ent } MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, - const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_name(locName),_gt(new MEDFileGTKeeperSta(geoType)),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w) + const std::vector& refCoo, const std::vector& gsCoo, const std::vector& w):_gt(new MEDFileGTKeeperSta(geoType)),_name(locName),_ref_coo(refCoo),_gs_coo(gsCoo),_w(w) { const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getGeoType())); _dim=cm.getDimension(); _nb_node_per_cell=cm.getNumberOfNodes(); - _nb_gauss_pt=_w.size(); + _nb_gauss_pt=(int)_w.size(); } @@ -265,11 +270,11 @@ std::string MEDFileFieldLoc::repr() const oss << "\n - Dimension : " << _dim << "\n - Number of gauss points : "; oss << _nb_gauss_pt << "\n - Number of nodes in cell : " << _nb_node_per_cell; oss << "\n - Ref coords are : "; - int sz=_ref_coo.size(); + std::size_t sz=_ref_coo.size(); if(sz%_dim==0) { - int nbOfTuples=sz/_dim; - for(int i=0;igetTypeOfField(); _start=start; @@ -313,8 +318,8 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off } case ON_GAUSS_NE: { - MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); - const int *arrPtr=arr->getConstPointer(); + MCAuto arr=field->getDiscretization()->getOffsetArr(field->getMesh()); + const mcIdType *arrPtr=arr->getConstPointer(); getOrCreateAndGetArray()->setContigPartOfSelectedValuesSlice(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1); _end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]); _nval=nbOfCells; @@ -323,17 +328,17 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off case ON_GAUSS_PT: { const MEDCouplingFieldDiscretization *disc(field->getDiscretization()); - const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(_loc_id)); + const MEDCouplingGaussLocalization& gsLoc(field->getGaussLocalization(FromIdType(_loc_id))); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("assignFieldNoProfile : invalid call to this method ! Internal Error !"); - const DataArrayInt *dai(disc2->getArrayOfDiscIds()); - MCAuto dai2(disc2->getOffsetArr(field->getMesh())); - const int *dai2Ptr(dai2->getConstPointer()); - int nbi(gsLoc.getWeights().size()); - MCAuto da2(dai->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1)); - MCAuto da3(da2->findIdsEqual(_loc_id)); - const int *da3Ptr(da3->getConstPointer()); + const DataArrayIdType *dai(disc2->getArrayOfDiscIds()); + MCAuto dai2(disc2->getOffsetArr(field->getMesh())); + const mcIdType *dai2Ptr(dai2->getConstPointer()); + 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()); if(da3->getNumberOfTuples()!=nbOfCells) {//profile : for gauss even in NoProfile !!! std::ostringstream oss; oss << "Pfl_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id; @@ -341,14 +346,14 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldNoProfile(int& start, int off da3->setName(_profile.c_str()); glob.appendProfile(da3); } - MCAuto da4(DataArrayInt::New()); + MCAuto da4(DataArrayIdType::New()); _nval=da3->getNbOfElems(); da4->alloc(_nval*nbi,1); - int *da4Ptr(da4->getPointer()); - for(int i=0;i<_nval;i++) + mcIdType *da4Ptr(da4->getPointer()); + for(mcIdType i=0;i<_nval;i++) { - int ref=dai2Ptr[offset+da3Ptr[i]]; - for(int j=0;jgetTypeOfField(); @@ -416,12 +421,12 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& } case ON_GAUSS_NE: { - MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); - MCAuto arr2=arr->deltaShiftIndex(); - MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); + MCAuto arr=field->getDiscretization()->getOffsetArr(mesh); + MCAuto arr2=arr->deltaShiftIndex(); + MCAuto arr3=arr2->selectByTupleId(multiTypePfl->begin(),multiTypePfl->end()); arr3->computeOffsetsFull(); - MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); - int trueNval=tmp->getNumberOfTuples(); + MCAuto tmp=idsInPfl->buildExplicitArrByRanges(arr3); + mcIdType trueNval=tmp->getNumberOfTuples(); _nval=idsInPfl->getNumberOfTuples(); getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp); _end=_start+trueNval; @@ -432,23 +437,23 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(field->getDiscretization()); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da1=disc2->getArrayOfDiscIds(); - const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(_loc_id); - MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); - MCAuto da3=da2->findIdsEqual(_loc_id); - MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); + const DataArrayIdType *da1=disc2->getArrayOfDiscIds(); + const MEDCouplingGaussLocalization& gsLoc=field->getGaussLocalization(FromIdType(_loc_id)); + MCAuto da2=da1->selectByTupleId(idsInPfl->begin(),idsInPfl->end()); + MCAuto da3=da2->findIdsEqual(_loc_id); + MCAuto da4=idsInPfl->selectByTupleId(da3->begin(),da3->end()); // MCAuto mesh2=mesh->buildPart(multiTypePfl->begin(),multiTypePfl->end()); - MCAuto arr=disc2->getOffsetArr(mesh2); + MCAuto arr=disc2->getOffsetArr(mesh2); // - MCAuto tmp=DataArrayInt::New(); - int trueNval=0; - for(const int *pt=da4->begin();pt!=da4->end();pt++) + MCAuto tmp=DataArrayIdType::New(); + mcIdType trueNval=0; + for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++) trueNval+=arr->getIJ(*pt+1,0)-arr->getIJ(*pt,0); tmp->alloc(trueNval,1); - int *tmpPtr=tmp->getPointer(); - for(const int *pt=da4->begin();pt!=da4->end();pt++) - for(int j=arr->getIJ(*pt,0);jgetIJ(*pt+1,0);j++) + mcIdType *tmpPtr=tmp->getPointer(); + for(const mcIdType *pt=da4->begin();pt!=da4->end();pt++) + for(mcIdType j=arr->getIJ(*pt,0);jgetIJ(*pt+1,0);j++) *tmpPtr++=j; // _nval=da4->getNumberOfTuples(); @@ -457,7 +462,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& oss << "_loc_" << _loc_id; if(locIds) { - MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); + MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); da5->setName(oss.str()); glob.appendProfile(da5); _profile=oss.str(); @@ -482,7 +487,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& start=_end; } -void MEDFileFieldPerMeshPerTypePerDisc::assignNodeFieldNoProfile(int& 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(); @@ -496,7 +501,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewOnRead( return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,profileIt,pd); } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId) { return new MEDFileFieldPerMeshPerTypePerDisc(fath,type,locId,std::string()); } @@ -525,7 +530,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::deepCopy(M return ret.retn(); } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, int profileIt, const PartDefinition *pd) +MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField atype, mcIdType profileIt, const PartDefinition *pd) try:_type(atype),_father(fath),_profile_it(profileIt),_pd(const_cast(pd)) { if(pd) @@ -536,7 +541,7 @@ catch(INTERP_KERNEL::Exception& e) throw e; } -MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int 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) { } @@ -544,8 +549,8 @@ MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFi { } -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()) +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()) { } @@ -556,7 +561,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const { med_entity_type mentiCpy(menti); INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - int nbi,tmp1; + med_int nbi,tmp1; med_int nbValsInFile(MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi)); if(nbValsInFile==0 && menti==MED_CELL) {// @@ -582,18 +587,18 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const if(!_profile.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : not implemented !"); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); - int profilesize,nbi; - int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + med_int profilesize,nbi; + med_int overallNval(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,FromIdType(_profile_it+1),MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { - int start,stop,step; + mcIdType start,stop,step; spd->getSlice(start,stop,step); - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(start,stop,step,"MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile")); med_filter filter=MED_FILTER_INIT; MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/start+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(start+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter)); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr)); MEDfilterClose(&filter); @@ -603,18 +608,18 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const if(dpd) { dpd->checkConsistencyLight(); - MCAuto myIds(dpd->toDAI()); - int a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); + MCAuto myIds(dpd->toDAI()); + mcIdType a(myIds->getMinValueInArray()),b(myIds->getMaxValueInArray()); myIds=myIds->deepCopy();// WARNING deep copy here because _pd is modified by applyLin !!! myIds->applyLin(1,-a); - int nbOfEltsToLoad(b-a+1); + mcIdType nbOfEltsToLoad(b-a+1); med_filter filter=MED_FILTER_INIT; {//TODO : manage int32 ! MCAuto tmp(DataArrayDouble::New()); tmp->alloc(nbOfEltsToLoad,nbOfCompo); MEDFILESAFECALLERRD0(MEDfilterBlockOfEntityCr,(fid,/*nentity*/overallNval,/*nvaluesperentity*/nbi,/*nconstituentpervalue*/nbOfCompo, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(a+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter)); MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast(tmp->getPointer()))); MCAuto feeder(DataArrayDouble::New()); @@ -633,23 +638,23 @@ const MEDFileFieldPerMeshPerTypeCommon *MEDFileFieldPerMeshPerTypePerDisc::getFa return _father; } -void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc) { INTERP_KERNEL::AutoPtr locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr pflname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); std::string fieldName(nasc.getName()),meshName(getMeshName()); - int iteration(getIteration()),order(getOrder()),profilesize,nbi; + med_int iteration(getIteration()),order(getOrder()),profilesize,nbi; TypeOfField type(getType()); med_geometry_type mgeoti; med_entity_type menti; _father->entriesForMEDfile(type,mgeoti,menti); - int zeNVal(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile_it+1,MED_COMPACT_PFLMODE,pflname,&profilesize,locname,&nbi)); + 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 :) - int zeNVal1(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_FACE,mgeoti,_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) { - int zeNVal2(MEDfieldnValueWithProfile(fid,fieldName.c_str(),iteration,order,MED_DESCENDING_EDGE,mgeoti,_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; } @@ -709,7 +714,7 @@ 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 nbOfCompo(arr->getNumberOfComponents()); + int nbOfCompo((int)arr->getNumberOfComponents()); DataArrayDouble *arrD(dynamic_cast(arr)); if(arrD) { @@ -717,7 +722,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast(startFeeding)); return ; } - DataArrayInt *arrI(dynamic_cast(arr)); + DataArrayInt32 *arrI(dynamic_cast(arr)); if(arrI) { int *startFeeding(arrI->getPointer()+_start*nbOfCompo); @@ -737,9 +742,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF /*! * Set a \c this->_start **and** \c this->_end keeping the same delta between the two. */ -void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(int newValueOfStart) +void MEDFileFieldPerMeshPerTypePerDisc::setNewStart(mcIdType newValueOfStart) { - int delta=_end-_start; + mcIdType delta=_end-_start; _start=newValueOfStart; _end=_start+delta; } @@ -797,19 +802,19 @@ void MEDFileFieldPerMeshPerTypePerDisc::setType(TypeOfField newType) _type=newType; } -int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const +std::size_t MEDFileFieldPerMeshPerTypePerDisc::getNumberOfComponents() const { return _father->getNumberOfComponents(); } -int MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const +mcIdType MEDFileFieldPerMeshPerTypePerDisc::getNumberOfTuples() const { return _end-_start; } -void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(int deltaNbVal) +void MEDFileFieldPerMeshPerTypePerDisc::incrementNbOfVals(mcIdType deltaNbVal) { - int nbi((_end-_start)/_nval); + mcIdType nbi((_end-_start)/_nval); _nval+=deltaNbVal; _end+=nbi*deltaNbVal; } @@ -874,11 +879,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::changeLocsRefsNamesGen(const std::vector } } -void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const +void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { if(type!=_type) return ; - dads.push_back(std::pair(_start,_end)); + dads.push_back(std::pair(_start,_end)); geoTypes.push_back(getGeoType()); if(_profile.empty()) pfls.push_back(0); @@ -894,9 +899,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::getFieldAtLevel(TypeOfField type, const } } -void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startEntryId, std::vector< std::pair,std::pair > >& entries) const +void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const { - entries[startEntryId]=std::pair ,std::pair >(std::pair(getGeoType(),discId),std::pair(_start,_end)); + entries[startEntryId]=std::pair ,std::pair >(std::pair(getGeoType(),discId),std::pair(_start,_end)); startEntryId++; } @@ -913,7 +918,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN if(!arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !"); const DataArrayDouble *arrD(dynamic_cast(arr)); - const DataArrayInt *arrI(dynamic_cast(arr)); + const DataArrayInt32 *arrI(dynamic_cast(arr)); const DataArrayFloat *arrF(dynamic_cast(arr)); const unsigned char *locToWrite=0; if(arrD) @@ -925,11 +930,11 @@ void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid, const MEDFileFieldN else throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 FLOAT32 and INT32 !"); MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti, - MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval, + MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,ToMedInt(_nval), locToWrite)); } -void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const +void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const { type=_type; pfl=_profile; @@ -943,9 +948,9 @@ void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pa * \param [out] ptToFill memory zone where the output will be stored. * \return the size of data pushed into output param \a ptToFill */ -int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const +mcIdType MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(mcIdType offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const { - _loc_id=offset; + _loc_id=FromIdType(offset); std::ostringstream oss; std::size_t nbOfType=codeOfMesh.size()/3; int found=-1; @@ -958,7 +963,7 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : not found geometric type " << cm.getRepr() << " in the referenced mesh of field !"; throw INTERP_KERNEL::Exception(oss.str()); } - int *work=ptToFill; + mcIdType *work=ptToFill; if(_profile.empty()) { if(_nval!=codeOfMesh[3*found+1]) @@ -968,12 +973,12 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << " whereas mesh has " << codeOfMesh[3*found+1] << " for this geometric type !"; throw INTERP_KERNEL::Exception(oss.str()); } - for(int ii=codeOfMesh[3*found+2];iigetNumberOfTuples()!=_nval) { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType()); @@ -982,8 +987,8 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: oss << pfl->getNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !"; throw INTERP_KERNEL::Exception(oss.str()); } - int offset2=codeOfMesh[3*found+2]; - for(const int *pflId=pfl->begin();pflId!=pfl->end();pflId++) + mcIdType offset2=codeOfMesh[3*found+2]; + for(const mcIdType *pflId=pfl->begin();pflId!=pfl->end();pflId++) { if(*pflId(locId); default: throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::ConvertType : not managed type of field !"); } @@ -1040,61 +1045,61 @@ std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > MEDFileFi * \param [out] result All new entries will be appended on it. * \return false if the configuration of renumbering leads to an unnecessary resplit of input \a entriesOnSameDisc. If not true is returned (the most general case !) */ -bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, - const DataArrayInt *explicitIdsInMesh, - const std::vector& newCode, +bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + const DataArrayIdType *explicitIdsInMesh, + const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto >& result) { if(entriesOnSameDisc.empty()) return false; TypeOfField type=entriesOnSameDisc[0]->getType(); - int szEntities=0,szTuples=0; + mcIdType szEntities=0,szTuples=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++) { szEntities+=(*it)->_nval; szTuples+=(*it)->_end-(*it)->_start; } - int nbi=szTuples/szEntities; + mcIdType nbi=szTuples/szEntities; if(szTuples%szEntities!=0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks : internal error the splitting into same dicretization failed !"); - MCAuto renumTuples=DataArrayInt::New(); renumTuples->alloc(szTuples,1); - MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); - std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); - std::vector< const DataArrayInt * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); - std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); - std::vector< const DataArrayInt * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); - MCAuto newGeoTypesPerChunk4=DataArrayInt::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); + MCAuto renumTuples=DataArrayIdType::New(); renumTuples->alloc(szTuples,1); + MCAuto ranges=MEDCouplingUMesh::ComputeRangesFromTypeDistribution(newCode); + std::vector< MCAuto > newGeoTypesPerChunk(entriesOnSameDisc.size()); + std::vector< const DataArrayIdType * > newGeoTypesPerChunk2(entriesOnSameDisc.size()); + std::vector< MCAuto > newGeoTypesPerChunk_bis(entriesOnSameDisc.size()); + std::vector< const DataArrayIdType * > newGeoTypesPerChunk3(entriesOnSameDisc.size()); + MCAuto newGeoTypesPerChunk4=DataArrayIdType::New(); newGeoTypesPerChunk4->alloc(szEntities,nbi); int id=0; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { - int startOfEltIdOfChunk=(*it)->_start; - MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); - MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); - MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); + mcIdType startOfEltIdOfChunk=(*it)->_start; + MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); + MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); + MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); // - MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); + MCAuto tmp=rangeIdsForChunk->duplicateEachTupleNTimes(nbi); rangeIdsForChunk->rearrange(nbi); newGeoTypesPerChunk4->setPartOfValues1(tmp,(*it)->_tmp_work1-offset,(*it)->_tmp_work1+(*it)->_nval*nbi-offset,1,0,nbi,1); // newGeoTypesPerChunk[id]=rangeIdsForChunk; newGeoTypesPerChunk2[id]=rangeIdsForChunk; newGeoTypesPerChunk_bis[id]=idsInRrangeForChunk; newGeoTypesPerChunk3[id]=idsInRrangeForChunk; } - MCAuto newGeoTypesEltIdsAllGather=DataArrayInt::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); - MCAuto newGeoTypesEltIdsAllGather2=DataArrayInt::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); - MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); - MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); + MCAuto newGeoTypesEltIdsAllGather=DataArrayIdType::Aggregate(newGeoTypesPerChunk2); newGeoTypesPerChunk.clear(); newGeoTypesPerChunk2.clear(); + MCAuto newGeoTypesEltIdsAllGather2=DataArrayIdType::Aggregate(newGeoTypesPerChunk3); newGeoTypesPerChunk_bis.clear(); newGeoTypesPerChunk3.clear(); + MCAuto diffVals=newGeoTypesEltIdsAllGather->getDifferentValues(); + MCAuto renumEltIds=newGeoTypesEltIdsAllGather->buildPermArrPerLevel(); // - MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); + MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // MCAuto arrPart=arr->subArray(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); - arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); + arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,ToIdType(arrPart->getNumberOfComponents()),1); bool ret=false; - const int *idIt=diffVals->begin(); + const mcIdType *idIt=diffVals->begin(); std::list li(entriesOnSameDisc.begin(),entriesOnSameDisc.end()); - int offset2=0; - for(int i=0;igetNumberOfTuples();i++,idIt++) + mcIdType offset2=0; + for(mcIdType i=0;igetNumberOfTuples();i++,idIt++) { - MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); - MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); - int nbEntityElts=subIds->getNumberOfTuples(); + MCAuto ids=newGeoTypesEltIdsAllGather->findIdsEqual(*idIt); + MCAuto subIds=newGeoTypesEltIdsAllGather2->selectByTupleId(ids->begin(),ids->end()); + mcIdType nbEntityElts=subIds->getNumberOfTuples(); bool ret2; MCAuto eltToAdd=MEDFileFieldPerMeshPerTypePerDisc:: NewObjectOnSameDiscThanPool(type,(INTERP_KERNEL::NormalizedCellType)newCode[3*(*idIt)],subIds,!subIds->isIota(newCode[3*(*idIt)+1]),nbi, @@ -1122,13 +1127,13 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve * and corresponding entry erased from \a entriesOnSameDisc. * \return a newly allocated chunk */ -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt, - bool isPfl, int nbi, int offset, +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, + bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting) { - int nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); + mcIdType nbMeshEntities=idsOfMeshElt->getNumberOfTuples(); std::list< const MEDFileFieldPerMeshPerTypePerDisc *>::iterator it=entriesOnSameDisc.begin(); for(;it!=entriesOnSameDisc.end();it++) { @@ -1141,7 +1146,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypePerDisc::NewObjectO else if(!(*it)->_profile.empty()) { - const DataArrayInt *pfl=glob.getProfile((*it)->_profile.c_str()); + const DataArrayIdType *pfl=glob.getProfile((*it)->_profile.c_str()); if(pfl->isEqualWithoutConsideringStr(*idsOfMeshElt)) break; } @@ -1221,10 +1226,10 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::getDirect return ret; } -void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(mcIdType& start, mcIdType offset, mcIdType nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - std::vector pos=addNewEntryIfNecessary(field,offset,nbOfCells); - for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + 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); } @@ -1237,23 +1242,23 @@ void MEDFileFieldPerMeshPerTypeCommon::assignFieldNoProfile(int& start, int offs * \param [in] nbOfEltsInWholeMesh nb of elts of type \a this->_geo_type in \b WHOLE mesh * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored. */ -void MEDFileFieldPerMeshPerTypeCommon::assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +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 pos=addNewEntryIfNecessary(field,idsInPfl); - for(std::vector::const_iterator it=pos.begin();it!=pos.end();it++) + 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(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) +void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob) { _field_pm_pt_pd.resize(1); _field_pm_pt_pd[0]=MEDFileFieldPerMeshPerTypePerDisc::New(this,ON_NODES,-3); _field_pm_pt_pd[0]->assignNodeFieldNoProfile(start,field,arr,glob); } -void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - MCAuto pfl2=pfl->deepCopy(); + MCAuto pfl2=pfl->deepCopy(); if(!arr || !arr->isAllocated()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile : input array is null, or not allocated !"); _field_pm_pt_pd.resize(1); @@ -1261,15 +1266,15 @@ void MEDFileFieldPerMeshPerTypeCommon::assignNodeFieldProfile(int& start, const _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, int offset, int nbOfCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) { int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - int sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; - for(int j=0;jgetLocId()==locIdToFind) { @@ -1282,25 +1287,25 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const _field_pm_pt_pd.resize(sz+1); _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); } - std::vector ret(1,(int)sz); + std::vector ret(1,(mcIdType)sz); return ret; } else { - std::vector ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); - int sz2=ret2.size(); - std::vector ret3(sz2); - int k=0; - for(int i=0;i ret2=addNewEntryIfNecessaryGauss(field,offset,nbOfCells); + std::size_t sz2=ret2.size(); + std::vector ret3(sz2); + mcIdType k=0; + for(std::size_t i=0;igetLocId()==locIdToFind) { - _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); + _field_pm_pt_pd[j]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType(locIdToFind)); ret3[k++]=j; found=true; } @@ -1308,7 +1313,7 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const if(!found) { _field_pm_pt_pd.resize(sz+1); - _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); + _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,FromIdType(locIdToFind)); ret3[k++]=sz; } } @@ -1316,32 +1321,32 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const } } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da=disc2->getArrayOfDiscIds(); + const DataArrayIdType *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss (no profile) : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); - MCAuto retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafeSlice(offset,offset+nbOfCells,1); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); - std::vector ret(retTmp->begin(),retTmp->end()); + std::vector ret(retTmp->begin(),retTmp->end()); return ret; } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { TypeOfField type=field->getTypeOfField(); if(type!=ON_GAUSS_PT) { int locIdToFind=MEDFileFieldPerMeshPerTypePerDisc::ConvertType(type,0); - int sz=_field_pm_pt_pd.size(); + std::size_t sz=_field_pm_pt_pd.size(); bool found=false; - for(int j=0;jgetLocId()==locIdToFind) { @@ -1354,21 +1359,21 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const _field_pm_pt_pd.resize(sz+1); _field_pm_pt_pd[sz]=MEDFileFieldPerMeshPerTypePerDisc::New(this,type,locIdToFind); } - std::vector ret(1,0); + std::vector ret(1,0); return ret; } else { - std::vector ret2=addNewEntryIfNecessaryGauss(field,subCells); - int sz2=ret2.size(); - std::vector ret3(sz2); - int k=0; - for(int i=0;i ret2=addNewEntryIfNecessaryGauss(field,subCells); + std::size_t sz2=ret2.size(); + std::vector ret3(sz2); + mcIdType k=0; + for(std::size_t i=0;igetLocId()==locIdToFind) { @@ -1388,20 +1393,20 @@ std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessary(const } } -std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells) +std::vector MEDFileFieldPerMeshPerTypeCommon::addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells) { const MEDCouplingFieldDiscretization *disc=field->getDiscretization(); const MEDCouplingFieldDiscretizationGauss *disc2=dynamic_cast(disc); if(!disc2) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : invalid call to this method ! Internal Error !"); - const DataArrayInt *da=disc2->getArrayOfDiscIds(); + const DataArrayIdType *da=disc2->getArrayOfDiscIds(); if(!da) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : no localization ids per cell array available ! The input Gauss node field is maybe invalid !"); - MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); - MCAuto retTmp=da2->getDifferentValues(); + MCAuto da2=da->selectByTupleIdSafe(subCells->getConstPointer(),subCells->getConstPointer()+subCells->getNumberOfTuples()); + MCAuto retTmp=da2->getDifferentValues(); if(retTmp->presenceOfValue(-1)) throw INTERP_KERNEL::Exception("addNewEntryIfNecessaryGauss : some cells have no dicretization description !"); - std::vector ret(retTmp->begin(),retTmp->end()); + std::vector ret(retTmp->begin(),retTmp->end()); return ret; } @@ -1432,11 +1437,11 @@ void MEDFileFieldPerMeshPerTypeCommon::fillTypesOfFieldAvailable(std::set >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const +void MEDFileFieldPerMeshPerTypeCommon::fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const { - int 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(int i=0;igetCoarseData(types[i],dads[i],pfls[i],locs[i]); } @@ -1462,16 +1467,16 @@ std::string MEDFileFieldPerMeshPerTypeCommon::getMeshName() const return _father->getMeshName(); } -void MEDFileFieldPerMeshPerTypeCommon::getSizes(int& globalSz, int& nbOfEntries) const +void MEDFileFieldPerMeshPerTypeCommon::getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const { for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) { globalSz+=(*it)->getNumberOfTuples(); } - nbOfEntries+=(int)_field_pm_pt_pd.size(); + nbOfEntries+=(mcIdType)_field_pm_pt_pd.size(); } -int MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const +std::size_t MEDFileFieldPerMeshPerTypeCommon::getNumberOfComponents() const { return _father->getNumberOfComponents(); } @@ -1582,14 +1587,14 @@ void MEDFileFieldPerMeshPerTypeCommon::changeLocsRefsNamesGen(const std::vector< (*it1)->changeLocsRefsNamesGen(mapOfModif); } -MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) +MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) { if(_field_pm_pt_pd.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } - if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) + if(locId>=0 && locId(0); } -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId(mcIdType locId) const { if(_field_pm_pt_pd.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypeCommon::getLeafGivenLocId : no localizations for geotype \"" << getGeoTypeRepr() << "\" !"; throw INTERP_KERNEL::Exception(oss.str()); } - if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) + if(locId>=0 && locId,std::pair > >& entries) const +void MEDFileFieldPerMeshPerTypeCommon::fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const { int i=0; for(std::vector< MCAuto >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) @@ -1645,7 +1650,7 @@ void MEDFileFieldPerMeshPerTypeCommon::setLeaves(const std::vector< MCAuto< MEDF * \param [out] its - list of pair (start,stop) kept * \return bool - false if the type of field \a tof is not contained in \a this. */ -bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) +bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its) { bool ret(false); std::vector< MCAuto > newPmPtPd; @@ -1653,7 +1658,7 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField if((*it)->getType()==tof) { newPmPtPd.push_back(*it); - std::pair bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd(); + std::pair bgEnd; bgEnd.first=(*it)->getStart(); bgEnd.second=(*it)->getEnd(); (*it)->setNewStart(globalNum); globalNum=(*it)->getEnd(); its.push_back(bgEnd); @@ -1669,13 +1674,13 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlySpatialDiscretization(TypeOfField * \param [out] its - list of pair (start,stop) kept * \return bool - false if the type of field \a tof is not contained in \a this. */ -bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) +bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its) { if(_field_pm_pt_pd.size()<=idOfDisc) return false; MCAuto elt(_field_pm_pt_pd[idOfDisc]); 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(); + 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(); its.push_back(bgEnd); @@ -1683,7 +1688,7 @@ bool MEDFileFieldPerMeshPerTypeCommon::keepOnlyGaussDiscretization(std::size_t i return true; } -void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMeshPerTypeCommon::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc) { for(std::vector< MCAuto >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); @@ -1746,7 +1751,7 @@ MEDFileFieldPerMeshPerType *MEDFileFieldPerMeshPerType::deepCopy(MEDFileFieldPer return ret.retn(); } -void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const +void MEDFileFieldPerMeshPerType::getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const { if(_geo_type!=INTERP_KERNEL::NORM_ERROR) { @@ -1818,7 +1823,7 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField INTERP_KERNEL::AutoPtr locName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_geometry_type mgeoti; med_entity_type menti(ConvertIntoMEDFileType(type,geoType,mgeoti)); - int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName)); + med_int nbProfiles(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),menti,mgeoti,pflName,locName)); _field_pm_pt_pd.resize(nbProfiles); for(int i=0;i=nbProfiles2?MED_DESCENDING_FACE:MED_DESCENDING_EDGE;//not enough words to describe the beauty @@ -1846,7 +1851,7 @@ MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(med_idt fid, MEDFileField } } -MCAuto MEDFileFieldPerMeshPerType::Aggregate(int &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMeshPerType::Aggregate(mcIdType &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo) { MCAuto ret(MEDFileFieldPerMeshPerType::New(father,gt)); std::map > > m; @@ -1881,7 +1886,7 @@ 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); - int 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;i >& 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 !"); } @@ -2013,15 +2018,15 @@ void MEDFileFieldPerMesh::copyTinyInfoFrom(const MEDCouplingMesh *mesh) mesh->getTime(_mesh_iteration,_mesh_order); } -void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(mcIdType& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - int nbOfTypes=code.size()/3; - int offset=0; - for(int i=0;iassignFieldNoProfile(start,offset,nbOfCells,field,arr,glob,nasc); offset+=nbOfCells; } @@ -2036,18 +2041,18 @@ void MEDFileFieldPerMesh::assignFieldNoProfileNoRenum(int& start, const std::vec * \param [in] idsPerType is a vector containing the profiles needed to be created for MED file format. \b WARNING these processed MED file profiles can be subdivided again in case of Gauss points. * \param [in] mesh is the mesh coming from the MEDFileMesh instance in correspondence with the MEDFileField. The mesh inside the \a field is simply ignored. */ -void MEDFileFieldPerMesh::assignFieldProfile(int& start, const DataArrayInt *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) +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) { - int nbOfTypes(code.size()/3); - for(int i=0;iassignNodeFieldNoProfile(start,field,arr,glob); } -void MEDFileFieldPerMesh::assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc) { - int 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, int& start, const MEDFileFieldNameScope& nasc) +void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc) { for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc); @@ -2083,8 +2088,8 @@ void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFie void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const { - int nbOfTypes=_field_pm_pt.size(); - for(int i=0;icopyOptionsFrom(*this); _field_pm_pt[i]->writeLL(fid,nasc); @@ -2111,12 +2116,12 @@ void MEDFileFieldPerMesh::fillTypesOfFieldAvailable(std::set& types (*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::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 { - int sz=_field_pm_pt.size(); - std::vector< std::vector > > ret(sz); + 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(int i=0;igetGeoType(); _field_pm_pt[i]->fillFieldSplitedByType(ret[i],typesF[i],pfls[i],locs[i]); @@ -2140,7 +2145,7 @@ int MEDFileFieldPerMesh::getOrder() const return _father->getOrder(); } -int MEDFileFieldPerMesh::getNumberOfComponents() const +std::size_t MEDFileFieldPerMesh::getNumberOfComponents() const { return _father->getNumberOfComponents(); } @@ -2282,24 +2287,24 @@ const std::vector& MEDFileFieldPerMesh::getInfo() const * - 'notNullPfls' contains sz2 values that are extracted from 'pfls' in which null profiles have been removed. * 'code' and 'notNullPfls' are in MEDCouplingUMesh::checkTypeConsistencyAndContig format. */ -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) +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; - int nbOfArrs=geoTypes.size(); - for(int i=0;i geoTypes3(geoTypes.begin(),geoTypes.end()); - int nbOfDiffGeoTypes=geoTypes3.size(); + std::size_t nbOfDiffGeoTypes=geoTypes3.size(); code.resize(3*nbOfDiffGeoTypes); notNullPfls.resize(notNullPflsSz); notNullPflsSz=0; - int j=0; - for(int i=0;i notNullTmp; + std::vector notNullTmp; if(pfls[j]) notNullTmp.push_back(pfls[j]); j++; @@ -2311,17 +2316,17 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T } else break; - std::vector< std::pair > tmpDads(dads.begin()+startZone,dads.begin()+j); - std::vector tmpPfls(pfls.begin()+startZone,pfls.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]=(int)refType; + code[3*i]=(mcIdType)refType; std::vector refType2(1,refType); code[3*i+1]=ComputeNbOfElems(glob,type,refType2,tmpDads,tmpLocs); if(notNullTmp.empty()) code[3*i+2]=-1; else { - notNullPfls[notNullPflsSz]=DataArrayInt::Aggregate(notNullTmp); + notNullPfls[notNullPflsSz]=DataArrayIdType::Aggregate(notNullTmp); code[3*i+2]=notNullPflsSz++; } } @@ -2330,11 +2335,11 @@ void MEDFileFieldPerMesh::SortArraysPerType(const MEDFileFieldGlobsReal *glob, T /*! * 'dads' 'geoTypes' and 'locs' are input parameters that should have same size sz. sz should be >=1. */ -int MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs) +mcIdType MEDFileFieldPerMesh::ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs) { - int sz=dads.size(); - int ret=0; - for(int i=0;i(pt2); } -bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { if(getMeshName()!=meshName) return false; std::set typesToKeep; for(std::size_t i=0;i,std::pair > > entries; + std::vector< std::pair,std::pair > > entries; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept; std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries; getUndergroundDataArrayExt(entries); @@ -2464,10 +2469,10 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam DataArrayDouble *arr(dynamic_cast(arr0));//tony if(!arr0) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !"); - int sz=0; + mcIdType sz=0; if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !"); - for(std::vector< std::pair,std::pair > >::const_iterator it=entries.begin();it!=entries.end();it++) + for(std::vector< std::pair,std::pair > >::const_iterator it=entries.begin();it!=entries.end();it++) { if(typesToKeep.find((*it).first.first)!=typesToKeep.end()) { @@ -2477,31 +2482,31 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam else otherEntries.push_back(getLeafGivenTypeAndLocId((*it).first.first,(*it).first.second)); } - MCAuto renumDefrag=DataArrayInt::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); + MCAuto renumDefrag=DataArrayIdType::New(); renumDefrag->alloc(arr->getNumberOfTuples(),1); renumDefrag->fillWithZero(); //////////////////// - MCAuto explicitIdsOldInMesh=DataArrayInt::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after - int *workI2=explicitIdsOldInMesh->getPointer(); - int sz1=0,sz2=0,sid=1; + MCAuto explicitIdsOldInMesh=DataArrayIdType::New(); explicitIdsOldInMesh->alloc(sz,1);//sz is a majorant of the real size. A realloc will be done after + mcIdType *workI2=explicitIdsOldInMesh->getPointer(); + mcIdType sz1=0,sz2=0,sid=1; std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptML=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKept); // std::vector tupleIdOfStartOfNewChuncksV(entriesKeptML.size()); for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator itL1=entriesKeptML.begin();itL1!=entriesKeptML.end();itL1++,sid++) { // tupleIdOfStartOfNewChuncksV[sid-1]=sz2; - MCAuto explicitIdsOldInArr=DataArrayInt::New(); explicitIdsOldInArr->alloc(sz,1); - int *workI=explicitIdsOldInArr->getPointer(); + MCAuto explicitIdsOldInArr=DataArrayIdType::New(); explicitIdsOldInArr->alloc(sz,1); + mcIdType *workI=explicitIdsOldInArr->getPointer(); for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator itL2=(*itL1).begin();itL2!=(*itL1).end();itL2++) { - int delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1; + mcIdType delta1=(*itL2)->fillTupleIds(workI); workI+=delta1; sz1+=delta1; (*itL2)->setLocId(sz2); (*itL2)->_tmp_work1=(*itL2)->getStart(); - int delta2=(*itL2)->fillEltIdsFromCode(sz2,oldCode,glob,workI2); workI2+=delta2; sz2+=delta2; + 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); - int tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; + mcIdType tupleIdOfStartOfNewChuncks=arr->getNumberOfTuples()-sz2; //////////////////// - MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; + MCAuto permArrDefrag=renumDefrag->buildPermArrPerLevel(); renumDefrag=0; // perform redispatching of non concerned MEDFileFieldPerMeshPerTypePerDisc std::vector< MCAuto > otherEntriesNew; for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=otherEntries.begin();it!=otherEntries.end();it++) @@ -2515,7 +2520,7 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesKept.begin();it!=entriesKept.end();it++) { MCAuto elt=MEDFileFieldPerMeshPerTypePerDisc::New(*(*it)); - int newStart=elt->getLocId(); + mcIdType newStart=elt->getLocId(); elt->setLocId((*it)->getGeoType()); elt->setNewStart(newStart); elt->_tmp_work1=permArrDefrag->getIJ(elt->_tmp_work1,0); @@ -2524,7 +2529,7 @@ 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()); + MCAuto explicitIdsNewInMesh=renumO2N->selectByTupleId(explicitIdsOldInMesh->begin(),explicitIdsOldInMesh->end()); std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > entriesKeptPerDisc=MEDFileFieldPerMeshPerTypePerDisc::SplitPerDiscretization(entriesKeptNew2); bool ret=false; for(std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> >::const_iterator it4=entriesKeptPerDisc.begin();it4!=entriesKeptPerDisc.end();it4++) @@ -2550,12 +2555,12 @@ bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshNam * \param [in,out] globalNum a global numbering counter for the renumbering. * \param [out] its - list of pair (start,stop) kept */ -void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its) +void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector< std::pair > its2; + std::vector< std::pair > its2; if((*it)->keepOnlySpatialDiscretization(tof,globalNum,its2)) { ret.push_back(*it); @@ -2569,12 +2574,12 @@ void MEDFileFieldPerMesh::keepOnlySpatialDiscretization(TypeOfField tof, int &gl * \param [in,out] globalNum a global numbering counter for the renumbering. * \param [out] its - list of pair (start,stop) kept */ -void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its) +void MEDFileFieldPerMesh::keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its) { std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > ret; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { - std::vector< std::pair > its2; + std::vector< std::pair > its2; if((*it)->keepOnlyGaussDiscretization(idOfDisc,globalNum,its2)) { ret.push_back(*it); @@ -2623,10 +2628,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); // - std::vector< std::pair > dads; - std::vector pfls; - std::vector notNullPflsPerGeoType; - std::vector locs,code; + std::vector< std::pair > dads; + std::vector pfls; + std::vector notNullPflsPerGeoType; + std::vector locs; + std::vectorcode; std::vector 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); @@ -2638,16 +2644,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t throw INTERP_KERNEL::Exception(oss.str()); } // - std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); - std::vector< const DataArrayInt *> notNullPflsPerGeoType3(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) { - DataArrayInt *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + DataArrayIdType *arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); if(!arr) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); else { - MCAuto arr2(arr); + MCAuto arr2(arr); return finishField2(type,glob,dads,locs,geoTypes,mesh,arr,isPfl,arrOut,nasc); } } @@ -2655,7 +2661,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - int nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2671,15 +2677,16 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t } } -DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const +DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const { if(_field_pm_pt.empty()) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : no types field set !"); // - std::vector > dads; - std::vector pfls; - std::vector notNullPflsPerGeoType; - std::vector locs,code; + std::vector > dads; + std::vector pfls; + std::vector notNullPflsPerGeoType; + std::vector locs; + std::vector code; std::vector 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); @@ -2690,18 +2697,18 @@ 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 > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); - std::vector< const DataArrayInt *> notNullPflsPerGeoType3(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) { - MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); + MCAuto arr=mesh->checkTypeConsistencyAndContig(code,notNullPflsPerGeoType3); return finishField4(dads,arr,mesh->getNumberOfCells(),pfl); } else { if(code.size()!=3) throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getFieldOnMeshAtLevel : internal error #1 !"); - int nb=code[1]; + mcIdType nb=code[1]; if(code[2]==-1) { if(nb!=mesh->getNumberOfNodes()) @@ -2728,10 +2735,10 @@ void MEDFileFieldPerMesh::accept(MEDFileFieldVisitor& visitor) const } } -void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const +void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const { - int globalSz=0; - int nbOfEntries=0; + mcIdType globalSz=0; + mcIdType nbOfEntries=0; for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { (*it)->getSizes(globalSz,nbOfEntries); @@ -2744,7 +2751,7 @@ void MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { @@ -2762,7 +2769,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId throw INTERP_KERNEL::Exception(oss.str()); } -const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const +const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const { for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) { @@ -2786,7 +2793,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAn * \param [in] dts - (Distribution of types) = level 1 : meshes to aggregate. Level 2 : all geo type. Level 3 pair specifying geo type and number of elem in geotype. * \param [out] extractInfo - Gives information about the where the data comes from. It is a vector of triplet. First element in the triplet the mesh pos. The 2nd one the start pos. The 3rd the end pos. */ -MCAuto MEDFileFieldPerMeshPerTypePerDisc::Aggregate(int &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMeshPerTypePerDisc::Aggregate(mcIdType &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo) { MCAuto ret(new MEDFileFieldPerMeshPerTypePerDisc(father,tof)); if(pms.empty()) @@ -2803,20 +2810,20 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg INTERP_KERNEL::NormalizedCellType gt(pms[0].second->getGeoType()); std::size_t i(0); std::vector< std::pair > filteredDTS; - 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++) + 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 !"); std::vector >::const_iterator it1(pms.begin()); std::vector< std::pair >::const_iterator it2(filteredDTS.begin()); - int zeStart(start),nval(0); + mcIdType zeStart(start),nval(0); for(;it1!=pms.end();it1++,it2++) { if((*it1).first!=(*it2).first) throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::Aggregate : not implemented yet for generated profiles 2 !"); - int s1((*it1).second->getStart()),e1((*it1).second->getEnd()); + mcIdType s1((*it1).second->getStart()),e1((*it1).second->getEnd()); extractInfo.push_back(std::pair >((*it1).first,std::pair(s1,e1))); start+=e1-s1; nval+=((*it1).second)->getNumberOfVals(); @@ -2825,7 +2832,7 @@ MCAuto MEDFileFieldPerMeshPerTypePerDisc::Agg return ret; } -MCAuto MEDFileFieldPerMesh::Aggregate(int &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo) +MCAuto MEDFileFieldPerMesh::Aggregate(mcIdType &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo) { MCAuto ret(new MEDFileFieldPerMesh(father,pms[0]->getMeshName(),pms[0]->getMeshIteration(),pms[0]->getMeshOrder())); std::map > > m; @@ -2854,7 +2861,7 @@ MCAuto MEDFileFieldPerMesh::Aggregate(int &start, const std int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type) { int i=0; - int pos=std::distance(typmai2,std::find(typmai2,typmai2+MED_N_CELL_FIXED_GEO,type)); + 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++) { @@ -2863,14 +2870,14 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp return i; else { - int 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; } } - int 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 ret; + return (int)ret; } /*! @@ -2878,7 +2885,7 @@ int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellTyp * \param [in] mesh is \b NOT the global mesh, but the possibly reduced mesh. \a mesh parameter will be directly aggregated in the returned field */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, + const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { isPfl=false; @@ -2890,14 +2897,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const da->setName(""); if(type==ON_GAUSS_PT) { - int offset=0; - int nbOfArrs=dads.size(); - for(int i=0;i > 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); - int nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); - MCAuto di=DataArrayInt::New(); + mcIdType nbOfElems=ComputeNbOfElems(glob,type,geoTypes2,dads2,locs2); + MCAuto di=DataArrayIdType::New(); di->alloc(nbOfElems,1); di->iota(offset); const MEDFileFieldLoc& fl=glob->getLocalizationFromId(locs[i]); @@ -2917,9 +2924,9 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField(TypeOfField type, const * \param [in] mesh is the global mesh. */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector >& dads, const std::vector& locs, + const std::vector >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(da->isIota(mesh->getNumberOfCells())) return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); @@ -2934,8 +2941,8 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishField2(TypeOfField type, cons * This method is the complement of MEDFileFieldPerMesh::finishField2 method except that this method works for node profiles. */ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileFieldGlobsReal *glob, - const std::vector >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const + const std::vector >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto& arrOut, const MEDFileFieldNameScope& nasc) const { if(da->isIota(mesh->getNumberOfNodes())) return finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); @@ -2946,11 +2953,11 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField if(meshu->getNodalConnectivity()==0) { MCAuto ret=finishField(ON_CELLS,glob,dads,locs,mesh,isPfl,arrOut,nasc); - int nb=da->getNbOfElems(); - const int *ptr=da->getConstPointer(); + mcIdType nb=da->getNbOfElems(); + const mcIdType *ptr=da->getConstPointer(); MEDCouplingUMesh *meshuc=const_cast(meshu); meshuc->allocateCells(nb); - for(int i=0;iinsertNextCell(INTERP_KERNEL::NORM_POINT1,1,ptr+i); meshuc->finishInsertingCells(); ret->setMesh(meshuc); @@ -2963,14 +2970,14 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField // MCAuto ret=finishField(ON_NODES,glob,dads,locs,mesh,isPfl,arrOut,nasc); isPfl=true; - DataArrayInt *arr2=0; - MCAuto cellIds=mesh->getCellIdsFullyIncludedInNodeIds(da->getConstPointer(),da->getConstPointer()+da->getNbOfElems()); + 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 arr3(arr2); - int nnodes=mesh2->getNumberOfNodes(); - if(nnodes==(int)da->getNbOfElems()) + MCAuto arr3(arr2); + mcIdType nnodes=mesh2->getNumberOfNodes(); + if(nnodes==(mcIdType)da->getNbOfElems()) { - MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); + MCAuto da3=da->transformWithIndArrR(arr2->begin(),arr2->end()); arrOut->renumberInPlace(da3->getConstPointer()); mesh2->setName(mesh->getName().c_str()); ret->setMesh(mesh2); @@ -2992,24 +2999,24 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField /*! * This method is the most light method of field retrieving. */ -DataArray *MEDFileFieldPerMesh::finishField4(const std::vector >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const +DataArray *MEDFileFieldPerMesh::finishField4(const std::vector >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const { if(!pflIn) { - pflOut=DataArrayInt::New(); + pflOut=DataArrayIdType::New(); pflOut->alloc(nbOfElems,1); pflOut->iota(0); } else { - pflOut=const_cast(pflIn); + pflOut=const_cast(pflIn); pflOut->incrRef(); } - MCAuto safePfl(pflOut); + MCAuto safePfl(pflOut); MCAuto da=getOrCreateAndGetArray()->selectByTupleRanges(dads); const std::vector& infos=getInfo(); - int nbOfComp=infos.size(); - for(int i=0;isetInfoOnComponent(i,infos[i].c_str()); safePfl->incrRef(); return da.retn(); @@ -3122,9 +3129,9 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith INTERP_KERNEL::AutoCppPtr iter0(MFFPMIter::NewCell(entities)); for(iter0->begin();!iter0->finished();iter0->next()) { - int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_CELL ,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + 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)); - int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + 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) { @@ -3140,7 +3147,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith } if(MFFPMIter::IsPresenceOfNode(entities)) { - int 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(0); @@ -3155,7 +3162,7 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith std::vector dynGT(entities->getDynGTAvail()); for(std::vector::const_iterator it=dynGT.begin();it!=dynGT.end();it++) { - int 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)); @@ -3168,9 +3175,9 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWith iter0=MFFPMIter::NewCell(entities); for(iter0->begin();!iter0->finished();iter0->next()) { - int nbProfile (MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_FACE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + 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)); - int nbProfile2(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_DESCENDING_EDGE,typmai[iter0->current()],meshCsit+1,meshName,pflName,locName)); + 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) { diff --git a/src/MEDLoader/MEDFileFieldInternal.hxx b/src/MEDLoader/MEDFileFieldInternal.hxx index 48d24b5a7..bb2e318df 100644 --- a/src/MEDLoader/MEDFileFieldInternal.hxx +++ b/src/MEDLoader/MEDFileFieldInternal.hxx @@ -133,20 +133,20 @@ namespace MEDCoupling { public: static MEDFileFieldPerMeshPerTypePerDisc *NewOnRead(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); - static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int locId); + static MEDFileFieldPerMeshPerTypePerDisc *New(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType locId); static MEDFileFieldPerMeshPerTypePerDisc *New(const MEDFileFieldPerMeshPerTypePerDisc& other); std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; MEDFileFieldPerMeshPerTypePerDisc *deepCopy(MEDFileFieldPerMeshPerTypeCommon *father) const; - void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arrr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); - void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) 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); + void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arrr, MEDFileFieldGlobsReal& glob); + void getCoarseData(TypeOfField& type, std::pair& dad, std::string& pfl, std::string& loc) const; void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; const MEDFileFieldPerMeshPerTypeCommon *getFather() const; - void loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType& start, const MEDFileFieldNameScope& nasc); void loadBigArray(med_idt fid, const MEDFileFieldNameScope& nasc); - void setNewStart(int newValueOfStart); + void setNewStart(mcIdType newValueOfStart); int getIteration() const; int getOrder() const; double getTime() const; @@ -156,13 +156,13 @@ namespace MEDCoupling void fillTypesOfFieldAvailable(std::set& types) const; void setType(TypeOfField newType); INTERP_KERNEL::NormalizedCellType getGeoType() const; - int getNumberOfComponents() const; - int getNumberOfTuples() const; - int getStart() const { return _start; } - int getEnd() const { return _end; } - void setEnd(int endd) { _end=endd; } - int getNumberOfVals() const { return _nval; } - void incrementNbOfVals(int deltaNbVal); + std::size_t getNumberOfComponents() const; + mcIdType getNumberOfTuples() const; + mcIdType getStart() const { return _start; } + mcIdType getEnd() const { return _end; } + void setEnd(mcIdType endd) { _end=endd; } + mcIdType getNumberOfVals() const { return _nval; } + void incrementNbOfVals(mcIdType deltaNbVal); DataArray *getOrCreateAndGetArray(); const DataArray *getOrCreateAndGetArray() const; const std::vector& getInfo() const; @@ -170,29 +170,29 @@ namespace MEDCoupling void setProfile(const std::string& newPflName); std::string getLocalization() const; void setLocalization(const std::string& newLocName); - int getLocId() const { return _loc_id; } - void setLocId(int newId) const { _loc_id=newId; } + mcIdType getLocId() const { return _loc_id; } + void setLocId(mcIdType newId) const { _loc_id=newId; } void setFather(MEDFileFieldPerMeshPerTypeCommon *newFather) { _father=newFather; } void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); - void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, + void getFieldAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; - void fillValues(int discId, int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; - int fillEltIdsFromCode(int offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, int *ptToFill) const; - int fillTupleIds(int *ptToFill) const; - static int ConvertType(TypeOfField type, int locId); + void fillValues(int discId, mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const; + mcIdType fillEltIdsFromCode(mcIdType offset, const std::vector& codeOfMesh, const MEDFileFieldGlobsReal& glob, mcIdType *ptToFill) const; + mcIdType fillTupleIds(mcIdType *ptToFill) const; + static int ConvertType(TypeOfField type, mcIdType locId); static std::vector< std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> > SplitPerDiscretization(const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entries); - static bool RenumberChunks(int offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, - const DataArrayInt *explicitIdsInMesh, const std::vector& newCode, + static bool RenumberChunks(mcIdType offset, const std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + const DataArrayIdType *explicitIdsInMesh, const std::vector& newCode, MEDFileFieldGlobsReal& glob, DataArrayDouble *arr, std::vector< MCAuto >& result); - static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayInt *idsOfMeshElt, - bool isPfl, int nbi, int offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, + static MEDFileFieldPerMeshPerTypePerDisc *NewObjectOnSameDiscThanPool(TypeOfField typeF, INTERP_KERNEL::NormalizedCellType geoType, DataArrayIdType *idsOfMeshElt, + bool isPfl, mcIdType nbi, mcIdType offset, std::list< const MEDFileFieldPerMeshPerTypePerDisc *>& entriesOnSameDisc, MEDFileFieldGlobsReal& glob, bool ¬InExisting); - static MCAuto Aggregate(int &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo); + static MCAuto Aggregate(mcIdType &start, const std::vector >& pms, const std::vector< std::vector< std::pair > >& dts, TypeOfField tof, MEDFileFieldPerMeshPerType *father, std::vector > >& extractInfo); MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type):_type(type),_father(fath),_start(-1),_end(-1),_nval(-1),_loc_id(-5),_profile_it(-1) { } private: - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const PartDefinition *pd); - MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, int profileIt, const std::string& dummy); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const PartDefinition *pd); + MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerTypeCommon *fath, TypeOfField type, mcIdType profileIt, const std::string& dummy); MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other); MEDFileFieldPerMeshPerTypePerDisc(); private: @@ -200,18 +200,18 @@ namespace MEDCoupling private: TypeOfField _type; MEDFileFieldPerMeshPerTypeCommon *_father; - int _start; - int _end; + mcIdType _start; + mcIdType _end; //! _nval is different than end-start in case of ON_GAUSS_PT and ON_GAUSS_NE ! (_nval=(_end-_start)/nbi) - int _nval; + mcIdType _nval; std::string _profile; std::string _localization; //! only on assignment -3 : ON_NODES, -2 : ON_CELLS, -1 : ON_GAUSS_NE, 0..* : ON_GAUSS_PT - mutable int _loc_id; - mutable int _profile_it; + mutable mcIdType _loc_id; + mutable mcIdType _profile_it; MCAuto _pd; public: - mutable int _tmp_work1; + mutable mcIdType _tmp_work1; }; class MEDFileFieldVisitor; @@ -222,23 +222,23 @@ namespace MEDCoupling public: std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; - void assignFieldNoProfile(int& start, int offset, int nbOfCells, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignFieldProfile(bool isPflAlone, int& start, const DataArrayInt *multiTypePfl, const DataArrayInt *idsInPfl, DataArrayInt *locIds, int nbOfEltsInWholeMesh, const MEDCouplingFieldTemplate *field, const DataArray *arr, const MEDCouplingMesh *mesh, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + 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); + void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); const MEDFileFieldPerMesh *getFather() const; - void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc); void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; bool isUniqueLevel(int& dim) const; void fillTypesOfFieldAvailable(std::set& types) const; - void fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const; + void fillFieldSplitedByType(std::vector< std::pair >& dads, std::vector& types, std::vector& pfls, std::vector& locs) const; int getIteration() const; int getOrder() const; double getTime() const; std::string getMeshName() const; - void getSizes(int& globalSz, int& nbOfEntries) const; - int getNumberOfComponents() const; + void getSizes(mcIdType& globalSz, mcIdType& nbOfEntries) const; + std::size_t getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; void pushDiscretization(MEDFileFieldPerMeshPerTypePerDisc *disc); DataArray *getOrCreateAndGetArray(); @@ -250,14 +250,14 @@ namespace MEDCoupling std::vector getLocsReallyUsedMulti() const; void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); - MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId); - const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(int locId) const; - int getNumberOfLoc() const { return _field_pm_pt_pd.size(); } + MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId); + const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenLocId(mcIdType locId) const; + int getNumberOfLoc() const { return (int)_field_pm_pt_pd.size(); } int locIdOfLeaf(const MEDFileFieldPerMeshPerTypePerDisc *leaf) const; - void fillValues(int& startEntryId, std::vector< std::pair,std::pair > >& entries) const; + void fillValues(mcIdType& startEntryId, std::vector< std::pair,std::pair > >& entries) const; void setLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); - bool keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); - bool keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); + bool keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its); + bool keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its); static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); MEDFileFieldPerMeshPerTypeCommon(MEDFileFieldPerMesh *father):_father(father) { } void setFather(MEDFileFieldPerMesh *father); @@ -270,13 +270,13 @@ namespace MEDCoupling virtual void simpleRepr(int bkOffset, std::ostream& oss, int id) const = 0; virtual std::string getGeoTypeRepr() const = 0; virtual MEDFileFieldPerMeshPerTypeCommon *deepCopy(MEDFileFieldPerMesh *father) const = 0; - virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const = 0; + virtual void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFileFieldGlobsReal *glob, std::vector< std::pair >& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const = 0; protected: void deepCopyElements(); - std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells); - std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, int offset, int nbOfCells); - std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells); - std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayInt *subCells); + std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells); + std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, mcIdType offset, mcIdType nbOfCells); + std::vector addNewEntryIfNecessary(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells); + std::vector addNewEntryIfNecessaryGauss(const MEDCouplingFieldTemplate *field, const DataArrayIdType *subCells); private: MEDFileFieldPerMesh *_father; protected: @@ -288,7 +288,7 @@ namespace MEDCoupling public: static MEDFileFieldPerMeshPerType *New(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType); static MEDFileFieldPerMeshPerType *NewOnRead(med_idt fid, MEDFileFieldPerMesh *fath, TypeOfField type, INTERP_KERNEL::NormalizedCellType geoType, const MEDFileFieldNameScope& nasc, const PartDefinition *pd); - static MCAuto Aggregate(int &start, const std::vector< std::pair >& pms, const std::vector< std::vector< std::pair > >& dts, INTERP_KERNEL::NormalizedCellType gt, MEDFileFieldPerMesh *father, std::vector > >& extractInfo); + 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; INTERP_KERNEL::NormalizedCellType getGeoType() const; @@ -296,7 +296,7 @@ namespace MEDCoupling 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; + 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); @@ -317,7 +317,7 @@ namespace MEDCoupling 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; + 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: @@ -338,15 +338,15 @@ namespace MEDCoupling MEDFileFieldPerMesh *deepCopy(MEDFileAnyTypeField1TSWithoutSDA *father) const; void simpleRepr(int bkOffset,std::ostream& oss, int id) const; void copyTinyInfoFrom(const MEDCouplingMesh *mesh); - void assignFieldProfile(int& start, const DataArrayInt *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); - void assignFieldNoProfileNoRenum(int& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void assignNodeFieldNoProfile(int& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - void assignNodeFieldProfile(int& start, const DataArrayInt *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); - void loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc); + void 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); + void assignFieldNoProfileNoRenum(mcIdType& start, const std::vector& code, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void assignNodeFieldNoProfile(mcIdType& start, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); + void assignNodeFieldProfile(mcIdType& start, const DataArrayIdType *pfl, const MEDCouplingFieldTemplate *field, const DataArray *arr, MEDFileFieldGlobsReal& glob, const MEDFileFieldNameScope& nasc); + void loadOnlyStructureOfDataRecursively(med_idt fid, mcIdType &start, const MEDFileFieldNameScope& nasc); void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc); void writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const; void fillTypesOfFieldAvailable(std::set& types) const; - std::vector< std::vector< std::pair > > getFieldSplitedByType(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 > > getFieldSplitedByType(std::vector& types, std::vector< std::vector >& typesF, std::vector< std::vector >& pfls, std::vector< std::vector >& locs) const; void accept(MEDFileFieldVisitor& visitor) const; void getDimension(int& dim) const; bool isUniqueLevel(int& dim) const; @@ -357,7 +357,7 @@ namespace MEDCoupling int getMeshOrder() const { return _mesh_order; } std::string getMeshName() const; void setMeshName(const std::string& meshName); - int getNumberOfComponents() const; + std::size_t getNumberOfComponents() const; bool presenceOfMultiDiscPerGeoType() const; bool presenceOfStructureElements() const; bool onlyStructureElements() const; @@ -374,37 +374,37 @@ namespace MEDCoupling std::vector getLocsReallyUsedMulti() const; void convertMedBallIntoClassic(); bool changeMeshNames(const std::vector< std::pair >& modifTab); - bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); - void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair >& its); - void keepOnlyGaussDiscretization(std::size_t idOfDisc, int &globalNum, std::vector< std::pair >& its); + bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); + void keepOnlySpatialDiscretization(TypeOfField tof, mcIdType &globalNum, std::vector< std::pair >& its); + void keepOnlyGaussDiscretization(std::size_t idOfDisc, mcIdType &globalNum, std::vector< std::pair >& its); void changePflsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); void changeLocsRefsNamesGen(const std::vector< std::pair, std::string > >& mapOfModif); MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; - void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; - MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId); - const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const; - static MCAuto Aggregate(int &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo); + DataArray *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayIdType *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const; + void getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const; + MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId); + const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, mcIdType locId) const; + static MCAuto Aggregate(mcIdType &start, const std::vector& pms, const std::vector< std::vector< std::pair > >& dts, MEDFileAnyTypeField1TSWithoutSDA *father, std::vector > >& extractInfo); private: int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type); MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + const std::vector< std::pair >& dads, const std::vector& locs, const MEDCouplingMesh *mesh, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishField2(TypeOfField type, const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, + const std::vector< std::pair >& dads, const std::vector& locs, const std::vector& geoTypes, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; MEDCouplingFieldDouble *finishFieldNode2(const MEDFileFieldGlobsReal *glob, - const std::vector< std::pair >& dads, const std::vector& locs, - const MEDCouplingMesh *mesh, const DataArrayInt *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; - DataArray *finishField4(const std::vector< std::pair >& dads, const DataArrayInt *pflIn, int nbOfElems, DataArrayInt *&pflOut) const; + const std::vector< std::pair >& dads, const std::vector& locs, + const MEDCouplingMesh *mesh, const DataArrayIdType *da, bool& isPfl, MCAuto &arrOut, const MEDFileFieldNameScope& nasc) const; + DataArray *finishField4(const std::vector< std::pair >& dads, const DataArrayIdType *pflIn, mcIdType nbOfElems, DataArrayIdType *&pflOut) const; void assignNewLeaves(const std::vector< MCAuto< MEDFileFieldPerMeshPerTypePerDisc > >& leaves); static void 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); - static int ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); + const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& pfls, const std::vector& locs, + std::vector& code, std::vector& notNullPfls); + static mcIdType ComputeNbOfElems(const MEDFileFieldGlobsReal *glob, TypeOfField type, const std::vector& geoTypes, const std::vector< std::pair >& dads, const std::vector& locs); MEDFileFieldPerMesh(med_idt fid, MEDFileAnyTypeField1TSWithoutSDA *fath, int meshCsit, int meshIteration, int meshOrder, const MEDFileFieldNameScope& nasc, const MEDFileMesh *mm, const MEDFileEntities *entities); MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const MEDCouplingMesh *mesh); - MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath, const std::string& meshName, int meshIt, int meshOrd):_father(fath),_mesh_iteration(meshIt),_mesh_order(meshOrd) { } + 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 26bdcb1be..3f19a60c9 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.cxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.cxx @@ -134,11 +134,11 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2(int bg, int end, int step) const { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds2"; - int nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); + mcIdType nbOfEntriesToKeep=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); MCAuto ret=createNew(); ret->setInfo(_infos); - int sz=(int)_time_steps.size(); - int j=bg; + std::size_t sz=_time_steps.size(); + std::size_t j=bg; for(int i=0;i=0 && j,std::pair > >& entries) const +DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const { return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries); } -bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, +bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob) { bool ret=false; @@ -494,24 +494,24 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysR { case MED_FLOAT64: { - _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_INT32: { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_FLOAT32: { - _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileFloatField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } case MED_INT: { if(sizeof(med_int)==sizeof(int)) { - _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,numdt,numo,_infos); + _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt(numdt),FromMedInt(numo),_infos); break; } } @@ -532,10 +532,10 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::writeLL(med_idt fid, const MEDFileWri throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::writeLL : no time steps set !"); checkThatNbOfCompoOfTSMatchThis(); std::vector infos(getInfo()); - int 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(int i=0;iwriteLL(fid,opts,*this); } @@ -583,7 +583,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::unloadArrays() int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const { - return _time_steps.size(); + return (int)_time_steps.size(); } void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseEmptyTS() @@ -625,13 +625,13 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2(int bg, int end, int step) { static const char msg[]="MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds2"; - int nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); + mcIdType nbOfEntriesToKill=DataArrayInt::GetNumberOfItemGivenBESRelative(bg,end,step,msg); if(nbOfEntriesToKill==0) return ; std::size_t sz=_time_steps.size(); std::vector b(sz,true); int j=bg; - for(int i=0;i > newTS; for(std::size_t i=0;i > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const { - int lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::pair > ret(lgth); - for(int i=0;ifillIteration(ret[i]); return ret; } @@ -830,9 +830,9 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::changeLocsRefsNamesGen2(const std::ve std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTypesOfFieldAvailable() const { - int lgth=_time_steps.size(); + std::size_t lgth=_time_steps.size(); std::vector< std::vector > ret(lgth); - for(int i=0;ifillTypesOfFieldAvailable(ret[i]); return ret; } @@ -840,7 +840,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTSWithoutSDA::ge /*! * entry point for users that want to iterate into MEDFile DataStructure without any overhead. */ -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(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 +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(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 { return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs); } @@ -1049,7 +1049,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT(const MEDCoup _time_steps.push_back(obj); } -void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) +void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller) { if(!field) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !"); @@ -1076,7 +1076,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAutogetNumberOfComponents()!=(int)_infos.size()) + if(tsPtr->getNumberOfComponents()!=_infos.size()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !"; throw INTERP_KERNEL::Exception(oss.str()); @@ -1484,7 +1484,7 @@ std::vector< std::vector > MEDFileAnyTypeFieldMultiTS::getTypesOfFi return contentNotNullBase()->getTypesOfFieldAvailable(); } -std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(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 +std::vector< std::vector< std::pair > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(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 { return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); } @@ -1951,7 +1951,7 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT } template -MCAuto AggregateHelperF1TS(const std::vector< typename MLFieldTraits::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) +MCAuto AggregateHelperF1TS(const std::vector< typename MLFieldTraits::F1TSType const *>& f1tss, const std::vector< std::vector< std::pair > >& dts) { MCAuto< typename MLFieldTraits::F1TSType > ret(MLFieldTraits::F1TSType::New()); if(f1tss.empty()) @@ -1974,7 +1974,7 @@ MCAuto AggregateHelperF1TS(const std::vector< typename M } template -MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair > >& dts) +MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< typename MLFieldTraits::FMTSType const *>& fmtss, const std::vector< std::vector< std::pair > >& dts) { MCAuto< typename MLFieldTraits::FMTSType > ret(MLFieldTraits::FMTSType::New()); if(fmtss.empty()) @@ -2007,7 +2007,7 @@ MCAuto< MEDFileAnyTypeFieldMultiTS > AggregateHelperFMTS(const std::vector< type /*! * \a dts and \a ftmss are expected to have same size. */ -MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts) +MCAuto MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector& fmtss, const std::vector< std::vector< std::pair > >& dts) { if(fmtss.empty()) throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !"); diff --git a/src/MEDLoader/MEDFileFieldMultiTS.hxx b/src/MEDLoader/MEDFileFieldMultiTS.hxx index e51a9c9e9..dd7b082aa 100644 --- a/src/MEDLoader/MEDFileFieldMultiTS.hxx +++ b/src/MEDLoader/MEDFileFieldMultiTS.hxx @@ -85,12 +85,12 @@ namespace MEDCoupling MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob); - MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller); - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(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 void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(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 std::vector< std::vector > getTypesOfFieldAvailable() const; MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const; - MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; - MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob); + MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const; + MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector& oldCode, const std::vector& newCode, const DataArrayIdType *renumO2N, MEDFileFieldGlobsReal& glob); MEDLOADER_EXPORT void accept(MEDFileFieldVisitor& visitor) const; MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll, const MEDFileMeshes *ms, const MEDFileEntities *entities); MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const; @@ -265,12 +265,12 @@ namespace MEDCoupling MEDLOADER_EXPORT int getNumberOfComponents() const; MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector& levs) const; MEDLOADER_EXPORT std::vector< std::vector > getTypesOfFieldAvailable() const; - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > getFieldSplitedByType(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 std::vector< std::vector< std::pair > > getFieldSplitedByType(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 MCAuto getContent(); public: MEDLOADER_EXPORT virtual MEDFileAnyTypeFieldMultiTS *buildNewEmpty() const = 0; - 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); + 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; MEDLOADER_EXPORT std::vector getLocsReallyUsed() const; @@ -299,8 +299,8 @@ namespace MEDCoupling MEDLOADER_EXPORT static typename MLFieldTraits::FMTSType *New(med_idt fid, const std::string& fieldName, bool loadAll=true); 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 { return this->extractPartImpl(extractDef,mm); } + MEDLOADER_EXPORT typename MLFieldTraits::FMTSType *extractPartImpl(const std::map >& extractDef, MEDFileMesh *mm) const; + 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; @@ -308,21 +308,21 @@ namespace MEDCoupling MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; MEDLOADER_EXPORT typename Traits::FieldType *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; - MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; + MEDLOADER_EXPORT typename Traits::ArrayType *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayIdType *&pfl) const; // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const typename Traits::FieldType *field); - MEDLOADER_EXPORT void appendFieldProfile(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void appendFieldProfileFlatly(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + 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; 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 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; protected: const typename MLFieldTraits::FMTSWSDAType *contentNotNull() const; typename MLFieldTraits::FMTSWSDAType *contentNotNull(); - void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, bool smartPflKiller); + void appendFieldProfileGeneral(const typename Traits::FieldType *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, bool smartPflKiller); protected: ~MEDFileTemplateFieldMultiTS() { } MEDFileTemplateFieldMultiTS(); diff --git a/src/MEDLoader/MEDFileFieldOverView.cxx b/src/MEDLoader/MEDFileFieldOverView.cxx index 6064ef744..79545ebf8 100644 --- a/src/MEDLoader/MEDFileFieldOverView.cxx +++ b/src/MEDLoader/MEDFileFieldOverView.cxx @@ -42,9 +42,9 @@ MEDFileMeshStruct *MEDFileMeshStruct::New(const MEDFileMesh *mesh) std::size_t MEDFileMeshStruct::getHeapMemorySizeWithoutChildren() const { std::size_t ret(0); - for(std::vector< std::vector >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++) + 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); + ret+=_geo_types_distrib.capacity()*sizeof(std::vector); return ret; } @@ -69,7 +69,7 @@ MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh) int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { int j=0; - for(std::vector< std::vector >::const_iterator 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 sz=(*it1).size(); if(sz%3!=0) @@ -85,9 +85,9 @@ int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) co /*! * \sa MEDFileMeshStruct::doesManageGeoType */ -int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const +mcIdType MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const { - for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { std::size_t sz=(*it1).size(); if(sz%3!=0) @@ -105,7 +105,7 @@ int MEDFileMeshStruct::getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellTy */ bool MEDFileMeshStruct::doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const { - for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) + for(std::vector< std::vector >::const_iterator it1=_geo_types_distrib.begin();it1!=_geo_types_distrib.end();it1++) { std::size_t sz=(*it1).size(); if(sz%3!=0) @@ -131,7 +131,7 @@ void MEDFileMeshStruct::appendIfImplicitType(INTERP_KERNEL::NormalizedCellType t std::size_t nbGeo(sz/3); if(nbGeo!=1) throw INTERP_KERNEL::Exception(MSG); - std::vector arr(3); arr[0]=(int)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; + std::vector arr(3); arr[0]=(mcIdType)t; arr[1]=_mesh->buildImplicitPartIfAny(t); arr[2]=-1; _geo_types_distrib.push_back(arr); } @@ -180,7 +180,7 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::New 2 : null input pointer !"); @@ -196,25 +196,25 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels())); ret->selectPartOfNodes(pflOnNode); return ret.retn(); } -void MEDMeshMultiLev::setNodeReduction(const DataArrayInt *nr) +void MEDMeshMultiLev::setNodeReduction(const DataArrayIdType *nr) { if(nr) nr->incrRef(); - _node_reduction=const_cast(nr); + _node_reduction=const_cast(nr); } -void MEDMeshMultiLev::setCellReduction(const DataArrayInt *cr) +void MEDMeshMultiLev::setCellReduction(const DataArrayIdType *cr) { if(_pfls.size()!=1) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::setCellReduction : can be used only for single geo type mesh !"); - _pfls[0]=const_cast(cr); + _pfls[0]=const_cast(cr); if(cr) cr->incrRef(); } @@ -227,7 +227,7 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst throw INTERP_KERNEL::Exception("MEDMeshMultiLev::isFastlyTheSameStruct : unexpected situation for nodes !"); const MEDFileField1TSStructItem2& p(fst[0]); std::string pflName(p.getPflName()); - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(pflName.empty() && !nr) return true; if(!pflName.empty() && !nr) @@ -241,8 +241,8 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst std::size_t sz(fst.getNumberOfItems()); if(sz!=_geo_types.size()) return false; - int strt(0); - for(std::size_t i=0;i(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; } + { famIds=const_cast(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MCAuto > retSafe(sz); - std::vector< const DataArrayInt *> ret(sz); - int start(0); + std::vector< MCAuto > retSafe(sz); + std::vector< const DataArrayIdType *> ret(sz); + mcIdType start(0); for(std::size_t i=0;i tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); + MCAuto tmp(fids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else @@ -301,40 +301,40 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isW ret[i]=retSafe[i]; start+=lgth; } - famIds=DataArrayInt::Aggregate(ret); + famIds=DataArrayIdType::Aggregate(ret); } /*! * \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const { - const DataArrayInt *nids(_cell_num_ids); + const DataArrayIdType *nids(_cell_num_ids); if(!nids) { numIds=0; isWithoutCopy=true; return ; } std::size_t sz(_geo_types.size()); bool presenceOfPfls(false); for(std::size_t i=0;i(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; } + { numIds=const_cast(nids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); return ; } //bad luck the slowest part isWithoutCopy=false; - std::vector< MCAuto > retSafe(sz); - std::vector< const DataArrayInt *> ret(sz); - int start(0); + std::vector< MCAuto > retSafe(sz); + std::vector< const DataArrayIdType *> ret(sz); + mcIdType start(0); for(std::size_t i=0;i tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); + MCAuto tmp(nids->selectByTupleIdSafeSlice(start,start+lgth,1)); retSafe[i]=tmp->selectByTupleIdSafe(pfl->begin(),pfl->end()); } else @@ -344,19 +344,19 @@ void MEDMeshMultiLev::retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isW ret[i]=retSafe[i]; start+=lgth; } - numIds=DataArrayInt::Aggregate(ret); + numIds=DataArrayIdType::Aggregate(ret); } /*! * \param [out] famIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a famIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const { - const DataArrayInt *fids(_node_fam_ids); + const DataArrayIdType *fids(_node_fam_ids); if(!fids) { famIds=0; isWithoutCopy=true; return ; } - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) { isWithoutCopy=false; @@ -364,7 +364,7 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isW } else { - famIds=const_cast(fids); famIds->incrRef(); + famIds=const_cast(fids); famIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(famIds); } } @@ -373,12 +373,12 @@ void MEDMeshMultiLev::retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isW * \param [out] numIds - Can be null. If not null the instance has to be dealt by the caller (decrRef). * \param [out] isWithoutCopy - When true the returned instance \a numIds if not null is directly those in the data structure. */ -void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const +void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const { - const DataArrayInt *fids(_node_num_ids); + const DataArrayIdType *fids(_node_num_ids); if(!fids) { numIds=0; isWithoutCopy=true; return ; } - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) { isWithoutCopy=false; @@ -386,7 +386,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW } else { - numIds=const_cast(fids); numIds->incrRef(); + numIds=const_cast(fids); numIds->incrRef(); isWithoutCopy=_mesh->isObjectInTheProgeny(numIds); } } @@ -395,7 +395,7 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW * This method returns, if any, a new object containing the global node ids **BUT CONTRARY TO OTHER RETRIEVE METHODS** the returned object is always a NON AGGREGATED object. So the returned object if not null * can be used as this safely. */ -DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const +DataArrayIdType *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const { const MEDFileUMesh *umesh(dynamic_cast(_mesh)); if(!umesh) @@ -403,12 +403,12 @@ DataArrayInt *MEDMeshMultiLev::retrieveGlobalNodeIdsIfAny() const const PartDefinition *pd(umesh->getPartDefAtLevel(1)); if(!pd) return 0; - MCAuto tmp(pd->toDAI()); - const DataArrayInt *tmpCpp(tmp); + MCAuto tmp(pd->toDAI()); + const DataArrayIdType *tmpCpp(tmp); if(!tmpCpp) return 0; // - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(nr) return tmp->selectByTupleIdSafe(nr->begin(),nr->end()); else @@ -420,28 +420,28 @@ std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() return _geo_types; } -void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds) +void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayIdType *famIds) { _cell_fam_ids=famIds; if(famIds) famIds->incrRef(); } -void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayInt *numIds) +void MEDMeshMultiLev::setNumberIdsOnCells(DataArrayIdType *numIds) { _cell_num_ids=numIds; if(numIds) numIds->incrRef(); } -void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayInt *famIds) +void MEDMeshMultiLev::setFamilyIdsOnNodes(DataArrayIdType *famIds) { _node_fam_ids=famIds; if(famIds) famIds->incrRef(); } -void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayInt *numIds) +void MEDMeshMultiLev::setNumberIdsOnNodes(DataArrayIdType *numIds) { _node_num_ids=numIds; if(numIds) @@ -453,7 +453,7 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const std::size_t sz(_pfls.size()); if(id<0 || id>=(int)sz) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::getPflNameOfId : invalid input id !"); - const DataArrayInt *pfl(_pfls[id]); + const DataArrayIdType *pfl(_pfls[id]); if(!pfl) return std::string(""); return pfl->getName(); @@ -463,7 +463,7 @@ std::string MEDMeshMultiLev::getPflNameOfId(int id) const * Returns the number of cells having geometric type \a t. * The profiles are **NOT** taken into account here. */ -int MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const +mcIdType MEDMeshMultiLev::getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const { std::size_t sz(_nb_entities.size()); for(std::size_t i=0;ideepCopy(); if(pflName.empty() && nr) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 2 !"); if(!pflName.empty() && nr) { - MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); - MCAuto p2(nr->deepCopy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); + MCAuto p2(nr->deepCopy()); p1->sort(true); p2->sort(true); if(!p1->isEqualWithoutConsideringStr(*p2)) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !"); - p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr); MCAuto ret(vals->deepCopy()); ret->renumberInPlace(p1->begin()); return ret.retn(); } if(!pflName.empty() && !nr) { - MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); + MCAuto p1(globs->getProfile(pflName.c_str())->deepCopy()); p1->sort(true); if(!p1->isIota(getNumberOfNodes())) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 4 !"); @@ -523,11 +523,11 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& std::vector< const DataArray *> arr(s.size()); std::vector< MCAuto > arrSafe(s.size()); int iii(0); - int nc(vals->getNumberOfComponents()); + 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 DataArrayInt *thisP(_pfls[iii]); + const DataArrayIdType *thisP(_pfls[iii]); std::vector ps; for(std::size_t i=0;igetNbOfIntegrationPts(globs)); - const DataArrayInt *otherP(ps[0]->getPfl(globs)); + const DataArrayIdType *otherP(ps[0]->getPfl(globs)); const std::pair& strtStop(ps[0]->getStartStop()); MCAuto ret(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!thisP && !otherP) @@ -550,8 +550,8 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(thisP && otherP) { - MCAuto p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); - MCAuto p2(thisP->deepCopy()); + MCAuto p1(otherP->invertArrayN2O2O2N(getNumberOfCells(ps[0]->getGeo()))); + MCAuto p2(thisP->deepCopy()); p2->transformWithIndArr(p1->begin(),p1->end()); //p1=p2->findIdsNotEqual(-1); //p1=p2->selectByTupleIdSafe(p1->begin(),p1->end()); @@ -561,10 +561,10 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } if(!thisP && otherP) { - MCAuto p1(otherP->deepCopy()); + MCAuto p1(otherP->deepCopy()); p1->sort(true); p1->checkAllIdsInRange(0,getNumberOfCells(ps[0]->getGeo())); - p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,p1); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,p1); ret->rearrange(nbi*nc); ret->renumberInPlace(p1->begin()); ret->rearrange(nc); ret->setInfoOnComponents(compInfo); arrSafe[iii]=ret; arr[iii]=ret; continue; @@ -573,47 +573,47 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& } else { - std::vector< const DataArrayInt * >otherPS(ps.size()); + std::vector< const DataArrayIdType * >otherPS(ps.size()); std::vector< const DataArray * > arr2(ps.size()); std::vector< MCAuto > arr2Safe(ps.size()); - std::vector< const DataArrayInt * > nbis(ps.size()); - std::vector< MCAuto > nbisSafe(ps.size()); + std::vector< const DataArrayIdType * > nbis(ps.size()); + std::vector< MCAuto > nbisSafe(ps.size()); int jj(0); for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { int nbi((*it2)->getNbOfIntegrationPts(globs)); - const DataArrayInt *otherPfl((*it2)->getPfl(globs)); + const DataArrayIdType *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); if(!otherPfl) throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for cells 4 !"); arr2[jj]=ret2; arr2Safe[jj]=ret2; otherPS[jj]=otherPfl; - nbisSafe[jj]=DataArrayInt::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi); + nbisSafe[jj]=DataArrayIdType::New(); nbisSafe[jj]->alloc(otherPfl->getNumberOfTuples(),1); nbisSafe[jj]->fillWithValue(nbi); nbis[jj]=nbisSafe[jj]; } MCAuto arr3(DataArray::Aggregate(arr2)); - MCAuto otherP(DataArrayInt::Aggregate(otherPS)); - MCAuto zenbis(DataArrayInt::Aggregate(nbis)); - MCAuto otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); - MCAuto p1; + MCAuto otherP(DataArrayIdType::Aggregate(otherPS)); + MCAuto zenbis(DataArrayIdType::Aggregate(nbis)); + MCAuto otherPN(otherP->invertArrayN2O2O2N(getNumberOfCells(*it))); + MCAuto p1; if(thisP) - p1=DataArrayInt::FindPermutationFromFirstToSecond(otherP,thisP); + p1=DataArrayIdType::FindPermutationFromFirstToSecond(otherP,thisP); else p1=otherP->deepCopy(); - MCAuto zenbisN(zenbis->renumber(p1->begin())); + MCAuto zenbisN(zenbis->renumber(p1->begin())); zenbisN->computeOffsetsFull(); jj=0; for(std::vector::const_iterator it2=ps.begin();it2!=ps.end();it2++,jj++) { //int nbi((*it2)->getNbOfIntegrationPts(globs)); - const DataArrayInt *otherPfl((*it2)->getPfl(globs)); + const DataArrayIdType *otherPfl((*it2)->getPfl(globs)); const std::pair& strtStop((*it2)->getStartStop()); MCAuto ret2(vals->selectByTupleIdSafeSlice(strtStop.first,strtStop.second,1)); // - MCAuto p2(otherPfl->deepCopy()); + MCAuto p2(otherPfl->deepCopy()); p2->transformWithIndArr(otherPN->begin(),otherPN->end()); p2->transformWithIndArr(p1->begin(),p1->end()); - MCAuto idsN(p2->buildExplicitArrByRanges(zenbisN)); + MCAuto idsN(p2->buildExplicitArrByRanges(zenbisN)); arr3->setPartOfValuesBase3(ret2,idsN->begin(),idsN->end(),0,nc,1); } arrSafe[iii]=arr3; arr[iii]=arr3; @@ -627,43 +627,43 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem& /*! * This method is called to add NORM_POINT1 cells in \a this so that orphan nodes in \a verticesToAdd will be fetched. */ -void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr) +void MEDMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - int nbOfVertices(verticesToAdd->getNumberOfTuples()); + 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); _node_reduction=nr; nr->incrRef(); _nb_nodes+=nbOfVertices; - const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids); + const DataArrayIdType *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids); if(cf) { - MCAuto tmp; - std::vector a(2); + MCAuto tmp; + std::vector a(2); a[0]=cf; if(nf) tmp=nf->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end()); else { - tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); + tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); } a[1]=tmp; - _cell_fam_ids=DataArrayInt::Aggregate(a); + _cell_fam_ids=DataArrayIdType::Aggregate(a); } if(cn) { - MCAuto tmp; - std::vector a(2); + MCAuto tmp; + std::vector a(2); a[0]=cn; if(nn) tmp=nn->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end()); else { - tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); + tmp=DataArrayIdType::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero(); } a[1]=tmp; - _cell_num_ids=DataArrayInt::Aggregate(a); + _cell_num_ids=DataArrayIdType::Aggregate(a); } } @@ -671,7 +671,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh):_mesh(mesh),_nb_nodes( { } -MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):_mesh(mesh),_geo_types(gts),_nb_entities(nbEntities),_nb_nodes(nbNodes) +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 sz(_geo_types.size()); if(sz!=pfls.size() || sz!=nbEntities.size()) @@ -681,7 +681,7 @@ MEDMeshMultiLev::MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std { if(pfls[i]) pfls[i]->incrRef(); - _pfls[i]=const_cast(pfls[i]); + _pfls[i]=const_cast(pfls[i]); } } @@ -730,16 +730,16 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector bool cellFamIdsNoCpy(levs.size()==1); if(cellFamIdsNoCpy) { - const DataArrayInt *tmp(m->getFamilyFieldAtLevel(levs[0])); + const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(levs[0])); if(tmp) { tmp->incrRef(); - _cell_fam_ids=(const_cast(tmp)); + _cell_fam_ids=(const_cast(tmp)); } } else { - std::vector tmps(levs.size()); + std::vector tmps(levs.size()); bool f(true); for(std::size_t i=0;i f=false; } if(f && !tmps.empty()) - _cell_fam_ids=DataArrayInt::Aggregate(tmps); + _cell_fam_ids=DataArrayIdType::Aggregate(tmps); } bool cellNumIdsNoCpy(levs.size()==1); if(cellNumIdsNoCpy) { - const DataArrayInt *tmp(m->getNumberFieldAtLevel(levs[0])); + const DataArrayIdType *tmp(m->getNumberFieldAtLevel(levs[0])); if(tmp) { tmp->incrRef(); - _cell_num_ids=(const_cast(tmp)); + _cell_num_ids=(const_cast(tmp)); } } else { - std::vector tmps(levs.size()); + std::vector tmps(levs.size()); bool n(true); for(std::size_t i=0;i n=false; } if(n && !tmps.empty()) - _cell_num_ids=DataArrayInt::Aggregate(tmps); + _cell_num_ids=DataArrayIdType::Aggregate(tmps); } // node part { - const DataArrayInt *tmp(m->getFamilyFieldAtLevel(1)); + const DataArrayIdType *tmp(m->getFamilyFieldAtLevel(1)); if(tmp) { tmp->incrRef(); - _node_fam_ids=(const_cast(tmp)); + _node_fam_ids=(const_cast(tmp)); } } { - const DataArrayInt *tmp(m->getNumberFieldAtLevel(1)); + const DataArrayIdType *tmp(m->getNumberFieldAtLevel(1)); if(tmp) { tmp->incrRef(); - _node_num_ids=(const_cast(tmp)); + _node_num_ids=(const_cast(tmp)); } } } -MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDUMeshMultiLev *MEDUMeshMultiLev::New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDUMeshMultiLev(m,gts,pfls,nbEntities); } -MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +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 sz(gts.size()); if(sz<1) @@ -820,23 +820,23 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vectorgetMeshDimension()); if(isSameDim && isNoPfl && m->getGeoTypesAtLevel(lev)==gts)//optimized part { - const DataArrayInt *famIds(m->getFamilyFieldAtLevel(lev)); + const DataArrayIdType *famIds(m->getFamilyFieldAtLevel(lev)); if(famIds) - { _cell_fam_ids=const_cast(famIds); famIds->incrRef(); } - const DataArrayInt *numIds(m->getNumberFieldAtLevel(lev)); + { _cell_fam_ids=const_cast(famIds); famIds->incrRef(); } + const DataArrayIdType *numIds(m->getNumberFieldAtLevel(lev)); if(numIds) - { _cell_num_ids=const_cast(numIds); numIds->incrRef(); } + { _cell_num_ids=const_cast(numIds); numIds->incrRef(); } famIds=m->getFamilyFieldAtLevel(1); if(famIds) - { _node_fam_ids=const_cast(famIds); famIds->incrRef(); } + { _node_fam_ids=const_cast(famIds); famIds->incrRef(); } numIds=m->getNumberFieldAtLevel(1); if(numIds) - { _node_num_ids=const_cast(numIds); numIds->incrRef(); } + { _node_num_ids=const_cast(numIds); numIds->incrRef(); } return ; } // - std::vector< MCAuto > famIdsSafe(sz); - std::vector famIds(sz); + std::vector< MCAuto > famIdsSafe(sz); + std::vector famIds(sz); bool f(true); for(std::size_t i=0;i > numIdsSafe(sz); - std::vector numIds(sz); + _cell_fam_ids=DataArrayIdType::Aggregate(famIds); + std::vector< MCAuto > numIdsSafe(sz); + std::vector numIds(sz); bool n(true); for(std::size_t i=0;igetFamilyFieldAtLevel(1)); + const DataArrayIdType *nodeFamIds(m->getFamilyFieldAtLevel(1)); if(nodeFamIds) - { _node_fam_ids=const_cast(nodeFamIds); nodeFamIds->incrRef(); } - const DataArrayInt *nodeNumIds(m->getNumberFieldAtLevel(1)); + { _node_fam_ids=const_cast(nodeFamIds); nodeFamIds->incrRef(); } + const DataArrayIdType *nodeNumIds(m->getNumberFieldAtLevel(1)); if(nodeNumIds) - { _node_num_ids=const_cast(nodeNumIds); nodeNumIds->incrRef(); } + { _node_num_ids=const_cast(nodeNumIds); nodeNumIds->incrRef(); } } -void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) +void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) return ; std::size_t sz(_parts.size()); - std::vector< MCAuto > a(sz); - std::vector< const DataArrayInt *> aa(sz); + 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())); - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); - int tmp=-1; - MCAuto o2n(m2->getNodeIdsInUse(tmp)); + mcIdType tmp=-1; + MCAuto o2n(m2->getNodeIdsInUse(tmp)); a[i]=o2n->invertArrayO2N2N2O(tmp); aa[i]=a[i]; if(pfl) _pfls[i]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end()); @@ -894,7 +894,7 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) _pfls[i]=cellIdsSafe; } if(!aa.empty()) - _node_reduction=DataArrayInt::Aggregate(aa);//general case + _node_reduction=DataArrayIdType::Aggregate(aa);//general case else _node_reduction=pflNodes->deepCopy();//case where no cells in read mesh. _node_reduction->sort(true); @@ -904,9 +904,9 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !"); // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts... - MCAuto pflNodes2(pflNodes->deepCopy()); + MCAuto pflNodes2(pflNodes->deepCopy()); pflNodes2->sort(true); - MCAuto diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); + MCAuto diff(pflNodes2->buildSubstractionOptimized(_node_reduction)); appendVertices(diff,pflNodes2); } @@ -933,7 +933,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const * If returned value is false output pointer \a coords is not the internal pointer. If returned value is true output pointer \a coords is directly the internal pointer. * If true is returned, the \a coords output parameter should be used with care (non const method call) to avoid to change the internal state of MEDFileUMesh instance. */ -bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const +bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const { const DataArrayDouble *tmp(0); if(_parts.empty()) @@ -943,7 +943,7 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * if(!tmp) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !"); MCAuto a(const_cast(tmp)); tmp->incrRef(); - int szBCE(0),szD(0),szF(0); + mcIdType szBCE(0),szD(0),szF(0); bool isPolyh(false); int iii(0); for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) @@ -952,45 +952,45 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * if(!cur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : a part is null !"); // - const DataArrayInt *pfl(_pfls[iii]); + const DataArrayIdType *pfl(_pfls[iii]); MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - int curNbCells(cur->getNumberOfCells()); + mcIdType curNbCells(cur->getNumberOfCells()); szBCE+=curNbCells; if((*it)->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) szD+=cur->getNodalConnectivity()->getNumberOfTuples()+curNbCells; else { isPolyh=true; - MCAuto tmp2(cur->computeEffectiveNbOfNodesPerCell()); - szD+=tmp2->accumulate(0)+curNbCells; + MCAuto tmp2(cur->computeEffectiveNbOfNodesPerCell()); + szD+=tmp2->accumulate((std::size_t)0)+curNbCells; szF+=2*curNbCells+cur->getNodalConnectivity()->getNumberOfTuples(); } } MCAuto b(DataArrayByte::New()); b->alloc(szBCE,1); char *bPtr(b->getPointer()); - MCAuto c(DataArrayInt::New()); c->alloc(szBCE,1); int *cPtr(c->getPointer()); - MCAuto d(DataArrayInt::New()); d->alloc(szD,1); int *dPtr(d->getPointer()); - MCAuto e(DataArrayInt::New()),f(DataArrayInt::New()); int *ePtr(0),*fPtr(0); + 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(0),*fPtr(0); if(isPolyh) { e->alloc(szBCE,1); ePtr=e->getPointer(); f->alloc(szF,1); fPtr=f->getPointer(); } - int k(0); + mcIdType k(0); iii=0; for(std::vector< MCAuto >::const_iterator it=_parts.begin();it!=_parts.end();it++,iii++) { const MEDCoupling1GTUMesh *cur(*it); // - const DataArrayInt *pfl(_pfls[iii]); + const DataArrayIdType *pfl(_pfls[iii]); MCAuto cur2; if(!pfl) { cur2=const_cast(cur); cur2->incrRef(); } else { cur2=dynamic_cast(cur->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); cur=cur2; } // - int curNbCells(cur->getNumberOfCells()); + 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 !"); @@ -1000,15 +1000,15 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * std::fill(bPtr,bPtr+curNbCells,gtvtk); bPtr+=curNbCells; const MEDCoupling1SGTUMesh *scur(dynamic_cast(cur)); const MEDCoupling1DGTUMesh *dcur(dynamic_cast(cur)); - const int *connPtr(cur->getNodalConnectivity()->begin()); + const mcIdType *connPtr(cur->getNodalConnectivity()->begin()); if(!scur && !dcur) throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : internal error !"); if(scur) { if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_HEXA27) { - int nnpc(scur->getNumberOfNodesPerCell()); - for(int i=0;igetNumberOfNodesPerCell()); + for(mcIdType i=0;igetNodalConnectivityIndex()->begin()); + const mcIdType *connIPtr(dcur->getNodalConnectivityIndex()->begin()); if(cur->getCellModelEnum()!=INTERP_KERNEL::NORM_POLYHED) { for(int i=0;i s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1); - *dPtr++=(int)s.size(); + std::set s(connPtr+connIPtr[0],connPtr+connIPtr[1]); s.erase(-1); + *dPtr++=(mcIdType)s.size(); dPtr=std::copy(s.begin(),s.end(),dPtr); - *cPtr++=k; k+=(int)s.size()+1; + *cPtr++=k; k+=(mcIdType)s.size()+1; } } if(isPolyh) @@ -1057,16 +1057,16 @@ bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte * { std::fill(ePtr,ePtr+curNbCells,-1); ePtr+=curNbCells; } else { - int kk(0); + mcIdType kk(0); for(int i=0;iisObjectInTheProgeny(coords); } -void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const +void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const { - const DataArrayInt *nr(_node_reduction); + const DataArrayIdType *nr(_node_reduction); if(!nr) return ; if(nodalConnVTK->empty() && !polyhedNodalConnVTK) @@ -1100,13 +1100,13 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MCAuto& coords, coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end())); return ; } - int sz(coords->getNumberOfTuples()); + mcIdType sz(coords->getNumberOfTuples()); std::vector b(sz,false); - const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); + const mcIdType *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end()); while(work!=endW) { - int nb(*work++); - for(int i=0;i=0 && *work& coords, work=polyhedNodalConnVTK->begin(); endW=polyhedNodalConnVTK->end(); while(work!=endW) { - int nb(*work++); - for(int i=0;i=0 && *work& coords, } } } - int szExp(std::count(b.begin(),b.end(),true)); - if(szExp!=nr->getNumberOfTuples()) + 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 ! - MCAuto o2n(DataArrayInt::New()); o2n->alloc(sz,1); - int *o2nPtr(o2n->getPointer()); + MCAuto o2n(DataArrayIdType::New()); o2n->alloc(sz,1); + mcIdType *o2nPtr(o2n->getPointer()); int newId(0); for(int i=0;ibegin()); - MCAuto n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); - MCAuto perm(DataArrayInt::FindPermutationFromFirstToSecond(n2o,nr)); - const int *permPtr(perm->begin()); - int *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); + const mcIdType *o2nPtrc(o2n->begin()); + MCAuto n2o(o2n->invertArrayO2N2N2O(nr->getNumberOfTuples())); + MCAuto perm(DataArrayIdType::FindPermutationFromFirstToSecond(n2o,nr)); + const mcIdType *permPtr(perm->begin()); + mcIdType *work2(nodalConnVTK->getPointer()),*endW2(nodalConnVTK->getPointer()+nodalConnVTK->getNumberOfTuples()); while(work2!=endW2) { - int nb(*work2++); - for(int i=0;i& coords, work2=polyhedNodalConnVTK->getPointer(); endW2=polyhedNodalConnVTK->getPointer()+polyhedNodalConnVTK->getNumberOfTuples(); while(work2!=endW2) { - int nb(*work2++); - for(int i=0;i& coords, } -void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr) +void MEDUMeshMultiLev::appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr) { - int 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); - for(int i=0;igetIJ(i,0)); + mcIdType pt(verticesToAdd->getIJ(i,0)); elt->insertNextCell(&pt,&pt+1); } if(_parts.empty()) @@ -1196,7 +1196,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh initStdFieldOfIntegers(m); } -MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true) +MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDMeshMultiLev(m,nbOfNodes,gts,pfls,nbEntities),_is_internal(true) { initStdFieldOfIntegers(m); } @@ -1208,18 +1208,18 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMult void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMesh *m) { // ids fields management - const DataArrayInt *tmp(0); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(0); if(tmp) { tmp->incrRef(); - _cell_fam_ids=const_cast(tmp); + _cell_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(0); if(tmp) { tmp->incrRef(); - _cell_num_ids=const_cast(tmp); + _cell_num_ids=const_cast(tmp); } // tmp=0; @@ -1227,26 +1227,26 @@ void MEDStructuredMeshMultiLev::initStdFieldOfIntegers(const MEDFileStructuredMe if(tmp) { tmp->incrRef(); - _node_fam_ids=const_cast(tmp); + _node_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(1); if(tmp) { tmp->incrRef(); - _node_num_ids=const_cast(tmp); + _node_num_ids=const_cast(tmp); } // faces (if any) tmp=m->getFamilyFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _face_fam_ids=const_cast(tmp); + _face_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _face_num_ids=const_cast(tmp); + _face_num_ids=const_cast(tmp); } } @@ -1269,7 +1269,7 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu MEDCoupling1GTUMesh *facesIfPresent((static_cast(_mesh))->getImplicitFaceMesh()); if(!facesIfPresent) return false; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; MCAuto facesIfPresent2(facesIfPresent); facesIfPresent->incrRef(); @@ -1285,39 +1285,39 @@ bool MEDStructuredMeshMultiLev::prepareForImplicitUnstructuredMeshCase(MEDMeshMu void MEDStructuredMeshMultiLev::dealWithImplicitUnstructuredMesh(const MEDFileMesh *m) { - const DataArrayInt *tmp(0); + const DataArrayIdType *tmp(0); tmp=m->getFamilyFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _cell_fam_ids=const_cast(tmp); + _cell_fam_ids=const_cast(tmp); } tmp=m->getNumberFieldAtLevel(-1); if(tmp) { tmp->incrRef(); - _cell_num_ids=const_cast(tmp); + _cell_num_ids=const_cast(tmp); } } -void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes) +void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayIdType *pflNodes) { if(!pflNodes || !pflNodes->isAllocated()) return ; - std::vector ngs(getNodeGridStructure()); - MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); - MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(ngs.size()))); + std::vector ngs(getNodeGridStructure()); + MCAuto conn(MEDCouplingStructuredMesh::Build1GTNodalConnectivity(&ngs[0],&ngs[0]+ngs.size())); + MCAuto m(MEDCoupling1SGTUMesh::New("",MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension((int)ngs.size()))); m->setNodalConnectivity(conn); - const DataArrayInt *pfl(_pfls[0]); + const DataArrayIdType *pfl(_pfls[0]); if(pfl) { m=dynamic_cast(m->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); } - DataArrayInt *cellIds=0; + DataArrayIdType *cellIds=0; m->fillCellIdsToKeepFromNodeIds(pflNodes->begin(),pflNodes->end(),true,cellIds); - MCAuto cellIdsSafe(cellIds); + MCAuto cellIdsSafe(cellIds); MCAuto m2(m->buildPartOfMySelfKeepCoords(cellIds->begin(),cellIds->end())); - int tmp=-1; + mcIdType tmp=-1; _node_reduction=m2->getNodeIdsInUse(tmp); if(pfl) _pfls[0]=pfl->selectByTupleIdSafe(cellIds->begin(),cellIds->end()); @@ -1332,7 +1332,7 @@ MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector return new MEDCMeshMultiLev(m,levs); } -MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDCMeshMultiLev(m,gts,pfls,nbEntities); } @@ -1355,7 +1355,7 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector } } -MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : null input pointer !"); @@ -1382,9 +1382,9 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDCMeshMultiLev& other):MEDStructuredM { } -std::vector MEDCMeshMultiLev::getNodeGridStructure() const +std::vector MEDCMeshMultiLev::getNodeGridStructure() const { - std::vector ret(_coords.size()); + std::vector ret(_coords.size()); for(std::size_t i=0;i<_coords.size();i++) ret[i]=_coords[i]->getNumberOfTuples(); return ret; @@ -1395,16 +1395,16 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MCAuto nnr; - std::vector cgs,ngs(getNodeGridStructure()); + MCAuto nnr; + std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { - std::vector< std::pair > cellParts; + std::vector< std::pair > cellParts; MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { @@ -1423,7 +1423,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const else { MCAuto m(MEDCouplingCMesh::New()); - for(std::size_t i=0;isetCoordsAt(i,_coords[i]); MCAuto m2(m->build1SGTUnstructured()); MCAuto m3=dynamic_cast(m2->buildPartOfMySelfKeepCoords(pfl->begin(),pfl->end())); @@ -1432,15 +1432,15 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } - const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); + const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); @@ -1478,7 +1478,7 @@ MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLi return new MEDCurveLinearMeshMultiLev(m,levs); } -MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) +MEDCurveLinearMeshMultiLev *MEDCurveLinearMeshMultiLev::New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities) { return new MEDCurveLinearMeshMultiLev(m,gts,pfls,nbEntities); } @@ -1497,7 +1497,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearM _structure=m->getMesh()->getNodeGridStructure(); } -MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) +MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities):MEDStructuredMeshMultiLev(m,m->getNumberOfNodes(),gts,pfls,nbEntities) { if(!m) throw INTERP_KERNEL::Exception("MEDCurveLinearMeshMultiLev constructor 2 : null input pointer !"); @@ -1521,7 +1521,7 @@ MEDCurveLinearMeshMultiLev::MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshM { } -std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const +std::vector MEDCurveLinearMeshMultiLev::getNodeGridStructure() const { return _structure; } @@ -1531,27 +1531,27 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const MEDMeshMultiLev *retSpecific(0); if(prepareForImplicitUnstructuredMeshCase(retSpecific)) return retSpecific; - const DataArrayInt *pfl(0),*nr(_node_reduction); + const DataArrayIdType *pfl(0),*nr(_node_reduction); if(!_pfls.empty()) pfl=_pfls[0]; - MCAuto nnr; - std::vector cgs,ngs(getNodeGridStructure()); + MCAuto nnr; + std::vector cgs,ngs(getNodeGridStructure()); cgs.resize(ngs.size()); - std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); + std::transform(ngs.begin(),ngs.end(),cgs.begin(),std::bind2nd(std::plus(),-1)); if(pfl) { - std::vector< std::pair > cellParts,nodeParts; + std::vector< std::pair > cellParts,nodeParts; MCAuto ret2; if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts)) { nodeParts=cellParts; - std::vector st(ngs.size()); + std::vector st(ngs.size()); for(std::size_t i=0;i p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); + MCAuto p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts)); MCAuto ret(new MEDCurveLinearMeshMultiLev(*this)); ret->_is_internal=false; if(nr) @@ -1573,15 +1573,15 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const { m3->zipCoords(); nnr=nr->deepCopy(); nnr->sort(true); ret->setNodeReduction(nnr); } ret2=(MEDUMeshMultiLev *)ret; ret2->incrRef(); } - const DataArrayInt *famIds(_cell_fam_ids),*numIds(_cell_num_ids); + const DataArrayIdType *famIds(_cell_fam_ids),*numIds(_cell_num_ids); if(famIds) { - MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(famIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setFamilyIdsOnCells(tmp); } if(numIds) { - MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); + MCAuto tmp(numIds->selectByTupleIdSafe(pfl->begin(),pfl->end())); ret2->setNumberIdsOnCells(tmp); } return ret2.retn(); @@ -1595,7 +1595,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const } } -void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const +void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const { isInternal=_is_internal; nodeStrct=_structure; @@ -1611,7 +1611,7 @@ MEDFileField1TSStructItem2::MEDFileField1TSStructItem2() { } -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(DataArrayInt::New()),_loc(d),_nb_of_entity(-1) +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) { _pfl->setName(c.c_str()); } @@ -1623,13 +1623,13 @@ void MEDFileField1TSStructItem2::checkWithMeshStructForCells(const MEDFileMeshSt MEDFileMeshStruct *mstUnConstCasted(const_cast(mst)); mstUnConstCasted->appendIfImplicitType(_geo_type); } - int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,1,globs); } void MEDFileField1TSStructItem2::checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) { - int 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); } @@ -1641,7 +1641,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()); - int nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); + mcIdType nbOfEnt=mst->getNumberOfElemsOfGeoType(_geo_type); checkInRange(nbOfEnt,loc.getNumberOfGaussPoints(),globs); } @@ -1650,9 +1650,9 @@ int MEDFileField1TSStructItem2::getNbOfIntegrationPts(const MEDFileFieldGlobsRea if(_loc.empty()) { if(getPflName().empty()) - return (_start_end.second-_start_end.first)/_nb_of_entity; + return (int)((_start_end.second-_start_end.first)/_nb_of_entity); else - return (_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples(); + return (int)((_start_end.second-_start_end.first)/getPfl(globs)->getNumberOfTuples()); } else { @@ -1666,7 +1666,7 @@ std::string MEDFileField1TSStructItem2::getPflName() const return _pfl->getName(); } -const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const +const DataArrayIdType *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsReal *globs) const { if(!_pfl->isAllocated()) { @@ -1683,7 +1683,7 @@ const DataArrayInt *MEDFileField1TSStructItem2::getPfl(const MEDFileFieldGlobsRe * \param [in] nbOfEntity - number of entity that can be either cells or nodes. Not other possibility. * \param [in] nip - number of integration points. 1 for ON_CELLS and NO_NODES */ -void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) +void MEDFileField1TSStructItem2::checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs) { _nb_of_entity=nbOfEntity; if(_pfl->getName().empty()) @@ -1696,14 +1696,14 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED { if(!globs) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no globals found in file !"); - const DataArrayInt *pfl=globs->getProfile(_pfl->getName().c_str()); + const DataArrayIdType *pfl=globs->getProfile(_pfl->getName().c_str()); if(!pfl) throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Presence of a profile on field whereas no such profile found in file !"); pfl->checkAllIdsInRange(0,nbOfEntity); } } -bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const +bool MEDFileField1TSStructItem2::isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const { if(startExp!=_start_end.first) return false; @@ -1732,7 +1732,7 @@ bool MEDFileField1TSStructItem2::isCellSupportEqual(const MEDFileField1TSStructI return false; if(_pfl->getName().empty() && other._pfl->getName().empty()) return true; - const DataArrayInt *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs)); + const DataArrayIdType *pfl1(getPfl(globs)),*pfl2(other.getPfl(globs)); return pfl1->isEqualWithoutConsideringStr(*pfl2); } @@ -1751,9 +1751,9 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const if(objs.size()==1) return MEDFileField1TSStructItem2(*objs[0]); INTERP_KERNEL::NormalizedCellType gt(objs[0]->_geo_type); - int nbEntityRef(objs[0]->_nb_of_entity); + mcIdType nbEntityRef(objs[0]->_nb_of_entity); std::size_t sz(objs.size()); - std::vector arrs(sz); + std::vector arrs(sz); for(std::size_t i=0;igetProfile(obj->_pfl->getName().c_str()); } - MCAuto arr(DataArrayInt::Aggregate(arrs)); + MCAuto arr(DataArrayIdType::Aggregate(arrs)); arr->sort(); - int 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 p(0,nbEntityRef); + std::pair p(0,nbEntityRef); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1782,7 +1782,7 @@ MEDFileField1TSStructItem2 MEDFileField1TSStructItem2::BuildAggregationOf(const else { arr->setName(NEWLY_CREATED_PFL_NAME); - std::pair p(0,oldNbTuples); + std::pair p(0,oldNbTuples); std::string a,b; MEDFileField1TSStructItem2 ret(gt,p,a,b); ret._nb_of_entity=nbEntityRef; @@ -1800,7 +1800,7 @@ std::size_t MEDFileField1TSStructItem2::getHeapMemorySizeWithoutChildren() const std::vector MEDFileField1TSStructItem2::getDirectChildrenWithNull() const { std::vector ret; - ret.push_back((const DataArrayInt *)_pfl); + ret.push_back((const DataArrayIdType *)_pfl); return ret; } @@ -1816,7 +1816,7 @@ void MEDFileField1TSStructItem::checkWithMeshStruct(const MEDFileMeshStruct *mst { case ON_NODES: { - int 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); @@ -1945,7 +1945,7 @@ bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TS int theFirstLevFull; bool ret0=isFullyOnOneLev(meshSt,theFirstLevFull); const MEDFileField1TSStructItem2& otherNodeIt(other._items[0]); - int nbOfNodes(meshSt->getNumberOfNodes()); + mcIdType nbOfNodes(meshSt->getNumberOfNodes()); if(otherNodeIt.getPflName().empty()) {//on all nodes if(!ret0) @@ -1959,8 +1959,8 @@ bool MEDFileField1TSStructItem::isCompatibleWithNodesDiscr(const MEDFileField1TS } else { - const DataArrayInt *pfl=globs->getProfile(otherNodeIt.getPflName().c_str()); - MCAuto cpyPfl(pfl->deepCopy()); + const DataArrayIdType *pfl=globs->getProfile(otherNodeIt.getPflName().c_str()); + MCAuto cpyPfl(pfl->deepCopy()); cpyPfl->sort(); if(cpyPfl->isIota(nbOfNodes)) {//on all nodes also ! @@ -2028,8 +2028,8 @@ MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCell { std::size_t sz(_items.size()); std::vector a0(sz); - std::vector a1(sz); - std::vector a2(sz); + std::vector a1(sz); + std::vector a2(sz); std::size_t i(0); for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++,i++) { @@ -2072,7 +2072,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile std::vector< std::vector > pfls,locs; std::vector< std::vector > typesF; std::vector geoTypes; - std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); + std::vector< std::vector > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs); std::size_t nbOfGeoTypes(geoTypes.size()); if(nbOfGeoTypes==0) throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref !"); @@ -2431,7 +2431,7 @@ bool MEDFileFastCellSupportComparator::isDataSetSupportEqualToThePreviousOne(int int MEDFileFastCellSupportComparator::getNumberOfTS() const { - return _f1ts_cmps.size(); + return (int)_f1ts_cmps.size(); } std::vector MEDFileFastCellSupportComparator::getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const diff --git a/src/MEDLoader/MEDFileFieldOverView.hxx b/src/MEDLoader/MEDFileFieldOverView.hxx index 19c839925..b59d3cccb 100644 --- a/src/MEDLoader/MEDFileFieldOverView.hxx +++ b/src/MEDLoader/MEDFileFieldOverView.hxx @@ -53,9 +53,9 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; const MEDFileMesh *getTheMesh() const { return _mesh; } - int getNumberOfNodes() const { return _nb_nodes; } + mcIdType getNumberOfNodes() const { return _nb_nodes; } bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const; - int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; + mcIdType getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const; int getNumberOfLevs() const; int getNumberOfGeoTypesInLev(int relativeLev) const; @@ -66,8 +66,8 @@ namespace MEDCoupling private: const MEDFileMesh *_mesh; std::string _name; - int _nb_nodes; - std::vector< std::vector > _geo_types_distrib; + mcIdType _nb_nodes; + std::vector< std::vector > _geo_types_distrib; }; class MEDFileField1TSStructItem; @@ -78,47 +78,47 @@ namespace MEDCoupling std::size_t getHeapMemorySizeWithoutChildren() const; std::vector getDirectChildrenWithNull() const; public: - static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector& levs); - static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode); - void setNodeReduction(const DataArrayInt *nr); - void setCellReduction(const DataArrayInt *cr); + static MEDMeshMultiLev *NewOnlyOnNode(const MEDFileMesh *m, const DataArrayIdType *pflOnNode); + void setNodeReduction(const DataArrayIdType *nr); + void setCellReduction(const DataArrayIdType *cr); bool isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs) const; MEDLOADER_EXPORT DataArray *buildDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; - MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayInt *& famIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const; - MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const; + MEDLOADER_EXPORT void retrieveFamilyIdsOnCells(DataArrayIdType *& famIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayIdType *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayIdType *& famIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayIdType *& numIds, bool& isWithoutCopy) const; + MEDLOADER_EXPORT DataArrayIdType *retrieveGlobalNodeIdsIfAny() const; MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const; - void setFamilyIdsOnCells(DataArrayInt *famIds); - void setNumberIdsOnCells(DataArrayInt *numIds); - void setFamilyIdsOnNodes(DataArrayInt *famIds); - void setNumberIdsOnNodes(DataArrayInt *numIds); - virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0; + void setFamilyIdsOnCells(DataArrayIdType *famIds); + void setNumberIdsOnCells(DataArrayIdType *numIds); + void setFamilyIdsOnNodes(DataArrayIdType *famIds); + void setNumberIdsOnNodes(DataArrayIdType *numIds); + virtual void selectPartOfNodes(const DataArrayIdType *pflNodes) = 0; virtual MEDMeshMultiLev *prepare() const = 0; - int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const; - int getNumberOfNodes() const; + mcIdType getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const; + mcIdType getNumberOfNodes() const; protected: std::string getPflNameOfId(int id) const; DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const; - virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); + virtual void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr); protected: MEDMeshMultiLev(const MEDFileMesh *mesh); MEDMeshMultiLev(const MEDMeshMultiLev& other); - MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDMeshMultiLev(const MEDFileMesh *mesh, mcIdType nbNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); protected: const MEDFileMesh *_mesh; - std::vector< MCAuto > _pfls; + std::vector< MCAuto > _pfls; std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types; - std::vector _nb_entities; - MCAuto _node_reduction; - int _nb_nodes; + std::vector _nb_entities; + MCAuto _node_reduction; + mcIdType _nb_nodes; // - MCAuto _cell_fam_ids; - MCAuto _cell_num_ids; - MCAuto _node_fam_ids; - MCAuto _node_num_ids; + MCAuto _cell_fam_ids; + MCAuto _cell_num_ids; + MCAuto _node_fam_ids; + MCAuto _node_num_ids; public: MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34; MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH]; @@ -131,19 +131,19 @@ 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 DataArrayInt *pflNodes); + static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + void selectPartOfNodes(const DataArrayIdType *pflNodes); MEDMeshMultiLev *prepare() const; MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto& part); - MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const; + MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayIdType *&cellLocations, DataArrayIdType *& cells, DataArrayIdType *&faceLocations, DataArrayIdType *&faces) const; protected: - void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr); + void appendVertices(const DataArrayIdType *verticesToAdd, DataArrayIdType *nr); private: - void reorderNodesIfNecessary(MCAuto& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const; + void reorderNodesIfNecessary(MCAuto& coords, DataArrayIdType *nodalConnVTK, DataArrayIdType *polyhedNodalConnVTK) const; private: MEDUMeshMultiLev(const MEDUMeshMultiLev& other); MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& levs); - MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: std::vector< MCAuto > _parts; //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts. @@ -153,12 +153,12 @@ namespace MEDCoupling class MEDStructuredMeshMultiLev : public MEDMeshMultiLev { public: - void selectPartOfNodes(const DataArrayInt *pflNodes); - virtual std::vector getNodeGridStructure() const = 0; + void selectPartOfNodes(const DataArrayIdType *pflNodes); + virtual std::vector getNodeGridStructure() const = 0; protected: MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other); MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector& lev); - MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, mcIdType nbOfNodes, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); void dealWithImplicitUnstructuredMesh(const MEDFileMesh *m); protected: void moveFaceToCell() const; @@ -167,22 +167,22 @@ namespace MEDCoupling void initStdFieldOfIntegers(const MEDFileStructuredMesh *m); protected: bool _is_internal; - MCAuto _face_fam_ids; - MCAuto _face_num_ids; + MCAuto _face_fam_ids; + MCAuto _face_num_ids; }; class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev { 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; + static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + std::vector getNodeGridStructure() const; MEDMeshMultiLev *prepare() const; MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const; private: MEDCMeshMultiLev(const MEDCMeshMultiLev& other); MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& levs); - MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: std::vector< MCAuto > _coords; }; @@ -191,24 +191,24 @@ namespace MEDCoupling { public: 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::vector getNodeGridStructure() const; + static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls , const std::vector& nbEntities); + std::vector getNodeGridStructure() const; MEDMeshMultiLev *prepare() const; - MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const; + MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector& nodeStrct, bool& isInternal) const; private: MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other); MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& levs); - MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); + MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector& gts, const std::vector& pfls, const std::vector& nbEntities); private: MCAuto _coords; - std::vector _structure; + std::vector _structure; }; class MEDFileField1TSStructItem2 : public BigMemoryObject { public: MEDFileField1TSStructItem2(); - MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& pfl, const std::string& loc); + MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair& b, const std::string& pfl, const std::string& loc); void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs); @@ -216,15 +216,15 @@ namespace MEDCoupling MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; // - const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const; + const DataArrayIdType *getPfl(const MEDFileFieldGlobsReal *globs) const; INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; } - int getNbEntity() const { return _nb_of_entity; } - const std::pair& getStartStop() const { return _start_end; } + mcIdType getNbEntity() const { return _nb_of_entity; } + const std::pair& getStartStop() const { return _start_end; } std::string getPflName() const; int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const; //! warning this method also set _nb_of_entity attribute ! - void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); - bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; + void checkInRange(mcIdType nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs); + bool isFastlyEqual(mcIdType& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const; bool operator==(const MEDFileField1TSStructItem2& other) const; bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const; @@ -233,10 +233,10 @@ namespace MEDCoupling static const char NEWLY_CREATED_PFL_NAME[]; private: INTERP_KERNEL::NormalizedCellType _geo_type; - std::pair _start_end; - MCAuto _pfl; + std::pair _start_end; + MCAuto _pfl; std::string _loc; - int _nb_of_entity; + mcIdType _nb_of_entity; }; class MEDFileField1TSStructItem : public BigMemoryObject diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index a1ed652a7..af5ea9d17 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -18,6 +18,7 @@ // #include "MEDFileJoint.hxx" +#include "MEDFileBasis.hxx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" @@ -33,7 +34,7 @@ using namespace MEDCoupling; std::size_t MEDFileJointCorrespondence::getHeapMemorySizeWithoutChildren() const { - return sizeof(MCAuto); + return sizeof(MCAuto); } std::vector MEDFileJointCorrespondence::getDirectChildrenWithNull() const @@ -55,7 +56,7 @@ MEDFileJointCorrespondence::MEDFileJointCorrespondence(): * \param [in] loc_geo_type - the local geometry type of correspondence. * \param [in] rem_geo_type - the remote geometry type of correspondence. */ -MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* correspondence, +MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayIdType* correspondence, bool isNodal, INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type): @@ -66,7 +67,7 @@ MEDFileJointCorrespondence::MEDFileJointCorrespondence(DataArrayInt* corresponde MEDFileJointCorrespondence::setCorrespondence( correspondence ); } -MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* correspondence, +MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayIdType* correspondence, INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type) { @@ -76,7 +77,7 @@ MEDFileJointCorrespondence* MEDFileJointCorrespondence::New(DataArrayInt* corres /*! * Returns a new MEDFileJointCorrespondence of nodes */ -MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayInt* correspondence) +MEDFileJointCorrespondence *MEDFileJointCorrespondence::New(DataArrayIdType* correspondence) { return new MEDFileJointCorrespondence(correspondence); } @@ -108,7 +109,7 @@ void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, co MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); std::ostringstream oss; oss << "MEDFileJointCorrespondence : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); if (( !_is_nodal ) && ( _loc_geo_type == INTERP_KERNEL::NORM_ERROR || @@ -117,7 +118,7 @@ void MEDFileJointCorrespondence::write(const std::string& fileName, int mode, co throw INTERP_KERNEL::Exception( "Geometric type not specified for a cell Joint" ); } - if ( (const DataArrayInt *)_correspondence ) + if ( (const DataArrayIdType *)_correspondence ) { writeLL(fid, localMeshName, jointName, order, iteration); } @@ -135,8 +136,8 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe order, iteration, MED_NODE, MED_NONE, MED_NODE, MED_NONE, - _correspondence->getNbOfElems()/2, - _correspondence->getConstPointer())); + ToMedInt(_correspondence->getNbOfElems()/2), + ToMedIntArray(_correspondence)->getConstPointer())); } else { @@ -144,12 +145,12 @@ void MEDFileJointCorrespondence::writeLL(med_idt fid, const std::string& localMe order, iteration, MED_CELL, typmai3[ _loc_geo_type ], MED_CELL, typmai3[ _rem_geo_type ], - _correspondence->getNbOfElems()/2, - _correspondence->getConstPointer())); + ToMedInt(_correspondence->getNbOfElems()/2), + ToMedIntArray(_correspondence)->getConstPointer())); } } -void MEDFileJointCorrespondence::setCorrespondence(DataArrayInt *corr) +void MEDFileJointCorrespondence::setCorrespondence(DataArrayIdType *corr) { _correspondence=corr; if ( corr ) @@ -198,13 +199,13 @@ std::string MEDFileJointCorrespondence::simpleRepr() const oss << "- entity type of the correspondence : " << ( getIsNodal() ? "NODE" : "CELL" ) << "\n"; oss << "- Local geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _loc_geo_type ).getRepr() << "\n"; oss << "- Remote geometry type of the correspondence : " << INTERP_KERNEL::CellModel::GetCellModel( _rem_geo_type ).getRepr() << "\n"; - if ( (const DataArrayInt *)_correspondence ) + if ( (const DataArrayIdType *)_correspondence ) { oss << "- Number entity of the correspondence : " << getCorrespondence()->getNumberOfTuples() << "\n"; - const DataArrayInt* tmp=getCorrespondence(); + const DataArrayIdType* tmp=getCorrespondence(); oss << "- Correspondence : <<"; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) oss<< *it << " "; } else @@ -222,7 +223,7 @@ MEDFileJointOneStep::MEDFileJointOneStep():_order(-1),_iteration(-1) std::size_t MEDFileJointOneStep::getHeapMemorySizeWithoutChildren() const { - return _correspondences.capacity()*sizeof(MCAuto); + return _correspondences.capacity()*sizeof(MCAuto); } std::vector MEDFileJointOneStep::getDirectChildrenWithNull() const @@ -262,20 +263,20 @@ MEDFileJointOneStep* MEDFileJointOneStep::New(med_idt fid, const std::string& mN MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int num) { - int order, iteration, ncorrespondence; + med_int order, iteration, ncorrespondence; MEDFILESAFECALLERRD0(MEDsubdomainComputingStepInfo,(fid, mName.c_str(), jointName.c_str(), num, &order, &iteration, &ncorrespondence)); - MEDFileJointOneStep::setOrder(order); - MEDFileJointOneStep::setIteration(iteration); + MEDFileJointOneStep::setOrder(FromMedInt(order)); + MEDFileJointOneStep::setIteration(FromMedInt(iteration)); for ( int cur_it = 1; cur_it <= ncorrespondence; ++cur_it ) { - int num_entity; + med_int num_entity; med_entity_type loc_ent_type, rem_ent_type; med_geometry_type loc_geo_type, rem_geo_type; MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceSizeInfo,(fid, mName.c_str(), jointName.c_str(), order, iteration, cur_it, &loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity)); if ( num_entity > 0 ) { - MCAuto correspondence=DataArrayInt::New(); + MCAuto correspondence=DataArrayMedInt::New(); correspondence->alloc(num_entity*2, 1); MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type, loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer())); @@ -283,7 +284,7 @@ MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, cor->setIsNodal( loc_ent_type == MED_NODE ); cor->setLocalGeometryType ( convertGeometryType( loc_geo_type )); cor->setRemoteGeometryType( convertGeometryType( rem_geo_type )); - cor->setCorrespondence( correspondence ); + cor->setCorrespondence( FromMedIntArray(correspondence )); _correspondences.push_back(cor); } } @@ -304,7 +305,7 @@ void MEDFileJointOneStep::write(const std::string& fileName, int mode, const std 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(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); if ( _correspondences.empty() ) throw INTERP_KERNEL::Exception("MEDFileJointOneStep::write : no correspondences defined !"); writeLL(fid, localMeshName, jointName); @@ -328,7 +329,7 @@ void MEDFileJointOneStep::pushCorrespondence(MEDFileJointCorrespondence* corresp int MEDFileJointOneStep::getNumberOfCorrespondences() const { - return _correspondences.size(); + return (int)_correspondences.size(); } /** Return a borrowed reference (caller is not responsible) */ @@ -481,14 +482,14 @@ MEDFileJoint::MEDFileJoint(med_idt fid, const std::string& mName, int curJoint) INTERP_KERNEL::AutoPtr joint_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); INTERP_KERNEL::AutoPtr desc_name=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); INTERP_KERNEL::AutoPtr rem_mesh_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); - int domain_number=0, nstep=0, nocstpncorrespondence=0; + med_int domain_number=0, nstep=0, nocstpncorrespondence=0; MEDFILESAFECALLERRD0(MEDsubdomainJointInfo,(fid,mName.c_str(), curJoint, joint_name, desc_name, &domain_number,rem_mesh_name, &nstep, &nocstpncorrespondence)); setLocalMeshName(mName); setRemoteMeshName(MEDLoaderBase::buildStringFromFortran(rem_mesh_name,MED_NAME_SIZE)); setDescription(MEDLoaderBase::buildStringFromFortran(desc_name,MED_COMMENT_SIZE)); setJointName(MEDLoaderBase::buildStringFromFortran(joint_name,MED_NAME_SIZE)); - setDomainNumber(domain_number); + setDomainNumber(FromMedInt(domain_number)); for(int cur_step=1; cur_step <= nstep; ++cur_step) { MEDFileJointOneStep *cor=MEDFileJointOneStep::New(fid, mName.c_str(), getJointName(), cur_step); @@ -515,7 +516,7 @@ void MEDFileJoint::pushStep(MEDFileJointOneStep* step) int MEDFileJoint::getNumberOfSteps() const { - return _joint.size(); + return (int)_joint.size(); } /** Return a borrowed reference (caller is not responsible) */ @@ -654,7 +655,7 @@ std::string MEDFileJoints::getMeshName() const int MEDFileJoints::getNumberOfJoints() const { - return _joints.size(); + return (int)_joints.size(); } /** Return a borrowed reference (caller is not responsible) */ @@ -759,7 +760,7 @@ MEDFileJoints::MEDFileJoints() MEDFileJoints::MEDFileJoints(med_idt fid, const std::string& meshName) { - int 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)); } diff --git a/src/MEDLoader/MEDFileJoint.hxx b/src/MEDLoader/MEDFileJoint.hxx index 421bca3fa..567d97abf 100644 --- a/src/MEDLoader/MEDFileJoint.hxx +++ b/src/MEDLoader/MEDFileJoint.hxx @@ -39,8 +39,8 @@ class MEDFileJointCorrespondence : public RefCountObject, public MEDFileWritable { public: MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(); - MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence); // nodes - MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayInt* correspondence, // cells + MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence); // nodes + MEDLOADER_EXPORT static MEDFileJointCorrespondence *New(DataArrayIdType* correspondence, // cells INTERP_KERNEL::NormalizedCellType loc_geo_type, INTERP_KERNEL::NormalizedCellType rem_geo_type); MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; @@ -54,15 +54,15 @@ public: MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getLocalGeometryType() const { return _loc_geo_type; } MEDLOADER_EXPORT void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type) { _rem_geo_type=type; } MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const { return _rem_geo_type; } - MEDLOADER_EXPORT void setCorrespondence(DataArrayInt *corr); - MEDLOADER_EXPORT const DataArrayInt *getCorrespondence() const { return _correspondence; } + MEDLOADER_EXPORT void setCorrespondence(DataArrayIdType *corr); + MEDLOADER_EXPORT const DataArrayIdType *getCorrespondence() const { return _correspondence; } MEDLOADER_EXPORT void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const; MEDLOADER_EXPORT std::string simpleRepr() const; MEDLOADER_EXPORT void writeLL(med_idt fid, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const; private: MEDFileJointCorrespondence(); - MEDFileJointCorrespondence(DataArrayInt* correspondence, + MEDFileJointCorrespondence(DataArrayIdType* correspondence, bool is_nodal = true, INTERP_KERNEL::NormalizedCellType loc_geo_type = INTERP_KERNEL::NORM_ERROR, INTERP_KERNEL::NormalizedCellType rem_geo_type = INTERP_KERNEL::NORM_ERROR); @@ -70,7 +70,7 @@ private: bool _is_nodal; INTERP_KERNEL::NormalizedCellType _loc_geo_type; INTERP_KERNEL::NormalizedCellType _rem_geo_type; - MCAuto _correspondence; + MCAuto _correspondence; }; /*! diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 49d4755ae..b45e6f7e8 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -28,6 +28,7 @@ #include "MEDCouplingUMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" @@ -57,8 +58,8 @@ std::size_t MEDFileMesh::getHeapMemorySizeWithoutChildren() const for(std::vector::const_iterator it2=(*it).second.begin();it2!=(*it).second.end();it2++) ret+=(*it2).capacity(); } - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) - ret+=(*it).first.capacity()+sizeof(int); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + ret+=(*it).first.capacity()+sizeof(mcIdType); return ret; } @@ -379,7 +380,7 @@ std::vector MEDFileMesh::getFamiliesOnGroups(const std::vector - sequence of ids of the families. * \throw If the name of a nonexistent group is specified. */ -std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const +std::vector MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const { std::string oname(name); std::map >::const_iterator it=_groups.find(oname); @@ -406,7 +407,7 @@ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector< _groups[oname]=fams; for(std::vector::const_iterator it1=fams.begin();it1!=fams.end();it1++) { - std::map::iterator it2=_families.find(*it1); + std::map::iterator it2=_families.find(*it1); if(it2==_families.end()) _families[*it1]=0; } @@ -420,12 +421,12 @@ void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector< * \param [in] famIds - a sequence of ids of families constituting the group. * \throw If a family name is not found by its id. */ -void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) +void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds) { std::string oname(name); std::vector fams(famIds.size()); int i=0; - for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) + for(std::vector::const_iterator it1=famIds.begin();it1!=famIds.end();it1++,i++) { std::string name2=getFamilyNameGivenId(*it1); fams[i]=name2; @@ -462,7 +463,7 @@ std::vector MEDFileMesh::getGroupsOnFamily(const std::string& name) void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector& grps) { std::string fName(famName); - const std::map::const_iterator it=_families.find(fName); + const std::map::const_iterator it=_families.find(fName); if(it==_families.end()) { std::vector fams=getFamiliesNames(); @@ -504,7 +505,7 @@ std::vector MEDFileMesh::getFamiliesNames() const { std::vector ret(_families.size()); int i=0; - for(std::map::const_iterator 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; } @@ -534,7 +535,7 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa std::vector allGrps(getGroupsNames()); for(std::vector::const_iterator it=allGrps.begin();it!=allGrps.end();it++) { - std::vector levs(getGrpNonEmptyLevelsExt((*it))); + std::vector levs(getGrpNonEmptyLevelsExt((*it))); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end()) ret.push_back(*it); } @@ -544,9 +545,9 @@ std::vector MEDFileMesh::getGroupsOnSpecifiedLev(int meshDimRelToMa /*! * Returns all relative mesh levels (including nodes) where a given group is defined. * \param [in] grp - the name of the group of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const +std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const { std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevelsExt(fams); @@ -556,9 +557,9 @@ std::vector MEDFileMesh::getGrpNonEmptyLevelsExt(const std::string& grp) co * Returns all relative mesh levels (**excluding nodes**) where given groups are defined. * To include nodes, call getGrpsNonEmptyLevelsExt() method. * \param [in] grps - a sequence of names of the groups of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector& grps) const +std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector& grps) const { std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevels(fams); @@ -567,9 +568,9 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const +std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector& grps) const { std::vector fams(getFamiliesOnGroups(grps)); return getFamsNonEmptyLevelsExt(fams); @@ -579,9 +580,9 @@ std::vector MEDFileMesh::getGrpsNonEmptyLevelsExt(const std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const +std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const { std::vector fams(getFamiliesOnGroup(grp)); return getFamsNonEmptyLevels(fams); @@ -591,9 +592,9 @@ std::vector MEDFileMesh::getGrpNonEmptyLevels(const std::string& grp) const * Returns all relative mesh levels (**excluding nodes**) where a given family is defined. * To include nodes, call getFamNonEmptyLevelsExt() method. * \param [in] fam - the name of the family of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const +std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevels(fams); @@ -602,9 +603,9 @@ std::vector MEDFileMesh::getFamNonEmptyLevels(const std::string& fam) const /*! * Returns all relative mesh levels (including nodes) where a given family is defined. * \param [in] fam - the name of the family of interest. - * \return std::vector - a sequence of the relative dimensions. + * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const +std::vector MEDFileMesh::getFamNonEmptyLevelsExt(const std::string& fam) const { std::vector fams(1,std::string(fam)); return getFamsNonEmptyLevelsExt(fams); @@ -622,8 +623,8 @@ std::string MEDFileMesh::GetMagicFamilyStr() void MEDFileMesh::assignFamilyNameWithGroupName() { std::map > groups(_groups); - std::map newFams; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map newFams; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { std::vector grps=getGroupsOnFamily((*it).first); if(grps.size()==1 && groups[grps[0]].size()==1) @@ -684,13 +685,13 @@ void MEDFileMesh::removeGroupAtLevel(int meshDimRelToMaxExt, const std::string& throw INTERP_KERNEL::Exception(oss.str().c_str()); } const std::vector &famsOnGrp((*it).second); - std::vector famIds(getFamiliesIdsOnGroup(name)); - const DataArrayInt *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt)); + std::vector famIds(getFamiliesIdsOnGroup(name)); + const DataArrayIdType *famArr(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(!famArr) return ; - MCAuto vals(famArr->getDifferentValues()); - MCAuto famIds2(DataArrayInt::NewFromStdVector(famIds)); - MCAuto idsToKill(famIds2->buildIntersection(vals)); + MCAuto vals(famArr->getDifferentValues()); + MCAuto famIds2(DataArrayIdType::NewFromStdVector(famIds)); + MCAuto idsToKill(famIds2->buildIntersection(vals)); if(idsToKill->empty()) return ; std::vector newFamsOnGrp; @@ -728,7 +729,7 @@ void MEDFileMesh::removeGroup(const std::string& name) void MEDFileMesh::removeFamily(const std::string& name) { std::string oname(name); - std::map::iterator it=_families.find(oname); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -770,17 +771,17 @@ std::vector MEDFileMesh::removeOrphanGroups() */ std::vector MEDFileMesh::removeOrphanFamilies() { - MCAuto allFamIdsInUse=computeAllFamilyIdsInUse(); + MCAuto allFamIdsInUse=computeAllFamilyIdsInUse(); std::vector ret; - if(!((DataArrayInt*)allFamIdsInUse)) + if(!((DataArrayIdType*)allFamIdsInUse)) { ret=getFamiliesNames(); _families.clear(); _groups.clear(); return ret; } - std::map famMap; + std::map famMap; std::map > grps(_groups); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if(allFamIdsInUse->presenceOfValue((*it).second)) famMap[(*it).first]=(*it).second; @@ -811,9 +812,9 @@ std::vector MEDFileMesh::removeOrphanFamilies() */ void MEDFileMesh::removeFamiliesReferedByNoGroups() { - std::map fams; + std::map fams; std::set sfams; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + 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(std::vector::const_iterator it1=(*it0).second.begin();it1!=(*it0).second.end();it1++) @@ -838,8 +839,8 @@ void MEDFileMesh::rearrangeFamilies() removeFamiliesReferedByNoGroups(); // std::vector levels(getNonEmptyLevelsExt()); - std::set idsRefed; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::set idsRefed; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { idsRefed.insert((*it).second); if((*it).second==0) @@ -853,7 +854,7 @@ void MEDFileMesh::rearrangeFamilies() } for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { - const DataArrayInt *fams(0); + const DataArrayIdType *fams(0); try { fams=getFamilyFieldAtLevel(*it); @@ -862,12 +863,12 @@ void MEDFileMesh::rearrangeFamilies() if(!fams) continue; std::vector v(fams->getNumberOfTuples(),false); - for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) + for(std::set::const_iterator pt=idsRefed.begin();pt!=idsRefed.end();pt++) fams->switchOnTupleEqualTo(*pt,v); - MCAuto unfetchedIds(DataArrayInt::BuildListOfSwitchedOff(v)); + MCAuto unfetchedIds(DataArrayIdType::BuildListOfSwitchedOff(v)); if(!unfetchedIds->empty()) { - MCAuto newFams(fams->deepCopy()); + MCAuto newFams(fams->deepCopy()); newFams->setPartOfValuesSimple3(0,unfetchedIds->begin(),unfetchedIds->end(),0,1,1); setFamilyFieldArr(*it,newFams); } @@ -895,9 +896,9 @@ void MEDFileMesh::zipFamilies() } // std::map > newGroups(_groups); - std::map newFams(_families); + std::map newFams(_families); std::vector levels(getNonEmptyLevelsExt()); - std::map > famIdsToSubstitute; + std::map > famIdsToSubstitute; // iterate on all different set of groups std::set familiesToKill; for(auto setOfCommonGrp : setOfFamilies) @@ -936,7 +937,7 @@ void MEDFileMesh::zipFamilies() { for(std::vector::const_iterator it=levels.begin();it!=levels.end();it++) { - DataArrayInt *fams(nullptr); + DataArrayIdType *fams(nullptr); try { fams=getFamilyFieldAtLevel(*it); @@ -944,7 +945,7 @@ void MEDFileMesh::zipFamilies() catch(INTERP_KERNEL::Exception& e) { } if(!fams) continue; - MCAuto idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size())); + MCAuto idsToModif(fams->findIdsEqualList(famIdsSubstSession.second.data(),famIdsSubstSession.second.data()+famIdsSubstSession.second.size())); fams->setPartOfValuesSimple3(famIdsSubstSession.first,idsToModif->begin(),idsToModif->end(),0,1,1); } } @@ -1003,11 +1004,11 @@ void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& * \param [in] oldId - a current id of the family. * \param [in] newId - a new family id. */ -void MEDFileMesh::changeFamilyId(int oldId, int newId) +void MEDFileMesh::changeFamilyId(mcIdType oldId, mcIdType newId) { changeFamilyIdArr(oldId,newId); - std::map fam2; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map fam2; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if((*it).second==oldId) fam2[(*it).first]=newId; @@ -1027,7 +1028,7 @@ void MEDFileMesh::changeFamilyId(int oldId, int newId) void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName) { std::string oname(oldName); - std::map::iterator it=_families.find(oname); + std::map::iterator it=_families.find(oname); std::vector fams=getFamiliesNames(); if(it==_families.end()) { @@ -1036,13 +1037,13 @@ void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string throw INTERP_KERNEL::Exception(oss.str().c_str()); } std::string nname(newName); - std::map::iterator it2=_families.find(nname); + 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()); } - int cpy=(*it).second; + mcIdType cpy=(*it).second; _families.erase(it); _families[newName]=cpy; for(std::map >::iterator it3=_groups.begin();it3!=_groups.end();it3++) @@ -1065,12 +1066,12 @@ bool MEDFileMesh::areFamsEqual(const MEDFileMesh *other, std::string& what) cons { if(_families==other->_families) return true; - std::map fam0; - std::map fam1; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + std::map fam0; + std::map fam1; + 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++) + 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; @@ -1152,9 +1153,9 @@ bool MEDFileMesh::existsGroup(const std::string& groupName) const * \param [in] famId - the family id. * \return bool - \c true the family with the id \a famId exists in \a this mesh. */ -bool MEDFileMesh::existsFamily(int famId) const +bool MEDFileMesh::existsFamily(mcIdType famId) const { - for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) + for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) if((*it2).second==famId) return true; return false; @@ -1176,16 +1177,16 @@ bool MEDFileMesh::existsFamily(const std::string& familyName) const * \param [in] familyName - the family name. * \param [in] id - a new id of the family. */ -void MEDFileMesh::setFamilyId(const std::string& familyName, int id) +void MEDFileMesh::setFamilyId(const std::string& familyName, mcIdType id) { std::string fname(familyName); _families[fname]=id; } -void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id) +void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, mcIdType id) { std::string fname(familyName); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) if((*it).second==id) { if((*it).first!=familyName) @@ -1203,13 +1204,13 @@ void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id) * \param [in] famId - an id of the family. * \throw If a family with the same name or id already exists in \a this mesh. */ -void MEDFileMesh::addFamily(const std::string& familyName, int famId) +void MEDFileMesh::addFamily(const std::string& familyName, mcIdType famId) { std::string fname(familyName); - std::map::const_iterator it=_families.find(fname); + std::map::const_iterator it=_families.find(fname); if(it==_families.end()) { - for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) + for(std::map::const_iterator it2=_families.begin();it2!=_families.end();it2++) if((*it2).second==famId) { std::ostringstream oss; @@ -1261,12 +1262,12 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr oss << std::endl << "Please choose an another group name or call removeGroup(\"" << grpName << "\") method !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(meshDimRelToMaxExt); if(fieldFamIds==0) throw INTERP_KERNEL::Exception("MEDFileMesh::createGroupOnAll : Family field arr ids is not defined for this level !"); - MCAuto famIds=fieldFamIds->getDifferentValues(); + MCAuto famIds=fieldFamIds->getDifferentValues(); std::vector familiesOnWholeGroup; - for(const int *it=famIds->begin();it!=famIds->end();it++) + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { bool tmp; familiesOnWholeGroup.push_back(findOrCreateAndGiveFamilyWithId(*it,tmp)); @@ -1283,28 +1284,28 @@ void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& gr * famIds should exclusively belong. * \return bool - \c true if no modification is done in \a this mesh by this method. */ -bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) +bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& vMeshDimRelToMaxExt) { std::set levsInput(vMeshDimRelToMaxExt.begin(),vMeshDimRelToMaxExt.end()); std::vector levs=getNonEmptyLevelsExt(); 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 famIds2(famIds.begin(),famIds.end()); + std::set famIds2(famIds.begin(),famIds.end()); bool ret=true; - int maxFamId=1; + mcIdType maxFamId=1; if(!_families.empty()) maxFamId=getMaxFamilyId()+1; std::vector allFams=getFamiliesNames(); for(std::vector::const_iterator it=levsToTest.begin();it!=levsToTest.end();it++) { - const DataArrayInt *fieldFamIds=getFamilyFieldAtLevel(*it); + const DataArrayIdType *fieldFamIds=getFamilyFieldAtLevel(*it); if(fieldFamIds) { - 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(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) + 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(std::vector::const_iterator it2=tmp.begin();it2!=tmp.end();it2++) { ret=false; std::string famName=getFamilyNameGivenId(*it2); @@ -1312,7 +1313,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector& famIds, const std 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++; } } @@ -1374,12 +1375,12 @@ void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const s } } -void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const +void MEDFileMesh::checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const { std::vector grpsNames(getGroupsNames()); if(std::find(grpsNames.begin(),grpsNames.end(),grpName)==grpsNames.end()) return ; - std::vector 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 !"; @@ -1389,9 +1390,9 @@ void MEDFileMesh::checkNoGroupClash(const DataArrayInt *famArr, const std::strin /*! * \param [in] ids ids and group name of the new group to add. The ids should be sorted and different each other (MED file norm). - * \parma [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed) + * \param [in,out] famArr family array on level of interest to be renumbered. The input pointer should be not \c NULL (no check of that will be performed) */ -void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr) +void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr) { if(!ids) throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : NULL pointer in input !"); @@ -1400,28 +1401,28 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, throw INTERP_KERNEL::Exception("MEDFileUMesh::addGroup : empty group name ! MED file format do not accept empty group name !"); ids->checkStrictlyMonotonic(true); checkNoGroupClash(famArr,grpName); - MCAuto famArrTmp; famArrTmp.takeRef(famArr); - std::list< MCAuto > allFamIds(getAllNonNullFamilyIds()); + MCAuto famArrTmp; famArrTmp.takeRef(famArr); + std::list< MCAuto > allFamIds(getAllNonNullFamilyIds()); allFamIds.erase(std::find(allFamIds.begin(),allFamIds.end(),famArrTmp)); - MCAuto famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); - MCAuto diffFamIds=famIds->getDifferentValues(); - std::vector familyIds; - std::vector< MCAuto > idsPerfamiliyIds; - int maxVal=getTheMaxAbsFamilyId()+1; - std::map families(_families); + MCAuto famIds=famArr->selectByTupleIdSafe(ids->begin(),ids->end()); + MCAuto diffFamIds=famIds->getDifferentValues(); + std::vector familyIds; + std::vector< MCAuto > idsPerfamiliyIds; + mcIdType maxVal=getTheMaxAbsFamilyId()+1; + std::map families(_families); std::map > groups(_groups); std::vector fams; bool created(false); - for(const int *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++) + for(const mcIdType *famId=diffFamIds->begin();famId!=diffFamIds->end();famId++) { - MCAuto ids2Tmp=famIds->findIdsEqual(*famId); - MCAuto ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); - MCAuto ids1=famArr->findIdsEqual(*famId); - MCAuto ret0(ids1->buildSubstractionOptimized(ids2)); + MCAuto ids2Tmp=famIds->findIdsEqual(*famId); + MCAuto ids2=ids->selectByTupleId(ids2Tmp->begin(),ids2Tmp->end()); + MCAuto ids1=famArr->findIdsEqual(*famId); + MCAuto ret0(ids1->buildSubstractionOptimized(ids2)); if(ret0->empty()) { bool isFamPresent=false; - for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) + for(std::list< MCAuto >::const_iterator itl=allFamIds.begin();itl!=allFamIds.end() && !isFamPresent;itl++) isFamPresent=(*itl)->presenceOfValue(*famId); if(!isFamPresent && *famId!=0) { familyIds.push_back(*famId); idsPerfamiliyIds.push_back(ret0); fams.push_back(FindOrCreateAndGiveFamilyWithId(families,*famId,created)); } // adding *famId in grp @@ -1453,7 +1454,7 @@ void MEDFileMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, } for(std::size_t i=0;isetPartOfValuesSimple3(familyIds[i],da->begin(),da->end(),0,1,1); } _families=families; @@ -1496,7 +1497,7 @@ void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map& families, int id, bool& created) +std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map& families, mcIdType id, bool& created) { std::vector famAlreadyExisting(families.size()); int ii=0; - for(std::map::const_iterator it=families.begin();it!=families.end();it++,ii++) + for(std::map::const_iterator it=families.begin();it!=families.end();it++,ii++) { if((*it).second!=id) { @@ -1536,7 +1537,7 @@ std::string MEDFileMesh::FindOrCreateAndGiveFamilyWithId(std::map& info) +void MEDFileMesh::setFamilyInfo(const std::map& info) { _families=info; } @@ -1554,12 +1555,12 @@ void MEDFileMesh::setGroupInfo(const std::map::const_iterator it=_families.find(name); + std::map::const_iterator it=_families.find(name); if(it==_families.end()) { std::vector fams(getFamiliesNames()); @@ -1573,16 +1574,16 @@ int MEDFileMesh::getFamilyId(const std::string& name) const /*! * Returns ids of the families having given names. * \param [in] fams - a sequence of the names of families of interest. - * \return std::vector - a sequence of the ids of families of interest. + * \return std::vector - a sequence of the ids of families of interest. * \throw If \a fams contains a name of an inexistent family. */ -std::vector MEDFileMesh::getFamiliesIds(const std::vector& fams) const +std::vector MEDFileMesh::getFamiliesIds(const std::vector& fams) const { - std::vector ret(fams.size()); + std::vector ret(fams.size()); int i=0; for(std::vector::const_iterator it=fams.begin();it!=fams.end();it++,i++) { - std::map::const_iterator it2=_families.find(*it); + std::map::const_iterator it2=_families.find(*it); if(it2==_families.end()) { std::vector fams2=getFamiliesNames(); @@ -1597,15 +1598,15 @@ std::vector MEDFileMesh::getFamiliesIds(const std::vector& fam /*! * Returns a maximal abs(id) of families in \a this mesh. - * \return int - the maximal norm of family id. + * \return mcIdType - the maximal norm of family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMaxAbsFamilyId() const +mcIdType MEDFileMesh::getMaxAbsFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); - int ret=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::max(std::abs((*it).second),ret); } @@ -1614,15 +1615,15 @@ int MEDFileMesh::getMaxAbsFamilyId() const /*! * Returns a maximal id of families in \a this mesh. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMaxFamilyId() const +mcIdType MEDFileMesh::getMaxFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMaxFamilyId : no families set !"); - int ret=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::max((*it).second,ret); } @@ -1631,15 +1632,15 @@ int MEDFileMesh::getMaxFamilyId() const /*! * Returns a minimal id of families in \a this mesh. - * \return int - the minimal family id. + * \return mcIdType - the minimal family id. * \throw If there are no families in \a this mesh. */ -int MEDFileMesh::getMinFamilyId() const +mcIdType MEDFileMesh::getMinFamilyId() const { if(_families.empty()) throw INTERP_KERNEL::Exception("MEDFileMesh::getMinFamilyId : no families set !"); - int ret=std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType ret=std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { ret=std::min((*it).second,ret); } @@ -1649,42 +1650,42 @@ int MEDFileMesh::getMinFamilyId() const /*! * Returns a maximal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. */ -int MEDFileMesh::getTheMaxAbsFamilyId() const +mcIdType MEDFileMesh::getTheMaxAbsFamilyId() const { - int m1=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::max(std::abs((*it).second),m1); - int m2=getMaxAbsFamilyIdInArrays(); + mcIdType m2=getMaxAbsFamilyIdInArrays(); return std::max(m1,m2); } /*! * Returns a maximal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the maximal family id. + * \return mcIdType - the maximal family id. */ -int MEDFileMesh::getTheMaxFamilyId() const +mcIdType MEDFileMesh::getTheMaxFamilyId() const { - int m1=-std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=-std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::max((*it).second,m1); - int m2=getMaxFamilyIdInArrays(); + mcIdType m2=getMaxFamilyIdInArrays(); return std::max(m1,m2); } /*! * Returns a minimal id of families in \a this mesh. Not only named families are * considered but all family fields as well. - * \return int - the minimal family id. + * \return mcIdType - the minimal family id. */ -int MEDFileMesh::getTheMinFamilyId() const +mcIdType MEDFileMesh::getTheMinFamilyId() const { - int m1=std::numeric_limits::max(); - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + mcIdType m1=std::numeric_limits::max(); + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) m1=std::min((*it).second,m1); - int m2=getMinFamilyIdInArrays(); + mcIdType m2=getMinFamilyIdInArrays(); return std::min(m1,m2); } @@ -1693,13 +1694,13 @@ int MEDFileMesh::getTheMinFamilyId() const * * \sa MEDFileMesh::computeAllFamilyIdsInUse */ -DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const +DataArrayIdType *MEDFileMesh::getAllFamiliesIdsReferenced() const { - MCAuto ret=DataArrayInt::New(); - std::set v; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + MCAuto ret=DataArrayIdType::New(); + std::set v; + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) v.insert((*it).second); - ret->alloc((int)v.size(),1); + ret->alloc((mcIdType)v.size(),1); std::copy(v.begin(),v.end(),ret->getPointer()); return ret.retn(); } @@ -1709,15 +1710,15 @@ DataArrayInt *MEDFileMesh::getAllFamiliesIdsReferenced() const * * \sa MEDFileMesh::getAllFamiliesIdsReferenced */ -DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const +DataArrayIdType *MEDFileMesh::computeAllFamilyIdsInUse() const { std::vector famLevs=getFamArrNonEmptyLevelsExt(); - MCAuto ret; + MCAuto ret; for(std::vector::const_iterator it=famLevs.begin();it!=famLevs.end();it++) { - const DataArrayInt *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt - MCAuto dv=arr->getDifferentValues(); - if((DataArrayInt *) ret) + const DataArrayIdType *arr=getFamilyFieldAtLevel(*it);//arr not null due to spec of getFamArrNonEmptyLevelsExt + MCAuto dv=arr->getDifferentValues(); + if((DataArrayIdType *) ret) ret=dv->buildUnion(ret); else ret=dv; @@ -1732,32 +1733,32 @@ DataArrayInt *MEDFileMesh::computeAllFamilyIdsInUse() const bool MEDFileMesh::ensureDifferentFamIdsPerLevel() { std::vector levs=getNonEmptyLevelsExt(); - std::set allFamIds; - int maxId=getMaxFamilyId()+1; - std::map > famIdsToRenum; + std::set allFamIds; + mcIdType maxId=getMaxFamilyId()+1; + std::map > famIdsToRenum; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayInt *fam=getFamilyFieldAtLevel(*it); + const DataArrayIdType *fam=getFamilyFieldAtLevel(*it); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::set r2; + 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[*it].insert(famIdsToRenum[*it].end(),r2.begin(),r2.end()); - std::set r3; + std::set r3; std::set_union(tmp->begin(),tmp->end(),allFamIds.begin(),allFamIds.end(),std::inserter(r3,r3.end())); } } if(famIdsToRenum.empty()) return true; - MCAuto allIds=getAllFamiliesIdsReferenced(); - for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) + MCAuto allIds=getAllFamiliesIdsReferenced(); + for(std::map >::const_iterator it2=famIdsToRenum.begin();it2!=famIdsToRenum.end();it2++) { - DataArrayInt *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); - int *famIdsToChange=fam->getPointer(); - std::map ren; - for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel((*it2).first)); + mcIdType *famIdsToChange=fam->getPointer(); + std::map ren; + for(std::vector::const_iterator it3=(*it2).second.begin();it3!=(*it2).second.end();it3++,maxId++) { if(allIds->presenceOfValue(*it3)) { @@ -1770,8 +1771,8 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() addFamilyOnGrp((*it4),newFam); } } - MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); - for(const int *id=ids->begin();id!=ids->end();id++) + MCAuto ids=fam->findIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size()); + for(const mcIdType *id=ids->begin();id!=ids->end();id++) famIdsToChange[*id]=ren[famIdsToChange[*id]]; } return false; @@ -1787,27 +1788,27 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel() void MEDFileMesh::normalizeFamIdsTrio() { ensureDifferentFamIdsPerLevel(); - MCAuto allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; - std::map families; + std::map families; if(std::find(levs.begin(),levs.end(),0)!=levs.end()) { levsS.erase(0); - const DataArrayInt *fam=getFamilyFieldAtLevel(0); + const DataArrayIdType *fam=getFamilyFieldAtLevel(0); if(fam) { - int refId=1; - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) + mcIdType refId=1; + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1821,19 +1822,19 @@ void MEDFileMesh::normalizeFamIdsTrio() if(std::find(levs.begin(),levs.end(),-1)!=levs.end()) { levsS.erase(-1); - const DataArrayInt *fam=getFamilyFieldAtLevel(-1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(-1); if(fam) { - int refId=-1; - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) + mcIdType refId=-1; + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1846,12 +1847,12 @@ void MEDFileMesh::normalizeFamIdsTrio() } for(std::set::const_iterator it2=levsS.begin();it2!=levsS.end();it2++) { - DataArrayInt *fam=const_cast(getFamilyFieldAtLevel(*it2)); + DataArrayIdType *fam=const_cast(getFamilyFieldAtLevel(*it2)); if(fam) { - MCAuto tmp=fam->getDifferentValues(); + MCAuto tmp=fam->getDifferentValues(); fam->fillWithZero(); - for(const int *it3=tmp->begin();it3!=tmp->end();it3++) + for(const mcIdType *it3=tmp->begin();it3!=tmp->end();it3++) if(allIds->presenceOfValue(*it3)) { std::string famName=getFamilyNameGivenId(*it3); @@ -1879,27 +1880,27 @@ void MEDFileMesh::normalizeFamIdsTrio() void MEDFileMesh::normalizeFamIdsMEDFile() { ensureDifferentFamIdsPerLevel(); - MCAuto allIds=getAllFamiliesIdsReferenced(); + MCAuto allIds=getAllFamiliesIdsReferenced(); std::vector levs=getNonEmptyLevelsExt(); std::set levsS(levs.begin(),levs.end()); std::set famsFetched; - std::map families; - int refId=1; + std::map families; + mcIdType refId=1; if(std::find(levs.begin(),levs.end(),1)!=levs.end()) { levsS.erase(1); - const DataArrayInt *fam=getFamilyFieldAtLevel(1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(1); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId++) + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId++) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1913,18 +1914,18 @@ void MEDFileMesh::normalizeFamIdsMEDFile() refId=-1; for(std::set::const_reverse_iterator it2=levsS.rbegin();it2!=levsS.rend();it2++) { - const DataArrayInt *fam=getFamilyFieldAtLevel(*it2); + const DataArrayIdType *fam=getFamilyFieldAtLevel(*it2); if(fam) { - MCAuto tmp=fam->getDifferentValues(); - std::map ren; - for(const int *it=tmp->begin();it!=tmp->end();it++,refId--) + MCAuto tmp=fam->getDifferentValues(); + std::map ren; + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++,refId--) ren[*it]=refId; - int nbOfTuples=fam->getNumberOfTuples(); - int *start=const_cast(fam)->getPointer(); - for(int *w=start;w!=start+nbOfTuples;w++) + mcIdType nbOfTuples=fam->getNumberOfTuples(); + mcIdType *start=const_cast(fam)->getPointer(); + for(mcIdType *w=start;w!=start+nbOfTuples;w++) *w=ren[*w]; - for(const int *it=tmp->begin();it!=tmp->end();it++) + for(const mcIdType *it=tmp->begin();it!=tmp->end();it++) { if(allIds->presenceOfValue(*it)) { @@ -1952,9 +1953,9 @@ void MEDFileMesh::normalizeFamIdsMEDFile() * \return std::string - the name of the found family. * \throw If no family with the given \a id exists. */ -std::string MEDFileMesh::getFamilyNameGivenId(int id) const +std::string MEDFileMesh::getFamilyNameGivenId(mcIdType id) const { - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + 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; @@ -1979,12 +1980,12 @@ std::string MEDFileMesh::simpleRepr() const * This method is nearly like getFamilyFieldAtLevel method. Except that if the array does not exist at the specified level \a meshDimRelToMaxExt * an empty one is created. */ -DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) { - DataArrayInt *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt)); + DataArrayIdType *ret(getFamilyFieldAtLevel(meshDimRelToMaxExt)); if(ret) return ret; - MCAuto arr(DataArrayInt::New()); + MCAuto arr(DataArrayIdType::New()); arr->alloc(getSizeAtLevel(meshDimRelToMaxExt),1); arr->fillWithZero(); setFamilyFieldArr(meshDimRelToMaxExt,arr); @@ -1998,17 +1999,17 @@ DataArrayInt *MEDFileMesh::getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToM * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const +DataArrayIdType *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; - DataArrayInt *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum); + DataArrayIdType *ret=getGroupsArr(meshDimRelToMaxExt,tmp,renum); ret->setName(grp); return ret; } @@ -2020,13 +2021,13 @@ DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string * \param [in] grps - the names of the groups of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the groups. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is present in \a grps. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const +DataArrayIdType *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum) const { std::vector fams2=getFamiliesOnGroups(grps); return getFamiliesArr(meshDimRelToMaxExt,fams2,renum); @@ -2039,16 +2040,16 @@ DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vecto * \param [in] fam - the name of the family of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the family. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const +DataArrayIdType *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; - DataArrayInt *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum); + DataArrayIdType *ret=getFamiliesArr(meshDimRelToMaxExt,tmp,renum); ret->setName(fam); return ret; } @@ -2058,17 +2059,17 @@ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::strin * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const { std::vector tmp(1); tmp[0]=grp; - DataArrayInt *ret=getNodeGroupsArr(tmp,renum); + DataArrayIdType *ret=getNodeGroupsArr(tmp,renum); ret->setName(grp); return ret; } @@ -2078,13 +2079,13 @@ DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) c * \param [in] grps - the names of the groups of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the groups. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is present in \a grps. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeGroupsArr(const std::vector& grps, bool renum) const { return getGroupsArr(1,grps,renum); } @@ -2094,17 +2095,17 @@ DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector& grps * \param [in] grp - the name of the group of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the group. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the name of a nonexistent group is specified. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const { std::vector tmp(1); tmp[0]=fam; - DataArrayInt *ret=getNodeFamiliesArr(tmp,renum); + DataArrayIdType *ret=getNodeFamiliesArr(tmp,renum); ret->setName(fam); return ret; } @@ -2114,12 +2115,12 @@ DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of nodes, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of nodes of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for nodes. */ -DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileMesh::getNodeFamiliesArr(const std::vector& fams, bool renum) const { return getFamiliesArr(1,fams,renum); } @@ -2136,7 +2137,7 @@ DataArrayInt *MEDFileMesh::getNodeFamiliesArr(const std::vector& fa * \throw If \a grps includes invalid ids (or numbers if \a renum == \c true ). * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum) +void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum) { if(grps.empty()) return ; @@ -2144,7 +2145,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector grpsName2(grps.size()); int i=0; - for(std::vector::const_iterator 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(); @@ -2153,29 +2154,29 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector fam; - std::vector< std::vector > fidsOfGroups; + mcIdType sz=getSizeAtLevel(meshDimRelToMaxExt); + MCAuto fam; + std::vector< std::vector > fidsOfGroups; if(!renum) { - fam=DataArrayInt::MakePartition(grps,sz,fidsOfGroups); + fam=DataArrayIdType::MakePartition(grps,sz,fidsOfGroups); } else { - std::vector< MCAuto > grps2(grps.size()); + std::vector< MCAuto > grps2(grps.size()); for(unsigned int ii=0;iisetName(grps[ii]->getName()); } - std::vector grps3(grps2.begin(),grps2.end()); - fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups); + std::vector grps3(grps2.begin(),grps2.end()); + fam=DataArrayIdType::MakePartition(grps3,sz,fidsOfGroups); } - int offset=1; + mcIdType offset=1; if(!_families.empty()) offset=getMaxAbsFamilyId()+1; TranslateFamilyIds(meshDimRelToMaxExt==1?offset:-offset,fam,fidsOfGroups); - MCAuto ids=fam->getDifferentValues(); + MCAuto ids=fam->getDifferentValues(); appendFamilyEntries(ids,fidsOfGroups,grpsName2); setFamilyFieldArr(meshDimRelToMaxExt,fam); } @@ -2185,10 +2186,10 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector >& fidsOfGrps, const std::vector& grpNames) +void MEDFileMesh::appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames) { - std::map famInv; - for(const int *it=famIds->begin();it!=famIds->end();it++) + std::map famInv; + for(const mcIdType *it=famIds->begin();it!=famIds->end();it++) { std::ostringstream oss; oss << "Family_" << (*it); @@ -2196,9 +2197,9 @@ void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vec famInv[*it]=oss.str(); } int i=0; - for(std::vector< std::vector >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) + for(std::vector< std::vector >::const_iterator it1=fidsOfGrps.begin();it1!=fidsOfGrps.end();it1++,i++) { - for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) + for(std::vector::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) { _groups[grpNames[i]].push_back(famInv[*it2]); } @@ -2220,7 +2221,7 @@ std::vector MEDFileMesh::getAllGeoTypes() con /*! * \sa getAllDistributionOfTypes */ -std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const +std::vector MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const { MCAuto mLev(getMeshAtLevel(meshDimRelToMax)); return mLev->getDistributionOfTypes(); @@ -2233,14 +2234,14 @@ void MEDFileMesh::loadLLWithAdditionalItems(med_idt fid, const std::string& mNam loadEquivalences(fid); } -void MEDFileMesh::TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp) +void MEDFileMesh::TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector >& famIdsPerGrp) { famArr->applyLin(offset>0?1:-1,offset,0); - for(std::vector< std::vector >::iterator it1=famIdsPerGrp.begin();it1!=famIdsPerGrp.end();it1++) + 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::bind2nd(std::plus(),offset)); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::negate()); + std::transform((*it1).begin(),(*it1).end(),(*it1).begin(),std::bind2nd(std::plus(),offset)); } } @@ -2265,7 +2266,7 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: //attempt #2 if(len>=1) { - for(std::size_t i=1;i<30;i++) + for(char i=1;i<30;i++) { std::string tmp1(nameTry.at(0),i); tmp1+=nameTry; @@ -2282,12 +2283,12 @@ std::string MEDFileMesh::CreateNameNotIn(const std::string& nameTry, const std:: throw INTERP_KERNEL::Exception("MEDFileMesh::CreateNameNotIn : impossible to find a not already used name !"); } -int MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, int strt) +mcIdType MEDFileMesh::PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt) { 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 !"); - int ret=strt; + mcIdType ret=strt; for(std::size_t i=0;i::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl; oss << " - Groups lying on this family : "; @@ -2429,7 +2430,7 @@ MEDFileUMesh *MEDFileUMesh::New(const MEDCouplingMappedExtrudedMesh *mem) m2D->setCoords(m3D->getCoords()); ret->setMeshAtLevel(0,m3D); ret->setMeshAtLevel(-1,m2D); - ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits::max()-mem->get2DCellIdForExtrusion()); + ret->setFamilyId(GetSpeStr4ExtMesh(),std::numeric_limits::max()-mem->get2DCellIdForExtrusion()); return ret.retn(); } @@ -2459,7 +2460,7 @@ MEDFileUMesh *MEDFileUMesh::New() * \param [in] mrs - the request for what to be loaded. * \return MEDFileUMesh * - a new instance of MEDFileUMesh. The caller is to delete this mesh using decrRef() as it is no more needed. */ -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) +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 fid(MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY)); @@ -2470,7 +2471,7 @@ MEDFileUMesh *MEDFileUMesh::LoadPartOf(const std::string& fileName, const std::s * Please refer to the other MEDFileUMesh::LoadPartOf method that has the same semantic and the same parameter (excepted the first). * This method is \b NOT wrapped into python. */ -MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +MEDFileUMesh *MEDFileUMesh::LoadPartOf(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MCAuto ret(MEDFileUMesh::New()); ret->loadPartUMeshFromFile(fid,mName,types,slicPerTyp,dt,it,mrs); @@ -2488,10 +2489,10 @@ std::vector MEDFileUMesh::getDirectChildrenWithNull() c { std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); ret.push_back((const DataArrayDouble*)_coords); - ret.push_back((const DataArrayInt *)_fam_coords); - ret.push_back((const DataArrayInt *)_num_coords); - ret.push_back((const DataArrayInt *)_global_num_coords); - ret.push_back((const DataArrayInt *)_rev_num_coords); + ret.push_back((const DataArrayIdType *)_fam_coords); + ret.push_back((const DataArrayIdType *)_num_coords); + ret.push_back((const DataArrayIdType *)_global_num_coords); + ret.push_back((const DataArrayIdType *)_rev_num_coords); ret.push_back((const DataArrayAsciiChar *)_name_coords); ret.push_back((const PartDefinition *)_part_coords); for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) @@ -2575,7 +2576,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *famc1(_fam_coords),*famc2(otherC->_fam_coords); + const DataArrayIdType *famc1(_fam_coords),*famc2(otherC->_fam_coords); if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; @@ -2592,7 +2593,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *numc1(_num_coords),*numc2(otherC->_num_coords); + const DataArrayIdType *numc1(_num_coords),*numc2(otherC->_num_coords); if((numc1==0 && numc2!=0) || (numc1!=0 && numc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; @@ -2609,7 +2610,7 @@ bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wh } } { - const DataArrayInt *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords); + const DataArrayIdType *gnumc1(_global_num_coords),*gnumc2(otherC->_global_num_coords); if((gnumc1==0 && gnumc2!=0) || (gnumc1!=0 && gnumc2==0)) { what="Mismatch of numbering arr on nodes ! One is defined and not other !"; @@ -2695,14 +2696,14 @@ void MEDFileUMesh::checkConsistency() const } else { - int 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!"); - int pos; - int maxValue=_num_coords->getMaxValue(pos); + mcIdType 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!"); } @@ -2736,7 +2737,7 @@ void MEDFileUMesh::checkSMESHConsistency() const if (_ms.size()) { std::vector< MCAuto >::const_iterator it=_ms.begin(); - std::vector< const DataArrayInt * > v; + std::vector< const DataArrayIdType * > v; bool voidOrNot = ((*it)->_num == 0); for (it++; it != _ms.end(); it++) if( ((*it)->_num == 0) != voidOrNot ) @@ -2747,7 +2748,7 @@ void MEDFileUMesh::checkSMESHConsistency() const { // don't forget the 1st one: v.push_back(_ms[0]->_num); - MCAuto inter = DataArrayInt::BuildIntersection(v); + MCAuto inter = DataArrayIdType::BuildIntersection(v); if (inter->getNumberOfTuples()) throw INTERP_KERNEL::Exception("MEDFileUMesh::checkConsistency(): overlapping entity numbering between mesh sub-levels!"); } @@ -2820,7 +2821,7 @@ catch(INTERP_KERNEL::Exception& e) * * \sa loadLL */ -void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) +void MEDFileUMesh::loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs) { MEDFileUMeshL2 loaderl2; MEDCoupling::MEDCouplingMeshType meshType; @@ -2964,7 +2965,7 @@ void MEDFileUMesh::loadLL(med_idt fid, const std::string& mName, int dt, int it, loaderl2.loadAll(fid,mid,mName,dt,it,mrs); dispatchLoadedPart(fid,loaderl2,mName,mrs); // Structure element part... - int nModels(-1); + med_int nModels(-1); { med_bool chgt=MED_FALSE,trsf=MED_FALSE; nModels=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf); @@ -3020,7 +3021,7 @@ void MEDFileUMesh::writeMeshLL(med_idt fid) const INTERP_KERNEL::AutoPtr 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 spaceDim=coo?coo->getNumberOfComponents():0; + int spaceDim=(int)(coo?coo->getNumberOfComponents():0); int mdim(0); if(!_ms.empty()) mdim=getMeshDimension(); @@ -3080,7 +3081,7 @@ std::vector MEDFileUMesh::getNonEmptyLevelsExt() const std::vector MEDFileUMesh::getFamArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *famCoo(_fam_coords); + const DataArrayIdType *famCoo(_fam_coords); if(famCoo) ret.push_back(1); int lev=0; @@ -3133,11 +3134,11 @@ std::vector MEDFileUMesh::getNameArrNonEmptyLevelsExt() const * \param [in] fams - the name of the family of interest. * \return std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const +std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector& fams) const { - std::vector ret; + std::vector ret; std::vector levs(getNonEmptyLevels()); - std::vector famIds(getFamiliesIds(fams)); + 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); @@ -3149,16 +3150,16 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevels(const std::vector - a sequence of the relative dimensions. */ -std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const +std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const { - std::vector ret0(getFamsNonEmptyLevels(fams)); - const DataArrayInt *famCoords(_fam_coords); + std::vector ret0(getFamsNonEmptyLevels(fams)); + const DataArrayIdType *famCoords(_fam_coords); if(!famCoords) return ret0; - std::vector famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); if(famCoords->presenceOfValue(famIds)) { - std::vector ret(ret0.size()+1); + std::vector ret(ret0.size()+1); ret[0]=1; std::copy(ret0.begin(),ret0.end(),ret.begin()+1); return ret; @@ -3167,22 +3168,22 @@ std::vector MEDFileUMesh::getFamsNonEmptyLevelsExt(const std::vector::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } } @@ -3190,22 +3191,22 @@ int MEDFileUMesh::getMaxAbsFamilyIdInArrays() const return ret; } -int MEDFileUMesh::getMaxFamilyIdInArrays() const +mcIdType MEDFileUMesh::getMaxFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMaxValue(tmp); + mcIdType val=_fam_coords->getMaxValue(tmp); ret=std::max(ret,val); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMaxValue(tmp); + mcIdType val=da->getMaxValue(tmp); ret=std::max(ret,val); } } @@ -3213,22 +3214,22 @@ int MEDFileUMesh::getMaxFamilyIdInArrays() const return ret; } -int MEDFileUMesh::getMinFamilyIdInArrays() const +mcIdType MEDFileUMesh::getMinFamilyIdInArrays() const { - int ret=std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_coords) + mcIdType ret=std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_coords) { - int val=_fam_coords->getMinValue(tmp); + mcIdType val=_fam_coords->getMinValue(tmp); ret=std::min(ret,val); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { if((const MEDFileUMeshSplitL1 *)(*it)) { - const DataArrayInt *da=(*it)->getFamilyField(); + const DataArrayIdType *da=(*it)->getFamilyField(); if(da) { - int val=da->getMinValue(tmp); + mcIdType val=da->getMinValue(tmp); ret=std::min(ret,val); } } @@ -3261,7 +3262,7 @@ int MEDFileUMesh::getSpaceDimension() const const DataArrayDouble *coo=_coords; if(!coo) throw INTERP_KERNEL::Exception(" MEDFileUMesh::getSpaceDimension : no coords set !"); - return coo->getNumberOfComponents(); + return (int)coo->getNumberOfComponents(); } /*! @@ -3329,10 +3330,10 @@ std::string MEDFileUMesh::advancedRepr() const /*! * Returns number of mesh entities of a given relative dimension in \a this mesh. * \param [in] meshDimRelToMaxExt - the relative dimension of interest. - * \return int - the number of entities. + * \return mcIdType - the number of entities. * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. */ -int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) { @@ -3346,10 +3347,10 @@ int MEDFileUMesh::getSizeAtLevel(int meshDimRelToMaxExt) const /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. */ -const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) return _fam_coords; @@ -3357,7 +3358,7 @@ const DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) return l1->getFamilyField(); } -DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) { if(meshDimRelToMaxExt==1) return _fam_coords; @@ -3368,10 +3369,10 @@ DataArrayInt *MEDFileUMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) /*! * Returns the optional numbers of mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers. + * \return const DataArrayIdType * - the array of the entity numbers. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) return _num_coords; @@ -3387,7 +3388,7 @@ const DataArrayAsciiChar *MEDFileUMesh::getNameFieldAtLevel(int meshDimRelToMaxE return l1->getNameField(); } -MCAuto MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const +MCAuto MEDFileUMesh::getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::getGlobalNumFieldAtLevel : not implemented yet for structured mesh !"); @@ -3409,7 +3410,7 @@ const PartDefinition *MEDFileUMesh::getPartDefAtLevel(int meshDimRelToMaxExt, IN return l1->getPartDef(gt); } -int MEDFileUMesh::getNumberOfNodes() const +mcIdType MEDFileUMesh::getNumberOfNodes() const { const DataArrayDouble *coo(_coords); if(!coo) @@ -3417,7 +3418,7 @@ int MEDFileUMesh::getNumberOfNodes() const return coo->getNumberOfTuples(); } -int MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileUMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const { const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMaxExt)); return l1->getNumberOfCells(); @@ -3428,7 +3429,7 @@ bool MEDFileUMesh::hasImplicitPart() const return false; } -int MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +mcIdType MEDFileUMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const { throw INTERP_KERNEL::Exception("MEDFileUMesh::buildImplicitPartIfAny : unstructured meshes do not have implicit part !"); } @@ -3448,7 +3449,7 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con m->computeNodeIdsAlg(nodesFetched); else { - const DataArrayInt *arr(globs->getProfile(st[i].getPflName())); + const DataArrayIdType *arr(globs->getProfile(st[i].getPflName())); MCAuto m2(dynamic_cast(m->buildPartOfMySelf(arr->begin(),arr->end(),true))); m2->computeNodeIdsAlg(nodesFetched); } @@ -3493,13 +3494,13 @@ void MEDFileUMesh::killStructureElements() /*! * Returns the optional numbers of mesh entities of a given dimension transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * DataArrayIdType::invertArrayN2O2O2N(). * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * \return const DataArrayIdType * - the array of the entity numbers transformed using + * DataArrayIdType::invertArrayN2O2O2N(). * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileUMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt==1) { @@ -3617,13 +3618,13 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v synchronizeTinyInfoOnLeaves(); if(meshDimRelToMaxExt==1) { - MCAuto arr=getFamiliesArr(1,fams,renum); + MCAuto arr=getFamiliesArr(1,fams,renum); MCAuto ret=MEDCouplingUMesh::New(); MCAuto c=_coords->selectByTupleId(arr->getConstPointer(),arr->getConstPointer()+arr->getNbOfElems()); ret->setCoords(c); return ret.retn(); } - std::vector famIds=getFamiliesIds(fams); + std::vector famIds=getFamiliesIds(fams); const MEDFileUMeshSplitL1 *l1=getMeshAtLevSafe(meshDimRelToMaxExt); MCAuto zeRet; if(!famIds.empty()) @@ -3642,19 +3643,19 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileUMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const { - std::vector famIds=getFamiliesIds(fams); + std::vector famIds=getFamiliesIds(fams); if(meshDimRelToMaxExt==1) { - if((const DataArrayInt *)_fam_coords) + if((const DataArrayIdType *)_fam_coords) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_coords->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -3707,7 +3708,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu return l1->getWholeMesh(renum); } -std::vector MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const +std::vector MEDFileUMesh::getDistributionOfTypes(int meshDimRelToMax) const { const MEDFileUMeshSplitL1 *l1(getMeshAtLevSafe(meshDimRelToMax)); return l1->getDistributionOfTypes(); @@ -3815,20 +3816,20 @@ MEDCoupling1GTUMesh *MEDFileUMesh::getDirectUndergroundSingleGeoTypeMesh(INTERP_ * * \sa getDistributionOfTypes */ -std::vector< std::pair > MEDFileUMesh::getAllDistributionOfTypes() const +std::vector< std::pair > MEDFileUMesh::getAllDistributionOfTypes() const { - std::vector< std::pair > ret; + std::vector< std::pair > ret; std::vector nel(getNonEmptyLevels()); for(std::vector::reverse_iterator it=nel.rbegin();it!=nel.rend();it++) { std::vector gt(getGeoTypesAtLevel(*it)); for(std::vector::const_iterator it1=gt.begin();it1!=gt.end();it1++) { - int 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())); + ret.push_back(std::pair(INTERP_KERNEL::NORM_ERROR,getNumberOfNodes())); return ret; } @@ -3842,7 +3843,7 @@ std::vector MEDFileUMesh::getGeoTypesAtLevel( return sp->getGeoTypes(); } -int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(ct); const MEDFileUMeshSplitL1 *sp(getMeshAtLevSafe( ((int)cm.getDimension())-getMeshDimension() )); @@ -3852,11 +3853,11 @@ int MEDFileUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) /*! * This method extracts from whole family field ids the part relative to the input parameter \a gt. * \param [in] gt - the geometric type for which the family field is asked. - * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to + * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to * delete using decrRef() as it is no more needed. * \sa MEDFileUMesh::extractNumberFieldOnGeoType */ -DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); int lev=(int)cm.getDimension()-getMeshDimension(); @@ -3867,11 +3868,11 @@ DataArrayInt *MEDFileUMesh::extractFamilyFieldOnGeoType(INTERP_KERNEL::Normalize /*! * This method extracts from whole number field ids the part relative to the input parameter \a gt. * \param [in] gt - the geometric type for which the number field is asked. - * \return DataArrayInt * - a pointer to DataArrayInt that the caller is to + * \return DataArrayIdType * - a pointer to DataArrayIdType that the caller is to * delete using decrRef() as it is no more needed. * \sa MEDFileUMesh::extractFamilyFieldOnGeoType */ -DataArrayInt *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMesh::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(gt); int lev=(int)cm.getDimension()-getMeshDimension(); @@ -3947,9 +3948,9 @@ void MEDFileUMesh::setCoords(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - int nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); _coords.takeRef(coords); - _fam_coords=DataArrayInt::New(); + _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(); @@ -3968,7 +3969,7 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) if(coords==(DataArrayDouble *)_coords) return ; coords->checkAllocated(); - int nbOfTuples(coords->getNumberOfTuples()); + mcIdType nbOfTuples(coords->getNumberOfTuples()); if(_coords.isNull()) { _coords=coords; @@ -3976,7 +3977,7 @@ void MEDFileUMesh::setCoordsForced(DataArrayDouble *coords) } else { - int 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; @@ -3996,7 +3997,7 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) { if(meshDimRelToMaxExt==1) { - if((DataArrayInt *)_fam_coords) + if((DataArrayIdType *)_fam_coords) _fam_coords->fillWithZero(); return ; } @@ -4011,17 +4012,17 @@ void MEDFileUMesh::eraseGroupsAtLevel(int meshDimRelToMaxExt) void MEDFileUMesh::optimizeFamilies() { std::vector levs=getNonEmptyLevelsExt(); - std::set allFamsIds; + std::set allFamsIds; for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { - const DataArrayInt *ffield=getFamilyFieldAtLevel(*it); - MCAuto ids=ffield->getDifferentValues(); - std::set res; + 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())); allFamsIds=res; } std::set famNamesToKill; - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { if(allFamsIds.find((*it).second)!=allFamsIds.end()) famNamesToKill.insert((*it).first); @@ -4069,32 +4070,32 @@ void MEDFileUMesh::optimizeFamilies() * \param[out] cellsNotModified ids of the rest of cells bordering the new boundary whose connectivity remains unchanged. * \sa clearNodeAndCellNumbers() */ -void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, - DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified) +void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayIdType *&nodesDuplicated, + DataArrayIdType *&cellsModified, DataArrayIdType *&cellsNotModified) { typedef MCAuto MUMesh; - typedef MCAuto DAInt; + typedef MCAuto DAInt; std::vector levs=getNonEmptyLevels(); if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end()) 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); - int nbNodes=m0->getNumberOfNodes(); + mcIdType nbNodes=m0->getNumberOfNodes(); MUMesh m11=getGroup(-1,grpNameM1); - DataArrayInt *tmp00=0,*tmp11=0,*tmp22=0; + DataArrayIdType *tmp00=0,*tmp11=0,*tmp22=0; m0->findNodesToDuplicate(*m11,tmp00,tmp11,tmp22); DAInt nodeIdsToDuplicate(tmp00); DAInt cellsToModifyConn0(tmp11); DAInt cellsToModifyConn1(tmp22); MUMesh tmp0=static_cast(m0->buildPartOfMySelf(cellsToModifyConn0->begin(),cellsToModifyConn0->end(),true)); // node renumbering of cells in m1 impacted by duplication of node but not in group 'grpNameM1' on level -1 - DAInt descTmp0=DataArrayInt::New(),descITmp0=DataArrayInt::New(),revDescTmp0=DataArrayInt::New(),revDescITmp0=DataArrayInt::New(); + DAInt descTmp0=DataArrayIdType::New(),descITmp0=DataArrayIdType::New(),revDescTmp0=DataArrayIdType::New(),revDescITmp0=DataArrayIdType::New(); MUMesh tmp0Desc=tmp0->buildDescendingConnectivity(descTmp0,descITmp0,revDescTmp0,revDescITmp0); 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)); - DataArrayInt *cellsInM1ToRenumW4Tmp=0; + DataArrayIdType *cellsInM1ToRenumW4Tmp=0; m1->areCellsIncludedIn(cellsInM1ToRenumW3,2,cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW4(cellsInM1ToRenumW4Tmp); DAInt cellsInM1ToRenumW5=cellsInM1ToRenumW4->findIdsInRange(0,m1->getNumberOfCells()); @@ -4113,7 +4114,7 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, _coords=m0->getCoords(); _coords->incrRef(); // duplication of cells in group 'grpNameM1' on level -1, but not duplicating cells for which nothing has changed m11->duplicateNodesInConn(nodeIdsToDuplicate->begin(),nodeIdsToDuplicate->end(),nbNodes); m11->setCoords(m0->getCoords()); - DataArrayInt * duplCells; + DataArrayIdType * duplCells; m1->areCellsIncludedIn(m11, 0, duplCells); DAInt zeIds = duplCells->findIdsNotInRange(-1, m1->getNumberOfCells()-1); duplCells->decrRef(); MUMesh m11Part=static_cast(m11->buildPartOfMySelf(zeIds->begin(),zeIds->end(),true)); @@ -4123,21 +4124,21 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DAInt idInMsOfCellGrpOfSameType(tmp11); // newm1->setName(getName()); - const DataArrayInt *fam=getFamilyFieldAtLevel(-1); + const DataArrayIdType *fam=getFamilyFieldAtLevel(-1); if(!fam) throw INTERP_KERNEL::Exception("MEDFileUMesh::buildInnerBoundaryAlongM1Group(): internal error no family field !"); - DAInt newFam=DataArrayInt::New(); + DAInt newFam=DataArrayIdType::New(); newFam->alloc(newm1->getNumberOfCells(),1); // Get a new family ID: care must be taken if we need a positive ID or a negative one: // Positive ID for family of nodes, negative for all the rest. - int idd; + mcIdType idd; if (m1->getMeshDimension() == 0) idd=getMaxFamilyId()+1; else idd=getMinFamilyId()-1; - int globStart=0,start=0,end,globEnd; - int nbOfChunks=szOfCellGrpOfSameType->getNumberOfTuples(); - for(int i=0;igetNumberOfTuples(); + for(mcIdType i=0;igetIJ(i,0); if(idInMsOfCellGrpOfSameType->getIJ(i,0)==0) @@ -4163,8 +4164,8 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, fam=_fam_coords; if(fam) { - int newNbOfNodes=getCoords()->getNumberOfTuples(); - newFam=DataArrayInt::New(); newFam->alloc(newNbOfNodes,1); + 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); _fam_coords=newFam; @@ -4188,43 +4189,43 @@ void MEDFileUMesh::buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, * in this method. * * \param [out] oldCode retrieves the distribution of types before the call if true is returned - * \param [out] newCode etrieves the distribution of types after the call if true is returned + * \param [out] newCode retrieves the distribution of types after the call if true is returned * \param [out] o2nRenumCell tells for **all levels** the old 2 new renumbering of cells. * * \return false if no modification has been performed linked to the unpolyzation. Neither cell type, not cell numbers. When false is returned no need of field on cells or on gauss renumbering. * Inversely, if true is returned, it means that distribution of cell by geometric type has changed and field on cell and field on gauss point must be renumbered. */ -bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) +bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { o2nRenumCell=0; oldCode.clear(); newCode.clear(); std::vector levs=getNonEmptyLevels(); bool ret=false; - std::vector< const DataArrayInt* > renumCellsSplited;//same than memorySaverIfThrow - std::vector< MCAuto > memorySaverIfThrow;//same than renumCellsSplited only in case of throw - int start=0; - int end=0; + 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(std::vector::reverse_iterator it=levs.rbegin();it!=levs.rend();it++) { MCAuto m=getMeshAtLevel(*it); - std::vector code1=m->getDistributionOfTypes(); + std::vector code1=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code1,start); oldCode.insert(oldCode.end(),code1.begin(),code1.end()); bool hasChanged=m->unPolyze(); - DataArrayInt *fake=0; - MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, + DataArrayIdType *fake=0; + MCAuto o2nCellsPart=m->getLevArrPerCellTypes(MEDCouplingUMesh::MEDMEM_ORDER, MEDCouplingUMesh::MEDMEM_ORDER+MEDCouplingUMesh::N_MEDMEM_ORDER,fake); fake->decrRef(); renumCellsSplited.push_back(o2nCellsPart); memorySaverIfThrow.push_back(o2nCellsPart); if(hasChanged) { - MCAuto o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); + MCAuto o2nCellsPart2=o2nCellsPart->buildPermArrPerLevel(); m->renumberCells(o2nCellsPart2->getConstPointer(),false); ret=true; - MCAuto famField2,numField2; - const DataArrayInt *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast(famField); } - const DataArrayInt *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast(numField); } + MCAuto famField2,numField2; + const DataArrayIdType *famField=getFamilyFieldAtLevel(*it); if(famField) { famField->incrRef(); famField2=const_cast(famField); } + const DataArrayIdType *numField=getNumberFieldAtLevel(*it); if(numField) { numField->incrRef(); numField2=const_cast(numField); } setMeshAtLevel(*it,m); - std::vector code2=m->getDistributionOfTypes(); + std::vector code2=m->getDistributionOfTypes(); end=PutInThirdComponentOfCodeOffset(code2,start); newCode.insert(newCode.end(),code2.begin(),code2.end()); // @@ -4232,12 +4233,12 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode continue; if(famField) { - MCAuto newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newFamField=famField->renumber(o2nCellsPart2->getConstPointer()); setFamilyFieldArr(*it,newFamField); } if(numField) { - MCAuto newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); + MCAuto newNumField=numField->renumber(o2nCellsPart2->getConstPointer()); setRenumFieldArr(*it,newNumField); } } @@ -4249,8 +4250,8 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode } if(ret) { - MCAuto renumCells=DataArrayInt::Aggregate(renumCellsSplited); - MCAuto o2nRenumCellRet=renumCells->buildPermArrPerLevel(); + MCAuto renumCells=DataArrayIdType::Aggregate(renumCellsSplited); + MCAuto o2nRenumCellRet=renumCells->buildPermArrPerLevel(); o2nRenumCell=o2nRenumCellRet.retn(); } return ret; @@ -4260,8 +4261,8 @@ bool MEDFileUMesh::unPolyze(std::vector& oldCode, std::vector& newCode struct MEDLoaderAccVisit1 { MEDLoaderAccVisit1():_new_nb_of_nodes(0) { } - int operator()(bool val) { return val?_new_nb_of_nodes++:-1; } - int _new_nb_of_nodes; + mcIdType operator()(bool val) { return val?_new_nb_of_nodes++:-1; } + mcIdType _new_nb_of_nodes; }; /*! \endcond */ @@ -4276,12 +4277,12 @@ struct MEDLoaderAccVisit1 * \throw If no coordinates are set in \a this or if there is in any available mesh in \a this a cell having a nodal connectivity containing a node id not in the range of * set coordinates. */ -DataArrayInt *MEDFileUMesh::zipCoords() +DataArrayIdType *MEDFileUMesh::zipCoords() { const DataArrayDouble *coo(getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileUMesh::zipCoords : no coordinates set in this !"); - int nbOfNodes(coo->getNumberOfTuples()); + mcIdType nbOfNodes(coo->getNumberOfTuples()); std::vector nodeIdsInUse(nbOfNodes,false); std::vector neLevs(getNonEmptyLevels()); for(std::vector::const_iterator lev=neLevs.begin();lev!=neLevs.end();lev++) @@ -4300,18 +4301,18 @@ DataArrayInt *MEDFileUMesh::zipCoords() mesh->computeNodeIdsAlg(nodeIdsInUse); } } - int nbrOfNodesInUse((int)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); + mcIdType nbrOfNodesInUse((mcIdType)std::count(nodeIdsInUse.begin(),nodeIdsInUse.end(),true)); if(nbrOfNodesInUse==nbOfNodes) return 0;//no need to update _part_coords - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfNodes,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfNodes,1); std::transform(nodeIdsInUse.begin(),nodeIdsInUse.end(),ret->getPointer(),MEDLoaderAccVisit1()); - MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); + MCAuto ret2(ret->invertArrayO2N2N2OBis(nbrOfNodesInUse)); MCAuto newCoords(coo->selectByTupleIdSafe(ret2->begin(),ret2->end())); - MCAuto newFamCoords; + MCAuto newFamCoords; MCAuto newNameCoords; - if((const DataArrayInt *)_fam_coords) + if((const DataArrayIdType *)_fam_coords) newFamCoords=_fam_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); - MCAuto newNumCoords,newGlobalNumCoords; + MCAuto newNumCoords,newGlobalNumCoords; if(_num_coords.isNotNull()) newNumCoords=_num_coords->selectByTupleIdSafe(ret2->begin(),ret2->end()); if(_global_num_coords.isNotNull()) @@ -4342,14 +4343,14 @@ DataArrayInt *MEDFileUMesh::zipCoords() * The extraction of \a this is specified by the extractDef \a input map. * This map tells for each level of cells, the cells kept in the extraction. * - * \return - a new reference of DataArrayInt that represents sorted node ids, the extraction is lying on. + * \return - a new reference of DataArrayIdType that represents sorted node ids, the extraction is lying on. * \sa MEDFileField1TS::extractPart, MEDFileUMesh::extractPart */ -DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const +DataArrayIdType *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const { std::vector levs(getNonEmptyLevels()); std::vector fetchedNodes(getNumberOfNodes(),false); - for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::deduceNodeSubPartFromCellSubPart : invalid key ! Must be <=1 !"); @@ -4366,7 +4367,7 @@ DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); mPart->computeNodeIdsAlg(fetchedNodes); } - return DataArrayInt::BuildListOfSwitchedOn(fetchedNodes); + return DataArrayIdType::BuildListOfSwitchedOn(fetchedNodes); } /*! @@ -4375,11 +4376,11 @@ DataArrayInt *MEDFileUMesh::deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const +MEDFileUMesh *MEDFileUMesh::extractPart(const std::map >& extractDef) const { MCAuto ret(MEDFileUMesh::New()); ret->setName(getName()); ret->copyFamGrpMapsFrom(*this); std::vector levs(getNonEmptyLevels()); - for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) + for(std::map >::const_iterator it=extractDef.begin();it!=extractDef.end();it++) { if((*it).first>1) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : invalid key ! Must be <=1 !"); @@ -4395,39 +4396,39 @@ MEDFileUMesh *MEDFileUMesh::extractPart(const std::map MCAuto m(getMeshAtLevel((*it).first)); MCAuto mPart(m->buildPartOfMySelf((*it).second->begin(),(*it).second->end(),true)); ret->setMeshAtLevel((*it).first,mPart); - const DataArrayInt *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first)); + const DataArrayIdType *fam(getFamilyFieldAtLevel((*it).first)),*num(getNumberFieldAtLevel((*it).first)); if(fam) { - MCAuto famPart(fam->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); + 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())); + MCAuto numPart(num->selectByTupleIdSafe((*it).second->begin(),(*it).second->end())); ret->setFamilyFieldArr((*it).first,numPart); } } - std::map >::const_iterator it2(extractDef.find(1)); + std::map >::const_iterator it2(extractDef.find(1)); if(it2!=extractDef.end()) { const DataArrayDouble *coo(ret->getCoords()); if(!coo) throw INTERP_KERNEL::Exception("MEDFileUMesh::extractPart : trying to extract nodes whereas there is no nodes !"); - MCAuto o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples())); + MCAuto o2nNodes(((*it2).second)->invertArrayN2O2O2N(coo->getNumberOfTuples())); MCAuto cooPart(coo->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setCoords(cooPart); - const DataArrayInt *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1)); + const DataArrayIdType *fam(getFamilyFieldAtLevel(1)),*num(getNumberFieldAtLevel(1)); if(fam) { - MCAuto famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); + MCAuto famPart(fam->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setFamilyFieldArr(1,famPart); } if(num) { - MCAuto numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); + MCAuto numPart(num->selectByTupleIdSafe((*it2).second->begin(),(*it2).second->end())); ret->setFamilyFieldArr(1,numPart); } - for(std::map >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++) + for(std::map >::const_iterator it3=extractDef.begin();it3!=extractDef.end();it3++) { if((*it3).first==1) continue; @@ -4462,13 +4463,13 @@ 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 !"); - int nbRep(m1D->getNumberOfCells()); + mcIdType nbRep(m1D->getNumberOfCells()); std::vector levs(getNonEmptyLevels()); std::vector grps(getGroupsNames()); std::vector< MCAuto > zeList; DataArrayDouble *coords(0); std::size_t nbOfLevsOut(levs.size()+1); - std::vector< MCAuto > o2ns(nbOfLevsOut); + std::vector< MCAuto > o2ns(nbOfLevsOut); for(std::vector::const_iterator lev=levs.begin();lev!=levs.end();lev++) { MCAuto item(getMeshAtLevel(*lev)); @@ -4496,7 +4497,7 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p { MCAuto elt1(getMeshAtLevel(lev+1)); MCAuto elt2(elt1->clone(false)); - MCAuto tmp(elt2->getNodalConnectivity()->deepCopy()); + MCAuto tmp(elt2->getNodalConnectivity()->deepCopy()); elt2->setConnectivity(tmp,elt2->getNodalConnectivityIndex()); elt2->shiftNodeNumbersInConn(nbRep*elt1->getNumberOfNodes()); elt1->setCoords(elt->getCoords()); elt2->setCoords(elt->getCoords()); @@ -4511,7 +4512,7 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } MCAuto endLev(getMeshAtLevel(levs.back())),endLev2; endLev=endLev->clone(false); endLev->setCoords(coords); - MCAuto tmp(endLev->getNodalConnectivity()->deepCopy()); + MCAuto tmp(endLev->getNodalConnectivity()->deepCopy()); endLev2=endLev->clone(false); endLev2->setConnectivity(tmp,endLev->getNodalConnectivityIndex()); endLev2->shiftNodeNumbersInConn(nbRep*getNumberOfNodes()); endLev=MEDCouplingUMesh::MergeUMeshesOnSameCoords(endLev,endLev2); @@ -4522,18 +4523,18 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p for(std::size_t ii=0;ii!=zeList.size();ii++) { int lev(levs[ii]); - std::vector< MCAuto > outGrps; - std::vector< const DataArrayInt * > outGrps2; + std::vector< MCAuto > outGrps; + std::vector< const DataArrayIdType * > outGrps2; if(lev<=-1) { 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()); - int offset0(zeList[ii]->getNumberOfCells()); - int offset1(offset0+getNumberOfCellsAtLevel(lev+1)); + MCAuto grpArr1(grpArr->deepCopy()),grpArr2(grpArr->deepCopy()); + 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()); @@ -4547,18 +4548,18 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p // 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()) { - int nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); - std::vector< MCAuto > grpArrs(nbRep); - std::vector< const DataArrayInt *> grpArrs2(nbRep); + mcIdType nbCellsB4Extrusion(getNumberOfCellsAtLevel(lev)); + std::vector< MCAuto > grpArrs(nbRep); + std::vector< const DataArrayIdType *> grpArrs2(nbRep); for(int iii=0;iiideepCopy(); grpArrs[iii]->applyLin(1,iii*nbCellsB4Extrusion); grpArrs2[iii]=grpArrs[iii]; } - MCAuto grpArrExt(DataArrayInt::Aggregate(grpArrs2)); + MCAuto grpArrExt(DataArrayIdType::Aggregate(grpArrs2)); grpArrExt->transformWithIndArr(o2ns[ii]->begin(),o2ns[ii]->end()); std::ostringstream grpName; grpName << *grp << "_extruded"; grpArrExt->setName(grpName.str()); @@ -4568,14 +4569,14 @@ MEDFileUMesh *MEDFileUMesh::buildExtrudedMesh(const MEDCouplingUMesh *m1D, int p } ret->setGroupsAtLevel(lev,outGrps2); } - std::vector< MCAuto > outGrps; - std::vector< const DataArrayInt * > outGrps2; + std::vector< MCAuto > outGrps; + std::vector< const DataArrayIdType * > outGrps2; 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()); + MCAuto grpArr2(grpArr1->deepCopy()); std::ostringstream grpName; grpName << *grp << "_top"; grpArr2->setName(grpName.str()); grpArr2->applyLin(1,getNumberOfCellsAtLevel(levs.back())); @@ -4602,25 +4603,25 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co { checkCartesian(); MCAuto ret(MEDFileUMesh::New()); - int initialNbNodes(getNumberOfNodes()); + mcIdType initialNbNodes(getNumberOfNodes()); MCAuto m0Tmp(getMeshAtLevel(0)); MCAuto m0(dynamic_cast(m0Tmp->deepCopy())); { - MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m0->convertLinearCellsToQuadratic(conversionType)); } DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); std::vector levs(getNonEmptyLevels()); - const DataArrayInt *famField(getFamilyFieldAtLevel(0)); + const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MCAuto fam(DataArrayInt::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); + MCAuto fam(DataArrayIdType::New()); fam->alloc(zeCoords->getNumberOfTuples(),1); fam->fillWithZero(); fam->setPartOfValues1(famField,0,initialNbNodes,1,0,1,1); ret->setFamilyFieldArr(1,fam); @@ -4636,21 +4637,21 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co if(m1->getMeshDimension()!=0) { { - MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); + MCAuto notUsed(m1->convertLinearCellsToQuadratic(conversionType)); }//kill unused notUsed var MCAuto m1Coords(m1->getCoords()->selectByTupleIdSafeSlice(initialNbNodes,m1->getNumberOfNodes(),1)); - DataArrayInt *b(0); + DataArrayIdType *b(0); bool a(partZeCoords->areIncludedInMe(m1Coords,eps,b)); - MCAuto bSafe(b); + MCAuto bSafe(b); if(!a) { 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); - MCAuto l0(DataArrayInt::New()); l0->alloc(initialNbNodes,1); l0->iota(); - std::vector v(2); v[0]=l0; v[1]=b; - MCAuto renum(DataArrayInt::Aggregate(v)); + MCAuto l0(DataArrayIdType::New()); l0->alloc(initialNbNodes,1); l0->iota(); + std::vector v(2); v[0]=l0; v[1]=b; + MCAuto renum(DataArrayIdType::Aggregate(v)); m1->renumberNodesInConn(renum->begin()); } m1->setCoords(zeCoords); @@ -4658,7 +4659,7 @@ MEDFileUMesh *MEDFileUMesh::linearToQuadratic(int conversionType, double eps) co famField=getFamilyFieldAtLevel(*lev); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } @@ -4686,16 +4687,16 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const DataArrayDouble *zeCoords(m0->getCoords()); ret->setMeshAtLevel(0,m0); std::vector levs(getNonEmptyLevels()); - const DataArrayInt *famField(getFamilyFieldAtLevel(0)); + const DataArrayIdType *famField(getFamilyFieldAtLevel(0)); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(0,famFieldCpy); } famField=getFamilyFieldAtLevel(1); if(famField) { - MCAuto fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1)); + MCAuto fam(famField->selectByTupleIdSafeSlice(0,zeCoords->getNumberOfTuples(),1)); ret->setFamilyFieldArr(1,fam); } ret->copyFamGrpMapsFrom(*this); @@ -4707,9 +4708,9 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const MCAuto m1(dynamic_cast(m1Tmp->deepCopy())); m1->convertQuadraticCellsToLinear(); m1->zipCoords(); - DataArrayInt *b(0); + DataArrayIdType *b(0); bool a(zeCoords->areIncludedInMe(m1->getCoords(),eps,b)); - MCAuto bSafe(b); + MCAuto bSafe(b); if(!a) { std::ostringstream oss; oss << "MEDFileUMesh::quadraticToLinear : for level " << *lev << " problem to identify nodes generated !"; @@ -4721,7 +4722,7 @@ MEDFileUMesh *MEDFileUMesh::quadraticToLinear(double eps) const famField=getFamilyFieldAtLevel(*lev); if(famField) { - MCAuto famFieldCpy(famField->deepCopy()); + MCAuto famFieldCpy(famField->deepCopy()); ret->setFamilyFieldArr(*lev,famFieldCpy); } } @@ -4755,7 +4756,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector coos(sz); - std::vector fam_coos(sz),num_coos(sz); + std::vector fam_coos(sz),num_coos(sz); for(auto it=meshes.begin();it!=meshes.end();it++,i++) { if(!(*it)) @@ -4767,19 +4768,19 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetSpaceDimension()),meshDim(ref->getMeshDimension()); std::vector levs(ref->getNonEmptyLevels()); - std::map > m_fam,m_renum; + std::map > m_fam,m_renum; std::map > > m_mesh2; std::map > m_mesh; - std::map famNumMap; - std::map famNumMap_rev; + std::map famNumMap; + std::map famNumMap_rev; std::map > grpFamMap; - std::set< MCAuto > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated. + std::set< MCAuto > mem_cleanup; // Memory clean-up. At set deletion (end of method), arrays will be deallocated. // Identify min family number used: - int min_fam_num(0); + mcIdType min_fam_num(0); for(const auto& msh : meshes) { - const std::map& locMap1(msh->getFamilyInfo()); + const std::map& locMap1(msh->getFamilyInfo()); for(const auto& it3 : locMap1) if(it3.second < min_fam_num) min_fam_num = it3.second; @@ -4794,14 +4795,14 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetNonEmptyLevels()!=levs) throw INTERP_KERNEL::Exception("MEDFileUMesh::Aggregate : levels must be the same for elements in input vector !"); - const std::map& locMap1(msh->getFamilyInfo()); + const std::map& locMap1(msh->getFamilyInfo()); std::map substitute; - std::map substituteN; + std::map substituteN; bool fam_conflict(false); for(const auto& it3 : locMap1) { const std::string& famName = it3.first; - int famNum = it3.second; + mcIdType famNum = it3.second; if (famNumMap_rev.find(famNum) != famNumMap_rev.end()) // Family number is already used! { // Is it used by a group of the current mesh or a group from a previous mesh? @@ -4849,8 +4850,8 @@ MCAuto MEDFileUMesh::Aggregate(const std::vectorgetFamilyFieldAtLevel(level)->deepCopy()); // Need a copy - mem_cleanup.insert(MCAuto(dai)); // Make sure array will decrRef() at end of method + DataArrayIdType* dai(msh->getFamilyFieldAtLevel(level)->deepCopy()); // Need a copy + mem_cleanup.insert(MCAuto(dai)); // Make sure array will decrRef() at end of method for (const auto& subN : substituteN) dai->changeValue(subN.first, subN.second); m_fam[level].push_back(dai); @@ -4892,14 +4893,14 @@ 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 DataArrayInt *)0)==fam_coos.end()) + if(std::find(fam_coos.begin(),fam_coos.end(),(const DataArrayIdType *)0)==fam_coos.end()) { - MCAuto fam_coo(DataArrayInt::Aggregate(fam_coos)); + MCAuto fam_coo(DataArrayIdType::Aggregate(fam_coos)); ret->setFamilyFieldArr(1,fam_coo); } - if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayInt *)0)==num_coos.end()) + if(std::find(num_coos.begin(),num_coos.end(),(const DataArrayIdType *)0)==num_coos.end()) { - MCAuto num_coo(DataArrayInt::Aggregate(num_coos)); + MCAuto num_coo(DataArrayIdType::Aggregate(num_coos)); ret->setRenumFieldArr(1,num_coo); } // cells @@ -4910,7 +4911,7 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector mesh(MEDCouplingUMesh::MergeUMeshes((*it2).second)); mesh->setCoords(coo); mesh->setName(ref->getName()); - MCAuto renum(mesh->sortCellsInMEDFileFrmt()); + MCAuto renum(mesh->sortCellsInMEDFileFrmt()); ret->setMeshAtLevel(level,mesh); auto it3(m_fam.find(level)),it4(m_renum.find(level)); if(it3==m_fam.end()) // Should never happen (all levels exist for all meshes) @@ -4918,18 +4919,18 @@ MCAuto MEDFileUMesh::Aggregate(const std::vector& fams((*it3).second); - if(std::find(fams.begin(),fams.end(),(const DataArrayInt *)0)==fams.end()) + const std::vector& fams((*it3).second); + if(std::find(fams.begin(),fams.end(),(const DataArrayIdType *)0)==fams.end()) { - MCAuto famm(DataArrayInt::Aggregate(fams)); + MCAuto famm(DataArrayIdType::Aggregate(fams)); famm->renumberInPlace(renum->begin()); ret->setFamilyFieldArr(level,famm); } // Set optional number field if defined for all input meshes: - const std::vector& renums((*it4).second); - if(std::find(renums.begin(),renums.end(),(const DataArrayInt *)0)==renums.end()) + const std::vector& renums((*it4).second); + if(std::find(renums.begin(),renums.end(),(const DataArrayIdType *)0)==renums.end()) { - MCAuto renumm(DataArrayInt::Aggregate(renums)); + MCAuto renumm(DataArrayIdType::Aggregate(renums)); renumm->renumberInPlace(renum->begin()); ret->setRenumFieldArr(level,renumm); } @@ -4948,17 +4949,17 @@ 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 !"); - int 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(); } -void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) +void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { clearNonDiscrAttributes(); forceComputationOfParts(); tinyDouble.clear(); tinyInt.clear(); tinyStr.clear(); bigArraysI.clear(); bigArrayD=0; - std::vector layer0; + std::vector layer0; layer0.push_back(getAxisType());//0 i layer0.push_back(_order); //1 i layer0.push_back(_iteration);//2 i @@ -4968,16 +4969,16 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& tinyStr.push_back(_desc_name);//1 s for(int i=0;igetInfoOnComponent(i)); - layer0.push_back((int)_families.size());//4 i <- key info aa layer#0 - for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) + layer0.push_back(ToIdType(_families.size()));//4 i <- key info aa layer#0 + for(std::map::const_iterator it=_families.begin();it!=_families.end();it++) { tinyStr.push_back((*it).first); layer0.push_back((*it).second); } - layer0.push_back((int)_groups.size());//4+aa i <- key info bb layer#0 + layer0.push_back((mcIdType)_groups.size());//4+aa i <- key info bb layer#0 for(std::map >::const_iterator it0=_groups.begin();it0!=_groups.end();it0++) { - layer0.push_back((int)(*it0).second.size()); + layer0.push_back(ToIdType((*it0).second.size())); tinyStr.push_back((*it0).first); for(std::vector::const_iterator it1=((*it0).second).begin();it1!=((*it0).second).end();it1++) tinyStr.push_back(*it1); @@ -4991,15 +4992,15 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& layer0.push_back(-1); else { - std::vector tmp0; + std::vector tmp0; pd->serialize(tmp0,bigArraysI); - tinyInt.push_back(tmp0.size()); + tinyInt.push_back(ToIdType(tmp0.size())); tinyInt.insert(tinyInt.end(),tmp0.begin(),tmp0.end()); } // - std::vector layer1; + std::vector layer1; std::vector levs(getNonEmptyLevels()); - layer1.push_back((int)levs.size());// 0 i <- key + layer1.push_back((mcIdType)levs.size());// 0 i <- key layer1.insert(layer1.end(),levs.begin(),levs.end()); for(std::vector::const_iterator it=levs.begin();it!=levs.end();it++) { @@ -5007,19 +5008,19 @@ void MEDFileUMesh::serialize(std::vector& tinyDouble, std::vector& lev->serialize(layer1,bigArraysI); } // put layers all together. - tinyInt.push_back(layer0.size()); + tinyInt.push_back(ToIdType(layer0.size())); tinyInt.insert(tinyInt.end(),layer0.begin(),layer0.end()); - tinyInt.push_back(layer1.size()); + tinyInt.push_back(ToIdType(layer1.size())); tinyInt.insert(tinyInt.end(),layer1.begin(),layer1.end()); } -void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) +void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD) { - int sz0(tinyInt[0]); - std::vector layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0); - int sz1(tinyInt[sz0+1]); - std::vector layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1); + mcIdType sz0(tinyInt[0]); + std::vector layer0(tinyInt.begin()+1,tinyInt.begin()+1+sz0); + mcIdType sz1(tinyInt[sz0+1]); + std::vector layer1(tinyInt.begin()+2+sz0,tinyInt.begin()+2+sz0+sz1); // std::reverse(layer0.begin(),layer0.end()); std::reverse(layer1.begin(),layer1.end()); @@ -5028,9 +5029,9 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector std::reverse(bigArraysI.begin(),bigArraysI.end()); // setAxisType((MEDCouplingAxisType)layer0.back()); layer0.pop_back(); - _order=layer0.back(); layer0.pop_back(); - _iteration=layer0.back(); layer0.pop_back(); - int spaceDim(layer0.back()); layer0.pop_back(); + _order=FromIdType(layer0.back()); layer0.pop_back(); + _iteration=FromIdType(layer0.back()); layer0.pop_back(); + mcIdType spaceDim(layer0.back()); layer0.pop_back(); _time=tinyDouble.back(); tinyDouble.pop_back(); _name=tinyStr.back(); tinyStr.pop_back(); _desc_name=tinyStr.back(); tinyStr.pop_back(); @@ -5040,21 +5041,21 @@ void MEDFileUMesh::unserialize(std::vector& tinyDouble, std::vector _coords->setInfoOnComponent(i,tinyStr.back()); tinyStr.pop_back(); } - int nbOfFams(layer0.back()); layer0.pop_back(); + mcIdType nbOfFams(layer0.back()); layer0.pop_back(); _families.clear(); - for(int i=0;i fams(nbOfFamsOnGrp); - for(int j=0;j& tinyDouble, std::vector _fam_coords=bigArraysI.back(); bigArraysI.pop_back(); _num_coords=bigArraysI.back(); bigArraysI.pop_back(); _part_coords=0; - int isPd(layer0.back()); layer0.pop_back(); + mcIdType isPd(layer0.back()); layer0.pop_back(); if(isPd!=-1) { - std::vector tmp0(layer0.begin(),layer0.begin()+isPd); + std::vector tmp0(layer0.begin(),layer0.begin()+isPd); layer0.erase(layer0.begin(),layer0.begin()+isPd); _part_coords=PartDefinition::Unserialize(tmp0,bigArraysI); } if(!layer0.empty()) throw INTERP_KERNEL::Exception("MEDFileUMesh::unserialize : something wrong during unserialization #1 !"); // - int nbLevs(layer1.back()); layer1.pop_back(); - std::vector levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end()); + mcIdType nbLevs(layer1.back()); layer1.pop_back(); + std::vector levs(layer1.rbegin(),layer1.rbegin()+nbLevs); layer1.erase(layer1.end()-nbLevs,layer1.end()); _ms.clear(); - int maxLev(-(*std::min_element(levs.begin(),levs.end()))); + mcIdType maxLev(-(*std::min_element(levs.begin(),levs.end()))); _ms.resize(maxLev+1); - for(int i=0;i& tinyDouble, std::vector * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) +void MEDFileUMesh::addNodeGroup(const DataArrayIdType *ids) { const DataArrayDouble *coords(_coords); if(!coords) throw INTERP_KERNEL::Exception("MEDFileUMesh::addNodeGroup : no coords set !"); - int nbOfNodes(coords->getNumberOfTuples()); + mcIdType nbOfNodes(coords->getNumberOfTuples()); if(_fam_coords.isNull()) - { _fam_coords=DataArrayInt::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } + { _fam_coords=DataArrayIdType::New(); _fam_coords->alloc(nbOfNodes,1); _fam_coords->fillWithZero(); } // addGroupUnderground(true,ids,_fam_coords); } @@ -5115,7 +5116,7 @@ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) /*! * Adds a group of nodes/cells/faces/edges to \a this mesh. * - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -5127,7 +5128,7 @@ void MEDFileUMesh::addNodeGroup(const DataArrayInt *ids) * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) +void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) { std::vector levs(getNonEmptyLevelsExt()); if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)==levs.end()) @@ -5138,7 +5139,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) if(meshDimRelToMaxExt==1) { addNodeGroup(ids); return ; } MEDFileUMeshSplitL1 *lev(getMeshAtLevSafe(meshDimRelToMaxExt)); - DataArrayInt *fam(lev->getOrCreateAndGetFamilyField()); + DataArrayIdType *fam(lev->getOrCreateAndGetFamilyField()); addGroupUnderground(false,ids,fam); } @@ -5148,7 +5149,7 @@ void MEDFileUMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) * \param [in] newFamName - the new family name. * \throw If no family with the given \a id exists. */ -void MEDFileUMesh::setFamilyNameAttachedOnId(int id, const std::string& newFamName) +void MEDFileUMesh::setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName) { std::string oldName=getFamilyNameGivenId(id); _families.erase(oldName); @@ -5308,11 +5309,11 @@ void MEDFileUMesh::setGroupsFromScratch(int meshDimRelToMax, const std::vector corr; + std::vector corr; MCAuto m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,_zipconn_pol,corr); - std::vector< MCAuto > corr3(corr.begin(),corr.end()); + std::vector< MCAuto > corr3(corr.begin(),corr.end()); setMeshAtLevel(meshDimRelToMax,m,renum); - std::vector corr2(corr.begin(),corr.end()); + std::vector corr2(corr.begin(),corr.end()); setGroupsAtLevel(meshDimRelToMax,corr2,true); } @@ -5353,11 +5354,11 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector > corr(ms.size()); + std::vector< MCAuto > corr(ms.size()); int i=0; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) { - DataArrayInt *arr=0; + DataArrayIdType *arr=0; bool test=m->areCellsIncludedIn(*it,_zipconn_pol,arr); corr[i]=arr; if(!test) @@ -5366,7 +5367,7 @@ void MEDFileUMesh::setGroupsOnSetMesh(int meshDimRelToMax, const std::vector corr2(corr.begin(),corr.end()); + std::vector corr2(corr.begin(),corr.end()); setGroupsAtLevel(meshDimRelToMax,corr2,renum); } @@ -5393,7 +5394,7 @@ DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vectorsetNameArr(nameArr); } -void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) +void MEDFileUMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) { if(meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileUMesh::setGlobalNumFieldAtLevel : Only implemented for meshDimRelToMaxExt==1 for the moment !"); @@ -5505,9 +5506,9 @@ void MEDFileUMesh::synchronizeTinyInfoOnLeaves() const /*! * This method is called by MEDFileMesh::changeFamilyId. It performs only one part of the family id modification. */ -void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) +void MEDFileUMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam_coords; + DataArrayIdType *arr=_fam_coords; if(arr) arr->changeValue(oldId,newId); for(std::vector< MCAuto >::iterator it=_ms.begin();it!=_ms.end();it++) @@ -5520,12 +5521,12 @@ void MEDFileUMesh::changeFamilyIdArr(int oldId, int newId) } } -std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const { - std::list< MCAuto > ret; - const DataArrayInt *da(_fam_coords); + std::list< MCAuto > ret; + const DataArrayIdType *da(_fam_coords); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } for(std::vector< MCAuto >::const_iterator it=_ms.begin();it!=_ms.end();it++) { const MEDFileUMeshSplitL1 *elt(*it); @@ -5533,7 +5534,7 @@ std::list< MCAuto > MEDFileUMesh::getAllNonNullFamilyIds() const { da=elt->getFamilyField(); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } } } return ret; @@ -5543,8 +5544,8 @@ void MEDFileUMesh::computeRevNum() const { if(_num_coords.isNotNull()) { - int pos; - int maxValue=_num_coords->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_coords->getMaxValue(pos); _rev_num_coords=_num_coords->invertArrayN2O2O2N(maxValue+1); } } @@ -5557,79 +5558,79 @@ std::size_t MEDFileStructuredMesh::getHeapMemorySizeWithoutChildren() const std::vector MEDFileStructuredMesh::getDirectChildrenWithNull() const { std::vector ret(MEDFileMesh::getDirectChildrenWithNull()); - ret.push_back((const DataArrayInt *)_fam_nodes); - ret.push_back((const DataArrayInt *)_num_nodes); + ret.push_back((const DataArrayIdType *)_fam_nodes); + ret.push_back((const DataArrayIdType *)_num_nodes); ret.push_back((const DataArrayAsciiChar *)_names_nodes); - ret.push_back((const DataArrayInt *)_fam_cells); - ret.push_back((const DataArrayInt *)_num_cells); + ret.push_back((const DataArrayIdType *)_fam_cells); + ret.push_back((const DataArrayIdType *)_num_cells); ret.push_back((const DataArrayAsciiChar *)_names_cells); - ret.push_back((const DataArrayInt *)_fam_faces); - ret.push_back((const DataArrayInt *)_num_faces); - ret.push_back((const DataArrayInt *)_rev_num_nodes); + ret.push_back((const DataArrayIdType *)_fam_faces); + ret.push_back((const DataArrayIdType *)_num_faces); + ret.push_back((const DataArrayIdType *)_rev_num_nodes); ret.push_back((const DataArrayAsciiChar *)_names_faces); - ret.push_back((const DataArrayInt *)_rev_num_cells); + ret.push_back((const DataArrayIdType *)_rev_num_cells); ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary); return ret; } -int MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMaxAbsFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,std::abs(val)); } return ret; } -int MEDFileStructuredMesh::getMaxFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMaxFamilyIdInArrays() const { - int ret=-std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=-std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMaxValue(tmp); + mcIdType val=_fam_nodes->getMaxValue(tmp); ret=std::max(ret,val); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMaxValue(tmp); + mcIdType val=_fam_cells->getMaxValue(tmp); ret=std::max(ret,val); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMaxValue(tmp); + mcIdType val=_fam_faces->getMaxValue(tmp); ret=std::max(ret,val); } return ret; } -int MEDFileStructuredMesh::getMinFamilyIdInArrays() const +mcIdType MEDFileStructuredMesh::getMinFamilyIdInArrays() const { - int ret=std::numeric_limits::max(),tmp=-1; - if((const DataArrayInt *)_fam_nodes) + mcIdType ret=std::numeric_limits::max(),tmp=-1; + if((const DataArrayIdType *)_fam_nodes) { - int val=_fam_nodes->getMinValue(tmp); + mcIdType val=_fam_nodes->getMinValue(tmp); ret=std::min(ret,val); } - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - int val=_fam_cells->getMinValue(tmp); + mcIdType val=_fam_cells->getMinValue(tmp); ret=std::min(ret,val); } - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - int val=_fam_faces->getMinValue(tmp); + mcIdType val=_fam_faces->getMinValue(tmp); ret=std::min(ret,val); } return ret; @@ -5645,8 +5646,8 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s what="Mesh types differ ! This is structured and other is NOT !"; return false; } - const DataArrayInt *famc1=_fam_nodes; - const DataArrayInt *famc2=otherC->_fam_nodes; + const DataArrayIdType *famc1=_fam_nodes; + const DataArrayIdType *famc2=otherC->_fam_nodes; if((famc1==0 && famc2!=0) || (famc1!=0 && famc2==0)) { what="Mismatch of families arr on nodes ! One is defined and not other !"; @@ -5795,24 +5796,24 @@ bool MEDFileStructuredMesh::isEqual(const MEDFileMesh *other, double eps, std::s void MEDFileStructuredMesh::clearNonDiscrAttributes() const { MEDFileMesh::clearNonDiscrAttributes(); - const DataArrayInt *tmp=_fam_nodes; + const DataArrayIdType *tmp=_fam_nodes; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_nodes; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_fam_cells; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_cells; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_fam_faces; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); tmp=_num_faces; if(tmp) - (const_cast(tmp))->setName(""); + (const_cast(tmp))->setName(""); } /*! @@ -5822,21 +5823,21 @@ void MEDFileStructuredMesh::clearNonDiscrAttributes() const * \param [in] fams - the names of the families of interest. * \param [in] renum - if \c true, the optional numbers of entities, if available, are * returned instead of ids. - * \return DataArrayInt * - a new instance of DataArrayInt holding either ids or + * \return DataArrayIdType * - a new instance of DataArrayIdType holding either ids or * numbers, if available and required, of mesh entities of the families. The caller * is to delete this array using decrRef() as it is no more needed. * \throw If the family field is missing for \a meshDimRelToMaxExt. */ -DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const +DataArrayIdType *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum) const { - std::vector famIds(getFamiliesIds(fams)); + std::vector famIds(getFamiliesIds(fams)); switch(meshDimRelToMaxExt) { case 1: { - if((const DataArrayInt *)_fam_nodes) + if((const DataArrayIdType *)_fam_nodes) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_nodes->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5852,9 +5853,9 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons } case 0: { - if((const DataArrayInt *)_fam_cells) + if((const DataArrayIdType *)_fam_cells) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_cells->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5870,9 +5871,9 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons } case -1: { - if((const DataArrayInt *)_fam_faces) + if((const DataArrayIdType *)_fam_faces) { - MCAuto da; + MCAuto da; if(!famIds.empty()) da=_fam_faces->findIdsEqualList(&famIds[0],&famIds[0]+famIds.size()); else @@ -5901,7 +5902,7 @@ DataArrayInt *MEDFileStructuredMesh::getFamiliesArr(int meshDimRelToMaxExt, cons * \throw If \a famArr has an invalid size. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1 and \a meshDimRelToMaxExt != -1. */ -void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) +void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) { const MEDCouplingStructuredMesh *mesh(getStructuredMesh()); if(!mesh) @@ -5910,7 +5911,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI { case 0: { - int 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; @@ -5918,7 +5919,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case 1: { - int 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; @@ -5926,7 +5927,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI } case -1: { - int 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; @@ -5947,7 +5948,7 @@ void MEDFileStructuredMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayI * \throw If \a renumArr has an invalid size. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) +void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) { const MEDCouplingStructuredMesh *mesh=getStructuredMesh(); if(!mesh) @@ -5956,21 +5957,21 @@ void MEDFileStructuredMesh::setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIn { case 0: { - int 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: { - int 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: { - int 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; @@ -5998,21 +5999,21 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra { case 0: { - int 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: { - int 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: { - int 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; } @@ -6023,14 +6024,14 @@ void MEDFileStructuredMesh::setNameFieldAtLevel(int meshDimRelToMaxExt, DataArra nameArr->incrRef(); } -void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) +void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) { throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::setGlobalNumFieldAtLevel : not implemented yet !"); } /*! * Adds a group of nodes to \a this mesh. - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -6042,7 +6043,7 @@ void MEDFileStructuredMesh::setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, Dat * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) +void MEDFileStructuredMesh::addNodeGroup(const DataArrayIdType *ids) { addGroup(1,ids); } @@ -6050,7 +6051,7 @@ void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) /*! * Adds a group of nodes/cells/faces/edges to \a this mesh. * - * \param [in] ids - a DataArrayInt providing ids and a name of the group to add. + * \param [in] ids - a DataArrayIdType providing ids and a name of the group to add. * The ids should be sorted and different each other (MED file norm). * * \warning this method can alter default "FAMILLE_ZERO" family. @@ -6062,9 +6063,9 @@ void MEDFileStructuredMesh::addNodeGroup(const DataArrayInt *ids) * \throw If \a ids does not respect the MED file norm. * \throw If a group with name \a ids->getName() already exists. */ -void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) +void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) { - DataArrayInt *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt)); + DataArrayIdType *fam(getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt)); addGroupUnderground(false,ids,fam); return ; } @@ -6072,11 +6073,11 @@ void MEDFileStructuredMesh::addGroup(int meshDimRelToMaxExt, const DataArrayInt /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { switch(meshDimRelToMaxExt) { @@ -6094,11 +6095,11 @@ const DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelT /*! * Returns the family field for mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the family field. It is an array of ids of families + * \return const DataArrayIdType * - the family field. It is an array of ids of families * each mesh entity belongs to. It can be \c NULL. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) +DataArrayIdType *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxExt) { switch(meshDimRelToMaxExt) { @@ -6116,11 +6117,11 @@ DataArrayInt *MEDFileStructuredMesh::getFamilyFieldAtLevel(int meshDimRelToMaxEx /*! * Returns the optional numbers of mesh entities of a given dimension. * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers. + * \return const DataArrayIdType * - the array of the entity numbers. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. */ -const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelToMaxExt) const { switch(meshDimRelToMaxExt) { @@ -6137,23 +6138,23 @@ const DataArrayInt *MEDFileStructuredMesh::getNumberFieldAtLevel(int meshDimRelT /*! * Returns the optional numbers of mesh entities of a given dimension transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * DataArrayIdType::invertArrayN2O2O2N(). * \param [in] meshDimRelToMaxExt - the relative dimension of mesh entities. - * \return const DataArrayInt * - the array of the entity numbers transformed using - * DataArrayInt::invertArrayN2O2O2N(). + * \return const DataArrayIdType * - the array of the entity numbers transformed using + * DataArrayIdType::invertArrayN2O2O2N(). * \throw If \a meshDimRelToMaxExt != 0 and \a meshDimRelToMaxExt != 1. * \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh. */ -const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const +const DataArrayIdType *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { if(meshDimRelToMaxExt!=0 && meshDimRelToMaxExt!=1) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getRevNumberFieldAtLevel : Only available for levels 0 or 1 !"); if(meshDimRelToMaxExt==0) { - if((const DataArrayInt *)_num_cells) + if((const DataArrayIdType *)_num_cells) { - int pos; - int maxValue=_num_cells->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_cells->getMaxValue(pos); _rev_num_cells=_num_cells->invertArrayN2O2O2N(maxValue+1); return _rev_num_cells; } @@ -6162,10 +6163,10 @@ const DataArrayInt *MEDFileStructuredMesh::getRevNumberFieldAtLevel(int meshDimR } else { - if((const DataArrayInt *)_num_nodes) + if((const DataArrayIdType *)_num_nodes) { - int pos; - int maxValue=_num_nodes->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num_nodes->getMaxValue(pos); _rev_num_nodes=_num_nodes->invertArrayN2O2O2N(maxValue+1); return _rev_num_nodes; } @@ -6189,7 +6190,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 !"); } @@ -6221,7 +6222,7 @@ std::vector MEDFileStructuredMesh::getNonEmptyLevelsExt() const std::vector MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces); + const DataArrayIdType *famNodes(_fam_nodes),*famCells(_fam_cells),*famFaces(_fam_faces); if(famNodes) ret.push_back(1); if(famCells) @@ -6237,7 +6238,7 @@ std::vector MEDFileStructuredMesh::getFamArrNonEmptyLevelsExt() const std::vector MEDFileStructuredMesh::getNumArrNonEmptyLevelsExt() const { std::vector ret; - const DataArrayInt *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces); + const DataArrayIdType *numNodes(_num_nodes),*numCells(_num_cells),*numFaces(_num_faces); if(numNodes) ret.push_back(1); if(numCells) @@ -6266,15 +6267,15 @@ std::vector MEDFileStructuredMesh::getNameArrNonEmptyLevelsExt() const /*! * no implementation here, it is not a bug, but intresically no polyhedra in \a this. */ -bool MEDFileStructuredMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) +bool MEDFileStructuredMesh::unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) { oldCode.clear(); newCode.clear(); o2nRenumCell=0; return false; } -void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId) +void MEDFileStructuredMesh::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam_nodes; + DataArrayIdType *arr=_fam_nodes; if(arr) arr->changeValue(oldId,newId); arr=_fam_cells; @@ -6285,44 +6286,44 @@ void MEDFileStructuredMesh::changeFamilyIdArr(int oldId, int newId) arr->changeValue(oldId,newId); } -std::list< MCAuto > MEDFileStructuredMesh::getAllNonNullFamilyIds() const +std::list< MCAuto > MEDFileStructuredMesh::getAllNonNullFamilyIds() const { - std::list< MCAuto > ret; - const DataArrayInt *da(_fam_nodes); + std::list< MCAuto > ret; + const DataArrayIdType *da(_fam_nodes); if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_cells; if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } da=_fam_faces; if(da) - { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } + { da->incrRef(); ret.push_back(MCAuto(const_cast(da))); } return ret; } void MEDFileStructuredMesh::deepCpyAttributes() { - if((const DataArrayInt*)_fam_nodes) + if((const DataArrayIdType*)_fam_nodes) _fam_nodes=_fam_nodes->deepCopy(); - if((const DataArrayInt*)_num_nodes) + if((const DataArrayIdType*)_num_nodes) _num_nodes=_num_nodes->deepCopy(); if((const DataArrayAsciiChar*)_names_nodes) _names_nodes=_names_nodes->deepCopy(); - if((const DataArrayInt*)_fam_cells) + if((const DataArrayIdType*)_fam_cells) _fam_cells=_fam_cells->deepCopy(); - if((const DataArrayInt*)_num_cells) + if((const DataArrayIdType*)_num_cells) _num_cells=_num_cells->deepCopy(); if((const DataArrayAsciiChar*)_names_cells) _names_cells=_names_cells->deepCopy(); - if((const DataArrayInt*)_fam_faces) + if((const DataArrayIdType*)_fam_faces) _fam_faces=_fam_faces->deepCopy(); - if((const DataArrayInt*)_num_faces) + if((const DataArrayIdType*)_num_faces) _num_faces=_num_faces->deepCopy(); if((const DataArrayAsciiChar*)_names_faces) _names_faces=_names_faces->deepCopy(); - if((const DataArrayInt*)_rev_num_nodes) + if((const DataArrayIdType*)_rev_num_nodes) _rev_num_nodes=_rev_num_nodes->deepCopy(); - if((const DataArrayInt*)_rev_num_cells) + if((const DataArrayIdType*)_rev_num_cells) _rev_num_cells=_rev_num_cells->deepCopy(); } @@ -6369,10 +6370,10 @@ MEDCouplingMesh *MEDFileStructuredMesh::getMeshAtLevel(int meshDimRelToMax, bool } } -std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector& fams) const +std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector& fams) const { - std::vector ret; - const DataArrayInt *famCells(_fam_cells),*famFaces(_fam_faces); + std::vector ret; + const DataArrayIdType *famCells(_fam_cells),*famFaces(_fam_faces); if(famCells && famCells->presenceOfValue(ret)) ret.push_back(0); if(famFaces && famFaces->presenceOfValue(ret)) @@ -6380,10 +6381,10 @@ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevels(const std::vector< return ret; } -std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const +std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vector& fams) const { - std::vector ret(getFamsNonEmptyLevels(fams)); - const DataArrayInt *famNodes(_fam_nodes); + std::vector ret(getFamsNonEmptyLevels(fams)); + const DataArrayIdType *famNodes(_fam_nodes); if(famNodes && famNodes->presenceOfValue(ret)) ret.push_back(1); return ret; @@ -6392,10 +6393,10 @@ std::vector MEDFileStructuredMesh::getFamsNonEmptyLevelsExt(const std::vect /*! * Returns number of mesh entities of a given relative dimension in \a this mesh. * \param [in] meshDimRelToMaxExt - the relative dimension of interest. - * \return int - the number of entities. + * \return mcIdType - the number of entities. * \throw If no mesh entities of dimension \a meshDimRelToMaxExt are available in \a this mesh. */ -int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6413,7 +6414,7 @@ int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const } } -int MEDFileStructuredMesh::getNumberOfNodes() const +mcIdType MEDFileStructuredMesh::getNumberOfNodes() const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6421,7 +6422,7 @@ int MEDFileStructuredMesh::getNumberOfNodes() const return cmesh->getNumberOfNodes(); } -int MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const +mcIdType MEDFileStructuredMesh::getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const { const MEDCouplingStructuredMesh *cmesh(getStructuredMesh()); if(!cmesh) @@ -6445,7 +6446,7 @@ bool MEDFileStructuredMesh::hasImplicitPart() const /*! * \sa MEDFileStructuredMesh::getImplicitFaceMesh */ -int MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const +mcIdType MEDFileStructuredMesh::buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const { static const char MSG[]="MEDFileStructuredMesh::buildImplicitPartIfAny : the given geo type is not manageable by a structured mesh !"; const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary); @@ -6522,7 +6523,7 @@ std::vector MEDFileStructuredMesh::getGeoType } } -int MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { if(ct!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension())) return 0; @@ -6536,21 +6537,21 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on single geo type ! it is not managed yet for structured mesh !"); if(st[0].getGeo()!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension())) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on expected geo type !"); - if(getNumberOfNodes()!=(int)nodesFetched.size()) + if(getNumberOfNodes()!=(mcIdType)nodesFetched.size()) throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : invalid size of array !"); if(st[0].getPflName().empty()) { std::fill(nodesFetched.begin(),nodesFetched.end(),true); return ; } - const DataArrayInt *arr(globs->getProfile(st[0].getPflName())); + const DataArrayIdType *arr(globs->getProfile(st[0].getPflName())); const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before - int sz(nodesFetched.size()); - for(const int *work=arr->begin();work!=arr->end();work++) + mcIdType sz(ToIdType(nodesFetched.size())); + for(const mcIdType *work=arr->begin();work!=arr->end();work++) { - std::vector conn; + std::vector conn; cmesh->getNodeIdsOfCell(*work,conn); - for(std::vector::const_iterator it=conn.begin();it!=conn.end();it++) + for(std::vector::const_iterator it=conn.begin();it!=conn.end();it++) if(*it>=0 && *it& famCells, MCAuto& numCells, MCAuto& namesCells) + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells) { med_bool chgt=MED_FALSE,trsf=MED_FALSE; med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim); - int nbOfElt(0); + mcIdType nbOfElt(0); nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf); if(nbOfElt>0) { if(!mrs || mrs->isCellFamilyFieldReading()) { - famCells=DataArrayInt::New(); - famCells->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer())); + MCAuto miFamCells=DataArrayMedInt::New(); + miFamCells->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miFamCells->getPointer())); + famCells = FromMedIntArray( miFamCells ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf); @@ -6585,9 +6587,10 @@ void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int { if(!mrs || mrs->isCellNumFieldReading()) { - numCells=DataArrayInt::New(); - numCells->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer())); + MCAuto miNumCells=DataArrayMedInt::New(); + miNumCells->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,miNumCells->getPointer())); + numCells = FromMedIntArray( miNumCells ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf); @@ -6614,19 +6617,20 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt setTimeUnit(strm->getTimeUnit()); MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf)); + mcIdType nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf)); if(nbOfElt>0) { if(!mrs || mrs->isNodeFamilyFieldReading()) { - int 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 !"); - _fam_nodes=DataArrayInt::New(); - _fam_nodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line. + MCAuto miFamNodes=DataArrayMedInt::New(); + miFamNodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line. if(nbNodes>nbOfElt)//yes it appends some times... It explains surely the mdump implementation. Bug revealed by PARAVIS EDF #2475 on structured.med file where only 12 first nodes are !=0 so nbOfElt=12 and nbOfNodes=378... - _fam_nodes->fillWithZero(); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer())); + miFamNodes->fillWithZero(); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miFamNodes->getPointer())); + _fam_nodes = FromMedIntArray( miFamNodes ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf); @@ -6634,9 +6638,10 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt { if(!mrs || mrs->isNodeNumFieldReading()) { - _num_nodes=DataArrayInt::New(); - _num_nodes->alloc(nbOfElt,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer())); + MCAuto miNumNodes=DataArrayMedInt::New(); + miNumNodes->alloc(nbOfElt,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,miNumNodes->getPointer())); + _num_nodes = FromMedIntArray( miNumNodes ); } } nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf); @@ -6661,18 +6666,18 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma int meshDim(getStructuredMesh()->getMeshDimension()); med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1)); // - if((const DataArrayInt *)_fam_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer())); - if((const DataArrayInt *)_fam_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer())); - if((const DataArrayInt *)_fam_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer())); - if((const DataArrayInt *)_num_cells) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer())); - if((const DataArrayInt *)_num_faces) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer())); - if((const DataArrayInt *)_num_nodes) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer())); + if((const DataArrayIdType *)_fam_cells) + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_fam_cells->getNumberOfTuples()),ToMedIntArray(_fam_cells)->getConstPointer())); + if((const DataArrayIdType *)_fam_faces) + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_fam_faces->getNumberOfTuples()),ToMedIntArray(_fam_faces)->getConstPointer())); + if((const DataArrayIdType *)_fam_nodes) + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_fam_nodes->getNumberOfTuples()),ToMedIntArray(_fam_nodes)->getConstPointer())); + if((const DataArrayIdType *)_num_cells) + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_num_cells->getNumberOfTuples()),ToMedIntArray(_num_cells)->getConstPointer())); + if((const DataArrayIdType *)_num_faces) + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_num_faces->getNumberOfTuples()),ToMedIntArray(_num_faces)->getConstPointer())); + if((const DataArrayIdType *)_num_nodes) + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_num_nodes->getNumberOfTuples()),ToMedIntArray(_num_nodes)->getConstPointer())); if((const DataArrayAsciiChar *)_names_cells) { if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -6681,7 +6686,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,ToMedInt(_names_cells->getNumberOfTuples()),_names_cells->getConstPointer())); } if((const DataArrayAsciiChar *)_names_faces) { @@ -6691,7 +6696,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_faces->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,ToMedInt(_names_faces->getNumberOfTuples()),_names_faces->getConstPointer())); } if((const DataArrayAsciiChar *)_names_nodes) { @@ -6701,7 +6706,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& ma oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,ToMedInt(_names_nodes->getNumberOfTuples()),_names_nodes->getConstPointer())); } // MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str); @@ -6999,7 +7004,7 @@ void MEDFileCMesh::writeMeshLL(med_idt fid) const for(int i=0;igetCoordsAt(i); - MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,ToMedInt(da->getNumberOfTuples()),da->getConstPointer())); } // std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); @@ -7228,10 +7233,10 @@ void MEDFileCurveLinearMesh::writeMeshLL(med_idt fid) const if(_univ_wr_status) MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa)); MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID)); - std::vector nodeGridSt=_clmesh->getNodeGridStructure(); - MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0])); + std::vector nodeGridSt=_clmesh->getNodeGridStructure(); + MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,ToMedIntArray(nodeGridSt)->getConstPointer())); - MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); + MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin())); // std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE)); MEDFileStructuredMesh::writeStructuredLL(fid,meshName); @@ -7497,7 +7502,7 @@ void MEDFileMeshes::writeLL(med_idt fid) const int MEDFileMeshes::getNumberOfMeshes() const { - return _meshes.size(); + return (int)_meshes.size(); } MEDFileMeshesIterator *MEDFileMeshes::iterator() diff --git a/src/MEDLoader/MEDFileMesh.hxx b/src/MEDLoader/MEDFileMesh.hxx index 4b54ed0ce..aadb0fcc3 100644 --- a/src/MEDLoader/MEDFileMesh.hxx +++ b/src/MEDLoader/MEDFileMesh.hxx @@ -74,21 +74,21 @@ namespace MEDCoupling MEDLOADER_EXPORT void setAxisType(MEDCouplingAxisType at) { _axis_type=at; } MEDLOADER_EXPORT MEDCouplingAxisType getAxisType() const { return _axis_type; } MEDLOADER_EXPORT std::vector getAllGeoTypes() const; - MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0; - MEDLOADER_EXPORT virtual int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfNodes() const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual bool hasImplicitPart() const = 0; - MEDLOADER_EXPORT virtual int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0; + MEDLOADER_EXPORT virtual mcIdType buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) const = 0; MEDLOADER_EXPORT virtual void releaseImplicitPartIfAny() const = 0; MEDLOADER_EXPORT virtual std::vector getGeoTypesAtLevel(int meshDimRelToMax) const = 0; - MEDLOADER_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0; + MEDLOADER_EXPORT virtual mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevels() const = 0; MEDLOADER_EXPORT virtual std::vector getNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getFamArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNumArrNonEmptyLevelsExt() const = 0; MEDLOADER_EXPORT virtual std::vector getNameArrNonEmptyLevelsExt() const = 0; - MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual mcIdType getSizeAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0; - MEDLOADER_EXPORT virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; + MEDLOADER_EXPORT virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; MEDLOADER_EXPORT virtual void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector& nodesFetched) const = 0; MEDLOADER_EXPORT virtual MEDFileMesh *cartesianize() const = 0; MEDLOADER_EXPORT virtual bool presenceOfStructureElements() const = 0; @@ -97,41 +97,41 @@ namespace MEDCoupling MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const; MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const; MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const; - MEDLOADER_EXPORT bool existsFamily(int famId) const; + MEDLOADER_EXPORT bool existsFamily(mcIdType famId) const; MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const; - MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id); - MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id); - MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id); + MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, mcIdType id); + MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, mcIdType id); + MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, mcIdType id); MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName); - MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); + MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName); - MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created); - MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); + MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(mcIdType id, bool& created); + MEDLOADER_EXPORT void setFamilyInfo(const std::map& info); MEDLOADER_EXPORT void setGroupInfo(const std::map >&info); MEDLOADER_EXPORT void copyFamGrpMapsFrom(const MEDFileMesh& other); MEDLOADER_EXPORT void clearGrpMap(); MEDLOADER_EXPORT void clearFamMap(); MEDLOADER_EXPORT void clearFamGrpMaps(); - MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } + MEDLOADER_EXPORT const std::map& getFamilyInfo() const { return _families; } MEDLOADER_EXPORT const std::map >& getGroupInfo() const { return _groups; } MEDLOADER_EXPORT std::vector getFamiliesOnGroup(const std::string& name) const; MEDLOADER_EXPORT std::vector getFamiliesOnGroups(const std::vector& grps) const; - MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const std::string& name) const; + MEDLOADER_EXPORT std::vector getFamiliesIdsOnGroup(const std::string& name) const; MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector& fams); - MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); + MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); MEDLOADER_EXPORT std::vector getGroupsOnFamily(const std::string& name) const; MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector& grps); MEDLOADER_EXPORT std::vector getGroupsNames() const; MEDLOADER_EXPORT std::vector getFamiliesNames() const; MEDLOADER_EXPORT std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; - MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const std::string& grp) const; - MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; - MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; - MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevels(const std::vector& fams) const = 0; - MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const = 0; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const std::string& fam) const; - MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getGrpNonEmptyLevels(const std::string& grp) const; + MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; + MEDLOADER_EXPORT std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; + MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevels(const std::vector& fams) const = 0; + MEDLOADER_EXPORT virtual std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const = 0; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevels(const std::string& fam) const; + MEDLOADER_EXPORT std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; MEDLOADER_EXPORT std::vector getFamiliesNamesWithFilePointOfView() const; MEDLOADER_EXPORT static std::string GetMagicFamilyStr(); MEDLOADER_EXPORT void assignFamilyNameWithGroupName(); @@ -147,22 +147,22 @@ namespace MEDCoupling MEDLOADER_EXPORT void checkOrphanFamilyZero() const; MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName); MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName); - MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId); + MEDLOADER_EXPORT void changeFamilyId(mcIdType oldId, mcIdType newId); MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames); - MEDLOADER_EXPORT int getFamilyId(const std::string& name) const; - MEDLOADER_EXPORT int getMaxAbsFamilyId() const; - MEDLOADER_EXPORT int getMaxFamilyId() const; - MEDLOADER_EXPORT int getMinFamilyId() const; - MEDLOADER_EXPORT int getTheMaxAbsFamilyId() const; - MEDLOADER_EXPORT int getTheMaxFamilyId() const; - MEDLOADER_EXPORT int getTheMinFamilyId() const; - MEDLOADER_EXPORT virtual int getMaxAbsFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT virtual int getMaxFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT virtual int getMinFamilyIdInArrays() const = 0; - MEDLOADER_EXPORT DataArrayInt *getAllFamiliesIdsReferenced() const; - MEDLOADER_EXPORT DataArrayInt *computeAllFamilyIdsInUse() const; - MEDLOADER_EXPORT std::vector getFamiliesIds(const std::vector& famNames) const; - MEDLOADER_EXPORT std::string getFamilyNameGivenId(int id) const; + MEDLOADER_EXPORT mcIdType getFamilyId(const std::string& name) const; + MEDLOADER_EXPORT mcIdType getMaxAbsFamilyId() const; + MEDLOADER_EXPORT mcIdType getMaxFamilyId() const; + MEDLOADER_EXPORT mcIdType getMinFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMaxAbsFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMaxFamilyId() const; + MEDLOADER_EXPORT mcIdType getTheMinFamilyId() const; + MEDLOADER_EXPORT virtual mcIdType getMaxAbsFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT virtual mcIdType getMaxFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT virtual mcIdType getMinFamilyIdInArrays() const = 0; + MEDLOADER_EXPORT DataArrayIdType *getAllFamiliesIdsReferenced() const; + MEDLOADER_EXPORT DataArrayIdType *computeAllFamilyIdsInUse() const; + MEDLOADER_EXPORT std::vector getFamiliesIds(const std::vector& famNames) const; + MEDLOADER_EXPORT std::string getFamilyNameGivenId(mcIdType id) const; MEDLOADER_EXPORT bool ensureDifferentFamIdsPerLevel(); MEDLOADER_EXPORT void normalizeFamIdsTrio(); MEDLOADER_EXPORT void normalizeFamIdsMEDFile(); @@ -170,30 +170,30 @@ namespace MEDCoupling MEDLOADER_EXPORT virtual std::string simpleRepr() const; MEDLOADER_EXPORT virtual std::string advancedRepr() const = 0; // - MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false); - MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) = 0; - MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) = 0; + MEDLOADER_EXPORT virtual void setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false); + MEDLOADER_EXPORT virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr) = 0; + MEDLOADER_EXPORT virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr) = 0; MEDLOADER_EXPORT virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) = 0; - MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) = 0; - MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayInt *ids) = 0; - MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) = 0; - MEDLOADER_EXPORT virtual const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0; - MEDLOADER_EXPORT DataArrayInt *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT virtual const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr) = 0; + MEDLOADER_EXPORT virtual void addNodeGroup(const DataArrayIdType *ids) = 0; + MEDLOADER_EXPORT virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids) = 0; + MEDLOADER_EXPORT virtual const DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyFieldAtLevel(int meshDimRelToMaxExt) = 0; + MEDLOADER_EXPORT DataArrayIdType *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt); + MEDLOADER_EXPORT virtual const DataArrayIdType *getNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual const DataArrayIdType *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const = 0; MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const = 0; - MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const; - MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; + MEDLOADER_EXPORT virtual MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const = 0; + MEDLOADER_EXPORT virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const; + MEDLOADER_EXPORT virtual DataArrayIdType *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; // tools - MEDLOADER_EXPORT virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell) = 0; + MEDLOADER_EXPORT virtual bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell) = 0; MEDLOADER_EXPORT int getNumberOfJoints() const; MEDLOADER_EXPORT MEDFileJoints *getJoints() const; MEDLOADER_EXPORT void setJoints( MEDFileJoints* joints ); @@ -211,17 +211,17 @@ namespace MEDCoupling void dealWithTinyInfo(const MEDCouplingMesh *m); virtual void synchronizeTinyInfoOnLeaves() const = 0; void getFamilyRepr(std::ostream& oss) const; - virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); - virtual void changeFamilyIdArr(int oldId, int newId) = 0; - virtual std::list< MCAuto > getAllNonNullFamilyIds() const = 0; + virtual void appendFamilyEntries(const DataArrayIdType *famIds, const std::vector< std::vector >& fidsOfGrps, const std::vector& grpNames); + virtual void changeFamilyIdArr(mcIdType oldId, mcIdType newId) = 0; + virtual std::list< MCAuto > getAllNonNullFamilyIds() const = 0; virtual void loadLL(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) = 0; void loadLLWithAdditionalItems(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr); - static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector >& famIdsPerGrp); + void addGroupUnderground(bool isNodeGroup, const DataArrayIdType *ids, DataArrayIdType *famArr); + static void TranslateFamilyIds(mcIdType offset, DataArrayIdType *famArr, std::vector< std::vector >& famIdsPerGrp); static void ChangeAllGroupsContainingFamily(std::map >& groups, const std::string& familyNameToChange, const std::vector& newFamiliesNames); - static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, int id, bool& created); + static std::string FindOrCreateAndGiveFamilyWithId(std::map& families, mcIdType id, bool& created); static std::string CreateNameNotIn(const std::string& nameTry, const std::vector& namesToAvoid); - static int PutInThirdComponentOfCodeOffset(std::vector& code, int strt); + static mcIdType PutInThirdComponentOfCodeOffset(std::vector& code, mcIdType strt); void writeJoints(med_idt fid) const; void loadJointsFromFile(med_idt fid, MEDFileJoints *toUseInstedOfReading=0); void loadEquivalences(med_idt fid); @@ -229,7 +229,7 @@ namespace MEDCoupling bool areEquivalencesEqual(const MEDFileMesh *other, std::string& what) const; void getEquivalencesRepr(std::ostream& oss) const; void checkCartesian() const; - void checkNoGroupClash(const DataArrayInt *famArr, const std::string& grpName) const; + void checkNoGroupClash(const DataArrayIdType *famArr, const std::string& grpName) const; private: virtual void writeMeshLL(med_idt fid) const = 0; protected: @@ -247,7 +247,7 @@ namespace MEDCoupling MCAuto _equiv; protected: std::map > _groups; - std::map _families; + std::map _families; public: MEDLOADER_EXPORT static const char DFT_FAM_NAME[]; }; @@ -265,8 +265,8 @@ namespace MEDCoupling MEDLOADER_EXPORT static MEDFileUMesh *New(DataArrayByte *db) { return BuildFromMemoryChunk(db); } MEDLOADER_EXPORT static MEDFileUMesh *New(const MEDCouplingMappedExtrudedMesh *mem); MEDLOADER_EXPORT static MEDFileUMesh *New(); - 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=0); - 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=0); + 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=0); + 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=0); MEDLOADER_EXPORT static const char *GetSpeStr4ExtMesh() { return SPE_FAM_STR_EXTRUDED_MESH; } MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; @@ -281,28 +281,28 @@ namespace MEDCoupling MEDLOADER_EXPORT void setName(const std::string& name); MEDLOADER_EXPORT const std::vector< MCAuto >& getAccessOfUndergroundEltStrs() const { return _elt_str; } // - MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMinFamilyIdInArrays() const; + 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 int getSizeAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) 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 MCAuto getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT const PartDefinition *getPartDefAtLevel(int meshDimRelToMaxExt, INTERP_KERNEL::NormalizedCellType gt=INTERP_KERNEL::NORM_ERROR) const; - MEDLOADER_EXPORT int getNumberOfNodes() const; - MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodes() const; + MEDLOADER_EXPORT mcIdType getNumberOfCellsAtLevel(int meshDimRelToMaxExt) const; MEDLOADER_EXPORT bool hasImplicitPart() const; - MEDLOADER_EXPORT int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) 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 int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) 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; @@ -312,17 +312,17 @@ namespace MEDCoupling 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 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 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + 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 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; MEDLOADER_EXPORT MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const; @@ -330,20 +330,20 @@ namespace MEDCoupling MEDLOADER_EXPORT void forceComputationOfParts() const; MEDLOADER_EXPORT std::vector getDirectUndergroundSingleGeoTypeMeshes(int meshDimRelToMax) const; MEDLOADER_EXPORT MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const; - MEDLOADER_EXPORT DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - MEDLOADER_EXPORT DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + MEDLOADER_EXPORT DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; MEDLOADER_EXPORT int getRelativeLevOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; // - MEDLOADER_EXPORT void setFamilyNameAttachedOnId(int id, const std::string& newFamName); + MEDLOADER_EXPORT void setFamilyNameAttachedOnId(mcIdType id, const std::string& newFamName); MEDLOADER_EXPORT void setCoords(DataArrayDouble *coords); MEDLOADER_EXPORT void setCoordsForced(DataArrayDouble *coords); MEDLOADER_EXPORT void eraseGroupsAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + 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, DataArrayInt *globalNumArr); - MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids); - MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); + 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 void removeMeshAtLevel(int meshDimRelToMax); MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m); MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false); @@ -352,11 +352,11 @@ namespace MEDCoupling MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector& ms, bool renum=false); MEDLOADER_EXPORT void optimizeFamilies(); // tools - MEDLOADER_EXPORT void buildInnerBoundaryAlongM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified); - MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayInt *& o2nRenumCell); - MEDLOADER_EXPORT DataArrayInt *zipCoords(); - MEDLOADER_EXPORT DataArrayInt *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; - MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map >& extractDef) const; + 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); + MEDLOADER_EXPORT DataArrayIdType *zipCoords(); + MEDLOADER_EXPORT DataArrayIdType *deduceNodeSubPartFromCellSubPart(const std::map >& extractDef) const; + MEDLOADER_EXPORT MEDFileUMesh *extractPart(const std::map >& extractDef) const; MEDLOADER_EXPORT MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const; MEDLOADER_EXPORT MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const; MEDLOADER_EXPORT MEDFileUMesh *quadraticToLinear(double eps=1e-12) const; @@ -364,16 +364,16 @@ namespace MEDCoupling MEDLOADER_EXPORT static MCAuto Aggregate(const std::vector& meshes); MEDLOADER_EXPORT MEDCouplingMappedExtrudedMesh *convertToExtrudedMesh() const; // serialization - MEDLOADER_EXPORT void serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); - MEDLOADER_EXPORT void unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, - std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); + MEDLOADER_EXPORT void serialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); + MEDLOADER_EXPORT void unserialize(std::vector& tinyDouble, std::vector& tinyInt, std::vector& tinyStr, + std::vector< MCAuto >& bigArraysI, MCAuto& bigArrayD); private: 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, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0); + void loadPartUMeshFromFile(med_idt fid, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, 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; @@ -382,19 +382,19 @@ namespace MEDCoupling DataArrayDouble *checkMultiMesh(const std::vector& ms) const; void computeRevNum() const; void synchronizeTinyInfoOnLeaves() const; - void changeFamilyIdArr(int oldId, int newId); - std::list< MCAuto > getAllNonNullFamilyIds() const; + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); + std::list< MCAuto > getAllNonNullFamilyIds() const; MCAuto& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m); private: static const char SPE_FAM_STR_EXTRUDED_MESH[]; private: std::vector< MCAuto > _ms; MCAuto _coords; - MCAuto _fam_coords; ///< Node family indices - MCAuto _num_coords; - MCAuto _global_num_coords; + MCAuto _fam_coords; ///< Node family indices + MCAuto _num_coords; + MCAuto _global_num_coords; MCAuto _name_coords; - mutable MCAuto _rev_num_coords; + mutable MCAuto _rev_num_coords; MCAuto _part_coords; std::vector< MCAuto > _elt_str; }; @@ -405,50 +405,50 @@ namespace MEDCoupling public: MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDLOADER_EXPORT std::vector getDirectChildrenWithNull() const; - MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMaxFamilyIdInArrays() const; - MEDLOADER_EXPORT int getMinFamilyIdInArrays() 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 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - MEDLOADER_EXPORT const DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT DataArrayInt *getFamilyFieldAtLevel(int meshDimRelToMaxExt); - MEDLOADER_EXPORT void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - MEDLOADER_EXPORT void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + 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, DataArrayInt *globalNumArr); - MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids); - MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); - MEDLOADER_EXPORT const DataArrayInt *getNumberFieldAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT const DataArrayInt *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const; + 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 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 int getSizeAtLevel(int meshDimRelToMaxExt) const; - MEDLOADER_EXPORT int getNumberOfNodes() const; - MEDLOADER_EXPORT int getNumberOfCellsAtLevel(int meshDimRelToMaxExt) 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 int buildImplicitPartIfAny(INTERP_KERNEL::NormalizedCellType gt) 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; - MEDLOADER_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) 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, DataArrayInt *& o2nRenumCell); + MEDLOADER_EXPORT bool unPolyze(std::vector& oldCode, std::vector& newCode, DataArrayIdType *& o2nRenumCell); protected: ~MEDFileStructuredMesh() { } - void changeFamilyIdArr(int oldId, int newId); - std::list< MCAuto > getAllNonNullFamilyIds() const; + 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; @@ -457,19 +457,19 @@ namespace MEDCoupling static med_geometry_type GetGeoTypeFromMeshDim(int meshDim); private: static void LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs, - MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells); + MCAuto& famCells, MCAuto& numCells, MCAuto& namesCells); private: - MCAuto _fam_nodes; - MCAuto _num_nodes; + MCAuto _fam_nodes; + MCAuto _num_nodes; MCAuto _names_nodes; - MCAuto _fam_cells; - MCAuto _num_cells; + MCAuto _fam_cells; + MCAuto _num_cells; MCAuto _names_cells; - MCAuto _fam_faces; - MCAuto _num_faces; + MCAuto _fam_faces; + MCAuto _num_faces; MCAuto _names_faces; - mutable MCAuto _rev_num_nodes; - mutable MCAuto _rev_num_cells; + mutable MCAuto _rev_num_nodes; + mutable MCAuto _rev_num_cells; mutable MCAuto _faces_if_necessary; }; diff --git a/src/MEDLoader/MEDFileMeshElt.cxx b/src/MEDLoader/MEDFileMeshElt.cxx index f222b32c9..96982a4b1 100644 --- a/src/MEDLoader/MEDFileMeshElt.cxx +++ b/src/MEDLoader/MEDFileMeshElt.cxx @@ -21,6 +21,7 @@ #include "MEDFileMeshElt.hxx" #include "MEDFileSafeCaller.txx" #include "MEDFileMeshReadSelector.hxx" +#include "MEDFileBasis.hxx" #include "MEDCouplingUMesh.hxx" @@ -39,7 +40,7 @@ MEDFileUMeshPerTypeCommon *MEDFileUMeshPerTypeCommon::New() return new MEDFileUMeshPerTypeCommon; } -void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt, +void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, int dt, int it, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; @@ -48,10 +49,11 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i { if(!mrs || mrs->isCellFamilyFieldReading()) { - _fam=DataArrayInt::New(); - _fam->alloc(curNbOfElem,1); - if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,_fam->getPointer())!=0) - std::fill(_fam->getPointer(),_fam->getPointer()+curNbOfElem,0); + MCAuto miFam=DataArrayMedInt::New(); + miFam->alloc(curNbOfElem,1); + if(MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,entity,geoElt,miFam->getPointer())!=0) + std::fill(miFam->getPointer(),miFam->getPointer()+curNbOfElem,0); + _fam=FromMedIntArray( miFam ); } } _num=0; @@ -59,10 +61,11 @@ void MEDFileUMeshPerTypeCommon::loadCommonPart(med_idt fid, const char *mName, i { if(!mrs || mrs->isCellNumFieldReading()) { - _num=DataArrayInt::New(); - _num->alloc(curNbOfElem,1); - if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,_num->getPointer())!=0) - _num=0; + MCAuto miNum=DataArrayMedInt::New(); + miNum->alloc(curNbOfElem,1); + if(MEDmeshEntityNumberRd(fid,mName,dt,it,entity,geoElt,miNum->getPointer())!=0) + miNum=0; + _num=FromMedIntArray(miNum); } } _names=0; @@ -88,8 +91,8 @@ std::size_t MEDFileUMeshPerTypeCommon::getHeapMemorySizeWithoutChildren() const std::vector MEDFileUMeshPerTypeCommon::getDirectChildrenWithNull() const { std::vector ret; - ret.push_back((const DataArrayInt *)_num); - ret.push_back((const DataArrayInt *)_fam); + ret.push_back((const DataArrayIdType *)_num); + ret.push_back((const DataArrayIdType *)_fam); ret.push_back((const DataArrayAsciiChar *)_names); return ret; } @@ -102,7 +105,7 @@ MEDFileUMeshPerType *MEDFileUMeshPerType::New(med_idt fid, const char *mName, in 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, int strt, int stp, int step, MEDFileMeshReadSelector *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 geoElt2i((int)geoElt2); if(geoElt2i<0 || geoElt2i>=34) @@ -131,11 +134,11 @@ std::vector MEDFileUMeshPerType::getDirectChildrenWithN bool MEDFileUMeshPerType::isExisting(med_idt fid, const char *mName, int dt, int it, med_geometry_type geoElt, med_entity_type& whichEntity) { static const med_entity_type entities[3]={MED_CELL,MED_DESCENDING_FACE,MED_DESCENDING_EDGE}; - int nbOfElt=0; + mcIdType nbOfElt=0; for(int i=0;i<3;i++) { med_bool changement,transformation; - int 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; @@ -160,7 +163,7 @@ MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - int 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()) { @@ -177,10 +180,10 @@ MEDFileUMeshPerType::MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, } void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs) + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; - int 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()) @@ -191,63 +194,64 @@ void MEDFileUMeshPerType::loadPart(med_idt fid, const char *mName, int dt, int i throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPart : not implemented yet for the dynamic type !"); } -void MEDFileUMeshPerType::loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int 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); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MCAuto conn(DataArrayInt::New()); - int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + MCAuto conn(DataArrayMedInt::New()); + 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::bind2nd(std::plus(),-1)); - mc->setNodalConnectivity(conn); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + mc->setNodalConnectivity(FromMedIntArray(conn)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshPerType::loadPartStaticType(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, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs) { if(strt<0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : start pos is negative !"); if(end>curNbOfElem) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::loadPartStaticType : end is after the authorized range !"); - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,end,step,"MEDFileUMeshPerType::loadPartStaticType")); _m=MEDCoupling1SGTUMesh::New(mName,type); MEDCoupling1SGTUMesh *mc(dynamic_cast((MEDCoupling1GTUMesh *)_m)); - MCAuto conn(DataArrayInt::New()); - int nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); + MCAuto conn(DataArrayMedInt::New()); + mcIdType nbOfNodesPerCell(mc->getNumberOfNodesPerCell()); conn->alloc(nbOfNodesPerCell*nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/nbOfNodesPerCell, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/ToMedInt(nbOfNodesPerCell), MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer())); MEDfilterClose(&filter); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); - mc->setNodalConnectivity(conn); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + mc->setNodalConnectivity(FromMedIntArray(conn)); loadPartOfCellCommonPart(fid,mName,strt,end,step,dt,it,mdim,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) +void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs) { med_bool changement,transformation; _fam=0; - int nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart")); + mcIdType nbOfEltsToLoad(DataArray::GetNumberOfItemGivenBES(strt,stp,step,"MEDFileUMeshPerType::loadPartOfCellCommonPart")); if(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { if(!mrs || mrs->isCellFamilyFieldReading()) { - _fam=DataArrayInt::New(); - _fam->alloc(nbOfEltsToLoad,1); + MCAuto miFam(DataArrayMedInt::New()); + miFam->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); - if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,_fam->getPointer())!=0) - _fam->fillWithZero(); + if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_FAMILY_NUMBER,dt,it,entity,geoElt,&filter,miFam->getPointer())!=0) + miFam->fillWithZero(); + _fam=FromMedIntArray(miFam); MEDfilterClose(&filter); } } @@ -256,15 +260,16 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam { if(!mrs || mrs->isCellNumFieldReading()) { - _num=DataArrayInt::New(); - _num->alloc(nbOfEltsToLoad,1); + MCAuto miNum(DataArrayMedInt::New()); + miNum->alloc(nbOfEltsToLoad,1); med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); - if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,_num->getPointer())!=0) - _num->fillWithZero(); + if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NUMBER,dt,it,entity,geoElt,&filter,miNum->getPointer())!=0) + miNum->fillWithZero(); + _num=FromMedIntArray(miNum); MEDfilterClose(&filter); } } @@ -276,9 +281,9 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam _names=DataArrayAsciiChar::New(); _names->alloc(nbOfEltsToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end med_filter filter=MED_FILTER_INIT; - MEDfilterBlockOfEntityCr(fid,/*nentity*/curNbOfElem,/*nvaluesperentity*/1,/*nconstituentpervalue*/1, + MEDfilterBlockOfEntityCr(fid,/*nentity*/ToMedInt(curNbOfElem),/*nvaluesperentity*/1,/*nconstituentpervalue*/1, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad, + /*start*/ToMedInt(strt+1),/*stride*/ToMedInt(step),/*count*/1,/*blocksize*/ToMedInt(nbOfEltsToLoad), /*lastblocksize=useless because count=1*/0,&filter); if(MEDmeshEntityAttributeAdvancedRd(fid,mName,MED_NAME,dt,it,entity,geoElt,&filter,_names->getPointer())!=0) _names=0; @@ -289,61 +294,61 @@ void MEDFileUMeshPerType::loadPartOfCellCommonPart(med_idt fid, const char *mNam } } -void MEDFileUMeshPerType::loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int 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; - med_int 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(DataArrayInt::New()),connI(DataArrayInt::New()); + MCAuto conn(DataArrayMedInt::New()),connI(DataArrayMedInt::New()); conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1); MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer())); - std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); - std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus(),-1)); - mc->setNodalConnectivity(conn,connI); + std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus(),-1)); + std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus(),-1)); + mc->setNodalConnectivity(FromMedIntArray(conn),FromMedIntArray(connI)); loadCommonPart(fid,mName,dt,it,curNbOfElem,geoElt,entity,mrs); } -void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int 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 indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)); - int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1); + 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 int[curNbOfElem+1]; - INTERP_KERNEL::AutoPtr indexFace=new int[indexFaceLgth]; - INTERP_KERNEL::AutoPtr locConn=new int[connFaceLgth]; + INTERP_KERNEL::AutoPtr index=new med_int[curNbOfElem+1]; + INTERP_KERNEL::AutoPtr indexFace=new med_int[indexFaceLgth]; + INTERP_KERNEL::AutoPtr locConn=new med_int[connFaceLgth]; MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn)); - MCAuto conn(DataArrayInt::New()),connI(DataArrayInt::New()); - int arraySize=connFaceLgth; - for(int i=0;i conn(DataArrayIdType::New()),connI(DataArrayIdType::New()); + mcIdType arraySize=connFaceLgth; + for(mcIdType i=0;ialloc(arraySize,1); - int *wFinalConn=conn->getPointer(); + mcIdType *wFinalConn=conn->getPointer(); connI->alloc(curNbOfElem+1,1); - int *finalIndex(connI->getPointer()); + mcIdType *finalIndex(connI->getPointer()); finalIndex[0]=0; - for(int i=0;i(),-1)); - for(int j=index[i];j(),-1)); + for(mcIdType j=index[i];j(),-1)); + wFinalConn=std::transform(locConn+indexFace[j]-1,locConn+indexFace[j+1]-1,wFinalConn,std::bind2nd(std::plus(),-1)); } } mc->setNodalConnectivity(conn,connI); 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 DataArrayInt *fam, const DataArrayInt *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) { - int nbOfCells=m->getNumberOfCells(); + mcIdType nbOfCells=m->getNumberOfCells(); if(nbOfCells<1) return ; int dt,it; @@ -356,9 +361,9 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1SGTUMesh *m0(dynamic_cast(m)); if(!m0) throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !"); - MCAuto arr(m0->getNodalConnectivity()->deepCopy()); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin())); + MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); + MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,ToMedInt(nbOfCells),arr->begin())); } else { @@ -367,31 +372,31 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !"); if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG) { - MCAuto arr(m0->getNodalConnectivity()->deepCopy()),arrI(m0->getNodalConnectivityIndex()->deepCopy()); - std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); - std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); - MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin())); + MCAuto arr(DataArrayMedInt::Copy(m0->getNodalConnectivity())),arrI(DataArrayMedInt::Copy(m0->getNodalConnectivityIndex())); + std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus(),1)); + std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus(),1)); + MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,ToMedInt(nbOfCells+1),arrI->begin(),arr->begin())); } else { - const int *conn(m0->getNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); - int meshLgth=m0->getNodalConnectivityLength(); - int nbOfFaces=std::count(conn,conn+meshLgth,-1)+nbOfCells; - INTERP_KERNEL::AutoPtr tab1=new int[nbOfCells+1]; - int *w1=tab1; *w1=1; - INTERP_KERNEL::AutoPtr tab2=new int[nbOfFaces+1]; - int *w2=tab2; *w2=1; - INTERP_KERNEL::AutoPtr bigtab=new int[meshLgth]; - int *bt=bigtab; - for(int i=0;igetNodalConnectivity()->begin()),*connI(m0->getNodalConnectivityIndex()->begin()); + 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]; + med_int *w2=tab2; *w2=1; + INTERP_KERNEL::AutoPtr bigtab=new med_int[meshLgth]; + med_int *bt=bigtab; + for(mcIdType i=0;i(),1)); - int nbOfNode=std::distance(w,wend); - w2[1]=w2[0]+nbOfNode; + const mcIdType *wend=std::find(w,conn+connI[i+1],-1); + bt=std::transform(w,wend,bt,std::bind2nd(std::plus(),1)); + std::size_t nbOfNode=std::distance(w,wend); + w2[1]=w2[0]+(med_int)nbOfNode; if(wend!=conn+connI[i+1]) w=wend+1; else @@ -400,13 +405,13 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, } w1[1]=w1[0]+nbOfFaces2; } - MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab)); + MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,ToMedInt(nbOfCells+1),tab1,ToMedInt(nbOfFaces+1),tab2,bigtab)); } } if(fam) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray(fam)->getConstPointer())); if(num) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),ToMedIntArray(num)->getConstPointer())); if(names) { if(names->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -415,6 +420,6 @@ void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, oss << " ! The array has " << names->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,ToMedInt(nbOfCells),names->getConstPointer())); } } diff --git a/src/MEDLoader/MEDFileMeshElt.hxx b/src/MEDLoader/MEDFileMeshElt.hxx index c6fef7af0..b0417ae67 100644 --- a/src/MEDLoader/MEDFileMeshElt.hxx +++ b/src/MEDLoader/MEDFileMeshElt.hxx @@ -39,16 +39,16 @@ namespace MEDCoupling { public: static MEDFileUMeshPerTypeCommon *New(); - void loadCommonPart(med_idt fid, const char *mName, int dt, int it, int curNbOfElem, med_geometry_type geoElt, + 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; std::vector getDirectChildrenWithNull() const; - const DataArrayInt *getFam() const { return _fam; } - const DataArrayInt *getNum() const { return _num; } + const DataArrayIdType *getFam() const { return _fam; } + const DataArrayIdType *getNum() const { return _num; } const DataArrayAsciiChar *getNames() const { return _names; } protected: - MCAuto _num; - MCAuto _fam; + MCAuto _num; + MCAuto _fam; MCAuto _names; }; @@ -56,29 +56,29 @@ namespace MEDCoupling { public: static MEDFileUMeshPerType *New(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType geoElt2, MEDFileMeshReadSelector *mrs); - static MEDFileUMeshPerType *NewPart(med_idt fid, const char *mName, int dt, int it, int mdim, INTERP_KERNEL::NormalizedCellType geoElt2, int strt, int stp, int step, MEDFileMeshReadSelector *mrs); + static 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); 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; std::vector getDirectChildrenWithNull() const; int getDim() const; MEDCoupling1GTUMesh *getMesh() const { return const_cast((const MEDCoupling1GTUMesh *)_m); } const PartDefinition *getPartDef() const { return _pd; } - static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names); + static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayIdType *fam, const DataArrayIdType *num, const DataArrayAsciiChar *names); private: 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); void loadPart(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs); - void loadFromStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, + med_entity_type entity, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs); + void 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); - void loadPartStaticType(med_idt fid, const char *mName, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type, - med_entity_type entity, int strt, int end, int step, MEDFileMeshReadSelector *mrs); - void loadPolyg(med_idt fid, const char *mName, int dt, int it, int mdim, int arraySize, med_geometry_type geoElt, + void loadPartStaticType(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, mcIdType strt, mcIdType end, mcIdType step, MEDFileMeshReadSelector *mrs); + void 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); - void loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt, + void 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); - void loadPartOfCellCommonPart(med_idt fid, const char *mName, int strt, int stp, int step, int dt, int it, int mdim, int curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); + void loadPartOfCellCommonPart(med_idt fid, const char *mName, mcIdType strt, mcIdType stp, mcIdType step, int dt, int it, int mdim, mcIdType curNbOfElem, med_geometry_type geoElt, med_entity_type entity, MEDFileMeshReadSelector *mrs); private: MCAuto _m; MCAuto _pd; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 898c50145..c58d94320 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -47,17 +47,19 @@ int MEDFileMeshL2::ZE_SEP2_FOR_FAMILY_KILLERS=4; std::vector MeshCls::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 { med_mesh_type type_maillage; - med_int spaceDim; + med_int spaceDim, meshDim, nbSteps; med_sorting_type stype; med_axis_type axistype; - int 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 univTmp(MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE)); - if(MEDmeshInfo(fid,getID(),nameTmp,&spaceDim,&Mdim,&type_maillage,description.getPointer(),dtunit.getPointer(), - &stype,&nstep,&axistype,axisname,axisunit)!=0) + 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 !"); + Mdim=FromMedInt(meshDim); + nstep=FromMedInt(nbSteps); MEDmeshUniversalNameRd(fid,nameTmp,univName.getPointer());// do not protect MEDFILESAFECALLERRD0 call : Thanks to fra.med. axType=MEDFileMeshL2::TraduceAxisType(axistype); switch(type_maillage) @@ -127,9 +129,9 @@ std::vector StructMeshCls::getAxisInfoOnMesh(med_idt fid, const std INTERP_KERNEL::AutoPtr msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); INTERP_KERNEL::AutoPtr zeDescription(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); med_axis_type medAxType; - int 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]); - int spaceDim(0),meshDim(0); + med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,getID(),msn,&spaceDim,&meshDim,zeDescription,&medAxType,axisName,axisUnit)); std::string descriptionCpp(MEDLoaderBase::buildStringFromFortran(zeDescription,MED_COMMENT_SIZE)); description.set(descriptionCpp.c_str()); @@ -179,11 +181,11 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( int ret=-1; med_sorting_type stype; std::vector ms; - int nstep; + med_int nstep; med_axis_type axistype; 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)); @@ -197,10 +199,10 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( } if(found==0) {//last chance ! Is it a support mesh ? - int 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 cur(MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa))); @@ -249,14 +251,14 @@ INTERP_KERNEL::AutoCppPtr MEDFileMeshL2::GetMeshIdFromName( med_int numdt,numit; med_float dtt; MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,mName.c_str(),1,&numdt,&numit,&dtt)); - dt=numdt; it=numit; + dt=FromMedInt(numdt); it=FromMedInt(numit); return new MeshCls(ret); } case 2: { meshType=UNSTRUCTURED; dt=MED_NO_DT; it=MED_NO_IT; dtunit1.clear(); - axType=axType=TraduceAxisType(axistype); + axType=TraduceAxisType(axistype); return new StructMeshCls(ret); } default: @@ -278,17 +280,17 @@ std::vector MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, const Mes return mId->getAxisInfoOnMesh(fid,mName,meshType,axType,nstep,Mdim,_description,_dt_unit,_univ_name); } -void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) +void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs) { if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading())) return ; char nomfam[MED_NAME_SIZE+1]; med_int numfam; - int nfam=MEDnFamily(fid,meshName.c_str()); - std::vector< std::pair > > > crudeFams(nfam); + 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]; @@ -299,10 +301,10 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName std::vector grps(ngro); for(int j=0;j > >(famName,std::pair >(numfam,grps)); + crudeFams[i]=std::pair > >(famName,std::pair >(numfam,grps)); } RenameFamiliesFromFileToMemInternal(crudeFams); - for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) + for(std::vector< std::pair > > >::const_iterator it0=crudeFams.begin();it0!=crudeFams.end();it0++) { fams[(*it0).first]=(*it0).second.first; for(std::vector::const_iterator it1=(*it0).second.second.begin();it1!=(*it0).second.second.end();it1++) @@ -310,11 +312,11 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName } } -void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol) +void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol) { - std::vector< std::pair > > > crudeFams(fams.size()); + std::vector< std::pair > > > crudeFams(fams.size()); std::size_t ii(0); - for(std::map::const_iterator 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(std::map >::const_iterator it1=grps.begin();it1!=grps.end();it1++) @@ -322,33 +324,33 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, 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)); + crudeFams[ii]=std::pair > >((*it).first,std::pair >((*it).second,grpsOfFam)); } RenameFamiliesFromMemToFileInternal(crudeFams); - for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) + for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++) { - int ngro((*it).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(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((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol); - int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second.first,ngro,groName); + med_int ret=MEDfamilyCr(fid,mname.c_str(),famName,ToMedInt((*it).second.first),ToMedInt(ngro),groName); ret++; } } -void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func) +void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func) { std::size_t ii(0); std::vector fams(crudeFams.size()); - for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) + for(std::vector< std::pair > > >::const_iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) fams[ii]=(*it).first; if(!func(fams)) return ; ii=0; - for(std::vector< std::pair > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) + for(std::vector< std::pair > > >::iterator it=crudeFams.begin();it!=crudeFams.end();it++,ii++) (*it).first=fams[ii]; } @@ -356,14 +358,14 @@ void MEDFileMeshL2::RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams) +void MEDFileMeshL2::RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams) { RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromFileToMem); } bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famNames) { - std::map m; + std::map m; std::set s; for(std::vector< std::string >::const_iterator it=famNames.begin();it!=famNames.end();it++) { @@ -375,7 +377,7 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN return false;// the general case ! for(std::vector< std::string >::iterator it=famNames.begin();it!=famNames.end();it++) { - std::map::iterator it2(m.find(*it)); + std::map::iterator it2(m.find(*it)); if(it2!=m.end()) { std::ostringstream oss; oss << *it << ZE_SEP_FOR_FAMILY_KILLERS << std::setfill('0') << std::setw(ZE_SEP2_FOR_FAMILY_KILLERS) << (*it2).second++; @@ -389,7 +391,7 @@ bool MEDFileMeshL2::RenameFamiliesFromFileToMem(std::vector< std::string >& famN * This method is dedicated to the killers that use a same family name to store different family ids. MED file API authorizes it. * So this method renames families (if needed generally not !) in order to have a discriminant name for families. */ -void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams) +void MEDFileMeshL2::RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams) { RenameFamiliesPatternInternal(crudeFams,RenameFamiliesFromMemToFile); } @@ -413,7 +415,7 @@ bool MEDFileMeshL2::RenameFamiliesFromMemToFile(std::vector< std::string >& famN if(found!=std::string::npos && found>=1) { std::string s1((*it).substr(found+sizeof(ZE_SEP_FOR_FAMILY_KILLERS)-1)); - if(s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS) + if((int)s1.size()!=ZE_SEP2_FOR_FAMILY_KILLERS) continue; int k(-1); std::istringstream iss(s1); @@ -544,7 +546,7 @@ void MEDFileUMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const loadCoords(fid,infosOnComp,mName,dt,it); } -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) +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 infosOnComp(loadCommonPart(fid,mId,mName,dt,it,Mdim)); @@ -552,13 +554,13 @@ void MEDFileUMeshL2::loadPart(med_idt fid, const MeshOrStructMeshCls *mId, const return ; loadPartOfConnectivity(fid,Mdim,mName,types,slicPerTyp,dt,it,mrs); med_bool changement,transformation; - int 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(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); - int nMin(std::distance(fetchedNodeIds.begin(),std::find(fetchedNodeIds.begin(),fetchedNodeIds.end(),true))); - int nMax(std::distance(fetchedNodeIds.rbegin(),std::find(fetchedNodeIds.rbegin(),fetchedNodeIds.rend(),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(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++) @@ -579,7 +581,7 @@ void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& sortTypes(); } -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) +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 nbOfTypes(types.size()); if(slicPerTyp.size()!=3*nbOfTypes) @@ -591,7 +593,7 @@ void MEDFileUMeshL2::loadPartOfConnectivity(med_idt fid, int mdim, const std::st _per_type_mesh[0].clear(); for(std::size_t ii=0;ii tmp(MEDFileUMeshPerType::NewPart(fid,mName.c_str(),dt,it,mdim,types[ii],strt,stp,step,mrs)); _per_type_mesh[0].push_back(tmp); } @@ -602,7 +604,7 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf { int spaceDim((int)infosOnComp.size()); med_bool changement,transformation; - int 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()); @@ -610,17 +612,19 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr)); if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _fam_coords=DataArrayInt::New(); - _fam_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer())); + MCAuto miFamCoord=DataArrayMedInt::New(); + miFamCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miFamCoord->getPointer())); + _fam_coords=FromMedIntArray(miFamCoord); } else _fam_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _num_coords=DataArrayInt::New(); - _num_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer())); + _num_coords=FromMedIntArray(miNumCoord); } else _num_coords=0; @@ -635,44 +639,47 @@ void MEDFileUMeshL2::loadCoords(med_idt fid, const std::vector& inf _name_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_GLOBAL_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _global_num_coords=DataArrayInt::New(); - _global_num_coords->alloc(nCoords,1); - MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_global_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nCoords,1); + MEDFILESAFECALLERRD0(MEDmeshGlobalNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,miNumCoord->getPointer())); + _global_num_coords=FromMedIntArray(miNumCoord); } for(int i=0;isetInfoOnComponent(i,infosOnComp[i]); } -void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax) +void MEDFileUMeshL2::loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax) { med_bool changement,transformation; - int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); + med_int spaceDim((int)infosOnComp.size()),nCoords(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); _coords=DataArrayDouble::New(); - int nbNodesToLoad(nMax-nMin); + mcIdType nbNodesToLoad(nMax-nMin); _coords->alloc(nbNodesToLoad,spaceDim); med_filter filter=MED_FILTER_INIT,filter2=MED_FILTER_INIT; MEDfilterBlockOfEntityCr(fid,/*nentity*/nCoords,/*nvaluesperentity*/1,/*nconstituentpervalue*/spaceDim, MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE, - /*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad, + /*start*/ToMedInt(nMin+1),/*stride*/1,/*count*/1,/*blocksize*/ToMedInt(nbNodesToLoad), /*lastblocksize=useless because count=1*/0,&filter); MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateAdvancedRd,(fid,mName.c_str(),dt,it,&filter,_coords->getPointer())); _part_coords=PartDefinition::New(nMin,nMax,1); MEDfilterClose(&filter); MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE, - MED_NO_PROFILE,nMin+1,1,1,nbNodesToLoad,0,&filter2); + MED_NO_PROFILE,ToMedInt(nMin+1),1,1,ToMedInt(nbNodesToLoad),0,&filter2); if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _fam_coords=DataArrayInt::New(); - _fam_coords->alloc(nbNodesToLoad,1); - MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer())); + MCAuto miFamCoord=DataArrayMedInt::New(); + miFamCoord->alloc(nbNodesToLoad,1); + MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miFamCoord->getPointer())); + _fam_coords=FromMedIntArray(miFamCoord); } else _fam_coords=0; if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0) { - _num_coords=DataArrayInt::New(); - _num_coords->alloc(nbNodesToLoad,1); - MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer())); + MCAuto miNumCoord=DataArrayMedInt::New(); + miNumCoord->alloc(nbNodesToLoad,1); + MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,miNumCoord->getPointer())); + _num_coords=FromMedIntArray(miNumCoord); } else _num_coords=0; @@ -722,15 +729,15 @@ void MEDFileUMeshL2::sortTypes() _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev); } -void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords) +void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords) { if(!coords) return ; - MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin())); + MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,ToMedInt(coords->getNumberOfTuples()),coords->begin())); if(famCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(famCoords->getNumberOfTuples()),ToMedIntArray(famCoords)->begin())); if(numCoords) - MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(numCoords->getNumberOfTuples()),ToMedIntArray(numCoords)->begin())); if(nameCoords) { if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE) @@ -739,10 +746,10 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,ToMedInt(nameCoords->getNumberOfTuples()),nameCoords->begin())); } if(globalNumCoords) - MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,globalNumCoords->getNumberOfTuples(),globalNumCoords->begin())); + MEDFILESAFECALLERWR0(MEDmeshGlobalNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NONE,ToMedInt(globalNumCoords->getNumberOfTuples()),ToMedIntArray(globalNumCoords)->begin())); } bool MEDFileUMeshL2::isFamDefinedOnLev(int levId) const @@ -797,7 +804,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const { med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf)); + med_int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf)); MCAuto da=DataArrayDouble::New(); da->alloc(nbOfElt,1); da->setInfoOnComponent(0,infosOnComp[i]); @@ -840,11 +847,13 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const _order=it; // _clmesh=MEDCouplingCurveLinearMesh::New(); - INTERP_KERNEL::AutoPtr stGrid=new int[Mdim]; - MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,stGrid)); - _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim); + MCAuto miStGrid=DataArrayMedInt::New(); + miStGrid->alloc(Mdim,1); + MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,miStGrid->getPointer())); + MCAuto stGrid=FromMedIntArray(miStGrid); + _clmesh->setNodeGridStructure(stGrid->begin(),stGrid->end()); med_bool chgt=MED_FALSE,trsf=MED_FALSE; - int 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); @@ -915,12 +924,12 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st const std::vector< MCAuto >& v=l2.getLev(id); if(v.empty()) return; - int sz=v.size(); + std::size_t sz=v.size(); std::vector ms(sz); - std::vector fams(sz),nums(sz); + std::vector fams(sz),nums(sz); std::vector names(sz); std::vector pds(sz); - for(int i=0;igetMesh()); MCAuto tmp2=l2.getCoords(); @@ -932,32 +941,32 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::st _m_by_types.assignDefParts(pds); if(l2.isFamDefinedOnLev(id)) { - for(int i=0;igetFam(); if(sz!=1) - _fam=DataArrayInt::Aggregate(fams); + _fam=DataArrayIdType::Aggregate(fams); else { fams[0]->incrRef(); - _fam=const_cast(fams[0]); + _fam=const_cast(fams[0]); } } if(l2.isNumDefinedOnLev(id)) { - for(int i=0;igetNum(); if(sz!=1) - _num=DataArrayInt::Aggregate(nums); + _num=DataArrayIdType::Aggregate(nums); else { nums[0]->incrRef(); - _num=const_cast(nums[0]); + _num=const_cast(nums[0]); } computeRevNum(); } if(l2.isNamesDefinedOnLev(id)) { - for(int i=0;igetNames(); _names=dynamic_cast(DataArrayChar::Aggregate(names)); } @@ -995,9 +1004,9 @@ std::vector MEDFileUMeshSplitL1::getDirectChildrenWithN std::vector ret; ret.push_back(&_m_by_types); ret.push_back(&_m); - ret.push_back((const DataArrayInt*)_fam); - ret.push_back((const DataArrayInt*)_num); - ret.push_back((const DataArrayInt*)_rev_num); + ret.push_back((const DataArrayIdType*)_fam); + ret.push_back((const DataArrayIdType*)_num); + ret.push_back((const DataArrayIdType*)_rev_num); ret.push_back((const DataArrayAsciiChar*)_names); return ret; } @@ -1014,11 +1023,11 @@ MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::deepCopy(DataArrayDouble *coords) cons { MCAuto ret(new MEDFileUMeshSplitL1(*this)); ret->_m_by_types=_m_by_types.deepCopy(coords); - if((const DataArrayInt *)_fam) + if((const DataArrayIdType *)_fam) ret->_fam=_fam->deepCopy(); - if((const DataArrayInt *)_num) + if((const DataArrayIdType *)_num) ret->_num=_num->deepCopy(); - if((const DataArrayInt *)_rev_num) + if((const DataArrayIdType *)_rev_num) ret->_rev_num=_rev_num->deepCopy(); if((const DataArrayAsciiChar *)_names) ret->_names=_names->deepCopy(); @@ -1029,12 +1038,12 @@ void MEDFileUMeshSplitL1::checkConsistency() const { if (!_fam || _fam->getNumberOfTuples() != getSize()) throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::checkConsistency(): internal family array has an invalid size!"); - int nbCells = getSize(); + mcIdType nbCells = getSize(); if (_num) { _num->checkNbOfTuplesAndComp(nbCells,1,"MEDFileUMeshSplitL1::checkConsistency(): inconsistent internal node numbering array!"); - int pos; - int maxValue=_num->getMaxValue(pos); + mcIdType 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!"); } @@ -1052,8 +1061,8 @@ bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, { if(!_m_by_types.isEqual(other->_m_by_types,eps,what)) return false; - const DataArrayInt *d1=_fam; - const DataArrayInt *d2=other->_fam; + const DataArrayIdType *d1=_fam; + const DataArrayIdType *d2=other->_fam; if((d1==0 && d2!=0) || (d1!=0 && d2==0)) { what="Presence of family arr in one sublevel and not in other!"; @@ -1126,7 +1135,7 @@ void MEDFileUMeshSplitL1::assignMesh(MEDCouplingUMesh *m, bool newOrOld) m->incrRef(); _m=m; _m_by_types.assignUMesh(dynamic_cast(m->deepCopy())); - MCAuto da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); + MCAuto da=_m_by_types.getUmesh()->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO); if(!da->isIota(m->getNumberOfCells())) { _num=da->invertArrayO2N2N2O(m->getNumberOfCells()); @@ -1162,7 +1171,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1():_m(this) void MEDFileUMeshSplitL1::assignCommonPart() { - _fam=DataArrayInt::New(); + _fam=DataArrayIdType::New(); _fam->alloc(_m_by_types.getSize(),1); _fam->fillWithValue(0); } @@ -1172,9 +1181,9 @@ bool MEDFileUMeshSplitL1::empty() const return _m_by_types.empty(); } -bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector& ids) const +bool MEDFileUMeshSplitL1::presenceOfOneFams(const std::vector& ids) const { - const DataArrayInt *fam=_fam; + const DataArrayIdType *fam=_fam; if(!fam) return false; return fam->presenceOfValue(ids); @@ -1187,32 +1196,32 @@ int MEDFileUMeshSplitL1::getMeshDimension() const void MEDFileUMeshSplitL1::simpleRepr(std::ostream& oss) const { - std::vector code=_m_by_types.getDistributionOfTypes(); - int nbOfTypes=code.size()/3; - for(int i=0;i code=_m_by_types.getDistributionOfTypes(); + std::size_t nbOfTypes=code.size()/3; + for(std::size_t i=0;i eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); + MCAuto eltsToKeep=_fam->findIdsEqualList(idsBg,idsEnd); MEDCouplingUMesh *m=(MEDCouplingUMesh *)_m_by_types.getUmesh()->buildPartOfMySelf(eltsToKeep->begin(),eltsToKeep->end(),true); if(renum) return renumIfNeeded(m,eltsToKeep->begin()); return m; } -DataArrayInt *MEDFileUMeshSplitL1::getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const +DataArrayIdType *MEDFileUMeshSplitL1::getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const { - MCAuto da=_fam->findIdsEqualList(idsBg,idsEnd); + MCAuto da=_fam->findIdsEqualList(idsBg,idsEnd); if(renum) return renumIfNeededArr(da); return da.retn(); @@ -1223,7 +1232,7 @@ std::vector MEDFileUMeshSplitL1::getGeoTypes( return _m_by_types.getGeoTypes(); } -int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { return _m_by_types.getNumberOfCellsWithType(ct); } @@ -1231,58 +1240,58 @@ int MEDFileUMeshSplitL1::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellT MEDCouplingUMesh *MEDFileUMeshSplitL1::getWholeMesh(bool renum) const { MCAuto tmp; - if(renum && ((const DataArrayInt *)_num)) + if(renum && ((const DataArrayIdType *)_num)) tmp=_m; else { tmp=_m_by_types.getUmesh(); if(tmp) tmp->incrRef(); } return tmp.retn(); } -int MEDFileUMeshSplitL1::getNumberOfCells() const +mcIdType MEDFileUMeshSplitL1::getNumberOfCells() const { return _m_by_types.getNumberOfCells(); } -DataArrayInt *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMeshSplitL1::extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { - const DataArrayInt *fam(_fam); + const DataArrayIdType *fam(_fam); if(!fam) return 0; - int start(0),stop(0); + mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return fam->selectByTupleIdSafeSlice(start,stop,1); } -DataArrayInt *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const +DataArrayIdType *MEDFileUMeshSplitL1::extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const { - const DataArrayInt *num(_num); + const DataArrayIdType *num(_num); if(!num) return 0; - int start(0),stop(0); + mcIdType start(0),stop(0); _m_by_types.getStartStopOfGeoTypeWithoutComputation(gt,start,stop); return num->selectByTupleIdSafeSlice(start,stop,1); } -DataArrayInt *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() +DataArrayIdType *MEDFileUMeshSplitL1::getOrCreateAndGetFamilyField() { - if((DataArrayInt *)_fam) + if((DataArrayIdType *)_fam) return _fam; - int nbOfTuples=_m_by_types.getSize(); - _fam=DataArrayInt::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero(); + mcIdType nbOfTuples=_m_by_types.getSize(); + _fam=DataArrayIdType::New(); _fam->alloc(nbOfTuples,1); _fam->fillWithZero(); return _fam; } -const DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() const { return _fam; } -const DataArrayInt *MEDFileUMeshSplitL1::getNumberField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getNumberField() const { return _num; } -const DataArrayInt *MEDFileUMeshSplitL1::getRevNumberField() const +const DataArrayIdType *MEDFileUMeshSplitL1::getRevNumberField() const { return _rev_num; } @@ -1305,37 +1314,37 @@ void MEDFileUMeshSplitL1::eraseFamilyField() /*! * This method ignores _m and _m_by_types. */ -void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, +void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups) { - std::vector< DataArrayInt * > corr; + std::vector< DataArrayIdType * > corr; _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr); - std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); - std::vector< std::vector > fidsOfGroups; - std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end()); - _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); - int nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); - std::map newfams; - std::map famIdTrad; + std::vector< MCAuto > corrMSafe(corr.begin(),corr.end()); + std::vector< std::vector > fidsOfGroups; + std::vector< const DataArrayIdType * > corr2(corr.begin(),corr.end()); + _fam=DataArrayIdType::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups); + mcIdType nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells(); + std::map newfams; + std::map famIdTrad; TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams); - int *w=_fam->getPointer(); - for(int i=0;igetPointer(); + for(mcIdType i=0;i ms(_m_by_types.getParts()); - int start=0; + mcIdType start=0; for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { - int nbCells=(*it)->getNumberOfCells(); - int end=start+nbCells; - MCAuto fam,num; + mcIdType nbCells=(*it)->getNumberOfCells(); + mcIdType end=start+nbCells; + MCAuto fam,num; MCAuto names; - if((const DataArrayInt *)_fam) + if((const DataArrayIdType *)_fam) fam=_fam->subArray(start,end); - if((const DataArrayInt *)_num) + if((const DataArrayIdType *)_num) num=_num->subArray(start,end); if((const DataArrayAsciiChar *)_names) names=static_cast(_names->subArray(start,end)); @@ -1344,51 +1353,51 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) } } -void MEDFileUMeshSplitL1::renumberNodesInConn(const int *newNodeNumbersO2N) +void MEDFileUMeshSplitL1::renumberNodesInConn(const mcIdType *newNodeNumbersO2N) { _m_by_types.renumberNodesInConnWithoutComputation(newNodeNumbersO2N); } -void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void MEDFileUMeshSplitL1::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_fam); bigArraysI.push_back(_num); _m_by_types.serialize(tinyInt,bigArraysI); } -void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +void MEDFileUMeshSplitL1::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { _fam=bigArraysI.back(); bigArraysI.pop_back(); _num=bigArraysI.back(); bigArraysI.pop_back(); _m_by_types.unserialize(name,coo,tinyInt,bigArraysI); } -void MEDFileUMeshSplitL1::changeFamilyIdArr(int oldId, int newId) +void MEDFileUMeshSplitL1::changeFamilyIdArr(mcIdType oldId, mcIdType newId) { - DataArrayInt *arr=_fam; + DataArrayIdType *arr=_fam; if(arr) arr->changeValue(oldId,newId); } -void MEDFileUMeshSplitL1::setFamilyArr(DataArrayInt *famArr) +void MEDFileUMeshSplitL1::setFamilyArr(DataArrayIdType *famArr) { if(!famArr) { _fam=0; return ; } - int 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; } -DataArrayInt *MEDFileUMeshSplitL1::getFamilyField() +DataArrayIdType *MEDFileUMeshSplitL1::getFamilyField() { return _fam; } -void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr) +void MEDFileUMeshSplitL1::setRenumArr(DataArrayIdType *renumArr) { if(!renumArr) { @@ -1396,7 +1405,7 @@ void MEDFileUMeshSplitL1::setRenumArr(DataArrayInt *renumArr) _rev_num=0; return ; } - int 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; @@ -1410,13 +1419,13 @@ void MEDFileUMeshSplitL1::setNameArr(DataArrayAsciiChar *nameArr) _names=0; return ; } - int 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; } -MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds) +MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds) { if(renum==0) return m; @@ -1424,63 +1433,63 @@ MEDCouplingUMesh *MEDFileUMeshSplitL1::Renumber2(const DataArrayInt *renum, MEDC m->renumberCells(renum->begin(),true); else { - MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); + MCAuto locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells()); m->renumberCells(locnum->begin(),true); } return m; } -MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { MCAuto ret(new MEDFileUMeshSplitL1); ret->unserialize(name,coo,tinyInt,bigArraysI); return ret.retn(); } -MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const +MEDCouplingUMesh *MEDFileUMeshSplitL1::renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const { return Renumber2(_num,m,cellIds); } -DataArrayInt *MEDFileUMeshSplitL1::Renumber(const DataArrayInt *renum, const DataArrayInt *da) +DataArrayIdType *MEDFileUMeshSplitL1::Renumber(const DataArrayIdType *renum, const DataArrayIdType *da) { - if((const DataArrayInt *)renum==0) + if((const DataArrayIdType *)renum==0) { da->incrRef(); - return const_cast(da); + return const_cast(da); } return renum->selectByTupleId(da->begin(),da->end()); } -DataArrayInt *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayInt *da) const +DataArrayIdType *MEDFileUMeshSplitL1::renumIfNeededArr(const DataArrayIdType *da) const { return Renumber(_num,da); } -std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(int nb, const std::map& families) +std::vector MEDFileUMeshSplitL1::GetNewFamiliesNumber(mcIdType nb, const std::map& families) { - int id=-1; - for(std::map::const_iterator it=families.begin();it!=families.end();it++) + mcIdType id=-1; + 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); - for(int i=1;i<=nb;i++) + std::vector ret(nb); + for(mcIdType i=1;i<=nb;i++) ret[i]=id+i; 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 allfids; + std::set allfids; //tony } void MEDFileUMeshSplitL1::computeRevNum() const { - int pos; - int maxValue=_num->getMaxValue(pos); + mcIdType pos; + mcIdType maxValue=_num->getMaxValue(pos); _rev_num=_num->invertArrayN2O2O2N(maxValue+1); } @@ -1561,11 +1570,11 @@ MEDCouplingUMesh *MEDFileUMeshAggregateCompute::getUmesh() const return _m; } -int MEDFileUMeshAggregateCompute::getNumberOfCells() const +mcIdType MEDFileUMeshAggregateCompute::getNumberOfCells() const { if(_mp_time<=_m_time) return _m->getNumberOfCells(); - int ret(0); + mcIdType ret(0); for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) ret+=(*it)->getNumberOfCells(); return ret; @@ -1585,7 +1594,7 @@ std::vector MEDFileUMeshAggregateCompute::get return _m->getAllGeoTypesSorted(); } -int MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const +mcIdType MEDFileUMeshAggregateCompute::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const { if(_mp_time>=_m_time) { @@ -1636,7 +1645,7 @@ MEDCoupling1GTUMesh *MEDFileUMeshAggregateCompute::retrievePartWithoutComputatio throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartWithoutComputation : the geometric type is not existing !"); } -void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const +void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const { start=0; stop=0; std::vector v(retrievePartsWithoutComputation()); @@ -1657,7 +1666,7 @@ void MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation(INTER throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getStartStopOfGeoTypeWithoutComputation : the geometric type is not existing !"); } -void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N) +void MEDFileUMeshAggregateCompute::renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N) { if(_mp_time>_m_time) { @@ -1715,12 +1724,12 @@ const PartDefinition *MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputati throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getPartDefOfWithoutComputation : The input geo type is not existing in this !"); } -void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { if(_mp_time<_m_time) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::serialize : the parts require a computation !"); std::size_t sz(_m_parts.size()); - tinyInt.push_back((int)sz); + tinyInt.push_back((mcIdType)sz); for(std::size_t i=0;i& tinyInt, std::vec const MEDCoupling1DGTUMesh *mesh2(dynamic_cast(mesh)); if(mesh1) { - DataArrayInt *elt(mesh1->getNodalConnectivity()); + DataArrayIdType *elt(mesh1->getNodalConnectivity()); if(elt) elt->incrRef(); - MCAuto elt1(elt); + MCAuto elt1(elt); bigArraysI.push_back(elt1); } else if(mesh2) { - DataArrayInt *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex()); + DataArrayIdType *elt1(mesh2->getNodalConnectivity()),*elt2(mesh2->getNodalConnectivityIndex()); if(elt1) elt1->incrRef(); if(elt2) elt2->incrRef(); - MCAuto elt11(elt1),elt22(elt2); + MCAuto elt11(elt1),elt22(elt2); bigArraysI.push_back(elt11); bigArraysI.push_back(elt22); } else @@ -1754,20 +1763,20 @@ void MEDFileUMeshAggregateCompute::serialize(std::vector& tinyInt, std::vec tinyInt.push_back(-1); else { - std::vector tinyTmp; + std::vector tinyTmp; pd->serialize(tinyTmp,bigArraysI); - tinyInt.push_back((int)tinyTmp.size()); + tinyInt.push_back((mcIdType)tinyTmp.size()); tinyInt.insert(tinyInt.end(),tinyTmp.begin(),tinyTmp.end()); } } } -void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { - int 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(int i=0;i mesh(MEDCoupling1GTUMesh::New(name,tp)); @@ -1780,7 +1789,7 @@ void MEDFileUMeshAggregateCompute::unserialize(const std::string& name, DataArra } else if(mesh2) { - MCAuto elt0,elt1; + MCAuto elt0,elt1; elt0=bigArraysI.back(); bigArraysI.pop_back(); elt1=bigArraysI.back(); bigArraysI.pop_back(); mesh2->setNodalConnectivity(elt0,elt1); @@ -1788,7 +1797,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; - int 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; @@ -2005,7 +2014,7 @@ int MEDFileUMeshAggregateCompute::getMeshDimension() const } } -std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const +std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const { if(_mp_time<_m_time) { @@ -2016,20 +2025,20 @@ std::vector MEDFileUMeshAggregateCompute::getDistributionOfTypes() const } else { - std::vector ret; + std::vector ret; for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *tmp(*it); if(!tmp) throw INTERP_KERNEL::Exception("MEDFileUMeshAggregateCompute::getDistributionOfTypes : part mesh contains null instance !"); - std::vector ret0(tmp->getDistributionOfTypes()); + std::vector ret0(tmp->getDistributionOfTypes()); ret.insert(ret.end(),ret0.begin(),ret0.end()); } return ret; } } -int MEDFileUMeshAggregateCompute::getSize() const +mcIdType MEDFileUMeshAggregateCompute::getSize() const { if(_mp_time<_m_time) { @@ -2040,7 +2049,7 @@ int MEDFileUMeshAggregateCompute::getSize() const } else { - int ret=0; + mcIdType ret=0; for(std::vector< MCAuto >::const_iterator it=_m_parts.begin();it!=_m_parts.end();it++) { const MEDCoupling1GTUMesh *m(*it); @@ -2092,16 +2101,17 @@ MEDFileEltStruct4Mesh::MEDFileEltStruct4Mesh(med_idt fid, const std::string& mNa MEDFILESAFECALLERRD0(MEDmeshEntityInfo,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,iterOnStEltOfMesh+1,geoTypeName,&geoType)); _geo_type=geoType; _geo_type_name=MEDLoaderBase::buildStringFromFortran(geoTypeName,MED_NAME_SIZE); - int nCells(0); + mcIdType nCells(0); { med_bool chgt=MED_FALSE,trsf=MED_FALSE; nCells=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,geoType,MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf); } MCAuto mss(MEDFileMeshSupports::New(fid)); MCAuto mse(MEDFileStructureElements::New(fid,mss)); - int nbEntities(mse->getNumberOfNodesPerSE(_geo_type_name)); - _conn=DataArrayInt::New(); _conn->alloc(nCells*nbEntities); - MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName.c_str(),dt,it,MED_STRUCT_ELEMENT,_geo_type,MED_NODAL,MED_FULL_INTERLACE,_conn->getPointer())); + 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); _conn->applyLin(1,-1); _conn->rearrange(nbEntities); _common=MEDFileUMeshPerTypeCommon::New(); diff --git a/src/MEDLoader/MEDFileMeshLL.hxx b/src/MEDLoader/MEDFileMeshLL.hxx index f57b311f4..21cb9c494 100644 --- a/src/MEDLoader/MEDFileMeshLL.hxx +++ b/src/MEDLoader/MEDFileMeshLL.hxx @@ -86,8 +86,8 @@ namespace MEDCoupling MCAuto getPartDefOfCoo() const { return _part_coords; } std::vector getAxisInfoOnMesh(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& nstep, int& Mdim); static INTERP_KERNEL::AutoCppPtr GetMeshIdFromName(med_idt fid, const std::string& mName, MEDCoupling::MEDCouplingMeshType& meshType, MEDCoupling::MEDCouplingAxisType& axType, int& dt, int& it, std::string& dtunit1); - static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); - static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); + static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map& fams, std::map >& grps, MEDFileMeshReadSelector *mrs); + static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map& fams, const std::map >& grps, int tooLongStrPol); static bool RenameFamiliesFromFileToMem(std::vector< std::string >& famNames); static bool RenameFamiliesFromMemToFile(std::vector< std::string >& famNames); static MEDCoupling::MEDCouplingAxisType TraduceAxisType(med_axis_type at); @@ -96,9 +96,9 @@ namespace MEDCoupling static med_grid_type TraduceAxisTypeRevStruct(MEDCoupling::MEDCouplingAxisType at); private: typedef bool (*RenameFamiliesPatternFunc)(std::vector< std::string >&); - static void RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func); - static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams); - static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams); + static void RenameFamiliesPatternInternal(std::vector< std::pair > > >& crudeFams, RenameFamiliesPatternFunc func); + static void RenameFamiliesFromFileToMemInternal(std::vector< std::pair > > >& crudeFams); + static void RenameFamiliesFromMemToFileInternal(std::vector< std::pair > > >& crudeFams); public: static const char ZE_SEP_FOR_FAMILY_KILLERS[]; static int ZE_SEP2_FOR_FAMILY_KILLERS; @@ -119,31 +119,31 @@ namespace MEDCoupling MEDFileUMeshL2(); std::vector loadCommonPart(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, int& Mdim); void loadAll(med_idt fid, const MeshOrStructMeshCls *mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void 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); + void 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); void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs); - void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); + void loadPartOfConnectivity(med_idt fid, int mdim, const std::string& mName, const std::vector& types, const std::vector& slicPerTyp, int dt, int it, MEDFileMeshReadSelector *mrs); void loadCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it); - void loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, int nMin, int nMax); - int getNumberOfLevels() const { return _per_type_mesh.size(); } + void loadPartCoords(med_idt fid, const std::vector& infosOnComp, const std::string& mName, int dt, int it, mcIdType nMin, mcIdType nMax); + int getNumberOfLevels() const { return (int)_per_type_mesh.size(); } bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); } const std::vector< MCAuto >& getLev(int levId) const { return _per_type_mesh[levId]; } bool isFamDefinedOnLev(int levId) const; bool isNumDefinedOnLev(int levId) const; bool isNamesDefinedOnLev(int levId) const; MCAuto getCoords() const { return _coords; } - MCAuto getCoordsFamily() const { return _fam_coords; } - MCAuto getCoordsNum() const { return _num_coords; } - MCAuto getCoordsGlobalNum() const { return _global_num_coords; } + MCAuto getCoordsFamily() const { return _fam_coords; } + MCAuto getCoordsNum() const { return _num_coords; } + MCAuto getCoordsGlobalNum() const { return _global_num_coords; } MCAuto getCoordsName() const { return _name_coords; } - static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayInt *globalNumCoords); + static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayIdType *famCoords, const DataArrayIdType *numCoords, const DataArrayAsciiChar *nameCoords, const DataArrayIdType *globalNumCoords); private: void sortTypes(); private: std::vector< std::vector< MCAuto > > _per_type_mesh; MCAuto _coords; - MCAuto _fam_coords; - MCAuto _num_coords; - MCAuto _global_num_coords; + MCAuto _fam_coords; + MCAuto _num_coords; + MCAuto _global_num_coords; MCAuto _name_coords; }; @@ -203,14 +203,14 @@ namespace MEDCoupling void assignDefParts(const std::vector& partDefs); void assignUMesh(MEDCouplingUMesh *m); MEDCouplingUMesh *getUmesh() const; - int getNumberOfCells() const; + mcIdType getNumberOfCells() const; std::vector getParts() const; std::vector getGeoTypes() const; - int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; std::vector retrievePartsWithoutComputation() const; MEDCoupling1GTUMesh *retrievePartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; - void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, int& start, int& stop) const; - void renumberNodesInConnWithoutComputation(const int *newNodeNumbersO2N); + void getStartStopOfGeoTypeWithoutComputation(INTERP_KERNEL::NormalizedCellType gt, mcIdType& start, mcIdType& stop) const; + void renumberNodesInConnWithoutComputation(const mcIdType *newNodeNumbersO2N); bool isStoredSplitByType() const; std::size_t getTimeOfThis() const; std::size_t getHeapMemorySizeWithoutChildren() const; @@ -223,13 +223,13 @@ namespace MEDCoupling void synchronizeTinyInfo(const MEDFileMesh& master) const; bool empty() const; int getMeshDimension() const; - std::vector getDistributionOfTypes() const; - int getSize() const; + std::vector getDistributionOfTypes() const; + mcIdType getSize() const; void setCoords(DataArrayDouble *coords); void forceComputationOfPartsFromUMesh() const; const PartDefinition *getPartDefOfWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const; - void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: std::size_t getTimeOfParts() const; std::size_t getTimeOfUMesh() const; @@ -265,64 +265,64 @@ namespace MEDCoupling void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts); void forceComputationOfParts() const; bool empty() const; - bool presenceOfOneFams(const std::vector& ids) const; + bool presenceOfOneFams(const std::vector& ids) const; int getMeshDimension() const; void simpleRepr(std::ostream& oss) const; - int getSize() const; - MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const; - DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const; + mcIdType getSize() const; + MEDCouplingUMesh *getFamilyPart(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const; + DataArrayIdType *getFamilyPartArr(const mcIdType *idsBg, const mcIdType *idsEnd, bool renum) const; MEDCouplingUMesh *getWholeMesh(bool renum) const; - int getNumberOfCells() const; + mcIdType getNumberOfCells() const; bool isMeshStoredSplitByType() const { return _m_by_types.isStoredSplitByType(); } std::vector getGeoTypes() const; - int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; + mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType ct) const; std::vector getDirectUndergroundSingleGeoTypeMeshes() const { return _m_by_types.retrievePartsWithoutComputation(); } MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const { return _m_by_types.retrievePartWithoutComputation(gt); } - DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - std::vector getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); } - DataArrayInt *getOrCreateAndGetFamilyField(); - const DataArrayInt *getFamilyField() const; - const DataArrayInt *getNumberField() const; + DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + std::vector getDistributionOfTypes() const { return _m_by_types.getDistributionOfTypes(); } + DataArrayIdType *getOrCreateAndGetFamilyField(); + const DataArrayIdType *getFamilyField() const; + const DataArrayIdType *getNumberField() const; const DataArrayAsciiChar *getNameField() const; - const DataArrayInt *getRevNumberField() const; + const DataArrayIdType *getRevNumberField() const; const PartDefinition *getPartDef(INTERP_KERNEL::NormalizedCellType gt) const; void eraseFamilyField(); - void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, + void setGroupsFromScratch(const std::vector& ms, std::map& familyIds, std::map >& groups); void write(med_idt fid, const std::string& mName, int mdim) const; // - void setFamilyArr(DataArrayInt *famArr); - DataArrayInt *getFamilyField(); - void setRenumArr(DataArrayInt *renumArr); + void setFamilyArr(DataArrayIdType *famArr); + DataArrayIdType *getFamilyField(); + void setRenumArr(DataArrayIdType *renumArr); void setNameArr(DataArrayAsciiChar *nameArr); - void changeFamilyIdArr(int oldId, int newId); + void changeFamilyIdArr(mcIdType oldId, mcIdType newId); // - void renumberNodesInConn(const int *newNodeNumbersO2N); + void renumberNodesInConn(const mcIdType *newNodeNumbersO2N); // - void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; - void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + void unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); // static void ClearNonDiscrAttributes(const MEDCouplingMesh *tmp); - static std::vector GetNewFamiliesNumber(int nb, const std::map& families); - static void TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, - std::map& famIdTrad, std::map& newfams); - static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da); - static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds); - static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + static std::vector GetNewFamiliesNumber(mcIdType nb, const std::map& families); + static void TraduceFamilyNumber(const std::vector< std::vector >& fidsGrps, std::map& familyIds, + std::map& famIdTrad, std::map& newfams); + static DataArrayIdType *Renumber(const DataArrayIdType *renum, const DataArrayIdType *da); + static MEDCouplingUMesh *Renumber2(const DataArrayIdType *renum, MEDCouplingUMesh *m, const mcIdType *cellIds); + static MEDFileUMeshSplitL1 *Unserialize(const std::string& name, DataArrayDouble *coo, std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); private: MEDFileUMeshSplitL1(); void assignCommonPart(); - MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const; - DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const; + MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const mcIdType *cellIds) const; + DataArrayIdType *renumIfNeededArr(const DataArrayIdType *da) const; void computeRevNum() const; private: MEDFileUMeshAggregateCompute _m_by_types; - MCAuto _fam; - MCAuto _num; - MCAuto _global_num; + MCAuto _fam; + MCAuto _num; + MCAuto _global_num; MCAuto _names; - mutable MCAuto _rev_num; + mutable MCAuto _rev_num; MEDFileUMeshPermCompute _m; }; @@ -331,7 +331,7 @@ namespace MEDCoupling public: static MEDFileEltStruct4Mesh *New(med_idt fid, const std::string& mName, int dt, int it, int iterOnStEltOfMesh, MEDFileMeshReadSelector *mrs); std::string getGeoTypeName() const { return _geo_type_name; } - MCAuto getConn() const { return _conn; } + MCAuto getConn() const { return _conn; } MCAuto getMeshDef() const { return _common; } const std::vector< MCAuto >& getVars() const { return _vars; } private: @@ -344,7 +344,7 @@ namespace MEDCoupling private: std::string _geo_type_name; int _geo_type; - MCAuto _conn; + MCAuto _conn; MCAuto _common; std::vector< MCAuto > _vars; }; diff --git a/src/MEDLoader/MEDFileMeshSupport.cxx b/src/MEDLoader/MEDFileMeshSupport.cxx index c1fb5c051..4be2a9116 100644 --- a/src/MEDLoader/MEDFileMeshSupport.cxx +++ b/src/MEDLoader/MEDFileMeshSupport.cxx @@ -45,16 +45,16 @@ MEDFileMeshSupports *MEDFileMeshSupports::New() MEDFileMeshSupports::MEDFileMeshSupports(med_idt fid) { - int 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; - int 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]); - int spaceDim(0),meshDim(0); + med_int spaceDim(0),meshDim(0); MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,i+1,msn,&spaceDim,&meshDim,description,&axType,axisName,axisUnit)); std::string name(MEDLoaderBase::buildStringFromFortran(msn,MED_NAME_SIZE)); _supports[i]=MEDFileUMesh::New(fid,name); @@ -120,7 +120,7 @@ const MEDFileUMesh *MEDFileMeshSupports::getSupMeshWithName(const std::string& n throw INTERP_KERNEL::Exception(oss.str()); } -int MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const +mcIdType MEDFileMeshSupports::getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const { const MEDFileUMesh *sup(getSupMeshWithName(name)); switch(entity) diff --git a/src/MEDLoader/MEDFileMeshSupport.hxx b/src/MEDLoader/MEDFileMeshSupport.hxx index f3caabc16..00634fdb2 100644 --- a/src/MEDLoader/MEDFileMeshSupport.hxx +++ b/src/MEDLoader/MEDFileMeshSupport.hxx @@ -41,7 +41,7 @@ namespace MEDCoupling 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 int getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodesInConnOf(TypeOfField entity, const std::string& name) const; private: MEDFileMeshSupports(med_idt fid); MEDFileMeshSupports(); diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx index e978b51af..c08481883 100644 --- a/src/MEDLoader/MEDFileParameter.cxx +++ b/src/MEDLoader/MEDFileParameter.cxx @@ -21,6 +21,7 @@ #include "MEDFileParameter.hxx" #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" +#include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" @@ -110,12 +111,12 @@ void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& std::ostringstream oss; oss << "MEDFileParameterDouble1TS::finishLoading : no specified time step (" << dt << "," << it << ") ! Time steps available : "; for(int i=0;i(locDt); _order=FromMedInt(locIt); _time=tim; MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast(&_arr))); return ; } @@ -136,10 +137,10 @@ void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& nam void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId) { - int locDt,locIt; + med_int locDt,locIt; double dt; MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt)); - _iteration=locDt; _order=locIt; _time=dt; + _iteration=FromMedInt(locDt); _order=FromMedInt(locIt); _time=dt; MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast(&_arr))); } @@ -212,7 +213,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - int 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); @@ -220,7 +221,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName med_parameter_type paramType; for(int i=0;i(nbOfSteps)); return ; } else @@ -244,7 +245,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName { MEDFileUtilities::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); - int 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); @@ -252,7 +253,7 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName med_parameter_type paramType; for(int i=0;i descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE); INTERP_KERNEL::AutoPtr unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE); med_parameter_type paramType; - int nbOfSteps; + med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE); if(paramType==MED_FLOAT64) @@ -407,7 +408,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) { - int nbPar(MEDnParameter(fid)); + med_int nbPar(MEDnParameter(fid)); if(nbPar<1) { std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << FileNameFromFID(fid) << "\" !" ; @@ -417,18 +418,18 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid) INTERP_KERNEL::AutoPtr descName(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE)); INTERP_KERNEL::AutoPtr unitName(MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE)); med_parameter_type paramType; - int nbOfSteps; + med_int nbOfSteps; MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps)); 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); - finishLoading(fid,paramType,nbOfSteps); + finishLoading(fid,paramType,FromMedInt(nbOfSteps)); } MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& paramName) { - int 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)); @@ -436,7 +437,7 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(med_idt fid, const std::string& med_parameter_type paramType; for(int i=0;i(nbOfSteps)); return ; } else @@ -469,13 +470,13 @@ void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, _param_per_ts.resize(nbOfSteps); for(int i=0;i(dt),FromMedInt(it),tim); _param_per_ts[i]->readValue(fid,_name.c_str()); break; /*case MED_INT32; @@ -724,7 +725,7 @@ MEDFileParameters *MEDFileParameters::New(med_idt fid) MEDFileParameters::MEDFileParameters(med_idt fid) { - int 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)); @@ -732,7 +733,7 @@ MEDFileParameters::MEDFileParameters(med_idt fid) med_parameter_type paramType; for(int i=0;i constattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type constatttype; - int nbCompo; + med_int nbCompo; med_entity_type met; - int pflSz; - MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&pflSz)); + med_int miPflSz; + MEDFILESAFECALLERRD0(MEDstructElementConstAttInfo,(fid,modelName.c_str(),idCstAtt+1,constattname,&constatttype,&nbCompo,&met,profilename,&miPflSz)); std::string name(MEDLoaderBase::buildStringFromFortran(constattname,MED_NAME_SIZE)); setName(name); setProfile(MEDLoaderBase::buildStringFromFortran(profilename,MED_NAME_SIZE)); _tof=MEDFileMesh::ConvertFromMEDFileEntity(met); // _val=MEDFileStructureElement::BuildFrom(constatttype); - nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,nbCompo); + nbCompo=MEDFileStructureElement::EffectiveNbCompo(constatttype,FromMedInt(nbCompo)); + mcIdType pflSz = miPflSz; if(pflSz==0 && getProfile().empty()) { switch(met) @@ -140,8 +141,10 @@ MEDFileSEVarAtt::MEDFileSEVarAtt(med_idt fid, MEDFileStructureElement *father, i INTERP_KERNEL::AutoPtr varattname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),profilename(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_attribute_type varatttype; { - int pflSz; - MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&_nb_compo)); + //int pflSz; + med_int nbComp; + MEDFILESAFECALLERRD0(MEDstructElementVarAttInfo,(fid,modelName.c_str(),idVarAtt+1,varattname,&varatttype,&nbComp)); + _nb_compo=FromMedInt(nbComp); } setName(MEDLoaderBase::buildStringFromFortran(varattname,MED_NAME_SIZE)); _gen=MEDFileStructureElement::BuildFrom(varatttype); @@ -174,11 +177,14 @@ MEDFileStructureElement::MEDFileStructureElement(med_idt fid, int idSE, const ME INTERP_KERNEL::AutoPtr modelName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)),supportMeshName(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE)); med_geometry_type sgeoType; med_entity_type entiyType; - int nConsAttr(0),nVarAttr(0); + med_int nConsAttr(0),nVarAttr(0); { med_bool anyPfl; - int nnode(0),ncell(0); - MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&_id_type,&_dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr)); + med_int nnode(0),ncell(0),dim(0); + med_geometry_type idType; + MEDFILESAFECALLERRD0(MEDstructElementInfo,(fid,idSE+1,modelName,&idType,&dim,supportMeshName,&entiyType,&nnode,&ncell,&sgeoType,&nConsAttr,&anyPfl,&nVarAttr)); + _id_type=(int)idType; + _dim=FromMedInt(dim); } _name=MEDLoaderBase::buildStringFromFortran(modelName,MED_NAME_SIZE); _sup_mesh_name=MEDLoaderBase::buildStringFromFortran(supportMeshName,MED_NAME_SIZE); @@ -327,7 +333,7 @@ void MEDFileStructureElements::writeLL(med_idt fid) const MEDFileStructureElements::MEDFileStructureElements(med_idt fid, const MEDFileMeshSupports *ms) { - int nbSE(MEDnStructElement(fid)); + med_int nbSE(MEDnStructElement(fid)); _elems.resize(nbSE); for(int i=0;i MEDFileStructureElements::getDynGTAvail() const @@ -371,7 +377,7 @@ const MEDFileStructureElement *MEDFileStructureElements::getWithGT(int idGT) con throw INTERP_KERNEL::Exception(oss.str()); } -int MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const +mcIdType MEDFileStructureElements::getNumberOfNodesPerSE(const std::string& seName) const { if(seName=="MED_PARTICLE") return 1; diff --git a/src/MEDLoader/MEDFileStructureElement.hxx b/src/MEDLoader/MEDFileStructureElement.hxx index 5cfeee1ed..b31802b36 100644 --- a/src/MEDLoader/MEDFileStructureElement.hxx +++ b/src/MEDLoader/MEDFileStructureElement.hxx @@ -121,7 +121,7 @@ class MEDFileSEConstAtt : public RefCountObject, public MEDFileWritableStandAlon MEDLOADER_EXPORT int getNumberOf() const; MEDLOADER_EXPORT std::vector getDynGTAvail() const; MEDLOADER_EXPORT const MEDFileStructureElement *getWithGT(int idGT) const; - MEDLOADER_EXPORT int getNumberOfNodesPerSE(const std::string& seName) const; + MEDLOADER_EXPORT mcIdType getNumberOfNodesPerSE(const std::string& seName) const; MEDLOADER_EXPORT const MEDFileStructureElement *getSEWithName(const std::string& seName) const; MEDLOADER_EXPORT std::vector getVarAttsOf(const std::string& seName) const; MEDLOADER_EXPORT const MEDFileSEVarAtt *getVarAttOf(const std::string &seName, const std::string& varName) const; diff --git a/src/MEDLoader/MEDFileUtilities.cxx b/src/MEDLoader/MEDFileUtilities.cxx index e05a25c80..d30377eae 100644 --- a/src/MEDLoader/MEDFileUtilities.cxx +++ b/src/MEDLoader/MEDFileUtilities.cxx @@ -22,6 +22,7 @@ #include "MEDFileSafeCaller.txx" #include "MEDLoaderBase.hxx" #include "MEDLoader.hxx" +#include "MEDFileBasis.hxx" #include "InterpKernelAutoPtr.hxx" @@ -103,7 +104,7 @@ void MEDFileUtilities::CheckFileForRead(const std::string& fileName) throw INTERP_KERNEL::Exception(oss.str().c_str()); } oss << " has been detected readable but "; - int major,minor,release; + med_int major,minor,release; MEDfileNumVersionRd(fid,&major,&minor,&release); if(major<2 || (major==2 && minor<2)) { @@ -155,7 +156,7 @@ void MEDCoupling::MEDFileWritable::setZipConnPolicy(int newVal) std::string MEDCoupling::MEDFileWritable::FileNameFromFID(med_idt fid) { - int lgth(MEDfileName(fid,0,0)); + med_int lgth(MEDfileName(fid,0,0)); if(lgth<=0) return std::string(); INTERP_KERNEL::AutoPtr tmp(new char[lgth+1]); @@ -185,7 +186,7 @@ void MEDCoupling::MEDFileWritableStandAlone::write(const std::string& fileName, 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(fid,fid,oss.str()); + MEDFileUtilities::CheckMEDCode((int)fid,fid,oss.str()); writeLL(fid); } diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 8b1ffc7c6..07d3e9393 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -163,12 +163,12 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st med_mesh_type type_maillage; med_int Sdim,Mdim; std::string trueMeshName; - med_int meshId=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; - int 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)); @@ -185,9 +185,9 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st { med_geometry_type curMedType=typmai[i]; med_bool changement,transformation; - int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); - int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation - int curNbOfElem; + med_int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation)); + med_int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation + med_int curNbOfElem; med_entity_type whichEntity; MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity); if(curNbOfElem>0) @@ -208,8 +208,8 @@ int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::st return ret; } -med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) - { +int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) +{ if(meshName.empty()) { std::vector meshes=getMeshNamesFid(fid); @@ -231,8 +231,8 @@ med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, throw INTERP_KERNEL::Exception(os2.str().c_str()); } trueMeshName=meshName; - return iter-meshes.begin()+1; - } + return (int)( iter-meshes.begin()+1 ); +} std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) { @@ -248,10 +248,10 @@ std::vector MEDLoaderNS::getMeshNamesFid(med_idt 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); - int nstep; + 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 cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa)); ret[i]=cur; @@ -262,7 +262,7 @@ std::vector MEDLoaderNS::getMeshNamesFid(med_idt fid) /*! * This methods allows to merger all entities and to considerate only cell types. */ -void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity) +void MEDLoaderNS::dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity) { if(nbOfElemCell>=nbOfElemFace) { @@ -340,9 +340,9 @@ void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release) med_err ret(MEDlibraryNumVersion(&majj,&minn,&rell)); if(ret!=0) throw INTERP_KERNEL::Exception("MEDFileVersion : fail to call MEDlibraryNumVersion ! It looks very bad !"); - major=majj; - minor=minn; - release=rell; + major=FromMedInt(majj); + minor=FromMedInt(minn); + release=FromMedInt(rell); } /*! @@ -378,7 +378,7 @@ void MEDCoupling::SetTooLongStrPolicy(int val) * - the space dimension * - the number of nodes */ -std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes) +std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes) { MEDFileUtilities::AutoFid fid(MEDCoupling::OpenMEDFileForRead(fileName)); std::set poss; @@ -386,15 +386,17 @@ std::vector< std::vector< std::pair > > M char maillage_description[MED_COMMENT_SIZE+1]; med_mesh_type type_maillage; std::string trueMeshName; - med_int 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; + med_int nstep, mDim, sDim; med_axis_type axisType; - int 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,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); + MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&sDim,&mDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); + meshDim=FromMedInt(mDim); + spaceDim=FromMedInt(sDim); if(type_maillage!=MED_UNSTRUCTURED_MESH) { std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName; @@ -414,7 +416,7 @@ std::vector< std::vector< std::pair > > M for(int i=0;i0) { INTERP_KERNEL::NormalizedCellType typp=typmai2[i]; @@ -431,7 +433,7 @@ std::vector< std::vector< std::pair > > M { ret[maxLev-dims[i]].push_back(geoTypes[i]); } - numberOfNodes=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation); + numberOfNodes=ToIdType(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation)); return ret; } @@ -518,7 +520,7 @@ std::vector MEDCoupling::GetMeshFamiliesNames(const std::string& fi med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -541,7 +543,7 @@ std::vector MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::str med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -569,7 +571,7 @@ std::vector MEDCoupling::GetMeshGroupsNamesOnFamily(const std::stri bool found=false; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -604,7 +606,7 @@ std::vector MEDCoupling::GetMeshGroupsNames(const std::string& file med_int numfam; for(int i=0;i attide=new med_int[natt]; INTERP_KERNEL::AutoPtr attval=new med_int[natt]; @@ -746,7 +748,7 @@ std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt)); std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); - int profilesize,nbi; + med_int profilesize,nbi; if(curMeshName==meshName) { bool found=false; @@ -796,7 +798,7 @@ std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1); if(nbPdt>0) { - int profilesize,nbi; + med_int profilesize,nbi; MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt)); med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE, pflname,&profilesize,locname,&nbi)); @@ -946,7 +948,7 @@ std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std: { for(int k=0;k > MEDCoupling::GetNodeFieldIterations(const std: { for(int k=0;k MEDCoupling::ReadFieldsOnSame if(!mmuPtr) throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !"); MCAuto m=mmuPtr->getMeshAtLevel(meshDimRelToMax); - const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); + const DataArrayIdType *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); MCAuto m2(m->clone(true)); if(o2n) m2->renumberCells(o2n->begin(),true); @@ -1325,7 +1327,7 @@ namespace MEDCoupling MCAuto::FieldType> ret(ff->getFieldOnMeshAtLevel(type,m)); if(muPtr.isNotNull()) { - const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); + const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); if(num) ret->renumberCells(num->begin()); } @@ -1373,27 +1375,27 @@ namespace MEDCoupling { if(muPtr.isNotNull()) { - const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); + const DataArrayIdType *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax)); if(num) ret->renumberCells(num->begin()); } } else { - DataArrayInt *pfl(nullptr),*arr2(nullptr); + DataArrayIdType *pfl(nullptr),*arr2(nullptr); MCAuto::ArrayType> arr(ff->getFieldWithProfile(ON_NODES,meshDimRelToMax,mm,pfl)); - MCAuto pflSafe(pfl); - MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); + MCAuto pflSafe(pfl); + MCAuto mp(m->getCellIdsFullyIncludedInNodeIds(pfl->begin(),pfl->end())); MCAuto mzip(static_cast(m->buildPartAndReduceNodes(mp->begin(),mp->end(),arr2))); - MCAuto arr2Safe(arr2); - MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); - MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); + MCAuto arr2Safe(arr2); + MCAuto arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); + MCAuto pflSorted(pflSafe->deepCopy()); pflSorted->sort(true); if(!arr3->isEqualWithoutConsideringStr(*pflSorted)) throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !"); if(!arr3->isEqualWithoutConsideringStr(*pflSafe)) { - MCAuto o2n2(pflSafe->checkAndPreparePermutation()); - MCAuto n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); + MCAuto o2n2(pflSafe->checkAndPreparePermutation()); + MCAuto n2o2(o2n2->invertArrayO2N2N2O(o2n2->getNumberOfTuples())); mzip->renumberNodes(n2o2->begin(),n2o2->getNumberOfTuples()); arr->setName(""); ret->setArray(arr); @@ -1557,8 +1559,8 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri { MCAuto mmu(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*mmu); - MCAuto o2n(um->getRenumArrForMEDFileFrmt()); - MCAuto n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); + MCAuto o2n(um->getRenumArrForMEDFileFrmt()); + MCAuto n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); f2->renumberCells(o2n->begin(),false); mmu->setMeshAtLevel(0,const_cast(static_cast(f2->getMesh()))); mmu->setRenumFieldArr(0,n2o); @@ -1630,7 +1632,7 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits 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()); + MCAuto o2n(m->getRenumArrForMEDFileFrmt()); f2->renumberCells(o2n->begin(),false); m=static_cast(const_cast(f2->getMesh())); MCAuto mread(mmuPtr->getMeshAtLevel(m->getMeshDimension()-mm->getMeshDimension())); @@ -1640,9 +1642,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits m->tryToShareSameCoordsPermute(*mread,_EPS_FOR_NODE_COMP); else mread->setCoords(m->getCoords()); - DataArrayInt *part(NULL); + DataArrayIdType *part(NULL); bool b(mread->areCellsIncludedIn(m,_COMP_FOR_CELL,part)); - MCAuto partSafe(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 !"; @@ -1662,9 +1664,9 @@ void WriteFieldT(const std::string& fileName, const typename MEDCoupling::Traits } else { - DataArrayInt *part(NULL); + DataArrayIdType *part(NULL); bool b(mread->getCoords()->areIncludedInMe(m->getCoords(),_EPS_FOR_NODE_COMP,part)); - MCAuto partSafe(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 !"; @@ -1738,7 +1740,7 @@ void WriteFieldUsingAlreadyWrittenMeshT(const std::string& fileName, const typen MEDCouplingUMesh *m(dynamic_cast(const_cast(f->getMesh()))); if(m) { - MCAuto o2n(m->getRenumArrForMEDFileFrmt()); + MCAuto o2n(m->getRenumArrForMEDFileFrmt()); MCAuto< typename MEDCoupling::Traits::FieldType > f2(f->deepCopy()); f2->renumberCells(o2n->begin(),false); f1ts->setFieldNoProfileSBT(f2); diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index e4471e2d2..6dfadb3f6 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -26,6 +26,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "NormalizedUnstructuredMesh.hxx" #include "MCAuto.hxx" +#include "MCIdType.hxx" #include #include @@ -48,7 +49,7 @@ namespace MEDCoupling MEDLOADER_EXPORT void MEDFileVersion(int& major, int& minor, int& release); MEDLOADER_EXPORT void CheckFileForRead(const std::string& fileName); MEDLOADER_EXPORT std::vector GetMeshNames(const std::string& fileName); - MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, mcIdType& numberOfNodes); MEDLOADER_EXPORT std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); MEDLOADER_EXPORT std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); MEDLOADER_EXPORT std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); diff --git a/src/MEDLoader/MEDLoaderBase.cxx b/src/MEDLoader/MEDLoaderBase.cxx index b2f8fd78a..7fdbbae76 100644 --- a/src/MEDLoader/MEDLoaderBase.cxx +++ b/src/MEDLoader/MEDLoaderBase.cxx @@ -45,7 +45,7 @@ int MEDLoaderBase::getStatusOfFile(const std::string& fileName) return EXIST_RW; } -char *MEDLoaderBase::buildEmptyString(int lgth) +char *MEDLoaderBase::buildEmptyString(std::size_t lgth) { char *ret=new char[lgth+1]; std::fill(ret,ret+lgth,' '); @@ -177,7 +177,7 @@ void MEDLoaderBase::safeStrCpy2(const char *src, int maxLgth, char *dest, int be return ; } } - int n(strlen(src)); + std::size_t n(strlen(src)); std::fill(dest,dest+maxLgth,' '); strncpy(dest,src,n); } diff --git a/src/MEDLoader/MEDLoaderBase.hxx b/src/MEDLoader/MEDLoaderBase.hxx index 0b6ea093f..bc11fe228 100644 --- a/src/MEDLoader/MEDLoaderBase.hxx +++ b/src/MEDLoader/MEDLoaderBase.hxx @@ -30,7 +30,7 @@ class MEDLOADER_EXPORT MEDLoaderBase { public: static int getStatusOfFile(const std::string& fileName); - static char *buildEmptyString(int lgth); + static char *buildEmptyString(std::size_t lgth); static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName); static std::string getPathSep(); static std::string joinPath(const std::string& dirName, const std::string& baseName); diff --git a/src/MEDLoader/MEDLoaderNS.hxx b/src/MEDLoader/MEDLoaderNS.hxx index 4726172f8..b637292b6 100644 --- a/src/MEDLoader/MEDLoaderNS.hxx +++ b/src/MEDLoader/MEDLoaderNS.hxx @@ -34,10 +34,10 @@ namespace MEDCoupling namespace MEDLoaderNS { int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector& possibilities); - void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity); + void dispatchElems(med_int nbOfElemCell, med_int nbOfElemFace, med_int& nbOfElem, med_entity_type& whichEntity); template void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const typename MEDCoupling::Traits::FieldType *f, bool writeFromScratch); - med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName); + int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName); std::vector getMeshNamesFid(med_idt fid); } diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 75fe2242a..ad9e35118 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -262,7 +262,7 @@ namespace // define default GAUSS points TInt GetNbRef() const { return myNbRef; } - TCoordSlice GetCoord(TInt theRefId) { return &myRefCoord[0] + theRefId * myDim; } + TCoordSlice GetCoord(std::size_t theRefId) { return &myRefCoord[0] + theRefId * myDim; } }; //--------------------------------------------------------------- /*! @@ -291,7 +291,7 @@ namespace // define default GAUSS points TGaussDef(const int geomType, const int nbPoints, const int variant=1); int dim() const { return SauvUtilities::getDimension( NormalizedCellType( myType )); } - int nbPoints() const { return myWeights.capacity(); } + std::size_t nbPoints() const { return myWeights.capacity(); } private: void add(const double x, const double weight); @@ -669,8 +669,8 @@ namespace // define default GAUSS points THexa20a::THexa20a(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; @@ -701,8 +701,8 @@ namespace // define default GAUSS points THexa27a::THexa27a(): THexa20a(3,27) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 20: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break; @@ -738,8 +738,8 @@ namespace // define default GAUSS points THexa20b::THexa20b(TInt theDim, TInt theNbRef): TShapeFun(theDim,theNbRef) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; @@ -770,8 +770,8 @@ namespace // define default GAUSS points TPenta6a::TPenta6a(): TShapeFun(3,6) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -787,8 +787,8 @@ namespace // define default GAUSS points TPenta6b::TPenta6b(): TShapeFun(3,6) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -804,8 +804,8 @@ namespace // define default GAUSS points TPenta15a::TPenta15a(): TShapeFun(3,15) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -831,8 +831,8 @@ namespace // define default GAUSS points TPenta15b::TPenta15b(): TShapeFun(3,15) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; @@ -858,8 +858,8 @@ namespace // define default GAUSS points TPyra5a::TPyra5a(): TShapeFun(3,5) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -874,8 +874,8 @@ namespace // define default GAUSS points TPyra5b::TPyra5b(): TShapeFun(3,5) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -890,8 +890,8 @@ namespace // define default GAUSS points TPyra13a::TPyra13a(): TShapeFun(3,13) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -915,8 +915,8 @@ namespace // define default GAUSS points TPyra13b::TPyra13b(): TShapeFun(3,13) { - TInt aNbRef = myRefCoord.size(); - for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + std::size_t aNbRef = myRefCoord.size(); + for(std::size_t aRefId = 0; aRefId < aNbRef; aRefId++){ TCoordSlice aCoord = GetCoord(aRefId); switch(aRefId){ case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; @@ -1497,7 +1497,7 @@ Cell::Cell(const Cell& ma) { if ( ma._sortedNodeIDs ) { - _sortedNodeIDs = new int[ _nodes.size() ]; + _sortedNodeIDs = new TID[ _nodes.size() ]; std::copy( ma._sortedNodeIDs, ma._sortedNodeIDs + _nodes.size(), _sortedNodeIDs ); } } @@ -1510,7 +1510,7 @@ Cell::Cell(const Cell& ma) SauvUtilities::Link Cell::link(int i) const { - int 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 @@ -1528,7 +1528,7 @@ const TID* Cell::getSortedNodes() const if ( !_sortedNodeIDs ) { size_t l=_nodes.size(); - _sortedNodeIDs = new int[ l ]; + _sortedNodeIDs = new TID[ l ]; for (size_t i=0; i!=l; ++i) _sortedNodeIDs[i]=_nodes[i]->_number; @@ -1548,9 +1548,9 @@ bool Cell::operator< (const Cell& ma) const if ( _nodes.size() == 1 ) return _nodes[0] < ma._nodes[0]; - const int* v1 = getSortedNodes(); - const int* v2 = ma.getSortedNodes(); - for ( const int* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 ) + const TID* v1 = getSortedNodes(); + const TID* v2 = ma.getSortedNodes(); + for ( const TID* vEnd = v1 + _nodes.size(); v1 < vEnd; ++v1, ++v2 ) if(*v1 != *v2) return *v1 < *v2; return false; @@ -1588,9 +1588,9 @@ std::ostream& SauvUtilities::operator<< (std::ostream& os, const SauvUtilities:: */ //================================================================================ -int Group::size() const +mcIdType Group::size() const { - int sizze = 0; + std::size_t sizze = 0; if ( !_relocTable.empty() ) sizze = _relocTable.size(); else if ( _medGroup ) @@ -1600,7 +1600,7 @@ int Group::size() const else for ( size_t i = 0; i < _groups.size(); ++i ) sizze += _groups[i]->size(); - return sizze; + return ToIdType( sizze ); } //================================================================================ @@ -1739,13 +1739,13 @@ bool ASCIIReader::getLine(char* & line) bool aResult = true; // Check the state of the buffer; // if there is too little left, read the next portion of data - int nBytesRest = _eptr - _ptr; + std::size_t nBytesRest = _eptr - _ptr; if (nBytesRest < GIBI_MaxOutputLen) { if (nBytesRest > 0) { // move the remaining portion to the buffer beginning - for ( int i = 0; i < nBytesRest; ++i ) + for ( std::size_t i = 0; i < nBytesRest; ++i ) _start[i] = _ptr[i]; //memcpy (_tmpBuf, _ptr, nBytesRest); //memcpy (_start, _tmpBuf, nBytesRest); @@ -1755,9 +1755,9 @@ bool ASCIIReader::getLine(char* & line) nBytesRest = 0; } _ptr = _start; - const int nBytesRead = ::read (_file, - &_start [nBytesRest], - GIBI_BufferSize - nBytesRest); + const std::size_t nBytesRead = ::read (_file, + &_start [nBytesRest], + GIBI_BufferSize - nBytesRest); nBytesRest += nBytesRead; _eptr = &_start [nBytesRest]; } @@ -1942,7 +1942,7 @@ int ASCIIReader::getInt() const float ASCIIReader::getFloat() const { - return getDouble(); + return (float)getDouble(); } //================================================================================ @@ -2327,7 +2327,7 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo // correct pointers to sub-groups for ( size_t j = 0; j < _groups[i]._groups.size(); ++j ) { - int iG = _groups[i]._groups[j] - &_groups[0]; + std::size_t iG = _groups[i]._groups[j] - &_groups[0]; newGroups[i]._groups[j] = & newGroups[ iG ]; } } @@ -2337,7 +2337,7 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo for ( size_t i = 0; i < groupsToFix->size(); ++i ) if ( (*groupsToFix)[i] ) { - int iG = (*groupsToFix)[i] - &_groups[0]; + std::size_t iG = (*groupsToFix)[i] - &_groups[0]; (*groupsToFix)[i] = & newGroups[ iG ]; } @@ -2351,12 +2351,12 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo for ( size_t j = 0; j < fields[i]->_sub.size(); ++j ) if ( fields[i]->_sub[j]._support ) { - int iG = fields[i]->_sub[j]._support - &_groups[0]; + std::size_t iG = fields[i]->_sub[j]._support - &_groups[0]; fields[i]->_sub[j]._support = & newGroups[ iG ]; } if ( fields[i]->_group ) { - int iG = fields[i]->_group - &_groups[0]; + std::size_t iG = fields[i]->_group - &_groups[0]; fields[i]->_group = & newGroups[ iG ]; } } @@ -2557,8 +2557,8 @@ void IntermediateMED::setFieldLongNames(std::set< std::string >& usedNames) if (medName.find( fields[ifi]->_name + "." ) == 0 ) { std::vector& aSubDs = fields[ifi]->_sub; - int nbSub = aSubDs.size(); - for (int isu = 0; isu < nbSub; isu++) + 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) @@ -2837,7 +2837,7 @@ void IntermediateMED::orientFaces3D() for ( size_t j = 0; j < grp._cells.size(); ++j ) if ( faces.insert( grp._cells[j] ).second ) { - for ( size_t k = 0; k < grp._cells[j]->_nodes.size(); ++k ) + for ( unsigned int k = 0; k < grp._cells[j]->_nodes.size(); ++k ) linkFacesMap[ grp._cells[j]->link( k ) ].push_back( grp._cells[j] ); fgm.insert( std::make_pair( grp._cells[j], &grp )); } @@ -3089,7 +3089,7 @@ void IntermediateMED::numberElements() // check if re-numeration is needed (to try to keep elem oreder as in sauve file ) bool ok = true, renumEntity = false; CellsByDimIterator cellsIt( *this, dim ); - int prevNbElems = 0; + mcIdType prevNbElems = 0; while ( const std::set * typeCells = cellsIt.nextType() ) { TID minNumber = std::numeric_limits::max(), maxNumber = 0; @@ -3098,7 +3098,7 @@ void IntermediateMED::numberElements() if ( elemIt->_number < minNumber ) minNumber = elemIt->_number; if ( elemIt->_number > maxNumber ) maxNumber = elemIt->_number; } - TID typeSize = typeCells->size(); + mcIdType typeSize = ToIdType( typeCells->size() ); if ( typeSize != maxNumber - minNumber + 1 ) ok = false; if ( prevNbElems+1 != (int)minNumber ) @@ -3112,12 +3112,12 @@ void IntermediateMED::numberElements() if ( ok && renumEntity ) // each geom type was numerated separately { cellsIt.init( dim ); - prevNbElems = cellsIt.nextType()->size(); // no need to renumber the first type + prevNbElems = ToIdType( cellsIt.nextType()->size()); // no need to renumber the first type while ( const std::set * typeCells = cellsIt.nextType() ) { for ( elemIt = typeCells->begin(), elemEnd = typeCells->end(); elemIt!=elemEnd; ++elemIt) elemIt->_number += prevNbElems; - prevNbElems += typeCells->size(); + prevNbElems += ToIdType( typeCells->size() ); } } if ( !ok ) @@ -3142,7 +3142,7 @@ MEDCoupling::DataArrayDouble * IntermediateMED::getCoords() DataArrayDouble* coordArray = DataArrayDouble::New(); coordArray->alloc( _nbNodes, _spaceDim ); double * coordPrt = coordArray->getPointer(); - for ( int i = 0, nb = _points.size(); i < nb; ++i ) + for ( unsigned int i = 0; i < _points.size(); ++i ) { Node* n = getNode( i+1 ); if ( n->isUsed() ) @@ -3175,9 +3175,9 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, { CellsByDimIterator dimCells( *this, dim ); - int nbOfCells = 0; + mcIdType nbOfCells = 0; while ( const std::set * cells = dimCells.nextType() ) - nbOfCells += cells->size(); + nbOfCells += ToIdType( cells->size() ); if ( nbOfCells == 0 ) continue; @@ -3188,27 +3188,27 @@ void IntermediateMED::setConnectivity( MEDCoupling::MEDFileUMesh* mesh, dimMesh->setMeshDimension( dim ); dimMesh->allocateCells( nbOfCells ); - int prevNbCells = 0; + mcIdType prevNbCells = 0; dimCells.init( dim ); while ( const std::set * cells = dimCells.nextType() ) { // fill connectivity array to take into account order of elements in the sauv file - const int nbCellNodes = cells->begin()->_nodes.size(); + const mcIdType nbCellNodes = ToIdType( cells->begin()->_nodes.size() ); std::vector< TID > connectivity( cells->size() * nbCellNodes ); - int * nodalConnOfCell; + TID * nodalConnOfCell; for ( elemIt = cells->begin(), elemEnd = cells->end(); elemIt != elemEnd; ++elemIt ) { const Cell& cell = *elemIt; - const int index = cell._number - 1 - prevNbCells; + const TID index = cell._number - 1 - prevNbCells; nodalConnOfCell = &connectivity[ index * nbCellNodes ]; if ( cell._reverse ) - for ( int i = nbCellNodes-1; i >= 0; --i ) + for ( mcIdType i = nbCellNodes-1; i >= 0; --i ) *nodalConnOfCell++ = cell._nodes[i]->_number - 1; else - for ( int i = 0; i < nbCellNodes; ++i ) + for ( mcIdType i = 0; i < nbCellNodes; ++i ) *nodalConnOfCell++ = cell._nodes[i]->_number - 1; } - prevNbCells += cells->size(); + prevNbCells += ToIdType( cells->size() ); // fill dimMesh TCellType cellType = dimCells.type(); @@ -3237,8 +3237,8 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) { const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim ); - std::vector medGroups; - std::vector > refGroups; + std::vector medGroups; + std::vector > refGroups; for ( size_t i = 0; i < _groups.size(); ++i ) { Group& grp = _groups[i]; @@ -3284,10 +3284,10 @@ void IntermediateMED::setGroups( MEDCoupling::MEDFileUMesh* mesh ) } } // create a med group - grp._medGroup = DataArrayInt::New(); + grp._medGroup = DataArrayIdType::New(); grp._medGroup->setName( grp._name.c_str() ); grp._medGroup->alloc( cell2order.size(), /*nbOfCompo=*/1 ); - int * idsPtr = grp._medGroup->getPointer(); + TID * idsPtr = grp._medGroup->getPointer(); TCellToOrderMap::iterator cell2orderIt, cell2orderEnd = cell2order.end(); for ( cell2orderIt = cell2order.begin(); cell2orderIt != cell2orderEnd; ++cell2orderIt ) *idsPtr++ = (*cell2orderIt).first->_number - 1; @@ -3336,7 +3336,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const { int dim = getDim( grp ); - int nbElems = 0; + mcIdType nbElems = 0; if ( dim == 0 ) { nbElems = _nbNodes; @@ -3346,7 +3346,7 @@ bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const { CellsByDimIterator dimCells( *this, dim ); while ( const std::set * cells = dimCells.nextType() ) - nbElems += cells->size(); + nbElems += ToIdType( cells->size() ); int meshDim = 3; for ( ; meshDim > 0; --meshDim ) @@ -3378,10 +3378,10 @@ MEDCoupling::MEDFileFields * IntermediateMED::makeMEDFileFields(MEDCoupling::MED MEDFileFields* fields = MEDFileFields::New(); - for ( size_t i = 0; i < _nodeFields.size(); ++i ) + for ( unsigned int i = 0; i < _nodeFields.size(); ++i ) setFields( _nodeFields[i], fields, mesh, i+1, usedFieldNames ); - for ( size_t i = 0; i < _cellFields.size(); ++i ) + for ( unsigned int i = 0; i < _cellFields.size(); ++i ) setFields( _cellFields[i], fields, mesh, i+1, usedFieldNames ); return fields; @@ -3415,7 +3415,7 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld, std::cout << "Castem field #" << castemID << " <" << fld->_name << "> is incompatible with MED format, so we split it into several fields:" << std::endl; - for ( size_t iSub = 0; iSub < fld->_sub.size(); ) + for ( unsigned int iSub = 0; iSub < fld->_sub.size(); ) { // set field name if ( !uniteSubs || fld->_name.empty() ) @@ -3429,8 +3429,8 @@ void IntermediateMED::setFields( SauvUtilities::DoubleField* fld, double * valPtr = values->getPointer(); if ( uniteSubs ) { - int nbElems = fld->_group->size(); - for ( int elemShift = 0; elemShift < nbElems && iSub < fld->_sub.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 ); } @@ -3660,7 +3660,7 @@ bool DoubleField::isMultiTimeStamps() const bool DoubleField::isMedCompatible(bool& sameNbGauss) const { - for ( size_t iSub = 0; iSub < _sub.size(); ++iSub ) + for ( unsigned int iSub = 0; iSub < _sub.size(); ++iSub ) { if ( !getSupport(iSub) || !getSupport(iSub)->_medGroup ) THROW_IK_EXCEPTION("SauvReader INTERNAL ERROR: NULL field support"); @@ -3741,9 +3741,9 @@ MEDCoupling::TypeOfTimeDiscretization DoubleField::getMedTimeDisc() const */ //================================================================================ -int DoubleField::getNbTuples( const int iSub ) const +mcIdType DoubleField::getNbTuples( const int iSub ) const { - int nb = 0; + mcIdType nb = 0; if ( hasCommonSupport() && !_group->_groups.empty() ) for ( size_t i = 0; i < _group->_groups.size(); ++i ) nb += _sub[i].nbGauss() * _sub[i]._support->size(); @@ -3758,7 +3758,7 @@ int DoubleField::getNbTuples( const int iSub ) const */ //================================================================================ -int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift ) const +mcIdType DoubleField::setValues( double * valPtr, const int iSub, const mcIdType elemShift ) const { // find values for iSub int iComp = 0; @@ -3768,41 +3768,41 @@ int DoubleField::setValues( double * valPtr, const int iSub, const int elemShift // Set values - const std::vector< unsigned >& relocTable = getSupport( iSub )->_relocTable; + const std::vector< mcIdType >& relocTable = getSupport( iSub )->_relocTable; - const int nbElems = _sub[iSub]._support->size(); + const mcIdType nbElems = _sub[iSub]._support->size(); const int nbGauss = _sub[iSub].nbGauss(); const int nbComponents = _sub[iSub].nbComponents(); const int nbValsByElem = nbComponents * nbGauss; // check nb values - int nbVals = 0; + mcIdType nbVals = 0; for ( iComp = 0; iComp < nbComponents; ++iComp ) - nbVals += compValues[iComp].size(); + nbVals += ToIdType( compValues[iComp].size() ); const bool isConstField = ( nbVals == nbComponents ); // one value per component (issue 22321) if ( !isConstField && nbVals != nbElems * nbValsByElem ) THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size"); // compute nb values in previous subs - int valsShift = 0; - for ( int iS = iSub-1, shift = elemShift; shift > 0; --iS) + mcIdType valsShift = 0; + for ( mcIdType iS = iSub-1, shift = elemShift; shift > 0; --iS) { - int nbE = _sub[iS]._support->size(); + mcIdType nbE = _sub[iS]._support->size(); shift -= nbE; valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss(); } if ( isConstField ) - for ( int iE = 0; iE < nbElems; ++iE ) + for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - int 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 ( int iE = 0; iE < nbElems; ++iE ) + for ( mcIdType iE = 0; iE < nbElems; ++iE ) { - int 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 ]; diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index 3505e486c..9fc216225 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -51,7 +51,7 @@ namespace SauvUtilities struct IntermediateMED; // ============================================================================== - typedef int TID; // an ID countered from 1 + typedef mcIdType TID; // an ID countered from 1 typedef std::pair Link; // a pair of node numbers typedef INTERP_KERNEL::NormalizedCellType TCellType; @@ -103,11 +103,11 @@ namespace SauvUtilities reference is converted into a copy of the medGroup (issue 0021311) */ - MEDCoupling::DataArrayInt* _medGroup; // result of conversion - std::vector< unsigned > _relocTable; // for _cells[i] gives its index in _medGroup + 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(); } - int size() const; + mcIdType size() const; Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {} }; @@ -126,7 +126,7 @@ namespace SauvUtilities void setData( int nb_comp, Group* supp ) { _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); } - int nbComponents() const { return _comp_names.size(); } + int nbComponents() const { return (int)_comp_names.size(); } std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; } bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) == *std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); } @@ -158,11 +158,11 @@ namespace SauvUtilities bool isMedCompatible(bool& sameNbGauss) const; MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const; MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const; - int getNbTuples( const int iSub=0 ) const; + mcIdType getNbTuples( const int iSub=0 ) const; int getNbValuesPerElement( const int iSub=0 ) const; int getNbGauss( const int iSub=0 ) const; const Group* getSupport( const int iSub=0 ) const; - int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const; + mcIdType setValues( double * valPtr, const int iSub, const mcIdType elemShift=0 ) const; void splitSubWithDiffNbGauss(); //virtual void dump(std::ostream&) const; @@ -253,7 +253,7 @@ namespace SauvUtilities ~IntermediateMED(); Node* getNode( TID nID ) { return _points.getNode( nID ); } - int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); } + 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=0); MEDCoupling::MEDFileData* convertInMEDFileDS(); diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 30a62fecb..931d35255 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -735,10 +735,10 @@ void SauvReader::setFieldSupport(const vector& supports, while ( isSwapped ) { isSwapped = false; - for ( size_t i = 1; i < groups.size(); ++i ) + for ( std::size_t i = 1; i < groups.size(); ++i ) { - int nbN1 = groups[i-1]->empty() ? 0 : groups[i-1]->_cells[0]->_nodes.size(); - int 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; @@ -1204,7 +1204,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, const int fixedLength = 71; while ((int)aWholeString.length() < stringLen) { - int remainLen = stringLen - aWholeString.length(); + int remainLen = (int)(stringLen - aWholeString.length()); int len; if ( remainLen > fixedLength ) { @@ -1226,7 +1226,7 @@ void SauvReader::read_PILE_STRINGS (const int nbObjects, while ((int)aWholeString.length() < stringLen) { getNextLine( line ); - int remainLen = stringLen - aWholeString.length(); + int remainLen = (int)(stringLen - aWholeString.length()); if ( remainLen > fixedLength ) { aWholeString += line + 1; diff --git a/src/MEDLoader/SauvWriter.cxx b/src/MEDLoader/SauvWriter.cxx index 55ed3c393..fbdbe0bff 100644 --- a/src/MEDLoader/SauvWriter.cxx +++ b/src/MEDLoader/SauvWriter.cxx @@ -130,9 +130,9 @@ namespace if (!healedName.empty()) { string name = healedName; - int len = name.length(); - for (int i = 0; i < len; ++i) - name[i] = toupper(name[i]); + std::size_t len = name.length(); + for (std::size_t i = 0; i < len; ++i) + name[i] = (char)toupper(name[i]); bool doResave = false; // only for tracing @@ -316,7 +316,7 @@ int SauvWriter::SubMesh::nbTypes() const void SauvWriter::fillSubMeshes( int& nbSauvObjects, map& nameNbMap ) { // evaluate nb of _subs in order to avoid re-allocation of _subs - int nbSubs = 1; // for the very mesh + std::size_t nbSubs = 1; // for the very mesh nbSubs += _fileMesh->getFamilyInfo().size() + 4; // + 4 zero families (for each dimRelExt) nbSubs += _fileMesh->getGroupInfo().size(); nbSubs += evaluateNbProfileSubMeshes(); @@ -375,21 +375,21 @@ void SauvWriter::fillFamilySubMeshes() { int dimRelExt = dims[ iDim ]; MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(dimRelExt); - const DataArrayInt * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); + const DataArrayIdType * famIds = _fileMesh->getFamilyFieldAtLevel(dimRelExt); if ( !famIds ) continue; - int curFamID = 0; + mcIdType curFamID = 0; SubMesh* curSubMesh = addSubMesh( "", dimRelExt ); // submesh of zero family _famIDs2Sub[0] = curSubMesh; - int sub0Index = _subs.size()-1; + std::size_t sub0Index = _subs.size()-1; - const int * famID = famIds->begin(), * famIDEnd = famIds->end(); - for ( int cellID = 0; famID < famIDEnd; ++famID, cellID++ ) + const mcIdType * famID = famIds->begin(), * famIDEnd = famIds->end(); + for ( mcIdType cellID = 0; famID < famIDEnd; ++famID, cellID++ ) { if ( *famID != curFamID ) { curFamID = *famID; - map< int, SubMesh* >::iterator 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; @@ -407,7 +407,7 @@ void SauvWriter::fillFamilySubMeshes() else if ( dimRelExt == 0 ) { // make a submesh including all cells - if ( sub0Index == (int)(_subs.size()-1) ) + if ( sub0Index == _subs.size()-1 ) { _famIDs2Sub[0]->_name = _fileMesh->getName(); // there is the zero family only } @@ -416,7 +416,7 @@ void SauvWriter::fillFamilySubMeshes() curSubMesh = addSubMesh( _fileMesh->getName(), dimRelExt ); if ( _famIDs2Sub[0]->nbTypes() == 0 ) sub0Index++; // skip an empty zero family - for ( size_t i = sub0Index; i < _subs.size()-1; ++i ) + for ( std::size_t i = sub0Index; i < _subs.size()-1; ++i ) curSubMesh->_subs.push_back( & _subs[i] ); } } @@ -442,8 +442,8 @@ void SauvWriter::fillGroupSubMeshes() std::size_t k = 0; for ( size_t i = 0; i < famNames.size(); ++i ) { - int famID = _fileMesh->getFamilyId( famNames[i].c_str() ); - map< int, SubMesh* >::iterator 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; @@ -519,7 +519,7 @@ void SauvWriter::fillProfileSubMeshes() if ( !pfl2sm->second ) { SubMesh* sm = pfl2sm->second = addSubMesh( "", dimRelExt ); // no names for profiles - const DataArrayInt * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); + const DataArrayIdType * pfl = isOnAll ? 0 : fields[i]->getProfile( pfls[iType][iPfl].c_str() ); makeProfileIDs( sm, types[iType], pfl ); } } @@ -536,11 +536,11 @@ void SauvWriter::fillProfileSubMeshes() int SauvWriter::evaluateNbProfileSubMeshes() const { - int nb = 0; - for ( size_t i = 0; i < _nodeFields.size(); ++i ) + std::size_t nb = 0; + for ( std::size_t i = 0; i < _nodeFields.size(); ++i ) nb += 1 + _nodeFields[i]->getPflsReallyUsed().size(); - for ( size_t i = 0; i < _cellFields.size(); ++i ) + for ( std::size_t i = 0; i < _cellFields.size(); ++i ) { nb += _cellFields[i]->getPflsReallyUsed().size(); @@ -554,7 +554,7 @@ int SauvWriter::evaluateNbProfileSubMeshes() const nb += 2 * types.size(); // x 2 - a type can be on nodes and on cells at the same time } - return nb; + return (int)nb; } //================================================================================ @@ -565,14 +565,14 @@ int SauvWriter::evaluateNbProfileSubMeshes() const void SauvWriter::makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, - const DataArrayInt* profile ) + const DataArrayIdType* profile ) { MCAuto< MEDCouplingMesh > mesh = _fileMesh->getMeshAtLevel(sm->_dimRelExt); const MEDCouplingUMesh* uMesh = dynamic_cast< const MEDCouplingUMesh* > ((const MEDCouplingMesh*) mesh ); if ( sm->_dimRelExt == 1 ) type = INTERP_KERNEL::NORM_POINT1; - vector< int >& ids = sm->_cellIDsByType[ type ]; + vector< mcIdType >& ids = sm->_cellIDsByType[ type ]; if ( sm->_dimRelExt == 1 || !uMesh ) { @@ -585,13 +585,13 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, { ids.resize( sm->_dimRelExt == 1 ? mesh->getNumberOfNodes() : mesh->getNumberOfCells() ); for ( size_t i = 0; i < ids.size(); ++i ) - ids[i]=i; + ids[i] = ToIdType( i ); } } else { // profile on cells - vector code(3); + vector code(3); code[0] = type; if ( profile ) // on profile { @@ -603,16 +603,16 @@ void SauvWriter::makeProfileIDs( SubMesh* sm, code[1] = mesh->getNumberOfCellsWithType( type ); code[2] = -1; } - vector idsPerType( 1, profile ); - MCAuto + vector idsPerType( 1, profile ); + MCAuto resIDs = uMesh->checkTypeConsistencyAndContig( code, idsPerType ); - if (( const DataArrayInt *) resIDs ) + if (( const DataArrayIdType *) resIDs ) { ids.assign( resIDs->begin(), resIDs->end() ); } else // mesh includes only one type { - int nbE = code[1]; + mcIdType nbE = code[1]; for ( ids.resize( nbE ); nbE; --nbE ) ids[ nbE-1 ] = nbE-1; } @@ -727,7 +727,7 @@ void SauvWriter::writeSubMeshes() TFieldCounter fcount( *_sauvFile, 10 ); // 10 integers per line - for ( size_t iSub = 0; iSub < _subs.size(); ++iSub ) + for ( unsigned int iSub = 0; iSub < _subs.size(); ++iSub ) { SubMesh& sm = _subs[iSub]; if ( sm._nbSauvObjects < 1 ) continue; @@ -753,7 +753,7 @@ void SauvWriter::writeSubMeshes() for ( int iType=0; iType < sm.cellIDsByTypeSize(); ++iType ) { - const vector& cellIDs = sm._cellIDsByType[iType]; + const vector& cellIDs = sm._cellIDsByType[iType]; if ( cellIDs.empty() ) continue; INTERP_KERNEL::NormalizedCellType @@ -762,7 +762,7 @@ void SauvWriter::writeSubMeshes() cell = INTERP_KERNEL::CellModel::GetCellModel( cellType ); int castemType = SauvUtilities::med2gibiGeom( cellType ); unsigned nbElemNodes = cell.getNumberOfNodes(); - unsigned nbElems = cellIDs.size(); + std::size_t nbElems = cellIDs.size(); *_sauvFile << setw(8) << castemType << zeroI8 @@ -772,14 +772,14 @@ void SauvWriter::writeSubMeshes() // write color of each element // * 8000 FORMAT(10I8) - for ( size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8; + for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << zeroI8; fcount.stop(); // write connectivity // gibi IDs are in FORTRAN mode while MEDCoupling IDs are in C mode if ( sm._dimRelExt == 1 ) // nodes { - for ( size_t i = 0; i < nbElems; ++i, fcount++ ) + for ( std::size_t i = 0; i < nbElems; ++i, fcount++ ) *_sauvFile << setw(8) << ( cellIDs[i] + 1 ); } else @@ -787,8 +787,8 @@ void SauvWriter::writeSubMeshes() // indices to transform MED connectivity to GIBI one const int * toMedConn = getGibi2MedQuadraticInterlace( cellType ); - vector< int > cellConn( nbElemNodes ), transformedConn( nbElemNodes ); - for ( size_t i = 0; i < nbElems; ++i ) + vector< mcIdType > cellConn( nbElemNodes ), transformedConn( nbElemNodes ); + for ( std::size_t i = 0; i < nbElems; ++i ) { cellConn.clear(); umesh->getNodeIdsOfCell( cellIDs[i], cellConn ); @@ -850,13 +850,13 @@ void SauvWriter::writeNodes() // write the index connecting nodes with their coordinates - const int nbNodes = umesh->getNumberOfNodes(); + const mcIdType nbNodes = umesh->getNumberOfNodes(); *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl << " PILE NUMERO 32NBRE OBJETS NOMMES 0NBRE OBJETS" << setw(8) << nbNodes << endl; *_sauvFile << setw(8) << nbNodes << endl; // TFieldCounter fcount( *_sauvFile, 10 );// * 8000 FORMAT(10I8) - for ( int i = 0; i < nbNodes; ++i, fcount++ ) + for ( mcIdType i = 0; i < nbNodes; ++i, fcount++ ) *_sauvFile << setw(8) << i + 1; fcount.stop(); @@ -865,8 +865,8 @@ void SauvWriter::writeNodes() *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl; *_sauvFile << " PILE NUMERO 33NBRE OBJETS NOMMES 0NBRE OBJETS 1" << endl; // - const int dim = umesh->getSpaceDimension(); - const int nbValues = nbNodes * ( dim + 1 ); + const int dim = umesh->getSpaceDimension(); + const mcIdType nbValues = nbNodes * ( dim + 1 ); *_sauvFile << setw(8) << nbValues << endl; // * 8003 FORMAT(1P,3E22.14) @@ -923,7 +923,7 @@ void SauvWriter::writeLongNames() *_sauvFile << endl; string theWholeString; // concatenated long names - vector theOffsets; + vector theOffsets; int iStr = 1; TFieldCounter fcount (*_sauvFile, 10); @@ -976,7 +976,7 @@ void SauvWriter::writeLongNames() // Write the STRING pile // ---------------------- - const int nbNames = theOffsets.size(); + const std::size_t nbNames = theOffsets.size(); *_sauvFile << " ENREGISTREMENT DE TYPE 2" << endl << " PILE NUMERO 27NBRE OBJETS NOMMES" << zeroI8 << "NBRE OBJETS" << setw(8) << nbNames << endl << setw(8) << theWholeString.length() << setw(8) << nbNames << endl; @@ -987,7 +987,7 @@ void SauvWriter::writeLongNames() *_sauvFile << setw(72) << theWholeString.substr(aPos, fixedLength) << endl; // write the offsets - for ( size_t i = 0; i < theOffsets.size(); ++i, fcount++ ) + for ( std::size_t i = 0; i < theOffsets.size(); ++i, fcount++ ) *_sauvFile << setw(8) << theOffsets[i]; } @@ -1004,7 +1004,7 @@ void SauvWriter::writeFieldNames( const bool isNodal, flds = isNodal ? _nodeFields : _cellFields; map nameNbMap; - for ( size_t iF = 0; iF < flds.size(); ++iF ) + for ( unsigned int iF = 0; iF < flds.size(); ++iF ) { string name = addName( nameNbMap, fldNamePrefixMap, flds[iF]->getName(), iF+1 ); nameGIBItoMED aMEDName; @@ -1089,9 +1089,9 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) // (1) write nb subcomponents, nb components(total) vector< pair > iters = _nodeFields[iF]->getIterations(); const vector& compInfo = _nodeFields[iF]->getInfo(); - const int nbSub = iters.size(); - const int nbComp = compInfo.size(); - const int totalNbComp = nbSub * nbComp; + const std::size_t nbSub = iters.size(); + const std::size_t nbComp = compInfo.size(); + const std::size_t totalNbComp = nbSub * nbComp; *_sauvFile << setw(8) << nbSub << setw(8) << totalNbComp << setw(8) << -1 // IFOUR @@ -1100,7 +1100,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) // (2) for each sub-component (iteration) // write support, number of values and number of components fcount.init(10); - vector< int > vals(3); + vector< mcIdType > vals(3); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { pair it = iters[iIt]; @@ -1108,7 +1108,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; 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, @@ -1120,7 +1120,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) << pfls[0][0] << "|"); vals[0] = -pfl2Sub->second->_id; vals[1] = (valsVec[0][0].second-valsVec[0][0].first); - vals[2] = compInfo.size(); + vals[2] = ToIdType( compInfo.size() ); for ( size_t i = 0; i < vals.size(); ++i, fcount++ ) *_sauvFile << setw(8) << vals[i]; } @@ -1132,7 +1132,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) fcount.init(8); *_sauvFile << left; for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) - for ( size_t i = 0; i < compInfo.size(); ++i, fcount++ ) + for ( std::size_t i = 0; i < compInfo.size(); ++i, fcount++ ) *_sauvFile << " " << setw(4) << mapMedToGibi[compInfo[i]]; *_sauvFile << right; fcount.stop(); @@ -1157,7 +1157,7 @@ void SauvWriter::writeNodalFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; 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, @@ -1206,10 +1206,10 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) // (10) 1.00000000000000E+02 1.00000000000000E+02 1.00000000000000E+02 // (10) ... - for ( size_t iF = 0; iF < _cellFields.size(); ++iF ) + for ( unsigned int iF = 0; iF < _cellFields.size(); ++iF ) { // count nb of sub-components - int iSub, nbSub = 0; + std::size_t iSub, nbSub = 0; vector< pair > iters = _cellFields[iF]->getIterations(); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { @@ -1218,7 +1218,7 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec = _cellFields[iF]->getFieldSplitedByType( it.first, it.second, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t i = 0; i < valsVec.size(); ++i ) @@ -1235,9 +1235,9 @@ void SauvWriter::writeElemFields(map& fldNamePrefixMap) *_sauvFile << setw(72) << " " << endl; // (3) support, nb components - vector vals(9, 0); + vector vals(9, 0); const vector& compInfo = _cellFields[iF]->getInfo(); - vals[2] = compInfo.size(); + vals[2] = ToIdType( compInfo.size() ); fcount.init(10); for ( std::size_t iIt = 0; iIt < iters.size(); ++iIt ) { @@ -1311,7 +1311,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) vector types; vector< vector > typesF; vector< vector > pfls, locs; - vector< vector< std::pair > > valsVec; + vector< vector< std::pair > > valsVec; valsVec = _cellFields[iF]->getFieldSplitedByType( iter, order, _fileMesh->getName().c_str(), types, typesF, pfls, locs); for ( size_t iType = 0; iType < pfls.size(); ++iType ) @@ -1320,7 +1320,7 @@ void SauvWriter::writeElemTimeStamp(int iF, int iter, int order) const vector& compInfo = _cellFields[iF]->getInfo(); // (6) component addresses - int iComp = 0, nbComp = compInfo.size(); + std::size_t iComp = 0, nbComp = compInfo.size(); for ( fcount.init(10); iComp < nbComp; ++iComp, fcount++ ) *_sauvFile << setw(8) << 777; // a good number fcount.stop(); diff --git a/src/MEDLoader/SauvWriter.hxx b/src/MEDLoader/SauvWriter.hxx index 31efd1ab4..3bdb3d3a7 100644 --- a/src/MEDLoader/SauvWriter.hxx +++ b/src/MEDLoader/SauvWriter.hxx @@ -39,7 +39,7 @@ namespace MEDCoupling class MEDFileData; class MEDFileMesh; class MEDFileFieldMultiTS; - class DataArrayInt; + class DataArrayIdType; /*! * \brief Class to write a MEDFileData into a SAUVE format file @@ -62,7 +62,7 @@ namespace MEDCoupling */ struct SubMesh { - std::vector _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ]; + std::vector _cellIDsByType[ INTERP_KERNEL::NORM_MAXTYPE+1 ]; std::vector _subs; std::string _name; int _id; @@ -83,7 +83,7 @@ namespace MEDCoupling std::map& compMedToGibi ); void makeProfileIDs( SubMesh* sm, INTERP_KERNEL::NormalizedCellType type, - const DataArrayInt* profile ); + const DataArrayIdType* profile ); void writeFileHead(); void writeSubMeshes(); void writeCompoundSubMesh(int iSub); @@ -103,7 +103,7 @@ namespace MEDCoupling std::vector< MCAuto< MEDFileFieldMultiTS > > _cellFields; std::vector _subs; - std::map< int, SubMesh* > _famIDs2Sub; + std::map< mcIdType, SubMesh* > _famIDs2Sub; std::map< std::string, SubMesh* > _profile2Sub; enum { diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index 6f110db0e..428263cd2 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -32,6 +32,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDLoader.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDLoader_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDLoader_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDLoader_SWIG_DPYS_FILES MEDLoaderCommon.i diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index 1438d85dd..9d74a0635 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -65,24 +65,42 @@ def MEDCouplingDataArrayFloatImul(self,*args): def MEDCouplingDataArrayFloatIdiv(self,*args): import _MEDLoader return _MEDLoader.DataArrayFloat____idiv___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDLoader.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDLoader.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDLoader.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDLoader.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDLoader.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDLoader - return _MEDLoader.DataArrayInt____ipow___(self, self, *args) + return _MEDLoader.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayDoubleTupleIadd(self,*args): import _MEDLoader return _MEDLoader.DataArrayDoubleTuple____iadd___(self, self, *args) @@ -95,21 +113,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDLoader return _MEDLoader.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): + import _MEDLoader + return _MEDLoader.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDLoader.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDLoader.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDLoader.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDLoader.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): import _MEDLoader - return _MEDLoader.DataArrayIntTuple____imod___(self, self, *args) + return _MEDLoader.DataArrayInt64Tuple____imod___(self, self, *args) def MEDCouplingDenseMatrixIadd(self,*args): import _MEDLoader return _MEDLoader.DenseMatrix____iadd___(self, self, *args) diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index dd03b5580..457fefbda 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -507,7 +507,8 @@ namespace MEDCoupling PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName) { - int meshDim,spaceDim,numberOfNodes; + int meshDim,spaceDim; + mcIdType numberOfNodes; std::vector< std::vector< std::pair > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); PyObject *ret=PyTuple_New(4); PyObject *elt0=PyList_New(res.size()); @@ -529,7 +530,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,0,elt0); PyTuple_SetItem(ret,1,SWIG_From_int(meshDim)); PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim)); - PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); + PyTuple_SetItem(ret,3,SWIG_From_long(numberOfNodes)); return ret; } @@ -565,9 +566,9 @@ namespace MEDCoupling PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName); - int size=v.size(); + std::size_t size=v.size(); PyObject *ret=PyList_New(size); - for(int i=0;isimpleRepr(); } - DataArrayInt *getCorrespondence() const + DataArrayIdType *getCorrespondence() const { - const DataArrayInt *ret(self->getCorrespondence()); + const DataArrayIdType *ret(self->getCorrespondence()); if(ret) ret->incrRef(); - return const_cast(ret); + return const_cast(ret); } } }; @@ -907,12 +908,12 @@ namespace MEDCoupling private: MEDFileEquivalenceData(); public: - void setArray(DataArrayInt *data); + void setArray(DataArrayInt32 *data); %extend { - DataArrayInt *getArray() + DataArrayInt32 *getArray() { - DataArrayInt *ret(self->getArray()); + DataArrayInt32 *ret(self->getArray()); if(ret) ret->incrRef(); return ret; } @@ -932,13 +933,13 @@ namespace MEDCoupling public: void clear(); std::size_t size() const; - void setArray(int meshDimRelToMax, DataArrayInt *da); - void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt *da); + void setArray(int meshDimRelToMax, DataArrayInt32 *da); + void setArrayForType(INTERP_KERNEL::NormalizedCellType type, DataArrayInt32 *da); %extend { - DataArrayInt *getArray(INTERP_KERNEL::NormalizedCellType type) + DataArrayInt32 *getArray(INTERP_KERNEL::NormalizedCellType type) { - DataArrayInt *ret(self->getArray(type)); + DataArrayInt32 *ret(self->getArray(type)); if(ret) ret->incrRef(); return ret; } @@ -964,7 +965,7 @@ namespace MEDCoupling void setName(const std::string& name); std::string getDescription() const; void setDescription(const std::string& descr); - void setArray(int meshDimRelToMaxExt, DataArrayInt *da);; + void setArray(int meshDimRelToMaxExt, DataArrayInt32 *da);; %extend { MEDFileEquivalenceCell *initCell() @@ -1068,7 +1069,7 @@ namespace MEDCoupling virtual std::vector getFamArrNonEmptyLevelsExt() const; virtual std::vector getNumArrNonEmptyLevelsExt() const; virtual std::vector getNameArrNonEmptyLevelsExt() const; - virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; + virtual std::vector getDistributionOfTypes(int meshDimRelToMax) const; virtual MEDFileMesh *cartesianize() const; std::vector getNonEmptyLevels() const; std::vector getNonEmptyLevelsExt() const; @@ -1082,7 +1083,7 @@ namespace MEDCoupling void addFamily(const std::string& familyName, int id); void addFamilyOnGrp(const std::string& grpName, const std::string& famName); virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName); - virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); + virtual bool keepFamIdsOnlyOnLevs(const std::vector& famIds, const std::vector& levs); void copyFamGrpMapsFrom(const MEDFileMesh& other); void clearGrpMap(); void clearFamMap(); @@ -1091,22 +1092,22 @@ namespace MEDCoupling const std::map >& getGroupInfo() const; std::vector getFamiliesOnGroup(const std::string& name) const; std::vector getFamiliesOnGroups(const std::vector& grps) const; - std::vector getFamiliesIdsOnGroup(const std::string& name) const; + std::vector getFamiliesIdsOnGroup(const std::string& name) const; void setFamiliesOnGroup(const std::string& name, const std::vector& fams); - void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); + void setFamiliesIdsOnGroup(const std::string& name, const std::vector& famIds); std::vector getGroupsOnFamily(const std::string& name) const; void setGroupsOnFamily(const std::string& famName, const std::vector& grps); std::vector getGroupsNames() const; std::vector getFamiliesNames() const; std::vector getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const; - std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; - std::vector getGrpNonEmptyLevels(const std::string& grp) const; - std::vector getFamsNonEmptyLevels(const std::vector& fams) const; - std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; - std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; - std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; - std::vector getFamNonEmptyLevels(const std::string& fam) const; - std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; + std::vector getGrpNonEmptyLevelsExt(const std::string& grp) const; + std::vector getGrpNonEmptyLevels(const std::string& grp) const; + std::vector getFamsNonEmptyLevels(const std::vector& fams) const; + std::vector getFamsNonEmptyLevelsExt(const std::vector& fams) const; + std::vector getGrpsNonEmptyLevels(const std::vector& grps) const; + std::vector getGrpsNonEmptyLevelsExt(const std::vector& grps) const; + std::vector getFamNonEmptyLevels(const std::string& fam) const; + std::vector getFamNonEmptyLevelsExt(const std::string& fam) const; std::vector getFamiliesNamesWithFilePointOfView() const; static std::string GetMagicFamilyStr(); void assignFamilyNameWithGroupName(); @@ -1124,7 +1125,7 @@ namespace MEDCoupling void changeFamilyName(const std::string& oldName, const std::string& newName); void changeFamilyId(int oldId, int newId); void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector& newFamiliesNames); - void setFamilyInfo(const std::map& info); + void setFamilyInfo(const std::map& info); void setGroupInfo(const std::map >&info); int getFamilyId(const std::string& name) const; int getMaxAbsFamilyId() const; @@ -1136,9 +1137,9 @@ namespace MEDCoupling virtual int getMaxAbsFamilyIdInArrays() const; virtual int getMaxFamilyIdInArrays() const; virtual int getMinFamilyIdInArrays() const; - DataArrayInt *getAllFamiliesIdsReferenced() const; - DataArrayInt *computeAllFamilyIdsInUse() const; - std::vector getFamiliesIds(const std::vector& famNames) const; + DataArrayIdType *getAllFamiliesIdsReferenced() const; + DataArrayIdType *computeAllFamilyIdsInUse() const; + std::vector getFamiliesIds(const std::vector& famNames) const; std::string getFamilyNameGivenId(int id) const; bool ensureDifferentFamIdsPerLevel(); void normalizeFamIdsTrio(); @@ -1148,20 +1149,20 @@ namespace MEDCoupling virtual std::string advancedRepr() const; // virtual MEDCouplingMesh *getMeshAtLevel(int meshDimRelToMax, bool renum=false) const; - virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr); - virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr); + virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayIdType *famArr); + virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayIdType *renumArr); virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr); - virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr); - virtual void addNodeGroup(const DataArrayInt *ids); - virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids); - virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; - virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; - virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; - virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const; - virtual DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; - virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const; - virtual DataArrayInt *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; + virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayIdType *globalNumArr); + virtual void addNodeGroup(const DataArrayIdType *ids); + virtual void addGroup(int meshDimRelToMaxExt, const DataArrayIdType *ids); + virtual DataArrayIdType *getFamiliesArr(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; + virtual DataArrayIdType *getGroupsArr(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; + virtual DataArrayIdType *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const; + virtual DataArrayIdType *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; + virtual DataArrayIdType *getNodeGroupArr(const std::string& grp, bool renum=false) const; + virtual DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + virtual DataArrayIdType *getNodeFamilyArr(const std::string& fam, bool renum=false) const; + virtual DataArrayIdType *getNodeFamiliesArr(const std::vector& fams, bool renum=false) const; int getNumberOfJoints(); MEDFileJoints *getJoints(); void setJoints( MEDFileJoints* joints ); @@ -1206,8 +1207,8 @@ namespace MEDCoupling void setGroupsAtLevel(int meshDimRelToMaxExt, PyObject *li, bool renum=false) { - std::vector grps; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",grps); + std::vector grps; + convertFromPyObjVectorOfObj(li,SWIGTITraits::TI,"DataArrayInt",grps); self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum); } @@ -1257,34 +1258,34 @@ namespace MEDCoupling PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getOrCreateAndGetFamilyFieldAtLevel(int meshDimRelToMaxExt) { - const DataArrayInt *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getOrCreateAndGetFamilyFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNumberFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getNumberFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const { - const DataArrayInt *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt); + const DataArrayIdType *tmp=self->getRevNumberFieldAtLevel(meshDimRelToMaxExt); if(tmp) tmp->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const @@ -1307,8 +1308,8 @@ namespace MEDCoupling PyObject *unPolyze() { - DataArrayInt *ret3=0; - std::vector ret1,ret2; + DataArrayIdType *ret3=0; + std::vector ret1,ret2; bool ret0=self->unPolyze(ret1,ret2,ret3); PyObject *ret=PyTuple_New(4); PyTuple_SetItem(ret,0,SWIG_From_bool(ret0)); @@ -1317,9 +1318,9 @@ namespace MEDCoupling for(int j=0;j<(int)ret1.size()/3;j++) { PyObject *retLev2=PyList_New(3); - PyList_SetItem(retLev2,0,SWIG_From_int(ret1[3*j])); - PyList_SetItem(retLev2,1,SWIG_From_int(ret1[3*j+1])); - PyList_SetItem(retLev2,2,SWIG_From_int(ret1[3*j+2])); + PyList_SetItem(retLev2,0,PyInt_FromLong(ret1[3*j])); + PyList_SetItem(retLev2,1,PyInt_FromLong(ret1[3*j+1])); + PyList_SetItem(retLev2,2,PyInt_FromLong(ret1[3*j+2])); PyList_SetItem(retLev1_0,j,retLev2); } PyTuple_SetItem(ret,1,retLev1_0); @@ -1328,14 +1329,14 @@ namespace MEDCoupling for(int j=0;j<(int)ret2.size()/3;j++) { PyObject *retLev2=PyList_New(3); - PyList_SetItem(retLev2,0,SWIG_From_int(ret2[3*j])); - PyList_SetItem(retLev2,1,SWIG_From_int(ret2[3*j+1])); - PyList_SetItem(retLev2,2,SWIG_From_int(ret2[3*j+2])); + PyList_SetItem(retLev2,0,PyInt_FromLong(ret2[3*j])); + PyList_SetItem(retLev2,1,PyInt_FromLong(ret2[3*j+1])); + PyList_SetItem(retLev2,2,PyInt_FromLong(ret2[3*j+2])); PyList_SetItem(retLev1_1,j,retLev2); } PyTuple_SetItem(ret,2,retLev1_1); // - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(ret3),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1346,9 +1347,9 @@ namespace MEDCoupling return ret; } - virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const + virtual DataArrayIdType *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const { - MCAuto ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt)); + MCAuto ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt)); return ret.retn(); } } @@ -1374,7 +1375,7 @@ namespace MEDCoupling MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector& grps, bool renum=false) const; MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const; MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector& fams, bool renum=false) const; - DataArrayInt *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; + DataArrayIdType *getNodeGroupsArr(const std::vector& grps, bool renum=false) const; MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const; MEDCouplingUMesh *getLevelM1Mesh(bool renum=false) const; MEDCouplingUMesh *getLevelM2Mesh(bool renum=false) const; @@ -1389,9 +1390,9 @@ namespace MEDCoupling void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m); void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false); void optimizeFamilies(); - DataArrayInt *zipCoords(); - DataArrayInt *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; - DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *zipCoords(); + DataArrayIdType *extractFamilyFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; + DataArrayIdType *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const; MEDFileUMesh *buildExtrudedMesh(const MEDCouplingUMesh *m1D, int policy) const; MEDFileUMesh *linearToQuadratic(int conversionType=0, double eps=1e-12) const; MEDFileUMesh *quadraticToLinear(double eps=1e-12) const; @@ -1423,7 +1424,7 @@ namespace MEDCoupling return MEDFileUMesh::New(); } - static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) + static MEDFileUMesh *LoadPartOf(const std::string& fileName, const std::string& mName, PyObject *types, const std::vector& slicPerTyp, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) { std::vector typesCpp1; convertPyToNewIntArr3(types,typesCpp1); @@ -1437,27 +1438,27 @@ namespace MEDCoupling PyObject *__getstate__() { std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - std::vector< MCAuto > a3; + std::vector< MCAuto > a3; MCAuto a4; self->serialize(a0,a1,a2,a3,a4); PyObject *ret(PyTuple_New(5)); PyTuple_SetItem(ret,0,convertDblArrToPyList2(a0)); PyTuple_SetItem(ret,1,convertIntArrToPyList2(a1)); - int sz(a2.size()); + std::size_t sz(a2.size()); PyObject *ret2(PyList_New(sz)); - for(int i=0;iincrRef(); - PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyList_SetItem(ret3,i,SWIG_NewPointerObj(SWIG_as_voidptr(elt),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); } PyTuple_SetItem(ret,3,ret3); DataArrayDouble *ret4(a4); @@ -1472,17 +1473,17 @@ namespace MEDCoupling static const char MSG[]="MEDFileUMesh.__setstate__ : expected input is a tuple of size 4 !"; if(!PyTuple_Check(inp)) throw INTERP_KERNEL::Exception(MSG); - int sz(PyTuple_Size(inp)); + std::size_t sz(PyTuple_Size(inp)); if(sz!=5) throw INTERP_KERNEL::Exception(MSG); std::vector a0; - std::vector a1; + std::vector a1; std::vector a2; - std::vector< MCAuto > a3; + std::vector< MCAuto > a3; MCAuto a4; // PyObject *a0py(PyTuple_GetItem(inp,0)),*a1py(PyTuple_GetItem(inp,1)),*a2py(PyTuple_GetItem(inp,2)); - int tmp(-1); + mcIdType tmp(-1); fillArrayWithPyListDbl3(a0py,tmp,a0); convertPyToNewIntArr3(a1py,a1); fillStringVector(a2py,a2); @@ -1496,8 +1497,8 @@ namespace MEDCoupling if((DataArrayDouble *)a4) a4->incrRef(); { - std::vector< DataArrayInt * > a3Tmp; - convertFromPyObjVectorOfObj(b0py,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",a3Tmp); + std::vector< DataArrayIdType * > a3Tmp; + convertFromPyObjVectorOfObj(b0py,SWIGTITraits::TI,"DataArrayInt",a3Tmp); std::size_t sz(a3Tmp.size()); a3.resize(sz); for(std::size_t i=0;i bb,bb2; - int sw; + mcIdType sw; const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true)); const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true)); MCAuto ret(self->symmetry3DPlane(centerPtr,vectorPtr)); @@ -1558,20 +1559,20 @@ namespace MEDCoupling PyObject *getAllDistributionOfTypes() const { - std::vector< std::pair > ret(self->getAllDistributionOfTypes()); + std::vector< std::pair > ret(self->getAllDistributionOfTypes()); return convertVecPairIntToPy(ret); } - DataArrayInt *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const + DataArrayIdType *deduceNodeSubPartFromCellSubPart(PyObject *extractDef) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->deduceNodeSubPartFromCellSubPart(extractDefCpp); } MEDFileUMesh *extractPart(PyObject *extractDef) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp); } @@ -1615,12 +1616,12 @@ namespace MEDCoupling PyObject *buildInnerBoundaryAlongM1Group(const std::string& grpNameM1) { - DataArrayInt *ret0=0,*ret1=0,*ret2=0; + DataArrayIdType *ret0=0,*ret1=0,*ret2=0; self->buildInnerBoundaryAlongM1Group(grpNameM1,ret0,ret1,ret2); PyObject *ret=PyTuple_New(3); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -1946,18 +1947,18 @@ namespace MEDCoupling { PyObject *getProfile(const std::string& pflName) const { - const DataArrayInt *ret=self->getProfile(pflName); + const DataArrayIdType *ret=self->getProfile(pflName); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getProfileFromId(int pflId) const { - const DataArrayInt *ret=self->getProfileFromId(pflId); + const DataArrayIdType *ret=self->getProfileFromId(pflId); if(ret) ret->incrRef(); - return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ); + return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 ); } PyObject *getLocalizationFromId(int locId) const @@ -2148,24 +2149,24 @@ namespace MEDCoupling std::vector< std::vector > typesF; std::vector< std::vector > pfls; std::vector< std::vector > locs; - std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i >& dadsI=ret[i]; + const std::vector< std::pair >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; const std::vector& pflsI=pfls[i]; const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -2234,8 +2235,8 @@ namespace MEDCoupling MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; // void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field); - void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false); void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false); %extend @@ -2290,9 +2291,9 @@ namespace MEDCoupling std::vector< std::vector > pfls; std::vector< std::vector > locs; std::vector< std::vector > ret=self->getFieldSplitedByType2(mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2300,9 +2301,9 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j(self,type,meshDimRelToMax,mesh); } - DataArrayInt *getUndergroundDataArray() const + DataArrayInt32 *getUndergroundDataArray() const { - DataArrayInt *ret=self->getUndergroundDataArray(); + DataArrayInt32 *ret=self->getUndergroundDataArray(); if(ret) ret->incrRef(); return ret; @@ -2415,8 +2416,8 @@ namespace MEDCoupling MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const; // void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field); - void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); + void setFieldProfileFlatly(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); void copyTimeInfoFrom(MEDCouplingFieldFloat *mcf); MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const; MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const; @@ -2537,7 +2538,7 @@ namespace MEDCoupling { if(elt0 && PyInt_Check(elt0)) {//fmts[3] - int pos=PyInt_AS_LONG(elt0); + int pos=(int)PyInt_AS_LONG(elt0); return pos; } else if(elt0 && PyTuple_Check(elt0)) @@ -2548,8 +2549,8 @@ namespace MEDCoupling PyObject *o1=PyTuple_GetItem(elt0,1); if(PyInt_Check(o0) && PyInt_Check(o1)) {//fmts(1,-1) - int iter=PyInt_AS_LONG(o0); - int order=PyInt_AS_LONG(o1); + int iter=(int)PyInt_AS_LONG(o0); + int order=(int)PyInt_AS_LONG(o1); return self->getPosOfTimeStep(iter,order); } else @@ -2621,24 +2622,24 @@ namespace MEDCoupling std::vector< std::vector > typesF; std::vector< std::vector > pfls; std::vector< std::vector > locs; - std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::vector< std::vector< std::pair > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i >& dadsI=ret[i]; + const std::vector< std::pair >& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; const std::vector& pflsI=pfls[i]; const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j ret(sz); - for(int i=0;igetNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !"); - self->eraseTimeStepIds2(strt,stp,step); + self->eraseTimeStepIds2((int)strt,(int)stp,(int)step); } else { @@ -2689,10 +2690,10 @@ namespace MEDCoupling void eraseTimeStepIds(PyObject *li) { - int sw; + mcIdType sw; int pos1; std::vector pos2; - DataArrayInt *pos3=0; + DataArrayInt32 *pos3=0; DataArrayIntTuple *pos4=0; convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4); switch(sw) @@ -2728,10 +2729,10 @@ namespace MEDCoupling { if(elt0 && PyList_Check(elt0)) { - int sz=PyList_Size(elt0); - MCAuto da=DataArrayInt::New(); da->alloc(sz,1); + std::size_t sz=PyList_Size(elt0); + MCAuto da=DataArrayInt32::New(); da->alloc(sz,1); int *pt=da->getPointer(); - for(int i=0;igetNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !"); - return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0); + return convertMEDFileFieldMultiTS(self->buildSubPartSlice((int)strt,(int)stp,(int)step),SWIG_POINTER_OWN | 0); } else return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0); @@ -2802,7 +2803,7 @@ namespace MEDCoupling MEDFileAnyTypeFieldMultiTS *extractPart(PyObject *extractDef, MEDFileMesh *mm) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -2882,7 +2883,7 @@ namespace MEDCoupling MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; // void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field); - void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const; %extend { @@ -2926,11 +2927,11 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayDouble *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -2941,9 +2942,9 @@ namespace MEDCoupling std::vector< std::vector > pfls; std::vector< std::vector > locs; std::vector< std::vector > ret=self->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs); - int sz=ret.size(); + std::size_t sz=ret.size(); PyObject *ret2=PyList_New(sz); - for(int i=0;i& dadsI=ret[i]; const std::vector& typesFI=typesF[i]; @@ -2951,9 +2952,9 @@ namespace MEDCoupling const std::vector& locsI=locs[i]; PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int(types[i])); - int sz2=ret[i].size(); + std::size_t sz2=ret[i].size(); PyObject *elt2=PyList_New(sz2); - for(int j=0;j,std::pair > > elt1Cpp; + std::vector< std::pair,std::pair > > elt1Cpp; DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp); if(elt0) elt0->incrRef(); @@ -2992,8 +2993,8 @@ namespace MEDCoupling PyTuple_SetItem(elt2,0,SWIG_From_int(elt1Cpp[i].first.first)); PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second)); PyObject *elt3=PyTuple_New(2); - PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first)); - PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second)); + PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first)); + PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second)); PyTuple_SetItem(elt1,0,elt2); PyTuple_SetItem(elt1,1,elt3); PyList_SetItem(elt,i,elt1); @@ -3032,7 +3033,7 @@ namespace MEDCoupling static MEDFileIntFieldMultiTS *New(DataArrayByte *db); // void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field); - void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -3076,17 +3077,17 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; - DataArrayInt *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); + DataArrayIdType *ret1=0; + DataArrayInt32 *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } - DataArrayInt *getUndergroundDataArray(int iteration, int order) const + DataArrayInt32 *getUndergroundDataArray(int iteration, int order) const { - DataArrayInt *ret=self->getUndergroundDataArray(iteration,order); + DataArrayInt32 *ret=self->getUndergroundDataArray(iteration,order); if(ret) ret->incrRef(); return ret; @@ -3103,7 +3104,7 @@ namespace MEDCoupling static MEDFileFloatFieldMultiTS *New(DataArrayByte *db); // void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field); - void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); + void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const; MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; @@ -3147,11 +3148,11 @@ namespace MEDCoupling PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const { - DataArrayInt *ret1=0; + DataArrayIdType *ret1=0; DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } @@ -3320,10 +3321,10 @@ namespace MEDCoupling { if(obj && PyList_Check(obj)) { - int sz=PyList_Size(obj); + std::size_t sz=PyList_Size(obj); MCAuto da=DataArrayInt::New(); da->alloc(sz,1); int *pt=da->getPointer(); - for(int i=0;igetPosFromFieldName(convertPyObjectToStr(elt0,msg)); } @@ -3372,9 +3373,9 @@ namespace MEDCoupling { if(PyList_Check(elts)) { - int sz=PyList_Size(elts); + std::size_t sz=PyList_Size(elts); std::vector ret(sz); - for(int i=0;igetNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !"); - self->destroyFieldsAtPos2(strt,stp,step); + self->destroyFieldsAtPos2((int)strt,(int)stp,(int)step); } else { @@ -3414,7 +3415,7 @@ namespace MEDCoupling MEDFileFields *extractPart(PyObject *extractDef, MEDFileMesh *mm) const { - std::map > extractDefCpp; + std::map > extractDefCpp; convertToMapIntDataArrayInt(extractDef,extractDefCpp); return self->extractPart(extractDefCpp,mm); } @@ -3569,7 +3570,7 @@ namespace MEDCoupling void eraseTimeStepIds(PyObject *ids) { - int sw; + mcIdType sw; int pos1; std::vector pos2; DataArrayInt *pos3=0; @@ -3614,8 +3615,8 @@ namespace MEDCoupling PyObject *o1=PyTuple_GetItem(elt0,1); if(PyInt_Check(o0) && PyInt_Check(o1)) {//fmts(1,-1) - int iter=PyInt_AS_LONG(o0); - int order=PyInt_AS_LONG(o1); + int iter=(int)PyInt_AS_LONG(o0); + int order=(int)PyInt_AS_LONG(o1); return self->getPosOfTimeStep(iter,order); } else @@ -3645,9 +3646,9 @@ namespace MEDCoupling { if(PyList_Check(elts)) { - int sz=PyList_Size(elts); + std::size_t sz=PyList_Size(elts); std::vector ret(sz); - for(int i=0;iretrieveFamilyIdsOnCells(famIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveNumberIdsOnCells() const { - DataArrayInt *numIds(0); + DataArrayIdType *numIds(0); bool isWithoutCopy(false); self->retrieveNumberIdsOnCells(numIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveFamilyIdsOnNodes() const { - DataArrayInt *famIds(0); + DataArrayIdType *famIds(0); bool isWithoutCopy(false); self->retrieveFamilyIdsOnNodes(famIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(famIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } PyObject *retrieveNumberIdsOnNodes() const { - DataArrayInt *numIds(0); + DataArrayIdType *numIds(0); bool isWithoutCopy(false); self->retrieveNumberIdsOnNodes(numIds,isWithoutCopy); PyObject *ret=PyTuple_New(2); PyObject *ret1Py=isWithoutCopy?Py_True:Py_False; Py_XINCREF(ret1Py); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(numIds),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,ret1Py); return ret; } @@ -4014,7 +4015,7 @@ namespace MEDCoupling { PyObject *buildVTUArrays() const { - DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayInt *cellLocations(0),*cells(0),*faceLocations(0),*faces(0); + DataArrayDouble *coords(0); DataArrayByte *types(0); DataArrayIdType *cellLocations(0),*cells(0),*faceLocations(0),*faces(0); bool ncc(self->buildVTUArrays(coords,types,cellLocations,cells,faceLocations,faces)); PyObject *ret0Py=ncc?Py_True:Py_False; Py_XINCREF(ret0Py); @@ -4022,10 +4023,10 @@ namespace MEDCoupling PyTuple_SetItem(ret,0,ret0Py); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(coords),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(types),SWIGTYPE_p_MEDCoupling__DataArrayByte, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,3,SWIG_NewPointerObj(SWIG_as_voidptr(cellLocations),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,4,SWIG_NewPointerObj(SWIG_as_voidptr(cells),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,5,SWIG_NewPointerObj(SWIG_as_voidptr(faceLocations),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,6,SWIG_NewPointerObj(SWIG_as_voidptr(faces),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } @@ -4072,7 +4073,7 @@ namespace MEDCoupling PyObject *buildVTUArrays() const { DataArrayDouble *ret0(0); - std::vector ret1; + std::vector ret1; bool ret2; self->buildVTUArrays(ret0,ret1,ret2); std::size_t sz(ret1.size()); @@ -4080,7 +4081,7 @@ namespace MEDCoupling PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 )); PyObject *ret1Py=PyList_New(sz); for(std::size_t i=0;i > convertTimePairIdsFromPy(PyObject *pyLi) std::vector > ret; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception("tuples in list must be of size 2 (dt,it) !"); PyObject *o0=PyTuple_GetItem(o,0); @@ -169,9 +169,9 @@ static void converPyListToVecString(PyObject *pyLi, std::vector& v) static const char msg2[]="Unrecognized python argument : expected a list of string or tuple of string or string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); v.resize(size); - for(int i=0;i& v) } else if(PyTuple_Check(pyLi)) { - int size=PyTuple_Size(pyLi); + std::size_t size=PyTuple_Size(pyLi); v.resize(size); - for(int i=0;i& v) static PyObject *convertFieldDoubleVecToPy(const std::vector& li) { - int sz=li.size(); + std::size_t sz=li.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i >& vec) +template< class T > +PyObject *convertVecPairIntToPy(const std::vector< std::pair >& vec) { PyObject *ret(PyList_New(vec.size())); int rk=0; - for(std::vector< std::pair >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++) + for(typename std::vector< std::pair >::const_iterator iter=vec.begin();iter!=vec.end();iter++,rk++) { PyObject *elt=PyTuple_New(2); PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); + PyTuple_SetItem(elt,1,PyInt_FromLong((*iter).second)); PyList_SetItem(ret,rk,elt); } return ret; @@ -221,9 +222,9 @@ PyObject *convertVecPairIntToPy(const std::vector< std::pair >& vec) PyObject *convertVecPairVecStToPy(const std::vector< std::pair, std::string > >& vec) { - int sz=(int)vec.size(); + std::size_t sz=vec.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i >& vec) { - int sz=(int)vec.size(); + std::size_t sz=vec.size(); PyObject *ret=PyList_New(sz); - for(int i=0;i > convertVecPairStStFromPy(PyO const char *msg="convertVecPairStStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is one string and the 2nd one a string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o0=PyTuple_GetItem(o,0); @@ -288,23 +289,23 @@ std::vector< std::pair, std::string > > convertVecPairV const char *msg="convertVecPairVecStFromPy : Expecting PyList of Tuples of size 2 ! The first elt in tuple is a list of strings and the 2nd one a string !"; if(PyList_Check(pyLi)) { - int size=PyList_Size(pyLi); + std::size_t size=PyList_Size(pyLi); ret.resize(size); - for(int i=0;i, std::string> p; - int size2=PyTuple_Size(o); + std::size_t size2=PyTuple_Size(o); if(size2!=2) throw INTERP_KERNEL::Exception(msg); PyObject *o0=PyTuple_GetItem(o,0); if(PyList_Check(o0)) { - int size3=PyList_Size(o0); + std::size_t size3=PyList_Size(o0); p.first.resize(size3); - for(int j=0;jgetPosOfTimeStep(iter,order); } else @@ -370,12 +371,12 @@ int MEDFileFieldsgetitemSingleTS__(const MEDFileFields *self, PyObject *obj) static const char msg[]="MEDFileFields::__getitem__ : only integer or string with fieldname supported !"; if(PyInt_Check(obj)) { - return InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfFields()); + return InterpreteNegativeInt(PyInt_AS_LONG(obj),self->getNumberOfFields()); } return self->getPosFromFieldName(convertPyObjectToStr(obj,msg)); } -void convertToMapIntDataArrayInt(PyObject *pyMap, std::map >& cppMap) +void convertToMapIntDataArrayInt(PyObject *pyMap, std::map >& cppMap) { if(!PyDict_Check(pyMap)) throw INTERP_KERNEL::Exception("convertToMapIntDataArrayInt : input is not a python map !"); @@ -386,16 +387,16 @@ void convertToMapIntDataArrayInt(PyObject *pyMap, std::map::TI,0|0)); if(!SWIG_IsOK(status)) { std::ostringstream oss; oss << "convertToMapIntDataArrayInt : values in map must be DataArrayInt !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - DataArrayInt *arg(reinterpret_cast(argp)); - MCAuto arg2(arg); + DataArrayIdType *arg(reinterpret_cast(argp)); + MCAuto arg2(arg); if(arg) arg->incrRef(); cppMap[k]=arg2; @@ -405,18 +406,18 @@ void convertToMapIntDataArrayInt(PyObject *pyMap, std::map PyObject *MEDFileField1TS_getFieldWithProfile(const typename MLFieldTraits::F1TSType *self, TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) { - DataArrayInt *ret1(NULL); + DataArrayIdType *ret1(NULL); typename MEDCoupling::Traits::ArrayType *ret0(self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1)); PyObject *ret(PyTuple_New(2)); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } template PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTraits::F1TSType *self) { - std::vector< std::pair,std::pair > > elt1Cpp; + std::vector< std::pair,std::pair > > elt1Cpp; typename MEDCoupling::Traits::ArrayType *elt0=self->getUndergroundDataArrayExt(elt1Cpp); if(elt0) elt0->incrRef(); @@ -431,8 +432,8 @@ PyObject *MEDFileField1TS_getUndergroundDataArrayExt(const typename MLFieldTrait PyTuple_SetItem(elt2,0,SWIG_From_int((int)elt1Cpp[i].first.first)); PyTuple_SetItem(elt2,1,SWIG_From_int(elt1Cpp[i].first.second)); PyObject *elt3=PyTuple_New(2); - PyTuple_SetItem(elt3,0,SWIG_From_int(elt1Cpp[i].second.first)); - PyTuple_SetItem(elt3,1,SWIG_From_int(elt1Cpp[i].second.second)); + PyTuple_SetItem(elt3,0,PyInt_FromLong(elt1Cpp[i].second.first)); + PyTuple_SetItem(elt3,1,PyInt_FromLong(elt1Cpp[i].second.second)); PyTuple_SetItem(elt1,0,elt2); PyTuple_SetItem(elt1,1,elt3); PyList_SetItem(elt,i,elt1); diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index b3284e9be..68484f81c 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -264,17 +264,17 @@ void MEDLoaderTest::testMultiMeshRW1() { const char fileName[]="file10.med"; MEDCouplingUMesh *mesh1=build3DMesh_1(); - const int part1[5]={1,2,4,13,15}; + const mcIdType part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName("mesh2"); - const int part2[4]={3,4,13,14}; + const mcIdType part2[4]={3,4,13,14}; MEDCouplingUMesh *mesh3=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part2,part2+4,true); mesh3->setName("mesh3"); MEDCouplingUMesh *mesh4=MEDCouplingUMesh::New(); mesh4->setName("mesh4"); mesh4->setMeshDimension(3); mesh4->allocateCells(1); - int conn[4]={0,11,1,3}; + mcIdType conn[4]={0,11,1,3}; mesh4->insertNextCell(INTERP_KERNEL::NORM_TETRA4,4,conn); mesh4->finishInsertingCells(); mesh4->setCoords(mesh1->getCoords()); @@ -288,7 +288,7 @@ void MEDLoaderTest::testMultiMeshRW1() // MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane); mesh1->setName(mnane); - const int part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; + const mcIdType part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true); mesh6->setName(mnane); mesh5->decrRef(); @@ -352,16 +352,16 @@ void MEDLoaderTest::testFieldProfilRW1() const char fileName[]="file12.med"; MEDCouplingUMesh *mesh1=build3DMesh_1(); bool b; - int newNbOfNodes; - DataArrayInt *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes); + mcIdType newNbOfNodes; + DataArrayIdType *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes); da->decrRef(); WriteUMesh(fileName,mesh1,true); - const int part1[5]={1,2,4,13,15}; + const mcIdType part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName(mesh1->getName().c_str());//<- important for the test // - int nbOfCells=mesh2->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL(5,nbOfCells); + mcIdType nbOfCells=mesh2->getNumberOfCells(); + CPPUNIT_ASSERT_EQUAL(ToIdType(5),nbOfCells); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setMesh(mesh2); @@ -398,7 +398,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() const char fileName[]="file19.med"; const char fileName2[]="file20.med"; MEDCouplingUMesh *m=build2DMesh_1(); - int nbOfNodes=m->getNumberOfNodes(); + mcIdType nbOfNodes=m->getNumberOfNodes(); WriteUMesh(fileName,m,true); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VFieldOnNodes"); @@ -413,7 +413,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() array->decrRef(); f1->setTime(3.14,2,7); f1->checkConsistencyLight(); - const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7 + const mcIdType arr2[2]={1,4};//node ids are 2,4,5,3,6,7 MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2); (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); WriteField(fileName,f2,false);//<- false important for the test @@ -423,7 +423,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); // - const int arr3[6]={1,3,0,5,2,4}; + const mcIdType arr3[6]={1,3,0,5,2,4}; f2->renumberNodes(arr3); WriteUMesh(fileName2,m,true); WriteField(fileName2,f2,false);//<- false important for the test @@ -460,7 +460,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() std::copy(arr2,arr2+24,tmp); f1->setTime(3.17,2,7); // - const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; + const mcIdType renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; f1->renumberNodes(renumArr); f1->checkConsistencyLight(); WriteField(fileName,f1,false);//<- false important for the test @@ -532,7 +532,7 @@ void MEDLoaderTest::testMesh3DSurfShuffleRW() { const char fileName[]="file15.med"; MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - const int renumber1[6]={2,5,1,0,3,4}; + const mcIdType renumber1[6]={2,5,1,0,3,4}; mesh->renumberCells(renumber1,false); mesh->checkConsistencyLight(); WriteUMesh(fileName,mesh,true); @@ -559,7 +559,7 @@ void MEDLoaderTest::testFieldShuffleRW1() f1->setTime(3.14,2,7); f1->checkConsistencyLight(); // - const int renumber1[6]={2,1,5,0,3,4}; + const mcIdType renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); WriteField(fileName,f1,true); MEDCouplingFieldDouble *f2=dynamic_cast((MEDCouplingField *)ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7)); @@ -578,11 +578,11 @@ void MEDLoaderTest::testMultiFieldShuffleRW1() const char fileName[]="file17.med"; MEDCouplingUMesh *m=build3DMesh_2(); CPPUNIT_ASSERT_EQUAL(20,(int)m->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(45,m->getNumberOfNodes()); - const int polys[3]={1,4,6}; - std::vector poly2(polys,polys+3); + CPPUNIT_ASSERT_EQUAL(ToIdType(45),m->getNumberOfNodes()); + const mcIdType polys[3]={1,4,6}; + std::vector poly2(polys,polys+3); m->convertToPolyTypes(&poly2[0],&poly2[0]+poly2.size()); - const int renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11}; + const mcIdType renum[20]={1,3,2,8,9,12,13,16,19,0,4,7,5,15,14,17,10,18,6,11}; m->renumberCells(renum,false); m->orientCorrectlyPolyhedrons(); // Writing @@ -631,10 +631,10 @@ void MEDLoaderTest::testWriteUMeshesRW1() MEDCouplingUMesh *m3d=build3DMesh_2(); const double pt[3]={0.,0.,-0.3}; const double vec[3]={0.,0.,1.}; - std::vector nodes; + std::vector nodes; m3d->findNodesOnPlane(pt,vec,1e-12,nodes); MEDCouplingUMesh *m2d=(MEDCouplingUMesh *)m3d->buildFacePartOfMySelfNode(&nodes[0],&nodes[0]+nodes.size(),true); - const int renumber[5]={1,2,0,4,3}; + const mcIdType renumber[5]={1,2,0,4,3}; m2d->renumberCells(renumber,false); m2d->setName("ExampleOfMultiDimW"); std::vector meshes; @@ -788,7 +788,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i)); @@ -796,7 +796,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,mesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -812,11 +812,11 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(1)); - CPPUNIT_ASSERT_EQUAL((std::size_t)11,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(11),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(132,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+11,0)); CPPUNIT_ASSERT_EQUAL(16,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+3,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -835,12 +835,12 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(7,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<6;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(i)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,mesh->getTypeOfCell(6)); - CPPUNIT_ASSERT_EQUAL((std::size_t)36,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(36),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(254,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+36,0)); CPPUNIT_ASSERT_EQUAL(141,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+8,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); @@ -874,7 +874,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -882,7 +882,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -903,7 +903,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -911,7 +911,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -957,7 +957,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -965,7 +965,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -985,7 +985,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<12;i++) CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,constMesh->getTypeOfCell(i)); @@ -993,7 +993,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(13)); CPPUNIT_ASSERT_EQUAL(NORM_HEXA8,constMesh->getTypeOfCell(14)); CPPUNIT_ASSERT_EQUAL(NORM_PYRA5,constMesh->getTypeOfCell(15)); - CPPUNIT_ASSERT_EQUAL((std::size_t)90,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(90),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(701,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+90,0)); CPPUNIT_ASSERT_EQUAL(705,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+17,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); @@ -1014,7 +1014,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(538,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(579,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(579),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<514;i++) CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(i)); @@ -1026,7 +1026,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() std::transform(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+12,expectedVals1,diffValue1,std::minus()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)2768,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2768),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+2768,0)); CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0)); mesh->decrRef(); @@ -1048,7 +1048,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(3,constMesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,constMesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(538,(int)constMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(579,constMesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(579),constMesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)constMesh->getAllGeoTypes().size()); for(int i=0;i<514;i++) CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,constMesh->getTypeOfCell(i)); @@ -1058,7 +1058,7 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() std::transform(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+12,expectedVals1,diffValue1,std::minus()); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::max_element(diffValue1,diffValue1+12),1e-12); CPPUNIT_ASSERT_DOUBLES_EQUAL(0.,*std::min_element(diffValue1,diffValue1+12),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)2768,constMesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(2768),constMesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(651050,std::accumulate(constMesh->getNodalConnectivity()->getConstPointer(),constMesh->getNodalConnectivity()->getConstPointer()+2768,0)); CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(constMesh->getNodalConnectivityIndex()->getConstPointer(),constMesh->getNodalConnectivityIndex()->getConstPointer()+539,0)); const double *values=field->getArray()->getPointer(); @@ -1080,12 +1080,12 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(2,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_TETRA4,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(1)); CPPUNIT_ASSERT_EQUAL(NORM_POLYHED,mesh->getTypeOfCell(2)); - CPPUNIT_ASSERT_EQUAL((std::size_t)98,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(98),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(725,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+98,0)); CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); CPPUNIT_ASSERT_EQUAL(155,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+4,0)); @@ -1096,7 +1096,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(17,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getAllGeoTypes().size()); CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(0)); CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(1)); @@ -1116,7 +1116,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(NORM_QUAD4,mesh->getTypeOfCell(15)); CPPUNIT_ASSERT_EQUAL(NORM_TRI3,mesh->getTypeOfCell(16)); CPPUNIT_ASSERT_DOUBLES_EQUAL(110.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); - CPPUNIT_ASSERT_EQUAL((std::size_t)83,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(83),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0)); mesh->decrRef(); // @@ -1133,18 +1133,18 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(3,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(1,(int)mesh->getAllGeoTypes().size()); for(int i=0;i<3;i++) CPPUNIT_ASSERT_EQUAL(NORM_POLYGON,mesh->getTypeOfCell(i)); - CPPUNIT_ASSERT_EQUAL((std::size_t)19,mesh->getNodalConnectivity()->getNbOfElems()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNodalConnectivity()->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(117,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+19,0)); mesh->decrRef(); // mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); + CPPUNIT_ASSERT_EQUAL(ToIdType(19),mesh->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(0,(int)mesh->getAllGeoTypes().size()); mesh->decrRef(); @@ -1153,7 +1153,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1() { double coords[6]={ 0.0, 0.3, 0.75, 1.0, 1.4, 1.3 }; - int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; + mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setName("1DMesh_1"); mesh->setMeshDimension(1); @@ -1175,7 +1175,7 @@ MEDCouplingUMesh *MEDLoaderTest::build1DMesh_1() MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1() { double coords[12]={ 0.0,0.0, 0.3,0.3, 0.75,0.75, 1.0,1.0, 1.4,1.4, 1.3,1.3 }; - int conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; + mcIdType conn[9]={ 0,1, 1,2, 2,3 , 3,4,5}; MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setName("2DCurveMesh_1"); mesh->setMeshDimension(1); @@ -1196,7 +1196,7 @@ MEDCouplingUMesh *MEDLoaderTest::build2DCurveMesh_1() MEDCouplingUMesh *MEDLoaderTest::build2DMesh_1() { double targetCoords[24]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(6); @@ -1224,7 +1224,7 @@ MEDCouplingUMesh *MEDLoaderTest::build2DMesh_2() -0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2, 0.7,0.2, -0.3,0.7, 0.2,0.7, 0.7,0.7, -0.05,0.95, 0.2,1.2, 0.45,0.95 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(5); @@ -1251,7 +1251,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DSurfMesh_1() -0.3,-0.3,-0.3, 0.2,-0.3,-0.3, 0.7,-0.3,-0.3, -0.3,0.2,-0.3, 0.2,0.2,-0.3, 0.7,0.2,-0.3, -0.3,0.7,-0.3, 0.2,0.7,-0.3, 0.7,0.7,-0.3 ,-0.05,0.95,-0.3, 0.2,1.2,-0.3, 0.45,0.95,-0.3 }; - int targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[24]={1,4,2, 4,5,2, 6,10,8,9,11,7, 0,3,4,1, 6,7,4,3, 7,8,5,4}; MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New(); targetMesh->setMeshDimension(2); targetMesh->allocateCells(6); @@ -1285,7 +1285,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_1() 0.,0.,3., 1.,1.,3., 1.,1.25,3., 0.,1.,3., 1.,1.5,3., 2.,0.,3., 2.,1.,3., 1.,2.,3., 0.,2.,3., 3.,1.,3., 3.,2.,3., 0.,1.,3., 1.,3.,3., 2.,2.,3., 2.,3.,3.}; - int conn[354]={ + mcIdType conn[354]={ // 0 0,11,1,3,15,26,16,18, 1,2,4,7,13,6,-1,1,16,21,6,-1,6,21,28,13,-1,13,7,22,28,-1,7,4,19,22,-1,4,2,17,19,-1,2,1,16,17,-1,16,21,28,22,19,17, 1,6,5,3,16,21,20,18, 13,10,9,6,28,25,24,21, @@ -1345,11 +1345,11 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_1() MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() { MEDCouplingUMesh *m3dsurfBase=build3DSurfMesh_1(); - int numbers[5]={0,1,2,3,5}; + mcIdType numbers[5]={0,1,2,3,5}; MEDCouplingUMesh *m3dsurf=(MEDCouplingUMesh *)m3dsurfBase->buildPartOfMySelf(numbers,numbers+5,false); m3dsurfBase->decrRef(); MEDCouplingUMesh *m1dBase=build1DMesh_1(); - int numbers2[4]={0,1,2,3}; + mcIdType numbers2[4]={0,1,2,3}; MEDCouplingUMesh *m1d=(MEDCouplingUMesh *)m1dBase->buildPartOfMySelf(numbers2,numbers2+4,false); m1dBase->decrRef(); m1d->changeSpaceDimension(3); @@ -1365,7 +1365,7 @@ MEDCouplingUMesh *MEDLoaderTest::build3DMesh_2() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - int nbOfCells=mesh->getNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setMesh(mesh); @@ -1388,7 +1388,7 @@ MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnCells_1() MEDCouplingFieldDouble *MEDLoaderTest::buildVecFieldOnNodes_1() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - int nbOfNodes=mesh->getNumberOfNodes(); + mcIdType nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); f1->setMesh(mesh); diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 018317f95..52ff60323 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -58,7 +58,7 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() const int spaceDim = 2; const int nbOfNodes = 6; double coords[nbOfNodes*spaceDim] = {0,0, 1,0, 1,1, 0,1, 2,0, 2,1}; - int conn[8]={0,1,2,3, 1,4,5,2}; + mcIdType conn[8]={0,1,2,3, 1,4,5,2}; MCAuto mesh2d=MEDCouplingUMesh::New("Mesh",spaceDim); mesh2d->allocateCells(2); mesh2d->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -75,14 +75,14 @@ void SauvLoaderTest::testMed2SauvOnAMeshWithVoidFamily() // Create families and groups - MCAuto fam = DataArrayInt::New(); + MCAuto fam = DataArrayIdType::New(); fam->alloc(2,1); - int elemsFams[2] = {-2,-3}; + mcIdType elemsFams[2] = {-2,-3}; std::copy(elemsFams,elemsFams+2,fam->getPointer()); m->setFamilyFieldArr(0,fam); - std::map theFamilies; + std::map theFamilies; theFamilies["FAM_-1"]=-1; theFamilies["FAM_-2"]=-2; theFamilies["FAM_-3"]=-3; @@ -160,7 +160,7 @@ void SauvLoaderTest::testSauv2MedOnA3SubsField() -6.111413346910e-07, -6.111413346910e-07}; - for (int i=0; i < field1d->getNumberOfTuples(); i++) + for (mcIdType i=0; i < field1d->getNumberOfTuples(); i++) { CPPUNIT_ASSERT_DOUBLES_EQUAL( values[i], field1d->getIJ(i, 0), 1e-12 ); } @@ -179,7 +179,7 @@ void SauvLoaderTest::testMed2Sauv() pointeM1D->setCoords( coords ); pointeM1D->setMeshDimension( 2 ); pointeM1D->allocateCells( 3 ); - int conn[]= + mcIdType conn[]= { 0,1,2, 0,1,3, 10,11,12,13 }; @@ -205,8 +205,8 @@ void SauvLoaderTest::testMed2Sauv() }; std::copy(vals,vals+d->getNbOfElems(),d->getPointer()); f1->setArray(d); - MCAuto da=DataArrayInt::New(); - int ids[] = + MCAuto da=DataArrayIdType::New(); + mcIdType ids[] = { 0,2 }; @@ -249,7 +249,7 @@ void SauvLoaderTest::testMed2Sauv() CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe4") != groups.end() ); CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"groupe5") != groups.end() ); CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() ); - CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0)); + CPPUNIT_ASSERT_EQUAL(ToIdType(16),m->getSizeAtLevel(0)); MCAuto um0 = m->getMeshAtLevel(0); CPPUNIT_ASSERT_EQUAL(12, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 )); CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 )); @@ -328,10 +328,10 @@ void SauvLoaderTest::testCellsWithLingNames() // - Nombre de mailles de type MED_HEXA8 : 24 // - Nombre de mailles de type MED_PENTA6 : 3 MEDFileUMesh* m = static_cast( d2->getMeshes()->getMeshAtPos(0)); - CPPUNIT_ASSERT_EQUAL(6, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); - CPPUNIT_ASSERT_EQUAL(43, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_QUAD4 )); - CPPUNIT_ASSERT_EQUAL(24, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); - CPPUNIT_ASSERT_EQUAL(3, m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 )); + 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 )); + CPPUNIT_ASSERT_EQUAL(ToIdType(3), m->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PENTA6 )); } void SauvLoaderTest::tearDown() @@ -350,7 +350,7 @@ void SauvLoaderTest::tearDown() if (access(fileToRemove[i], F_OK) == 0) #endif #if defined(WIN32) && defined(UNICODE) - _wremove(fileToRemove[i]); + _wremove(fileToRemove[i]); #else remove(fileToRemove[i]); #endif diff --git a/src/MEDPartitioner/CMakeLists.txt b/src/MEDPartitioner/CMakeLists.txt index 9f27daa16..41eceb565 100644 --- a/src/MEDPartitioner/CMakeLists.txt +++ b/src/MEDPartitioner/CMakeLists.txt @@ -19,6 +19,10 @@ ADD_DEFINITIONS(${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${LIBXML2_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} ${MEDFILE_INCLUDE_DIRS} diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx index 7297e48b6..870fd4f0f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.cxx @@ -30,16 +30,16 @@ MEDPARTITIONER::ConnectZone::ConnectZone(): ,_description("") ,_local_domain_number(0) ,_distant_domain_number(0) - ,_node_corresp(0) - ,_face_corresp(0) ,_local_mesh(0) ,_distant_mesh(0) + ,_node_corresp(0) + ,_face_corresp(0) { } MEDPARTITIONER::ConnectZone::~ConnectZone() { - for(std::map < std::pair ,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++) + for(std::map < std::pair ,MEDCouplingSkyLineArray * >::iterator iter=_entity_corresp.begin(); iter!=_entity_corresp.end();iter++) { iter->second->decrRef(); } @@ -50,11 +50,11 @@ 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(0) + ,_distant_mesh(0) ,_node_corresp(myConnectZone._node_corresp) ,_face_corresp(myConnectZone._face_corresp) ,_entity_corresp(myConnectZone._entity_corresp) - ,_local_mesh(0) - ,_distant_mesh(0) { } @@ -88,9 +88,9 @@ MEDCouplingUMesh *MEDPARTITIONER::ConnectZone::getDistantMesh() const return _distant_mesh; } -bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int distantEntity) const +bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(mcIdType localEntity, mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { if ((iter->first).first==localEntity && (iter->first).second==distantEntity) @@ -99,17 +99,17 @@ bool MEDPARTITIONER::ConnectZone::isEntityCorrespPresent(int localEntity, int di return false; } -const int *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const +const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespIndex() const { return _node_corresp->getIndex(); } -const int *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const +const mcIdType *MEDPARTITIONER::ConnectZone::getNodeCorrespValue() const { return _node_corresp->getValues(); } -int MEDPARTITIONER::ConnectZone::getNodeNumber() const +mcIdType MEDPARTITIONER::ConnectZone::getNodeNumber() const { return _node_corresp->getNumberOf(); } @@ -119,17 +119,17 @@ const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getNodeCorresp() co return (const MEDCouplingSkyLineArray *)_node_corresp; } -const int *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const +const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespIndex() const { return _face_corresp->getIndex(); } -const int *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const +const mcIdType *MEDPARTITIONER::ConnectZone::getFaceCorrespValue() const { return _face_corresp->getValues(); } -int MEDPARTITIONER::ConnectZone::getFaceNumber() const +mcIdType MEDPARTITIONER::ConnectZone::getFaceNumber() const { return _face_corresp->getNumberOf(); } @@ -139,10 +139,10 @@ const MEDCouplingSkyLineArray * MEDPARTITIONER::ConnectZone::getFaceCorresp() co return _face_corresp; } -const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -152,10 +152,10 @@ const int *MEDPARTITIONER::ConnectZone::getEntityCorrespIndex(int localEntity, return 0; } -const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, - int distantEntity) const +const mcIdType *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -165,10 +165,10 @@ const int *MEDPARTITIONER::ConnectZone::getEntityCorrespValue(int localEntity, return 0; } -int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, - int distantEntity) const +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for(map_iter iter=_entity_corresp.begin();iter!=_entity_corresp.end();iter++) { @@ -178,10 +178,10 @@ int MEDPARTITIONER::ConnectZone::getEntityCorrespNumber(int localEntity, return 0; } -int MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, - int distantEntity) const +mcIdType MEDPARTITIONER::ConnectZone::getEntityCorrespLength(mcIdType localEntity, + mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { @@ -192,9 +192,9 @@ int MEDPARTITIONER::ConnectZone::getEntityCorrespLength(int localEntity, } const MEDCouplingSkyLineArray * -MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity) const +MEDPARTITIONER::ConnectZone::getEntityCorresp(mcIdType localEntity, mcIdType distantEntity) const { - typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; + typedef std::map, MEDCouplingSkyLineArray*>::const_iterator map_iter; for (map_iter iter=_entity_corresp.begin(); iter != _entity_corresp.end(); iter++) { @@ -204,11 +204,11 @@ MEDPARTITIONER::ConnectZone::getEntityCorresp(int localEntity, int distantEntity return 0; } -std::vector< std::pair< int,int > > MEDPARTITIONER::ConnectZone::getEntities() const +std::vector< std::pair< mcIdType,mcIdType > > MEDPARTITIONER::ConnectZone::getEntities() const { - std::vector< std::pair< int,int > > types; + std::vector< std::pair< mcIdType,mcIdType > > types; - std::map, MEDCouplingSkyLineArray*>::const_iterator + std::map, MEDCouplingSkyLineArray*>::const_iterator iter = _entity_corresp.begin(); for ( ; iter != _entity_corresp.end(); iter++) { @@ -252,15 +252,15 @@ void MEDPARTITIONER::ConnectZone::setDistantMesh(MEDCouplingUMesh * distantMesh) * the node-node connections * to a MEDCouplingSkyLineArray */ -void MEDPARTITIONER::ConnectZone::setNodeCorresp(const int * nodeCorresp, int nbnode) +void MEDPARTITIONER::ConnectZone::setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode) { - MCAuto indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbnode+1 ); valueArr->alloc( 2*nbnode ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbface+1 ); valueArr->alloc( 2*nbface ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i indexArr( DataArrayInt::New() ); - MCAuto valueArr( DataArrayInt::New() ); + MCAuto indexArr( DataArrayIdType::New() ); + MCAuto valueArr( DataArrayIdType::New() ); indexArr->alloc( nbentity+1 ); valueArr->alloc( 2*nbentity ); - int * index = indexArr->getPointer(); - int * value = valueArr->getPointer(); - for (int i=0; igetPointer(); + mcIdType * value = valueArr->getPointer(); + for (mcIdType i=0; i, MEDCouplingSkyLineArray * >::iterator it; + std::map < std::pair , MEDCouplingSkyLineArray * >::iterator it; it = _entity_corresp.insert ( std::make_pair( std::make_pair(localEntity,distantEntity), nullArray )).first; if ( it->second != nullArray ) it->second->decrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx index ea4ffd3fb..6cf3eff68 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ConnectZone.hxx @@ -22,6 +22,7 @@ #include "MEDPARTITIONER.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" namespace MEDCoupling { @@ -51,26 +52,26 @@ namespace MEDPARTITIONER MEDCouplingUMesh *getLocalMesh() const ; MEDCouplingUMesh *getDistantMesh() const ; - bool isEntityCorrespPresent(int localEntity,int distantEntity) const; - const int *getNodeCorrespIndex() const; - const int *getNodeCorrespValue() const; - int getNodeNumber() const; + bool isEntityCorrespPresent(mcIdType localEntity,mcIdType distantEntity) const; + const mcIdType *getNodeCorrespIndex() const; + const mcIdType *getNodeCorrespValue() const; + mcIdType getNodeNumber() const; const MEDCouplingSkyLineArray * getNodeCorresp() const; - const int *getFaceCorrespIndex() const; - const int *getFaceCorrespValue() const; - int getFaceNumber() const; + const mcIdType *getFaceCorrespIndex() const; + const mcIdType *getFaceCorrespValue() const; + mcIdType getFaceNumber() const; const MEDCouplingSkyLineArray * getFaceCorresp() const; - const int *getEntityCorrespIndex(int localEntity, - int distantEntity) const; - const int *getEntityCorrespValue(int localEntity, - int distantEntity) const; - int getEntityCorrespNumber(int localEntity, - int distantEntity) const; - int getEntityCorrespLength(int localEntity, - int distantEntity) const; - const MEDCouplingSkyLineArray * getEntityCorresp(int localEntity, - int distantEntity) const; - std::vector< std::pair< int,int > > getEntities() const; + const mcIdType *getEntityCorrespIndex(mcIdType localEntity, + mcIdType distantEntity) const; + const mcIdType *getEntityCorrespValue(mcIdType localEntity, + mcIdType distantEntity) const; + mcIdType getEntityCorrespNumber(mcIdType localEntity, + mcIdType distantEntity) const; + mcIdType getEntityCorrespLength(mcIdType localEntity, + mcIdType distantEntity) const; + const MEDCouplingSkyLineArray * getEntityCorresp(mcIdType localEntity, + mcIdType distantEntity) const; + std::vector< std::pair< mcIdType,mcIdType > > getEntities() const; void setName(const std::string& name) ; void setDescription(const std::string& description) ; @@ -79,13 +80,13 @@ namespace MEDPARTITIONER void setLocalMesh(MEDCouplingUMesh * localMesh) ; void setDistantMesh(MEDCouplingUMesh * distantMesh) ; - void setNodeCorresp(const int * nodeCorresp, int nbnode); + void setNodeCorresp(const mcIdType * nodeCorresp, mcIdType nbnode); void setNodeCorresp(MEDCouplingSkyLineArray* array); - void setFaceCorresp(const int * faceCorresp, int nbface); + void setFaceCorresp(const mcIdType * faceCorresp, mcIdType nbface); void setFaceCorresp(MEDCouplingSkyLineArray* array); - void setEntityCorresp(int localEntity, int distantEntity, - const int * entityCorresp, int nbentity); - void setEntityCorresp(int localEntity, int distantEntity, + void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity, + const mcIdType * entityCorresp, mcIdType nbentity); + void setEntityCorresp(mcIdType localEntity, mcIdType distantEntity, MEDCouplingSkyLineArray *array); private : std::string _name; @@ -99,7 +100,7 @@ namespace MEDPARTITIONER MCAuto _node_corresp; MCAuto _face_corresp; - std::map < std::pair , MEDCouplingSkyLineArray * > _entity_corresp; + std::map < std::pair , MEDCouplingSkyLineArray * > _entity_corresp; }; } # endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 51e7ee7af..17df2fc01 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -43,22 +43,22 @@ namespace MEDPARTITIONER int Graph::nbDomains() const { - std::set domains; + std::set domains; if ( _partition.isNotNull() ) - if ( MEDCoupling::DataArrayInt* array = _partition->getValuesArray() ) + if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() ) { - for ( const int * dom = array->begin(); dom != array->end(); ++dom ) + for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom ) domains.insert( *dom ); } - return domains.size(); + return (int)domains.size(); } - const int *Graph::getPart() const + const mcIdType *Graph::getPart() const { return _partition->getValues(); } - int Graph::nbVertices() const + mcIdType Graph::nbVertices() const { return _graph->getNumberOf(); } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx index 605718bd9..c860416e6 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx @@ -22,6 +22,7 @@ #include "MEDPARTITIONER.hxx" #include "MCAuto.hxx" +#include "MCType.hxx" #include @@ -52,14 +53,14 @@ namespace MEDPARTITIONER virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0; //returns the partitioning - const int *getPart() const; + const mcIdType *getPart() const; //returns the number of graph vertices (which can correspond to the cells in the mesh!) - int nbVertices() const; + mcIdType nbVertices() const; // returns nb of domains in _partition int nbDomains() const; - + const MEDCouplingSkyLineArray *getGraph() const { return (const MEDCouplingSkyLineArray*)_graph; } const MEDCouplingSkyLineArray *getPartition() const { return (const MEDCouplingSkyLineArray*)_partition; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx index 9e02fd968..36aa24052 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.cxx @@ -50,9 +50,9 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() int nbproc=_domain_selector->nbProcs(); std::vector bbtree(nbdomain,(BBTreeOfDim*) 0); std::vector bbxi(nbdomain,(double*) 0); - std::vector rev(nbdomain,(MEDCoupling::DataArrayInt*) 0); - std::vector revIndx(nbdomain,(MEDCoupling::DataArrayInt*) 0); - int meshDim=-1; + std::vector rev(nbdomain,(MEDCoupling::DataArrayIdType*) 0); + std::vector revIndx(nbdomain,(MEDCoupling::DataArrayIdType*) 0); + //int meshDim=-1; int spaceDim=-1; //init rev and revIndx and bbtree for my domain (of me:proc n) @@ -61,10 +61,10 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() if(!_domain_selector->isMyDomain(mydomain)) continue; const MEDCoupling::MEDCouplingUMesh* myMesh=_mesh_collection.getMesh(mydomain); - meshDim = myMesh->getMeshDimension(); + //meshDim = myMesh->getMeshDimension(); spaceDim= myMesh->getSpaceDimension(); - rev[mydomain] = MEDCoupling::DataArrayInt::New(); - revIndx[mydomain] = MEDCoupling::DataArrayInt::New(); + rev[mydomain] = MEDCoupling::DataArrayIdType::New(); + revIndx[mydomain] = MEDCoupling::DataArrayIdType::New(); myMesh->getReverseNodalConnectivity(rev[mydomain],revIndx[mydomain]); double* bbx=new double[2*spaceDim*myMesh->getNumberOfNodes()]; for (int i=0; igetNumberOfNodes()*spaceDim; i++) @@ -97,7 +97,7 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() SendDoubleVec(vec,targetProc); //retrieving target data for storage in commonDistantNodes array - std::vector localCorrespondency; + std::vector localCorrespondency; RecvIntVec(localCorrespondency, targetProc); for (std::size_t i=0; i recvVec; RecvDoubleVec(recvVec,sourceProc); - std::map commonNodes; // (local nodes, distant nodes) list - for (int inode=0; inode<(recvVec.size()/spaceDim); inode++) + std::map commonNodes; // (local nodes, distant nodes) list + for (mcIdType inode=0; inode inodes; + std::vector inodes; bbtree[itarget]->getIntersectingElems(bbox,inodes); delete [] bbox; @@ -131,16 +131,16 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() } } - std::vector nodeCellCorrespondency; - for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) + std::vector nodeCellCorrespondency; + for (std::map::iterator iter=commonNodes.begin(); iter!=commonNodes.end(); iter++) { _node_node[itarget][isource].push_back(std::make_pair(iter->first, iter->second));//storing node pairs in a vector - const int* revIndxPtr=revIndx[itarget]->getConstPointer(); - const int* revPtr=rev[itarget]->getConstPointer(); - for (int icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) + const mcIdType* revIndxPtr=revIndx[itarget]->getConstPointer(); + const mcIdType* revPtr=rev[itarget]->getConstPointer(); + for (mcIdType icell=revIndxPtr[iter->first]; icellfirst+1]; icell++) { nodeCellCorrespondency.push_back(iter->second); // - int globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); + mcIdType globalCell=_topology->convertCellToGlobal(itarget,revPtr[icell]); nodeCellCorrespondency.push_back(globalCell); } } @@ -166,12 +166,12 @@ void MEDPARTITIONER::JointFinder::findCommonDistantNodes() std::cout << "proc " << _domain_selector->rank() << " : end JointFinder::findCommonDistantNodes" << std::endl; } -std::vector > >& MEDPARTITIONER::JointFinder::getDistantNodeCell() +std::vector > >& MEDPARTITIONER::JointFinder::getDistantNodeCell() { return _distant_node_cell; } -std::vector > > >& MEDPARTITIONER::JointFinder::getNodeNode() +std::vector > > >& MEDPARTITIONER::JointFinder::getNodeNode() { return _node_node; } @@ -200,7 +200,7 @@ void MEDPARTITIONER::JointFinder::print() { for (int itarget=0; itarget::iterator it; + std::multimap::iterator it; for (it=_distant_node_cell[isource][itarget].begin() ; it!=_distant_node_cell[isource][itarget].end(); it++) { std::cout << " nc" << _domain_selector->rank() << "|" << itarget << "|" << isource << "|" << (*it).first << "=" << (*it).second; diff --git a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx index a83d3449a..ed51e926c 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_JointFinder.hxx @@ -21,6 +21,7 @@ #define __MEDPARTITIONER_JOINTFINDER_HXX__ #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include #include @@ -38,14 +39,14 @@ namespace MEDPARTITIONER ~JointFinder(); void findCommonDistantNodes(); void print(); - std::vector > >& getDistantNodeCell(); - std::vector > > >& getNodeNode(); + std::vector > >& getDistantNodeCell(); + std::vector > > >& getNodeNode(); private: const MeshCollection& _mesh_collection; const ParaDomainSelector *_domain_selector; const Topology *_topology; - std::vector > > _distant_node_cell; - std::vector > > > _node_node; + std::vector > > _distant_node_cell; + std::vector > > > _node_node; }; } diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 130ffc701..bbaba7b05 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -105,8 +105,8 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection _create_empty_groups(create_empty_groups), _joint_finder(0) { - std::vector > > new2oldIds(initialCollection.getTopology()->nbDomain()); - std::vector o2nRenumber; + std::vector > > new2oldIds(initialCollection.getTopology()->nbDomain()); + std::vector o2nRenumber; castCellMeshes(initialCollection, new2oldIds, o2nRenumber ); @@ -127,7 +127,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection //nodeMapping contains the mapping between old nodes and new nodes // (iolddomain,ioldnode)->(inewdomain,inewnode) createNodeMapping(initialCollection, nodeMapping); - std::vector > > new2oldFaceIds; + std::vector > > new2oldFaceIds; castFaceMeshes(initialCollection, nodeMapping, new2oldFaceIds); //////////////////// @@ -175,7 +175,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(MeshCollection& initialCollection castAllFields(initialCollection,"cellFieldDouble"); if (_i_non_empty_mesh<0) { - for (size_t i=0; i<_mesh.size(); i++) + for (int i=0; i > >& new2oldIds, - std::vector & o2nRenumber) + std::vector > >& new2oldIds, + std::vector & o2nRenumber) { if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : castCellMeshes" << std::endl; @@ -231,10 +231,10 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle { if (!isParallelMode() || initialCollection._domain_selector->isMyDomain(iold)) { - int size=(initialCollection._mesh)[iold]->getNumberOfCells(); - std::vector globalids(size); + mcIdType size=(initialCollection._mesh)[iold]->getNumberOfCells(); + std::vector globalids(size); initialCollection.getTopology()->getCellList(iold, &globalids[0]); - std::vector ilocalnew(size); //local + std::vector ilocalnew(size); //local std::vector ipnew(size); //idomain old _topology->convertGlobalCellList(&globalids[0],size,&ilocalnew[0],&ipnew[0]); @@ -299,10 +299,10 @@ void MEDPARTITIONER::MeshCollection::castCellMeshes(MeshCollection& initialColle _mesh[inew]=MEDCoupling::MEDCouplingUMesh::MergeUMeshes(meshes); o2nRenumber[inew]=_mesh[inew]->sortCellsInMEDFileFrmt(); bool areNodesMerged; - int nbNodesMerged; + mcIdType nbNodesMerged; if (meshes.size()>1) { - MEDCoupling::DataArrayInt* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged); + MEDCoupling::DataArrayIdType* array=_mesh[inew]->mergeNodes(1e-12,areNodesMerged,nbNodesMerged); array->decrRef(); // array is not used in this case } _mesh[inew]->zipCoords(); @@ -336,8 +336,8 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC // std::map >, int > nodeClassifier; MEDCoupling::DataArrayDouble* coords = initialCollection.getMesh(iold)->getCoords(); double* coordsPtr=coords->getPointer(); - dim = coords->getNumberOfComponents(); - int nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); + dim = (int)coords->getNumberOfComponents(); + mcIdType nvertices=initialCollection.getMesh(iold)->getNumberOfNodes(); bbox=new double[nvertices*2*dim]; for (int i=0; igetNumberOfNodes();inode++) { double* coordsPtr=coords->getPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr,elems); if (elems.size()==0) continue; nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode))); @@ -378,7 +378,7 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC for (int inode=0; inode<_mesh[inew]->getNumberOfNodes();inode++) { double* coordsPtr=coords->getPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr,elems); if (elems.size()==0) continue; nodeMapping.insert(make_pair(make_pair(iold,elems[0]),make_pair(inew,inode))); @@ -394,16 +394,16 @@ void MEDPARTITIONER::MeshCollection::createNodeMapping( MeshCollection& initialC } -void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector& nodeIds) +void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCouplingUMesh& meshTwo, std::vector& nodeIds) { using std::vector; using MEDPARTITIONER::BBTreeOfDim; //if (!&meshOne || !&meshTwo) return; //empty or not existing double* bbox; BBTreeOfDim* tree = 0; - int nv1=meshOne.getNumberOfNodes(); + mcIdType nv1=meshOne.getNumberOfNodes(); MEDCoupling::DataArrayDouble* coords=meshOne.getCoords(); - int dim = coords->getNumberOfComponents(); + int dim = (int)coords->getNumberOfComponents(); bbox=new double[nv1*2*dim]; double* coordsPtr=coords->getPointer(); @@ -414,13 +414,13 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling } tree=new BBTreeOfDim( dim, bbox,0,0,nv1,1e-9); - int nv2=meshTwo.getNumberOfNodes(); + mcIdType nv2=meshTwo.getNumberOfNodes(); nodeIds.resize(nv2,-1); coords=meshTwo.getCoords(); for (int inode=0; inodegetPointer()+inode*dim; - vector elems; + vector elems; tree->getElementsAroundPoint(coordsPtr2,elems); if (elems.size()==0) continue; nodeIds[inode]=elems[0]; @@ -434,8 +434,8 @@ void getNodeIds(MEDCoupling::MEDCouplingUMesh& meshOne, MEDCoupling::MEDCoupling faces at the interface are duplicated */ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialCollection, - const std::multimap, std::pair >& nodeMapping, - std::vector > >& new2oldIds) + const std::multimap, std::pair >& nodeMapping, + std::vector > >& new2oldIds) { //splitMeshes structure will contain the partition of //the old faces on the new ones @@ -489,12 +489,12 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle //initial face mesh known : in my domain if (meshesCastFrom[iold] != 0) { - for (int ielem=0; ielemgetNumberOfCells(); ielem++) + for (mcIdType ielem=0; ielemgetNumberOfCells(); ielem++) { - vector nodes; + vector nodes; meshesCastFrom[iold]->getNodeIdsOfCell(ielem,nodes); - map faces; + map faces; //analysis of element ielem //counters are set for the element @@ -502,10 +502,10 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle //are incremented for each target node //the face is considered as going to target domains if the counter of the domain //is equal to the number of nodes - for (int inode=0; inode<(int)nodes.size(); inode++) + for (std::size_t inode=0; inode,pair >::const_iterator MI; - int mynode=nodes[inode]; + typedef multimap,pair >::const_iterator MI; + mcIdType mynode=nodes[inode]; pair myRange = nodeMapping.equal_range(make_pair(iold,mynode)); for (MI iter=myRange.first; iter!=myRange.second; iter++) @@ -518,9 +518,9 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle } } - for (map::iterator iter=faces.begin(); iter!=faces.end(); iter++) + for (map::iterator iter=faces.begin(); iter!=faces.end(); iter++) { - if (iter->second==(int)nodes.size()) + if (iter->second==ToIdType(nodes.size())) //cvw eligible but may be have to be face of a cell of this->getMesh()[inew]? //it is not sure here... //done before writeMedfile on option?... see filterFaceOnCell() @@ -635,13 +635,13 @@ void MEDPARTITIONER::MeshCollection::castFaceMeshes(MeshCollection& initialColle void MEDPARTITIONER::MeshCollection::castIntField(std::vector& meshesCastFrom, std::vector& meshesCastTo, - std::vector& arrayFrom, + std::vector& arrayFrom, std::string nameArrayTo) { using std::vector; - int ioldMax=meshesCastFrom.size(); - int inewMax=meshesCastTo.size(); + std::size_t ioldMax=meshesCastFrom.size(); + std::size_t inewMax=meshesCastTo.size(); //preparing bounding box trees for accelerating source-target node identifications @@ -649,7 +649,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vector acceleratingStructures(ioldMax); std::vectorbbox(ioldMax); - for (int iold =0; iold< ioldMax; iold++) + for (unsigned int iold =0; iold< ioldMax; iold++) if (isParallelMode() && _domain_selector->isMyDomain(iold)) { MEDCoupling::DataArrayDouble* sourceCoords=meshesCastFrom[iold]->computeCellCenterOfMass(); @@ -659,9 +659,9 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && !_domain_selector->isMyDomain(inew)) @@ -669,8 +669,8 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorsendMesh(*meshesCastFrom[iold],_domain_selector->getProcessorID(inew)); //send vector - int size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1! - vectorsendIds; + mcIdType size=arrayFrom[iold]->getNumberOfTuples(); //cvw may be -1! + vector sendIds; if (MyGlobals::_Verbose>400) std::cout<<"proc "<<_domain_selector->rank()<<" : castIntField SendIntVec size "<0) //no empty { @@ -688,7 +688,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && _domain_selector->isMyDomain(inew)) { //receive mesh - vector recvIds; + vector recvIds; MEDCoupling::MEDCouplingUMesh* recvMesh; _domain_selector->recvMesh(recvMesh,_domain_selector->getProcessorID(iold)); //receive vector @@ -701,16 +701,16 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorisMyDomain(iold) && _domain_selector->isMyDomain(inew))) { remapIntField(inew,iold,*meshesCastFrom[iold],*meshesCastTo[inew],arrayFrom[iold]->getConstPointer(),nameArrayTo,acceleratingStructures[iold]); } } - for (int iold=0; ioldisMyDomain(iold)) { bbox[iold]->decrRef(); @@ -721,7 +721,7 @@ void MEDPARTITIONER::MeshCollection::castIntField(std::vectorgetConstPointer(); - int targetSize=targetMesh.getNumberOfCells(); - int sourceSize=sourceMesh.getNumberOfCells(); + mcIdType targetSize=targetMesh.getNumberOfCells(); + mcIdType sourceSize=sourceMesh.getNumberOfCells(); if (MyGlobals::_Verbose>200) std::cout<<"remap vers target de taille "< ccI; + std::vector ccI; std::string str,cle; str=nameArrayTo+"_toArray"; cle=Cle1ToStr(str,inew); - int* toArray; + mcIdType* toArray; const BBTreeOfDim* tree; bool cleantree=false; MEDCoupling::DataArrayDouble* sourceBBox=0; - int dim = targetCoords->getNumberOfComponents(); + int dim = (int)targetCoords->getNumberOfComponents(); if (myTree==0) { sourceBBox=sourceMesh.computeCellCenterOfMass()->computeBBoxPerTuple(1e-8); @@ -755,7 +755,7 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, { if (MyGlobals::_Is0verbose>100) std::cout << "create " << cle << " size " << targetSize << std::endl; - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc(targetSize,1); p->fillWithZero(); toArray=p->getPointer(); @@ -766,16 +766,16 @@ void MEDPARTITIONER::MeshCollection::remapIntField(int inew, int iold, toArray=_map_dataarray_int.find(cle)->second->getPointer(); } - std::map< int, int > isource2nb; // count coincident elements - std::map::iterator i2nb; + std::map< mcIdType, int > isource2nb; // count coincident elements + std::map< mcIdType, int>::iterator i2nb; - for (int itargetnode=0; itargetnode intersectingElems; + std::vector intersectingElems; tree->getElementsAroundPoint(tc+itargetnode*dim,intersectingElems); if (intersectingElems.size()!=0) { - int isourcenode=intersectingElems[0]; + mcIdType isourcenode=intersectingElems[0]; if ( intersectingElems.size() > 1 ) { i2nb = isource2nb.insert( std::make_pair( isourcenode, 0 )).first; @@ -810,21 +810,21 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec std::string nameTo="typeData=6"; //resume the type of field casted // send-recv operations - int ioldMax=initialCollection.getMesh().size(); - int inewMax=this->getMesh().size(); - int 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 (int ifield=0; ifieldisMyDomain(iold) && !_domain_selector->isMyDomain(inew)) @@ -849,9 +849,9 @@ void MEDPARTITIONER::MeshCollection::castAllFields(MeshCollection& initialCollec } #endif //local contributions and aggregation - for (int inew=0; inewisMyDomain(iold) && _domain_selector->isMyDomain(inew))) { MEDCoupling::DataArrayDouble* field=initialCollection.getField(descriptionField,iold); @@ -871,7 +871,7 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, throw INTERP_KERNEL::Exception("Error remapDoubleField only on cellFieldDouble"); std::string key=Cle2ToStr("cellFamily_ccI",inew,iold); - std::map::iterator it1; + std::map::iterator it1; it1=_map_dataarray_int.find(key); if (it1==_map_dataarray_int.end()) { @@ -880,19 +880,19 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, return; } //create ccI in remapIntField - MEDCoupling::DataArrayInt *ccI=it1->second; + MEDCoupling::DataArrayIdType *ccI=it1->second; if (MyGlobals::_Verbose>300) std::cout << "proc " << MyGlobals::_Rank << " : remapDoubleField " << key << " size " << ccI->getNbOfElems() << std::endl; - int nbcell=this->getMesh()[inew]->getNumberOfCells(); - int nbcomp=fromArray->getNumberOfComponents(); + 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); - int fromArrayNbOfElem=fromArray->getNbOfElems(); - int fromArrayNbOfComp=fromArray->getNumberOfComponents(); - int fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; + mcIdType fromArrayNbOfElem=fromArray->getNbOfElems(); + mcIdType fromArrayNbOfComp=ToIdType(fromArray->getNumberOfComponents()); + mcIdType fromArrayNbOfCell=fromArrayNbOfElem/fromArrayNbOfComp/nbPtGauss; if (MyGlobals::_Verbose>1000) { @@ -933,20 +933,20 @@ void MEDPARTITIONER::MeshCollection::remapDoubleField(int inew, int iold, else { //replaced by setPartOfValuesAdv if nbPtGauss==1 - int iMax=ccI->getNbOfElems(); - int* pccI=ccI->getPointer(); + mcIdType iMax=ccI->getNbOfElems(); + mcIdType* pccI=ccI->getPointer(); double* pField=field->getPointer(); double* pFrom=fromArray->getPointer(); - int itarget, isource, delta=nbPtGauss*nbcomp; - for (int i=0; i=nbcell) || (isource<0) || (isource>=fromArrayNbOfCell)) throw INTERP_KERNEL::Exception("Error field override"); - int ita=itarget*delta; - int iso=isource*delta; - for (int k=0; k renumN2O = ids1->buildPermArrPerLevel(); + MCAuto< DataArrayIdType > renumN2O = ids1->buildPermArrPerLevel(); ids1->renumberInPlaceR( renumN2O->begin() ); ids2->renumberInPlaceR( renumN2O->begin() ); @@ -982,7 +982,7 @@ namespace } if ( delta != 0 ) { - int * id = ids1->getPointer(); + mcIdType * id = ids1->getPointer(); for ( ; id < ids1->end(); ++id ) ++(*id); id = ids2->getPointer(); @@ -991,7 +991,7 @@ namespace } // join - DataArrayInt* ids12 = DataArrayInt::Meld( ids1, ids2 ); // two components + DataArrayIdType* ids12 = DataArrayIdType::Meld( ids1, ids2 ); // two components ids12->rearrange( 1 ); // make one component return ids12; } @@ -1004,12 +1004,12 @@ namespace */ //================================================================================ - void renumber( DataArrayInt* ids, const DataArrayInt* o2nRenumber ) + void renumber( DataArrayIdType* ids, const DataArrayIdType* o2nRenumber ) { if ( !ids || !o2nRenumber ) return; - int * id = ids->getPointer(); - const int * o2n = o2nRenumber->getConstPointer(); + mcIdType * id = ids->getPointer(); + const mcIdType * o2n = o2nRenumber->getConstPointer(); for ( ; id < ids->end(); ++id ) { *id = o2n[ *id ]; @@ -1029,7 +1029,7 @@ namespace //================================================================================ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeMapping, - const std::vector & o2nRenumber, + const std::vector & o2nRenumber, int nbInitialDomains) { if ( !MyGlobals::_Create_Joints || _topology->nbDomain() < 2 ) @@ -1053,7 +1053,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // 1) add node correspondences // ================================== - std::vector< std::vector< std::vector< int > > > nodeCorresp( nb_domains ); + std::vector< std::vector< std::vector< mcIdType > > > nodeCorresp( nb_domains ); for ( int idomain = 0; idomain < nb_domains; ++idomain ) { nodeCorresp[ idomain ].resize( nb_domains ); @@ -1076,11 +1076,11 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM if ( ++nmIt2 == nmEnd ) break; int dom1 = nmIt1->second.first; - int node1 = nmIt1->second.second; + mcIdType node1 = nmIt1->second.second; for ( ; nmIt2 != nmEnd; ++nmIt2 ) { int dom2 = nmIt2->second.first; - int node2 = nmIt2->second.second; + mcIdType node2 = nmIt2->second.second; if ( dom1 != dom2 ) { nodeCorresp[ dom1 ][ dom2 ].push_back( node1 ); @@ -1101,7 +1101,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM { for ( int idomainNear = 0; idomainNear < nb_domains; ++idomainNear ) { - std::vector< int > & corresp = nodeCorresp[ idomain ][ idomainNear ]; + std::vector< mcIdType > & corresp = nodeCorresp[ idomain ][ idomainNear ]; if ( corresp.empty() ) continue; @@ -1121,7 +1121,7 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM czVec.push_back(cz); } - cz->setNodeCorresp( &corresp[0], corresp.size()/2 ); + cz->setNodeCorresp( &corresp[0], ToIdType( corresp.size()/2 )); } } @@ -1142,8 +1142,8 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getEntityCorresp( 0, 0 ); - const DataArrayInt* ids12 = corrArray->getValuesArray(); - MCAuto ids1, ids2, ids12Sorted; + const DataArrayIdType* ids12 = corrArray->getValuesArray(); + MCAuto ids1, ids2, ids12Sorted; ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); @@ -1180,13 +1180,13 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM } else // split and sort { - typedef std::pair< std::vector< int >, std::vector< int > > T2Vecs; + typedef std::pair< std::vector< mcIdType >, std::vector< mcIdType > > T2Vecs; T2Vecs idsByType[ INTERP_KERNEL::NORM_MAXTYPE ][ INTERP_KERNEL::NORM_MAXTYPE ]; int t1, t2; - const int nbIds = ids1->getNbOfElems(); - const int * p1 = ids1->begin(), * p2 = ids2->begin(); - for ( int i = 0; i < nbIds; ++i ) + const mcIdType nbIds = ids1->getNbOfElems(); + const mcIdType * p1 = ids1->begin(), * p2 = ids2->begin(); + for ( mcIdType i = 0; i < nbIds; ++i ) { t1 = mesh1->getTypeOfCell( p1[ i ]); t2 = mesh2->getTypeOfCell( p2[ i ]); @@ -1252,8 +1252,8 @@ void MEDPARTITIONER::MeshCollection::buildConnectZones( const NodeMapping& nodeM // separate ids of two domains const MEDCoupling::MEDCouplingSkyLineArray *corrArray = cz->getNodeCorresp(); - const DataArrayInt *ids12 = corrArray->getValuesArray(); - MCAuto ids1, ids2, ids12Sorted; + const DataArrayIdType *ids12 = corrArray->getValuesArray(); + MCAuto ids1, ids2, ids12Sorted; ids1 = ids12->selectByTupleIdSafeSlice( 0, corrArray->getLength(), 2 ); ids2 = ids12->selectByTupleIdSafeSlice( 1, corrArray->getLength(), 2 ); @@ -1288,12 +1288,12 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() using MEDCoupling::DataArrayInt; std::vector& faceMeshes = getFaceMesh(); - int nbMeshes = faceMeshes.size(); + std::size_t nbMeshes = faceMeshes.size(); //preparing bounding box trees for accelerating search of coincident faces std::vector bbTrees(nbMeshes); std::vectorbbox (nbMeshes); - for (int inew = 0; inew < nbMeshes-1; inew++) + for (unsigned int inew = 0; inew < nbMeshes-1; inew++) if ( !isParallelMode() || _domain_selector->isMyDomain(inew) ) { DataArrayDouble* bcCoords = faceMeshes[inew]->computeCellCenterOfMass(); @@ -1305,9 +1305,9 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() } // loop on domains to find joint faces between them - for (int inew1 = 0; inew1 < nbMeshes; inew1++ ) + for (unsigned int inew1 = 0; inew1 < nbMeshes; inew1++ ) { - for (int inew2 = inew1+1; inew2 < nbMeshes; inew2++ ) + for (unsigned int inew2 = inew1+1; inew2 < nbMeshes; inew2++ ) { MEDCouplingUMesh* mesh1 = 0; MEDCouplingUMesh* mesh2 = 0; @@ -1338,22 +1338,22 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() if ( mesh2Here && !mesh2 ) mesh2 = faceMeshes[ inew2 ]; // find coincident faces - std::vector< int > faces1, faces2; + std::vector< mcIdType > faces1, faces2; if ( mesh1 && mesh2 ) { const DataArrayDouble* coords2 = mesh2->computeCellCenterOfMass(); - const double* c2 = coords2->getConstPointer(); - const int dim = coords2->getNumberOfComponents(); - const int nbFaces2 = mesh2->getNumberOfCells(); - const int nbFaces1 = mesh1->getNumberOfCells(); + const double* c2 = coords2->getConstPointer(); + const std::size_t dim = coords2->getNumberOfComponents(); + const mcIdType nbFaces2 = mesh2->getNumberOfCells(); + const mcIdType nbFaces1 = mesh1->getNumberOfCells(); - for (int i2 = 0; i2 < nbFaces2; i2++) + for (mcIdType i2 = 0; i2 < nbFaces2; i2++) { - std::vector coincFaces; + std::vector coincFaces; bbTrees[inew1]->getElementsAroundPoint( c2+i2*dim, coincFaces ); if (coincFaces.size()!=0) { - int i1 = coincFaces[0]; + mcIdType i1 = coincFaces[0]; // if ( coincFaces.size() > 1 ) // { // i2nb = isource2nb.insert( std::make_pair( i1 , 0 )).first; @@ -1399,7 +1399,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() // delete bounding box trees - for (int inew = 0; inew < nbMeshes-1; inew++) + for (unsigned int inew = 0; inew < nbMeshes-1; inew++) if (isParallelMode() && _domain_selector->isMyDomain(inew)) { bbox[inew]->decrRef(); @@ -1417,7 +1417,7 @@ void MEDPARTITIONER::MeshCollection::buildBoundaryFaces() */ //================================================================================ -void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& faces, +void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< mcIdType >& faces, const int inew1, const int inew2, const bool is2nd ) @@ -1437,15 +1437,15 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& _group_info.erase( groupName ); // get family IDs array - int* famIDs = 0; + mcIdType* famIDs = 0; int inew = (is2nd ? inew2 : inew1 ); - int totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0; + mcIdType totalNbFaces = _face_mesh[ inew ] ? _face_mesh[ inew ]->getNumberOfCells() : 0; std::string cle = Cle1ToStr( "faceFamily_toArray", inew ); if ( !_map_dataarray_int.count(cle) ) { if ( totalNbFaces > 0 ) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc( totalNbFaces, 1 ); p->fillWithZero(); famIDs = p->getPointer(); @@ -1457,14 +1457,14 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& famIDs = _map_dataarray_int.find(cle)->second->getPointer(); } // find a family ID of an existing JOINT group - int familyID = 0; - std::map::iterator name2id = _family_info.find( groupName ); + mcIdType familyID = 0; + std::map::iterator name2id = _family_info.find( groupName ); if ( name2id != _family_info.end() ) familyID = name2id->second; // remove faces from the familyID-the family if ( familyID != 0 && famIDs ) - for ( int i = 0; i < totalNbFaces; ++i ) + for ( mcIdType i = 0; i < totalNbFaces; ++i ) if ( famIDs[i] == familyID ) famIDs[i] = 0; @@ -1473,7 +1473,7 @@ void MEDPARTITIONER::MeshCollection::createJointGroup( const std::vector< int >& if ( familyID == 0 ) // generate a family ID for JOINT group { - std::set< int > familyIDs; + std::set< mcIdType > familyIDs; for ( name2id = _family_info.begin(); name2id != _family_info.end(); ++name2id ) familyIDs.insert( name2id->second ); // find the next free family ID @@ -1535,7 +1535,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename) throw INTERP_KERNEL::Exception("file does not comply with any recognized format"); } } - for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain ) + for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain ) if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 ) _i_non_empty_mesh = idomain; } @@ -1654,7 +1654,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para } } // find non-empty domain mesh - for ( int idomain = 0; idomain < (int)_mesh.size(); ++idomain ) + for ( unsigned int idomain = 0; idomain < _mesh.size(); ++idomain ) if ( _mesh[idomain] && _mesh[idomain]->getNumberOfNodes() > 0 ) _i_non_empty_mesh = idomain; @@ -1733,22 +1733,22 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, cons MEDPARTITIONER::MeshCollection::~MeshCollection() { - for (int i=0; i<(int)_mesh.size();i++) + for (std::size_t i=0; i<_mesh.size();i++) if (_mesh[i]!=0) _mesh[i]->decrRef(); - for (int i=0; i<(int)_cell_family_ids.size();i++) + for (std::size_t i=0; i<_cell_family_ids.size();i++) if (_cell_family_ids[i]!=0) _cell_family_ids[i]->decrRef(); - for (int i=0; i<(int)_face_mesh.size();i++) + for (std::size_t i=0; i<_face_mesh.size();i++) if (_face_mesh[i]!=0) _face_mesh[i]->decrRef(); - for (int i=0; i<(int)_face_family_ids.size();i++) + 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::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ ) + for (std::map::iterator it=_map_dataarray_int.begin() ; it!=_map_dataarray_int.end(); it++ ) if ((*it).second!=0) (*it).second->decrRef(); @@ -1830,9 +1830,9 @@ int MEDPARTITIONER::MeshCollection::getNbOfLocalMeshes() const return nb; } -int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const +mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const { - int nb=0; + mcIdType nb=0; for (size_t i=0; i<_mesh.size(); i++) { if (_mesh[i]) nb=nb+_mesh[i]->getNumberOfCells(); @@ -1840,9 +1840,9 @@ int MEDPARTITIONER::MeshCollection::getNbOfLocalCells() const return nb; } -int MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const +mcIdType MEDPARTITIONER::MeshCollection::getNbOfLocalFaces() const { - int nb=0; + mcIdType nb=0; for (size_t i=0; i<_face_mesh.size(); i++) { if (_face_mesh[i]) nb=nb+_face_mesh[i]->getNumberOfCells(); @@ -1919,8 +1919,8 @@ void MEDPARTITIONER::MeshCollection::buildCellGraph(MEDCoupling::MEDCouplingSkyL //looking for reverse nodal connectivity i global numbering if (isParallelMode() && !_domain_selector->isMyDomain(0)) { - vector value; - vector index(1,0); + vector value; + vector index(1,0); array = MEDCoupling::MEDCouplingSkyLineArray::New(index,value); return; @@ -1940,11 +1940,11 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup using std::make_pair; using std::pair; - std::multimap< int, int > node2cell; - std::map< pair, int > cell2cellcounter; - std::multimap cell2cell; + std::multimap< mcIdType, mcIdType > node2cell; + std::map< pair, mcIdType > cell2cellcounter; + std::multimap cell2cell; - std::vector > > commonDistantNodes; + std::vector > > commonDistantNodes; int nbdomain=_topology->nbDomain(); #ifdef HAVE_MPI if (isParallelMode()) @@ -1968,21 +1968,21 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup continue; meshDim = _mesh[idomain]->getMeshDimension(); - MEDCoupling::DataArrayInt* index=MEDCoupling::DataArrayInt::New(); - MEDCoupling::DataArrayInt* revConn=MEDCoupling::DataArrayInt::New(); - int nbNodes=_mesh[idomain]->getNumberOfNodes(); + MEDCoupling::DataArrayIdType* index=MEDCoupling::DataArrayIdType::New(); + MEDCoupling::DataArrayIdType* revConn=MEDCoupling::DataArrayIdType::New(); + mcIdType nbNodes=_mesh[idomain]->getNumberOfNodes(); _mesh[idomain]->getReverseNodalConnectivity(revConn,index); //problem saturation over 1 000 000 nodes for 1 proc if (MyGlobals::_Verbose>100) std::cout << "proc " << MyGlobals::_Rank << " : getReverseNodalConnectivity done on " << nbNodes << " nodes" << std::endl; - int* index_ptr=index->getPointer(); - int* revConnPtr=revConn->getPointer(); - for (int i=0; igetPointer(); + mcIdType* revConnPtr=revConn->getPointer(); + for (mcIdType i=0; iconvertNodeToGlobal(idomain,i); - int 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)); } } @@ -1991,14 +1991,14 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup #ifdef HAVE_MPI for (int iother=0; iother::iterator it; + std::multimap::iterator it; int isource=idomain; int itarget=iother; for (it=_joint_finder->getDistantNodeCell()[isource][itarget].begin(); it!=_joint_finder->getDistantNodeCell()[isource][itarget].end(); it++) { - int globalNode=_topology->convertNodeToGlobal(idomain,(*it).first); - int globalCell=(*it).second; + mcIdType globalNode=_topology->convertNodeToGlobal(idomain,(*it).first); + mcIdType globalCell=(*it).second; node2cell.insert(make_pair(globalNode, globalCell)); } } @@ -2018,32 +2018,32 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup if (MyGlobals::_Verbose>50) std::cout<< "proc " << MyGlobals::_Rank << " : creating graph arcs on nbNodes " << _topology->nbNodes() << std::endl; - for (int inode=0;inode<_topology->nbNodes();inode++) + for (mcIdType inode=0;inode<_topology->nbNodes();inode++) { - typedef multimap::const_iterator MI; + typedef multimap::const_iterator MI; std::pair nodeRange=node2cell.equal_range(inode); for (MI cell1=nodeRange.first;cell1!=nodeRange.second;cell1++) for (MI cell2=nodeRange.first;cell2!=cell1;cell2++) { - int icell1=cell1->second; - int icell2=cell2->second; - if (icell1>icell2) {int tmp=icell1; icell1=icell2; icell2=tmp;} - std::map,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); + mcIdType icell1=cell1->second; + mcIdType icell2=cell2->second; + if (icell1>icell2) std::swap(icell1,icell2); + std::map,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1)); else (it->second)++; } } - // for (int icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes + // for (mcIdType icell1=0; icell1<_topology->nbCells(); icell1++) //on all nodes // { - // typedef multimap::const_iterator MI; + // typedef multimap::const_iterator MI; // std::pair nodeRange=cell2node.equal_range(icell1); // for (MI node1=nodeRange.first; node1!=nodeRange.second; node1++) //on nodes with icell // { // std::pair cellRange=node2cell.equal_range(node1->second); // for (MI cell2=cellRange.first; cell2!=cellRange.second; cell2++) //on one of these cell // { - // int icell2=cell2->second; - // std::map,int>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); + // mcIdType icell2=cell2->second; + // std::map,mcIdType>::iterator it=cell2cellcounter.find(make_pair(icell1,icell2)); // if (it==cell2cellcounter.end()) cell2cellcounter.insert(make_pair(make_pair(icell1,icell2),1)); // else (it->second)++; // } @@ -2052,7 +2052,7 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup //converting the counter to a multimap structure - for (std::map,int>::const_iterator it=cell2cellcounter.begin(); + for (std::map,mcIdType>::const_iterator it=cell2cellcounter.begin(); it!=cell2cellcounter.end(); it++) if (it->second>=meshDim) @@ -2065,25 +2065,25 @@ void MEDPARTITIONER::MeshCollection::buildParallelCellGraph(MEDCoupling::MEDCoup if (MyGlobals::_Verbose>50) std::cout << "proc " << MyGlobals::_Rank << " : create skylinearray" << std::endl; //filling up index and value to create skylinearray structure - std::vector index,value; + std::vector index,value; index.push_back(0); - int idep=0; + mcIdType idep=0; for (int idomain=0; idomainisMyDomain(idomain)) continue; - int nbCells=_mesh[idomain]->getNumberOfCells(); - for (int icell=0; icellgetNumberOfCells(); + for (mcIdType icell=0; icellconvertCellToGlobal(idomain,icell); - multimap::iterator it; - pair::iterator,multimap::iterator> ret; + mcIdType size=0; + mcIdType globalCell=_topology->convertCellToGlobal(idomain,icell); + multimap::iterator it; + pair::iterator,multimap::iterator> ret; ret=cell2cell.equal_range(globalCell); for (it=ret.first; it!=ret.second; ++it) { - int ival=(*it).second; //no adding one existing yet - for (int i=idep ; irank() << " : end MeshCollection::buildCellGraph " << index.size()-1 << " " << value.size() << std::endl; - int max=index.size()>15?15:index.size(); + std::size_t max=index.size()>15?15:index.size(); if (index.size()>1) { - for (int i=0; i domains; - for (int i=0; i<_topology->nbCells(); i++) + for (mcIdType i=0; i<_topology->nbCells(); i++) { domains.insert(partition[i]); } @@ -2232,7 +2232,7 @@ MEDPARTITIONER::Topology* MEDPARTITIONER::MeshCollection::createPartition(const //cellGraph is a shared pointer Topology *topology=0; - int nbdomain=domains.size(); + int nbdomain=(int)domains.size(); topology=new ParallelTopology (cellGraph, getTopology(), nbdomain, getMeshDimension()); // if (array!=0) delete array; delete cellGraph; @@ -2293,22 +2293,22 @@ void MEDPARTITIONER::MeshCollection::prepareFieldDescriptions() //to have unique valid fields names/pointers/descriptions for partitionning //filter _field_descriptions to be in all procs compliant and equal { - int nbfiles=MyGlobals::_File_Names.size(); //nb domains + std::size_t nbfiles=MyGlobals::_File_Names.size(); //nb domains if (nbfiles==0) { nbfiles=_topology->nbDomain(); } std::vector r2; //from allgatherv then vector(procs) of serialised vector(fields) of vector(description) data - for (int i=0; i<(int)_field_descriptions.size(); i++) + for (std::size_t i=0; i<_field_descriptions.size(); i++) { std::vector r1=DeserializeToVectorOfString(_field_descriptions[i]); - for (int ii=0; ii<(int)r1.size(); ii++) + for (std::size_t ii=0; ii& inodesFace, std::vector< int >& inodesCell) +bool isFaceOncell(std::vector< mcIdType >& inodesFace, std::vector< mcIdType >& inodesCell) { - int ires=0; - int nbok=inodesFace.size(); - for (int i=0; i nodeIds; + std::vector nodeIds; getNodeIds(*mcel, *mfac, nodeIds); if (nodeIds.size()==0) continue; //one empty mesh nothing to do - MEDCoupling::DataArrayInt *revNodalCel=MEDCoupling::DataArrayInt::New(); - MEDCoupling::DataArrayInt *revNodalIndxCel=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType *revNodalCel=MEDCoupling::DataArrayIdType::New(); + MEDCoupling::DataArrayIdType *revNodalIndxCel=MEDCoupling::DataArrayIdType::New(); mcel->getReverseNodalConnectivity(revNodalCel,revNodalIndxCel); - int *revC=revNodalCel->getPointer(); - int *revIndxC=revNodalIndxCel->getPointer(); + mcIdType *revC=revNodalCel->getPointer(); + mcIdType *revIndxC=revNodalIndxCel->getPointer(); - std::vector< int > faceOnCell; - std::vector< int > faceNotOnCell; - int nbface=mfac->getNumberOfCells(); - for (int iface=0; iface faceOnCell; + std::vector< mcIdType > faceNotOnCell; + mcIdType nbface=mfac->getNumberOfCells(); + for (mcIdType iface=0; iface inodesFace; + std::vector< mcIdType > inodesFace; mfac->getNodeIdsOfCell(iface, inodesFace); - int nbnodFace=inodesFace.size(); + mcIdType nbnodFace=ToIdType(inodesFace.size()); if ( nbnodFace != mfac->getNumberOfNodesInCell( iface )) continue; // invalid node ids //set inodesFace in mcel @@ -2395,17 +2395,17 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() nbok += (( inodesFace[i]=nodeIds[inodesFace[i]] ) >= 0 ); if ( nbok != nbnodFace ) continue; - int inod=inodesFace[0]; + mcIdType inod=inodesFace[0]; if (inod<0) { std::cout << "filterFaceOnCell problem 1" << std::endl; continue; } - int nbcell=revIndxC[inod+1]-revIndxC[inod]; - for (int j=0; j inodesCell; + mcIdType icel=revC[revIndxC[inod]+j]; + std::vector< mcIdType > inodesCell; mcel->getNodeIdsOfCell(icel, inodesCell); ok=isFaceOncell(inodesFace, inodesCell); if (ok) break; @@ -2443,11 +2443,11 @@ void MEDPARTITIONER::MeshCollection::filterFaceOnCell() std::string key = Cle1ToStr("faceFamily_toArray",inew); if ( getMapDataArrayInt().count( key )) { - MEDCoupling::DataArrayInt * & fam = getMapDataArrayInt()[ key ]; - MEDCoupling::DataArrayInt * famFilter = MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType * & fam = getMapDataArrayInt()[ key ]; + MEDCoupling::DataArrayIdType * famFilter = MEDCoupling::DataArrayIdType::New(); famFilter->alloc(faceOnCell.size(),1); - int* pfamFilter = famFilter->getPointer(); - int* pfam = fam->getPointer(); + mcIdType* pfamFilter = famFilter->getPointer(); + mcIdType* pfam = fam->getPointer(); for ( size_t i=0; idecrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx index c20901c84..8d24d8a97 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.hxx @@ -46,7 +46,7 @@ namespace MEDPARTITIONER class JointFinder; typedef enum{MedAscii, MedXml, Undefined} DriverType; - typedef std::multimap, std::pair > NodeMapping ; + typedef std::multimap, std::pair > NodeMapping ; typedef std::vector > NodeList; class MEDPARTITIONER_EXPORT MeshCollection @@ -87,9 +87,9 @@ namespace MEDPARTITIONER //getting mesh dimension int getMeshDimension() const; int getNbOfLocalMeshes() const; - int getNbOfGlobalMeshes() const { return _mesh.size(); } - int getNbOfLocalCells() const; - int getNbOfLocalFaces() const; + int getNbOfGlobalMeshes() const { return (int)_mesh.size(); } + mcIdType getNbOfLocalCells() const; + mcIdType getNbOfLocalFaces() const; //getting a reference to mesh vector std::vector& getMesh(); @@ -100,13 +100,13 @@ namespace MEDPARTITIONER MEDCoupling::MEDCouplingUMesh* getFaceMesh(int idomain); std::vector& getGroupMeshes(int idomain); - std::vector& getCellFamilyIds() { return _cell_family_ids; } - std::vector& getFaceFamilyIds() { return _face_family_ids; } + std::vector& getCellFamilyIds() { return _cell_family_ids; } + std::vector& getFaceFamilyIds() { return _face_family_ids; } - std::map& getMapDataArrayInt() { return _map_dataarray_int; } + std::map& getMapDataArrayInt() { return _map_dataarray_int; } std::map& getMapDataArrayDouble() { return _map_dataarray_double; } - std::map& getFamilyInfo() { return _family_info; } + std::map& getFamilyInfo() { return _family_info; } std::map >& getGroupInfo() { return _group_info; } MEDCoupling::DataArrayDouble* getField(std::string descriptionField, int iold); @@ -138,20 +138,20 @@ namespace MEDPARTITIONER //creates the node mapping between an old collection and the present one void createNodeMapping(MeshCollection& initialCollection, - std::multimap,std::pair >& nodeMapping); + std::multimap,std::pair >& nodeMapping); void castCellMeshes(MeshCollection& initialCollection, - std::vector > >& new2oldIds, - std::vector & o2nRenumber); + std::vector > >& new2oldIds, + std::vector & o2nRenumber); //creates faces on the new collection void castFaceMeshes(MeshCollection& initialCollection, - const std::multimap, std::pair >& nodeMapping, - std::vector > >& new2oldIds); + const std::multimap, std::pair >& nodeMapping, + std::vector > >& new2oldIds); //constructing connect zones void buildConnectZones( const NodeMapping& nodeMapping, - const std::vector & o2nRenumber, + const std::vector & o2nRenumber, int nbInitialDomains ); // Find faces common with neighbor domains and put them in groups @@ -160,19 +160,19 @@ namespace MEDPARTITIONER private: void castIntField(std::vector& meshesCastFrom, std::vector& meshesCastTo, - std::vector& arrayFrom, + std::vector& arrayFrom, std::string nameArrayTo); void castAllFields(MeshCollection& initialCollection, std::string nameArrayTo); - void findCommonDistantNodes(std::vector > >& commonDistantNodes); + void findCommonDistantNodes(std::vector > >& commonDistantNodes); void remapIntField(int inew, int iold, const MEDCoupling::MEDCouplingUMesh& sourceMesh, const MEDCoupling::MEDCouplingUMesh& targetMesh, - const int* fromArray, + const mcIdType* fromArray, std::string nameArrayTo, const BBTreeOfDim* tree); @@ -181,7 +181,7 @@ namespace MEDPARTITIONER std::string nameArrayTo, std::string descriptionField); - void createJointGroup( const std::vector< int >& faces, + void createJointGroup( const std::vector< mcIdType >& faces, const int inew1, const int inew2, const bool is2nd ); @@ -207,11 +207,11 @@ namespace MEDPARTITIONER int _i_non_empty_mesh; //family ids storages - std::vector _cell_family_ids; - std::vector _face_family_ids; + std::vector _cell_family_ids; + std::vector _face_family_ids; //DataArrayInt* storages - std::map _map_dataarray_int; + std::map _map_dataarray_int; //DataArrayDouble* storages std::map _map_dataarray_double; @@ -219,7 +219,7 @@ namespace MEDPARTITIONER std::vector _field_descriptions; //group family conversion - std::map _family_info; + std::map _family_info; std::map > _group_info; //list of groups that are not to be split diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index d01d9e068..2e6ec0e46 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -72,8 +72,8 @@ int MeshCollectionDriver::readSeq(const char* filename, const char* meshname) (_collection->getFaceMesh()).push_back(mfm->getLevelM1Mesh(false)); //reading family ids - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); + MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); + MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getCellFamilyIds()).push_back(cellIds); (_collection->getFaceFamilyIds()).push_back(faceIds); @@ -136,13 +136,13 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getMesh())[idomain]=mfm->getLevel0Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); + MEDCoupling::DataArrayIdType* cellIds(mfm->getFamilyFieldAtLevel(0)->deepCopy()); (_collection->getCellFamilyIds())[idomain]=cellIds; } catch(...) { (_collection->getMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want tests; - MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New(); empty->alloc(0,1); (_collection->getCellFamilyIds())[idomain]=empty; std::cout<<"\nNO Level0Mesh (Cells)\n"; @@ -153,7 +153,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) { (_collection->getFaceMesh())[idomain]=mfm->getLevelM1Mesh(false); //reading families groups - MEDCoupling::DataArrayInt* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); + MEDCoupling::DataArrayIdType* faceIds(mfm->getFamilyFieldAtLevel(-1)->deepCopy()); (_collection->getFaceFamilyIds())[idomain]=faceIds; if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : WITH Faces\n"; @@ -166,7 +166,7 @@ void MeshCollectionDriver::readData(MEDCoupling::MEDFileUMesh* mfm, int idomain) catch(...) { (_collection->getFaceMesh())[idomain]=CreateEmptyMEDCouplingUMesh(); // or 0 if you want test; - MEDCoupling::DataArrayInt* empty=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* empty=MEDCoupling::DataArrayIdType::New(); (_collection->getFaceFamilyIds())[idomain]=empty; if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : WITHOUT Faces\n"; @@ -304,7 +304,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const j1st->pushCorrespondence( corr ); } - std::vector< std::pair< int,int > > types = cz->getEntities(); + std::vector< std::pair< mcIdType,mcIdType > > types = cz->getEntities(); INTERP_KERNEL::NormalizedCellType t1, t2; for ( size_t it = 0; it < types.size(); ++it ) { @@ -368,10 +368,10 @@ 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=")); - int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); + std::size_t nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents=")); if (nbc==da->getNumberOfComponents()) { - for (int i=0; isetInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=")); } else @@ -429,7 +429,7 @@ MEDCoupling::MEDFileData* MeshCollectionDriver::getMEDFileData() meshes = MEDCoupling::MEDFileMeshes::New(); fields = MEDCoupling::MEDFileFields::New(); - for (size_t i=0; i<_collection->getMesh().size(); i++) + for (unsigned int i=0; i<_collection->getMesh().size(); i++) { MEDCoupling::MEDFileMesh* mfm = getMesh( i ); meshes->pushMesh(mfm); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx index 3da899e5f..0fd977b06 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx @@ -58,14 +58,14 @@ int MeshCollectionMedAsciiDriver::read(MEDCoupling::MEDFileData* filedata) readMEDFileData(filedata); std::vector cz; // to fill from filedata - std::vector cellglobal; - std::vector nodeglobal; - std::vector faceglobal; - int size = (_collection->getMesh()).size(); + std::vector cellglobal; + std::vector nodeglobal; + std::vector faceglobal; + std::size_t size = _collection->getMesh().size(); cellglobal.resize(size); nodeglobal.resize(size); faceglobal.resize(size); - for ( int idomain = 0; idomain < size; ++idomain ) + for ( unsigned int idomain = 0; idomain < size; ++idomain ) { cellglobal[idomain]=0; faceglobal[idomain]=0; @@ -90,9 +90,9 @@ int MeshCollectionMedAsciiDriver::read(MEDCoupling::MEDFileData* filedata) int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* domainSelector) { //distributed meshes - std::vector cellglobal; - std::vector nodeglobal; - std::vector faceglobal; + std::vector cellglobal; + std::vector nodeglobal; + std::vector faceglobal; int nbdomain; //reading ascii master file @@ -168,12 +168,12 @@ int MeshCollectionMedAsciiDriver::read(const char* filename, ParaDomainSelector* */ void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelector* domainSelector) const { - int nbdomains=_collection->getMesh().size(); + std::size_t nbdomains=_collection->getMesh().size(); std::vector filenames; filenames.resize(nbdomains); //loop on the domains - for (int idomain=0; idomaingetMesh().size() << " " << std::endl; - for (int idomain=0; idomaingetName() <<" "<< idomain+1 << " " << (_collection->getMesh())[idomain]->getName() << " localhost " << filenames[idomain] << " "<< std::endl; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx index ba130e9b5..79a472764 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx @@ -242,7 +242,7 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0); xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str()); - int nbdomains= _collection->getMesh().size(); + int nbdomains= _collection->getNbOfGlobalMeshes(); //loop on the domains std::string finalMeshName=""; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx index 561d366ec..6f20908ee 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx @@ -55,10 +55,17 @@ void METISGraph::partGraph(int ndomain, std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl; //number of graph vertices - int n=_graph->getNumberOf(); + int n=FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); +#endif //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; @@ -100,13 +107,13 @@ void METISGraph::partGraph(int ndomain, for (int i=0; i index(n+1); - vector value(n); + vector index(n+1); + vector value(n); index[0]=0; for (int i=0; igetNumberOf(); + int n = FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); +#endif //ndomain int nparts=ndomain; @@ -104,13 +111,13 @@ void PTSCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Pa SCOTCH_stratExit(&scotch_strategy); SCOTCH_dgraphExit(&scotch_graph); - std::vector index(n+1); - std::vector value(n); + std::vector index(n+1); + std::vector value(n); index[0]=0; for (int i=0; igetNumberOf(); + int n=FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); ++#endif //constraints int * vwgt=_cell_weight; int * adjwgt=_edge_weight; @@ -110,8 +117,8 @@ void ParMETISGraph::partGraph(int ndomain, MPI_Comm *comm); */ - vector index(n+1); - vector value(n); + vector index(n+1); + vector value(n); index[0]=0; if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize { @@ -120,7 +127,7 @@ void ParMETISGraph::partGraph(int ndomain, for (int i=0; i #include #ifdef HAVE_MPI + #include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + #endif /*! @@ -137,8 +147,8 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes + int nb_domains=(int)domain_meshes.size(); + std::vector nb_elems(nb_domains*2, 0); //NumberOfCells & NumberOfNodes for (int i=0; igetNumberOfNodes(); } // receive nb of elems from other procs - std::vector all_nb_elems; + std::vector all_nb_elems; if (MyGlobals::_World_Size==1) { all_nb_elems=nb_elems; @@ -155,12 +165,12 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbOf(const std::vector1"); #endif } - int total_nb_cells=0, total_nb_nodes=0; + mcIdType total_nb_cells=0, total_nb_nodes=0; for (int i=0; i10) std::cout << "totalNbCells " << total_nb_cells << " totalNbNodes " << total_nb_nodes << std::endl; - std::vector& cell_shift_by_domain=_cell_shift_by_domain; - std::vector& node_shift_by_domain=_node_shift_by_domain; - std::vector& face_shift_by_domain=_face_shift_by_domain; + std::vector& cell_shift_by_domain=_cell_shift_by_domain; + std::vector& node_shift_by_domain=_node_shift_by_domain; + std::vector& face_shift_by_domain=_face_shift_by_domain; - std::vector< int > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains); + std::vector< mcIdType > ordered_nbs_cell, ordered_nbs_node, domain_order(nb_domains); ordered_nbs_cell.push_back(0); ordered_nbs_node.push_back(0); for (int iproc=0; iproc(& _nb_vert_of_procs[0]); + return const_cast(& _nb_vert_of_procs[0]); } /*! @@ -252,7 +262,7 @@ int *MEDPARTITIONER::ParaDomainSelector::getProcVtxdist() const * gatherNbOf() must be called before. * Result added to local id on given domain gives id in the whole distributed mesh */ -int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) const { evaluateMemory(); if (_cell_shift_by_domain.empty()) @@ -260,7 +270,7 @@ int MEDPARTITIONER::ParaDomainSelector::getDomainCellShift(int domainIndex) cons return _cell_shift_by_domain[domainIndex]; } -int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) const { evaluateMemory(); if (_node_shift_by_domain.empty()) @@ -274,7 +284,7 @@ int MEDPARTITIONER::ParaDomainSelector::getDomainNodeShift(int domainIndex) cons * gatherNbOf() must be called before. * Result added to global id on this processor gives id in the whole distributed mesh */ -int MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const +mcIdType MEDPARTITIONER::ParaDomainSelector::getProcNodeShift() const { evaluateMemory(); if (_nb_vert_of_procs.empty()) @@ -298,20 +308,21 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe std::vector index_size_of_proc( nbProcs() ); // index sizes - 1 for ( std::size_t i = 1; i < _nb_vert_of_procs.size(); ++i ) - index_size_of_proc[i-1] = _nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]; + index_size_of_proc[i-1] = FromIdType(_nb_vert_of_procs[ i ] - _nb_vert_of_procs[ i-1 ]); - int index_size = 1 + _cell_shift_by_domain.back(); - int *graph_index = new int[ index_size ]; - const int *index = graph->getGraph()->getIndex(); - int *proc_index_displacement = const_cast( & _nb_vert_of_procs[0] ); + 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(); MPI_Allgatherv((void*) (index+1), // send local index except first 0 (or 1) index_size_of_proc[_rank], // index size on this proc - MPI_INT, + MPI_ID_TYPE, (void*) graph_index, // receive indices & index_size_of_proc[0], // index size on each proc proc_index_displacement, // displacement of each proc index - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); graph_index[0] = index[0]; // it is not overwritten thanks to proc_index_displacement[0]==1 @@ -320,7 +331,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe for ( int i = 0; i < nbProcs(); ++i ) { if ( index_size_of_proc[i] > 0 ) - value_size_of_proc[i] = graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]; + value_size_of_proc[i] = (int)(graph_index[ proc_index_displacement[ i+1 ]-1 ] - graph_index[0]); else value_size_of_proc[i] = 0; proc_value_displacement.push_back( proc_value_displacement.back() + value_size_of_proc[i] ); @@ -329,7 +340,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe // update graph_index for ( int i = 1; i < nbProcs(); ++i ) { - int 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; } @@ -338,33 +349,33 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe // Gather values // -------------- - int value_size = graph_index[ index_size-1 ] - graph_index[ 0 ]; - int *graph_value = new int[ value_size ]; - const int *value = graph->getGraph()->getValues(); + 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 value_size_of_proc[_rank], // value size on this proc - MPI_INT, + MPI_ID_TYPE, (void*) graph_value, // receive values & value_size_of_proc[0], // value size on each proc & proc_value_displacement[0], // displacement of each proc value - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); // ----------------- // Gather partition // ----------------- - int * partition = new int[ _cell_shift_by_domain.back() ]; - const int* part = graph->getPart(); + mcIdType * partition = new mcIdType[ _cell_shift_by_domain.back() ]; + const mcIdType* part = graph->getPart(); MPI_Allgatherv((void*) part, // send local partition index_size_of_proc[_rank], // index size on this proc - MPI_INT, + MPI_ID_TYPE, (void*)(partition-1), // -1 compensates proc_index_displacement[0]==1 & index_size_of_proc[0], // index size on each proc proc_index_displacement, // displacement of each proc index - MPI_INT, + MPI_ID_TYPE, MPI_COMM_WORLD); // ----------- @@ -389,7 +400,7 @@ std::unique_ptr MEDPARTITIONER::ParaDomainSelector::gathe /*! * \brief Set nb of cell/cell pairs in a joint between domains */ -void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ) +void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain ) { // This method is needed for further computing global numbers of faces in joint. // Store if both domains are on this proc else on one of procs only @@ -410,7 +421,7 @@ void MEDPARTITIONER::ParaDomainSelector::setNbCellPairs( int nb_cell_pairs, int */ //================================================================================ -int MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getNbCellPairs( int dist_domain, int loc_domain ) const { evaluateMemory(); @@ -430,12 +441,12 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbCellPairs() _nb_cell_pairs_by_joint.resize( _nb_result_domains*(_nb_result_domains+1), 0); evaluateMemory(); - std::vector< int > send_buf = _nb_cell_pairs_by_joint; + std::vector< mcIdType > send_buf = _nb_cell_pairs_by_joint; #ifdef HAVE_MPI MPI_Allreduce((void*)&send_buf[0], (void*)&_nb_cell_pairs_by_joint[0], - _nb_cell_pairs_by_joint.size(), - MPI_INT, MPI_SUM, MPI_COMM_WORLD); + (int)_nb_cell_pairs_by_joint.size(), + MPI_ID_TYPE, MPI_SUM, MPI_COMM_WORLD); #endif // check that the set nbs of cell pairs are correct, // namely that each joint is treated on one proc only @@ -450,14 +461,14 @@ void MEDPARTITIONER::ParaDomainSelector::gatherNbCellPairs() */ //================================================================================ -int MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const +mcIdType MEDPARTITIONER::ParaDomainSelector::getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const { // total_nb_faces includes faces existing before creation of joint faces // (got in gatherNbOf( MED_FACE )). evaluateMemory(); - int total_nb_faces = _face_shift_by_domain.empty() ? 0 : _face_shift_by_domain.back(); - int id = total_nb_faces + 1; + 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"); @@ -482,8 +493,8 @@ int *MEDPARTITIONER::ParaDomainSelector::exchangeSubentityIds( int loc_domain, i int dest = getProcessorID( dist_domain ); int tag = 2002 + jointId( loc_domain, dist_domain ); MPI_Status status; - MPI_Sendrecv((void*)&loc_ids_here[0], loc_ids_here.size(), MPI_INT, dest, tag, - (void*) loc_ids_dist, loc_ids_here.size(), MPI_INT, dest, tag, + 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, MPI_COMM_WORLD, &status); #endif evaluateMemory(); @@ -539,36 +550,36 @@ void MEDPARTITIONER::ParaDomainSelector::sendMesh(const MEDCoupling::MEDCoupling std::cout << "proc " << _rank << " : sendMesh '" << mesh.getName() << "' size " << mesh.getNumberOfCells() << " to " << target << std::endl; // First stage : sending sizes // ------------------------------ - std::vector tinyInfoLocal; + std::vector tinyInfoLocal; std::vector tinyInfoLocalS; std::vector tinyInfoLocalD; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. mesh.getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); tinyInfoLocal.push_back(mesh.getNumberOfCells()); - int tinySize=tinyInfoLocal.size(); + int tinySize=(int)tinyInfoLocal.size(); MPI_Send(&tinySize, 1, MPI_INT, target, 1113, MPI_COMM_WORLD); - MPI_Send(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, target, 1112, MPI_COMM_WORLD); + MPI_Send(&tinyInfoLocal[0], (int)tinyInfoLocal.size(), MPI_ID_TYPE, target, 1112, MPI_COMM_WORLD); if (mesh.getNumberOfCells()>0) //no sends if empty { - MEDCoupling::DataArrayInt *v1Local=0; + 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; - int* ptLocal=0; + mcIdType* ptLocal=0; if(v1Local) //if empty getNbOfElems() is 1! { - nbLocalElems=v1Local->getNbOfElems(); // if empty be 1! + nbLocalElems=FromIdType(v1Local->getNbOfElems()); // if empty be 1! ptLocal=v1Local->getPointer(); } - MPI_Send(ptLocal, nbLocalElems, MPI_INT, target, 1111, MPI_COMM_WORLD); + MPI_Send(ptLocal, nbLocalElems, MPI_ID_TYPE, target, 1111, MPI_COMM_WORLD); int nbLocalElems2=0; double *ptLocal2=0; if(v2Local) //if empty be 0! { - nbLocalElems2=v2Local->getNbOfElems(); + nbLocalElems2=FromIdType(v2Local->getNbOfElems()); ptLocal2=v2Local->getPointer(); } MPI_Send(ptLocal2, nbLocalElems2, MPI_DOUBLE, target, 1110, MPI_COMM_WORLD); @@ -590,7 +601,7 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* #else // First stage : exchanging sizes // ------------------------------ - std::vector tinyInfoDistant; + std::vector tinyInfoDistant; std::vector tinyInfoLocalS; std::vector tinyInfoDistantD(1); //Getting tiny info of local mesh to allow the distant proc to initialize and allocate @@ -601,12 +612,12 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* tinyInfoDistant.resize(tinyVecSize); std::fill(tinyInfoDistant.begin(),tinyInfoDistant.end(),0); - MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_INT,source,1112,MPI_COMM_WORLD, &status); + MPI_Recv(&tinyInfoDistant[0], tinyVecSize, MPI_ID_TYPE,source,1112,MPI_COMM_WORLD, &status); //there was tinyInfoLocal.push_back(mesh.getNumberOfCells()); - int NumberOfCells=tinyInfoDistant[tinyVecSize-1]; + mcIdType NumberOfCells=tinyInfoDistant[tinyVecSize-1]; if (NumberOfCells>0) { - MEDCoupling::DataArrayInt *v1Distant=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType *v1Distant=MEDCoupling::DataArrayIdType::New(); MEDCoupling::DataArrayDouble *v2Distant=MEDCoupling::DataArrayDouble::New(); //Building the right instance of copy of distant mesh. MEDCoupling::MEDCouplingPointSet *distant_mesh_tmp= @@ -617,18 +628,18 @@ void MEDPARTITIONER::ParaDomainSelector::recvMesh(MEDCoupling::MEDCouplingUMesh* mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); int nbDistElem=0; - int *ptDist=0; + mcIdType *ptDist=0; if(v1Distant) { - nbDistElem=v1Distant->getNbOfElems(); + nbDistElem=FromIdType(v1Distant->getNbOfElems()); ptDist=v1Distant->getPointer(); } - MPI_Recv(ptDist, nbDistElem, MPI_INT, source,1111, MPI_COMM_WORLD, &status); + MPI_Recv(ptDist, nbDistElem, MPI_ID_TYPE, source,1111, MPI_COMM_WORLD, &status); double *ptDist2=0; nbDistElem=0; if(v2Distant) { - nbDistElem=v2Distant->getNbOfElems(); + nbDistElem=FromIdType(v2Distant->getNbOfElems()); ptDist2=v2Distant->getPointer(); } MPI_Recv(ptDist2, nbDistElem, MPI_DOUBLE,source, 1110, MPI_COMM_WORLD, &status); @@ -662,7 +673,7 @@ int MEDPARTITIONER::ParaDomainSelector::evaluateMemory() const struct sysinfo si; int err = sysinfo( &si ); if ( !err ) - used_memory = (( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; + used_memory = (int)(( si.totalram - si.freeram + si.totalswap - si.freeswap ) * si.mem_unit ) / 1024; #endif if ( used_memory > _max_memory ) _max_memory = used_memory; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx index 9a371e498..ef94256a3 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParaDomainSelector.hxx @@ -21,6 +21,7 @@ #define __MEDPARTITIONER_PARADOMAINSELECTOR_HXX__ #include "MEDPARTITIONER.hxx" +#include "MCType.hxx" #include #include @@ -59,35 +60,35 @@ namespace MEDPARTITIONER //identifier for a joint int jointId( int local_domain, int distant_domain ) const; - int getNbTotalCells() { return _cell_shift_by_domain.back(); } - int getNbTotalNodes() { return _node_shift_by_domain.back(); }; - int getNbTotalFaces() { return _face_shift_by_domain.back(); }; + mcIdType getNbTotalCells() { return _cell_shift_by_domain.back(); } + mcIdType getNbTotalNodes() { return _node_shift_by_domain.back(); }; + mcIdType getNbTotalFaces() { return _face_shift_by_domain.back(); }; //Collect nb of entities on procs void gatherNbOf(const std::vector& domain_meshes); //distribution of the graph vertices among the processors - int* getProcVtxdist() const; + mcIdType* getProcVtxdist() const; //nb of nodes on processors with lower rank - int getProcNodeShift() const; + mcIdType getProcNodeShift() const; //nb of cells in domains with lower index - int getDomainCellShift(int domainIndex) const; + mcIdType getDomainCellShift(int domainIndex) const; //nb of nodes in domains with lower index - int getDomainNodeShift(int domainIndex) const; + mcIdType getDomainNodeShift(int domainIndex) const; //Gather graphs from all processors into one std::unique_ptr gatherGraph(const Graph* graph) const; //Set nb of cell/cell pairs in a joint between domains - void setNbCellPairs( int nb_cell_pairs, int dist_domain, int loc_domain ); + void setNbCellPairs( mcIdType nb_cell_pairs, int dist_domain, int loc_domain ); //Gather size of each proc/proc joint void gatherNbCellPairs(); //nb of cell/cell pairs in a joint between domains on different procs - int getNbCellPairs( int dist_domain, int loc_domain ) const; + mcIdType getNbCellPairs( int dist_domain, int loc_domain ) const; //get the first global id of sub-entity for the joint - int getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; + mcIdType getFisrtGlobalIdOfSubentity( int loc_domain, int dist_domain ) const; //Send-receive local ids of joint faces int* exchangeSubentityIds( int loc_domain, int dist_domain, const std::vector& loc_ids_here ) const; @@ -104,11 +105,11 @@ namespace MEDPARTITIONER int _world_size; //nb of processors int _nb_result_domains; //required nb of domains - std::vector< int > _nb_cell_pairs_by_joint; - std::vector< int > _nb_vert_of_procs; //graph vertices - std::vector< int > _cell_shift_by_domain; - std::vector< int > _node_shift_by_domain; - std::vector< int > _face_shift_by_domain; + std::vector< mcIdType > _nb_cell_pairs_by_joint; + std::vector< mcIdType > _nb_vert_of_procs; //graph vertices + std::vector< mcIdType > _cell_shift_by_domain; + std::vector< mcIdType > _node_shift_by_domain; + std::vector< mcIdType > _face_shift_by_domain; double _init_time; bool _mesure_memory; diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx index 99c62b4a9..af874d658 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParallelTopology.cxx @@ -28,6 +28,7 @@ #include "MEDCouplingSkyLineArray.hxx" #include "MEDCouplingUMesh.hxx" #include "InterpKernelHashMap.hxx" +#include "MCIdType.hxx" #include #include @@ -47,7 +48,7 @@ ParallelTopology::ParallelTopology():_nb_domain(0),_mesh_dimension(0) //constructing topology according to mesh collection without global numerotation (use setGlobalNumerotation later) ParallelTopology::ParallelTopology(const std::vector& meshes) { - _nb_domain=meshes.size(); + _nb_domain=(int)meshes.size(); _nb_cells.resize(_nb_domain); _nb_nodes.resize(_nb_domain); // _nb_faces.resize(_nb_domain); @@ -98,10 +99,10 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _loc_to_glob[idomain].resize(_nb_cells[idomain]); - int domainCellShift=domainSelector->getDomainCellShift(idomain); - for (int i=0; i<_nb_cells[idomain]; i++) + mcIdType domainCellShift=domainSelector->getDomainCellShift(idomain); + for (mcIdType i=0; i<_nb_cells[idomain]; i++) { - int global=domainCellShift+i ; + mcIdType global=domainCellShift+i ; _glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i))); _loc_to_glob[idomain][i]=global; if (MyGlobals::_Verbose>500) @@ -117,10 +118,10 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe for (int idomain=0; idomain<_nb_domain; idomain++) { _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); - int domainNodeShift=domainSelector->getDomainNodeShift(idomain); - for (int i=0; i<_nb_nodes[idomain]; i++) + mcIdType domainNodeShift=domainSelector->getDomainNodeShift(idomain); + for (mcIdType i=0; i<_nb_nodes[idomain]; i++) { - int global=domainNodeShift+i ; + mcIdType global=domainNodeShift+i ; _node_glob_to_loc.insert(std::make_pair(global,std::make_pair(idomain,i))); _node_loc_to_glob[idomain][i]=global; if (MyGlobals::_Verbose>500) @@ -142,14 +143,14 @@ void ParallelTopology::setGlobalNumerotationDefault(ParaDomainSelector* domainSe //constructing topology according to mesh collection ParallelTopology::ParallelTopology(const std::vector& meshes, const std::vector& cz, - std::vector& cellglobal, - std::vector& nodeglobal, - std::vector& faceglobal) + std::vector& cellglobal, + std::vector& nodeglobal, + std::vector& faceglobal) { - _nb_domain=meshes.size(); - int index_global=0; - int index_node_global=0; - int index_face_global=0; + _nb_domain=(int)meshes.size(); + mcIdType index_global=0; + mcIdType index_node_global=0; + mcIdType index_face_global=0; _nb_cells.resize(_nb_domain); _nb_nodes.resize(_nb_domain); @@ -177,9 +178,9 @@ ParallelTopology::ParallelTopology(const std::vectorgetNumberOfNodes()); - for (int i=0; igetNumberOfNodes(); i++) + for (mcIdType i=0; igetNumberOfNodes(); i++) { _node_glob_to_loc.insert(std::make_pair(i,std::make_pair(0,i))); _node_loc_to_glob[0][i]=i; @@ -216,20 +217,20 @@ ParallelTopology::ParallelTopology(const std::vectorgetNumberOfNodes(); - INTERP_KERNEL::HashMap > local2distant; + INTERP_KERNEL::HashMap > local2distant; _node_loc_to_glob[idomain].resize(_nb_nodes[idomain]); for (std::size_t icz=0; iczgetLocalDomainNumber() == idomain && cz[icz]->getLocalDomainNumber()>cz[icz]->getDistantDomainNumber()) { - int nb_node= cz[icz]->getNodeNumber(); - const int* node_corresp=cz[icz]->getNodeCorrespValue(); + mcIdType nb_node= cz[icz]->getNodeNumber(); + const mcIdType* node_corresp=cz[icz]->getNodeCorrespValue(); int distant_ip = cz[icz]->getDistantDomainNumber(); - for (int i=0; i< nb_node; i++) + for (mcIdType i=0; i< nb_node; i++) { - int local= node_corresp[i*2]; - int distant = node_corresp[i*2+1]; + mcIdType local= node_corresp[i*2]; + mcIdType distant = node_corresp[i*2+1]; local2distant.insert(std::make_pair(local, std::make_pair(distant_ip,distant))); } } @@ -237,7 +238,7 @@ ParallelTopology::ParallelTopology(const std::vectorsecond).first; - int distant = (local2distant.find(inode)->second).second; - int global_number=_loc_to_glob[ip][distant]; + mcIdType distant = (local2distant.find(inode)->second).second; + mcIdType global_number=_loc_to_glob[ip][distant]; _node_glob_to_loc.insert(std::make_pair(global_number,std::make_pair(idomain,inode))); _node_loc_to_glob[idomain][inode]=global_number; } @@ -259,9 +260,9 @@ ParallelTopology::ParallelTopology(const std::vectorgetPart(); //all cells for this proc (may be more domains) + const mcIdType* part=graph->getPart(); //all cells for this proc (may be more domains) _nb_total_cells=graph->nbVertices(); //all cells for this proc (may be more domains) if (MyGlobals::_Verbose>300) std::cout << "proc " << MyGlobals::_Rank << " : topology from partition, nbTotalCells " << _nb_total_cells << std::endl; @@ -300,17 +301,17 @@ 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; ioldnbDomain(); iold++) { - int ioldNbCell=oldTopology->getCellNumber(iold); + mcIdType ioldNbCell=oldTopology->getCellNumber(iold); //std::cout<<"proc "< globalids(ioldNbCell); + std::vector globalids(ioldNbCell); oldTopology->getCellList(iold, &globalids[0]); //unique global numerotation - for (int icell=0; icell(part[icellProc]); _nb_cells[idomain]++; icellProc++; - int iGlobalCell=globalids[icell]; + mcIdType iGlobalCell=globalids[icell]; _loc_to_glob[idomain].push_back(iGlobalCell); _glob_to_loc.insert(std::make_pair(iGlobalCell, std::make_pair(idomain, _nb_cells[idomain]))); } @@ -324,29 +325,29 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d if ( MyGlobals::_Create_Joints && nb_domain > 1 ) { - std::vector< std::vector< std::vector< int > > > cellCorresp( nb_domain ); + std::vector< std::vector< std::vector< mcIdType > > > cellCorresp( nb_domain ); for ( int idomain = 0; idomain < nb_domain; ++idomain ) { cellCorresp[ idomain ].resize( nb_domain ); } const MEDCoupling::MEDCouplingSkyLineArray* skylinegraph = graph->getGraph(); - const int* index = skylinegraph->getIndex(); - const int* value = skylinegraph->getValues(); - const int nbCells = skylinegraph->getNumberOf(); + const mcIdType* index = skylinegraph->getIndex(); + const mcIdType* value = skylinegraph->getValues(); + const mcIdType nbCells = skylinegraph->getNumberOf(); - for ( int iGlob = 0; iGlob < nbCells; ++iGlob ) + for ( mcIdType iGlob = 0; iGlob < nbCells; ++iGlob ) { - int iGlobDom = part[ iGlob ]; - for ( int i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) + int iGlobDom = FromIdType(part[ iGlob ]); + for ( mcIdType i = index[ iGlob ]; i < index[ iGlob+1 ]; i++ ) { - int iGlobNear = value[ i ]; + mcIdType iGlobNear = value[ i ]; if ( iGlob > iGlobNear ) continue; // treat ( iGlob, iGlobNear ) pair once - int iGlobNearDom = part[ iGlobNear ]; + int iGlobNearDom = FromIdType(part[ iGlobNear ]); if ( iGlobDom != iGlobNearDom ) { - int iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt - int iLocNear = convertGlobalCell( iGlobNear ).second - 1; + mcIdType iLoc = convertGlobalCell( iGlob ).second - 1; // to MEDCoupling fmt + mcIdType iLocNear = convertGlobalCell( iGlobNear ).second - 1; cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLoc ); cellCorresp[ iGlobDom ][ iGlobNearDom ].push_back( iLocNear ); cellCorresp[ iGlobNearDom ][ iGlobDom ].push_back( iLocNear ); @@ -358,14 +359,14 @@ ParallelTopology::ParallelTopology(Graph* graph, Topology* oldTopology, int nb_d { for ( int idomainNear = 0; idomainNear < nb_domain; ++idomainNear ) { - std::vector< int > & corresp = cellCorresp[ idomain ][ idomainNear ]; + std::vector< mcIdType > & corresp = cellCorresp[ idomain ][ idomainNear ]; if ( corresp.empty() ) continue; MEDPARTITIONER::ConnectZone* cz = new MEDPARTITIONER::ConnectZone(); cz->setName( "Connect Zone defined by MEDPARTITIONER" ); cz->setDistantDomainNumber( idomainNear ); cz->setLocalDomainNumber ( idomain ); - cz->setEntityCorresp( 0,0, &corresp[0], corresp.size()/2 ); + cz->setEntityCorresp( 0,0, &corresp[0], ToIdType( corresp.size()/2 )); _connect_zones.push_back( cz ); } } @@ -388,13 +389,13 @@ ParallelTopology::~ParallelTopology() * If a node in the list is represented on several domains, * only the first value is returned * */ -void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int* ip) +void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int* ip) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - std::pair local_node = _node_glob_to_loc.find(node_list[i])->second; + std::pair local_node = _node_glob_to_loc.find(node_list[i])->second; ip[i]=local_node.first; local[i]=local_node.second; } @@ -407,14 +408,14 @@ void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, i * only the value with domain ip is returned * * */ -void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, int* local, int ip) +void ParallelTopology::convertGlobalNodeList(const mcIdType* node_list, mcIdType nbnode, mcIdType* local, int ip) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_node_glob_to_loc.equal_range(node_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -431,24 +432,24 @@ void ParallelTopology::convertGlobalNodeList(const int* node_list, int nbnode, i * If a node in the list is represented on several domains, * all the values are put in the array * */ -void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int nbnode, int*& local, int*& ip,int*& full_array, int& size) +void ParallelTopology::convertGlobalNodeListWithTwins(const mcIdType* node_list, mcIdType nbnode, mcIdType*& local, int*& ip,mcIdType*& full_array, mcIdType& size) { if (_node_glob_to_loc.empty()) throw INTERP_KERNEL::Exception("Node mapping has not yet been built"); size=0; - for (int i=0; i< nbnode; i++) + for (mcIdType i=0; i< nbnode; i++) { - int count= _node_glob_to_loc.count(node_list[i]); + mcIdType count= ToIdType( _node_glob_to_loc.count(node_list[i])); size+=count; } - int index=0; + mcIdType index=0; ip=new int[size]; - local=new int[size]; - full_array=new int[size]; - for (int i=0; i< nbnode; i++) + local=new mcIdType[size]; + full_array=new mcIdType[size]; + for (mcIdType i=0; i< nbnode; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_node_glob_to_loc.equal_range(node_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -467,22 +468,22 @@ void ParallelTopology::convertGlobalNodeListWithTwins(const int* node_list, int * If a face in the list is represented on several domains, * all the values are put in the array * */ -void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int nbface, int*& local, int*& ip, int*& full_array,int& size) +void ParallelTopology::convertGlobalFaceListWithTwins(const mcIdType* face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array,mcIdType& size) { size=0; - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { //int count = _face_glob_to_loc.count(face_list[i]); //if (count >1) MESSAGE_MED("face en doublon "< >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_face_glob_to_loc.equal_range(face_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -497,11 +498,11 @@ void ParallelTopology::convertGlobalFaceListWithTwins(const int* face_list, int //!converts a list of global cell numbers //!to a distributed array with local cell numbers -void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, int* local, int* ip) +void ParallelTopology::convertGlobalCellList(const mcIdType* cell_list, mcIdType nbcell, mcIdType* local, int* ip) { - for (int i=0; i >::const_iterator iter = _glob_to_loc.find(cell_list[i]); + INTERP_KERNEL::HashMap >::const_iterator iter = _glob_to_loc.find(cell_list[i]); if (iter == _glob_to_loc.end()) { std::cerr << "proc " << MyGlobals::_Rank << " : KO cell_list[" << i << "] : " << cell_list[i] << std::endl; @@ -518,11 +519,11 @@ void ParallelTopology::convertGlobalCellList(const int* cell_list, int nbcell, i /*!Converts a list of global face numbers * to a distributed array with local face numbers */ -void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int* ip) +void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int* ip) { - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { - INTERP_KERNEL::HashMap >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); + INTERP_KERNEL::HashMap >::const_iterator iter = _face_glob_to_loc.find(face_list[i]); if (iter == _face_glob_to_loc.end()) { throw INTERP_KERNEL::Exception("ParallelTopology::convertGlobalFaceList : Face not found"); @@ -539,11 +540,11 @@ void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, i * only the value with domain ip is returned * */ -void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, int* local, int ip) +void ParallelTopology::convertGlobalFaceList(const mcIdType* face_list, mcIdType nbface, mcIdType* local, int ip) { - for (int i=0; i< nbface; i++) + for (mcIdType i=0; i< nbface; i++) { - typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; + typedef INTERP_KERNEL::HashMultiMap >::iterator mmiter; std::pair range=_face_glob_to_loc.equal_range(face_list[i]); for (mmiter it=range.first; it !=range.second; it++) { @@ -558,13 +559,13 @@ void ParallelTopology::convertGlobalFaceList(const int* face_list, int nbface, i //replacing a table of global numbering with a table with local numberings // type_connectivity contains global connectivity for each type in input // type_connectivity contains local connectivity for each type in output -void ParallelTopology::convertToLocal2ndVersion(int* nodes, int nbnodes, int idomain) +void ParallelTopology::convertToLocal2ndVersion(mcIdType* nodes, mcIdType nbnodes, int idomain) { - for (int inode=0; inodegetNumberOf(); + int n = FromIdType(_graph->getNumberOf()); //graph +#ifdef MEDCOUPLING_USE_64BIT_IDS + std::vector indexVec( _graph->getIndex(), _graph->getIndexArray()->end() ); + std::vector valueVec( _graph->getValues(), _graph->getValuesArray()->end() ); + int * xadj=indexVec.data(); + int * adjncy=valueVec.data(); +#else int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValues()); +#endif //ndomain int nparts=ndomain; @@ -99,13 +106,13 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Para SCOTCH_stratExit(&scotch_strategy); SCOTCH_graphExit(&scotch_graph); - std::vector index(n+1); - std::vector value(n); + std::vector index(n+1); + std::vector value(n); index[0]=0; for (int i=0; i #include @@ -47,63 +48,63 @@ namespace MEDPARTITIONER /*! converts a list of global cell numbers * to a distributed array with local cell numbers */ - virtual void convertGlobalNodeList(const int *list, int nb, int *local, int*ip) = 0; - virtual void convertGlobalNodeList(const int *list, int nb, int *local, int ip) = 0; + virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int*ip) = 0; + virtual void convertGlobalNodeList(const mcIdType *list, mcIdType nb, mcIdType *local, int ip) = 0; //converts a list of global node numbers /*! to a distributed array with local cell numbers */ - virtual void convertGlobalCellList(const int*list , int nb, int *local, int*ip) = 0; + virtual void convertGlobalCellList(const mcIdType*list , mcIdType nb, mcIdType *local, int*ip) = 0; /*! converts a list of global face numbers * to a distributed array with local face numbers */ - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int*ip) = 0; - virtual void convertGlobalFaceList(const int*list , int nb, int* local, int ip) = 0; - virtual void convertGlobalFaceListWithTwins(const int *face_list, int nbface, int*& local, int*& ip, int*& full_array, int& size) = 0; - virtual void convertGlobalNodeListWithTwins(const int *face_list, int nbnode, int*& local, int*& ip, int*& full_array, int& size) = 0; + virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int*ip) = 0; + virtual void convertGlobalFaceList(const mcIdType*list , mcIdType nb, mcIdType* local, int ip) = 0; + virtual void convertGlobalFaceListWithTwins(const mcIdType *face_list, mcIdType nbface, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0; + virtual void convertGlobalNodeListWithTwins(const mcIdType *face_list, mcIdType nbnode, mcIdType*& local, int*& ip, mcIdType*& full_array, mcIdType& size) = 0; /*! number of doamins */ virtual int nbDomain() const = 0; /*! number of cells */ - virtual int nbCells() const = 0; + virtual mcIdType nbCells() const = 0; /*! number of nodes */ - virtual int nbNodes() const = 0; + virtual mcIdType nbNodes() const = 0; /*! number of cells on a specific domain */ - virtual int nbCells(int idomain) const = 0; + virtual mcIdType nbCells(int idomain) const = 0; /*! converting node global numberings to local numberings */ - virtual void convertToLocal2ndVersion(int*,int,int) = 0; - virtual int convertNodeToGlobal(int ip,int icell) const = 0; - virtual int convertFaceToGlobal(int ip,int icell) const = 0; - virtual int convertCellToGlobal(int ip,int icell) const = 0; - virtual void convertNodeToGlobal(int ip,const int *local, int n, int *global) const = 0; - virtual void convertCellToGlobal(int ip,const int *local, int n, int *global) const = 0; - virtual void convertFaceToGlobal(int ip,const int *local, int n, int *global) const = 0; + virtual void convertToLocal2ndVersion(mcIdType*,mcIdType,int) = 0; + virtual mcIdType convertNodeToGlobal(int ip,mcIdType icell) const = 0; + virtual mcIdType convertFaceToGlobal(int ip,mcIdType icell) const = 0; + virtual mcIdType convertCellToGlobal(int ip,mcIdType icell) const = 0; + virtual void convertNodeToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; + virtual void convertCellToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; + virtual void convertFaceToGlobal(int ip,const mcIdType *local, mcIdType n, mcIdType *global) const = 0; /*! retrieving number of nodes */ - virtual int getNodeNumber(int idomain) const = 0; - virtual int getNodeNumber() const = 0; + virtual mcIdType getNodeNumber(int idomain) const = 0; + virtual mcIdType getNodeNumber() const = 0; /*! retrieving list of nodes */ - virtual void getNodeList(int idomain, int *list) const = 0; - virtual std::vector & getFusedCellNumbers(int idomain) = 0; - virtual const std::vector & getFusedCellNumbers(int idomain) const = 0; - virtual std::vector & getFusedFaceNumbers(int idomain) = 0; - virtual const std::vector & getFusedFaceNumbers(int idomain) const = 0; + virtual void getNodeList(int idomain, mcIdType *list) const = 0; + virtual std::vector & getFusedCellNumbers(int idomain) = 0; + virtual const std::vector & getFusedCellNumbers(int idomain) const = 0; + virtual std::vector & getFusedFaceNumbers(int idomain) = 0; + virtual const std::vector & getFusedFaceNumbers(int idomain) const = 0; /*! retrieving number of nodes */ - virtual int getCellNumber(int idomain) const = 0; + virtual mcIdType getCellNumber(int idomain) const = 0; /*! retrieving list of nodes */ - virtual void getCellList(int idomain, int *list) const = 0; + virtual void getCellList(int idomain, mcIdType *list) const = 0; /*! retrieving number of faces */ - virtual int getFaceNumber(int idomain) const = 0; - virtual int getFaceNumber() const = 0; + virtual mcIdType getFaceNumber(int idomain) const = 0; + virtual mcIdType getFaceNumber() const = 0; /*! retrieving list of nodes */ - virtual void getFaceList(int idomain, int *list) const = 0; + virtual void getFaceList(int idomain, mcIdType *list) const = 0; /*! adding a face to the mapping */ - virtual void appendFace(int idomain, int ilocal, int iglobal) = 0; + virtual void appendFace(int idomain, mcIdType ilocal, mcIdType iglobal) = 0; /*! returns max global face number */ - virtual int getMaxGlobalFace() const = 0; + virtual mcIdType getMaxGlobalFace() const = 0; /*! converting a global cell number to a local representation */ - virtual std::pair convertGlobalCell(int iglobal) const = 0; + virtual std::pair convertGlobalCell(mcIdType iglobal) const = 0; /*! converting a global face number to a local representation */ - virtual int convertGlobalFace(int iglobal, int idomain) = 0; + virtual mcIdType convertGlobalFace(mcIdType iglobal, int idomain) = 0; /*! converting a global node number to a local representation */ - virtual int convertGlobalNode(int iglobal, int idomain) = 0; + virtual mcIdType convertGlobalNode(mcIdType iglobal, int idomain) = 0; /*! getting a reference to connect zones vector */ virtual std::vector& getCZ() = 0; }; diff --git a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx index b00d29eb3..9098d93c7 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UserGraph.cxx @@ -32,13 +32,13 @@ 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, int n):Graph(array,0) +UserGraph::UserGraph(MEDCoupling::MEDCouplingSkyLineArray *array, const int *partition, mcIdType n):Graph(array,0) { - std::vector index(n+1),value(n); + std::vector index(n+1),value(n); index[0]=0; - for (int i=0; i& ran, std::cerr << "MEDPARTITIONER::RandomizeAdj only works on one proc!" << std::endl; return; } - int size=ran.size(); + std::size_t size=ran.size(); std::vector invran(size); - for (int i=0; i& v return oss.str(); } -std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map& mymap) +std::string MEDPARTITIONER::ReprMapOfStringInt(const std::map& mymap) { if (mymap.size()==0) return std::string(" NONE\n"); std::ostringstream oss; - for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) oss << " -> [" << (*i).first << "]=" << (*i).second << std::endl; return oss.str(); } @@ -285,10 +285,10 @@ std::string MEDPARTITIONER::EraseTagSerialized(const std::string& fromStr, const * elements first and second of map give one elements in result vector of string * converting formatted the int second as firsts characters ending at first slash */ -std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map& mymap) +std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std::map& mymap) { std::vector res; - for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) + for (std::map::const_iterator i=mymap.begin(); i!=mymap.end(); ++i) { std::ostringstream oss; oss << (*i).second << "/" << (*i).first; @@ -300,9 +300,9 @@ std::vector MEDPARTITIONER::VectorizeFromMapOfStringInt(const std:: /* * if existing identicals (first,second) in vector no problem, else Exception */ -std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector& vec) +std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std::vector& vec) { - std::map res; + std::map res; for (std::vector::const_iterator i=vec.begin(); i!=vec.end(); ++i) { std::size_t pos=0; @@ -310,11 +310,11 @@ std::map MEDPARTITIONER::DevectorizeToMapOfStringInt(const std: std::size_t found=(*i).find('/'); //first slash if ((found==std::string::npos) || (found<1)) throw INTERP_KERNEL::Exception("Error aIntNumber/anyString is expected"); - int second; + mcIdType second; std::istringstream iss((*i).substr(pos,found)); iss >> second; std::string first=(*i).substr(pos+found+1,posmax-found); - std::map::iterator it=res.find(first); + std::map::iterator it=res.find(first); if (it!=res.end()) if ((*it).second!=second) throw INTERP_KERNEL::Exception("Error not the same map value"); @@ -506,17 +506,17 @@ void MEDPARTITIONER::FieldShortDescriptionToData(const std::string& description, IT=StrToInt(ExtractFromDescription(description,"IT=")); } -MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v) +MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); p->alloc(v.size(),1); std::copy(v.begin(),v.end(),p->getPointer()); return p; } -MEDCoupling::DataArrayInt *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v,const int nbComponents) +MEDCoupling::DataArrayIdType *MEDPARTITIONER::CreateDataArrayIntFromVector(const std::vector& v,const int nbComponents) { - MEDCoupling::DataArrayInt* p=MEDCoupling::DataArrayInt::New(); + MEDCoupling::DataArrayIdType* p=MEDCoupling::DataArrayIdType::New(); if (v.size()%nbComponents!=0) throw INTERP_KERNEL::Exception("Problem size modulo nbComponents != 0"); p->alloc(v.size()/nbComponents,nbComponents); @@ -539,9 +539,9 @@ std::vector MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::ME std::vector res; if (fd->getArray()) { - int nb=fd->getArray()->getNumberOfComponents(); - res.push_back("nbComponents="); res.back()+=IntToStr(nb); - for (int i=0; igetArray()->getNumberOfComponents(); + res.push_back("nbComponents="); res.back()+=IntToStr((int)nb); + for (unsigned int i=0; igetArray()->getInfoOnComponent(i); @@ -704,7 +704,7 @@ std::vector MEDPARTITIONER::GetInfosOfField(const char *fileName, c { for (int j=0; j MEDPARTITIONER::GetInfosOfField(const char *fileName, c return res; } +MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > MEDPARTITIONER::FromIdTypeVec( const std::vector< mcIdType >& vec ) +{ + MEDCoupling::DataArrayInt32* array = MEDCoupling::DataArrayInt32::New(); + array->alloc( vec.size(), 1 ); + std::copy( vec.begin(), vec.end(), array->getPointer() ); + return array; +} + + /*! * quick almost human readable information on all fields on a mesh in a .med file */ @@ -830,27 +839,27 @@ MEDCoupling::MEDCouplingUMesh* MEDPARTITIONER::CreateEmptyMEDCouplingUMesh() namespace MEDPARTITIONER { - BBTreeOfDim::BBTreeOfDim( int dim, + BBTreeOfDim::BBTreeOfDim( std::size_t dim, const double* bbs, - int* elems, + mcIdType* elems, int level, - int nbelems, + mcIdType nbelems, double epsilon) { switch ( dim ) { case 3: - _tree=new BBTree<3> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<3,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 3 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 3 >; break; case 2: - _tree=new BBTree<2> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<2,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 2 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 2 >; break; case 1: - _tree=new BBTree<1> (bbs,elems,level,nbelems,epsilon); + _tree=new BBTree<1,mcIdType> (bbs,elems,level,nbelems,epsilon); _PgetElementsAroundPoint = & BBTreeOfDim::_getElementsAroundPoint< 1 >; _PgetIntersectingElems = & BBTreeOfDim::_getIntersectingElems< 1 >; break; @@ -866,13 +875,13 @@ namespace MEDPARTITIONER } void BBTreeOfDim::getElementsAroundPoint( const double* coordsPtr, - std::vector& elems ) const + std::vector& elems ) const { BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetElementsAroundPoint) ( coordsPtr, elems ); } void BBTreeOfDim::getIntersectingElems(const double* bb, - std::vector& elems) const + std::vector& elems) const { BBTreeOfDim* me = (BBTreeOfDim*) this; (me->*_PgetIntersectingElems) ( bb, elems ); diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx index 3b00ab7bf..57de1814b 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.hxx @@ -45,7 +45,7 @@ namespace MEDPARTITIONER MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec); MEDPARTITIONER_EXPORT std::string ReprVectorOfString(const std::vector& vec, const std::string separator); - MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::string ReprMapOfStringInt(const std::map& mymap); MEDPARTITIONER_EXPORT std::string ReprMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); MEDPARTITIONER_EXPORT std::string ReprFieldDescriptions(const std::vector& vec,const std::string separator); @@ -54,8 +54,8 @@ namespace MEDPARTITIONER MEDPARTITIONER_EXPORT std::vector DeserializeToVectorOfString(const std::string& str); MEDPARTITIONER_EXPORT std::string EraseTagSerialized(const std::string& fromStr, const std::string& tag); - MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringInt(const std::map& mymap); - MEDPARTITIONER_EXPORT std::map DevectorizeToMapOfStringInt(const std::vector& vec); + MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringInt(const std::map& mymap); + MEDPARTITIONER_EXPORT std::map DevectorizeToMapOfStringInt(const std::vector& vec); MEDPARTITIONER_EXPORT std::vector VectorizeFromMapOfStringVectorOfString(const std::map< std::string,std::vector >& mymap); MEDPARTITIONER_EXPORT std::map< std::string,std::vector > DevectorizeToMapOfStringVectorOfString(const std::vector& vec); @@ -75,10 +75,10 @@ namespace MEDPARTITIONER int& idomain, std::string& fileName, std::string& meshName, std::string& fieldName, int& typeField, int& DT, int& IT); MEDPARTITIONER_EXPORT void FieldShortDescriptionToData(const std::string& description, - std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); - - MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector& v); - MEDCoupling::DataArrayInt *CreateDataArrayIntFromVector(const std::vector& v, const int nbComponents); + std::string& fieldName, int& typeField, int& entity, int& DT, int& IT); + + MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v); + MEDCoupling::DataArrayIdType *CreateDataArrayIntFromVector(const std::vector& v, const int nbComponents); MEDCoupling::DataArrayDouble *CreateDataArrayDoubleFromVector(const std::vector& v); MEDCoupling::MEDCouplingUMesh *CreateEmptyMEDCouplingUMesh(); @@ -88,6 +88,9 @@ namespace MEDPARTITIONER std::vector BrowseAllFieldsOnMesh(const std::string& myfile, const std::string& mymesh, const int idomain); std::vector GetInfosOfField(const char *fileName, const char *meshName, const int idomain ); + MEDCoupling::MCAuto< MEDCoupling::DataArrayInt32 > FromIdTypeVec( const std::vector< mcIdType >& vec ); + + #ifdef HAVE_MPI //not advised, interblocking, use sendAndReceive //void SendVectorOfString(const std::vector& vec, const int target); @@ -100,9 +103,9 @@ namespace MEDPARTITIONER std::vector *RecvDoubleVec(const int source); void RecvDoubleVec(std::vector& vec, const int source); - void SendIntVec(const std::vector& vec, const int target); + void SendIntVec(const std::vector& vec, const int target); std::vector* RecvIntVec(int source); - void RecvIntVec(std::vector& vec, const int source); + void RecvIntVec(std::vector& vec, const int source); void SendDataArrayInt(const MEDCoupling::DataArrayInt* da, const int target); MEDCoupling::DataArrayInt *RecvDataArrayInt(const int source); @@ -146,33 +149,33 @@ namespace MEDPARTITIONER { void * _tree; void (BBTreeOfDim::*_PgetElementsAroundPoint)( const double* coordsPtr, - std::vector& elems ) const; + std::vector& elems ) const; void (BBTreeOfDim::*_PgetIntersectingElems)( const double* bb, - std::vector& elems ) const; + std::vector& elems ) const; template< int dim> void _getElementsAroundPoint( const double* coordsPtr, - std::vector& elems ) const + std::vector& elems ) const { - ((BBTree*)_tree)->getElementsAroundPoint( coordsPtr, elems ); + ((BBTree*)_tree)->getElementsAroundPoint( coordsPtr, elems ); } template< int dim> void _getIntersectingElems(const double* bb, - std::vector& elems) const + std::vector& elems) const { - ((BBTree*)_tree)->getIntersectingElems( bb, elems ); + ((BBTree*)_tree)->getIntersectingElems( bb, elems ); } public: - BBTreeOfDim( int dim, + BBTreeOfDim( std::size_t dim, const double* bbs, - int* elems, + mcIdType* elems, int level, - int nbelems, + mcIdType nbelems, double epsilon=1e-12); ~BBTreeOfDim(); - void getElementsAroundPoint(const double* coordsPtr, std::vector& elems ) const; - void getIntersectingElems (const double* bb, std::vector& elems) const; + void getElementsAroundPoint(const double* coordsPtr, std::vector& elems ) const; + void getIntersectingElems (const double* bb, std::vector& elems) const; }; } #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx index fcd43eaad..f02318984 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_UtilsPara.cxx @@ -27,6 +27,7 @@ #include "MEDCouplingFieldDouble.hxx" #include "InterpKernelException.hxx" #include "MCAuto.hxx" +#include "MEDCouplingMemArray.txx" #include "InterpKernelAutoPtr.hxx" #include @@ -36,7 +37,15 @@ #include #ifdef HAVE_MPI + #include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + #endif using namespace MEDPARTITIONER; @@ -54,9 +63,9 @@ std::vector MEDPARTITIONER::SendAndReceiveVectorOfString(const std: if (rank == source) { std::string str=SerializeFromVectorOfString(vec); - int size=str.length(); + int size=(int)str.length(); MPI_Send( &size, 1, MPI_INT, target, tag, MPI_COMM_WORLD ); - MPI_Send( (void*)str.data(), str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); + MPI_Send( (void*)str.data(), (int)str.length(), MPI_CHAR, target, tag+100, MPI_COMM_WORLD ); } int recSize=0; @@ -83,7 +92,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec std::string str=SerializeFromVectorOfString(vec); std::vector indexes(world_size); - int size=str.length(); + int size=(int)str.length(); MPI_Allgather(&size, 1, MPI_INT, &indexes[0], 1, MPI_INT, MPI_COMM_WORLD); @@ -92,7 +101,7 @@ std::vector MEDPARTITIONER::AllgathervVectorOfString(const std::vec for (int i=0; i MEDPARTITIONER::AllgathervVectorOfString(const std::vec void MEDPARTITIONER::SendDoubleVec(const std::vector& vec, const int target) { int tag = 111002; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDoubleVec " << size << std::endl; #ifdef HAVE_MPI @@ -164,15 +173,15 @@ void MEDPARTITIONER::RecvDoubleVec(std::vector& vec, const int source) \param vec vector to be sent \param target processor id of the target */ -void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) +void MEDPARTITIONER::SendIntVec(const std::vector& vec, const int target) { int tag = 111003; - int size=vec.size(); + int size=(int)vec.size(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendIntVec " << size << std::endl; #ifdef HAVE_MPI - MPI_Send(&size, 1, MPI_INT, target, tag, MPI_COMM_WORLD); - MPI_Send(const_cast(&vec[0]), size,MPI_INT, target, tag+100, MPI_COMM_WORLD); + MPI_Send(&size, 1, MPI_ID_TYPE, target, tag, MPI_COMM_WORLD); + MPI_Send(const_cast(&vec[0]), size,MPI_ID_TYPE, target, tag+100, MPI_COMM_WORLD); #endif } @@ -197,7 +206,7 @@ std::vector *MEDPARTITIONER::RecvIntVec(const int source) return vec; } -void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) +void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) { int tag = 111003; int size; @@ -207,7 +216,7 @@ void MEDPARTITIONER::RecvIntVec(std::vector& vec, const int source) if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : <-- RecvIntVec " << size << std::endl; vec.resize(size); - MPI_Recv(&vec[0], size, MPI_INT, source, tag+100, MPI_COMM_WORLD,&status); + MPI_Recv(&vec[0], size, MPI_ID_TYPE, source, tag+100, MPI_COMM_WORLD,&status); #endif } @@ -223,9 +232,9 @@ void MEDPARTITIONER::SendDataArrayInt(const MEDCoupling::DataArrayInt *da, const throw INTERP_KERNEL::Exception("Problem send DataArrayInt* NULL"); int tag = 111004; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayInt " << size[0] << std::endl; #ifdef HAVE_MPI @@ -271,9 +280,9 @@ void MEDPARTITIONER::SendDataArrayDouble(const MEDCoupling::DataArrayDouble *da, throw INTERP_KERNEL::Exception("Problem send DataArrayDouble* NULL"); int tag = 111005; int size[3]; - size[0]=da->getNbOfElems(); - size[1]=da->getNumberOfTuples(); - size[2]=da->getNumberOfComponents(); + size[0]=(int)da->getNbOfElems(); + size[1]=(int)da->getNumberOfTuples(); + size[2]=(int)da->getNumberOfComponents(); if (MyGlobals::_Verbose>1000) std::cout << "proc " << MyGlobals::_Rank << " : --> SendDataArrayDouble " << size[0] << std::endl; #ifdef HAVE_MPI @@ -380,7 +389,7 @@ void MEDPARTITIONER::TestVectorOfStringMpi() void MEDPARTITIONER::TestMapOfStringIntMpi() { int rank=MyGlobals::_Rank; - std::map myMap; + std::map myMap; myMap["one"]=1; myMap["two"]=22; //a bug myMap["three"]=3; @@ -389,7 +398,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() if (rank==0) { std::vector v2=VectorizeFromMapOfStringInt(myMap); - std::map m3=DevectorizeToMapOfStringInt(v2); + std::map m3=DevectorizeToMapOfStringInt(v2); if (ReprMapOfStringInt(m3)!=ReprMapOfStringInt(myMap)) throw INTERP_KERNEL::Exception("Problem in (de)vectorize MapOfStringInt"); } @@ -399,7 +408,7 @@ void MEDPARTITIONER::TestMapOfStringIntMpi() { std::cout << "v2 is : a vector of size " << v2.size() << std::endl; std::cout << ReprVectorOfString(v2) << std::endl; - std::map m2=DevectorizeToMapOfStringInt(v2); + std::map m2=DevectorizeToMapOfStringInt(v2); std::cout << "m2 is : a map of size " << m2.size() << std::endl; std::cout << ReprMapOfStringInt(m2) << std::endl; } diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 1c1b78102..21a25cecb 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -163,7 +163,7 @@ void MEDPARTITIONERTest::tearDown() MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() //only hexa8 { - vector conn; + vector conn; vector coor; for (int k=0; k<=_nk; k++) for (int j=0; j<=_nj; j++) @@ -213,12 +213,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(3); - int nbc=conn.size()/8; //nb of cells - int nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(int i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; i conn; + vector conn; vector coor; for (int j=0; j<=_nj; j++) for (int i=0; i<=_ni; i++) @@ -281,12 +281,12 @@ MEDCoupling::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); - int nbc=conn.size()/4; //nb of cells - int nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(int i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; isetMeshDimension(2); - int nbc=conn.size()/4; //nb of cells - int nbv=coor.size()/3; //nb of vertices - mesh->allocateCells(nbc); - for(int i=0; iallocateCells(ToIdType(nbc)); + for(std::size_t i=0; igetNumberOfCells(); + mcIdType nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); f1->setDescription("DescriptionOfFieldOnCells"); //not saved in file? @@ -422,7 +422,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() } MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); - int 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? @@ -472,15 +472,15 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() WriteUMeshes(_file_name_with_faces.c_str(), meshes, true); MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str()); - DataArrayInt* FacesFam=DataArrayInt::New(); + DataArrayIdType* FacesFam=DataArrayIdType::New(); FacesFam->alloc(mfm->getSizeAtLevel(-1),1); FacesFam->fillWithValue(-1); - DataArrayInt* CellsFam=DataArrayInt::New(); + DataArrayIdType* CellsFam=DataArrayIdType::New(); CellsFam->alloc(mfm->getSizeAtLevel(0),1); CellsFam->fillWithValue(1); mfm->setFamilyFieldArr(-1,FacesFam); mfm->setFamilyFieldArr(0,CellsFam); - map theFamilies; + map theFamilies; theFamilies["FAMILLE_ZERO"]=0; theFamilies["FamilyFaces"]=-1; theFamilies["FamilyCells"]=1; @@ -594,10 +594,10 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int DataArrayDouble* coords=mesh->getCoords(); //int nbOfComp=coords->getNumberOfComponents(); //be 3D - int nbOfTuple=coords->getNumberOfTuples(); + mcIdType nbOfTuple=coords->getNumberOfTuples(); double* ptr=coords->getPointer(); double* ptrini=ptrInit; - for (int i=0; igetMesh()->getNumberOfCells(); - int nb=nbcell*nbptgauss; + mcIdType nbcell=f3->getMesh()->getNumberOfCells(); + mcIdType nb=nbcell*nbptgauss; int nbcomp=2; array->alloc(nb,nbcomp); double *ptr=array->getPointer(); @@ -805,8 +805,8 @@ void MEDPARTITIONERTest::testMeshCollectionSingle() CPPUNIT_ASSERT(collection.getName()=="testMesh"); CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(1,collection.getNbOfGlobalMeshes()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk,collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk),collection.getNbOfLocalCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj),collection.getNbOfLocalFaces()); } void MEDPARTITIONERTest::testMeshCollectionXml() @@ -821,8 +821,8 @@ void MEDPARTITIONERTest::testMeshCollectionXml() CPPUNIT_ASSERT(collection.getName()=="testMesh"); CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(8,collection.getNbOfGlobalMeshes()); - CPPUNIT_ASSERT_EQUAL(_ni*_nj*_nk*8,collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(_ni*_nj*_nk*8),collection.getNbOfLocalCells()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces()); } @@ -1064,17 +1064,17 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); std::vectorcellMeshes=collection.getMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); - int nbcells=0; + mcIdType nbcells=0; for (std::size_t i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); std::vectorfaceMeshes=collection.getFaceMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); - int nbfaces=0; + mcIdType nbfaces=0; for (std::size_t i=0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL((int)faceMesh->getNumberOfCells(), nbfaces); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); //merge split meshes and test equality cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc @@ -1105,7 +1105,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std */ std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1175,7 +1175,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1186,8 +1186,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC MCAuto field2Tmp(ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1)); MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(field2Tmp)); - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + mcIdType nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); @@ -1200,21 +1200,21 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC } int nbequal=0; - int nbcomp=field1->getNumberOfComponents(); + std::size_t nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); + mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int i1=pc[i]*nbcomp; - int i2=i*nbcomp; - for (int j = 0; j < nbcomp; j++) + 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++; //cout<<" "<decrRef(); @@ -1263,7 +1263,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); std::vector meshes; - std::vector corr; + std::vector corr; meshes.push_back(cellMesh); refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); meshes.push_back(refusedCellMesh); @@ -1274,8 +1274,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG MCAuto field2Tmp=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); MCAuto field1(MEDCoupling::DynamicCast(field1Tmp)),field2(MEDCoupling::DynamicCast(field2Tmp)); - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL((int)cellMesh->getNumberOfCells(), nbcells); + mcIdType nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); @@ -1289,21 +1289,21 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG } int nbequal=0; int nbptgauss=8; - int nbcomp=field1->getNumberOfComponents(); + std::size_t nbcomp=field1->getNumberOfComponents(); double* p1=f1->getPointer(); double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); + mcIdType* pc=corr[1]->getPointer(); for (int i = 0; i < nbcells; i++) { - int i1=pc[i]*nbcomp*nbptgauss; - int i2=i*nbcomp*nbptgauss; - for (int j = 0; j < nbcomp*nbptgauss; j++) + 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++; //cout<<" "<decrRef(); @@ -1336,7 +1336,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() int nbFam1, nbFam2, nbc; { const int nbX = 20, nbY = 15; - vector conn; + vector conn; vector coor; for (int j=0; j<=nbY; j++) for (int i=0; i<=nbX; i++) @@ -1358,14 +1358,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(2); - nbc=conn.size()/4; //nb of cells + nbc=(int)conn.size()/4; //nb of cells mesh->allocateCells(nbc); - int* pConn = &conn[0]; + mcIdType* pConn = &conn[0]; for(int i=0; iinsertNextCell(INTERP_KERNEL::NORM_QUAD4,4,pConn); mesh->finishInsertingCells(); - int nbv=coor.size()/2; //nb of vertices + int nbv=(int)coor.size()/2; //nb of vertices DataArrayDouble *myCoords=DataArrayDouble::New(); myCoords->useArray( &coor[0], /*ownership=*/false, DeallocType::CPP_DEALLOC, nbv, 2 ); mesh->setCoords(myCoords); @@ -1374,14 +1374,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() mesh->checkConsistencyLight(); // groups of cells - DataArrayInt* cellsFam=DataArrayInt::New(); + DataArrayIdType* cellsFam=DataArrayIdType::New(); cellsFam->alloc(nbc,1); nbFam1 = nbc/3, nbFam2 = nbc/2; int iE = 0; for ( int i = 0; i < nbFam1; ++i ) cellsFam->getPointer()[ iE++ ] = idFam1; for ( int i = 0; i < nbFam2; ++i ) cellsFam->getPointer()[ iE++ ] = idFam2; for ( ; iE < nbc; ) cellsFam->getPointer()[ iE++ ] = 0; - map theFamilies; + map theFamilies; theFamilies["FAMILLE_ZERO"]=0; theFamilies["Family1" ]=idFam1; theFamilies["Family2" ]=idFam2; @@ -1432,7 +1432,7 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes()); CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells()); - CPPUNIT_ASSERT_EQUAL(0,collection.getNbOfLocalFaces()); + CPPUNIT_ASSERT_EQUAL(ToIdType(0),collection.getNbOfLocalFaces()); CPPUNIT_ASSERT (new_collection.getNbOfLocalFaces() > 0 ); MyGlobals::_General_Informations.clear(); @@ -1443,14 +1443,14 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // Check that "groups and family handling is NOT bugged" MeshCollection new_collection(std::string(xmlName)+".xml"); - std::map< int, int > famId2nb; // count total nb of cells in divided families - std::map< int, int >::iterator id2nn; + std::map< mcIdType, int > famId2nb; // count total nb of cells in divided families + std::map< mcIdType, int >::iterator id2nn; { - const std::vector& famIdsVec = new_collection.getCellFamilyIds(); + const std::vector& famIdsVec = new_collection.getCellFamilyIds(); for ( size_t i = 0; i < famIdsVec.size(); ++i ) { - MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i]; - for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) + MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; + for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; id2nn->second++; @@ -1468,11 +1468,11 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // Check that "creates boundary faces option is handled" famId2nb.clear(); - const std::vector& famIdsVec = new_collection.getFaceFamilyIds(); + const std::vector& famIdsVec = new_collection.getFaceFamilyIds(); for ( size_t i = 0; i < famIdsVec.size(); ++i ) { - MEDCoupling::DataArrayInt* famIdsArr = famIdsVec[i]; - for ( int j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) + MEDCoupling::DataArrayIdType* famIdsArr = famIdsVec[i]; + for ( mcIdType j = famIdsArr->getNbOfElems()-1; j >= 0; --j ) { id2nn = famId2nb.insert( make_pair( famIdsArr->getPointer()[j], 0 )).first; id2nn->second++; @@ -1483,9 +1483,9 @@ void MEDPARTITIONERTest::testCreateBoundaryFaces2D() // for each "JOINT_n_p_..." group there must be "JOINT_p_n_..." group // of the same size - std::map& famName2id = new_collection.getFamilyInfo(); - std::map::iterator na2id = famName2id.begin(), na2id2; - std::set< int > okFamIds; + std::map& famName2id = new_collection.getFamilyInfo(); + std::map::iterator na2id = famName2id.begin(), na2id2; + std::set< mcIdType > okFamIds; okFamIds.insert(0); for ( ; na2id != famName2id.end(); ++na2id ) { diff --git a/src/MEDPartitioner_Swig/CMakeLists.txt b/src/MEDPartitioner_Swig/CMakeLists.txt index c24e4cf3e..a5ef082df 100644 --- a/src/MEDPartitioner_Swig/CMakeLists.txt +++ b/src/MEDPartitioner_Swig/CMakeLists.txt @@ -21,6 +21,10 @@ INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${HDF5_DEFINITIONS} ${MEDFILE_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDPartitioner.i PROPERTIES SWIG_FLAGS "-py3") diff --git a/src/ParaMEDLoader/CMakeLists.txt b/src/ParaMEDLoader/CMakeLists.txt index 1bf934ecd..bd76a8332 100644 --- a/src/ParaMEDLoader/CMakeLists.txt +++ b/src/ParaMEDLoader/CMakeLists.txt @@ -24,6 +24,10 @@ IF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) ADD_DEFINITIONS("-DHDF5_IS_PARALLEL") ENDIF(HDF5_ENABLE_PARALLEL OR HDF5_IS_PARALLEL) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${MPI_INCLUDE_DIRS} ${MEDFILE_INCLUDE_DIRS} diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index dbf9c1103..69f94c8b8 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -88,15 +88,16 @@ MEDFileUMesh *ParaMEDFileUMesh::ParaNew(int iPart, int nbOfParts, const MPI_Comm MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts, const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs) { MCAuto ret; - int meshDim, spaceDim, numberOfNodes; + int meshDim, spaceDim; + mcIdType numberOfNodes; std::vector< std::vector< std::pair > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); std::vector types; - std::vector distrib; + std::vector distrib; for(std::vector< std::vector< std::pair > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++) for(std::vector< std::pair >::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++) { types.push_back((*it1).first); - int tmp[3]; + mcIdType tmp[3]; DataArray::GetSlice(0,(*it1).second,1,iPart,nbOfParts,tmp[0],tmp[1]); tmp[2]=1; distrib.insert(distrib.end(),tmp,tmp+3); diff --git a/src/ParaMEDLoader/ParaMEDLoader.cxx b/src/ParaMEDLoader/ParaMEDLoader.cxx index 4c72d0be9..dbd238af1 100644 --- a/src/ParaMEDLoader/ParaMEDLoader.cxx +++ b/src/ParaMEDLoader/ParaMEDLoader.cxx @@ -56,11 +56,11 @@ void ParaMEDLoader::WriteParaMesh(const char *fileName, MEDCoupling::ParaMESH *m */ void ParaMEDLoader::WriteMasterFile(const char *fileName, const std::vector& fileNames, const char *meshName) { - int nbOfDom=fileNames.size(); + std::size_t nbOfDom=fileNames.size(); std::ofstream fs(fileName); fs << "#MED Fichier V 2.3" << " " << std::endl; fs << "#"<<" " << std::endl; fs << nbOfDom <<" " << std::endl; - for(int i=0;igetSpaceDimension()), _proc_group(&group), _owns_processor_group(false) { - vector axis_length(_dimension); + vector axis_length(_dimension); _nb_elems=1; for (int idim=0; idim <_dimension; idim++) { @@ -119,7 +119,7 @@ namespace MEDCoupling _proc_group=geom_topo.getProcGroup(); _local_array_indices=geom_topo._local_array_indices; vector comp_indices = *(comp_topo.getBlockIndices()); - _local_array_indices.push_back(comp_indices); + _local_array_indices.emplace_back( comp_indices.begin(), comp_indices.end() ); _nb_procs_per_dim=geom_topo._nb_procs_per_dim; _nb_procs_per_dim.push_back(comp_topo.nbBlocks()); _cycle_type=geom_topo._cycle_type; @@ -137,16 +137,16 @@ namespace MEDCoupling * to \a group will cause an MPI error, while calling from a subset * of \a group will result in a deadlock. */ - BlockTopology::BlockTopology(const ProcessorGroup& group, int nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false) + BlockTopology::BlockTopology(const ProcessorGroup& group, mcIdType nb_elem):_dimension(1),_proc_group(&group),_owns_processor_group(false) { - int* nbelems_per_proc = new int[group.size()]; + mcIdType* nbelems_per_proc = new mcIdType[group.size()]; const MPIProcessorGroup* mpi_group=dynamic_cast(_proc_group); const MPI_Comm* comm=mpi_group->getComm(); - int nbtemp=nb_elem; - mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_INT, - nbelems_per_proc, 1, MPI_INT, + mcIdType nbtemp=nb_elem; + mpi_group->getCommInterface().allGather(&nbtemp, 1, MPI_ID_TYPE, + nbelems_per_proc, 1, MPI_ID_TYPE, *comm); - _nb_elems=0; + _nb_elems=0; //splitting along only dimension _local_array_indices.resize(1); @@ -174,22 +174,22 @@ namespace MEDCoupling } //!converts a pair to a global number - std::pair BlockTopology::globalToLocal(const int global) const + std::pair BlockTopology::globalToLocal(const mcIdType global) const { int subdomain_id=0; - int position=global; - int size=_nb_elems; - int size_procs=_proc_group->size(); - int increment=size; - vectoraxis_position(_dimension); - vectoraxis_offset(_dimension); + mcIdType position=global; + mcIdType size=_nb_elems; + std::size_t size_procs=_proc_group->size(); + mcIdType increment=size; + vectoraxis_position(_dimension); + vectoraxis_offset(_dimension); for (int idim=0; idim<_dimension; idim++) { - int axis_size=_local_array_indices[idim].size()-1; - int axis_nb_elem=_local_array_indices[idim][axis_size]; + 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 proc_increment = size_procs/(axis_size); - int 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) @@ -200,8 +200,8 @@ namespace MEDCoupling axis_position[idim]=axis_pos-_local_array_indices[idim][iaxis-1]; axis_offset[idim]=iaxis; } - int local=0; - int local_increment=1; + mcIdType local=0; + mcIdType local_increment=1; for (int idim=_dimension-1; idim>=0; idim--) { local+=axis_position[idim]*local_increment; @@ -211,26 +211,26 @@ namespace MEDCoupling } //!converts local number to a global number - int BlockTopology::localToGlobal(const pair local) const + mcIdType BlockTopology::localToGlobal(const pair local) const { - int subdomain_id=local.first; - int global=0; - int loc=local.second; - int increment=_nb_elems; - int proc_increment=_proc_group->size(); - int local_increment=getNbLocalElements(); + std::size_t subdomain_id=local.first; + mcIdType global=0; + mcIdType loc=local.second; + mcIdType increment=_nb_elems; + std::size_t proc_increment=_proc_group->size(); + mcIdType local_increment=getNbLocalElements(); for (int idim=0; idim < _dimension; idim++) { - int axis_size=_local_array_indices[idim].size()-1; - int axis_nb_elem=_local_array_indices[idim][axis_size]; + std::size_t axis_size=_local_array_indices[idim].size()-1; + 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); - int proc_axis=subdomain_id/proc_increment; + proc_increment = proc_increment/axis_size; + std::size_t proc_axis=subdomain_id/proc_increment; subdomain_id=subdomain_id%proc_increment; - int local_axis_nb_elem=_local_array_indices[idim][proc_axis+1]-_local_array_indices[idim][proc_axis]; + 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); - int iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis]; + mcIdType iaxis=((local_increment==0)?0:(loc/local_increment))+_local_array_indices[idim][proc_axis]; global+=increment*iaxis; loc = (local_increment==0)?0:(loc%local_increment); } @@ -238,18 +238,18 @@ namespace MEDCoupling } //Retrieves the local number of elements - int BlockTopology::getNbLocalElements()const + mcIdType BlockTopology::getNbLocalElements()const { int position=_proc_group->myRank(); - int nb_elem = 1; + mcIdType nb_elem = 1; int increment=1; for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; int idim=position%increment; position=position/increment; - int imin=_local_array_indices[i][idim]; - int imax=_local_array_indices[i][idim+1]; + mcIdType imin=_local_array_indices[i][idim]; + mcIdType imax=_local_array_indices[i][idim+1]; nb_elem*=(imax-imin); } return nb_elem; @@ -260,16 +260,16 @@ namespace MEDCoupling * as a size and each pair contains min and max. Indices * range from min to max-1. */ - std::vector > BlockTopology::getLocalArrayMinMax() const + std::vector > BlockTopology::getLocalArrayMinMax() const { - vector > local_indices (_dimension); + vector > local_indices (_dimension); int myrank=_proc_group->myRank(); int increment=1; for (int i=_dimension-1; i>=0; i--) { increment *=_nb_procs_per_dim[i]; int idim=myrank%increment; - local_indices[i].first=_local_array_indices[i][idim]; + 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< buffer; + vector buffer; buffer.push_back(_dimension); buffer.push_back(_nb_elems); @@ -288,13 +288,13 @@ namespace MEDCoupling { buffer.push_back(_nb_procs_per_dim[i]); buffer.push_back(_cycle_type[i]); - buffer.push_back(_local_array_indices[i].size()); - for (int j=0; j<(int)_local_array_indices[i].size(); j++) + buffer.push_back(ToIdType(_local_array_indices[i].size())); + for (std::size_t j=0; j<_local_array_indices[i].size(); j++) buffer.push_back(_local_array_indices[i][j]); } //serializing the comm group - int size_comm=_proc_group->size(); + mcIdType size_comm=_proc_group->size(); buffer.push_back(size_comm); MPIProcessorGroup world_group(_proc_group->getCommInterface()); for (int i=0; i procs; - int size_comm=*(ptr_serializer++); + mcIdType size_comm=*(ptr_serializer++); for (int i=0; i globalToLocal (const int) const ; - int localToGlobal (const std::pair) const; - std::vector > getLocalArrayMinMax() const ; + std::pair globalToLocal (const mcIdType) const ; + mcIdType localToGlobal (const std::pair) const; + std::vector > getLocalArrayMinMax() const ; int getDimension() const { return _dimension; } - void serialize(int* & serializer, int& size) const ; - void unserialize(const int* serializer, const CommInterface& comm_interface); + void serialize(mcIdType* & serializer, mcIdType& size) const ; + void unserialize(const mcIdType* serializer, const CommInterface& comm_interface); private: //dimension : 2 or 3 int _dimension; //proc array std::vector _nb_procs_per_dim; //stores the offsets vector - std::vector > _local_array_indices; + std::vector > _local_array_indices; //stores the cycle type (block or cyclic) std::vector _cycle_type; //Processor group const ProcessorGroup* _proc_group; //nb of elements - int _nb_elems; + mcIdType _nb_elems; bool _owns_processor_group; }; } diff --git a/src/ParaMEDMEM/CMakeLists.txt b/src/ParaMEDMEM/CMakeLists.txt index 98aa37d05..7324dd19d 100644 --- a/src/ParaMEDMEM/CMakeLists.txt +++ b/src/ParaMEDMEM/CMakeLists.txt @@ -20,6 +20,10 @@ ADD_DEFINITIONS(${MPI_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + INCLUDE_DIRECTORIES( ${MPI_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/ParaMEDMEM/CommInterface.hxx b/src/ParaMEDMEM/CommInterface.hxx index c24c4fcfc..e76f22e6e 100644 --- a/src/ParaMEDMEM/CommInterface.hxx +++ b/src/ParaMEDMEM/CommInterface.hxx @@ -21,6 +21,9 @@ #define __COMMINTERFACE_HXX__ #include + +#include "ParaIdType.hxx" + namespace MEDCoupling { diff --git a/src/ParaMEDMEM/ComponentTopology.hxx b/src/ParaMEDMEM/ComponentTopology.hxx index 429bac236..90048bc17 100644 --- a/src/ParaMEDMEM/ComponentTopology.hxx +++ b/src/ParaMEDMEM/ComponentTopology.hxx @@ -51,7 +51,7 @@ namespace MEDCoupling //!returns the number of the first MED component on local processor int firstLocalComponent() const ; //!returns the number of blocks in the topology - int nbBlocks()const {return _component_array.size()-1;} + int nbBlocks()const {return (int)_component_array.size()-1;} //!returns the block structure const std::vector* getBlockIndices() const { return &_component_array; } const ProcessorGroup* getProcGroup()const { return _proc_group; } diff --git a/src/ParaMEDMEM/DisjointDEC.cxx b/src/ParaMEDMEM/DisjointDEC.cxx index 334af2106..48d90c5c4 100644 --- a/src/ParaMEDMEM/DisjointDEC.cxx +++ b/src/ParaMEDMEM/DisjointDEC.cxx @@ -133,9 +133,9 @@ namespace MEDCoupling const std::set& target_ids, const MPI_Comm& world_comm): _local_field(0), + _comm_interface(0), _owns_field(false), _owns_groups(true), - _comm_interface(0), _union_comm(MPI_COMM_NULL) { MEDCoupling::CommInterface comm; @@ -151,7 +151,7 @@ namespace MEDCoupling // Create a communicator on these procs MPI_Group union_group,world_group; comm.commGroup(world_comm,&world_group); - comm.groupIncl(world_group,union_ids.size(),union_ranks_world,&union_group); + comm.groupIncl(world_group,(int)union_ids.size(),union_ranks_world,&union_group); comm.commCreate(world_comm,union_group,&_union_comm); delete[] union_ranks_world; if (_union_comm==MPI_COMM_NULL) @@ -171,8 +171,8 @@ namespace MEDCoupling int* target_ranks_world=new int[target_ids.size()]; // ranks of targets in world_comm std::copy(target_ids.begin(), target_ids.end(),target_ranks_world); int* target_ranks_union=new int[target_ids.size()]; // ranks of targets in union_comm - MPI_Group_translate_ranks(world_group,source_ids.size(),source_ranks_world,union_group,source_ranks_union); - MPI_Group_translate_ranks(world_group,target_ids.size(),target_ranks_world,union_group,target_ranks_union); + MPI_Group_translate_ranks(world_group,(int)source_ids.size(),source_ranks_world,union_group,source_ranks_union); + MPI_Group_translate_ranks(world_group,(int)target_ids.size(),target_ranks_world,union_group,target_ranks_union); std::set source_ids_union; for (int i=0;i<(int)source_ids.size();i++) source_ids_union.insert(source_ranks_union[i]); @@ -237,7 +237,7 @@ namespace MEDCoupling std::set union_ids; // source and target ids in world_comm union_ids.insert(src->getProcIDs().begin(),src->getProcIDs().end()); union_ids.insert(tgt->getProcIDs().begin(),tgt->getProcIDs().end()); - if(union_ids.size()!=size) + if((int)union_ids.size()!=size) throw INTERP_KERNEL::Exception("DisjointDEC constructor: source_ids and target_ids do not form a partition of the communicator! Restrain the world communicator passed to MPIProcessorGroup ctor."); } @@ -331,7 +331,7 @@ namespace MEDCoupling void DisjointDEC::renormalizeTargetField(bool isWAbs) { if (_source_group->containsMyRank()) - for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) + for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm = total_norm; @@ -340,7 +340,7 @@ namespace MEDCoupling } if (_target_group->containsMyRank()) { - for (int icomp=0; icomp<_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) + for (int icomp=0; icomp<(int)_local_field->getField()->getArray()->getNumberOfComponents(); icomp++) { double total_norm = _local_field->getVolumeIntegral(icomp+1,isWAbs); double source_norm=total_norm; diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index 6f09ce2dc..753249170 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -81,14 +81,14 @@ namespace MEDCoupling */ void ElementLocator::exchangeMesh(int idistantrank, MEDCouplingPointSet*& distant_mesh, - int*& distant_ids) + mcIdType*& distant_ids) { int rank = _union_group->translateRank(&_distant_group,idistantrank); if (find(_distant_proc_ids.begin(), _distant_proc_ids.end(),rank)==_distant_proc_ids.end()) return; - MCAuto elems; + MCAuto elems; #ifdef USE_DIRECTED_BB INTERP_KERNEL::DirectedBoundingBox dbb; double* distant_bb = _domain_bounding_boxes+rank*dbb.dataSize(_local_cell_mesh_space_dim); @@ -99,7 +99,7 @@ namespace MEDCoupling elems=_local_cell_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); #endif - DataArrayInt *distant_ids_send; + DataArrayIdType *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(); @@ -227,15 +227,15 @@ namespace MEDCoupling void ElementLocator::_exchangeMesh( MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh, int iproc_distant, - const DataArrayInt* distant_ids_send, - int*& distant_ids_recv) + const DataArrayIdType* distant_ids_send, + mcIdType*& distant_ids_recv) { CommInterface comm_interface=_union_group->getCommInterface(); // First stage : exchanging sizes // ------------------------------ vector tinyInfoLocalD,tinyInfoDistantD(1);//not used for the moment - vector tinyInfoLocal,tinyInfoDistant; + vector tinyInfoLocal,tinyInfoDistant; vector tinyInfoLocalS; //Getting tiny info of local mesh to allow the distant proc to initialize and allocate //the transmitted mesh. @@ -252,12 +252,12 @@ namespace MEDCoupling int iprocdistant_in_union = group->translateRank(&_distant_group, iproc_distant); - comm_interface.sendRecv(&tinyInfoLocal[0], tinyInfoLocal.size(), MPI_INT, iprocdistant_in_union, 1112, - &tinyInfoDistant[0], tinyInfoDistant.size(), MPI_INT,iprocdistant_in_union,1112, + 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); - DataArrayInt *v1Local=0; + DataArrayIdType *v1Local=0; DataArrayDouble *v2Local=0; - DataArrayInt *v1Distant=DataArrayInt::New(); + DataArrayIdType *v1Distant=DataArrayIdType::New(); DataArrayDouble *v2Distant=DataArrayDouble::New(); //serialization of local mesh to send data to distant proc. local_mesh->serialize(v1Local,v2Local); @@ -265,10 +265,10 @@ namespace MEDCoupling MEDCouplingPointSet *distant_mesh_tmp=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]); std::vector unusedTinyDistantSts; distant_mesh_tmp->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); - int nbLocalElems=0; - int nbDistElem=0; - int *ptLocal=0; - int *ptDist=0; + mcIdType nbLocalElems=0; + mcIdType nbDistElem=0; + mcIdType *ptLocal=0; + mcIdType *ptDist=0; if(v1Local) { nbLocalElems=v1Local->getNbOfElems(); @@ -279,9 +279,9 @@ namespace MEDCoupling nbDistElem=v1Distant->getNbOfElems(); ptDist=v1Distant->getPointer(); } - comm_interface.sendRecv(ptLocal, nbLocalElems, MPI_INT, + comm_interface.sendRecv(ptLocal, (int)nbLocalElems, MPI_ID_TYPE, iprocdistant_in_union, 1111, - ptDist, nbDistElem, MPI_INT, + ptDist, (int)nbDistElem, MPI_ID_TYPE, iprocdistant_in_union,1111, *comm, &status); nbLocalElems=0; @@ -298,9 +298,9 @@ namespace MEDCoupling nbDistElem=v2Distant->getNbOfElems(); ptDist2=v2Distant->getPointer(); } - comm_interface.sendRecv(ptLocal2, nbLocalElems, MPI_DOUBLE, + comm_interface.sendRecv(ptLocal2, (int)nbLocalElems, MPI_DOUBLE, iprocdistant_in_union, 1112, - ptDist2, nbDistElem, MPI_DOUBLE, + ptDist2, (int)nbDistElem, MPI_DOUBLE, iprocdistant_in_union, 1112, *comm, &status); // @@ -308,10 +308,10 @@ namespace MEDCoupling //finish unserialization distant_mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); // - distant_ids_recv=new int[tinyInfoDistant.back()]; - comm_interface.sendRecv(const_cast(reinterpret_cast(distant_ids_send->getConstPointer())),tinyInfoLocal.back(), MPI_INT, + distant_ids_recv=new mcIdType[tinyInfoDistant.back()]; + comm_interface.sendRecv(const_cast(reinterpret_cast(distant_ids_send->getConstPointer())),(int)tinyInfoLocal.back(), MPI_ID_TYPE, iprocdistant_in_union, 1113, - distant_ids_recv,tinyInfoDistant.back(), MPI_INT, + distant_ids_recv,(int)tinyInfoDistant.back(), MPI_ID_TYPE, iprocdistant_in_union,1113, *comm, &status); if(v1Local) @@ -344,17 +344,17 @@ namespace MEDCoupling /*! * connected with ElementLocator::recvFromWorkingSideL */ - void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) + void ElementLocator::sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; + const vector& eltIds=distantLocEltIds[procId]; const vector& valued=partialSumRelToDistantIds[procId]; - int lgth=eltIds.size(); + int lgth=(int)eltIds.size(); comm.send(&lgth,1,MPI_INT,*iter,1114,*_comm); - comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1115,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1115,*_comm); comm.send(const_cast(reinterpret_cast(&valued[0])),lgth,MPI_DOUBLE,*iter,1116,*_comm); } } @@ -370,30 +370,30 @@ namespace MEDCoupling for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { std::vector& vec=globalSumRelToDistantIds[procId]; - comm.recv(&vec[0],vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status); + comm.recv(&vec[0],(int)vec.size(),MPI_DOUBLE,*iter,1117,*_comm,&status); } } /*! * connected with ElementLocator::recvLocalIdsFromWorkingSideL */ - void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds) + void ElementLocator::sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds) { int procId=0; CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& eltIds=distantLocEltIds[procId]; - int lgth=eltIds.size(); + const vector& eltIds=distantLocEltIds[procId]; + int lgth=(int)eltIds.size(); comm.send(&lgth,1,MPI_INT,*iter,1121,*_comm); - comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_INT,*iter,1122,*_comm); + comm.send(const_cast(reinterpret_cast(&eltIds[0])),lgth,MPI_ID_TYPE,*iter,1122,*_comm); } } /*! * connected with ElementLocator::sendGlobalIdsToWorkingSideL */ - void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) + void ElementLocator::recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -401,17 +401,17 @@ namespace MEDCoupling globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vec=distantLocEltIds[procId]; - std::vector& global=globalIds[procId]; + const std::vector& vec=distantLocEltIds[procId]; + std::vector& global=globalIds[procId]; global.resize(vec.size()); - comm.recv(&global[0],vec.size(),MPI_INT,*iter,1123,*_comm,&status); + comm.recv(&global[0],(int)vec.size(),MPI_ID_TYPE,*iter,1123,*_comm,&status); } } /*! * connected with ElementLocator::sendCandidatesGlobalIdsToWorkingSideL */ - void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds) + void ElementLocator::recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds) { int procId=0; CommInterface comm; @@ -419,26 +419,26 @@ namespace MEDCoupling globalIds.resize(_distant_proc_ids.size()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - std::vector& global=globalIds[procId]; + std::vector& global=globalIds[procId]; int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1132,*_comm,&status); global.resize(lgth); - comm.recv(&global[0],lgth,MPI_INT,*iter,1133,*_comm,&status); + comm.recv(&global[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm,&status); } } /*! * connected with ElementLocator::recvSumFromWorkingSideL */ - void ElementLocator::sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum) + void ElementLocator::sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { comm.send(&lgth,1,MPI_INT,*iter,1124,*_comm); - comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1125,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1125,*_comm); comm.send(const_cast(reinterpret_cast(&sum[0])),lgth,MPI_DOUBLE,*iter,1126,*_comm); } } @@ -446,35 +446,35 @@ namespace MEDCoupling /*! * connected with ElementLocator::recvCandidatesForAddElementsL */ - void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) + void ElementLocator::sendCandidatesForAddElementsW(const std::vector& distantGlobIds) { int procId=0; CommInterface comm; - int lgth=distantGlobIds.size(); + int lgth=(int)distantGlobIds.size(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { comm.send(const_cast(reinterpret_cast(&lgth)),1,MPI_INT,*iter,1128,*_comm); - comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_INT,*iter,1129,*_comm); + comm.send(const_cast(reinterpret_cast(&distantGlobIds[0])),lgth,MPI_ID_TYPE,*iter,1129,*_comm); } } /*! * connected with ElementLocator::sendAddElementsToWorkingSideL */ - void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd) + void ElementLocator::recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd) { int procId=0; CommInterface comm; MPI_Status status; - int lgth=_distant_proc_ids.size(); + int lgth=(int)_distant_proc_ids.size(); elementsToAdd.resize(lgth); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int locLgth; - std::vector& eltToFeed=elementsToAdd[procId]; + std::vector& eltToFeed=elementsToAdd[procId]; comm.recv(&locLgth,1,MPI_INT,*iter,1130,*_comm,&status); eltToFeed.resize(locLgth); - comm.recv(&eltToFeed[0],locLgth,MPI_INT,*iter,1131,*_comm,&status); + comm.recv(&eltToFeed[0],locLgth,MPI_ID_TYPE,*iter,1131,*_comm,&status); } } @@ -485,7 +485,7 @@ namespace MEDCoupling { CommInterface comm; int toSend; - DataArrayInt *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); + DataArrayIdType *isCumulative=_local_para_field.returnCumulativeGlobalNumbering(); if(isCumulative) { toSend=CUMULATIVE_POLICY; @@ -512,12 +512,12 @@ namespace MEDCoupling { int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1114,*_comm,&status); - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; ids.resize(lgth); vector values(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1115,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1115,*_comm,&status); comm.recv(&values[0],lgth,MPI_DOUBLE,*iter,1116,*_comm,&status); - for(int i=0;i::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector valsToSend(ids.size()); vector::iterator iter3=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++) + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter3++) *iter3=_values_added[*iter2]; - comm.send(&valsToSend[0],ids.size(),MPI_DOUBLE,*iter,1117,*_comm); + comm.send(&valsToSend[0],(int)ids.size(),MPI_DOUBLE,*iter,1117,*_comm); //ids.clear(); } //_ids_per_working_proc.clear(); @@ -554,10 +554,10 @@ namespace MEDCoupling for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int lgth; - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; comm.recv(&lgth,1,MPI_INT,*iter,1121,*_comm,&status); ids.resize(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1122,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1122,*_comm,&status); } } @@ -568,16 +568,16 @@ namespace MEDCoupling { int procId=0; CommInterface comm; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) *iter1=globalIdsC[*iter2]; - comm.send(&valsToSend[0],ids.size(),MPI_INT,*iter,1123,*_comm); + comm.send(&valsToSend[0],(int)ids.size(),MPI_ID_TYPE,*iter,1123,*_comm); } if(globalIds) globalIds->decrRef(); @@ -588,24 +588,24 @@ namespace MEDCoupling */ void ElementLocator::recvSumFromWorkingSideL() { - int procId=0; - int wProcSize=_distant_proc_ids.size(); + std::size_t procId=0; + std::size_t wProcSize=_distant_proc_ids.size(); CommInterface comm; _ids_per_working_proc.resize(wProcSize); _values_per_working_proc.resize(wProcSize); MPI_Status status; - std::map sums; + std::map sums; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { int lgth; comm.recv(&lgth,1,MPI_INT,*iter,1124,*_comm,&status); - vector& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& vals=_values_per_working_proc[procId]; ids.resize(lgth); vals.resize(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1125,*_comm,&status); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1125,*_comm,&status); comm.recv(&vals[0],lgth,MPI_DOUBLE,*iter,1126,*_comm,&status); - vector::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::const_iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) sums[*iter1]+=*iter2; @@ -613,9 +613,9 @@ namespace MEDCoupling //assign sum to prepare sending to working side for(procId=0;procId& ids=_ids_per_working_proc[procId]; + vector& ids=_ids_per_working_proc[procId]; vector& vals=_values_per_working_proc[procId]; - vector::const_iterator iter1=ids.begin(); + vector::const_iterator iter1=ids.begin(); vector::iterator iter2=vals.begin(); for(;iter1!=ids.end();iter1++,iter2++) *iter2=sums[*iter1]; @@ -633,38 +633,38 @@ namespace MEDCoupling */ void ElementLocator::recvCandidatesForAddElementsL() { - int procId=0; - int wProcSize=_distant_proc_ids.size(); + std::size_t procId=0; + std::size_t wProcSize=_distant_proc_ids.size(); CommInterface comm; _ids_per_working_proc3.resize(wProcSize); MPI_Status status; std::map sums; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - int nbElts=globalIds->getNumberOfTuples(); - std::set globalIdsS(globalIdsC,globalIdsC+nbElts); + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); + mcIdType nbElts=globalIds->getNumberOfTuples(); + std::set globalIdsS(globalIdsC,globalIdsC+nbElts); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& ids0=_ids_per_working_proc[procId]; - int lgth0=ids0.size(); - std::set elts0; - for(int i=0;i& ids0=_ids_per_working_proc[procId]; + std::size_t lgth0=ids0.size(); + std::set elts0; + for(std::size_t i=0;i ids(lgth); - comm.recv(&ids[0],lgth,MPI_INT,*iter,1129,*_comm,&status); - set ids1(ids.begin(),ids.end()); + vector ids(lgth); + comm.recv(&ids[0],lgth,MPI_ID_TYPE,*iter,1129,*_comm,&status); + set ids1(ids.begin(),ids.end()); ids.clear(); set tmp5,tmp6; set_intersection(globalIdsS.begin(),globalIdsS.end(),ids1.begin(),ids1.end(),inserter(tmp5,tmp5.begin())); set_difference(tmp5.begin(),tmp5.end(),elts0.begin(),elts0.end(),inserter(tmp6,tmp6.begin())); - std::vector& ids2=_ids_per_working_proc3[procId]; + std::vector& ids2=_ids_per_working_proc3[procId]; ids2.resize(tmp6.size()); std::copy(tmp6.begin(),tmp6.end(),ids2.begin()); //global->local - for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) - *iter2=std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC; + for(std::vector::iterator iter2=ids2.begin();iter2!=ids2.end();iter2++) + *iter2=ToIdType(std::find(globalIdsC,globalIdsC+nbElts,*iter2)-globalIdsC); } if(globalIds) globalIds->decrRef(); @@ -679,10 +679,10 @@ namespace MEDCoupling CommInterface comm; for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const std::vector& vals=_ids_per_working_proc3[procId]; - int size=vals.size(); + const std::vector& vals=_ids_per_working_proc3[procId]; + int size=(int)vals.size(); comm.send(const_cast(reinterpret_cast(&size)),1,MPI_INT,*iter,1130,*_comm); - comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_INT,*iter,1131,*_comm); + comm.send(const_cast(reinterpret_cast(&vals[0])),size,MPI_ID_TYPE,*iter,1131,*_comm); } } @@ -694,25 +694,25 @@ namespace MEDCoupling { int procId=0; CommInterface comm; - DataArrayInt *globalIds=_local_para_field.returnGlobalNumbering(); - const int *globalIdsC=globalIds->getConstPointer(); - MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); - for(int *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) + DataArrayIdType *globalIds=_local_para_field.returnGlobalNumbering(); + const mcIdType *globalIdsC=globalIds->getConstPointer(); + MCAuto candidates=_local_para_field.getSupport()->getCellMesh()->findBoundaryNodes(); + for(mcIdType *iter1=candidates->getPointer();iter1!=candidates->getPointer()+candidates->getNumberOfTuples();iter1++) (*iter1)=globalIdsC[*iter1]; - std::set candidatesS(candidates->begin(),candidates->end()); + std::set candidatesS(candidates->begin(),candidates->end()); for(vector::const_iterator iter=_distant_proc_ids.begin();iter!=_distant_proc_ids.end();iter++,procId++) { - const vector& ids=_ids_per_working_proc[procId]; - vector valsToSend(ids.size()); - vector::iterator iter1=valsToSend.begin(); - for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) + const vector& ids=_ids_per_working_proc[procId]; + vector valsToSend(ids.size()); + vector::iterator iter1=valsToSend.begin(); + for(vector::const_iterator iter2=ids.begin();iter2!=ids.end();iter2++,iter1++) *iter1=globalIdsC[*iter2]; - std::set tmp2(valsToSend.begin(),valsToSend.end()); - std::vector tmp3; - set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(tmp3)); - int lgth=tmp3.size(); + std::set tmp2(valsToSend.begin(),valsToSend.end()); + std::vector tmp3; + set_intersection(candidatesS.begin(),candidatesS.end(),tmp2.begin(),tmp2.end(),std::back_insert_iterator< std::vector >(tmp3)); + int lgth=(int)tmp3.size(); comm.send(&lgth,1,MPI_INT,*iter,1132,*_comm); - comm.send(&tmp3[0],lgth,MPI_INT,*iter,1133,*_comm); + comm.send(&tmp3[0],lgth,MPI_ID_TYPE,*iter,1133,*_comm); } if(globalIds) globalIds->decrRef(); diff --git a/src/ParaMEDMEM/ElementLocator.hxx b/src/ParaMEDMEM/ElementLocator.hxx index f5704949f..b5013f8e0 100644 --- a/src/ParaMEDMEM/ElementLocator.hxx +++ b/src/ParaMEDMEM/ElementLocator.hxx @@ -47,7 +47,7 @@ namespace MEDCoupling virtual ~ElementLocator(); void exchangeMesh(int idistantrank, MEDCouplingPointSet*& target_mesh, - int*& distant_ids); + mcIdType*& distant_ids); void exchangeMethod(const std::string& sourceMeth, int idistantrank, std::string& targetMeth); const std::vector& getDistantProcIds() const { return _distant_proc_ids; } const MPI_Comm *getCommunicator() const; @@ -56,15 +56,15 @@ namespace MEDCoupling bool isM1DCorr() const { return _is_m1d_corr; } //Working side methods void recvPolicyFromLazySideW(std::vector& policy); - void sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds); + void sendSumToLazySideW(const std::vector< std::vector >& distantLocEltIds, const std::vector< std::vector >& partialSumRelToDistantIds); void recvSumFromLazySideW(std::vector< std::vector >& globalSumRelToDistantIds); - void sendCandidatesForAddElementsW(const std::vector& distantGlobIds); - void recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd); + void sendCandidatesForAddElementsW(const std::vector& distantGlobIds); + void recvAddElementsFromLazyProcsW(std::vector >& elementsToAdd); // - void sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds); - void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds); - void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds); - void sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum); + void sendLocalIdsToLazyProcsW(const std::vector< std::vector >& distantLocEltIds); + void recvGlobalIdsFromLazyProcsW(const std::vector< std::vector >& distantLocEltIds, std::vector< std::vector >& globalIds); + void recvCandidatesGlobalIdsFromLazyProcsW(std::vector< std::vector >& globalIds); + void sendPartialSumToLazyProcsW(const std::vector& distantGlobIds, const std::vector& sum); //Lazy side methods int sendPolicyToWorkingSideL(); void recvFromWorkingSideL(); @@ -81,8 +81,8 @@ namespace MEDCoupling void _computeBoundingBoxes(); bool _intersectsBoundingBox(int irank); void _exchangeMesh(MEDCouplingPointSet* local_mesh, MEDCouplingPointSet*& distant_mesh, - int iproc_distant, const DataArrayInt* distant_ids_send, - int*& distant_ids_recv); + int iproc_distant, const DataArrayIdType* distant_ids_send, + mcIdType*& distant_ids_recv); private: const ParaFIELD& _local_para_field ; MEDCouplingPointSet* _local_cell_mesh; @@ -99,8 +99,8 @@ namespace MEDCoupling const MPI_Comm *_comm; //Attributes only used by lazy side std::vector _values_added; - std::vector< std::vector > _ids_per_working_proc; - std::vector< std::vector > _ids_per_working_proc3; + std::vector< std::vector > _ids_per_working_proc; + std::vector< std::vector > _ids_per_working_proc3; std::vector< std::vector > _values_per_working_proc; public: static const int CUMULATIVE_POLICY=3; diff --git a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx index d0e0abed8..c7b62a879 100644 --- a/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx +++ b/src/ParaMEDMEM/ExplicitCoincidentDEC.cxx @@ -145,16 +145,16 @@ namespace MEDCoupling vector* target_arrays=new vector[target_size]; - int nb_local = _toposource-> getNbLocalElements(); + mcIdType nb_local = _toposource-> getNbLocalElements(); - int union_size=group->size(); + std::size_t union_size=group->size(); _sendcounts=new int[union_size]; _senddispls=new int[union_size]; _recvcounts=new int[union_size]; _recvdispls=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _sendcounts[i]=0; _recvcounts[i]=0; @@ -177,7 +177,7 @@ namespace MEDCoupling int* counter=new int [target_size]; counter[0]=0; for (int i=1; igetField()->getArray()->getPointer(); @@ -205,21 +205,21 @@ namespace MEDCoupling return; MPIProcessorGroup* group=new MPIProcessorGroup(_topotarget->getProcGroup()->getCommInterface()); - vector < vector > source_arrays(_sourcegroup->size()); - int nb_local = _topotarget-> getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + vector < vector > source_arrays(_sourcegroup->size()); + mcIdType nb_local = _topotarget-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { - //pair source_local =_distant_elems[ielem]; - pair source_local=_explicit_mapping.getDistantNumbering(ielem); - source_arrays[source_local.first].push_back(source_local.second); + //pair source_local =_distant_elems[ielem]; + pair source_local=_explicit_mapping.getDistantNumbering(ielem); + source_arrays[source_local.first].push_back(source_local.second); } - int union_size=group->size(); + std::size_t union_size=group->size(); _recvcounts=new int[union_size]; _recvdispls=new int[union_size]; _sendcounts=new int[union_size]; _senddispls=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _sendcounts[i]=0; _recvcounts[i]=0; @@ -229,9 +229,9 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_sourcegroup,iproc); - _recvcounts[unionrank]=source_arrays[iproc].size()*_topotarget->getNbComponents(); + _recvcounts[unionrank]=(int)(source_arrays[iproc].size()*_topotarget->getNbComponents()); } - for (int i=1; igetNbComponents()]; @@ -249,8 +249,8 @@ namespace MEDCoupling { MPI_Status status; - int* serializer=0; - int size; + mcIdType* serializer=0; + mcIdType size; MPIProcessorGroup* group=new MPIProcessorGroup(*_comm_interface); @@ -264,8 +264,8 @@ namespace MEDCoupling int itarget=iproc; if (!toposend->getProcGroup()->contains(itarget)) { - _comm_interface->send(&size,1,MPI_INT, itarget,tag+itarget,*(group->getComm())); - _comm_interface->send(serializer, size, MPI_INT, itarget, tag+itarget,*(group->getComm())); + _comm_interface->send(&size,1,MPI_ID_TYPE, itarget,tag+itarget,*(group->getComm())); + _comm_interface->send(serializer, (int)size, MPI_ID_TYPE, itarget, tag+itarget,*(group->getComm())); } } } @@ -278,19 +278,19 @@ namespace MEDCoupling int isource = iproc; if (!toporecv->getProcGroup()->contains(isource)) { - int nbelem; - _comm_interface->recv(&nbelem, 1, MPI_INT, isource, tag+myworldrank, *(group->getComm()), &status); - int* buffer = new int[nbelem]; - _comm_interface->recv(buffer, nbelem, MPI_INT, isource,tag+myworldrank, *(group->getComm()), &status); + mcIdType nbelem; + _comm_interface->recv(&nbelem, 1, MPI_ID_TYPE, isource, tag+myworldrank, *(group->getComm()), &status); + mcIdType* buffer = new mcIdType[nbelem]; + _comm_interface->recv(buffer, (int)nbelem, MPI_ID_TYPE, isource,tag+myworldrank, *(group->getComm()), &status); ExplicitTopology* topotemp=new ExplicitTopology(); topotemp->unserialize(buffer, *_comm_interface); delete[] buffer; - for (int ielem=0; ielemgetNbLocalElements(); ielem++) + for (mcIdType ielem=0; ielemgetNbLocalElements(); ielem++) { - int global = toporecv->localToGlobal(ielem); - int sendlocal=topotemp->globalToLocal(global); + mcIdType global = toporecv->localToGlobal(ielem); + mcIdType sendlocal=topotemp->globalToLocal(global); if (sendlocal!=-1) { size2[iproc]++; @@ -327,7 +327,7 @@ namespace MEDCoupling } _comm_interface->allToAll(nb_transfer_union, 1, MPI_INT, dummy_recv, 1, MPI_INT, MPI_COMM_WORLD); - int* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank()); + mcIdType* sendbuffer= _explicit_mapping.serialize(_topotarget->getProcGroup()->myRank()); int* sendcounts= new int [world_size]; int* senddispls = new int [world_size]; @@ -347,7 +347,7 @@ namespace MEDCoupling recvcounts[i]=0; recvdispls[i]=0; } - _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_INT, dummyrecv, recvcounts, senddispls, MPI_INT, MPI_COMM_WORLD); + _comm_interface->allToAllV(sendbuffer, sendcounts, senddispls, MPI_ID_TYPE, dummyrecv, recvcounts, senddispls, MPI_ID_TYPE, MPI_COMM_WORLD); } //receiving in the source subdomains the mapping sent by targets @@ -367,7 +367,7 @@ namespace MEDCoupling int* targetranks = new int[ nbtarget]; for (int i=0; itranslateRank(_targetgroup,i); - int* mappingbuffer= new int [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]; @@ -387,7 +387,7 @@ namespace MEDCoupling sendcounts[i]=0; senddispls[i]=0; } - _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_INT, mappingbuffer, recvcounts, recvdispls, MPI_INT, MPI_COMM_WORLD); + _comm_interface->allToAllV(dummysend, sendcounts, senddispls, MPI_ID_TYPE, mappingbuffer, recvcounts, recvdispls, MPI_ID_TYPE, MPI_COMM_WORLD); _explicit_mapping.unserialize(world_size,nb_transfer_union,nbtarget, targetranks, mappingbuffer); } } @@ -402,7 +402,7 @@ namespace MEDCoupling _comm_interface->allToAllV(_sendbuffer, _sendcounts, _senddispls, MPI_DOUBLE, _recvbuffer, _recvcounts, _recvdispls, MPI_DOUBLE,MPI_COMM_WORLD); cout<<"end AllToAll"<getNbLocalElements(); + mcIdType nb_local = _topotarget->getNbLocalElements(); double* value=new double[nb_local*_topotarget->getNbComponents()]; vector counters(_sourcegroup->size()); diff --git a/src/ParaMEDMEM/ExplicitMapping.cxx b/src/ParaMEDMEM/ExplicitMapping.cxx index 7eff1780d..b82eaa7b5 100644 --- a/src/ParaMEDMEM/ExplicitMapping.cxx +++ b/src/ParaMEDMEM/ExplicitMapping.cxx @@ -35,12 +35,12 @@ namespace MEDCoupling if (_comm_buffer!=0) delete[] _comm_buffer; } - void ExplicitMapping::pushBackElem(std::pair idistant) + void ExplicitMapping::pushBackElem(std::pair idistant) { _mapping.push_back(idistant); } - void ExplicitMapping::setDistantElem(int ilocal, std::pair idistant) + void ExplicitMapping::setDistantElem(mcIdType ilocal, std::pair idistant) { _mapping[ilocal]=idistant; } @@ -49,15 +49,15 @@ namespace MEDCoupling { if (_distant_domains.empty()) { - for (std::vector >::const_iterator iter= _mapping.begin(); + for (std::vector >::const_iterator iter= _mapping.begin(); iter!=_mapping.end(); iter++) _distant_domains.insert(iter->first); } - return _distant_domains.size(); + return (int)_distant_domains.size(); } - std::pair ExplicitMapping::getDistantNumbering(int ielem)const + std::pair ExplicitMapping::getDistantNumbering(mcIdType ielem)const { return _mapping[ielem]; } @@ -77,17 +77,17 @@ namespace MEDCoupling return _numbers[i]; } - int* ExplicitMapping::serialize(int idproc) + mcIdType* ExplicitMapping::serialize(int idproc) { - _comm_buffer=new int[_mapping.size()*2]; - std::vector offsets(_distant_domains.size()); + _comm_buffer=new mcIdType[_mapping.size()*2]; + std::vector offsets(_distant_domains.size()); offsets[0]=0; for (int i=1; i<(int)_distant_domains.size();i++) offsets[i]=offsets[i-1]+_numbers[i-1]; for (int i=0; i<(int)_mapping.size(); i++) { - int offset= offsets[_mapping[i].first]; + mcIdType offset= offsets[_mapping[i].first]; _comm_buffer[offset*2]=idproc; _comm_buffer[offset*2+1]=_mapping[i].second; offsets[_mapping[i].first]++; @@ -95,7 +95,7 @@ namespace MEDCoupling return _comm_buffer; } - void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer) + void ExplicitMapping::unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer) { int total_size=0; for (int i=0; i< nbprocs; i++) @@ -109,7 +109,7 @@ namespace MEDCoupling { _mapping[indmap].first=i; _mapping[indmap].second=commbuffer[indmap*2+1]; - _buffer_index[indmap]=commbuffer[indmap*2+1]; + _buffer_index[indmap]=(int)commbuffer[indmap*2+1]; indmap++; } _numbers=new int [nbtarget]; diff --git a/src/ParaMEDMEM/ExplicitMapping.hxx b/src/ParaMEDMEM/ExplicitMapping.hxx index dcd69cf7e..95717ea31 100644 --- a/src/ParaMEDMEM/ExplicitMapping.hxx +++ b/src/ParaMEDMEM/ExplicitMapping.hxx @@ -20,6 +20,8 @@ #ifndef __EXPLICITMAPPING_HXX__ #define __EXPLICITMAPPING_HXX__ +#include "MCIdType.hxx" + #include #include #include @@ -37,24 +39,24 @@ namespace MEDCoupling ExplicitMapping(); ~ExplicitMapping(); - void pushBackElem(std::pair idistant); - void setDistantElem(int ilocal, std::pair idistant); + void pushBackElem(std::pair idistant); + void setDistantElem(mcIdType ilocal, std::pair idistant); int nbDistantDomains(); - std::pair getDistantNumbering(int ielem) const; + std::pair getDistantNumbering(mcIdType ielem) const; int getDistantDomain(int i); int getNbDistantElems(int i); - int* serialize(int idproc); - void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, int* commbuffer); + mcIdType* serialize(int idproc); + void unserialize(int nbprocs, int* sizes,int nbtarget, int* targetrank, mcIdType* commbuffer); int* getBufferIndex() const { return _buffer_index; } int* getCounts() const { return _send_counts; } private: - std::vector > _mapping; + std::vector > _mapping; std::set _distant_domains; int* _numbers; int* _domains; - int* _comm_buffer; + mcIdType* _comm_buffer; int* _buffer_index; int* _send_counts; diff --git a/src/ParaMEDMEM/ExplicitTopology.cxx b/src/ParaMEDMEM/ExplicitTopology.cxx index d6cf32c83..0d46627db 100644 --- a/src/ParaMEDMEM/ExplicitTopology.cxx +++ b/src/ParaMEDMEM/ExplicitTopology.cxx @@ -43,10 +43,10 @@ _proc_group(paramesh.getBlockTopology()->getProcGroup()), _nb_components(1) { _nb_elems=paramesh.getCellMesh()->getNumberOfCells(); - const int* global=paramesh.getGlobalNumberingCell(); - _loc2glob=new int[_nb_elems]; + const mcIdType* global=paramesh.getGlobalNumberingCell(); + _loc2glob=new mcIdType[_nb_elems]; - for (int i=0; i<_nb_elems; i++) + for (mcIdType i=0; i<_nb_elems; i++) { _loc2glob[i]=global[i]; _glob2loc[global[i]]=i; @@ -58,8 +58,8 @@ ExplicitTopology::ExplicitTopology(const ExplicitTopology& topo, int nb_componen _proc_group = topo._proc_group; _nb_elems = topo._nb_elems; _nb_components = nb_components; - _loc2glob=new int[_nb_elems]; - for (int i=0; i<_nb_elems; i++) + _loc2glob=new mcIdType[_nb_elems]; + for (mcIdType i=0; i<_nb_elems; i++) { _loc2glob[i]=topo._loc2glob[i]; } @@ -75,18 +75,18 @@ ExplicitTopology::~ExplicitTopology() /*! Serializes the data contained in the Explicit Topology * for communication purposes*/ -void ExplicitTopology::serialize(int* & serializer, int& size) const +void ExplicitTopology::serialize(mcIdType* & serializer, mcIdType& size) const { - vector buffer; + vector buffer; buffer.push_back(_nb_elems); - for (int i=0; i<_nb_elems; i++) + for (mcIdType i=0; i<_nb_elems; i++) { buffer.push_back(_loc2glob[i]); } - serializer=new int[buffer.size()]; - size= buffer.size(); + serializer=new mcIdType[buffer.size()]; + size=ToIdType(buffer.size()); copy(buffer.begin(), buffer.end(), serializer); } @@ -94,14 +94,14 @@ void ExplicitTopology::serialize(int* & serializer, int& size) const * after communication. Uses the same structure as the one used for serialize() * * */ -void ExplicitTopology::unserialize(const int* serializer,const CommInterface& comm_interface) +void ExplicitTopology::unserialize(const mcIdType* serializer,const CommInterface& comm_interface) { - const int* ptr_serializer=serializer; + const mcIdType* ptr_serializer=serializer; cout << "unserialize..."< local) const { return localToGlobal(local.second); } - inline int localToGlobal(int) const; - inline int globalToLocal(int) const; - void serialize(int* & serializer, int& size) const ; - void unserialize(const int* serializer, const CommInterface& comm_interface); + mcIdType localToGlobal (const std::pair local) const { return localToGlobal(local.second); } + inline mcIdType localToGlobal(mcIdType) const; + inline mcIdType globalToLocal(mcIdType) const; + void serialize(mcIdType* & serializer, mcIdType& size) const ; + void unserialize(const mcIdType* serializer, const CommInterface& comm_interface); int getNbComponents() const { return _nb_components; } private: //Processor group const ProcessorGroup* _proc_group; //nb of elements - int _nb_elems; + mcIdType _nb_elems; //nb of components int _nb_components; //mapping local to global - int* _loc2glob; + mcIdType* _loc2glob; //mapping global to local - INTERP_KERNEL::HashMap _glob2loc; + INTERP_KERNEL::HashMap _glob2loc; }; //!converts a pair to a global number - inline int ExplicitTopology::globalToLocal(const int global) const + inline mcIdType ExplicitTopology::globalToLocal(const mcIdType global) const { - return (_glob2loc.find(global))->second;; + return (_glob2loc.find(global))->second; } //!converts local number to a global number - int ExplicitTopology::localToGlobal(int local) const + mcIdType ExplicitTopology::localToGlobal(mcIdType local) const { return _loc2glob[local]; } //!Retrieves the number of elements for a given topology - inline int ExplicitTopology::getNbElements() const + inline mcIdType ExplicitTopology::getNbElements() const { return _nb_elems; } //Retrieves the local number of elements - inline int ExplicitTopology::getNbLocalElements()const + inline mcIdType ExplicitTopology::getNbLocalElements()const { - return _glob2loc.size(); + return ToIdType(_glob2loc.size()); } } diff --git a/src/ParaMEDMEM/InterpKernelDEC.cxx b/src/ParaMEDMEM/InterpKernelDEC.cxx index 5d87ac873..93919747e 100644 --- a/src/ParaMEDMEM/InterpKernelDEC.cxx +++ b/src/ParaMEDMEM/InterpKernelDEC.cxx @@ -204,7 +204,7 @@ namespace MEDCoupling //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); MEDCouplingPointSet* distant_mesh=0; - int* distant_ids=0; + mcIdType* distant_ids=0; std::string distantMeth; for (int i=0; i<_target_group->size(); i++) { @@ -235,7 +235,7 @@ namespace MEDCoupling //transferring option from InterpKernelDEC to ElementLocator locator.copyOptions(*this); MEDCouplingPointSet* distant_mesh=0; - int* distant_ids=0; + mcIdType* distant_ids=0; for (int i=0; i<_source_group->size(); i++) { // int idistant_proc = (i+_target_group->myRank())%_source_group->size(); diff --git a/src/ParaMEDMEM/InterpolationMatrix.cxx b/src/ParaMEDMEM/InterpolationMatrix.cxx index c3d813dd9..021e9ac6e 100644 --- a/src/ParaMEDMEM/InterpolationMatrix.cxx +++ b/src/ParaMEDMEM/InterpolationMatrix.cxx @@ -66,7 +66,7 @@ namespace MEDCoupling _source_group(source_group), _target_group(target_group) { - int nbelems = source_field->getField()->getNumberOfTuples(); + mcIdType nbelems = source_field->getField()->getNumberOfTuples(); _row_offsets.resize(nbelems+1); _coeffs.resize(nbelems); _target_volume.resize(nbelems); @@ -94,14 +94,14 @@ namespace MEDCoupling */ void InterpolationMatrix::addContribution ( MEDCouplingPointSet& distant_support, int iproc_distant, - const int* distant_elems, + const mcIdType* distant_elems, const std::string& srcMeth, const std::string& targetMeth) { std::string interpMethod(targetMeth); interpMethod+=srcMeth; //creating the interpolator structure - vector > surfaces; + vector > surfaces; //computation of the intersection volumes between source and target elements MEDCouplingUMesh *distant_supportC=dynamic_cast(&distant_support); MEDCouplingUMesh *source_supportC=dynamic_cast(_source_support); @@ -258,30 +258,30 @@ namespace MEDCoupling target_triangle_surf->decrRef(); } - void InterpolationMatrix::fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf) + void InterpolationMatrix::fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf) { //loop over the elements to build the interpolation //matrix structures - int source_size=values.size(); - for (int ielem=0; ielem < source_size; ielem++) + std::size_t source_size=values.size(); + for (std::size_t ielem=0; ielem < source_size; ielem++) { - _row_offsets[ielem+1] += values[ielem].size(); - for(map::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++) + _row_offsets[ielem+1] += ToIdType(values[ielem].size()); + for(map::const_iterator iter=values[ielem].begin();iter!=values[ielem].end();iter++) { - int localId; + mcIdType localId; if(distant_elems) localId=distant_elems[iter->first]; else localId=iter->first; //locating the (iproc, itriangle) pair in the list of columns - map,int >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId)); - int col_id; + map,mcIdType >::iterator iter2 = _col_offsets.find(make_pair(iproc_distant,localId)); + mcIdType col_id; if (iter2 == _col_offsets.end()) { //(iproc, itriangle) is not registered in the list //of distant elements - col_id =_col_offsets.size(); + col_id =ToIdType(_col_offsets.size()); _col_offsets.insert(make_pair(make_pair(iproc_distant,localId),col_id)); _mapping.addElementFromSource(iproc_distant,localId); } @@ -303,13 +303,13 @@ namespace MEDCoupling } } - void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const + void InterpolationMatrix::serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const { data1.clear(); data2.clear(); - const std::vector >& sendingIds=_mapping.getSendingIds(); + const std::vector >& sendingIds=_mapping.getSendingIds(); std::set procsS; - for(std::vector >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++) + for(std::vector >::const_iterator iter1=sendingIds.begin();iter1!=sendingIds.end();iter1++) procsS.insert((*iter1).first); data1.resize(procsS.size()); data2.resize(procsS.size()); @@ -318,15 +318,15 @@ namespace MEDCoupling int id=0; for(std::set::const_iterator iter2=procsS.begin();iter2!=procsS.end();iter2++,id++) fastProcAcc[*iter2]=id; - int nbOfSrcElt=_coeffs.size(); - for(std::vector< std::vector< std::map > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++) + mcIdType nbOfSrcElt=ToIdType(_coeffs.size()); + for(std::vector< std::vector< std::map > >::iterator iter3=data1.begin();iter3!=data1.end();iter3++) (*iter3).resize(nbOfSrcElt); id=0; for(std::vector< std::vector< std::pair > >::const_iterator iter4=_coeffs.begin();iter4!=_coeffs.end();iter4++,id++) { for(std::vector< std::pair >::const_iterator iter5=(*iter4).begin();iter5!=(*iter4).end();iter5++) { - const std::pair& elt=sendingIds[(*iter5).first]; + const std::pair& elt=sendingIds[(*iter5).first]; data1[fastProcAcc[elt.first]][id][elt.second]=(*iter5).second; } } @@ -334,7 +334,7 @@ namespace MEDCoupling void InterpolationMatrix::initialize() { - int lgth=_coeffs.size(); + mcIdType lgth=ToIdType(_coeffs.size()); _row_offsets.clear(); _row_offsets.resize(lgth+1); _coeffs.clear(); _coeffs.resize(lgth); _target_volume.clear(); _target_volume.resize(lgth); @@ -495,7 +495,7 @@ namespace MEDCoupling void InterpolationMatrix::computeGlobalRowSum(ElementLocator& elementLocator, std::vector >& denoStrorage, std::vector >& denoStrorageInv) { //stores id in distant procs sorted by lazy procs connected with - vector< vector > rowsPartialSumI; + vector< vector > rowsPartialSumI; //stores for each lazy procs connected with, if global info is available and if it's the case the policy vector policyPartial; //stores the corresponding values. @@ -513,11 +513,11 @@ namespace MEDCoupling //updateWithNewAdditionnalElements(addingElements); //stores for each lazy procs connected with, the ids in global mode if it exists (regarding policyPartial). This array has exactly the size of rowsPartialSumI, //if policyPartial has CUMALATIVE_POLICY in each. - vector< vector > globalIdsPartial; + vector< vector > globalIdsPartial; computeLocalRowSum(elementLocator.getDistantProcIds(),rowsPartialSumI,rowsPartialSumD); elementLocator.sendLocalIdsToLazyProcsW(rowsPartialSumI); elementLocator.recvCandidatesGlobalIdsFromLazyProcsW(globalIdsPartial); - std::vector< std::vector > addingElements; + std::vector< std::vector > addingElements; findAdditionnalElements(elementLocator,addingElements,rowsPartialSumI,globalIdsPartial); addGhostElements(elementLocator.getDistantProcIds(),addingElements); rowsPartialSumI.clear(); @@ -542,7 +542,7 @@ namespace MEDCoupling * It contains the element ids (2nd dimension) of the corresponding lazy proc. * @param resPerProcD out parameter with the same format than 'resPerProcI'. It contains corresponding sum values. */ - void InterpolationMatrix::computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, + void InterpolationMatrix::computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, std::vector >& resPerProcD) const { resPerProcI.resize(distantProcs.size()); @@ -552,9 +552,9 @@ namespace MEDCoupling for(vector >::const_iterator iter3=(*iter).begin();iter3!=(*iter).end();iter3++) res[(*iter3).first]+=(*iter3).second; set procsSet; - int id=-1; - const vector >& mapping=_mapping.getSendingIds(); - for(vector >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++) + std::size_t id=-1; + const vector >& mapping=_mapping.getSendingIds(); + for(vector >::const_iterator iter2=mapping.begin();iter2!=mapping.end();iter2++) { std::pair::iterator,bool> isIns=procsSet.insert((*iter2).first); if(isIns.second) @@ -568,56 +568,56 @@ namespace MEDCoupling * This method is only usable when CUMULATIVE_POLICY detected. This method finds elements ids (typically nodes) lazy side that * are not present in columns of 'this' and that should regarding cumulative merge of elements regarding their global ids. */ - void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, - const std::vector >& resPerProcI, const std::vector >& globalIdsPartial) + void InterpolationMatrix::findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, + const std::vector >& resPerProcI, const std::vector >& globalIdsPartial) { - std::set globalIds; - int nbLazyProcs=globalIdsPartial.size(); - for(int i=0;i globalIds; + std::size_t nbLazyProcs=globalIdsPartial.size(); + for(std::size_t i=0;i tmp(globalIds.size()); + std::vector tmp(globalIds.size()); std::copy(globalIds.begin(),globalIds.end(),tmp.begin()); globalIds.clear(); elementLocator.sendCandidatesForAddElementsW(tmp); elementLocator.recvAddElementsFromLazyProcsW(elementsToAdd); } - void InterpolationMatrix::addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd) + void InterpolationMatrix::addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd) { - std::vector< std::vector< std::map > > data1; + std::vector< std::vector< std::map > > data1; std::vector data2; serializeMe(data1,data2); initialize(); - int nbOfDistProcs=distantProcs.size(); - for(int i=0;i& eltsForThisProc=elementsToAdd[i]; + const std::vector& eltsForThisProc=elementsToAdd[i]; if(!eltsForThisProc.empty()) { std::vector::iterator iter1=std::find(data2.begin(),data2.end(),procId); - std::map *toFeed=0; + std::map *toFeed=0; if(iter1!=data2.end()) {//to test - int rank=iter1-data2.begin(); + std::size_t rank=iter1-data2.begin(); toFeed=&(data1[rank].back()); } else { iter1=std::lower_bound(data2.begin(),data2.end(),procId); - int rank=iter1-data2.begin(); + std::size_t rank=iter1-data2.begin(); data2.insert(iter1,procId); - std::vector< std::map > tmp(data1.front().size()); + std::vector< std::map > tmp(data1.front().size()); data1.insert(data1.begin()+rank,tmp); toFeed=&(data1[rank].back()); } - for(std::vector::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++) + for(std::vector::const_iterator iter2=eltsForThisProc.begin();iter2!=eltsForThisProc.end();iter2++) (*toFeed)[*iter2]=0.; } } // nbOfDistProcs=data2.size(); - for(int j=0;j >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, - std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding) + void InterpolationMatrix::mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, + std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding) { - std::map sumToReturn; - int nbLazyProcs=rowsPartialSumD.size(); - for(int i=0;i sumToReturn; + std::size_t nbLazyProcs=rowsPartialSumD.size(); + for(std::size_t i=0;i& rowSumOfP=rowsPartialSumD[i]; - const std::vector& globalIdsOfP=globalIdsPartial[i]; + const std::vector& globalIdsOfP=globalIdsPartial[i]; std::vector::const_iterator iter1=rowSumOfP.begin(); - std::vector::const_iterator iter2=globalIdsOfP.begin(); + std::vector::const_iterator iter2=globalIdsOfP.begin(); for(;iter1!=rowSumOfP.end();iter1++,iter2++) sumToReturn[*iter2]+=*iter1; } // - int lgth=sumToReturn.size(); + std::size_t lgth=sumToReturn.size(); globalIdsLazySideInteraction.resize(lgth); sumCorresponding.resize(lgth); - std::vector::iterator iter3=globalIdsLazySideInteraction.begin(); + std::vector::iterator iter3=globalIdsLazySideInteraction.begin(); std::vector::iterator iter4=sumCorresponding.begin(); - for(std::map::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++) + for(std::map::const_iterator iter5=sumToReturn.begin();iter5!=sumToReturn.end();iter5++,iter3++,iter4++) { *iter3=(*iter5).first; *iter4=(*iter5).second; @@ -679,35 +679,35 @@ namespace MEDCoupling * @param globalIdsLazySideInteraction : in parameter that represents ALL the global ids of every lazy procs in interaction * @param sumCorresponding : in parameter with same size as 'globalIdsLazySideInteraction' that stores the corresponding sum of 'globalIdsLazySideInteraction' */ - void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, - const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding) + void InterpolationMatrix::mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, + const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding) { - std::map acc; - std::vector::const_iterator iter1=globalIdsLazySideInteraction.begin(); + std::map acc; + std::vector::const_iterator iter1=globalIdsLazySideInteraction.begin(); std::vector::const_iterator iter2=sumCorresponding.begin(); for(;iter1!=globalIdsLazySideInteraction.end();iter1++,iter2++) acc[*iter1]=*iter2; // - int nbLazyProcs=globalIdsPartial.size(); - for(int i=0;i& tmp1=globalIdsPartial[i]; + const std::vector& tmp1=globalIdsPartial[i]; std::vector& tmp2=rowsPartialSumD[i]; - std::vector::const_iterator iter3=tmp1.begin(); + std::vector::const_iterator iter3=tmp1.begin(); std::vector::iterator iter4=tmp2.begin(); for(;iter3!=tmp1.end();iter3++,iter4++) *iter4=acc[*iter3]; } } - void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD) + void InterpolationMatrix::mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD) { - std::map sum; - std::vector< std::vector >::const_iterator iter1=globalIdsPartial.begin(); + std::map sum; + std::vector< std::vector >::const_iterator iter1=globalIdsPartial.begin(); std::vector< std::vector >::iterator iter2=rowsPartialSumD.begin(); for(;iter1!=globalIdsPartial.end();iter1++,iter2++) { - std::vector::const_iterator iter3=(*iter1).begin(); + std::vector::const_iterator iter3=(*iter1).begin(); std::vector::const_iterator iter4=(*iter2).begin(); for(;iter3!=(*iter1).end();iter3++,iter4++) sum[*iter3]+=*iter4; @@ -715,7 +715,7 @@ namespace MEDCoupling iter2=rowsPartialSumD.begin(); for(iter1=globalIdsPartial.begin();iter1!=globalIdsPartial.end();iter1++,iter2++) { - std::vector::const_iterator iter3=(*iter1).begin(); + std::vector::const_iterator iter3=(*iter1).begin(); std::vector::iterator iter4=(*iter2).begin(); for(;iter3!=(*iter1).end();iter3++,iter4++) *iter4=sum[*iter3]; @@ -729,36 +729,36 @@ namespace MEDCoupling * @param rowsPartialSumI input parameter : local ids of distant lazy procs elements in interaction with * @param globalIdsPartial input parameter : global ids of distant lazy procs elements in interaction with */ - void InterpolationMatrix::mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, - const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv) + void InterpolationMatrix::mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, + const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv) { //preparing fast access structures std::map procT; int localProcId=0; for(std::vector::const_iterator iter1=procsInInteraction.begin();iter1!=procsInInteraction.end();iter1++,localProcId++) procT[*iter1]=localProcId; - int size=procsInInteraction.size(); - std::vector > localToGlobal(size); - for(int i=0;i& myLocalToGlobal=localToGlobal[i]; - const std::vector& locals=rowsPartialSumI[i]; - const std::vector& globals=globalIdsPartial[i]; - std::vector::const_iterator iter3=locals.begin(); - std::vector::const_iterator iter4=globals.begin(); + std::size_t size=procsInInteraction.size(); + std::vector > localToGlobal(size); + for(std::size_t i=0;i& myLocalToGlobal=localToGlobal[i]; + const std::vector& locals=rowsPartialSumI[i]; + const std::vector& globals=globalIdsPartial[i]; + std::vector::const_iterator iter3=locals.begin(); + std::vector::const_iterator iter4=globals.begin(); for(;iter3!=locals.end();iter3++,iter4++) myLocalToGlobal[*iter3]=*iter4; } // - const vector >& mapping=_mapping.getSendingIds(); - std::map globalIdVal; + const vector >& mapping=_mapping.getSendingIds(); + std::map globalIdVal; //accumulate for same global id on lazy part. for(vector > >::iterator iter1=_coeffs.begin();iter1!=_coeffs.end();iter1++) for(vector >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++) { - const std::pair& distantLocalLazyId=mapping[(*iter2).first]; + const std::pair& distantLocalLazyId=mapping[(*iter2).first]; int localLazyProcId=procT[distantLocalLazyId.first]; - int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; + mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; globalIdVal[globalDistantLazyId]+=(*iter2).second; } //perform merge @@ -770,9 +770,9 @@ namespace MEDCoupling std::vector::iterator iter4=(*iter3).begin(); for(vector >::iterator iter2=(*iter1).begin();iter2!=(*iter1).end();iter2++,iter4++) { - const std::pair& distantLocalLazyId=mapping[(*iter2).first]; + const std::pair& distantLocalLazyId=mapping[(*iter2).first]; int localLazyProcId=procT[distantLocalLazyId.first]; - int globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; + mcIdType globalDistantLazyId=localToGlobal[localLazyProcId][distantLocalLazyId.second]; double newVal=globalIdVal[globalDistantLazyId]; if((*iter2).second!=0.) (*iter4)=val*newVal/(*iter2).second; @@ -783,17 +783,17 @@ namespace MEDCoupling } } - void InterpolationMatrix::divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, + void InterpolationMatrix::divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, const std::vector >& resPerProcD, std::vector >& deno) { - map fastSums; + map fastSums; int procId=0; for(vector::const_iterator iter1=distantProcs.begin();iter1!=distantProcs.end();iter1++,procId++) { - const std::vector& currentProcI=resPerProcI[procId]; + const std::vector& currentProcI=resPerProcI[procId]; const std::vector& currentProcD=resPerProcD[procId]; vector::const_iterator iter3=currentProcD.begin(); - for(vector::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++) + for(vector::const_iterator iter2=currentProcI.begin();iter2!=currentProcI.end();iter2++,iter3++) fastSums[_col_offsets[std::make_pair(*iter1,*iter2)]]=*iter3; } deno.resize(_coeffs.size()); @@ -841,8 +841,8 @@ namespace MEDCoupling */ void InterpolationMatrix::prepare() { - int nbelems = _source_field->getField()->getNumberOfTuples(); - for (int ielem=0; ielem < nbelems; ielem++) + mcIdType nbelems = _source_field->getField()->getNumberOfTuples(); + for (mcIdType ielem=0; ielem < nbelems; ielem++) { _row_offsets[ielem+1]+=_row_offsets[ielem]; } @@ -864,24 +864,24 @@ namespace MEDCoupling */ void InterpolationMatrix::multiply(MEDCouplingFieldDouble& field) const { - int nbcomp = field.getArray()->getNumberOfComponents(); + mcIdType nbcomp = ToIdType(field.getArray()->getNumberOfComponents()); vector target_value(_col_offsets.size()* nbcomp,0.0); //computing the matrix multiply on source side if (_source_group.containsMyRank()) { - int nbrows = _coeffs.size(); + mcIdType nbrows = ToIdType(_coeffs.size()); // performing W.S // W is the intersection matrix // S is the source vector - for (int irow=0; irowgetNumberOfTuples() ; + mcIdType nbelems = field.getArray()->getNumberOfTuples() ; double* value = const_cast (field.getArray()->getPointer()); - for (int i=0; igetNumberOfComponents(); + std::size_t nbcomp = field.getArray()->getNumberOfComponents(); vector source_value(_col_offsets.size()* nbcomp,0.0); _mapping.reverseSendRecv(&source_value[0],field); //treatment of the transpose matrix multiply on the source side if (_source_group.containsMyRank()) { - int nbrows = _coeffs.size(); - double *array = field.getArray()->getPointer() ; + mcIdType nbrows = ToIdType( _coeffs.size() ); + double *array = field.getArray()->getPointer() ; // Initialization std::fill(array, array+nbrows*nbcomp, 0.0) ; @@ -939,14 +939,14 @@ namespace MEDCoupling //performing WT.T //WT is W transpose //T is the target vector - for (int irow = 0; irow < nbrows; irow++) + for (mcIdType irow = 0; irow < nbrows; irow++) { - for (int icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) + for (mcIdType icol = _row_offsets[irow]; icol < _row_offsets[irow+1]; icol++) { int colid = _coeffs[irow][icol-_row_offsets[irow]].first; double value = _coeffs[irow][icol-_row_offsets[irow]].second; double deno = _deno_reverse_multiply[irow][icol-_row_offsets[irow]]; - for (int icomp=0; icomp& res) const; - void computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, + void computeLocalRowSum(const std::vector& distantProcs, std::vector >& resPerProcI, std::vector >& resPerProcD) const; void computeGlobalRowSum(ElementLocator& elementLocator, std::vector >& denoStrorage, std::vector >& denoStrorageInv); void computeGlobalColSum(std::vector >& denoStrorage); void resizeGlobalColSum(std::vector >& denoStrorage); - void fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf); - void serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const; + void fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map >& values, MEDCouplingFieldDouble *surf); + void serializeMe(std::vector< std::vector< std::map > >& data1, std::vector& data2) const; void initialize(); - void findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, - const std::vector >& resPerProcI, const std::vector >& globalIdsPartial); - void addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd); + void findAdditionnalElements(ElementLocator& elementLocator, std::vector >& elementsToAdd, + const std::vector >& resPerProcI, const std::vector >& globalIdsPartial); + void addGhostElements(const std::vector& distantProcs, const std::vector >& elementsToAdd); int mergePolicies(const std::vector& policyPartial); - void mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, - std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding); - void mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, - const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding); - void mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD); - void mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, - const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv); - void divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, + void mergeRowSum(const std::vector< std::vector >& rowsPartialSumD, const std::vector< std::vector >& globalIdsPartial, + std::vector& globalIdsLazySideInteraction, std::vector& sumCorresponding); + void mergeRowSum2(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD, + const std::vector& globalIdsLazySideInteraction, const std::vector& sumCorresponding); + void mergeRowSum3(const std::vector< std::vector >& globalIdsPartial, std::vector< std::vector >& rowsPartialSumD); + void mergeCoeffs(const std::vector& procsInInteraction, const std::vector< std::vector >& rowsPartialSumI, + const std::vector >& globalIdsPartial, std::vector >& denoStrorageInv); + void divideByGlobalRowSum(const std::vector& distantProcs, const std::vector >& resPerProcI, const std::vector >& resPerProcD, std::vector >& deno); private: bool isSurfaceComputationNeeded(const std::string& method) const; private: const MEDCoupling::ParaFIELD *_source_field; - std::vector _row_offsets; - std::map, int > _col_offsets; + std::vector _row_offsets; + std::map, mcIdType > _col_offsets; MEDCouplingPointSet *_source_support; MxN_Mapping _mapping; diff --git a/src/ParaMEDMEM/MPIAccess.cxx b/src/ParaMEDMEM/MPIAccess.cxx index 8b5878dc9..27d19d91e 100644 --- a/src/ParaMEDMEM/MPIAccess.cxx +++ b/src/ParaMEDMEM/MPIAccess.cxx @@ -290,7 +290,7 @@ namespace MEDCoupling { int size = 0; for (int i = 0 ; i < _processor_group_size ; i++ ) - size += _send_requests[ i ].size() ; + size += (int)_send_requests[ i ].size() ; return size ; } @@ -315,7 +315,7 @@ namespace MEDCoupling { int size = 0 ; for (int i = 0 ; i < _processor_group_size ; i++ ) - size += _recv_requests[ i ].size() ; + size += (int)_recv_requests[ i ].size() ; return size ; } @@ -344,7 +344,7 @@ namespace MEDCoupling list< int >::const_iterator iter ; for (iter = _send_requests[ destrank ].begin() ; iter != _send_requests[destrank].end() ; iter++ ) ArrayOfSendRequests[i++] = *iter ; - return _send_requests[destrank].size() ; + return (int)_send_requests[destrank].size() ; } // Returns in ArrayOfRecvRequests with the dimension "size" all the @@ -358,7 +358,7 @@ namespace MEDCoupling _recv_requests[ sourcerank ] ; for (iter = _recv_requests[ sourcerank ].begin() ; iter != _recv_requests[sourcerank].end() ; iter++ ) ArrayOfRecvRequests[i++] = *iter ; - return _recv_requests[sourcerank].size() ; + return (int)_recv_requests[sourcerank].size() ; } // Send in synchronous mode count values of type datatype from buffer to target @@ -1052,6 +1052,14 @@ namespace MEDCoupling return aextent ; } + // Returns the MPI size of a MPI_LONG + MPI_Aint MPIAccess::longExtent() const + { + MPI_Aint aextent, lbound ; + MPI_Type_get_extent( MPI_LONG , &lbound, &aextent ) ; + return aextent ; + } + // Returns the MPI size of a MPI_DOUBLE MPI_Aint MPIAccess::doubleExtent() const { diff --git a/src/ParaMEDMEM/MPIAccess.hxx b/src/ParaMEDMEM/MPIAccess.hxx index 782c68a25..196fd41b6 100644 --- a/src/ParaMEDMEM/MPIAccess.hxx +++ b/src/ParaMEDMEM/MPIAccess.hxx @@ -124,6 +124,7 @@ namespace MEDCoupling bool isTimeMessage( int MPITag ) const ; MPI_Aint timeExtent() const ; MPI_Aint intExtent() const ; + MPI_Aint longExtent() const ; MPI_Aint doubleExtent() const ; MPI_Aint extent( MPI_Datatype datatype ) const ; @@ -236,14 +237,14 @@ namespace MEDCoupling // used to allocate ArrayOfSendRequests for the call to SendRequestIds inline int MPIAccess::sendRequestIdsSize(int destrank) { - return _send_requests[destrank].size() ; + return (int)_send_requests[destrank].size() ; } // Returns the number of all RecvRequestIds matching a source rank. It may be // used to allocate ArrayOfRecvRequests for the call to RecvRequestIds inline int MPIAccess::recvRequestIdsSize(int sourcerank) { - return _recv_requests[sourcerank].size() ; + return (int)_recv_requests[sourcerank].size() ; } // Returns the MPI_Datatype (registered in MPI in the constructor with @@ -266,6 +267,8 @@ namespace MEDCoupling return timeExtent() ; if ( adatatype == MPI_INT ) return intExtent() ; + if ( adatatype == MPI_LONG ) + return longExtent() ; if ( adatatype == MPI_DOUBLE ) return doubleExtent() ; return 0 ; diff --git a/src/ParaMEDMEM/MPIAccessDEC.cxx b/src/ParaMEDMEM/MPIAccessDEC.cxx index 5c74dbec7..f6bd17325 100644 --- a/src/ParaMEDMEM/MPIAccessDEC.cxx +++ b/src/ParaMEDMEM/MPIAccessDEC.cxx @@ -152,6 +152,11 @@ namespace MEDCoupling sts = _MPI_access->ISend( &((int *) sendbuf)[offset] , sendcount , sendtype , target , SendRequestId ) ; } + else if ( sendtype == MPI_LONG ) + { + sts = _MPI_access->ISend( &((long *) sendbuf)[offset] , sendcount , sendtype , + target , SendRequestId ) ; + } else { sts = _MPI_access->ISend( &((double *) sendbuf)[offset] , sendcount , sendtype , @@ -165,6 +170,11 @@ namespace MEDCoupling sts = _MPI_access->send( &((int *) sendbuf)[offset] , sendcount , sendtype , target , SendRequestId ) ; } + else if ( sendtype == MPI_LONG ) + { + sts = _MPI_access->send( &((long *) sendbuf)[offset] , sendcount , sendtype , + target , SendRequestId ) ; + } else { sts = _MPI_access->send( &((double *) sendbuf)[offset] , sendcount , sendtype , @@ -192,6 +202,11 @@ namespace MEDCoupling sts = _MPI_access->IRecv( &((int *) recvbuf)[offset] , recvcount , recvtype , target , RecvRequestId ) ; } + else if ( recvtype == MPI_LONG ) + { + sts = _MPI_access->IRecv( &((long *) recvbuf)[offset] , recvcount , recvtype , + target , RecvRequestId ) ; + } else { sts = _MPI_access->IRecv( &((double *) recvbuf)[offset] , recvcount , recvtype , @@ -205,6 +220,11 @@ namespace MEDCoupling sts = _MPI_access->recv( &((int *) recvbuf)[offset] , recvcount , recvtype , target , RecvRequestId ) ; } + else if ( recvtype == MPI_LONG ) + { + sts = _MPI_access->recv( &((long *) recvbuf)[offset] , recvcount , recvtype , + target , RecvRequestId ) ; + } else { sts = _MPI_access->recv( &((double *) recvbuf)[offset] , recvcount , recvtype , @@ -565,7 +585,7 @@ namespace MEDCoupling { for ( target = 0 ; target < _group_size ; target++ ) { - int recvsize = recvcount*_MPI_access->extent( recvtype ) ; + int recvsize = (int)(recvcount*_MPI_access->extent( recvtype )); checkTime( recvcount , recvtype , target , false ) ; //=========================================================================== //TODO : it is assumed actually that we have only 1 timestep before and after @@ -714,7 +734,7 @@ namespace MEDCoupling { if ( recvcounts[target] ) { - int recvsize = recvcounts[target]*_MPI_access->extent( recvtype ) ; + int recvsize = (int)(recvcounts[target]*_MPI_access->extent( recvtype )); checkTime( recvcounts[target] , recvtype , target , false ) ; //=========================================================================== //TODO : it is assumed actually that we have only 1 timestep before nad after diff --git a/src/ParaMEDMEM/MPIProcessorGroup.cxx b/src/ParaMEDMEM/MPIProcessorGroup.cxx index 7cbdb7692..91ec6faf7 100644 --- a/src/ParaMEDMEM/MPIProcessorGroup.cxx +++ b/src/ParaMEDMEM/MPIProcessorGroup.cxx @@ -115,7 +115,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("invalid rank in set argument of MPIProcessorGroup constructor"); } - _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group); + _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group); _comm_interface.commCreate(_world_comm, _group, &_comm); diff --git a/src/ParaMEDMEM/MxN_Mapping.cxx b/src/ParaMEDMEM/MxN_Mapping.cxx index b7d561304..d3a930b0c 100644 --- a/src/ParaMEDMEM/MxN_Mapping.cxx +++ b/src/ParaMEDMEM/MxN_Mapping.cxx @@ -52,7 +52,7 @@ namespace MEDCoupling \param distant_proc proc rank of the distant processor (in terms of the union group) \param distant_element id of the element on the distant processor */ - void MxN_Mapping::addElementFromSource(int distant_proc, int distant_element) + void MxN_Mapping::addElementFromSource(int distant_proc, mcIdType distant_element) { _sending_ids.push_back(make_pair(distant_proc,distant_element)); for (int i=distant_proc; i<_union_group->size(); i++) @@ -93,12 +93,12 @@ namespace MEDCoupling delete[] nbrecv; _recv_ids.resize(_recv_proc_offsets[_union_group->size()]); - int* isendbuf=0; - int* irecvbuf=0; + mcIdType* isendbuf=0; + mcIdType* irecvbuf=0; if (_sending_ids.size()>0) - isendbuf = new int[_sending_ids.size()]; + isendbuf = new mcIdType[_sending_ids.size()]; if (_recv_ids.size()>0) - irecvbuf = new int[_recv_ids.size()]; + irecvbuf = new mcIdType[_recv_ids.size()]; int* sendcounts = new int[_union_group->size()]; int* senddispls=new int[_union_group->size()]; int* recvcounts=new int[_union_group->size()]; @@ -111,14 +111,14 @@ namespace MEDCoupling recvdispls[i]=_recv_proc_offsets[i]; } vector offsets = _send_proc_offsets; - for (int i=0; i<(int)_sending_ids.size();i++) + for (std::size_t i=0; i<_sending_ids.size();i++) { int iproc = _sending_ids[i].first; isendbuf[offsets[iproc]]=_sending_ids[i].second; offsets[iproc]++; } - comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_INT, - irecvbuf, recvcounts, recvdispls, MPI_INT, + comm_interface.allToAllV(isendbuf, sendcounts, senddispls, MPI_ID_TYPE, + irecvbuf, recvcounts, recvdispls, MPI_ID_TYPE, *comm); for (int i=0; i< _recv_proc_offsets[_union_group->size()]; i++) @@ -146,7 +146,7 @@ namespace MEDCoupling CommInterface comm_interface=_union_group->getCommInterface(); const MPIProcessorGroup* group = static_cast(_union_group); - int nbcomp=field.getArray()->getNumberOfComponents(); + int nbcomp=(int)field.getArray()->getNumberOfComponents(); double* sendbuf=0; double* recvbuf=0; if (_sending_ids.size() >0) @@ -190,7 +190,7 @@ namespace MEDCoupling break; case PointToPoint: _access_DEC->allToAllv(sendbuf, sendcounts, senddispls, MPI_DOUBLE, - recvbuf, recvcounts, recvdispls, MPI_DOUBLE); + recvbuf, recvcounts, recvdispls, MPI_DOUBLE); break; } @@ -229,7 +229,7 @@ namespace MEDCoupling CommInterface comm_interface=_union_group->getCommInterface(); const MPIProcessorGroup* group = static_cast(_union_group); - int nbcomp=field.getArray()->getNumberOfComponents(); + int nbcomp=(int)field.getArray()->getNumberOfComponents(); double* sendbuf=0; double* recvbuf=0; if (_recv_ids.size() >0) diff --git a/src/ParaMEDMEM/MxN_Mapping.hxx b/src/ParaMEDMEM/MxN_Mapping.hxx index c19493db2..792a29485 100644 --- a/src/ParaMEDMEM/MxN_Mapping.hxx +++ b/src/ParaMEDMEM/MxN_Mapping.hxx @@ -42,14 +42,14 @@ namespace MEDCoupling public: MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options); virtual ~MxN_Mapping(); - void addElementFromSource(int distant_proc, int distant_elem); + void addElementFromSource(int distant_proc, mcIdType distant_elem); void prepareSendRecv(); void sendRecv(MEDCouplingFieldDouble& field); void sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const ; void reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const ; // - const std::vector >& getSendingIds() const { return _sending_ids; } + const std::vector >& getSendingIds() const { return _sending_ids; } const std::vector& getSendProcsOffsets() const { return _send_proc_offsets; } void initialize(); @@ -58,8 +58,8 @@ namespace MEDCoupling ProcessorGroup* _union_group; MPIAccessDEC * _access_DEC; int _nb_comps; - std::vector > _sending_ids; - std::vector _recv_ids; + std::vector > _sending_ids; + std::vector _recv_ids; std::vector _send_proc_offsets; std::vector _recv_proc_offsets; }; diff --git a/src/ParaMEDMEM/OverlapDEC.cxx b/src/ParaMEDMEM/OverlapDEC.cxx index fe06c5290..8cf451025 100644 --- a/src/ParaMEDMEM/OverlapDEC.cxx +++ b/src/ParaMEDMEM/OverlapDEC.cxx @@ -212,9 +212,9 @@ namespace MEDCoupling OverlapDEC::OverlapDEC(const std::set& procIds, const MPI_Comm& world_comm): _load_balancing_algo(1), _own_group(true),_interpolation_matrix(0), _locator(0), + _default_field_value(0.0), _source_field(0),_own_source_field(false), _target_field(0),_own_target_field(false), - _default_field_value(0.0), _comm(MPI_COMM_NULL) { MEDCoupling::CommInterface comm; @@ -222,7 +222,7 @@ namespace MEDCoupling std::copy(procIds.begin(),procIds.end(),ranks_world); MPI_Group group,world_group; comm.commGroup(world_comm,&world_group); - comm.groupIncl(world_group,procIds.size(),ranks_world,&group); + comm.groupIncl(world_group,(int)procIds.size(),ranks_world,&group); delete [] ranks_world; comm.commCreate(world_comm,group,&_comm); comm.groupFree(&group); @@ -233,7 +233,7 @@ namespace MEDCoupling return ; } std::set idsUnion; - for(std::size_t i=0;i >::const_iterator it=jobs.begin();it!=jobs.end();it++) { const MEDCouplingPointSet *src=_locator->getSourceMesh((*it).first); - const DataArrayInt *srcIds=_locator->getSourceIds((*it).first); + const DataArrayIdType *srcIds=_locator->getSourceIds((*it).first); const MEDCouplingPointSet *trg=_locator->getTargetMesh((*it).second); - const DataArrayInt *trgIds=_locator->getTargetIds((*it).second); + const DataArrayIdType *trgIds=_locator->getTargetIds((*it).second); _interpolation_matrix->computeLocalIntersection(src,srcIds,srcMeth,(*it).first,trg,trgIds,trgMeth,(*it).second); } _interpolation_matrix->prepare(_locator->getProcsToSendFieldData()); diff --git a/src/ParaMEDMEM/OverlapElementLocator.cxx b/src/ParaMEDMEM/OverlapElementLocator.cxx index 0138eec6e..db769075c 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.cxx +++ b/src/ParaMEDMEM/OverlapElementLocator.cxx @@ -48,8 +48,8 @@ namespace MEDCoupling _local_source_mesh(0), _local_target_mesh(0), _domain_bounding_boxes(0), - _group(group), - _epsAbs(epsAbs) + _epsAbs(epsAbs), + _group(group) { if(_local_source_field) _local_source_mesh=_local_source_field->getSupport()->getCellMesh(); @@ -201,9 +201,9 @@ namespace MEDCoupling else { if(cpl.first == procID) - (*itMap).second = full_set[cpl.second].size(); + (*itMap).second = (int)full_set[cpl.second].size(); else // cpl.second == srcProcID - (*itMap).second = full_set[cpl.first].size(); + (*itMap).second = (int)full_set[cpl.first].size(); } } INTERP_KERNEL::AutoPtr proc_valid = new bool[grp_size]; @@ -216,7 +216,7 @@ namespace MEDCoupling int max_sz = -1, max_id = -1; for(itVector = full_set.begin(), procID=0; itVector != full_set.end(); itVector++, procID++) { - int sz = (*itVector).size(); + int sz = (int)(*itVector).size(); if (proc_valid[procID] && sz > max_sz) { max_sz = sz; @@ -393,7 +393,7 @@ namespace MEDCoupling return (*it).second; } - const DataArrayInt *OverlapElementLocator::getSourceIds(int procId) const + const DataArrayIdType *OverlapElementLocator::getSourceIds(int procId) const { int myProcId=_group.myRank(); if(myProcId==procId) @@ -413,7 +413,7 @@ namespace MEDCoupling return (*it).second; } - const DataArrayInt *OverlapElementLocator::getTargetIds(int procId) const + const DataArrayIdType *OverlapElementLocator::getTargetIds(int procId) const { int myProcId=_group.myRank(); if(myProcId==procId) @@ -469,7 +469,7 @@ namespace MEDCoupling field=_local_target_field; } AutoDAInt elems=local_mesh->getCellsInBoundingBox(distant_bb,getBoundingBoxAdjustment()); - DataArrayInt *old2new_map; + DataArrayIdType *old2new_map; MEDCouplingPointSet *send_mesh=static_cast(field->getField()->buildSubMeshData(elems->begin(),elems->end(),old2new_map)); if(sourceOrTarget) matrix.keepTracksOfSourceIds(procId,old2new_map); @@ -486,7 +486,7 @@ namespace MEDCoupling */ void OverlapElementLocator::receiveRemoteMeshFrom(int procId, bool sourceOrTarget) { - DataArrayInt *old2new_map=0; + DataArrayIdType *old2new_map=0; MEDCouplingPointSet *m=0; receiveMesh(procId,m,old2new_map); Proc_SrcOrTgt p(procId,sourceOrTarget); @@ -494,57 +494,57 @@ namespace MEDCoupling _remote_elems[p]=old2new_map; } - void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const + void OverlapElementLocator::sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const { CommInterface comInterface=_group.getCommInterface(); // First stage : exchanging sizes vector tinyInfoLocalD;//tinyInfoLocalD not used for the moment - vector tinyInfoLocal; + vector tinyInfoLocal; vector tinyInfoLocalS; mesh->getTinySerializationInformation(tinyInfoLocalD,tinyInfoLocal,tinyInfoLocalS); const MPI_Comm *comm=getCommunicator(); // - int lgth[2]; - lgth[0]=tinyInfoLocal.size(); + mcIdType lgth[2]; + lgth[0]=ToIdType(tinyInfoLocal.size()); lgth[1]=idsToSend->getNbOfElems(); - comInterface.send(&lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm); - comInterface.send(&tinyInfoLocal[0],tinyInfoLocal.size(),MPI_INT,procId,START_TAG_MESH_XCH+1,*comm); + 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); // - DataArrayInt *v1Local=0; + DataArrayIdType *v1Local=0; DataArrayDouble *v2Local=0; mesh->serialize(v1Local,v2Local); - comInterface.send(v1Local->getPointer(),v1Local->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm); - comInterface.send(v2Local->getPointer(),v2Local->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm); + 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); //finished for mesh, ids now - comInterface.send(const_cast(idsToSend->getConstPointer()),lgth[1],MPI_INT,procId,START_TAG_MESH_XCH+4,*comm); + comInterface.send(const_cast(idsToSend->getConstPointer()),(int)lgth[1],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+4,*comm); // v1Local->decrRef(); v2Local->decrRef(); } - void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const + void OverlapElementLocator::receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const { - int lgth[2]; + mcIdType lgth[2]; MPI_Status status; const MPI_Comm *comm=getCommunicator(); CommInterface comInterface=_group.getCommInterface(); - comInterface.recv(lgth,2,MPI_INT,procId,START_TAG_MESH_XCH,*_comm,&status); - std::vector tinyInfoDistant(lgth[0]); - ids=DataArrayInt::New(); + comInterface.recv(lgth,2,MPI_ID_TYPE,procId,START_TAG_MESH_XCH,*_comm,&status); + std::vector tinyInfoDistant(lgth[0]); + ids=DataArrayIdType::New(); ids->alloc(lgth[1],1); - comInterface.recv(&tinyInfoDistant[0],lgth[0],MPI_INT,procId,START_TAG_MESH_XCH+1,*comm,&status); + comInterface.recv(&tinyInfoDistant[0],(int)lgth[0],MPI_ID_TYPE,procId,START_TAG_MESH_XCH+1,*comm,&status); mesh=MEDCouplingPointSet::BuildInstanceFromMeshType((MEDCouplingMeshType)tinyInfoDistant[0]); std::vector unusedTinyDistantSts; vector tinyInfoDistantD(1);//tinyInfoDistantD not used for the moment - DataArrayInt *v1Distant=DataArrayInt::New(); + DataArrayIdType *v1Distant=DataArrayIdType::New(); DataArrayDouble *v2Distant=DataArrayDouble::New(); mesh->resizeForUnserialization(tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); - comInterface.recv(v1Distant->getPointer(),v1Distant->getNbOfElems(),MPI_INT,procId,START_TAG_MESH_XCH+2,*comm,&status); - comInterface.recv(v2Distant->getPointer(),v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status); + comInterface.recv(v1Distant->getPointer(),(int)v1Distant->getNbOfElems(),MPI_ID_TYPE,procId,START_TAG_MESH_XCH+2,*comm,&status); + comInterface.recv(v2Distant->getPointer(),(int)v2Distant->getNbOfElems(),MPI_DOUBLE,procId,START_TAG_MESH_XCH+3,*comm,&status); mesh->unserialization(tinyInfoDistantD,tinyInfoDistant,v1Distant,v2Distant,unusedTinyDistantSts); //finished for mesh, ids now - comInterface.recv(ids->getPointer(),lgth[1],MPI_INT,procId,1144,*comm,&status); + comInterface.recv(ids->getPointer(),(int)lgth[1],MPI_ID_TYPE,procId,1144,*comm,&status); // v1Distant->decrRef(); v2Distant->decrRef(); diff --git a/src/ParaMEDMEM/OverlapElementLocator.hxx b/src/ParaMEDMEM/OverlapElementLocator.hxx index fff82010f..59232d3ad 100644 --- a/src/ParaMEDMEM/OverlapElementLocator.hxx +++ b/src/ParaMEDMEM/OverlapElementLocator.hxx @@ -55,9 +55,9 @@ namespace MEDCoupling std::string getSourceMethod() const; std::string getTargetMethod() const; const MEDCouplingPointSet *getSourceMesh(int procId) const; - const DataArrayInt *getSourceIds(int procId) const; + const DataArrayIdType *getSourceIds(int procId) const; const MEDCouplingPointSet *getTargetMesh(int procId) const; - const DataArrayInt *getTargetIds(int procId) const; + const DataArrayIdType *getTargetIds(int procId) const; bool isInMyTodoList(int i, int j) const; void debugPrintWorkSharing(std::ostream & ostr) const; private: @@ -68,11 +68,11 @@ namespace MEDCoupling bool intersectsBoundingBox(int i, int j) const; void sendLocalMeshTo(int procId, bool sourceOrTarget, OverlapInterpolationMatrix& matrix) const; void receiveRemoteMeshFrom(int procId, bool sourceOrTarget); - void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayInt *idsToSend) const; - void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayInt *&ids) const; + void sendMesh(int procId, const MEDCouplingPointSet *mesh, const DataArrayIdType *idsToSend) const; + void receiveMesh(int procId, MEDCouplingPointSet* &mesh, DataArrayIdType *&ids) const; private: typedef MCAuto< MEDCouplingPointSet > AutoMCPointSet; - typedef MCAuto< DataArrayInt > AutoDAInt; + typedef MCAuto< DataArrayIdType > AutoDAInt; typedef std::pair 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 5e03f9d6a..3f5479f3a 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.cxx @@ -61,12 +61,12 @@ namespace MEDCoupling { } - void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayInt *ids) + void OverlapInterpolationMatrix::keepTracksOfSourceIds(int procId, DataArrayIdType *ids) { _mapping.keepTracksOfSourceIds(procId,ids); } - void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayInt *ids) + void OverlapInterpolationMatrix::keepTracksOfTargetIds(int procId, DataArrayIdType *ids) { _mapping.keepTracksOfTargetIds(procId,ids); } @@ -84,14 +84,14 @@ namespace MEDCoupling * * One of the 2 is necessarily null (the two can be null together) */ - void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, - const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId) + void OverlapInterpolationMatrix::computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId, + const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId) { std::string interpMethod(srcMeth); interpMethod+=trgMeth; //creating the interpolator structure vector sparse_matrix_part; - int colSize=0; + mcIdType colSize=0; //computation of the intersection volumes between source and target elements const MEDCouplingUMesh *trgC=dynamic_cast(trg); const MEDCouplingUMesh *srcC=dynamic_cast(src); @@ -160,7 +160,7 @@ namespace MEDCoupling vector matrixTranspose; colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source. TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part); - colSize=matrixTranspose.size(); + colSize=ToIdType(matrixTranspose.size()); } else if ( src->getMeshDimension() == 1 && trg->getMeshDimension() == 2 && trg->getSpaceDimension() == 2 && src->getSpaceDimension() == 2 ) @@ -181,7 +181,7 @@ namespace MEDCoupling vector matrixTranspose; colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,matrixTranspose,interpMethod);//not a bug target in source. TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part); - colSize=matrixTranspose.size(); + colSize=ToIdType(matrixTranspose.size()); } else if (trg->getMeshDimension() != _source_support->getMeshDimension()) { @@ -291,7 +291,7 @@ namespace MEDCoupling } void OverlapInterpolationMatrix::TransposeMatrix(const std::vector& matIn, - int nbColsMatIn, std::vector& matOut) + mcIdType nbColsMatIn, std::vector& matOut) { matOut.resize(nbColsMatIn); int id=0; diff --git a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx index 89715ec74..44945a79d 100644 --- a/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx +++ b/src/ParaMEDMEM/OverlapInterpolationMatrix.hxx @@ -48,12 +48,12 @@ namespace MEDCoupling const InterpolationOptions& i_opt, const OverlapElementLocator & loc); - void keepTracksOfSourceIds(int procId, DataArrayInt *ids); + void keepTracksOfSourceIds(int procId, DataArrayIdType *ids); - void keepTracksOfTargetIds(int procId, DataArrayInt *ids); + void keepTracksOfTargetIds(int procId, DataArrayIdType *ids); - void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId, - const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId); + void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayIdType *srcIds, const std::string& srcMeth, int srcProcId, + const MEDCouplingPointSet *trg, const DataArrayIdType *trgIds, const std::string& trgMeth, int trgProcId); void prepare(const std::vector< int > & procsToSendField); @@ -66,7 +66,7 @@ namespace MEDCoupling virtual ~OverlapInterpolationMatrix(); private: - static void TransposeMatrix(const std::vector& matIn, int nbColsMatIn, + static void TransposeMatrix(const std::vector& matIn, mcIdType nbColsMatIn, std::vector& matOut); private: ParaFIELD *_source_field; diff --git a/src/ParaMEDMEM/OverlapMapping.cxx b/src/ParaMEDMEM/OverlapMapping.cxx index 3a68b78e6..b9aa4be12 100644 --- a/src/ParaMEDMEM/OverlapMapping.cxx +++ b/src/ParaMEDMEM/OverlapMapping.cxx @@ -39,7 +39,7 @@ OverlapMapping::OverlapMapping(const ProcessorGroup& group, const OverlapElement /*! * Keeps the link between a given a proc holding source mesh data, and the corresponding cell IDs. */ -void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids) +void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayIdType *ids) { ids->incrRef(); _sent_src_ids[procId] = ids; @@ -48,7 +48,7 @@ void OverlapMapping::keepTracksOfSourceIds(int procId, DataArrayInt *ids) /*! * Same as keepTracksOfSourceIds() but for target mesh data. */ -void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids) +void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayIdType *ids) { ids->incrRef(); _sent_trg_ids[procId] = ids; @@ -64,7 +64,7 @@ void OverlapMapping::keepTracksOfTargetIds(int procId, DataArrayInt *ids) * * One of the 2 is necessarily null (the two can be null together) */ -void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *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); @@ -73,12 +73,12 @@ void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& mat _nb_of_rcv_src_ids[srcProcId] = srcIds->getNumberOfTuples(); else // source mesh part is local { - std::set s; + std::set s; // For all source IDs (=col indices) in the sparse matrix: for(std::vector< SparseDoubleVec >::const_iterator it1=matrixST.begin();it1!=matrixST.end();it1++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) s.insert((*it2).first); - vector v(s.begin(), s.end()); // turn set into vector + vector v(s.begin(), s.end()); // turn set into vector _src_ids_zip_comp[trgProcId] = v; } } @@ -91,7 +91,7 @@ void OverlapMapping::addContributionST(const std::vector< SparseDoubleVec >& mat * * After the call of this method, 'this' contains the matrixST for all source cells of the current proc */ -void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbOfTrgElems) +void OverlapMapping::prepare(const std::vector< int >& procsToSendField, mcIdType nbOfTrgElems) { #ifdef DEC_DEBUG printMatrixesST(); @@ -100,45 +100,45 @@ void OverlapMapping::prepare(const std::vector< int >& procsToSendField, int nbO CommInterface commInterface=_group.getCommInterface(); const MPIProcessorGroup *group=static_cast(&_group); const MPI_Comm *comm=group->getComm(); - int grpSize=_group.size(); - INTERP_KERNEL::AutoPtr nbsend=new int[grpSize]; + std::size_t grpSize=_group.size(); + INTERP_KERNEL::AutoPtr nbsend=new mcIdType[grpSize]; INTERP_KERNEL::AutoPtr nbsend2=new int[grpSize]; INTERP_KERNEL::AutoPtr nbsend3=new int[grpSize]; - std::fill(nbsend,nbsend+grpSize,0); + std::fill(nbsend,nbsend+grpSize,0); 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]]=_matrixes_st[i].size(); - INTERP_KERNEL::AutoPtr nbrecv=new int[grpSize]; - commInterface.allToAll(nbsend,1,MPI_INT,nbrecv,1,MPI_INT,*comm); + nbsend[_target_proc_id_st[i]]=(int)_matrixes_st[i].size(); + INTERP_KERNEL::AutoPtr nbrecv=new mcIdType[grpSize]; + commInterface.allToAll(nbsend,1,MPI_ID_TYPE,nbrecv,1,MPI_ID_TYPE,*comm); //exchanging matrix //first exchanging offsets+ids_source INTERP_KERNEL::AutoPtr nbrecv1=new int[grpSize]; INTERP_KERNEL::AutoPtr nbrecv2=new int[grpSize]; // - int *tmp=0; + mcIdType *tmp=0; serializeMatrixStep0ST(nbrecv, tmp,nbsend2,nbsend3, nbrecv1,nbrecv2); - INTERP_KERNEL::AutoPtr bigArr=tmp; - INTERP_KERNEL::AutoPtr bigArrRecv=new int[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]]; - commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_INT, - bigArrRecv,nbrecv1,nbrecv2,MPI_INT, + INTERP_KERNEL::AutoPtr bigArr=tmp; + INTERP_KERNEL::AutoPtr bigArrRecv=new mcIdType[nbrecv2[grpSize-1]+nbrecv1[grpSize-1]]; + commInterface.allToAllV(bigArr,nbsend2,nbsend3,MPI_ID_TYPE, + bigArrRecv,nbrecv1,nbrecv2,MPI_ID_TYPE, *comm);// sending ids of sparse matrix (n+1 elems) //second phase echange target ids std::fill(nbsend2,nbsend2+grpSize,0); INTERP_KERNEL::AutoPtr nbrecv3=new int[grpSize]; INTERP_KERNEL::AutoPtr nbrecv4=new int[grpSize]; double *tmp2=0; - int lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2, + mcIdType lgthOfArr=serializeMatrixStep1ST(nbrecv,bigArrRecv,nbrecv1,nbrecv2, tmp,tmp2, nbsend2,nbsend3,nbrecv3,nbrecv4); - INTERP_KERNEL::AutoPtr bigArr2=tmp; + INTERP_KERNEL::AutoPtr bigArr2=tmp; INTERP_KERNEL::AutoPtr bigArrD2=tmp2; - INTERP_KERNEL::AutoPtr bigArrRecv2=new int[lgthOfArr]; + INTERP_KERNEL::AutoPtr bigArrRecv2=new mcIdType[lgthOfArr]; INTERP_KERNEL::AutoPtr bigArrDRecv2=new double[lgthOfArr]; - commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_INT, - bigArrRecv2,nbrecv3,nbrecv4,MPI_INT, + commInterface.allToAllV(bigArr2,nbsend2,nbsend3,MPI_ID_TYPE, + bigArrRecv2,nbrecv3,nbrecv4,MPI_ID_TYPE, *comm); commInterface.allToAllV(bigArrD2,nbsend2,nbsend3,MPI_DOUBLE, bigArrDRecv2,nbrecv3,nbrecv4,MPI_DOUBLE, @@ -238,7 +238,7 @@ void OverlapMapping::computeDenoRevIntegral(const DataArrayDouble & targetAreas) /*! * Compute denominators for ConvervativeVolumic interp. */ -void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) +void OverlapMapping::computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg) { int myProcId=_group.myRank(); // @@ -251,8 +251,8 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) { const std::vector< SparseDoubleVec >& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); - int rowId=0; + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + mcIdType rowId=0; if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId) // Local computation: simple, because rowId of mat are directly target cell ids. { for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) @@ -261,8 +261,8 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) } else // matrix was received, remote computation { - const DataArrayInt *trgIds = (*isItem1).second; - const int *trgIds2=trgIds->getConstPointer(); + const DataArrayIdType *trgIds = (*isItem1).second; + const mcIdType *trgIds2=trgIds->getConstPointer(); for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) deno[trgIds2[rowId]]+=(*it2).second; @@ -271,23 +271,23 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) // Broadcast the vector into a structure similar to the initial sparse matrix of numerators: for(std::size_t i=0;i& mat=_the_matrix_st[i]; int curSrcId=_the_matrix_st_source_proc_id[i]; - map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); + map < int, MCAuto >::const_iterator isItem1 = _sent_trg_ids.find(curSrcId); std::vector< SparseDoubleVec >& denoM=_the_deno_st[i]; denoM.resize(mat.size()); if(isItem1==_sent_trg_ids.end() || curSrcId==myProcId)//item1 of step2 main algo. Simple, because rowId of mat are directly target ids. { - int rowId=0; + mcIdType rowId=0; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) denoM[rowId][(*it2).first]=deno[rowId]; } else { - const DataArrayInt *trgIds = (*isItem1).second; - const int *trgIds2=trgIds->getConstPointer(); + const DataArrayIdType *trgIds = (*isItem1).second; + const mcIdType *trgIds2=trgIds->getConstPointer(); for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++,rowId++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) denoM[rowId][(*it2).first]=deno[trgIds2[rowId]]; @@ -302,43 +302,43 @@ void OverlapMapping::computeDenoConservativeVolumic(int nbOfTuplesTrg) * \param offsets tells for a proc i where to start serialize#0 matrix. size equal to _group.size(). * \param nbOfElemsSrc of size _group.size(). Comes from previous all2all call. tells how many srcIds per proc contains matrix for current proc. */ -void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets, +void OverlapMapping::serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets, int *countForRecv, int *offsetsForRecv) const { - int grpSize=_group.size(); + std::size_t grpSize=_group.size(); std::fill(count,count+grpSize,0); - int szz=0; + std::size_t szz=0; int myProcId=_group.myRank(); for(std::size_t i=0;i<_matrixes_st.size();i++) { if(_source_proc_id_st[i]==myProcId)// && _target_proc_id_st[i]!=myProcId { - count[_target_proc_id_st[i]]=_matrixes_st[i].size()+1; + count[_target_proc_id_st[i]]=(int)_matrixes_st[i].size()+1; szz+=_matrixes_st[i].size()+1; } } - bigArr=new int[szz]; + bigArr=new mcIdType[szz]; offsets[0]=0; - for(int i=1;i& mat=_matrixes_st[i]; for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++,work++) - work[1]=work[0]+(*it).size(); + work[1]=work[0]+ToIdType((*it).size()); } } // offsetsForRecv[0]=0; - for(int i=0;i0) - countForRecv[i]=nbOfElemsSrc[i]+1; + countForRecv[i]=(int)nbOfElemsSrc[i]+1; else countForRecv[i]=0; if(i>0) @@ -350,18 +350,18 @@ void OverlapMapping::serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigAr * 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. */ -int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0, - int *&bigArrI, double *&bigArrD, int *count, int *offsets, +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 { - int grpSize=_group.size(); + std::size_t grpSize=_group.size(); int myProcId=_group.myRank(); offsForRecv[0]=0; - int szz=0; - for(int i=0;i& mat=_matrixes_st[i]; - int lgthToSend=0; + mcIdType lgthToSend=0; for(std::vector< SparseDoubleVec >::const_iterator it=mat.begin();it!=mat.end();it++) - lgthToSend+=(*it).size(); - count[_target_proc_id_st[i]]=lgthToSend; + lgthToSend+=ToIdType((*it).size()); + count[_target_proc_id_st[i]]=(int)lgthToSend; fullLgth+=lgthToSend; } } - for(int i=1;i& mat=_matrixes_st[i]; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++) { - int j=0; + mcIdType j=0; for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++,j++) { bigArrI[fullLgth+j]=(*it2).first; @@ -418,31 +418,31 @@ int OverlapMapping::serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *r * - 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(int nbOfTrgElems, - const int *nbOfElemsSrcPerProc,//first all2all - const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs,//2nd all2all - const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs)//3rd and 4th all2alls +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 { _the_matrix_st.clear(); _the_matrix_st_source_proc_id.clear(); // - int grpSize=_group.size(); - for(int i=0;i& mat=_matrixes_st[i]; @@ -488,7 +488,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl { using namespace std; - int nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test + std::size_t nbOfCompo=fieldInput->getNumberOfComponents();//to improve same number of components to test CommInterface commInterface=_group.getCommInterface(); const MPIProcessorGroup *group=static_cast(&_group); const MPI_Comm *comm=group->getComm(); @@ -530,21 +530,21 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl MCAuto vals; if(_locator.isInMyTodoList(myProcID, procID)) { - map >::const_iterator isItem11 = _src_ids_zip_comp.find(procID); + map >::const_iterator isItem11 = _src_ids_zip_comp.find(procID); if (isItem11 == _src_ids_zip_comp.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _src_ids_zip_comp!"); - const vector & v = (*isItem11).second; - int sz = v.size(); + const vector & v = (*isItem11).second; + std::size_t sz = v.size(); vals=fieldInput->getArray()->selectByTupleId(&(v[0]),&(v[0])+sz); } else { - map < int, MCAuto >::const_iterator isItem11 = _sent_src_ids.find( procID ); + map < int, MCAuto >::const_iterator isItem11 = _sent_src_ids.find( procID ); if (isItem11 == _sent_src_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: SEND: unexpected end iterator in _sent_src_ids!"); vals=fieldInput->getArray()->selectByTupleId(*(*isItem11).second); } - nbsend[procID] = vals->getNbOfElems(); + nbsend[procID] = (int)vals->getNbOfElems(); valsToSend.insert(valsToSend.end(),vals->getConstPointer(),vals->getConstPointer()+nbsend[procID]); } @@ -566,17 +566,17 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl { if(_locator.isInMyTodoList(procID, myProcID)) { - map ::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID); + map ::const_iterator isItem11 = _nb_of_rcv_src_ids.find(procID); if (isItem11 == _nb_of_rcv_src_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _nb_of_rcv_src_ids!"); - nbrecv[procID] = (*isItem11).second; + nbrecv[procID] = (int)((*isItem11).second); } else { - map >::const_iterator isItem11 = _src_ids_zip_recv.find(procID); + map >::const_iterator isItem11 = _src_ids_zip_recv.find(procID); if (isItem11 == _src_ids_zip_recv.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: RCV: unexpected end iterator in _src_ids_zip_recv!"); - nbrecv[procID] = (*isItem11).second.size()*nbOfCompo; + nbrecv[procID] = (int)((*isItem11).second.size()*nbOfCompo); } } } @@ -624,7 +624,7 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl // For each source processor corresponding to a locally held matrix: { int srcProcID = *itProc; - int id = distance(_the_matrix_st_source_proc_id.begin(),itProc); + std::size_t id = std::distance(_the_matrix_st_source_proc_id.begin(),itProc); const vector< SparseDoubleVec >& mat =_the_matrix_st[id]; const vector< SparseDoubleVec >& deno = _the_deno_st[id]; @@ -636,9 +636,9 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl */ if (srcProcID == myProcID) { - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0; j revert_zip; - map >::const_iterator it11= _src_ids_zip_recv.find(srcProcID); + map revert_zip; + map >::const_iterator it11= _src_ids_zip_recv.find(srcProcID); if (it11 == _src_ids_zip_recv.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _src_ids_zip_recv!"); - const vector & vec = (*it11).second; + + const vector & vec = (*it11).second; int newId=0; - for(vector::const_iterator it=vec.begin();it!=vec.end();it++,newId++) + for(vector::const_iterator it=vec.begin();it!=vec.end();it++,newId++) revert_zip[*it]=newId; - map < int, MCAuto >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); + map < int, MCAuto >::const_iterator isItem24 = _sent_trg_ids.find(srcProcID); if (isItem24 == _sent_trg_ids.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in _sent_trg_ids!"); - const DataArrayInt *tgrIdsDA = (*isItem24).second; - const int *tgrIds = tgrIdsDA->getConstPointer(); + const DataArrayIdType *tgrIdsDA = (*isItem24).second; + const mcIdType *tgrIds = tgrIdsDA->getConstPointer(); - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0;j::const_iterator it4=revert_zip.find((*it3).first); + map::const_iterator it4=revert_zip.find((*it3).first); if(it4==revert_zip.end()) throw INTERP_KERNEL::Exception("OverlapMapping::multiply(): internal error: MULTIPLY: unexpected end iterator in revert_zip!"); double ratio = (*it3).second/(*it5).second; @@ -722,9 +723,9 @@ void OverlapMapping::multiply(const MEDCouplingFieldDouble *fieldInput, MEDCoupl */ { // Same loop as in the case srcProcID == myProcID, except that instead of working on local field data, we work on bigArr - int nbOfTrgTuples=mat.size(); + std::size_t nbOfTrgTuples=mat.size(); double * targetBase = fieldOutput->getArray()->getPointer(); - for(int j=0;j& mat=_the_matrix_st[i]; - std::set s; + std::set s; for(std::vector< SparseDoubleVec >::const_iterator it1=mat.begin();it1!=mat.end();it1++) for(SparseDoubleVec::const_iterator it2=(*it1).begin();it2!=(*it1).end();it2++) s.insert((*it2).first); - vector vec(s.begin(),s.end()); + vector vec(s.begin(),s.end()); _src_ids_zip_recv[curSrcProcId] = vec; } } diff --git a/src/ParaMEDMEM/OverlapMapping.hxx b/src/ParaMEDMEM/OverlapMapping.hxx index ef3ed4c49..fc541413f 100644 --- a/src/ParaMEDMEM/OverlapMapping.hxx +++ b/src/ParaMEDMEM/OverlapMapping.hxx @@ -35,7 +35,7 @@ namespace MEDCoupling class MEDCouplingFieldDouble; using namespace std; - typedef map SparseDoubleVec; + typedef map SparseDoubleVec; /*! * Internal class, not part of the public API. @@ -48,11 +48,11 @@ namespace MEDCoupling public: OverlapMapping(const ProcessorGroup& group, const OverlapElementLocator& locator); - void keepTracksOfSourceIds(int procId, DataArrayInt *ids); - void keepTracksOfTargetIds(int procId, DataArrayInt *ids); - void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayInt *srcIds, int srcProcId, const DataArrayInt *trgIds, int trgProcId); - void prepare(const vector< int >& procsToSendField, int nbOfTrgElems); - void computeDenoConservativeVolumic(int nbOfTuplesTrg); + void keepTracksOfSourceIds(int procId, DataArrayIdType *ids); + void keepTracksOfTargetIds(int procId, DataArrayIdType *ids); + void addContributionST(const vector< SparseDoubleVec >& matrixST, const DataArrayIdType *srcIds, int srcProcId, const DataArrayIdType *trgIds, int trgProcId); + void prepare(const vector< int >& procsToSendField, mcIdType nbOfTrgElems); + void computeDenoConservativeVolumic(mcIdType nbOfTuplesTrg); // void computeDenoIntegralGlobConstraint(); // void computeDenoIntegral(); void computeDenoRevIntegral(const DataArrayDouble & targetAreas); @@ -60,13 +60,13 @@ namespace MEDCoupling void multiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput, double default_val) const; void transposeMultiply(const MEDCouplingFieldDouble *fieldInput, MEDCouplingFieldDouble *fieldOutput); private: - void serializeMatrixStep0ST(const int *nbOfElemsSrc, int *&bigArr, int *count, int *offsets, + void serializeMatrixStep0ST(const mcIdType *nbOfElemsSrc, mcIdType *&bigArr, int *count, int *offsets, int *countForRecv, int *offsetsForRecv) const; - int serializeMatrixStep1ST(const int *nbOfElemsSrc, const int *recvStep0, const int *countStep0, const int *offsStep0, - int *&bigArrI, double *&bigArrD, int *count, int *offsets, + mcIdType 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; - void unserializationST(int nbOfTrgElems, const int *nbOfElemsSrcPerProc, const int *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs, - const int *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs); + void unserializationST(mcIdType nbOfTrgElems, const mcIdType *nbOfElemsSrcPerProc, const mcIdType *bigArrRecv, const int *bigArrRecvCounts, const int *bigArrRecvOffs, + const mcIdType *bigArrRecv2, const double *bigArrDRecv2, const int *bigArrRecv2Count, const int *bigArrRecv2Offs); void finishToFillFinalMatrixST(); void fillSourceIdsZipReceivedForMultiply(); @@ -83,10 +83,10 @@ namespace MEDCoupling * gives an old2new map for the local part of the source mesh that has been sent to proc#i, just based on the * bounding box computation (this is potentially a larger set than what is finally in the interp matrix). * Second member gives proc ID. */ - map < int, MCAuto > _sent_src_ids; + map < int, MCAuto > _sent_src_ids; //! See _sent_src_ids. Same for target mesh. - map < int, MCAuto > _sent_trg_ids; + map < int, MCAuto > _sent_trg_ids; /**! Vector of matrixes (partial interpolation ratios), result of the LOCAL interpolator run. * Indexing shared with _source_proc_id_st, and _target_proc_id_st. */ @@ -99,16 +99,16 @@ namespace MEDCoupling /**! Number of received source mesh IDs at mesh data exchange. Counting the number of IDs suffices, as we just need this to prepare the receive side, when doing the final vector matrix multiplication. First dimension is the remote proc ID from which we received. */ - map _nb_of_rcv_src_ids; + map _nb_of_rcv_src_ids; /**! Specifies for each (target) remote proc ID (first dim of the map) the corresponding * source cell IDs to use. * This information is stored from the *locally* COMPuted matrices, and corresponds hence to field value that will need to * sent later on, if this matrix bit itself is sent aways. */ - map > _src_ids_zip_comp; + map > _src_ids_zip_comp; /**! Same idea as _src_ids_zip_comp above, but for RECEIVED matrix. */ - map > _src_ids_zip_recv; + map > _src_ids_zip_recv; /**! THE matrix for matrix-vector product. The first dimension is indexed in the set of target procs * that interacts with local source mesh. The second dim is the target cell ID. diff --git a/src/ParaMEDMEM/ParaFIELD.cxx b/src/ParaMEDMEM/ParaFIELD.cxx index e1e1886fc..b3e65716b 100644 --- a/src/ParaMEDMEM/ParaFIELD.cxx +++ b/src/ParaMEDMEM/ParaFIELD.cxx @@ -112,7 +112,7 @@ namespace MEDCoupling */ ParaFIELD::ParaFIELD(MEDCouplingFieldDouble* subdomain_field, ParaMESH *sup, const ProcessorGroup& proc_group): _field(subdomain_field), - _component_topology(ComponentTopology(_field->getNumberOfComponents())),_topology(0),_own_support(false), + _component_topology(ComponentTopology((int)_field->getNumberOfComponents())),_topology(0),_own_support(false), _support(sup) { if(_field) @@ -174,7 +174,7 @@ namespace MEDCoupling * For example if _field is a nodal field : returned array will be the nodal global numbers. * The content of this method is used to inform Working side to accumulate data received by lazy side. */ - DataArrayInt* ParaFIELD::returnCumulativeGlobalNumbering() const + DataArrayIdType* ParaFIELD::returnCumulativeGlobalNumbering() const { if(!_field) return 0; @@ -190,7 +190,7 @@ namespace MEDCoupling } } - DataArrayInt* ParaFIELD::returnGlobalNumbering() const + DataArrayIdType* ParaFIELD::returnGlobalNumbering() const { if(!_field) return 0; diff --git a/src/ParaMEDMEM/ParaFIELD.hxx b/src/ParaMEDMEM/ParaFIELD.hxx index afdfbc007..7ca217363 100644 --- a/src/ParaMEDMEM/ParaFIELD.hxx +++ b/src/ParaMEDMEM/ParaFIELD.hxx @@ -22,6 +22,7 @@ #include "MEDCouplingRefCountObject.hxx" #include "ComponentTopology.hxx" +#include "MCType.hxx" namespace MEDCoupling { @@ -43,8 +44,8 @@ namespace MEDCoupling void synchronizeSource( MEDCoupling::ParaFIELD* target_field); MEDCouplingFieldDouble* getField() const { return _field; } void setOwnSupport(bool v) const { _own_support=v; } - DataArrayInt* returnCumulativeGlobalNumbering() const; - DataArrayInt* returnGlobalNumbering() const; + DataArrayIdType* returnCumulativeGlobalNumbering() const; + DataArrayIdType* returnGlobalNumbering() const; Topology* getTopology() const { return _topology; } ParaMESH* getSupport() const { return _support; } int nbComponents() const; diff --git a/src/ParaMEDMEM/ParaIdType.hxx b/src/ParaMEDMEM/ParaIdType.hxx new file mode 100644 index 000000000..8bc4dbb5b --- /dev/null +++ b/src/ParaMEDMEM/ParaIdType.hxx @@ -0,0 +1,31 @@ +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __ParaIdType_HXX__ +#define __ParaIdType_HXX__ + +#include + +#ifndef MEDCOUPLING_USE_64BIT_IDS +#define MPI_ID_TYPE MPI_INT +#else +#define MPI_ID_TYPE MPI_LONG +#endif + +#endif diff --git a/src/ParaMEDMEM/ParaMESH.cxx b/src/ParaMEDMEM/ParaMESH.cxx index cc5598194..1fe4ddf9c 100644 --- a/src/ParaMEDMEM/ParaMESH.cxx +++ b/src/ParaMEDMEM/ParaMESH.cxx @@ -34,8 +34,8 @@ using namespace std; namespace MEDCoupling { ParaMESH::ParaMESH( MEDCouplingPointSet *subdomain_mesh, MEDCouplingPointSet *subdomain_face, - DataArrayInt *CorrespElt_local2global, DataArrayInt *CorrespFace_local2global, - DataArrayInt *CorrespNod_local2global, const ProcessorGroup& proc_group ): + DataArrayIdType *CorrespElt_local2global, DataArrayIdType *CorrespFace_local2global, + DataArrayIdType *CorrespNod_local2global, const ProcessorGroup& proc_group ): _cell_mesh(subdomain_mesh), _face_mesh(subdomain_face), _my_domain_id(proc_group.myRank()), @@ -67,20 +67,20 @@ namespace MEDCoupling { if(_cell_mesh) _cell_mesh->incrRef(); - int nb_elem=mesh->getNumberOfCells(); + mcIdType nb_elem=mesh->getNumberOfCells(); _explicit_topology=new BlockTopology(proc_group,nb_elem); - int nbOfCells=mesh->getNumberOfCells(); - _cell_global = DataArrayInt::New(); + mcIdType nbOfCells=mesh->getNumberOfCells(); + _cell_global = DataArrayIdType::New(); _cell_global->alloc(nbOfCells,1); - int *cellglobal=_cell_global->getPointer(); - int offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0)); - for (int i=0; igetPointer(); + mcIdType offset = _block_topology->localToGlobal(make_pair(_my_domain_id,0)); + for (mcIdType i=0; iisStructured(); } MEDCouplingPointSet *getCellMesh() const { return _cell_mesh; } MEDCouplingPointSet *getFaceMesh() const { return _face_mesh; } BlockTopology* getBlockTopology() const { return _block_topology; } - DataArrayInt* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; } - DataArrayInt* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; } - DataArrayInt* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; } - const int* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; } - const int* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; } - const int* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; } + DataArrayIdType* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; } + DataArrayIdType* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; } + DataArrayIdType* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; } + const mcIdType* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; } + const mcIdType* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; } + const mcIdType* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; } private: //mesh object underlying the ParaMESH object @@ -84,9 +84,9 @@ namespace MEDCoupling MEDCoupling::BlockTopology* _block_topology; Topology* _explicit_topology; // pointers to global numberings - DataArrayInt* _node_global; - DataArrayInt* _face_global; - DataArrayInt* _cell_global; + DataArrayIdType* _node_global; + DataArrayIdType* _face_global; + DataArrayIdType* _cell_global; }; } diff --git a/src/ParaMEDMEM/ProcessorGroup.hxx b/src/ParaMEDMEM/ProcessorGroup.hxx index 2b10a2184..f4cd902f0 100644 --- a/src/ParaMEDMEM/ProcessorGroup.hxx +++ b/src/ParaMEDMEM/ProcessorGroup.hxx @@ -49,7 +49,7 @@ namespace MEDCoupling virtual void intersect (ProcessorGroup&) = 0; bool contains(int rank) const { return _proc_ids.find(rank)!=_proc_ids.end(); } virtual bool containsMyRank() const = 0; - int size() const { return _proc_ids.size(); } + int size() const { return (int)_proc_ids.size(); } const CommInterface& getCommInterface()const { return _comm_interface; } virtual int myRank() const = 0; virtual int translateRank(const ProcessorGroup*, int) const = 0; diff --git a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx index 2a8acfc29..36454c959 100644 --- a/src/ParaMEDMEM/StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEM/StructuredCoincidentDEC.cxx @@ -152,29 +152,29 @@ namespace MEDCoupling int myranksource = _topo_source->getProcGroup()->myRank(); - vector * target_arrays=new vector[_topo_target->getProcGroup()->size()]; + vector * target_arrays=new vector[_topo_target->getProcGroup()->size()]; //cout<<" topotarget size"<< _topo_target->getProcGroup()->size()< getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + mcIdType nb_local = _topo_source-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"source local :"<localToGlobal(make_pair(myranksource, ielem)); + mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem)); // cout << "global "< target_local =_topo_target->globalToLocal(global); + pair target_local =_topo_target->globalToLocal(global); // cout << "target local : "<size(); + std::size_t union_size=group->size(); _send_counts=new int[union_size]; _send_displs=new int[union_size]; _recv_counts=new int[union_size]; _recv_displs=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _send_counts[i]=0; _recv_counts[i]=0; @@ -186,7 +186,7 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_topo_target->getProcGroup(),iproc); - _send_counts[unionrank]=target_arrays[iproc].size(); + _send_counts[unionrank]=(int)target_arrays[iproc].size(); } for (int iproc=1; iprocsize();iproc++) @@ -200,15 +200,15 @@ namespace MEDCoupling int* counter=new int [_topo_target->getProcGroup()->size()]; counter[0]=0; for (int i=1; i<_topo_target->getProcGroup()->size(); i++) - counter[i]=counter[i-1]+target_arrays[i-1].size(); + counter[i]=counter[i-1]+(int)target_arrays[i-1].size(); const double* value = _local_field->getField()->getArray()->getPointer(); //cout << "Nb local " << nb_local<localToGlobal(make_pair(myranksource, ielem)); - pair target_local =_topo_target->globalToLocal(global); + mcIdType global = _topo_source->localToGlobal(make_pair(myranksource, ielem)); + pair target_local =_topo_target->globalToLocal(global); //cout <<"global : "<< global<<" local :"<getProcGroup()->myRank(); - vector < vector > source_arrays(_topo_source->getProcGroup()->size()); - int nb_local = _topo_target-> getNbLocalElements(); - for (int ielem=0; ielem< nb_local ; ielem++) + vector < vector > source_arrays(_topo_source->getProcGroup()->size()); + mcIdType nb_local = _topo_target-> getNbLocalElements(); + for (mcIdType ielem=0; ielem< nb_local ; ielem++) { // cout <<"TS target local :"<localToGlobal(make_pair(myranktarget, ielem)); + mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem)); //cout << "TS global "< source_local =_topo_source->globalToLocal(global); + pair source_local =_topo_source->globalToLocal(global); // cout << "TS source local : "<size(); + std::size_t union_size=group->size(); _recv_counts=new int[union_size]; _recv_displs=new int[union_size]; _send_counts=new int[union_size]; _send_displs=new int[union_size]; - for (int i=0; i< union_size; i++) + for (std::size_t i=0; i< union_size; i++) { _send_counts[i]=0; _recv_counts[i]=0; @@ -257,9 +257,9 @@ namespace MEDCoupling { //converts the rank in target to the rank in union communicator int unionrank=group->translateRank(_topo_source->getProcGroup(),iproc); - _recv_counts[unionrank]=source_arrays[iproc].size(); + _recv_counts[unionrank]=(int)source_arrays[iproc].size(); } - for (int i=1; imyRank()<< "received master rank"<broadcast(&size, 1,MPI_INT,rank_master,*(group->getComm())); + _comm_interface->broadcast(&size, 1,MPI_ID_TYPE,rank_master,*(group->getComm())); - int* buffer=new int[size]; + mcIdType* buffer=new mcIdType[size]; if (topo!=0 && topo->getProcGroup()->myRank()==0) copy(serializer, serializer+size, buffer); - _comm_interface->broadcast(buffer,size,MPI_INT,rank_master,*(group->getComm())); + _comm_interface->broadcast(buffer,(int)size,MPI_ID_TYPE,rank_master,*(group->getComm())); // Processors which did not possess the source topology // unserialize it @@ -353,7 +353,7 @@ namespace MEDCoupling _recv_buffer, _recv_counts, _recv_displs, MPI_DOUBLE,comm); cout<<"end AllToAll"<getNbLocalElements(); + mcIdType nb_local = _topo_target->getNbLocalElements(); //double* value=new double[nb_local]; double* value=const_cast(_local_field->getField()->getArray()->getPointer()); @@ -368,10 +368,10 @@ namespace MEDCoupling delete group; } - for (int ielem=0; ielemlocalToGlobal(make_pair(myranktarget, ielem)); - pair source_local =_topo_source->globalToLocal(global); + mcIdType global = _topo_target->localToGlobal(make_pair(myranktarget, ielem)); + pair source_local =_topo_source->globalToLocal(global); value[ielem]=_recv_buffer[counters[source_local.first]++]; } diff --git a/src/ParaMEDMEM/Topology.hxx b/src/ParaMEDMEM/Topology.hxx index 101ecbbe0..168b5bbd5 100644 --- a/src/ParaMEDMEM/Topology.hxx +++ b/src/ParaMEDMEM/Topology.hxx @@ -20,6 +20,8 @@ #ifndef __TOPOLOGY_HXX__ #define __TOPOLOGY_HXX__ +#include "MCType.hxx" + namespace MEDCoupling { class ProcessorGroup; @@ -36,8 +38,8 @@ namespace MEDCoupling public: Topology() { } virtual ~Topology() { } - virtual int getNbElements() const = 0; - virtual int getNbLocalElements() const = 0; + virtual mcIdType getNbElements() const = 0; + virtual mcIdType getNbLocalElements() const = 0; virtual const ProcessorGroup* getProcGroup()const = 0; }; } diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx index cb3725380..ebacc6dc6 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx @@ -80,7 +80,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() const double sourceCoordsAll[2][8]={{0.4,0.5,0.4,1.5,1.6,1.5,1.6,0.5}, {0.3,-0.5,1.6,-0.5,1.6,-1.5,0.3,-1.5}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; std::ostringstream stream; stream << "sourcemesh2D proc " << grank; mesh=MEDCouplingUMesh::New(stream.str().c_str(),2); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx index 29265f665..b7a10c8ad 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx @@ -82,7 +82,7 @@ void MPI2ParaMEDMEMTest::testBasicMPI2_1() const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4}, {0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7}, {0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}}; std::ostringstream stream; stream << "targetmesh2D proc " << grank-(gsize-lsize); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx index c8521a8cb..408084e31 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx @@ -69,8 +69,8 @@ void ParaMEDMEMTest::testBlockTopology_constructor() CommInterface interface; MPIProcessorGroup group(interface); BlockTopology blocktopo(group,1); - CPPUNIT_ASSERT_EQUAL(1,blocktopo.getNbLocalElements()); - CPPUNIT_ASSERT_EQUAL(size,blocktopo.getNbElements()); + CPPUNIT_ASSERT_EQUAL(ToIdType(1),blocktopo.getNbLocalElements()); + CPPUNIT_ASSERT_EQUAL(ToIdType(size),blocktopo.getNbElements()); CPPUNIT_ASSERT_EQUAL(1,blocktopo.getDimension()); //checking access methods @@ -93,11 +93,11 @@ void ParaMEDMEMTest::testBlockTopology_constructor() global=blocktopo2.localToGlobal(local); CPPUNIT_ASSERT_EQUAL(global,2*size-1); - std::vector > bounds = blocktopo2.getLocalArrayMinMax(); + std::vector > bounds = blocktopo2.getLocalArrayMinMax(); int vecsize = bounds.size(); CPPUNIT_ASSERT_EQUAL(1,vecsize); CPPUNIT_ASSERT_EQUAL(2*rank, (bounds[0]).first); - CPPUNIT_ASSERT_EQUAL(2*rank+2, (bounds[0]).second); + CPPUNIT_ASSERT_EQUAL(ToIdType(2*rank+2), (bounds[0]).second); } void ParaMEDMEMTest::testBlockTopology_serialize() @@ -114,8 +114,8 @@ void ParaMEDMEMTest::testBlockTopology_serialize() //testing the serialization process that is used to transfer a //block topology via a MPI_Send/Recv comm BlockTopology blocktopo_recv; - int* serializer; - int sersize; + mcIdType* serializer; + mcIdType sersize; blocktopo.serialize(serializer,sersize); blocktopo_recv.unserialize(serializer,interface); CPPUNIT_ASSERT_EQUAL(blocktopo.getNbElements(),blocktopo_recv.getNbElements()); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx index 6e3d5a80c..514251c47 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx @@ -65,7 +65,7 @@ void ParaMEDMEMTest::testFabienAPI1() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -85,7 +85,7 @@ void ParaMEDMEMTest::testFabienAPI1() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); @@ -150,7 +150,7 @@ void ParaMEDMEMTest::testFabienAPI2() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -170,7 +170,7 @@ void ParaMEDMEMTest::testFabienAPI2() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx index 5c05af4fa..c8e2d4948 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx @@ -60,7 +60,7 @@ MEDCouplingUMesh *init_quadGauthier1(int is_master) const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[8]={0,1,3,2,4,5,7,6}; + const mcIdType conn[8]={0,1,3,2,4,5,7,6}; m->allocateCells(2); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4); @@ -83,7 +83,7 @@ MEDCouplingUMesh *init_triangleGauthier1(int is_master) const double dataCoo[24]={0,0,0,1,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,1}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; + const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; m->allocateCells(2); for(int i=0;i<4;i++) m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); @@ -285,7 +285,7 @@ void ParaMEDMEMTest::testGauthier2() std::copy(cooData,cooData+189,arr->getPointer()); mesh->setCoords(arr); mesh->allocateCells(80); - const int conn[240]={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,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29}; + const mcIdType conn[240]={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,2,1,31,5,4,32,8,7,33,11,10,34,14,13,35,17,16,36,20,19,37,23,22,38,26,25,39,29,28,30,40,2,31,41,5,32,42,8,33,43,11,34,44,14,35,45,17,36,46,20,37,47,23,38,48,26,39,49,29,31,2,40,32,5,41,33,8,42,34,11,43,35,14,44,36,17,45,37,20,46,38,23,47,39,26,48,50,29,49,3,2,4,6,5,7,9,8,10,12,11,13,15,14,16,18,17,19,21,20,22,24,23,25,27,26,28,51,29,52,31,4,2,32,7,5,33,10,8,34,13,11,35,16,14,36,19,17,37,22,20,38,25,23,39,28,26,50,52,29,0,2,53,3,5,54,6,8,55,9,11,56,12,14,57,15,17,58,18,20,59,21,23,60,24,26,61,27,29,62,3,53,2,6,54,5,9,55,8,12,56,11,15,57,14,18,58,17,21,59,20,24,60,23,27,61,26,51,62,29}; for(int i=0;i<80;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); MCAuto f(MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME)); @@ -307,7 +307,7 @@ void ParaMEDMEMTest::testGauthier2() std::copy(cooData,cooData+66,arr->getPointer()); mesh->setCoords(arr); mesh->allocateCells(10); - const int conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20}; + const mcIdType conn[40]={0,1,3,2,2,3,5,4,4,5,7,6,6,7,9,8,8,9,11,10,10,11,13,12,12,13,15,14,14,15,17,16,16,17,19,18,18,19,21,20}; for(int i=0;i<10;i++) mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4*i); MCAuto f(MEDCouplingFieldDouble::New(type==0?ON_CELLS:ON_NODES,ONE_TIME)); @@ -338,7 +338,7 @@ void ParaMEDMEMTest::testGauthier2() { double pmin=1e38, pmax=-1e38; const double *p(vitesse->getField()->getArray()->begin()); - for(std::size_t i=0;igetField()->getArray()->getNbOfElems();i++,p++) + for(mcIdType i=0;igetField()->getArray()->getNbOfElems();i++,p++) { if (*ppmax) pmax=*p; @@ -555,12 +555,12 @@ void ParaMEDMEMTest::testGauthier4() { // const double sourceCoords[19*3]={0.5,0.5,0.1,0.5,0.5,1.2,0.5,0.5,1.6,0.5,0.5,1.8,0.5,0.5,2.43,0.5,0.5,2.55,0.5,0.5,4.1,0.5,0.5,4.4,0.5,0.5,4.9,0.5,0.5,5.1,0.5,0.5,7.6,0.5,0.5,7.7,0.5,0.5,8.2,0.5,0.5,8.4,0.5,0.5,8.6,0.5,0.5,8.8,0.5,0.5,9.2,0.5,0.5,9.6,0.5,0.5,11.5}; - const int sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18}; + const mcIdType sourceConn[18*2]={0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18}; const double sourceVals[19]={0.49,2.8899999999999997,7.29,13.69,22.09,32.49,44.89,59.29,75.69,94.09, 114.49,136.89,161.29,187.69,216.09,246.49,278.89,313.29,349.69}; const double targetCoords0[20*3]={0.,0.,0.,1.,0.,0.,0.,1.,0.,1.,1.,0.,0.,0.,1.,1.,0.,1.,0.,1.,1.,1.,1.,1.,0.,0.,2.,1.,0.,2.,0.,1.,2.,1.,1.,2.,0.,0.,3.,1.,0.,3.,0.,1.,3.,1.,1.,3.,0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.}; - const int targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19}; + const mcIdType targetConn0[8*4]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19}; const double targetCoords1[28*3]={0.,0.,4.,1.,0.,4.,0.,1.,4.,1.,1.,4.,0.,0.,5.,1.,0.,5.,0.,1.,5.,1.,1.,5.,0.,0.,6.,1.,0.,6.,0.,1.,6.,1.,1.,6.,0.,0.,7.,1.,0.,7.,0.,1.,7.,1.,1.,7.,0.,0.,8.,1.,0.,8.,0.,1.,8.,1.,1.,8.,0.,0.,9.,1.,0.,9.,0.,1.,9.,1.,1.,9.,0.,0.,10.,1.,0.,10.,0.,1.,10.,1.,1.,10.}; - const int targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27}; + const mcIdType targetConn1[8*6]={1,0,2,3,5,4,6,7,5,4,6,7,9,8,10,11,9,8,10,11,13,12,14,15,13,12,14,15,17,16,18,19,17,16,18,19,21,20,22,23,21,20,22,23,25,24,26,27}; // int size; int rank; diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx index 46b42b8ca..2c846ac20 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx @@ -72,7 +72,7 @@ MEDCouplingUMesh *init_quad() const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[8]={0,1,3,2,4,5,7,6}; + const mcIdType conn[8]={0,1,3,2,4,5,7,6}; m->allocateCells(2); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); m->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn+4); @@ -87,7 +87,7 @@ MEDCouplingUMesh *init_triangle() const double dataCoo[24]={0.,0.,0.,1.,0.,0.,0.,0.,1.,1.,0.,1.,0.,1e-05,0.,1.,1e-05,0.,0.,1e-05,1.,1.,1e-05,1.}; coo->alloc(8,3); std::copy(dataCoo,dataCoo+24,coo->getPointer()); - const int conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; + const mcIdType conn[12]={0,1,2,1,2,3,4,5,7,4,6,7}; m->allocateCells(4); for(int i=0;i<4;i++) m->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn+3*i); @@ -144,7 +144,6 @@ void ParaMEDMEMTest::testICoco1() champ_recepteur->setOwnSupport(true); } - MPI_Barrier(MPI_COMM_WORLD); clock_t clock0(clock()); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 7be3eb003..d6aee48e8 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -105,7 +105,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==0) { double coords[4]={0.3,0.7, 0.9,1.0}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",1); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -120,7 +120,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==1) { double coords[2]={0.7,0.9}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -134,7 +134,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==2) { double coords[2]={1.,1.12}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc2",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -169,7 +169,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==3) { double coords[2]={0.5,0.75}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -184,7 +184,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_1D() if(rank==4) { double coords[2]={0.75,1.2}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -294,7 +294,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==0) { double coords[8]={0.3,0.3,0.7,0.7, 0.9,0.9,1.0,1.0}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",1); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -309,7 +309,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==1) { double coords[4]={0.7,0.7,0.9,0.9}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -323,7 +323,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==2) { double coords[4]={1.,1.,1.12,1.12}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Source mesh Proc2",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -358,7 +358,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==3) { double coords[4]={0.5,0.5,0.75,0.75}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -373,7 +373,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2DCurve() if(rank==4) { double coords[4]={0.75,0.75,1.2,1.2}; - int conn[2]={0,1}; + mcIdType conn[2]={0,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",1); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,conn); @@ -1091,7 +1091,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P0() const double targetCoordsAll[3][16]={{0.7,1.45,0.7,1.65,0.9,1.65,0.9,1.45, 1.1,1.4,1.1,1.6,1.3,1.6,1.3,1.4}, {0.7,-0.6,0.7,0.7,0.9,0.7,0.9,-0.6, 1.1,-0.7,1.1,0.6,1.3,0.6,1.3,-0.7}, {0.7,-1.55,0.7,-1.35,0.9,-1.35,0.9,-1.55, 1.1,-1.65,1.1,-1.45,1.3,-1.45,1.3,-1.65}}; - int conn4All[8]={0,1,2,3,4,5,6,7}; + mcIdType conn4All[8]={0,1,2,3,4,5,6,7}; double targetResults[3][2]={{34.,34.},{38.333333333333336,42.666666666666664},{47.,47.}}; double targetResults2[3][2]={{0.28333333333333344,0.56666666666666687},{1.8564102564102569,2.0128205128205132},{1.0846153846153845,0.36153846153846159}}; double targetResults3[3][2]={{3.7777777777777781,7.5555555555555562},{24.511111111111113,26.355555555555558},{14.1,4.7}}; @@ -1410,7 +1410,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==0) { double coords[6]={-0.3,-0.3, 0.7,0.7, 0.7,-0.3}; - int conn[3]={0,1,2}; + mcIdType conn[3]={0,1,2}; //int globalNode[3]={1,2,0}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",2); mesh->allocateCells(1); @@ -1425,7 +1425,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==1) { double coords[6]={-0.3,-0.3, -0.3,0.7, 0.7,0.7}; - int conn[3]={0,1,2}; + mcIdType conn[3]={0,1,2}; //int globalNode[3]={1,3,2}; mesh=MEDCouplingUMesh::New("Source mesh Proc1",2); mesh->allocateCells(1); @@ -1462,7 +1462,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==2) { double coords[10]={-0.3,-0.3, 0.2,-0.3, 0.7,-0.3, -0.3,0.2, 0.2,0.2 }; - int conn[7]={0,3,4,1, 1,4,2}; + mcIdType conn[7]={0,3,4,1, 1,4,2}; //int globalNode[5]={4,3,0,2,1}; mesh=MEDCouplingUMesh::New("Target mesh Proc2",2); mesh->allocateCells(2); @@ -1475,8 +1475,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP2[5]={0,1,2,3,4}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP2[5]={0,1,2,3,4}; da->useArray(globalNumberingP2,false,DeallocType::CPP_DEALLOC,5,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1484,7 +1484,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==3) { double coords[6]={0.2,0.2, 0.7,-0.3, 0.7,0.2}; - int conn[3]={0,2,1}; + mcIdType conn[3]={0,2,1}; //int globalNode[3]={1,0,5}; mesh=MEDCouplingUMesh::New("Target mesh Proc3",2); mesh->allocateCells(1); @@ -1496,8 +1496,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP3[3]={4,2,5}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP3[3]={4,2,5}; da->useArray(globalNumberingP3,false,DeallocType::CPP_DEALLOC,3,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1505,7 +1505,7 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() if(rank==4) { double coords[12]={-0.3,0.2, -0.3,0.7, 0.2,0.7, 0.2,0.2, 0.7,0.7, 0.7,0.2}; - int conn[8]={0,1,2,3, 3,2,4,5}; + mcIdType conn[8]={0,1,2,3, 3,2,4,5}; //int globalNode[6]={2,6,7,1,8,5}; mesh=MEDCouplingUMesh::New("Target mesh Proc4",2); mesh->allocateCells(2); @@ -1518,8 +1518,8 @@ void ParaMEDMEMTest::testInterpKernelDECNonOverlapp_2D_P0P1P1P0() mesh->setCoords(myCoords); myCoords->decrRef(); paramesh=new ParaMESH(mesh,*target_group,targetMeshName); - DataArrayInt *da=DataArrayInt::New(); - const int globalNumberingP4[6]={3,6,7,4,8,5}; + DataArrayIdType *da=DataArrayIdType::New(); + const mcIdType globalNumberingP4[6]={3,6,7,4,8,5}; da->useArray(globalNumberingP4,false,DeallocType::CPP_DEALLOC,6,1); paramesh->setNodeGlobal(da); da->decrRef(); @@ -1636,7 +1636,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() myCoords->decrRef(); if(rank==0) { - int targetConn[7]={0,3,4,1, 1,4,2}; + mcIdType targetConn[7]={0,3,4,1, 1,4,2}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+4); @@ -1644,7 +1644,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2DM1D_P0P0() } else { - int targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4}; + mcIdType targetConn[11]={4,5,2, 6,7,4,3, 7,8,5,4}; mesh->allocateCells(3); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn+3); @@ -1869,7 +1869,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[4]={0,2,3,1}; + mcIdType targetConn[4]={0,2,3,1}; mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn); mesh->finishInsertingCells(); @@ -1894,7 +1894,7 @@ void ParaMEDMEMTest::testInterpKernelDECPartialProcs() std::copy(targetCoords,targetCoords+8,myCoords->getPointer()); mesh->setCoords(myCoords); myCoords->decrRef(); - int targetConn[6]={0,2,1,2,3,1}; + mcIdType targetConn[6]={0,2,1,2,3,1}; mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn); mesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn+3); @@ -1962,7 +1962,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(source_group->containsMyRank()) { double coords[15]={1.,0.,0., 2.,0.,0., 2.,2.,0., 0.,2.,0., 0.5,0.5,1.}; - int conn[7]={0,1,2,3,0,3,4}; + mcIdType conn[7]={0,1,2,3,0,3,4}; mesh=MEDCouplingUMesh::New("Source mesh Proc0",2); mesh->allocateCells(2); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -1987,7 +1987,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(rank==1) { double coords[12]={0.25,0.25,0.5, 0.,0.25,0.5, 0.,0.,0.5, 0.25,0.,0.5}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Target mesh Proc1",2); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); @@ -2002,7 +2002,7 @@ void ParaMEDMEMTest::testInterpKernelDEC3DSurfEmptyBBox() if(rank==2) { double coords[12]={0.,0.25,0.5, 0.,0.,0.5, -1.,0.,0.5, -1.,0.25,0.5}; - int conn[4]={0,1,2,3}; + mcIdType conn[4]={0,1,2,3}; mesh=MEDCouplingUMesh::New("Target mesh Proc2",2); mesh->allocateCells(1); mesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,conn); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx index 410b5ce6a..06c081ebb 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx @@ -196,7 +196,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+10,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[7]={0,3,4,1, 1,4,2}; + mcIdType connS[7]={0,3,4,1, 1,4,2}; meshS->allocateCells(2); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS+4); @@ -215,7 +215,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,2,1}; + mcIdType connT[3]={0,2,1}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -238,7 +238,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+10,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[7]={0,1,2, 1,3,4,2}; + mcIdType connS[7]={0,1,2, 1,3,4,2}; meshS->allocateCells(2); meshS->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connS); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS+3); @@ -257,7 +257,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,2,1}; + mcIdType connT[3]={0,2,1}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -280,7 +280,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsS,coordsS+8,myCoords->getPointer()); meshS->setCoords(myCoords); myCoords->decrRef(); - int connS[4]={0,2,3,1}; + mcIdType connS[4]={0,2,3,1}; meshS->allocateCells(1); meshS->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); meshS->finishInsertingCells(); @@ -298,7 +298,7 @@ void prepareData1(int rank, NatureOfField nature, std::copy(coordsT,coordsT+6,myCoords->getPointer()); meshT->setCoords(myCoords); myCoords->decrRef(); - int connT[3]={0,1,2}; + mcIdType connT[3]={0,1,2}; meshT->allocateCells(1); meshT->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT->finishInsertingCells(); @@ -319,7 +319,7 @@ void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* myCoords->alloc(5,2); std::copy(coords,coords+10,myCoords->getPointer()); meshS_0->setCoords(myCoords); myCoords->decrRef(); - int connS[4]={0,1,2,3}; + mcIdType connS[4]={0,1,2,3}; meshS_0->allocateCells(2); meshS_0->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,connS); // @@ -329,7 +329,7 @@ void prepareData2_buildOneSquare(MEDCouplingUMesh* & meshS_0, MEDCouplingUMesh* std::copy(coords,coords+10,myCoords->getPointer()); meshT_0->setCoords(myCoords); myCoords->decrRef(); - int connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4}; + mcIdType connT[12]={0,1,4, 1,2,4, 2,3,4, 3,0,4}; meshT_0->allocateCells(4); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT); meshT_0->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,connT+3); diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx index b538f7317..b898cd4fd 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx @@ -106,7 +106,7 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() { parafield = new ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo); int nb_local=mesh->getNumberOfCells(); - const int* global_numbering = paramesh->getGlobalNumberingCell(); + const mcIdType* global_numbering = paramesh->getGlobalNumberingCell(); double *value=parafield->getField()->getArray()->getPointer(); for(int ielem=0; ielemgetGlobalNumberingCell(); - int size=self->getCellMesh()->getNumberOfCells(); + const mcIdType *tmp=self->getGlobalNumberingCell(); + mcIdType size=self->getCellMesh()->getNumberOfCells(); PyObject *ret=PyList_New(size); - for(int i=0;igetGlobalNumberingFace(); - int size=self->getFaceMesh()->getNumberOfCells(); + const mcIdType *tmp=self->getGlobalNumberingFace(); + mcIdType size=self->getFaceMesh()->getNumberOfCells(); PyObject *ret=PyList_New(size); - for(int i=0;igetGlobalNumberingNode(); - int size=self->getCellMesh()->getNumberOfNodes(); + const mcIdType *tmp=self->getGlobalNumberingNode(); + mcIdType size=self->getCellMesh()->getNumberOfNodes(); PyObject *ret=PyList_New(size); - for(int i=0;i #include -void BOOSTRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) +void BOOSTRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { - MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); // typedef boost::adjacency_list > > Graph; + boost::property > > Graph; typedef boost::graph_traits::vertex_descriptor Vertex; typedef boost::graph_traits::vertices_size_type size_type; Graph G(nbCell); - for (int i=0;i::type 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)); - int *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); - for(int c=0;c!=nbCell;++c) + mcIdType *out0Ptr(out0->getPointer()),*out1Ptr(out1->getPointer()); + for(mcIdType c=0;c!=nbCell;++c) out1Ptr[index_map[out0Ptr[nbCell-c-1]]]=c; out0->reverse(); iperm=out0.retn(); perm=out1.retn(); diff --git a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx index f82bab2a7..4a62e4f66 100644 --- a/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_BOOSTRenumbering.hxx @@ -26,7 +26,7 @@ class RENUMBER_EXPORT BOOSTRenumbering:public Renumbering { public: - void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm); + 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 3fb90960e..f2593b051 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.cxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.cxx @@ -33,13 +33,36 @@ extern "C" #include "RENUMBER_METISRenumbering.hxx" -void METISRenumbering::renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) +#ifdef MEDCOUPLING_USE_64BIT_IDS +#define ID_TYPE_SIZE 64 +#else +#define ID_TYPE_SIZE 32 +#endif + +void METISRenumbering::renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) { - MEDCoupling::MCAuto out0(MEDCoupling::DataArrayInt::New()),out1(MEDCoupling::DataArrayInt::New()); + MEDCoupling::MCAuto out0(MEDCoupling::DataArrayIdType::New()),out1(MEDCoupling::DataArrayIdType::New()); out0->alloc(nbCell,1); out1->alloc(nbCell,1); out0->fillWithZero(); out1->fillWithZero(); int num_flag=1; int options=0; - METIS_NodeND(&nbCell,(int*)index_graph,(int*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#if ID_TYPE_SIZE == IDXTYPEWIDTH + + METIS_NodeND(&nbCell,(idx_t*)index_graph,(idx_t*)graph,&num_flag,&options,out0->getPointer(),out1->getPointer()); + +#else + + mcIdType indexSize = nbCell + 1, graphSize = index_graph[indexSize]; + std::vector indexVec( index_graph, index_graph + indexSize ); + std::vector graphVec( graph, graph + graphSize ); + std::vector out0Vec( nbCell ), out1Vec( nbCell ); + idx_t nb = static_cast( 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() ); + +#endif + iperm=out0.retn(); perm=out1.retn(); } diff --git a/src/RENUMBER/RENUMBER_METISRenumbering.hxx b/src/RENUMBER/RENUMBER_METISRenumbering.hxx index c29dd2419..4fa31399d 100644 --- a/src/RENUMBER/RENUMBER_METISRenumbering.hxx +++ b/src/RENUMBER/RENUMBER_METISRenumbering.hxx @@ -26,7 +26,7 @@ class RENUMBER_EXPORT METISRenumbering:public Renumbering { public: - virtual void renumber(const int *graph, const int *index_graph, int nb_cell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm); + 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 12e034b49..df2c83d7f 100644 --- a/src/RENUMBER/RENUMBER_Renumbering.hxx +++ b/src/RENUMBER/RENUMBER_Renumbering.hxx @@ -27,13 +27,13 @@ namespace MEDCoupling { - class DataArrayInt; + class DataArrayIdType; } class RENUMBER_EXPORT Renumbering { public: - virtual void renumber(const int *graph, const int *index_graph, int nbCell, MEDCoupling::DataArrayInt *&iperm, MEDCoupling::DataArrayInt *&perm) = 0; + virtual void renumber(const mcIdType *graph, const mcIdType *index_graph, mcIdType nbCell, MEDCoupling::DataArrayIdType *&iperm, MEDCoupling::DataArrayIdType *&perm) = 0; virtual ~Renumbering() { } }; diff --git a/src/RENUMBER/renumbering.cxx b/src/RENUMBER/renumbering.cxx index 50d78d78e..8b2a7782c 100644 --- a/src/RENUMBER/renumbering.cxx +++ b/src/RENUMBER/renumbering.cxx @@ -38,7 +38,7 @@ using namespace MED_RENUMBER; int main(int argc, char** argv) { double t_begin,t_read_st,t_compute_graph,t_family,t_field; - t_begin=clock(); + t_begin=(double)clock(); if (argc <5) { cerr << "Usage : " << argv[0] @@ -65,39 +65,39 @@ int main(int argc, char** argv) std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - t_read_st=clock(); + t_read_st=(double)clock(); cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Reading mesh MCAuto workMesh=mc->getMeshAtLevel(0); - std::vector code=workMesh->getDistributionOfTypes(); + //std::vector code=workMesh->getDistributionOfTypes(); cout << "Building the graph : " << flush; - DataArrayInt *neighb=0,*neighbI=0; + DataArrayIdType *neighb=0,*neighbI=0; workMesh->computeNeighborsOfCells(neighb,neighbI); - MCAuto neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; - const int *graph=neighbSafe->begin(); - const int *graph_index=neighbISafe->begin(); + MCAuto neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe; + const mcIdType *graph=neighbSafe->begin(); + const mcIdType *graph_index=neighbISafe->begin(); // Compute permutation iperm->new2old perm->old2new - DataArrayInt *iperm(0),*perm(0); + 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=0;//erase new2old, we are using only old 2 new - t_compute_graph=clock(); + t_compute_graph=(double)clock(); cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl; cout.flush(); // Connectivity cout << "Reordering connectivity & families and writing : " << flush; workMesh->renumberCells(perm->begin(),false); mc->setMeshAtLevel(0,workMesh); - const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0); + const DataArrayIdType *famField=mc->getFamilyFieldAtLevel(0); if(famField) { - MCAuto famField2=famField->renumber(perm->begin()); + MCAuto famField2=famField->renumber(perm->begin()); mc->setFamilyFieldArr(0,famField2); } mc->write(filename_out,2); - t_family=clock(); + t_family=(double)clock(); cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush; // Fields cout << "Reordering fields and writing : " << flush; @@ -122,7 +122,7 @@ int main(int argc, char** argv) fs->write(filename_out,0); //fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged } - t_field=clock(); + t_field=(double)clock(); cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush; return 0; } diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index 9c265924b..a85a1a6be 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -21,6 +21,10 @@ INCLUDE(${SWIG_USE_FILE}) ADD_DEFINITIONS(${PYTHON_DEFINITIONS} ${NUMPY_DEFINITIONS} ${SCIPY_DEFINITIONS}) +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_FLAGS "-py3") @@ -28,6 +32,9 @@ ELSE() SET_SOURCE_FILES_PROPERTIES(MEDRenumber.i PROPERTIES SWIG_DEFINITIONS "-shadow") ENDIF() SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD") +IF(MEDCOUPLING_USE_64BIT_IDS) + STRING(APPEND SWIG_MODULE_MEDRenumber_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS") +ENDIF(MEDCOUPLING_USE_64BIT_IDS) SET (MEDRenumber_SWIG_DPYS_FILES MEDRenumberCommon.i diff --git a/src/RENUMBER_Swig/MEDRenumber.i b/src/RENUMBER_Swig/MEDRenumber.i index 2060dd0e1..1a4c7bdbe 100644 --- a/src/RENUMBER_Swig/MEDRenumber.i +++ b/src/RENUMBER_Swig/MEDRenumber.i @@ -37,24 +37,42 @@ def MEDCouplingDataArrayDoubleIdiv(self,*args): def MEDCouplingDataArrayDoubleIpow(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayDouble____ipow___(self, self, *args) -def MEDCouplingDataArrayIntIadd(self,*args): +def MEDCouplingDataArrayInt32Iadd(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____iadd___(self, self, *args) -def MEDCouplingDataArrayIntIsub(self,*args): + return _MEDRenumber.DataArrayInt32____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32Isub(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____isub___(self, self, *args) -def MEDCouplingDataArrayIntImul(self,*args): + return _MEDRenumber.DataArrayInt32____isub___(self, self, *args) +def MEDCouplingDataArrayInt32Imul(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____imul___(self, self, *args) -def MEDCouplingDataArrayIntIdiv(self,*args): + return _MEDRenumber.DataArrayInt32____imul___(self, self, *args) +def MEDCouplingDataArrayInt32Idiv(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____idiv___(self, self, *args) -def MEDCouplingDataArrayIntImod(self,*args): + return _MEDRenumber.DataArrayInt32____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32Imod(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____imod___(self, self, *args) -def MEDCouplingDataArrayIntIpow(self,*args): + return _MEDRenumber.DataArrayInt32____imod___(self, self, *args) +def MEDCouplingDataArrayInt32Ipow(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayInt____ipow___(self, self, *args) + return _MEDRenumber.DataArrayInt32____ipow___(self, self, *args) +def MEDCouplingDataArrayInt64Iadd(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64Isub(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____isub___(self, self, *args) +def MEDCouplingDataArrayInt64Imul(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____imul___(self, self, *args) +def MEDCouplingDataArrayInt64Idiv(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64Imod(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____imod___(self, self, *args) +def MEDCouplingDataArrayInt64Ipow(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64____ipow___(self, self, *args) def MEDCouplingDataArrayFloatIadd(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayFloat____iadd___(self, self, *args) @@ -79,21 +97,36 @@ def MEDCouplingDataArrayDoubleTupleImul(self,*args): def MEDCouplingDataArrayDoubleTupleIdiv(self,*args): import _MEDRenumber return _MEDRenumber.DataArrayDoubleTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleIadd(self,*args): +def MEDCouplingDataArrayInt32TupleIadd(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt32Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIsub(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____iadd___(self, self, *args) -def MEDCouplingDataArrayIntTupleIsub(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImul(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____isub___(self, self, *args) -def MEDCouplingDataArrayIntTupleImul(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt32TupleIdiv(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____imul___(self, self, *args) -def MEDCouplingDataArrayIntTupleIdiv(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt32TupleImod(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____idiv___(self, self, *args) -def MEDCouplingDataArrayIntTupleImod(self,*args): + return _MEDRenumber.DataArrayInt32Tuple____imod___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIadd(self,*args): import _MEDRenumber - return _MEDRenumber.DataArrayIntTuple____imod___(self, self, *args) + return _MEDRenumber.DataArrayInt64Tuple____iadd___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIsub(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____isub___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImul(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____imul___(self, self, *args) +def MEDCouplingDataArrayInt64TupleIdiv(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____idiv___(self, self, *args) +def MEDCouplingDataArrayInt64TupleImod(self,*args): + import _MEDRenumber + return _MEDRenumber.DataArrayInt64Tuple____imod___(self, self, *args) %} @@ -106,44 +139,79 @@ DataArrayDouble.__imul__=MEDCouplingDataArrayDoubleImul DataArrayDouble.__idiv__=MEDCouplingDataArrayDoubleIdiv DataArrayDouble.__ipow__=MEDCouplingDataArrayDoubleIpow -DataArrayInt.__reduce__=MEDCouplingDataArrayIntReduce -DataArrayInt.__iadd__=MEDCouplingDataArrayIntIadd -DataArrayInt.__isub__=MEDCouplingDataArrayIntIsub -DataArrayInt.__imul__=MEDCouplingDataArrayIntImul -DataArrayInt.__idiv__=MEDCouplingDataArrayIntIdiv -DataArrayInt.__imod__=MEDCouplingDataArrayIntImod -DataArrayInt.__ipow__=MEDCouplingDataArrayIntIpow +DataArrayInt32.__reduce__=MEDCouplingDataArrayInt32Reduce +DataArrayInt32.__iadd__=MEDCouplingDataArrayInt32Iadd +DataArrayInt32.__isub__=MEDCouplingDataArrayInt32Isub +DataArrayInt32.__imul__=MEDCouplingDataArrayInt32Imul +DataArrayInt32.__idiv__=MEDCouplingDataArrayInt32Idiv +DataArrayInt32.__imod__=MEDCouplingDataArrayInt32Imod +DataArrayInt32.__ipow__=MEDCouplingDataArrayInt32Ipow +DataArrayInt64.__reduce__=MEDCouplingDataArrayInt64Reduce +DataArrayInt64.__iadd__=MEDCouplingDataArrayInt64Iadd +DataArrayInt64.__isub__=MEDCouplingDataArrayInt64Isub +DataArrayInt64.__imul__=MEDCouplingDataArrayInt64Imul +DataArrayInt64.__idiv__=MEDCouplingDataArrayInt64Idiv +DataArrayInt64.__imod__=MEDCouplingDataArrayInt64Imod +DataArrayInt64.__ipow__=MEDCouplingDataArrayInt64Ipow DataArrayDoubleTuple.__iadd__=MEDCouplingDataArrayDoubleTupleIadd DataArrayDoubleTuple.__isub__=MEDCouplingDataArrayDoubleTupleIsub DataArrayDoubleTuple.__imul__=MEDCouplingDataArrayDoubleTupleImul DataArrayDoubleTuple.__idiv__=MEDCouplingDataArrayDoubleTupleIdiv -DataArrayIntTuple.__iadd__=MEDCouplingDataArrayIntTupleIadd -DataArrayIntTuple.__isub__=MEDCouplingDataArrayIntTupleIsub -DataArrayIntTuple.__imul__=MEDCouplingDataArrayIntTupleImul -DataArrayIntTuple.__idiv__=MEDCouplingDataArrayIntTupleIdiv -DataArrayIntTuple.__imod__=MEDCouplingDataArrayIntTupleImod +DataArrayInt32Tuple.__iadd__=MEDCouplingDataArrayInt32TupleIadd +DataArrayInt32Tuple.__isub__=MEDCouplingDataArrayInt32TupleIsub +DataArrayInt32Tuple.__imul__=MEDCouplingDataArrayInt32TupleImul +DataArrayInt32Tuple.__idiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__itruediv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__ifloordiv__=MEDCouplingDataArrayInt32TupleIdiv +DataArrayInt32Tuple.__imod__=MEDCouplingDataArrayInt32TupleImod + +DataArrayInt64Tuple.__iadd__=MEDCouplingDataArrayInt64TupleIadd +DataArrayInt64Tuple.__isub__=MEDCouplingDataArrayInt64TupleIsub +DataArrayInt64Tuple.__imul__=MEDCouplingDataArrayInt64TupleImul +DataArrayInt64Tuple.__idiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__itruediv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__ifloordiv__=MEDCouplingDataArrayInt64TupleIdiv +DataArrayInt64Tuple.__imod__=MEDCouplingDataArrayInt64TupleImod + + + del INTERPKERNELExceptionReduce -del MEDCouplingDataArrayDoubleReduce -del MEDCouplingDataArrayIntReduce del MEDCouplingDataArrayDoubleIadd -del MEDCouplingDataArrayDoubleIsub -del MEDCouplingDataArrayDoubleImul del MEDCouplingDataArrayDoubleIdiv -del MEDCouplingDataArrayIntIadd -del MEDCouplingDataArrayIntIsub -del MEDCouplingDataArrayIntImul -del MEDCouplingDataArrayIntIdiv -del MEDCouplingDataArrayIntImod +del MEDCouplingDataArrayDoubleImul +del MEDCouplingDataArrayDoubleIpow +del MEDCouplingDataArrayDoubleIsub +del MEDCouplingDataArrayDoubleReduce del MEDCouplingDataArrayDoubleTupleIadd -del MEDCouplingDataArrayDoubleTupleIsub -del MEDCouplingDataArrayDoubleTupleImul del MEDCouplingDataArrayDoubleTupleIdiv -del MEDCouplingDataArrayIntTupleIadd -del MEDCouplingDataArrayIntTupleIsub -del MEDCouplingDataArrayIntTupleImul -del MEDCouplingDataArrayIntTupleIdiv -del MEDCouplingDataArrayIntTupleImod +del MEDCouplingDataArrayDoubleTupleImul +del MEDCouplingDataArrayDoubleTupleIsub +del MEDCouplingDataArrayInt32Iadd +del MEDCouplingDataArrayInt32Idiv +del MEDCouplingDataArrayInt32Imod +del MEDCouplingDataArrayInt32Imul +del MEDCouplingDataArrayInt32Ipow +del MEDCouplingDataArrayInt32Isub +del MEDCouplingDataArrayInt32Reduce +del MEDCouplingDataArrayInt32TupleIadd +del MEDCouplingDataArrayInt32TupleIdiv +del MEDCouplingDataArrayInt32TupleImod +del MEDCouplingDataArrayInt32TupleImul +del MEDCouplingDataArrayInt32TupleIsub +del MEDCouplingDataArrayInt64Iadd +del MEDCouplingDataArrayInt64Idiv +del MEDCouplingDataArrayInt64Imod +del MEDCouplingDataArrayInt64Imul +del MEDCouplingDataArrayInt64Ipow +del MEDCouplingDataArrayInt64Isub +del MEDCouplingDataArrayInt64Reduce +del MEDCouplingDataArrayInt64TupleIadd +del MEDCouplingDataArrayInt64TupleIdiv +del MEDCouplingDataArrayInt64TupleImod +del MEDCouplingDataArrayInt64TupleImul +del MEDCouplingDataArrayInt64TupleIsub + %} diff --git a/src/RENUMBER_Swig/MEDRenumberImpl.i b/src/RENUMBER_Swig/MEDRenumberImpl.i index 21c5c8e9d..3b116cb84 100644 --- a/src/RENUMBER_Swig/MEDRenumberImpl.i +++ b/src/RENUMBER_Swig/MEDRenumberImpl.i @@ -32,17 +32,17 @@ class Renumbering public: %extend { - virtual PyObject *renumber(const MEDCoupling::DataArrayInt *graph, const MEDCoupling::DataArrayInt *index_graph) + virtual PyObject *renumber(const MEDCoupling::DataArrayIdType *graph, const MEDCoupling::DataArrayIdType *index_graph) { if(!graph || !index_graph) throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is NULL !"); if(!graph->isAllocated() || !index_graph->isAllocated()) throw INTERP_KERNEL::Exception("wrap of Renumbering::renumber : One of the input arrays is not allocated !"); - MEDCoupling::DataArrayInt *out0(0),*out1(0); + MEDCoupling::DataArrayIdType *out0(0),*out1(0); self->renumber(graph->begin(),index_graph->begin(),index_graph->getNumberOfTuples()-1,out0,out1); PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(out0),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(out1),SWIGTITraits::TI, SWIG_POINTER_OWN | 0 )); return ret; } } -- 2.39.2