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.
This commit is contained in:
Henry Weller
2021-12-20 22:48:37 +00:00
parent 7934ed693c
commit 526b3840c7
6 changed files with 22 additions and 154 deletions

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
//{

View File

@ -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> 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);

View File

@ -8,4 +8,5 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lmeshTools
-lmeshTools \
-L${ZOLTAN_ARCH_PATH}/lib64 -lzoltan

View File

@ -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<const Foam::polyMesh*>(data);
if ((nGID != 1) || (nLID != 1) || (nCells != mesh.nCells()))
{
*ierr = ZOLTAN_FATAL;
return;
}
for (Foam::label i=0; i<nCells; i++)
{
const Foam::cell& cFaces = mesh.cells()[localIDs[i]];
forAll(cFaces, cFacei)
{
Foam::label n = 0;
if (mesh.isInternalFace(cFaces[cFacei]))
{
n++;
}
numEdges[i] = n;
}
}
*ierr = ZOLTAN_OK;
}
static void get_edge_list
(
void* data,
int nGID,
int nLID,
int nCells,
ZOLTAN_ID_PTR globalIDs,
ZOLTAN_ID_PTR localIDs,
int* num_edges,
ZOLTAN_ID_PTR nborGID,
int* nborProc,
int wgt_dim,
float* ewgts,
int* ierr
)
{
const Foam::polyMesh& mesh = *static_cast<const Foam::polyMesh*>(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<const Foam::polyMesh*>(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<entry>, coeffsDict_, iter)
{
if (!iter().isDict())
@ -317,18 +205,12 @@ Foam::labelList Foam::zoltanRenumber::renumber
void* meshPtr = &const_cast<polyMesh&>(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

View File

@ -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