Skip to content
Snippets Groups Projects
Commit a49ddaa9 authored by Emmanouil Kiagias's avatar Emmanouil Kiagias Committed by Christoph Grüninger
Browse files

Choose different codepath if METIS 5 is found.


Updated how METIS_PartGraphRecursive is called in METIS version 5.
In the new parameters NULL value is used where possible. Only one
new parameter could not be set to NULL, it is the "ncon" (second argument).
In the manual it says: "ncon: The number of balancing constraints.
It should be at least 1." so 1 is used as its value.

Also options with the new layout are passed in METIS_PartGraphRecursive
initialized with the default values(default values also used in the
current code: options[0]=0). Only one option was added manually:
the METIS_OPTION_NUMBERING = numflag which is the same numflag parameter
passed in the old version of METIS_PartGraphRecursive function.

Signed-off-by: default avatarChristoph Grüninger <gruenich@dune-project.org>
parent 6ef23f29
No related branches found
No related tags found
No related merge requests found
......@@ -767,6 +767,7 @@ namespace Dune
typedef std::size_t idxtype;
#endif
#ifndef METIS_VER_MAJOR
extern "C"
{
// backwards compatibility to parmetis < 4.0.0
......@@ -778,6 +779,7 @@ namespace Dune
idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts,
int *options, int *edgecut, idxtype *part);
}
#endif
#else
typedef std::size_t idxtype;
#endif // HAVE_PARMETIS
......@@ -1134,9 +1136,18 @@ namespace Dune
std::cout<<"Creating grah one 1 process took "<<time.elapsed()<<std::endl;
time.reset();
options[0]=0; options[1]=1; options[2]=1; options[3]=3; options[4]=3;
#if METIS_VER_MAJOR >= 5
idxtype ncon = 1;
idxtype moptions[METIS_NOPTIONS];
METIS_SetDefaultOptions(moptions);
moptions[METIS_OPTION_NUMBERING] = numflag;
METIS_PartGraphRecursive(&noVertices, &ncon, gxadj, gadjncy, gvwgt, NULL, gadjwgt,
&nparts, NULL, NULL, moptions, &edgecut, gpart);
#else
// Call metis
METIS_PartGraphRecursive(&noVertices, gxadj, gadjncy, gvwgt, gadjwgt, &wgtflag,
&numflag, &nparts, options, &edgecut, gpart);
#endif
if(verbose && oocomm.communicator().rank()==0)
std::cout<<"METIS took "<<time.elapsed()<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment