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:
@ -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
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
|
||||||
@ -43,7 +43,9 @@ method CuthillMcKee;
|
|||||||
//method random;
|
//method random;
|
||||||
//method structured;
|
//method structured;
|
||||||
//method spring;
|
//method spring;
|
||||||
//method zoltan; // only if compiled with zoltan support
|
|
||||||
|
//method zoltan;
|
||||||
|
//libs ("libzoltanRenumber.so");
|
||||||
|
|
||||||
//CuthillMcKeeCoeffs
|
//CuthillMcKeeCoeffs
|
||||||
//{
|
//{
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Website: https://openfoam.org
|
\\ / O peration | Website: https://openfoam.org
|
||||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -28,6 +28,7 @@ InClass
|
|||||||
|
|
||||||
#include "renumberMethod.H"
|
#include "renumberMethod.H"
|
||||||
#include "decompositionMethod.H"
|
#include "decompositionMethod.H"
|
||||||
|
#include "dlLibraryTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -46,7 +47,14 @@ Foam::autoPtr<Foam::renumberMethod> Foam::renumberMethod::New
|
|||||||
{
|
{
|
||||||
const word methodType(renumberDict.lookup("method"));
|
const word methodType(renumberDict.lookup("method"));
|
||||||
|
|
||||||
// Info<< "Selecting renumberMethod " << methodType << endl;
|
Info<< "Selecting renumberMethod " << methodType << endl;
|
||||||
|
|
||||||
|
libs.open
|
||||||
|
(
|
||||||
|
renumberDict,
|
||||||
|
"libs",
|
||||||
|
dictionaryConstructorTablePtr_
|
||||||
|
);
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find(methodType);
|
dictionaryConstructorTablePtr_->find(methodType);
|
||||||
|
|||||||
@ -8,4 +8,5 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lmeshTools
|
-lmeshTools \
|
||||||
|
-L${ZOLTAN_ARCH_PATH}/lib64 -lzoltan
|
||||||
|
|||||||
@ -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)
|
static int get_mesh_dim(void* data, int* ierr)
|
||||||
{
|
{
|
||||||
const Foam::polyMesh& mesh = *static_cast<const Foam::polyMesh*>(data);
|
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)
|
Foam::zoltanRenumber::zoltanRenumber(const dictionary& renumberDict)
|
||||||
:
|
:
|
||||||
renumberMethod(renumberDict),
|
renumberMethod(renumberDict)
|
||||||
coeffsDict_(renumberDict.optionalSubDict(typeName+"Coeffs"))
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -301,6 +185,10 @@ Foam::labelList Foam::zoltanRenumber::renumber
|
|||||||
struct Zoltan_Struct *zz = Zoltan_Create(PstreamGlobals::MPI_COMM_FOAM);
|
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)
|
forAllConstIter(IDLList<entry>, coeffsDict_, iter)
|
||||||
{
|
{
|
||||||
if (!iter().isDict())
|
if (!iter().isDict())
|
||||||
@ -317,18 +205,12 @@ Foam::labelList Foam::zoltanRenumber::renumber
|
|||||||
|
|
||||||
void* meshPtr = &const_cast<polyMesh&>(mesh);
|
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_Num_Obj_Fn(zz, get_number_of_vertices, meshPtr);
|
||||||
Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, meshPtr);
|
Zoltan_Set_Obj_List_Fn(zz, get_vertex_list, meshPtr);
|
||||||
|
|
||||||
// Callbacks for geometry
|
// Callbacks for geometry
|
||||||
Zoltan_Set_Num_Geom_Fn(zz, get_mesh_dim, meshPtr);
|
Zoltan_Set_Num_Geom_Fn(zz, get_mesh_dim, meshPtr);
|
||||||
Zoltan_Set_Geom_Multi_Fn(zz, get_geom_list, 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
|
// Local to global cell index mapper
|
||||||
|
|||||||
@ -32,7 +32,7 @@ Description
|
|||||||
Zoltan install:
|
Zoltan install:
|
||||||
- in your ~/.bashrc:
|
- in your ~/.bashrc:
|
||||||
export ZOLTAN_ARCH_PATH=\
|
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
|
- unpack into $WM_THIRD_PARTY_DIR
|
||||||
- cd Zoltan_XXX
|
- cd Zoltan_XXX
|
||||||
- mkdir build
|
- mkdir build
|
||||||
@ -41,7 +41,7 @@ Description
|
|||||||
- export CXXFLAGS="-fPIC"
|
- export CXXFLAGS="-fPIC"
|
||||||
- export CFLAGS="-fPIC"
|
- export CFLAGS="-fPIC"
|
||||||
- ../configure \
|
- ../configure \
|
||||||
--prefix=$ZOLTAN_ARCH_DIR \
|
--prefix=$ZOLTAN_ARCH_PATH \
|
||||||
--with-ccflags=-fPIC --with-cxxflags=-fPIC
|
--with-ccflags=-fPIC --with-cxxflags=-fPIC
|
||||||
- make everything
|
- make everything
|
||||||
- make install
|
- make install
|
||||||
|
|||||||
Reference in New Issue
Block a user