From ad373daf5193daf8a8c990f5012158f38d8e74fa Mon Sep 17 00:00:00 2001 From: rnv Date: Wed, 29 Aug 2018 14:46:27 +0300 Subject: [PATCH] Windows porting --- doc/user/images/cartesian.py | 6 +- doc/user/images/convert2quadratic.py | 7 +- doc/user/images/curvelinear.py | 6 +- doc/user/images/explodeIntoEdges.py | 7 +- doc/user/images/extractSlice3D.py | 7 +- doc/user/images/extract_mesh_fetched_nodes.py | 5 +- doc/user/images/extract_mesh_ids.py | 6 +- doc/user/images/extrusion.py | 7 +- doc/user/images/intersect_2d1d.py | 6 +- doc/user/images/intersect_2d2d.py | 6 +- doc/user/images/measure_field.py | 7 +- doc/user/images/orderConsecutiveCells1D.py | 5 +- doc/user/images/orient_2d.py | 6 +- doc/user/images/ortho_field.py | 6 +- doc/user/images/partition.py | 6 +- doc/user/images/partition_with_layer.py | 6 +- doc/user/images/projection_P0P1_dual.py | 7 +- doc/user/images/projection_P0P1_meshes.py | 7 +- doc/user/images/projection_P1P0_dual.py | 7 +- doc/user/images/renumber_nodes.py | 6 +- doc/user/images/simplexize.py | 8 +- doc/user/images/skin.py | 6 +- doc/user/images/zones.py | 7 +- .../ExprEval/InterpKernelFunction.cxx | 1 + .../ExprEval/InterpKernelUnit.cxx | 1 + .../ExprEval/InterpKernelValue.cxx | 4 + .../Geometric2D/InterpKernelGeo2DEdge.cxx | 3 + .../InterpKernelGeo2DPrecision.hxx | 2 +- .../InterpKernelCellSimplify.cxx | 1 + src/INTERP_KERNEL/VectorUtils.hxx | 2 + src/MEDCoupling/MEDCoupling.hxx | 2 +- src/MEDCoupling/MEDCouplingAMRAttribute.cxx | 4 + src/MEDCoupling/MEDCouplingMemArray.cxx | 9 +- src/MEDCoupling/MEDCouplingMemArray.hxx | 194 +++++++++--------- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 1 + .../MEDCouplingUMesh_intersection.cxx | 4 +- .../Test/MEDCouplingBasicsTest1.cxx | 6 - src/MEDCoupling_Swig/CMakeLists.txt | 30 ++- .../MEDCouplingBasicsTest1.py | 7 +- .../MEDCouplingBasicsTest2.py | 7 +- .../MEDCouplingBasicsTest3.py | 6 +- .../MEDCouplingBasicsTest4.py | 7 +- .../MEDCouplingBasicsTest5.py | 8 +- .../MEDCouplingBasicsTest6.py | 7 +- src/MEDCoupling_Swig/MEDCouplingCommon.i | 1 + .../MEDCouplingDataForTest.py | 7 +- .../MEDCouplingExamplesTest.py | 7 +- .../MEDCouplingIntersectTest.py | 7 +- src/MEDCoupling_Swig/MEDCouplingNumPyTest.py | 7 +- src/MEDCoupling_Swig/MEDCouplingPickleTest.py | 7 +- .../UsersGuideExamplesTest.py | 7 +- .../UsersGuideExamplesTest_numpy.py | 12 +- src/MEDLoader/Swig/CMakeLists.txt | 10 +- src/MEDPartitioner_Swig/CMakeLists.txt | 7 +- src/ParaMEDMEM_Swig/CMakeLists.txt | 7 +- src/PyWrapping/CMakeLists.txt | 7 +- src/RENUMBER_Swig/CMakeLists.txt | 7 +- src/RENUMBER_Swig/MEDRenumberCommon.i | 7 +- src/RENUMBER_Swig/MEDRenumberTest.py | 7 +- src/RENUMBER_Swig/UsersGuideExamplesTest.py | 14 +- 60 files changed, 392 insertions(+), 182 deletions(-) diff --git a/doc/user/images/cartesian.py b/doc/user/images/cartesian.py index 7ac1c79d0..2829dfb63 100644 --- a/doc/user/images/cartesian.py +++ b/doc/user/images/cartesian.py @@ -64,8 +64,12 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh XCoords=[-0.3,0.,0.1,0.3,0.45,0.47,0.49,1.,1.22] # 9 values along X diff --git a/doc/user/images/convert2quadratic.py b/doc/user/images/convert2quadratic.py index d4cb1d08f..7bb05d062 100644 --- a/doc/user/images/convert2quadratic.py +++ b/doc/user/images/convert2quadratic.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh arr=DataArrayDouble(range(2)) diff --git a/doc/user/images/curvelinear.py b/doc/user/images/curvelinear.py index 268a8e844..056cd16b5 100644 --- a/doc/user/images/curvelinear.py +++ b/doc/user/images/curvelinear.py @@ -64,8 +64,12 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh m=MEDCouplingCurveLinearMesh("myCurveLinearMesh") diff --git a/doc/user/images/explodeIntoEdges.py b/doc/user/images/explodeIntoEdges.py index 0c626eab6..b07e658ed 100644 --- a/doc/user/images/explodeIntoEdges.py +++ b/doc/user/images/explodeIntoEdges.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(5)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extractSlice3D.py b/doc/user/images/extractSlice3D.py index 5d34cab18..5b5e1c782 100644 --- a/doc/user/images/extractSlice3D.py +++ b/doc/user/images/extractSlice3D.py @@ -26,7 +26,12 @@ ipar.append("ParaView_1", "empty") # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "ParaViS") -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from MEDLoader import WriteMesh, WriteFieldUsingAlreadyWrittenMesh medfile1="mesh1.med" diff --git a/doc/user/images/extract_mesh_fetched_nodes.py b/doc/user/images/extract_mesh_fetched_nodes.py index 2a49a353f..5d94de3db 100644 --- a/doc/user/images/extract_mesh_fetched_nodes.py +++ b/doc/user/images/extract_mesh_fetched_nodes.py @@ -65,7 +65,10 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extract_mesh_ids.py b/doc/user/images/extract_mesh_ids.py index c619c055b..09cca9c67 100644 --- a/doc/user/images/extract_mesh_ids.py +++ b/doc/user/images/extract_mesh_ids.py @@ -64,8 +64,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/extrusion.py b/doc/user/images/extrusion.py index 73f3334c4..324ed6cb3 100644 --- a/doc/user/images/extrusion.py +++ b/doc/user/images/extrusion.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/intersect_2d1d.py b/doc/user/images/intersect_2d1d.py index 62590010d..49b3d13e7 100644 --- a/doc/user/images/intersect_2d1d.py +++ b/doc/user/images/intersect_2d1d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh2d=MEDCouplingCMesh("mesh2d") diff --git a/doc/user/images/intersect_2d2d.py b/doc/user/images/intersect_2d2d.py index 37219194c..048ba4133 100644 --- a/doc/user/images/intersect_2d2d.py +++ b/doc/user/images/intersect_2d2d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(6)) mesh2d=MEDCouplingCMesh("mesh2") diff --git a/doc/user/images/measure_field.py b/doc/user/images/measure_field.py index 24cbd6497..d686fbad0 100644 --- a/doc/user/images/measure_field.py +++ b/doc/user/images/measure_field.py @@ -10,7 +10,12 @@ import salome salome.salome_init() theStudy = salome.myStudy -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from MEDLoader import WriteMesh, WriteFieldUsingAlreadyWrittenMesh medfile="mesh1.med" diff --git a/doc/user/images/orderConsecutiveCells1D.py b/doc/user/images/orderConsecutiveCells1D.py index 4d26fca62..e2ca078ad 100644 --- a/doc/user/images/orderConsecutiveCells1D.py +++ b/doc/user/images/orderConsecutiveCells1D.py @@ -65,8 +65,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * -from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(6)) diff --git a/doc/user/images/orient_2d.py b/doc/user/images/orient_2d.py index d6b8409a8..f5cf417fd 100644 --- a/doc/user/images/orient_2d.py +++ b/doc/user/images/orient_2d.py @@ -65,8 +65,10 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(6)) diff --git a/doc/user/images/ortho_field.py b/doc/user/images/ortho_field.py index 7d27868d9..f49bc4f78 100644 --- a/doc/user/images/ortho_field.py +++ b/doc/user/images/ortho_field.py @@ -4,7 +4,11 @@ ### This script is intended to be launched in a new SALOME study ### -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/partition.py b/doc/user/images/partition.py index a669b8221..ba2cd5b99 100644 --- a/doc/user/images/partition.py +++ b/doc/user/images/partition.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import ReadMeshFromFile, WriteMesh coordsArr=DataArrayDouble(range(8)) diff --git a/doc/user/images/partition_with_layer.py b/doc/user/images/partition_with_layer.py index e7d64c722..abd4d78bd 100644 --- a/doc/user/images/partition_with_layer.py +++ b/doc/user/images/partition_with_layer.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import ReadMeshFromFile, WriteMesh coordsArr=DataArrayDouble(range(8)) diff --git a/doc/user/images/projection_P0P1_dual.py b/doc/user/images/projection_P0P1_dual.py index 59500cc75..2c4c0cf2a 100644 --- a/doc/user/images/projection_P0P1_dual.py +++ b/doc/user/images/projection_P0P1_dual.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/projection_P0P1_meshes.py b/doc/user/images/projection_P0P1_meshes.py index a26adfb7a..92ec7ae3f 100644 --- a/doc/user/images/projection_P0P1_meshes.py +++ b/doc/user/images/projection_P0P1_meshes.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/projection_P1P0_dual.py b/doc/user/images/projection_P1P0_dual.py index 4d925b927..f9b3f9aaa 100644 --- a/doc/user/images/projection_P1P0_dual.py +++ b/doc/user/images/projection_P1P0_dual.py @@ -64,8 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * srcCoo=DataArrayDouble([(0,0),(1,0),(3,0),(0,1),(1,1),(3,1)]) src=MEDCouplingUMesh("src",2) diff --git a/doc/user/images/renumber_nodes.py b/doc/user/images/renumber_nodes.py index 0e15ab61e..ac1603103 100644 --- a/doc/user/images/renumber_nodes.py +++ b/doc/user/images/renumber_nodes.py @@ -68,9 +68,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * - -from MEDCoupling import * from MEDLoader import WriteMesh coordsArr=DataArrayDouble(range(2)) diff --git a/doc/user/images/simplexize.py b/doc/user/images/simplexize.py index 73a350bde..c5edfd6a2 100644 --- a/doc/user/images/simplexize.py +++ b/doc/user/images/simplexize.py @@ -64,9 +64,11 @@ ipar.append("VTKViewer_1", """ # fill list AP_MODULES_LIST ipar.append("AP_MODULES_LIST", "Mesh") - - -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(3)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/skin.py b/doc/user/images/skin.py index be8381374..4a212e8b4 100644 --- a/doc/user/images/skin.py +++ b/doc/user/images/skin.py @@ -65,7 +65,11 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * coordsArr=DataArrayDouble(range(5)) mesh1=MEDCouplingCMesh("mesh") diff --git a/doc/user/images/zones.py b/doc/user/images/zones.py index 73afd5a17..f5e0b6bcd 100644 --- a/doc/user/images/zones.py +++ b/doc/user/images/zones.py @@ -65,7 +65,12 @@ ipar.append("VTKViewer_1", """ ipar.append("AP_MODULES_LIST", "Mesh") -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDLoader import WriteMesh coords=DataArrayDouble(range(6)) diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx index c3ddbac46..bed1610b7 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelFunction.cxx @@ -21,6 +21,7 @@ #include "InterpKernelFunction.hxx" #include "InterpKernelValue.hxx" +#include #include #include diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx index aeee8ba16..3c8215e94 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelUnit.cxx @@ -21,6 +21,7 @@ #include "InterpKernelUnit.hxx" #include "InterpKernelExprParser.hxx" +#include #include #include #include diff --git a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx index 833607843..223e34063 100644 --- a/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx +++ b/src/INTERP_KERNEL/ExprEval/InterpKernelValue.cxx @@ -25,6 +25,10 @@ #include #include +#ifdef WIN32 +#include +#endif + using namespace INTERP_KERNEL; ValueDouble::ValueDouble():_data(std::numeric_limits::max()) diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx index 27a9acb99..db8f43d67 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx @@ -28,6 +28,9 @@ #include +#include + + using namespace INTERP_KERNEL; MergePoints::MergePoints():_ass1Start1(0),_ass1End1(0),_ass1Start2(0),_ass1End2(0), diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx index 00149c564..e66a0a378 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DPrecision.hxx @@ -36,7 +36,7 @@ namespace INTERP_KERNEL * When the instance is destroyed, the previous precision is set back. * */ - class QuadraticPlanarPrecision + class INTERPKERNEL_EXPORT QuadraticPlanarPrecision { public: QuadraticPlanarPrecision(double prec); diff --git a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx index 40fad8559..ebc88f280 100644 --- a/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx +++ b/src/INTERP_KERNEL/InterpKernelCellSimplify.cxx @@ -21,6 +21,7 @@ #include "InterpKernelCellSimplify.hxx" #include "CellModel.hxx" +#include #include #include #include diff --git a/src/INTERP_KERNEL/VectorUtils.hxx b/src/INTERP_KERNEL/VectorUtils.hxx index 7ac0582bd..00b2bf042 100644 --- a/src/INTERP_KERNEL/VectorUtils.hxx +++ b/src/INTERP_KERNEL/VectorUtils.hxx @@ -20,12 +20,14 @@ #ifndef __VECTORUTILS_HXX__ #define __VECTORUTILS_HXX__ +#include #include #include #include #include #include + namespace INTERP_KERNEL { /// Precision used for tests of 3D part of INTERP_KERNEL diff --git a/src/MEDCoupling/MEDCoupling.hxx b/src/MEDCoupling/MEDCoupling.hxx index 89add71b6..391b9d378 100644 --- a/src/MEDCoupling/MEDCoupling.hxx +++ b/src/MEDCoupling/MEDCoupling.hxx @@ -22,7 +22,7 @@ #define _MEDCOUPLING_HXX_ #ifdef WIN32 -# if defined medcoupling_EXPORTS +# if defined(medcoupling_EXPORTS) || defined(medcouplingcpp_EXPORTS) || defined(MEDCOUPLING_WIN32_SWIG) # define MEDCOUPLING_EXPORT __declspec( dllexport ) # else # define MEDCOUPLING_EXPORT __declspec( dllimport ) diff --git a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx index 7302fa45f..f1e508106 100644 --- a/src/MEDCoupling/MEDCouplingAMRAttribute.cxx +++ b/src/MEDCoupling/MEDCouplingAMRAttribute.cxx @@ -26,6 +26,10 @@ #include #include +#ifdef WIN32 +#include +#endif + using namespace MEDCoupling; /// @cond INTERNAL diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index f7bcef009..4346c26be 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -53,12 +53,9 @@ template class MEDCoupling::DataArrayIterator; template class MEDCoupling::DataArrayIterator; template class MEDCoupling::DataArrayDiscrete; template class MEDCoupling::DataArrayDiscreteSigned; - -// [ABN] : Newest Intel compilers need this: -template Traits::ArrayType* MEDCoupling::DataArrayTuple::buildDA(int, int) const; -template Traits::ArrayType* MEDCoupling::DataArrayTuple::buildDA(int, int) const; -template Traits::ArrayType* MEDCoupling::DataArrayTuple::buildDA(int, int) const; - +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 diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 0fdbdcf1c..af887b919 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -51,14 +51,14 @@ namespace MEDCoupling class MEDCouplingPointer { public: - MEDCouplingPointer():_internal(0),_external(0) { } - void null() { _internal=0; _external=0; } - bool isNull() const { return _internal==0 && _external==0; } - void setInternal(T *pointer); - void setExternal(const T *pointer); - const T *getConstPointer() const { if(_internal) return _internal; else return _external; } - const T *getConstPointerLoc(std::size_t offset) const { if(_internal) return _internal+offset; else return _external+offset; } - T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; } + MEDCOUPLING_EXPORT MEDCouplingPointer():_internal(0),_external(0) { } + MEDCOUPLING_EXPORT void null() { _internal=0; _external=0; } + MEDCOUPLING_EXPORT bool isNull() const { return _internal==0 && _external==0; } + MEDCOUPLING_EXPORT void setInternal(T *pointer); + MEDCOUPLING_EXPORT void setExternal(const T *pointer); + MEDCOUPLING_EXPORT const T *getConstPointer() const { if(_internal) return _internal; else return _external; } + MEDCOUPLING_EXPORT const T *getConstPointerLoc(std::size_t offset) const { if(_internal) return _internal+offset; else return _external+offset; } + MEDCOUPLING_EXPORT T *getPointer() { if(_internal) return _internal; if(_external) throw INTERP_KERNEL::Exception("Trying to write on an external pointer."); else return 0; } private: T *_internal; const T *_external; @@ -70,45 +70,45 @@ namespace MEDCoupling public: typedef void (*Deallocator)(void *,void *); public: - MemArray():_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0) { } - MemArray(const MemArray& other); - bool isNull() const { return _pointer.isNull(); } - const T *getConstPointerLoc(std::size_t offset) const { return _pointer.getConstPointerLoc(offset); } - const T *getConstPointer() const { return _pointer.getConstPointer(); } - std::size_t getNbOfElem() const { return _nb_of_elem; } - std::size_t getNbOfElemAllocated() const { return _nb_of_elem_alloc; } - T *getPointer() { return _pointer.getPointer(); } - MemArray &operator=(const MemArray& other); - T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; } - T& operator[](std::size_t id) { return _pointer.getPointer()[id]; } - bool isEqual(const MemArray& other, T prec, std::string& reason) const; - void repr(int sl, std::ostream& stream) const; - bool reprHeader(int sl, std::ostream& stream) const; - void reprZip(int sl, std::ostream& stream) const; - void reprNotTooLong(int sl, std::ostream& stream) const; - void fillWithValue(const T& val); - T *fromNoInterlace(int nbOfComp) const; - T *toNoInterlace(int nbOfComp) const; - void sort(bool asc); - void reverse(int nbOfComp); - void alloc(std::size_t nbOfElements); - void reserve(std::size_t newNbOfElements); - void reAlloc(std::size_t newNbOfElements); - void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfElem); - void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfElem); - void writeOnPlace(std::size_t id, T element0, const T *others, std::size_t sizeOfOthers); + MEDCOUPLING_EXPORT MemArray():_nb_of_elem(0),_nb_of_elem_alloc(0),_ownership(false),_dealloc(0),_param_for_deallocator(0) { } + MEDCOUPLING_EXPORT MemArray(const MemArray& other); + MEDCOUPLING_EXPORT bool isNull() const { return _pointer.isNull(); } + MEDCOUPLING_EXPORT const T *getConstPointerLoc(std::size_t offset) const { return _pointer.getConstPointerLoc(offset); } + MEDCOUPLING_EXPORT const T *getConstPointer() const { return _pointer.getConstPointer(); } + MEDCOUPLING_EXPORT std::size_t getNbOfElem() const { return _nb_of_elem; } + MEDCOUPLING_EXPORT std::size_t getNbOfElemAllocated() const { return _nb_of_elem_alloc; } + MEDCOUPLING_EXPORT T *getPointer() { return _pointer.getPointer(); } + MEDCOUPLING_EXPORT MemArray &operator=(const MemArray& other); + 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 fillWithValue(const T& val); + MEDCOUPLING_EXPORT T *fromNoInterlace(int nbOfComp) const; + MEDCOUPLING_EXPORT T *toNoInterlace(int nbOfComp) const; + MEDCOUPLING_EXPORT void sort(bool asc); + MEDCOUPLING_EXPORT void reverse(int 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); + MEDCOUPLING_EXPORT void useArray(const T *array, bool ownership, DeallocType type, std::size_t nbOfElem); + MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const T *array, std::size_t nbOfElem); + MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, std::size_t sizeOfOthers); template void insertAtTheEnd(InputIterator first, InputIterator last); - void pushBack(T elem); - T popBack(); - void pack() const; - bool isDeallocatorCalled() const { return _ownership; } - Deallocator getDeallocator() const { return _dealloc; } - void setSpecificDeallocator(Deallocator dealloc) { _dealloc=dealloc; } - void setParameterForDeallocator(void *param) { _param_for_deallocator=param; } - void *getParameterForDeallocator() const { return _param_for_deallocator; } - void destroy(); - ~MemArray() { destroy(); } + MEDCOUPLING_EXPORT void pushBack(T elem); + MEDCOUPLING_EXPORT T popBack(); + MEDCOUPLING_EXPORT void pack() const; + MEDCOUPLING_EXPORT bool isDeallocatorCalled() const { return _ownership; } + MEDCOUPLING_EXPORT Deallocator getDeallocator() const { return _dealloc; } + MEDCOUPLING_EXPORT void setSpecificDeallocator(Deallocator dealloc) { _dealloc=dealloc; } + MEDCOUPLING_EXPORT void setParameterForDeallocator(void *param) { _param_for_deallocator=param; } + MEDCOUPLING_EXPORT void *getParameterForDeallocator() const { return _param_for_deallocator; } + MEDCOUPLING_EXPORT void destroy(); + MEDCOUPLING_EXPORT ~MemArray() { destroy(); } public: static void CPPDeallocator(void *pt, void *param); static void CDeallocator(void *pt, void *param); @@ -229,68 +229,68 @@ namespace MEDCoupling // 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(); } - bool empty() const; + MEDCOUPLING_EXPORT bool empty() const; MEDCOUPLING_EXPORT void *getVoidStarPointer() { return getPointer(); } MEDCOUPLING_EXPORT const T *getConstPointer() const { return _mem.getConstPointer(); } MEDCOUPLING_EXPORT const T *begin() const { return getConstPointer(); } MEDCOUPLING_EXPORT const T *end() const { return getConstPointer()+getNbOfElems(); } MEDCOUPLING_EXPORT T *rwBegin() { return getPointer(); } MEDCOUPLING_EXPORT T *rwEnd() { return getPointer()+getNbOfElems(); } - void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1); - void useArray(const T *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo); - void useExternalArrayWithRWAccess(const T *array, int nbOfTuple, int nbOfCompo); - T getIJSafe(int tupleId, int compoId) const; + 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 T *getPointer() { return _mem.getPointer(); declareAsNew(); } - void pack() const; - bool isAllocated() const; - void checkAllocated() const; - void desallocate(); - void reserve(std::size_t nbOfElems); - void rearrange(int newNbOfCompo); - void transpose(); - void pushBackSilent(T val); - void pushBackValsSilent(const T *valsBg, const T *valsEnd); - T popBackSilent(); - T front() const; - T back() const; - std::size_t getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); } - void allocIfNecessary(int nbOfTuple, int nbOfCompo); - void deepCopyFrom(const DataArrayTemplate& other); - void reverse(); - void fillWithValue(T val); - void reAlloc(std::size_t newNbOfTuple); - void renumberInPlace(const int *old2New); - void renumberInPlaceR(const int *new2Old); - void sort(bool asc=true); - typename Traits::ArrayType *renumber(const int *old2New) const; - typename Traits::ArrayType *renumberR(const int *new2Old) const; - typename Traits::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const; - typename Traits::ArrayType *changeNbOfComponents(int newNbOfComp, T dftValue) const; - typename Traits::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const; - MCAuto::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const; - void circularPermutation(int nbOfShift=1); - void circularPermutationPerTuple(int nbOfShift=1); - void reversePerTuple(); - void setPartOfValues1(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - void setPartOfValues2(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp); - void setPartOfValues3(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp); - void setPartOfValues4(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); - void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayInt32 *tuplesSelec); - void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec); - void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); - T getMaxValue(int& tupleId) const; - T getMaxValueInArray() const; - T getMaxAbsValue(std::size_t& tupleId) const; - T getMaxAbsValueInArray() const; - T getMinValue(int& tupleId) const; - T getMinValueInArray() const; + MEDCOUPLING_EXPORT void pack() const; + MEDCOUPLING_EXPORT bool isAllocated() const; + 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 transpose(); + MEDCOUPLING_EXPORT void pushBackSilent(T val); + MEDCOUPLING_EXPORT void pushBackValsSilent(const T *valsBg, const T *valsEnd); + MEDCOUPLING_EXPORT T popBackSilent(); + 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 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 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 MCAuto::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const; + MEDCOUPLING_EXPORT void circularPermutation(int nbOfShift=1); + MEDCOUPLING_EXPORT void circularPermutationPerTuple(int 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 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 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); } template void insertAtTheEnd(InputIterator first, InputIterator last); diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index 9652e8ddd..3f1ba3f42 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -20,6 +20,7 @@ #include "MEDCouplingPartDefinition.hxx" +#include #include using namespace MEDCoupling; diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index ba461e5a4..51b716ba0 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -2016,7 +2016,7 @@ DataArrayInt *MEDCouplingUMesh::conformize2D(double eps) */ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) { - internalColinearize2D(eps, false); + return internalColinearize2D(eps, false); } /*! @@ -2028,7 +2028,7 @@ DataArrayInt *MEDCouplingUMesh::colinearize2D(double eps) */ DataArrayInt *MEDCouplingUMesh::colinearizeKeepingConform2D(double eps) { - internalColinearize2D(eps, true); + return internalColinearize2D(eps, true); } diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 94db55df8..d3ac9fa3d 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -23,17 +23,11 @@ #include "MEDCouplingCMesh.hxx" #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingFieldDouble.hxx" -#include "MEDCouplingMemArray.hxx" - #include #include #include #include -#ifdef WIN32 -#include "MEDCouplingMemArray.txx" -#endif - using namespace MEDCoupling; void MEDCouplingBasicsTest1::testArray() diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 26033c3b0..8707de7a7 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -87,9 +87,21 @@ IF(MEDCOUPLING_BUILD_DOC) swig_ready) ENDIF() -SWIG_ADD_MODULE(MEDCoupling python MEDCoupling.i) -SWIG_LINK_LIBRARIES(MEDCoupling ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp) -SWIG_CHECK_GENERATION(MEDCoupling) +IF(WIN32) + # Under Windows MEDCoupling conflicts wiht medcoupling from PyWrapping + SET(MEDCouling_target_name MEDCouplingCompat) +ELSE() + SET(MEDCouling_target_name MEDCoupling) +ENDIF() + +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(${MEDCouling_target_name} python MEDCoupling.i) +ELSE() + SWIG_ADD_LIBRARY(${MEDCouling_target_name} LANGUAGE python SOURCES MEDCoupling.i) +ENDIF() + +SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp) +SWIG_CHECK_GENERATION(${MEDCouling_target_name}) SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON) IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3") SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3") @@ -103,14 +115,20 @@ SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES} ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX} ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX}) -SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i) + +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i) +ELSE() + SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i) +ENDIF() + SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper) IF(WIN32) SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d) - SET_TARGET_PROPERTIES(_MEDCoupling PROPERTIES DEBUG_OUTPUT_NAME _MEDCoupling_d) + SET_TARGET_PROPERTIES(_${MEDCouling_target_name} PROPERTIES DEBUG_OUTPUT_NAME _${MEDCouling_target_name}_d) ENDIF(WIN32) -INSTALL(TARGETS ${SWIG_MODULE_MEDCoupling_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) +INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCoupling.py ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py) SALOME_INSTALL_SCRIPTS("${PYFILES_TO_INSTALL}" ${MEDCOUPLING_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_MEDCoupling_REAL_NAME};${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME}") diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py index 4d3692134..f9e80cf4f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index 9589dc0de..bb74613ad 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py index a5d5e16fc..034c288a6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest3.py @@ -18,7 +18,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index 00090fb60..d72103bf5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index b5b326bc4..28cfa11de 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -17,7 +17,13 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py index 76fbfb667..c5f7d5b3e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index e8d5a9db8..df59e032c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -31,6 +31,7 @@ #include "MEDCouplingMappedExtrudedMesh.hxx" #include "MEDCouplingCMesh.hxx" #include "MEDCouplingIMesh.hxx" +#include "MEDCouplingMap.txx" #include "MEDCouplingCurveLinearMesh.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingField.hxx" diff --git a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py index 99f975407..f6861f0d6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataForTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingDataForTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * class MEDCouplingDataForTest: def build2DTargetMesh_1(cls): diff --git a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py index fb60d96a8..13cbd3342 100644 --- a/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingExamplesTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * import unittest from math import pi, sqrt diff --git a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py index 17acd21f9..28e92fbc4 100644 --- a/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingIntersectTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +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 diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py index 90c6f5eb8..0cfc225e3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * if MEDCouplingHasNumPyBindings(): from numpy import * diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index a73bb88ab..a8f7b3cbb 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from MEDCouplingDataForTest import MEDCouplingDataForTest if MEDCouplingHasNumPyBindings(): diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py index cad12285f..314f5c70b 100755 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest.py @@ -18,7 +18,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * + +import sys +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * from math import pi, sqrt # ! [PySnippetUMeshStdBuild1_1] diff --git a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py index ad566904a..bf8506fb6 100644 --- a/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py +++ b/src/MEDCoupling_Swig/UsersGuideExamplesTest_numpy.py @@ -17,12 +17,20 @@ # # 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 * -from MEDCoupling import * from math import pi, sqrt import numpy -import MEDCoupling +if sys.platform == "win32": + import MEDCouplingCompat as MEDCoupling +else: + import MEDCoupling + #! [UG_DataArrayNumpy_0] # NumPy is an optional pre-requisite! assert(MEDCoupling.MEDCouplingHasNumPyBindings()) diff --git a/src/MEDLoader/Swig/CMakeLists.txt b/src/MEDLoader/Swig/CMakeLists.txt index 54b018f35..b8469f518 100644 --- a/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/MEDLoader/Swig/CMakeLists.txt @@ -68,11 +68,19 @@ IF(MEDCOUPLING_BUILD_DOC) swig_ready) ENDIF() -SWIG_ADD_MODULE(MEDLoader python MEDLoader.i) + +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(MEDLoader python MEDLoader.i) +ELSE() + SWIG_ADD_LIBRARY(MEDLoader LANGUAGE python SOURCES MEDLoader.i) +ENDIF() + SWIG_LINK_LIBRARIES(MEDLoader ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medloader medcouplingcpp ) SWIG_CHECK_GENERATION(MEDLoader) IF(WIN32) SET_TARGET_PROPERTIES(_MEDLoader PROPERTIES DEBUG_OUTPUT_NAME _MEDLoader_d) + # To increase the size of the .obj file on Windows because MEDLoaderPYTHON_wrap.cxx, generated by SWIG, is too big + TARGET_COMPILE_OPTIONS(_MEDLoader PRIVATE /bigobj) ENDIF(WIN32) INSTALL(TARGETS _MEDLoader DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) diff --git a/src/MEDPartitioner_Swig/CMakeLists.txt b/src/MEDPartitioner_Swig/CMakeLists.txt index 9fa9b025b..3a8e3986c 100644 --- a/src/MEDPartitioner_Swig/CMakeLists.txt +++ b/src/MEDPartitioner_Swig/CMakeLists.txt @@ -52,7 +52,12 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints ) -SWIG_ADD_MODULE(MEDPartitioner python MEDPartitioner.i) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(MEDPartitioner python MEDPartitioner.i) +ELSE() + SWIG_ADD_LIBRARY(MEDPartitioner LANGUAGE python SOURCES MEDPartitioner.i) +ENDIF() + SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medpartitionercpp) SWIG_CHECK_GENERATION(MEDPartitioner) diff --git a/src/ParaMEDMEM_Swig/CMakeLists.txt b/src/ParaMEDMEM_Swig/CMakeLists.txt index 24730403b..d23f6b284 100644 --- a/src/ParaMEDMEM_Swig/CMakeLists.txt +++ b/src/ParaMEDMEM_Swig/CMakeLists.txt @@ -49,7 +49,12 @@ SET (SWIG_MODULE_ParaMEDMEM_EXTRA_DEPS ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX} ${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX}) -SWIG_ADD_MODULE(ParaMEDMEM python ParaMEDMEM.i) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(ParaMEDMEM python ParaMEDMEM.i) +ELSE() + SWIG_ADD_LIBRARY(ParaMEDMEM LANGUAGE python SOURCES ParaMEDMEM.i) +ENDIF() + SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem) SWIG_CHECK_GENERATION(ParaMEDMEM) diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index 16271266b..1d05b34d0 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -82,7 +82,12 @@ IF(MEDCOUPLING_USE_MPI) LIST(APPEND medcoupling_LIB_dependancies paramedmem) ENDIF(MEDCOUPLING_USE_MPI) -SWIG_ADD_MODULE(medcoupling python medcoupling.i) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(medcoupling python medcoupling.i) +ELSE() + SWIG_ADD_LIBRARY(medcoupling LANGUAGE python SOURCES medcoupling.i) +ENDIF() + SWIG_LINK_LIBRARIES(medcoupling ${medcoupling_LIB_dependancies}) SWIG_CHECK_GENERATION(medcoupling) IF(WIN32) diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index f4df9d5af..fac3ae3a0 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -49,7 +49,12 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints ) -SWIG_ADD_MODULE(MEDRenumber python MEDRenumber.i) +IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(MEDRenumber python MEDRenumber.i) +ELSE() + SWIG_ADD_LIBRARY(MEDRenumber LANGUAGE python SOURCES MEDRenumber.i) +ENDIF() + SWIG_LINK_LIBRARIES(MEDRenumber ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} renumbercpp) SWIG_CHECK_GENERATION(MEDRenumber) diff --git a/src/RENUMBER_Swig/MEDRenumberCommon.i b/src/RENUMBER_Swig/MEDRenumberCommon.i index 3c1cec8a8..a88e4fb6f 100644 --- a/src/RENUMBER_Swig/MEDRenumberCommon.i +++ b/src/RENUMBER_Swig/MEDRenumberCommon.i @@ -22,6 +22,9 @@ %include std_string.i %{ +#ifdef WIN32 +#define MEDCOUPLING_WIN32_SWIG +#endif #include "MEDCouplingMemArray.txx" #include "MCAuto.hxx" #include "MEDCouplingDataArrayTypemaps.i" @@ -38,7 +41,7 @@ using namespace INTERP_KERNEL; %init %{ import_array(); %} #endif -%init %{ initializeMe(); %} +%init %{ initializeMe_renumber(); %} %feature("autodoc", "1"); %feature("docstring"); @@ -51,7 +54,7 @@ using namespace INTERP_KERNEL; %include "MEDCouplingMemArray.i" %{ - void initializeMe() + void initializeMe_renumber() {// 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; diff --git a/src/RENUMBER_Swig/MEDRenumberTest.py b/src/RENUMBER_Swig/MEDRenumberTest.py index 8a826141a..f4bb20003 100644 --- a/src/RENUMBER_Swig/MEDRenumberTest.py +++ b/src/RENUMBER_Swig/MEDRenumberTest.py @@ -19,12 +19,17 @@ from MEDRenumber import * import unittest +import sys class MEDRenumberTest(unittest.TestCase): @unittest.skipUnless("BOOST" in RenumberAvailableMethods(),"requires BOOST prerequisite !") def test1(self): - from MEDCoupling import MEDCouplingCMesh + if sys.platform == "win32": + from MEDCouplingCompat import MEDCouplingCMesh + else: + from MEDCoupling import MEDCouplingCMesh + ren=RenumberingFactory("BOOST") arr=DataArrayDouble(10) ; arr.iota() c=MEDCouplingCMesh() ; c.setCoords(arr,arr) diff --git a/src/RENUMBER_Swig/UsersGuideExamplesTest.py b/src/RENUMBER_Swig/UsersGuideExamplesTest.py index d61b6746f..6713ba7ca 100644 --- a/src/RENUMBER_Swig/UsersGuideExamplesTest.py +++ b/src/RENUMBER_Swig/UsersGuideExamplesTest.py @@ -18,10 +18,19 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from MEDCoupling import * +import sys + +if sys.platform == "win32": + from MEDCouplingCompat import * +else: + from MEDCoupling import * + from math import pi, sqrt -import MEDCoupling +if sys.platform == "win32": + import MEDCouplingCompat as MEDCoupling +else: + import MEDCoupling from MEDCouplingDataForTest import MEDCouplingDataForTest m=MEDCouplingDataForTest.build2DTargetMesh_1(); @@ -34,7 +43,6 @@ mrenum=m[n2o] #! [UG_Optimization_0] #! [UG_Optimization_1] -from MEDCoupling import MEDCouplingSkyLineArray import MEDPartitioner # prepare a MEDPartitioner a,b=m.computeNeighborsOfCells() -- 2.30.2