]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Some factorization before integration of ParaMEDMEM into medcoupling python module
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 28 Dec 2017 12:40:54 +0000 (13:40 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 28 Dec 2017 12:40:54 +0000 (13:40 +0100)
src/ParaMEDMEM_Swig/CMakeLists.txt
src/ParaMEDMEM_Swig/ParaMEDMEM.i
src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i [new file with mode: 0644]

index 93403995c9b2eca31ce4bd61ef80ae41c400ee66..6e66dca05d5fa8a975ff27715f26de400f0daeda 100644 (file)
@@ -54,7 +54,7 @@ SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem)
 SWIG_CHECK_GENERATION(ParaMEDMEM)
 
 INSTALL(TARGETS _ParaMEDMEM DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
-INSTALL(FILES ParaMEDMEM.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
+INSTALL(FILES ParaMEDMEM.i ParaMEDMEMCommon.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS})
 INSTALL(FILES test_InterpKernelDEC.py test_NonCoincidentDEC.py test_StructuredCoincidentDEC.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON})
 SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/ParaMEDMEM.py ${MEDCOUPLING_INSTALL_PYTHON})
 
index ab4fe45c8d87534f5c47dec1dddeb61714e961c3..3f8ba08bbffb3c4b25e18e817bdbfbb0debbdaff 100644 (file)
@@ -17,6 +17,8 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
+// Author : Anthony Geay (EDF R&D)
+
 %module ParaMEDMEM
 
 #define MEDCOUPLING_EXPORT
 
 %include "MEDCouplingCommon.i"
 
-%include std_set.i
-%include std_string.i
-
-%template() std::set<int>;
-
-%{
-#include "CommInterface.hxx"
-#include "ProcessorGroup.hxx"
-#include "Topology.hxx"
-#include "MPIProcessorGroup.hxx"
-#include "DEC.hxx"
-#include "InterpKernelDEC.hxx"
-#include "NonCoincidentDEC.hxx"
-#include "StructuredCoincidentDEC.hxx"
-#include "ParaMESH.hxx"
-#include "ParaFIELD.hxx"
-#include "ICoCoMEDField.hxx"
-#include "ComponentTopology.hxx"
-
-using namespace INTERP_KERNEL;
-using namespace MEDCoupling;
-using namespace ICoCo;
-%}
-
-%include "InterpolationOptions.hxx"
-%include "CommInterface.hxx"
-%include "ProcessorGroup.hxx"
-%include "DECOptions.hxx"
-%include "ParaMESH.hxx"
-%include "ParaFIELD.hxx"
-%include "MPIProcessorGroup.hxx"
-%include "ComponentTopology.hxx"
-%include "DEC.hxx"
-%include "DisjointDEC.hxx"
-%include "InterpKernelDEC.hxx"
-%include "StructuredCoincidentDEC.hxx"
-
-%include "ICoCoField.hxx"
-%rename(ICoCoMEDField) ICoCo::MEDField;
-%include "ICoCoMEDField.hxx"
-
-%nodefaultctor;
-
-/* This object can be used only if MED_ENABLE_FVM is defined*/
-#ifdef MED_ENABLE_FVM
-class NonCoincidentDEC : public DEC
-{
-public:
-  NonCoincidentDEC(ProcessorGroup& source, ProcessorGroup& target);
-};
-#endif
-
-%extend MEDCoupling::ParaMESH
-{
-  PyObject *getGlobalNumberingCell2() const
-  {
-    const int *tmp=self->getGlobalNumberingCell();
-    int size=self->getCellMesh()->getNumberOfCells();
-    PyObject *ret=PyList_New(size);
-    for(int i=0;i<size;i++)
-      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
-    return ret;
-  }
-
-  PyObject *getGlobalNumberingFace2() const
-  {
-    const int *tmp=self->getGlobalNumberingFace();
-    int size=self->getFaceMesh()->getNumberOfCells();
-    PyObject *ret=PyList_New(size);
-    for(int i=0;i<size;i++)
-      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
-    return ret;
-  }
-
-  PyObject *getGlobalNumberingNode2() const
-  {
-    const int *tmp=self->getGlobalNumberingNode();
-    int size=self->getCellMesh()->getNumberOfNodes();
-    PyObject *ret=PyList_New(size);
-    for(int i=0;i<size;i++)
-      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
-    return ret;
-  }
-}
+%include "ParaMEDMEMCommon.i"
 
 %pythoncode %{
 def MEDCouplingDataArrayDoubleIadd(self,*args):
diff --git a/src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i b/src/ParaMEDMEM_Swig/ParaMEDMEMCommon.i
new file mode 100644 (file)
index 0000000..c5b760a
--- /dev/null
@@ -0,0 +1,102 @@
+// Copyright (C) 2017  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
+//
+
+%include std_set.i
+
+%template() std::set<int>;
+
+%{
+#include "CommInterface.hxx"
+#include "ProcessorGroup.hxx"
+#include "Topology.hxx"
+#include "MPIProcessorGroup.hxx"
+#include "DEC.hxx"
+#include "InterpKernelDEC.hxx"
+#include "NonCoincidentDEC.hxx"
+#include "StructuredCoincidentDEC.hxx"
+#include "ParaMESH.hxx"
+#include "ParaFIELD.hxx"
+#include "ICoCoMEDField.hxx"
+#include "ComponentTopology.hxx"
+
+using namespace INTERP_KERNEL;
+using namespace MEDCoupling;
+using namespace ICoCo;
+%}
+
+%include "InterpolationOptions.hxx"
+%include "CommInterface.hxx"
+%include "ProcessorGroup.hxx"
+%include "DECOptions.hxx"
+%include "ParaMESH.hxx"
+%include "ParaFIELD.hxx"
+%include "MPIProcessorGroup.hxx"
+%include "ComponentTopology.hxx"
+%include "DEC.hxx"
+%include "DisjointDEC.hxx"
+%include "InterpKernelDEC.hxx"
+%include "StructuredCoincidentDEC.hxx"
+
+%include "ICoCoField.hxx"
+%rename(ICoCoMEDField) ICoCo::MEDField;
+%include "ICoCoMEDField.hxx"
+
+%nodefaultctor;
+
+/* This object can be used only if MED_ENABLE_FVM is defined*/
+#ifdef MED_ENABLE_FVM
+class NonCoincidentDEC : public DEC
+{
+public:
+  NonCoincidentDEC(ProcessorGroup& source, ProcessorGroup& target);
+};
+#endif
+
+%extend MEDCoupling::ParaMESH
+{
+  PyObject *getGlobalNumberingCell2() const
+  {
+    const int *tmp=self->getGlobalNumberingCell();
+    int size=self->getCellMesh()->getNumberOfCells();
+    PyObject *ret=PyList_New(size);
+    for(int i=0;i<size;i++)
+      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
+    return ret;
+  }
+
+  PyObject *getGlobalNumberingFace2() const
+  {
+    const int *tmp=self->getGlobalNumberingFace();
+    int size=self->getFaceMesh()->getNumberOfCells();
+    PyObject *ret=PyList_New(size);
+    for(int i=0;i<size;i++)
+      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
+    return ret;
+  }
+
+  PyObject *getGlobalNumberingNode2() const
+  {
+    const int *tmp=self->getGlobalNumberingNode();
+    int size=self->getCellMesh()->getNumberOfNodes();
+    PyObject *ret=PyList_New(size);
+    for(int i=0;i<size;i++)
+      PyList_SetItem(ret,i,PyInt_FromLong(tmp[i])); 
+    return ret;
+  }
+}