From 0cf8430802abd4f9b2acea68567c862b6ec54bbb Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 16 Jul 2013 21:28:42 +0100 Subject: [PATCH] ENH: renumberMethods: addressing in losort form --- .../CuthillMcKeeRenumber.C | 20 ++++++++++++++++- .../CuthillMcKeeRenumber.H | 13 ++++++++++- .../renumberMethod/renumberMethod.C | 22 ++++++++++++++++++- .../renumberMethod/renumberMethod.H | 13 ++++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.C b/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.C index a756b2c514..fae937cb39 100644 --- a/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.C +++ b/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -86,6 +86,24 @@ Foam::labelList Foam::CuthillMcKeeRenumber::renumber } +Foam::labelList Foam::CuthillMcKeeRenumber::renumber +( + const labelList& cellCells, + const labelList& offsets, + const pointField& cc +) const +{ + labelList orderedToOld = bandCompression(cellCells, offsets); + + if (reverse_) + { + reverse(orderedToOld); + } + + return orderedToOld; +} + + Foam::labelList Foam::CuthillMcKeeRenumber::renumber ( const labelListList& cellCells, diff --git a/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.H b/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.H index 237b828e25..25484a82f2 100644 --- a/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.H +++ b/src/renumber/renumberMethods/CuthillMcKeeRenumber/CuthillMcKeeRenumber.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -98,6 +98,17 @@ public: const pointField& cc ) const; + //- Return the order in which cells need to be visited, i.e. + // from ordered back to original cell label. + // Connectivity in losort addressing (= neighbour + offsets into + // neighbour) + virtual labelList renumber + ( + const labelList& cellCells, + const labelList& offsets, + const pointField& cc + ) const; + //- Return the order in which cells need to be visited, i.e. // from ordered back to original cell label. // The connectivity is equal to mesh.cellCells() except diff --git a/src/renumber/renumberMethods/renumberMethod/renumberMethod.C b/src/renumber/renumberMethods/renumberMethod/renumberMethod.C index 76ba1911e2..ea12a22519 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 | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -89,6 +89,26 @@ Foam::labelList Foam::renumberMethod::renumber } +Foam::labelList Foam::renumberMethod::renumber +( + const labelList& cellCells, + const labelList& offsets, + const pointField& cc +) const +{ + notImplemented + ( + "renumberMethod::renumber\n" + "(\n" + " const labelList&,\n" + " const labelList&,\n" + " const pointField&\n" + ") const" + ); + return labelList(); +} + + Foam::labelList Foam::renumberMethod::renumber ( const polyMesh& mesh, diff --git a/src/renumber/renumberMethods/renumberMethod/renumberMethod.H b/src/renumber/renumberMethods/renumberMethod/renumberMethod.H index b7b02f2dbd..7808e53f49 100644 --- a/src/renumber/renumberMethods/renumberMethod/renumberMethod.H +++ b/src/renumber/renumberMethods/renumberMethod/renumberMethod.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -126,6 +126,17 @@ public: // Use the mesh connectivity (if needed) virtual labelList renumber(const polyMesh&, const pointField&) const; + //- Return the order in which cells need to be visited, i.e. + // from ordered back to original cell label. + // Addresing in losort addressing (= neighbour + offsets into + // neighbour) + virtual labelList renumber + ( + const labelList& cellCells, + const labelList& offsets, + const pointField& + ) const; + //- Return the order in which cells need to be visited, i.e. // from ordered back to original cell label. // Gets passed agglomeration map (from fine to coarse cells) and coarse