From f88d85ba8adae9347bbee69592d1c1a34168dda0 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 1 Mar 2010 17:11:08 +0000 Subject: [PATCH] ENH: have dummy versions for thirdparty libraries The dummyThirdParty tree builds libraries which are drop-in (but non-functional) versions of some thirdparty libraries. This will make it easier to ship binary versions without having to ship thirdparty packs. --- .../redistributeMeshPar/Make/options | 3 +- src/Allwmake | 2 + src/dummyThirdParty/Allwmake | 11 + src/dummyThirdParty/MGridGen/Make/files | 3 + src/dummyThirdParty/MGridGen/Make/options | 3 + src/dummyThirdParty/MGridGen/dummyMGridGen.C | 59 ++++ src/dummyThirdParty/MGridGen/mgridgen.h | 64 ++++ src/dummyThirdParty/metisDecomp/Make/files | 3 + src/dummyThirdParty/metisDecomp/Make/options | 5 + .../metisDecomp/dummyMetisDecomp.C | 156 ++++++++++ src/dummyThirdParty/parMetisDecomp/Make/files | 3 + .../parMetisDecomp/Make/options | 5 + .../parMetisDecomp/dummyParMetisDecomp.C | 185 ++++++++++++ src/dummyThirdParty/scotchDecomp/Make/files | 3 + src/dummyThirdParty/scotchDecomp/Make/options | 6 + .../scotchDecomp/dummyScotchDecomp.C | 280 ++++++++++++++++++ src/meshTools/Make/options | 1 - src/parallel/Allwmake | 7 +- src/parallel/AllwmakeLnInclude | 8 + src/parallel/decompositionMethods/Make/files | 2 - .../decompositionMethods/Make/options | 12 +- src/parallel/metisDecomp/Make/files | 2 +- src/parallel/metisDecomp/Make/options | 3 +- src/parallel/parMetisDecomp/Make/files | 2 +- src/parallel/parMetisDecomp/Make/options | 3 +- src/parallel/scotchDecomp/Make/files | 3 + src/parallel/scotchDecomp/Make/options | 7 + .../scotchDecomp/scotchDecomp.C | 0 .../scotchDecomp/scotchDecomp.H | 0 29 files changed, 826 insertions(+), 15 deletions(-) create mode 100755 src/dummyThirdParty/Allwmake create mode 100644 src/dummyThirdParty/MGridGen/Make/files create mode 100644 src/dummyThirdParty/MGridGen/Make/options create mode 100644 src/dummyThirdParty/MGridGen/dummyMGridGen.C create mode 100644 src/dummyThirdParty/MGridGen/mgridgen.h create mode 100644 src/dummyThirdParty/metisDecomp/Make/files create mode 100644 src/dummyThirdParty/metisDecomp/Make/options create mode 100644 src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C create mode 100644 src/dummyThirdParty/parMetisDecomp/Make/files create mode 100644 src/dummyThirdParty/parMetisDecomp/Make/options create mode 100644 src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C create mode 100644 src/dummyThirdParty/scotchDecomp/Make/files create mode 100644 src/dummyThirdParty/scotchDecomp/Make/options create mode 100644 src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C create mode 100755 src/parallel/AllwmakeLnInclude create mode 100644 src/parallel/scotchDecomp/Make/files create mode 100644 src/parallel/scotchDecomp/Make/options rename src/parallel/{decompositionMethods => }/scotchDecomp/scotchDecomp.C (100%) rename src/parallel/{decompositionMethods => }/scotchDecomp/scotchDecomp.H (100%) diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options index 45ab666e24..8f8010fff7 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/Make/options @@ -8,5 +8,4 @@ EXE_LIBS = \ -lfiniteVolume \ -ldecompositionMethods \ -lmeshTools \ - -ldynamicMesh \ - -L$(FOAM_MPI_LIBBIN) -lparMetisDecompositionMethod + -ldynamicMesh diff --git a/src/Allwmake b/src/Allwmake index f24f2f370d..2f6d198d8e 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -28,6 +28,8 @@ wmake libso surfMesh wmake libso triSurface # Decomposition methods needed by meshTools +parallel/AllwmakeLnInclude +dummyThirdParty/Allwmake wmake libso parallel/decompositionMethods wmake libso parallel/metisDecomp diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake new file mode 100755 index 0000000000..6629894909 --- /dev/null +++ b/src/dummyThirdParty/Allwmake @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake libso scotchDecomp +wmake libso metisDecomp +wmake libso parMetisDecomp +wmake libso MGridGen + + +# ----------------------------------------------------------------- end-of-file diff --git a/src/dummyThirdParty/MGridGen/Make/files b/src/dummyThirdParty/MGridGen/Make/files new file mode 100644 index 0000000000..684d67331a --- /dev/null +++ b/src/dummyThirdParty/MGridGen/Make/files @@ -0,0 +1,3 @@ +dummyMGridGen.C + +LIB = $(FOAM_LIBBIN)/dummy/libMGridGen diff --git a/src/dummyThirdParty/MGridGen/Make/options b/src/dummyThirdParty/MGridGen/Make/options new file mode 100644 index 0000000000..4c3dd783cb --- /dev/null +++ b/src/dummyThirdParty/MGridGen/Make/options @@ -0,0 +1,3 @@ +EXE_INC = + +EXE_LIBS = diff --git a/src/dummyThirdParty/MGridGen/dummyMGridGen.C b/src/dummyThirdParty/MGridGen/dummyMGridGen.C new file mode 100644 index 0000000000..3fbf08b460 --- /dev/null +++ b/src/dummyThirdParty/MGridGen/dummyMGridGen.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +//extern "C" +//{ +#include "mgridgen.h" +//} + +#include "error.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +static const char* notImplementedMessage = +"You are trying to use MGridGen but do not have the MGridGen library loaded.\n" +"This message is from the dummy MGridGen stub library instead.\n" +"\n" +"Normally the MGridGen library will be loaded through the LD_LIBRARY_PATH\n" +"environment variable but you are picking up this dummy library from the\n" +"$FOAM_LIBBIN/dummy directory. Please install MGridGen and make sure the\n" +"libMGridGen.so is in your LD_LIBRARY_PATH."; + +#ifdef __cplusplus +extern "C" +#endif +void MGridGen(int, idxtype *, realtype *, realtype *, idxtype *, realtype *, + int, int, int *, int *, int *, idxtype *) +{ + FatalErrorIn("MGridGen(..)") + << notImplementedMessage + << Foam::exit(Foam::FatalError); +} + + +// ************************************************************************* // diff --git a/src/dummyThirdParty/MGridGen/mgridgen.h b/src/dummyThirdParty/MGridGen/mgridgen.h new file mode 100644 index 0000000000..2a040431a6 --- /dev/null +++ b/src/dummyThirdParty/MGridGen/mgridgen.h @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Namespace + C linkage + +Description + Dummy stub for mgridgen library functions. + Only implements the absolute minimum we are using. + +SourceFiles + dummyMGridGen.C + +\*---------------------------------------------------------------------------*/ + +#ifndef mgridgen_H +#define mgridgen_H + +#include "scalar.H" + +#ifndef idxtype +#define idxtype int +#define realtype Foam::scalar +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +/*---------------------------------------------------------------------------*\ + Class metis Declaration +\*---------------------------------------------------------------------------*/ + +#ifdef __cplusplus +extern "C" +#endif +void MGridGen(int, idxtype *, realtype *, realtype *, idxtype *, realtype *, + int, int, int *, int *, int *, idxtype *); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/dummyThirdParty/metisDecomp/Make/files b/src/dummyThirdParty/metisDecomp/Make/files new file mode 100644 index 0000000000..cdc9482e7d --- /dev/null +++ b/src/dummyThirdParty/metisDecomp/Make/files @@ -0,0 +1,3 @@ +dummyMetisDecomp.C + +LIB = $(FOAM_LIBBIN)/dummy/libmetisDecomp diff --git a/src/dummyThirdParty/metisDecomp/Make/options b/src/dummyThirdParty/metisDecomp/Make/options new file mode 100644 index 0000000000..05ee5feb98 --- /dev/null +++ b/src/dummyThirdParty/metisDecomp/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \ + -I$(FOAM_SRC)/parallel/metisDecomp/lnInclude + +LIB_LIBS = diff --git a/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C new file mode 100644 index 0000000000..6167a7aa09 --- /dev/null +++ b/src/dummyThirdParty/metisDecomp/dummyMetisDecomp.C @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "metisDecomp.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" + +static const char* notImplementedMessage = +"You are trying to use metis but do not have the metisDecomp library loaded." +"\nThis message is from the dummy metisDecomp stub library instead.\n" +"\n" +"Please install metis and make sure that libmetis.so is in your " +"LD_LIBRARY_PATH.\n" +"The metisDecomp library can then be built in $FOAM_SRC/decompositionMethods/" +"metisDecomp\n"; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(metisDecomp, 0); + + addToRunTimeSelectionTable + ( + decompositionMethod, + metisDecomp, + dictionaryMesh + ); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +Foam::label Foam::metisDecomp::decompose +( + const List& adjncy, + const List& xadj, + const scalarField& cellWeights, + List& finalDecomp +) +{ + FatalErrorIn + ( + "labelList metisDecomp::decompose" + "(" + "const List&, " + "const List&, " + "const scalarField&, " + "List&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::metisDecomp::metisDecomp +( + const dictionary& decompositionDict, + const polyMesh& mesh +) +: + decompositionMethod(decompositionDict), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::labelList Foam::metisDecomp::decompose +( + const pointField& points, + const scalarField& pointWeights +) +{ + FatalErrorIn + ( + "labelList metisDecomp::decompose" + "(" + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +Foam::labelList Foam::metisDecomp::decompose +( + const labelList& agglom, + const pointField& agglomPoints, + const scalarField& agglomWeights +) +{ + FatalErrorIn + ( + "labelList metisDecomp::decompose" + "(" + "const labelList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +Foam::labelList Foam::metisDecomp::decompose +( + const labelListList& globalCellCells, + const pointField& cellCentres, + const scalarField& cellWeights +) +{ + FatalErrorIn + ( + "labelList metisDecomp::decompose" + "(" + "const labelListList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +// ************************************************************************* // diff --git a/src/dummyThirdParty/parMetisDecomp/Make/files b/src/dummyThirdParty/parMetisDecomp/Make/files new file mode 100644 index 0000000000..beb734541c --- /dev/null +++ b/src/dummyThirdParty/parMetisDecomp/Make/files @@ -0,0 +1,3 @@ +dummyParMetisDecomp.C + +LIB = $(FOAM_LIBBIN)/dummy/libparMetisDecomp diff --git a/src/dummyThirdParty/parMetisDecomp/Make/options b/src/dummyThirdParty/parMetisDecomp/Make/options new file mode 100644 index 0000000000..2267e7a542 --- /dev/null +++ b/src/dummyThirdParty/parMetisDecomp/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \ + -I$(FOAM_SRC)/parallel/parMetisDecomp/lnInclude + +LIB_LIBS = diff --git a/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C b/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C new file mode 100644 index 0000000000..7cf3663e6c --- /dev/null +++ b/src/dummyThirdParty/parMetisDecomp/dummyParMetisDecomp.C @@ -0,0 +1,185 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "parMetisDecomp.H" +#include "addToRunTimeSelectionTable.H" +#include "polyMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(parMetisDecomp, 0); + + addToRunTimeSelectionTable + ( + decompositionMethod, + parMetisDecomp, + dictionaryMesh + ); +} + +static const char* notImplementedMessage = +"You are trying to use parMetis but do not have the parMetisDecomp library " +"loaded.\n" +"This message is from the dummy parMetisDecomp stub library instead.\n" +"\n" +"Please install parMetis and make sure that libparMetis.so is in your " +"LD_LIBRARY_PATH.\n" +"The parMetisDecomp library can then be built in $FOAM_SRC/decompositionMethods/" +"parMetisDecomp\n"; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +//- Does prevention of 0 cell domains and calls parmetis. +Foam::label Foam::parMetisDecomp::decompose +( + Field& xadj, + Field& adjncy, + const pointField& cellCentres, + Field& cellWeights, + Field& faceWeights, + const List& options, + + List& finalDecomp +) +{ + FatalErrorIn + ( + "label parMetisDecomp::decompose" + "(" + "Field&, " + "Field&, " + "const pointField&, " + "Field&, " + "Field&, " + "const List&, " + "List&" + ")" + )<< notImplementedMessage << exit(FatalError); + + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::parMetisDecomp::parMetisDecomp +( + const dictionary& decompositionDict, + const polyMesh& mesh +) +: + decompositionMethod(decompositionDict), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::labelList Foam::parMetisDecomp::decompose +( + const pointField& cc, + const scalarField& cWeights +) +{ + FatalErrorIn + ( + "labelList parMetisDecomp::decompose" + "(" + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +Foam::labelList Foam::parMetisDecomp::decompose +( + const labelList& cellToRegion, + const pointField& regionPoints, + const scalarField& regionWeights +) +{ + FatalErrorIn + ( + "labelList parMetisDecomp::decompose" + "(" + "const labelList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +Foam::labelList Foam::parMetisDecomp::decompose +( + const labelListList& globalCellCells, + const pointField& cellCentres, + const scalarField& cWeights +) +{ + FatalErrorIn + ( + "labelList parMetisDecomp::decompose" + "(" + "const labelListList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList(); +} + + +void Foam::parMetisDecomp::calcMetisDistributedCSR +( + const polyMesh& mesh, + List& adjncy, + List& xadj +) +{ + FatalErrorIn + ( + "void parMetisDecomp::calcMetisDistributedCSR" + "(" + "const polyMesh&, " + "List&, " + "List&" + ")" + ) << notImplementedMessage << exit(FatalError); +} + + +// ************************************************************************* // diff --git a/src/dummyThirdParty/scotchDecomp/Make/files b/src/dummyThirdParty/scotchDecomp/Make/files new file mode 100644 index 0000000000..f8f7b50143 --- /dev/null +++ b/src/dummyThirdParty/scotchDecomp/Make/files @@ -0,0 +1,3 @@ +dummyScotchDecomp.C + +LIB = $(FOAM_LIBBIN)/dummy/libscotchDecomp diff --git a/src/dummyThirdParty/scotchDecomp/Make/options b/src/dummyThirdParty/scotchDecomp/Make/options new file mode 100644 index 0000000000..e109fb6fce --- /dev/null +++ b/src/dummyThirdParty/scotchDecomp/Make/options @@ -0,0 +1,6 @@ +EXE_INC = \ + -I$(FOAM_SRC)/parallel/decompositionMethods/lnInclude \ + -I$(FOAM_SRC)/parallel/scotchDecomp/lnInclude + +LIB_LIBS = + diff --git a/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C new file mode 100644 index 0000000000..cefc26c582 --- /dev/null +++ b/src/dummyThirdParty/scotchDecomp/dummyScotchDecomp.C @@ -0,0 +1,280 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM 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 General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + From scotch forum: + + By: Francois PELLEGRINI RE: Graph mapping 'strategy' string [ reply ] + 2008-08-22 10:09 Strategy handling in Scotch is a bit tricky. In order + not to be confused, you must have a clear view of how they are built. + Here are some rules: + + 1- Strategies are made up of "methods" which are combined by means of + "operators". + + 2- A method is of the form "m{param=value,param=value,...}", where "m" + is a single character (this is your first error: "f" is a method name, + not a parameter name). + + 3- There exist different sort of strategies : bipartitioning strategies, + mapping strategies, ordering strategies, which cannot be mixed. For + instance, you cannot build a bipartitioning strategy and feed it to a + mapping method (this is your second error). + + To use the "mapCompute" routine, you must create a mapping strategy, not + a bipartitioning one, and so use stratGraphMap() and not + stratGraphBipart(). Your mapping strategy should however be based on the + "recursive bipartitioning" method ("b"). For instance, a simple (and + hence not very efficient) mapping strategy can be : + + "b{sep=f}" + + which computes mappings with the recursive bipartitioning method "b", + this latter using the Fiduccia-Mattheyses method "f" to compute its + separators. + + If you want an exact partition (see your previous post), try + "b{sep=fx}". + + However, these strategies are not the most efficient, as they do not + make use of the multi-level framework. + + To use the multi-level framework, try for instance: + + "b{sep=m{vert=100,low=h,asc=f}x}" + + The current default mapping strategy in Scotch can be seen by using the + "-vs" option of program gmap. It is, to date: + + b + { + job=t, + map=t, + poli=S, + sep= + ( + m + { + asc=b + { + bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, + org=f{move=80,pass=-1,bal=0.005}, + width=3 + }, + low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, + type=h, + vert=80, + rat=0.8 + } + | m + { + asc=b + { + bnd=d{pass=40,dif=1,rem=1}f{move=80,pass=-1,bal=0.005}, + org=f{move=80,pass=-1,bal=0.005}, + width=3 + }, + low=h{pass=10}f{move=80,pass=-1,bal=0.0005}, + type=h, + vert=80, + rat=0.8 + } + ) + } + + +\*---------------------------------------------------------------------------*/ + +#include "scotchDecomp.H" +#include "addToRunTimeSelectionTable.H" +#include "Time.H" + +static const char* notImplementedMessage = +"You are trying to use scotch but do not have the scotchDecomp library loaded." +"\nThis message is from the dummy scotchDecomp stub library instead.\n" +"\n" +"Please install scotch and make sure that libscotch.so is in your " +"LD_LIBRARY_PATH.\n" +"The scotchDecomp library can then be built in $FOAM_SRC/decompositionMethods/" +"scotchDecomp\n"; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(scotchDecomp, 0); + + addToRunTimeSelectionTable + ( + decompositionMethod, + scotchDecomp, + dictionaryMesh + ); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::scotchDecomp::check(const int retVal, const char* str) +{} + + +Foam::label Foam::scotchDecomp::decompose +( + const List& adjncy, + const List& xadj, + const scalarField& cWeights, + + List& finalDecomp +) +{ + FatalErrorIn + ( + "label scotchDecomp::decompose" + "(" + "const List&, " + "const List&, " + "const scalarField&, " + "List&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return -1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::scotchDecomp::scotchDecomp +( + const dictionary& decompositionDict, + const polyMesh& mesh +) +: + decompositionMethod(decompositionDict), + mesh_(mesh) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::labelList Foam::scotchDecomp::decompose +( + const pointField& points, + const scalarField& pointWeights +) +{ + FatalErrorIn + ( + "labelList scotchDecomp::decompose" + "(" + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +Foam::labelList Foam::scotchDecomp::decompose +( + const labelList& agglom, + const pointField& agglomPoints, + const scalarField& pointWeights +) +{ + FatalErrorIn + ( + "labelList scotchDecomp::decompose" + "(" + "const labelList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +Foam::labelList Foam::scotchDecomp::decompose +( + const labelListList& globalCellCells, + const pointField& cellCentres, + const scalarField& cWeights +) +{ + FatalErrorIn + ( + "labelList scotchDecomp::decompose" + "(" + "const labelListList&, " + "const pointField&, " + "const scalarField&" + ")" + ) << notImplementedMessage << exit(FatalError); + + return labelList::null(); +} + + +void Foam::scotchDecomp::calcCSR +( + const polyMesh& mesh, + List& adjncy, + List& xadj +) +{ + FatalErrorIn + ( + "labelList scotchDecomp::decompose" + "(" + "const polyMesh&, " + "const List&, " + "const List&" + ")" + ) << notImplementedMessage << exit(FatalError); +} + + +void Foam::scotchDecomp::calcCSR +( + const labelListList& cellCells, + List& adjncy, + List& xadj +) +{ + FatalErrorIn + ( + "labelList scotchDecomp::decompose" + "(" + "const labelListList&, " + "const List&, " + "const List&" + ")" + ) << notImplementedMessage << exit(FatalError); +} + + +// ************************************************************************* // diff --git a/src/meshTools/Make/options b/src/meshTools/Make/options index 6bf989d4f5..0ff2202926 100644 --- a/src/meshTools/Make/options +++ b/src/meshTools/Make/options @@ -6,5 +6,4 @@ EXE_INC = \ LIB_LIBS = \ -ltriSurface \ -ldecompositionMethods \ - -lmetisDecompositionMethod \ -llagrangian diff --git a/src/parallel/Allwmake b/src/parallel/Allwmake index 48c7d41624..5309e3481e 100755 --- a/src/parallel/Allwmake +++ b/src/parallel/Allwmake @@ -2,7 +2,9 @@ cd ${0%/*} || exit 1 # run from this directory set -x -wmake libso decompositionMethods +wmakeLnInclude decompositionMethods + +wmake libso scotchDecomp wmake libso metisDecomp wmake libso reconstruct @@ -11,4 +13,7 @@ then ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB; wmake libso parMetisDecomp ) fi +wmake libso decompositionMethods + + # ----------------------------------------------------------------- end-of-file diff --git a/src/parallel/AllwmakeLnInclude b/src/parallel/AllwmakeLnInclude new file mode 100755 index 0000000000..0737a7ffd4 --- /dev/null +++ b/src/parallel/AllwmakeLnInclude @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmakeLnInclude decompositionMethods +wmakeLnInclude metisDecomp +wmakeLnInclude parMetisDecomp +wmakeLnInclude scotchDecomp diff --git a/src/parallel/decompositionMethods/Make/files b/src/parallel/decompositionMethods/Make/files index 751ebe90f2..43bb9a25c1 100644 --- a/src/parallel/decompositionMethods/Make/files +++ b/src/parallel/decompositionMethods/Make/files @@ -4,6 +4,4 @@ simpleGeomDecomp/simpleGeomDecomp.C hierarchGeomDecomp/hierarchGeomDecomp.C manualDecomp/manualDecomp.C -scotchDecomp/scotchDecomp.C - LIB = $(FOAM_LIBBIN)/libdecompositionMethods diff --git a/src/parallel/decompositionMethods/Make/options b/src/parallel/decompositionMethods/Make/options index 3949e7e1d9..fbe9e72228 100644 --- a/src/parallel/decompositionMethods/Make/options +++ b/src/parallel/decompositionMethods/Make/options @@ -1,7 +1,9 @@ -EXE_INC = \ - -I$(WM_THIRD_PARTY_DIR)/scotch_5.1/include \ - -I/usr/include/scotch \ - -I../metisDecomp/lnInclude +EXE_INC = LIB_LIBS = \ - -lscotch -lscotcherrexit + -L$(FOAM_LIBBIN)/dummy \ + -L$(FOAM_MPI_LIBBIN) \ + -lscotchDecomp \ + -lmetisDecomp \ + -lparMetisDecomp + diff --git a/src/parallel/metisDecomp/Make/files b/src/parallel/metisDecomp/Make/files index eb1e633e18..39ee731e4d 100644 --- a/src/parallel/metisDecomp/Make/files +++ b/src/parallel/metisDecomp/Make/files @@ -1,3 +1,3 @@ metisDecomp.C -LIB = $(FOAM_LIBBIN)/libmetisDecompositionMethod +LIB = $(FOAM_LIBBIN)/libmetisDecomp diff --git a/src/parallel/metisDecomp/Make/options b/src/parallel/metisDecomp/Make/options index a7d5398f03..2115beb95a 100644 --- a/src/parallel/metisDecomp/Make/options +++ b/src/parallel/metisDecomp/Make/options @@ -1,6 +1,7 @@ EXE_INC = \ -I$(WM_THIRD_PARTY_DIR)/metis-5.0pre2/include \ - -I../decompositionMethods/lnInclude + -I../decompositionMethods/lnInclude \ + -I../scotchDecomp/lnInclude LIB_LIBS = \ -lmetis \ diff --git a/src/parallel/parMetisDecomp/Make/files b/src/parallel/parMetisDecomp/Make/files index 21d8080bc0..7b771b8161 100644 --- a/src/parallel/parMetisDecomp/Make/files +++ b/src/parallel/parMetisDecomp/Make/files @@ -1,3 +1,3 @@ parMetisDecomp.C -LIB = $(FOAM_MPI_LIBBIN)/libparMetisDecompositionMethod +LIB = $(FOAM_MPI_LIBBIN)/libparMetisDecomp diff --git a/src/parallel/parMetisDecomp/Make/options b/src/parallel/parMetisDecomp/Make/options index 79beb369af..76a64be219 100644 --- a/src/parallel/parMetisDecomp/Make/options +++ b/src/parallel/parMetisDecomp/Make/options @@ -5,7 +5,8 @@ EXE_INC = \ -I$(WM_THIRD_PARTY_DIR)/ParMetis-3.1/ParMETISLib \ -I$(WM_THIRD_PARTY_DIR)/ParMetis-3.1 \ -I../decompositionMethods/lnInclude \ - -I../metisDecomp/lnInclude + -I../metisDecomp/lnInclude \ + -I../scotchDecomp/lnInclude LIB_LIBS = \ -L$(FOAM_MPI_LIBBIN) \ diff --git a/src/parallel/scotchDecomp/Make/files b/src/parallel/scotchDecomp/Make/files new file mode 100644 index 0000000000..59717fa15c --- /dev/null +++ b/src/parallel/scotchDecomp/Make/files @@ -0,0 +1,3 @@ +scotchDecomp.C + +LIB = $(FOAM_LIBBIN)/libscotchDecomp diff --git a/src/parallel/scotchDecomp/Make/options b/src/parallel/scotchDecomp/Make/options new file mode 100644 index 0000000000..96b64b8fdd --- /dev/null +++ b/src/parallel/scotchDecomp/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(WM_THIRD_PARTY_DIR)/scotch_5.1/include \ + -I/usr/include/scotch \ + -I../decompositionMethods/lnInclude + +LIB_LIBS = \ + -lscotch -lscotcherrexit diff --git a/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C b/src/parallel/scotchDecomp/scotchDecomp.C similarity index 100% rename from src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.C rename to src/parallel/scotchDecomp/scotchDecomp.C diff --git a/src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.H b/src/parallel/scotchDecomp/scotchDecomp.H similarity index 100% rename from src/parallel/decompositionMethods/scotchDecomp/scotchDecomp.H rename to src/parallel/scotchDecomp/scotchDecomp.H