From 526b3840c7d8afcdfd2aa07e5f06ae671e5d27d4 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Mon, 20 Dec 2021 22:48:37 +0000 Subject: [PATCH] renumberMethods::zoltanRenumber: set default ORDER_METHOD to LOCAL_HSFC also adding optional "libs" entry to renumberMeshDict so that the libzoltanRenumber.so can be loaded at run-time rather than having to recompile and relink the renumberMesh utility to support it. --- .../mesh/manipulation/renumberMesh/Allwmake | 25 ---- etc/caseDicts/annotated/renumberMeshDict | 4 +- .../renumberMethod/renumberMethod.C | 12 +- src/renumber/zoltanRenumber/Make/options | 3 +- src/renumber/zoltanRenumber/zoltanRenumber.C | 128 +----------------- src/renumber/zoltanRenumber/zoltanRenumber.H | 4 +- 6 files changed, 22 insertions(+), 154 deletions(-) delete mode 100755 applications/utilities/mesh/manipulation/renumberMesh/Allwmake diff --git a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake b/applications/utilities/mesh/manipulation/renumberMesh/Allwmake deleted file mode 100755 index 8fbaba1674..0000000000 --- a/applications/utilities/mesh/manipulation/renumberMesh/Allwmake +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -cd ${0%/*} || exit 1 # Run from this directory - -# Parse arguments for compilation (at least for error catching) -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments - -export COMPILE_FLAGS='' -export LINK_FLAGS='' - -if [ -f "${FOAM_LIBBIN}/libSloanRenumber.so" ] -then - echo "Found libSloanRenumber.so -- enabling Sloan renumbering support." - export LINK_FLAGS="${LINK_FLAGS} -lSloanRenumber" -fi - -if [ -f "${ZOLTAN_ARCH_PATH}/lib64/libzoltan.a" -a -f "${FOAM_LIBBIN}/libzoltanRenumber.so" ] -then - echo "Found libzoltanRenumber.so -- enabling zoltan renumbering support." - export COMPILE_FLAGS="-DFOAM_USE_ZOLTAN" - export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib64 -lzoltan" -fi - -wmake $targetType - -#------------------------------------------------------------------------------ diff --git a/etc/caseDicts/annotated/renumberMeshDict b/etc/caseDicts/annotated/renumberMeshDict index 7d680df122..a1c60bf331 100644 --- a/etc/caseDicts/annotated/renumberMeshDict +++ b/etc/caseDicts/annotated/renumberMeshDict @@ -43,7 +43,9 @@ method CuthillMcKee; //method random; //method structured; //method spring; -//method zoltan; // only if compiled with zoltan support + +//method zoltan; +//libs ("libzoltanRenumber.so"); //CuthillMcKeeCoeffs //{ diff --git a/src/renumber/renumberMethods/renumberMethod/renumberMethod.C b/src/renumber/renumberMethods/renumberMethod/renumberMethod.C index 5964a4c41b..3d48b8d6f8 100644 --- a/src/renumber/renumberMethods/renumberMethod/renumberMethod.C +++ b/src/renumber/renumberMethods/renumberMethod/renumberMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,6 +28,7 @@ InClass #include "renumberMethod.H" #include "decompositionMethod.H" +#include "dlLibraryTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -46,7 +47,14 @@ Foam::autoPtr Foam::renumberMethod::New { const word methodType(renumberDict.lookup("method")); - // Info<< "Selecting renumberMethod " << methodType << endl; + Info<< "Selecting renumberMethod " << methodType << endl; + + libs.open + ( + renumberDict, + "libs", + dictionaryConstructorTablePtr_ + ); dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(methodType); diff --git a/src/renumber/zoltanRenumber/Make/options b/src/renumber/zoltanRenumber/Make/options index 5bd46bbf9b..9062f4faf4 100644 --- a/src/renumber/zoltanRenumber/Make/options +++ b/src/renumber/zoltanRenumber/Make/options @@ -8,4 +8,5 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ - -lmeshTools + -lmeshTools \ + -L${ZOLTAN_ARCH_PATH}/lib64 -lzoltan diff --git a/src/renumber/zoltanRenumber/zoltanRenumber.C b/src/renumber/zoltanRenumber/zoltanRenumber.C index ab3138d79a..92ac351bef 100644 --- a/src/renumber/zoltanRenumber/zoltanRenumber.C +++ b/src/renumber/zoltanRenumber/zoltanRenumber.C @@ -90,121 +90,6 @@ static void get_vertex_list } -static void get_num_edges_list -( - void* data, - int nGID, - int nLID, - int nCells, - ZOLTAN_ID_PTR globalIDs, - ZOLTAN_ID_PTR localIDs, - int* numEdges, - int* ierr -) -{ - const Foam::polyMesh& mesh = *static_cast(data); - - if ((nGID != 1) || (nLID != 1) || (nCells != mesh.nCells())) - { - *ierr = ZOLTAN_FATAL; - return; - } - - for (Foam::label i=0; i(data); - - if - ( - (nGID != 1) - || (nLID != 1) - || (nCells != mesh.nCells()) - || (wgt_dim != 1) - ) - { - *ierr = ZOLTAN_FATAL; - return; - } - - ZOLTAN_ID_TYPE* nextNbor = nborGID; - int* nextProc = nborProc; - float* nextWgt = ewgts; - - for (Foam::label i=0; i < nCells; i++) - { - const Foam::label celli = localIDs[i]; - const Foam::cell& cFaces = mesh.cells()[celli]; - - forAll(cFaces, cFacei) - { - Foam::label n = 0; - - const Foam::label facei = cFaces[cFacei]; - - if (mesh.isInternalFace(facei)) - { - Foam::label nbr = mesh.faceOwner()[facei]; - - if (nbr == celli) - { - nbr = mesh.faceNeighbour()[facei]; - } - - // Note: global index - *nextNbor++ = nbr; - *nextProc++ = 0; - *nextWgt++ = 1.0; - - n++; - } - - if (n != num_edges[i]) - { - *ierr = ZOLTAN_FATAL; - return; - } - } - } - - *ierr = ZOLTAN_OK; -} - - static int get_mesh_dim(void* data, int* ierr) { const Foam::polyMesh& mesh = *static_cast(data); @@ -266,8 +151,7 @@ static void get_geom_list Foam::zoltanRenumber::zoltanRenumber(const dictionary& renumberDict) : - renumberMethod(renumberDict), - coeffsDict_(renumberDict.optionalSubDict(typeName+"Coeffs")) + renumberMethod(renumberDict) {} @@ -301,6 +185,10 @@ Foam::labelList Foam::zoltanRenumber::renumber struct Zoltan_Struct *zz = Zoltan_Create(PstreamGlobals::MPI_COMM_FOAM); { + // Set default order method to LOCAL_HSFC + Zoltan_Set_Param(zz, "ORDER_METHOD", "LOCAL_HSFC"); + Zoltan_Set_Param(zz, "ORDER_TYPE", "LOCAL"); + forAllConstIter(IDLList, coeffsDict_, iter) { if (!iter().isDict()) @@ -317,18 +205,12 @@ Foam::labelList Foam::zoltanRenumber::renumber void* meshPtr = &const_cast(mesh); - Zoltan_Set_Param(zz, "ORDER_TYPE", "LOCAL"); - Zoltan_Set_Num_Obj_Fn(zz, get_number_of_vertices, meshPtr); Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, meshPtr); // Callbacks for geometry Zoltan_Set_Num_Geom_Fn(zz, get_mesh_dim, meshPtr); Zoltan_Set_Geom_Multi_Fn(zz, get_geom_list, meshPtr); - - // Callbacks for connectivity - Zoltan_Set_Num_Edges_Multi_Fn(zz, get_num_edges_list, meshPtr); - Zoltan_Set_Edge_List_Multi_Fn(zz, get_edge_list, meshPtr); } // Local to global cell index mapper diff --git a/src/renumber/zoltanRenumber/zoltanRenumber.H b/src/renumber/zoltanRenumber/zoltanRenumber.H index 3f23995a0b..102214f427 100644 --- a/src/renumber/zoltanRenumber/zoltanRenumber.H +++ b/src/renumber/zoltanRenumber/zoltanRenumber.H @@ -32,7 +32,7 @@ Description Zoltan install: - in your ~/.bashrc: export ZOLTAN_ARCH_PATH=\ - $WM_THIRD_PARTY_DIR/platforms/linux64Gcc/Zoltan_XXX + $WM_THIRD_PARTY_DIR/platforms/linux64Gcc/Zoltan-XXX - unpack into $WM_THIRD_PARTY_DIR - cd Zoltan_XXX - mkdir build @@ -41,7 +41,7 @@ Description - export CXXFLAGS="-fPIC" - export CFLAGS="-fPIC" - ../configure \ - --prefix=$ZOLTAN_ARCH_DIR \ + --prefix=$ZOLTAN_ARCH_PATH \ --with-ccflags=-fPIC --with-cxxflags=-fPIC - make everything - make install