Salome HOME
350ac7555c4898f2ff5e6693b41c46cdbfefba4e
[tools/medcoupling.git] / src / MEDPartitioner_Swig / MEDPartitionerCommon.i
1 // Copyright (C) 2007-2016  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, or (at your option) any later version.
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 MEDPartitioner
21
22 %include std_string.i
23
24 %{
25 #include "MEDFileData.hxx"
26
27 #include "MEDPARTITIONER_MEDPartitioner.hxx"
28 #include "MEDPARTITIONER.hxx"
29 #include "MEDPARTITIONER_Graph.hxx"
30
31 using namespace MEDCoupling;
32 using namespace INTERP_KERNEL;
33 using namespace MEDPARTITIONER;
34 %}
35
36 %feature("autodoc", "1");
37 %feature("docstring");
38
39 %newobject MEDPARTITIONER::MEDPartitioner::New;
40 %newobject MEDPARTITIONER::MEDPartitioner::Graph;
41 %newobject MEDPARTITIONER::MEDPartitioner::Graph::getGraph;
42 %newobject MEDPARTITIONER::MEDPartitioner::Graph::getPartition;
43 %newobject MEDPARTITIONER::MEDPartitioner::getMEDFileData;
44 %feature("unref") MEDCoupling::MEDFileData "$this->decrRef();"
45
46 %nodefaultctor;
47
48 %rename (InterpKernelException) INTERP_KERNEL::Exception;
49
50 namespace MEDPARTITIONER
51 {
52   class Graph
53   {
54   public:
55     typedef enum {METIS,SCOTCH} splitter_type;
56   public:
57     virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) throw(INTERP_KERNEL::Exception);
58     MEDCoupling::MEDCouplingSkyLineArray *getGraph() const
59     {
60       const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getGraph());
61       if(ret)
62         ret->incrRef();
63       return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
64     }
65     const MEDCoupling::MEDCouplingSkyLineArray *getPartition() const
66     {
67       const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getPartition());
68       if(ret)
69         ret->incrRef();
70       return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
71     }
72     int nbVertices() const;
73   };
74
75   class MEDPartitioner
76   {
77   public:
78     MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
79     MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
80     MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
81     static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0) throw(INTERP_KERNEL::Exception);
82     MEDCoupling::MEDFileData* getMEDFileData() throw(INTERP_KERNEL::Exception);
83     void write(const std::string& filename) throw(INTERP_KERNEL::Exception);
84   };
85 }
86