mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: lduAddressing: added profile calculation
This commit is contained in:
@ -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
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "lduAddressing.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "scalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -248,4 +249,28 @@ Foam::label Foam::lduAddressing::triIndex(const label a, const label b) const
|
||||
}
|
||||
|
||||
|
||||
Foam::Tuple2<Foam::label, Foam::scalar> Foam::lduAddressing::band() const
|
||||
{
|
||||
const labelUList& owner = lowerAddr();
|
||||
const labelUList& neighbour = upperAddr();
|
||||
|
||||
labelList cellBandwidth(size(), 0);
|
||||
|
||||
forAll(neighbour, faceI)
|
||||
{
|
||||
label own = owner[faceI];
|
||||
label nei = neighbour[faceI];
|
||||
|
||||
// Note: mag not necessary for correct (upper-triangular) ordering.
|
||||
label diff = nei-own;
|
||||
cellBandwidth[nei] = max(cellBandwidth[nei], diff);
|
||||
}
|
||||
|
||||
label bandwidth = max(cellBandwidth);
|
||||
scalar profile = sum(1.0*cellBandwidth);
|
||||
|
||||
return Tuple2<label, scalar>(bandwidth, profile);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -98,6 +98,7 @@ SourceFiles
|
||||
|
||||
#include "labelList.H"
|
||||
#include "lduSchedule.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -196,6 +197,9 @@ public:
|
||||
|
||||
//- Return off-diagonal index given owner and neighbour label
|
||||
label triIndex(const label a, const label b) const;
|
||||
|
||||
//- Calculate bandwidth and profile of addressing
|
||||
Tuple2<label, scalar> band() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user