Files
openfoam/src/mesh/blockMesh/gradingDescriptor/gradingDescriptors.C
Mark Olesen 48e3590bc8 ENH: minor blockMesh improvements
- avoid potential ambiguities in naming of mesh faces/edges
  vs. block faces/edges

- additional methods characterizing the number of faces
  (internal, boundary, total) associated with a blockDescriptor

- cellLabel() accessor and checkIndex() methods

- restore demand-driven behaviour of block, cache the calculated cells
  and refactor generation of block boundary faces to improve potential
  reuse.
2019-02-17 19:29:22 +01:00

104 lines
2.9 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2015 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "gradingDescriptors.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::gradingDescriptors::gradingDescriptors()
:
gradingDescriptors(gradingDescriptor())
{}
Foam::gradingDescriptors::gradingDescriptors(const gradingDescriptor& gd)
:
List<gradingDescriptor>(1, gd)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::gradingDescriptors Foam::gradingDescriptors::inv() const
{
gradingDescriptors ret(*this);
forAll(ret, i)
{
ret[i] = operator[](ret.size() - i - 1).inv();
}
return ret;
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, gradingDescriptors& gds)
{
// Examine next token
token t(is);
if (t.isNumber())
{
gds = gradingDescriptors(gradingDescriptor(t.number()));
}
else
{
is.putBack(t);
// Read the list for gradingDescriptors
is >> static_cast<List<gradingDescriptor>&>(gds);
// Check state of Istream
is.check(FUNCTION_NAME);
// Normalize the blockFractions and nDivFractions
// of the list of gradingDescriptors
scalar sumBlockFraction = 0;
scalar sumNDivFraction = 0;
forAll(gds, i)
{
sumBlockFraction += gds[i].blockFraction_;
sumNDivFraction += gds[i].nDivFraction_;
}
forAll(gds, i)
{
gds[i].blockFraction_ /= sumBlockFraction;
gds[i].nDivFraction_ /= sumNDivFraction;
}
}
return is;
}
// ************************************************************************* //