Salome HOME
1401433045c4dd51e87e2ee3df2f3ebf8bef2edb
[tools/medcoupling.git] / src / MEDPartitioner_Swig / MEDPartitionerCommon.i
1 // Copyright (C) 2007-2019  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 %{
21 #include "MEDPARTITIONER_MEDPartitioner.hxx"
22 #include "MEDPARTITIONER.hxx"
23 #include "MEDPARTITIONER_Graph.hxx"
24
25 using namespace MEDPARTITIONER;
26 %}
27
28
29
30 %newobject MEDPARTITIONER::MEDPartitioner::New;
31 %newobject MEDPARTITIONER::MEDPartitioner::Graph;
32 %newobject MEDPARTITIONER::MEDPartitioner::Graph::getGraph;
33 %newobject MEDPARTITIONER::MEDPartitioner::Graph::getPartition;
34 %newobject MEDPARTITIONER::MEDPartitioner::getMEDFileData;
35
36 namespace MEDPARTITIONER
37 {
38   class Graph
39   {
40   public:
41     typedef enum {METIS,SCOTCH,PTSCOTCH} splitter_type;
42   public:
43     virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0);
44     MEDCoupling::MEDCouplingSkyLineArray *getGraph() const
45     {
46       const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getGraph());
47       if(ret)
48         ret->incrRef();
49       return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
50     }
51     const MEDCoupling::MEDCouplingSkyLineArray *getPartition() const
52     {
53       const MEDCoupling::MEDCouplingSkyLineArray *ret(self->getPartition());
54       if(ret)
55         ret->incrRef();
56       return const_cast<MEDCoupling::MEDCouplingSkyLineArray *>(ret);
57     }
58     int nbVertices() const;
59   };
60
61   class MEDPartitioner
62   {
63   public:
64     MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
65     MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
66     MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
67     static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, MEDCoupling::DataArrayIdType* vlbloctab=0);
68     static std::vector<std::string> AvailableAlgorithms();
69     static std::vector<std::string> AllAlgorithms();
70     MEDCoupling::MEDFileData* getMEDFileData();
71     void write(const std::string& filename);
72   };
73 }
74