Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / MEDSPLITTER_Swig / libMEDSPLITTER_Swig.i
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 %module libMEDSPLITTER_Swig
21
22 %{
23 #include "MEDMEM_Mesh.hxx"
24 #include<MEDSPLITTER_Topology.hxx>
25 #include<MEDSPLITTER_MESHCollection.hxx>
26
27 using namespace MEDSPLITTER;
28
29 typedef enum {METIS,SCOTCH} splitter_type;
30 %}
31
32 typedef enum {METIS,SCOTCH} splitter_type;
33 typedef enum{MedAscii, MedXML, Undefined} DriverType; 
34
35 %include "my_typemap.i"
36
37 %typecheck(SWIG_TYPECHECK_POINTER) const int* {
38    $1 = PyList_Check($input) ? 1 : 0;
39 }
40
41 namespace MEDSPLITTER {
42 class Graph {
43 public:
44   typedef enum {METIS,SCOTCH} splitter_type;
45   %extend {
46     Graph() {return 0;}
47   }
48 };
49 }
50
51 class MESHCollection {
52 public:
53   MESHCollection(const MESHCollection&, MEDSPLITTER::Topology*,
54                  bool family_splitting=false, bool create_empty_groups=false);
55   MESHCollection(const char* filename);
56   MESHCollection(const char* filename, char* meshname);
57
58   MEDSPLITTER::Topology* createPartition(int nbdomain,
59                                          MEDSPLITTER::Graph::splitter_type splitter_type = METIS, 
60                                          const char* theStr=0);
61   MEDSPLITTER::Topology* createPartition(const int* partition);
62
63   void setDriverType(::DriverType type);
64   void setSubdomainBoundaryCreates(bool flag);
65
66   void write(const char* filename);
67   void castAllFields(const MESHCollection& old_collection);
68   void castFamilies(const MESHCollection& old_collection);
69   void castField(const MESHCollection& old_collection, const char* fieldname, 
70                  int itnumber, int ordernumber);
71
72   void setIndivisibleGroup(const std::string& a);
73 };