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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "lduAddressing.H"
|
#include "lduAddressing.H"
|
||||||
#include "demandDrivenData.H"
|
#include "demandDrivenData.H"
|
||||||
|
#include "scalarField.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * 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 "labelList.H"
|
||||||
#include "lduSchedule.H"
|
#include "lduSchedule.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -196,6 +197,9 @@ public:
|
|||||||
|
|
||||||
//- Return off-diagonal index given owner and neighbour label
|
//- Return off-diagonal index given owner and neighbour label
|
||||||
label triIndex(const label a, const label b) const;
|
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