diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C index efdeba0c78..a54d490946 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -32,19 +32,12 @@ License void Foam::blockDescriptor::check(const Istream& is) { - forAll(blockShape_, pi) + for (const label pointi : blockShape_) { - if (blockShape_[pi] < 0) + if (pointi < 0 || pointi >= vertices_.size()) { FatalIOErrorInFunction(is) - << "Negative point label " << blockShape_[pi] - << " in block " << *this - << exit(FatalIOError); - } - else if (blockShape_[pi] >= vertices_.size()) - { - FatalIOErrorInFunction(is) - << "Point label " << blockShape_[pi] + << "Point label " << pointi << " out of range 0.." << vertices_.size() - 1 << " in block " << *this << exit(FatalIOError); @@ -108,22 +101,22 @@ void Foam::blockDescriptor::check(const Istream& is) void Foam::blockDescriptor::findCurvedFaces() { - const faceList blockFaces(blockShape().faces()); + const faceList shapeFaces(blockShape().faces()); - forAll(blockFaces, blockFacei) + forAll(shapeFaces, shapeFacei) { - forAll(faces_, facei) + forAll(blockFaces_, facei) { if ( face::sameVertices ( - faces_[facei].vertices(), - blockFaces[blockFacei] + blockFaces_[facei].vertices(), + shapeFaces[shapeFacei] ) ) { - curvedFaces_[blockFacei] = facei; + curvedFaces_[shapeFacei] = facei; nCurvedFaces_++; break; } @@ -146,8 +139,8 @@ Foam::blockDescriptor::blockDescriptor ) : vertices_(vertices), - edges_(edges), - faces_(faces), + blockEdges_(edges), + blockFaces_(faces), blockShape_(bshape), density_(density), expand_(expand), @@ -155,7 +148,11 @@ Foam::blockDescriptor::blockDescriptor curvedFaces_(-1), nCurvedFaces_(0) { - if (expand_.size() != 12) + if (expand_.empty()) + { + expand_.resize(12, gradingDescriptors()); + } + else if (expand_.size() != 12) { FatalErrorInFunction << "Unknown definition of expansion ratios" @@ -177,9 +174,9 @@ Foam::blockDescriptor::blockDescriptor ) : vertices_(vertices), - edges_(edges), - faces_(faces), - density_(), + blockEdges_(edges), + blockFaces_(faces), + density_(0, 0, 0), expand_(12, gradingDescriptors()), zoneName_(), curvedFaces_(-1), @@ -351,7 +348,7 @@ void Foam::blockDescriptor::correctFacePoints { if (curvedFaces_[blockFacei] != -1) { - faces_[curvedFaces_[blockFacei]].project + blockFaces_[curvedFaces_[blockFacei]].project ( *this, blockFacei, @@ -381,7 +378,7 @@ void Foam::blockDescriptor::write } -// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * // Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) { @@ -390,13 +387,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) os << bshape.model().name() << " ("; - forAll(blockLabels, labelI) + forAll(blockLabels, labeli) { - if (labelI) + if (labeli) { os << ' '; } - os << blockLabels[labelI]; + os << blockLabels[labeli]; } os << ')'; @@ -409,7 +406,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) << " simpleGrading ("; - const List& expand = bd.expand_; + const List& expand = bd.grading(); // Can we use a compact notation? if @@ -455,4 +452,23 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) } +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const InfoProxy& iproxy +) +{ + const blockDescriptor& bd = iproxy.t_; + + os << "Dimensions:" << bd.density() + << " nPoints:" << bd.nPoints() + << " nCells:" << bd.nCells() + << " nFaces:" << bd.nFaces() + << " nInternalFaces:" << bd.nInternalFaces() + << nl; + + return os; +} + + // ************************************************************************* // diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H index 0fa96fb44c..0b89d948d3 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2017 OpenFOAM Foundation @@ -63,35 +63,29 @@ SourceFiles #include "blockEdgeList.H" #include "blockFaceList.H" #include "gradingDescriptors.H" +#include "InfoProxy.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class Istream; -class Ostream; - -// Forward declaration of friend functions and operators -class blockDescriptor; -Ostream& operator<<(Ostream&, const blockDescriptor&); - /*---------------------------------------------------------------------------*\ Class blockDescriptor Declaration \*---------------------------------------------------------------------------*/ class blockDescriptor { - // Private data + // Private Data //- Reference to point field defining the block mesh const pointField& vertices_; //- Reference to a list of block edges - const blockEdgeList& edges_; + const blockEdgeList& blockEdges_; //- Reference to the list of curved faces - const blockFaceList& faces_; + const blockFaceList& blockFaces_; //- Block shape cellShape blockShape_; @@ -131,9 +125,6 @@ class blockDescriptor void findCurvedFaces(); - - // Private Member Functions - //- No copy assignment void operator=(const blockDescriptor&) = delete; @@ -145,10 +136,10 @@ public: //- Construct from components. Optional cellSet/zone name. blockDescriptor ( - const cellShape&, + const cellShape& bshape, const pointField& vertices, - const blockEdgeList&, - const blockFaceList&, + const blockEdgeList& edges, + const blockFaceList& faces, const Vector