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.
This commit is contained in:
Mark Olesen
2019-02-17 19:29:22 +01:00
committed by Andrew Heather
parent fe445ac516
commit 48e3590bc8
38 changed files with 585 additions and 448 deletions

View File

@ -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<gradingDescriptors>& expand = bd.expand_;
const List<gradingDescriptors>& 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<blockDescriptor>& 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;
}
// ************************************************************************* //

View File

@ -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<label>& density,
const UList<gradingDescriptors>& expand,
const word& zoneName = ""
@ -160,9 +151,9 @@ public:
const dictionary& dict,
const label index,
const pointField& vertices,
const blockEdgeList&,
const blockFaceList&,
Istream&
const blockEdgeList& edges,
const blockFaceList& faces,
Istream& is
);
@ -172,7 +163,7 @@ public:
inline const pointField& vertices() const;
//- Return reference to the list of curved faces
inline const blockFaceList& faces() const;
inline const blockFaceList& blockFaces() const;
//- Return the block shape
inline const cellShape& blockShape() const;
@ -180,15 +171,27 @@ public:
//- Return the mesh density (number of cells) in the i,j,k directions
inline const Vector<label>& density() const;
//- Expansion ratios in all directions
const List<gradingDescriptors>& grading() const;
//- Return the (optional) zone name
inline const word& zoneName() const;
//- Return the number of points
//- The number of meshed points described: (nx+1) * (ny+1) * (nz+1)
inline label nPoints() const;
//- Return the number of cells
//- The number of meshed cells described: (nx * ny * nz)
inline label nCells() const;
//- The number of meshed faces described
inline label nFaces() const;
//- The number of meshed internal faces described
inline label nInternalFaces() const;
//- The number of meshed internal faces described
inline label nBoundaryFaces() const;
//- Curved-face labels for each block-face (-1 for flat faces)
inline const FixedList<label, 6>& curvedFaces() const;
@ -198,6 +201,22 @@ public:
//- Return block point for local label i
inline const point& blockPoint(const label i) const;
//- Check indices are within valid range ni,nj,nk
inline void checkIndex
(
const label i,
const label j,
const label k
) const;
//- Cell label offset for a particular i,j,k position
inline label cellLabel
(
const label i,
const label j,
const label k
) const;
//- Vertex label offset for a particular i,j,k position
inline label pointLabel
(
@ -246,13 +265,21 @@ public:
//- Write block index with dictionary lookup
static void write(Ostream&, const label blocki, const dictionary&);
// IOstream Operators
friend Ostream& operator<<(Ostream&, const blockDescriptor&);
//- Return info proxy
inline InfoProxy<blockDescriptor> info() const
{
return *this;
}
};
//- Output Operator
Ostream& operator<<(Ostream& os, const blockDescriptor& bd);
//- Info output
Ostream& operator<<(Ostream& os, const InfoProxy<blockDescriptor>& info);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -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
@ -50,10 +50,8 @@ Foam::label Foam::blockDescriptor::edgePointsWeights
// Set the edge points/weights
// The edge is a straight-line if it is not in the list of blockEdges
forAll(edges_, cedgei)
for (const blockEdge& cedge : blockEdges_)
{
const blockEdge& cedge = edges_[cedgei];
const int cmp = cedge.compare(blockLabels[start], blockLabels[end]);
if (cmp)

View File

@ -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
@ -33,9 +33,9 @@ inline const Foam::pointField& Foam::blockDescriptor::vertices() const
}
inline const Foam::blockFaceList& Foam::blockDescriptor::faces() const
inline const Foam::blockFaceList& Foam::blockDescriptor::blockFaces() const
{
return faces_;
return blockFaces_;
}
@ -51,6 +51,13 @@ inline const Foam::Vector<Foam::label>& Foam::blockDescriptor::density() const
}
inline const Foam::List<Foam::gradingDescriptors>&
Foam::blockDescriptor::grading() const
{
return expand_;
}
inline const Foam::word& Foam::blockDescriptor::zoneName() const
{
return zoneName_;
@ -79,6 +86,39 @@ inline Foam::label Foam::blockDescriptor::nCells() const
}
inline Foam::label Foam::blockDescriptor::nFaces() const
{
return
(
((density_.x() + 1) * density_.y() * density_.z())
+ ((density_.y() + 1) * density_.z() * density_.x())
+ ((density_.z() + 1) * density_.x() * density_.y())
);
}
inline Foam::label Foam::blockDescriptor::nInternalFaces() const
{
return
(
((density_.x() - 1) * density_.y() * density_.z())
+ ((density_.y() - 1) * density_.z() * density_.x())
+ ((density_.z() - 1) * density_.x() * density_.y())
);
}
inline Foam::label Foam::blockDescriptor::nBoundaryFaces() const
{
return
(
(2 * density_.y() * density_.z())
+ (2 * density_.z() * density_.x())
+ (2 * density_.x() * density_.y())
);
}
inline const Foam::FixedList<Foam::label, 6>&
Foam::blockDescriptor::curvedFaces() const
{
@ -98,6 +138,46 @@ inline const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const
}
inline void Foam::blockDescriptor::checkIndex
(
const label i, const label j, const label k
) const
{
if (i < 0 || i >= density_.x())
{
FatalErrorInFunction
<< "index " << i << " out of range [0," << density_.x() << "]"
<< abort(FatalError);
}
if (j < 0 || j >= density_.y())
{
FatalErrorInFunction
<< "index " << j << " out of range [0," << density_.y() << "]"
<< abort(FatalError);
}
if (k < 0 || k >= density_.z())
{
FatalErrorInFunction
<< "index " << k << " out of range [0," << density_.z() << "]"
<< abort(FatalError);
}
}
inline Foam::label Foam::blockDescriptor::cellLabel
(
const label i,
const label j,
const label k
) const
{
#ifdef FULLDEBUG
checkIndex(i, j, k);
#endif
return (i + j*density_.x() + k*density_.x()*density_.y());
}
inline Foam::label Foam::blockDescriptor::pointLabel
(
const label i,
@ -105,12 +185,10 @@ inline Foam::label Foam::blockDescriptor::pointLabel
const label k
) const
{
return
(
i
+ j*(density_.x() + 1)
+ k*(density_.x() + 1)*(density_.y() + 1)
);
#ifdef FULLDEBUG
checkIndex(i, j, k);
#endif
return (i + j*(density_.x()+1) + k*(density_.x()+1)*(density_.y()+1));
}
@ -123,6 +201,7 @@ inline Foam::label Foam::blockDescriptor::facePointLabel
{
if (facei == 0 || facei == 1)
{
// x-min, x-max
return
(
i
@ -131,6 +210,7 @@ inline Foam::label Foam::blockDescriptor::facePointLabel
}
else if (facei == 2 || facei == 3)
{
// y-min, y-max
return
(
i
@ -139,6 +219,7 @@ inline Foam::label Foam::blockDescriptor::facePointLabel
}
else
{
// z-min, z-max
return
(
i

View File

@ -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) 2014-2016 OpenFOAM Foundation
@ -86,12 +86,6 @@ Foam::blockEdges::BSplineEdge::BSplineEdge
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::blockEdges::BSplineEdge::~BSplineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::blockEdges::BSplineEdge::position(const scalar mu) const

View File

@ -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) 2014-2016 OpenFOAM Foundation
@ -94,7 +94,7 @@ public:
//- Destructor
virtual ~BSplineEdge();
virtual ~BSplineEdge() = default;
// Member Functions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -68,12 +68,6 @@ Foam::blockEdges::bezier::bezier
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::blockEdges::bezier::~bezier()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::blockEdges::bezier::position(const scalar lambda) const

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -104,8 +104,8 @@ public:
);
//- Destructor
virtual ~bezier();
//- Destructor
virtual ~bezier() = default;
// Member Functions

View File

@ -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
@ -66,12 +66,6 @@ Foam::blockEdges::lineEdge::lineEdge
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
Foam::blockEdges::lineEdge::~lineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::blockEdges::lineEdge::position(const scalar lambda) const

View File

@ -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
@ -74,12 +74,12 @@ public:
const label index,
const searchableSurfaces& geometry,
const pointField&,
Istream&
Istream& is
);
//- Destructor
virtual ~lineEdge();
virtual ~lineEdge() = default;
// Member Functions

View File

@ -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
@ -69,12 +69,6 @@ Foam::blockEdges::polyLineEdge::polyLineEdge
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::blockEdges::polyLineEdge::~polyLineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::blockEdges::polyLineEdge::position(const scalar lambda) const

View File

@ -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
@ -89,12 +89,12 @@ public:
const label index,
const searchableSurfaces& geometry,
const pointField&,
Istream&
Istream& is
);
//- Destructor
virtual ~polyLineEdge();
//- Destructor
virtual ~polyLineEdge() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -55,7 +55,7 @@ class projectCurveEdge
:
public blockEdge
{
// Private data
// Private Data
const searchableSurfaces& geometry_;
@ -87,13 +87,12 @@ public:
const label index,
const searchableSurfaces& geometry,
const pointField& points,
Istream&
Istream& is
);
//- Destructor
virtual ~projectCurveEdge()
{}
virtual ~projectCurveEdge() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -55,7 +55,7 @@ class projectEdge
:
public blockEdge
{
// Private data
// Private Data
const searchableSurfaces& geometry_;
@ -90,13 +90,12 @@ public:
const label index,
const searchableSurfaces& geometry,
const pointField& points,
Istream&
Istream& is
);
//- Destructor
virtual ~projectEdge()
{}
virtual ~projectEdge() = default;
// Member Functions

View File

@ -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
@ -86,12 +86,6 @@ Foam::blockEdges::splineEdge::splineEdge
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::blockEdges::splineEdge::~splineEdge()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::point Foam::blockEdges::splineEdge::position(const scalar mu) const

View File

@ -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
@ -94,7 +94,7 @@ public:
//- Destructor
virtual ~splineEdge();
virtual ~splineEdge() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -79,10 +79,7 @@ Foam::autoPtr<Foam::blockFace> Foam::blockFace::New
Istream& is
)
{
if (debug)
{
InfoInFunction << "Constructing blockFace" << endl;
}
DebugInFunction << "Constructing blockFace" << endl;
const word faceType(is);
@ -112,7 +109,7 @@ void Foam::blockFace::write(Ostream& os, const dictionary& d) const
// Write contents
forAll(vertices_, i)
{
if (i > 0) os << token::SPACE;
if (i) os << token::SPACE;
blockVertex::write(os, vertices_[i], d);
}

View File

@ -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) 2016 OpenFOAM Foundation
@ -44,8 +44,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward declarations
class blockDescriptor;
class blockFace;
@ -98,7 +97,7 @@ public:
(
const dictionary& dict,
const label index,
Istream&
Istream& is
);
//- Clone function
@ -138,8 +137,7 @@ public:
//- Destructor
virtual ~blockFace()
{}
virtual ~blockFace() = default;
// Member Functions

View File

@ -52,13 +52,13 @@ const Foam::searchableSurface& Foam::blockFaces::projectFace::lookupSurface
Istream& is
) const
{
word name(is);
const word name(is);
forAll(geometry, i)
for (const searchableSurface& geom : geometry)
{
if (geometry[i].name() == name)
if (geom.name() == name)
{
return geometry[i];
return geom;
}
}

View File

@ -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) 2016 OpenFOAM Foundation
@ -55,7 +55,7 @@ class projectFace
:
public blockFace
{
// Private data
// Private Data
//- The surface onto which the points are projected
const searchableSurface& surface_;
@ -106,13 +106,12 @@ public:
const dictionary& dict,
const label index,
const searchableSurfaces& geometry,
Istream&
Istream& is
);
//- Destructor
virtual ~projectFace()
{}
virtual ~projectFace() = default;
// Member Functions

View File

@ -79,8 +79,7 @@ void Foam::blockMesh::check(const polyMesh& bm, const dictionary& dict) const
{
Info<< " Curved edge ";
edges_[cei].write(Info, dict);
Info<< " does not correspond to a block edge."
<< endl;
Info<< " does not correspond to a block edge." << endl;
ok = false;
}
}

View File

@ -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
@ -105,11 +105,11 @@ void Foam::blockMesh::createCells() const
cells_.setSize(nCells_);
label cellLabel = 0;
label celli = 0;
forAll(blocks, blocki)
{
const List<FixedList<label, 8>> blockCells(blocks[blocki].cells());
const List<FixedList<label, 8>>& blockCells = blocks[blocki].cells();
forAll(blockCells, blockCelli)
{
@ -126,9 +126,9 @@ void Foam::blockMesh::createCells() const
}
// Construct collapsed cell and add to list
cells_[cellLabel] = cellShape(hex, cellPoints, true);
cells_[celli] = cellShape(hex, cellPoints, true);
cellLabel++;
++celli;
}
}
}

View File

@ -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) 2015-2016 OpenFOAM Foundation
@ -87,6 +87,7 @@ void genFaceFaceRotMap()
}
}
// Return the direction map for the merge-faces
Pair<int> faceMap
(
@ -113,6 +114,7 @@ Pair<int> faceMap
return Pair<int>(0, 0);
}
// Set the block and face indices for all the merge faces
void setBlockFaceCorrespondence
(
@ -155,6 +157,7 @@ void setBlockFaceCorrespondence
}
}
// Return the number of divisions in each direction for the face
Pair<label> faceNij(const label facei, const block& block)
{
@ -181,24 +184,28 @@ Pair<label> faceNij(const label facei, const block& block)
return fnij;
}
// Sign the index corresponding to the map
inline label signIndex(const int map, const label i)
{
return map < 0 ? -i-1 : i;
}
// Reverse a signed index with the number of divisions
inline label unsignIndex(const label i, const label ni)
{
return i >= 0 ? i : ni + i + 1;
}
// Return the mapped index
inline label mapij(const int map, const label i, const label j)
{
return signIndex(map, mag(map) == 1 ? i : j);
}
// Return the face point index
inline label facePoint
(
@ -227,6 +234,7 @@ inline label facePoint
}
}
// Return the neighbour face point from the signed indices
inline label facePointN
(
@ -244,6 +252,7 @@ inline label facePointN
);
}
// Return the neighbour face point from the mapped indices
inline label facePointN
(
@ -272,6 +281,7 @@ inline label facePointN
}
}
// Return the neighbour face point using the map
inline label facePointN
(
@ -285,7 +295,7 @@ inline label facePointN
return facePointN(facei, block, mapij(fmap[0], i, j), mapij(fmap[1], i, j));
}
}
} // End namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -358,17 +368,11 @@ void Foam::blockMesh::calcMergeInfoFast()
mergeBlockN
);
if (debug)
{
Info<< endl;
}
DebugInfo << endl;
forAll(topoInternalFaces, topoFacei)
{
if (debug)
{
Info<< "Processing face " << topoFacei << endl;
}
DebugInfo << "Processing face " << topoFacei << endl;
label blockPi = mergeBlockP[topoFacei].first();
label blockPfacei = mergeBlockP[topoFacei].second();
@ -387,13 +391,11 @@ void Foam::blockMesh::calcMergeInfoFast()
)
);
if (debug)
{
Info<< " Face map for faces "
<< blocks[blockPi].blockShape().faces()[blockPfacei] << " "
<< blocks[blockNi].blockShape().faces()[blockNfacei] << ": "
<< fmap << endl;
}
DebugInfo
<< " Face map for faces "
<< blocks[blockPi].blockShape().faces()[blockPfacei] << " "
<< blocks[blockNi].blockShape().faces()[blockNfacei] << ": "
<< fmap << endl;
const pointField& blockPpoints = blocks[blockPi].points();
const pointField& blockNpoints = blocks[blockNi].points();
@ -482,11 +484,9 @@ void Foam::blockMesh::calcMergeInfoFast()
}
}
if (debug)
{
Info<< " Max distance between merge points: "
<< sqrt(maxSqrDist) << endl;
}
DebugInfo
<< " Max distance between merge points: "
<< sqrt(maxSqrDist) << endl;
}

View File

@ -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
@ -81,19 +81,12 @@ void Foam::blockMesh::checkPatchLabels
}
else
{
forAll(f, fp)
for (const label pointi : f)
{
if (f[fp] < 0)
if (pointi < 0 || pointi >= points.size())
{
FatalIOErrorInFunction(source)
<< "Negative point label " << f[fp] << nl
<< " on patch " << patchName << ", face " << facei
<< exit(FatalIOError);
}
else if (f[fp] >= points.size())
{
FatalIOErrorInFunction(source)
<< "Point label " << f[fp]
<< "Point label " << pointi
<< " out of range 0.." << points.size() - 1 << nl
<< " on patch " << patchName << ", face " << facei
<< exit(FatalIOError);

View File

@ -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) 2016 OpenFOAM Foundation
@ -50,7 +50,6 @@ namespace Foam
class blockVertex
{
public:
//- Runtime type information
@ -116,8 +115,7 @@ public:
//- Destructor
virtual ~blockVertex()
{}
virtual ~blockVertex() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -56,7 +56,7 @@ class namedVertex
{
protected:
// Protected member data
// Protected Member Data
//- The dictionary variable name for the vertex number
word name_;
@ -76,16 +76,15 @@ public:
//- Construct from Istream setting pointsList
namedVertex
(
const dictionary&,
const dictionary& dict,
const label index,
const searchableSurfaces& geometry,
Istream&
Istream& is
);
//- Destructor
virtual ~namedVertex()
{}
virtual ~namedVertex() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -72,16 +72,15 @@ public:
//- Construct from Istream setting pointsList
pointVertex
(
const dictionary&,
const dictionary& dict,
const label index,
const searchableSurfaces& geometry,
Istream&
Istream& is
);
//- Destructor
virtual ~pointVertex()
{}
virtual ~pointVertex() = default;
// Member Functions

View File

@ -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) 2016 OpenFOAM Foundation
@ -83,16 +83,15 @@ public:
//- Construct from Istream setting pointsList
projectVertex
(
const dictionary&,
const dictionary& dict,
const label index,
const searchableSurfaces& geometry,
Istream&
Istream& is
);
//- Destructor
virtual ~projectVertex()
{}
virtual ~projectVertex() = default;
// Member Functions

View File

@ -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
@ -48,11 +48,11 @@ Foam::block::block
const word& zoneName
)
:
blockDescriptor(bshape, vertices, edges, faces, density, expand, zoneName)
{
createPoints();
createBoundary();
}
blockDescriptor(bshape, vertices, edges, faces, density, expand, zoneName),
points_(),
blockCells_(),
blockPatches_()
{}
Foam::block::block
@ -65,22 +65,24 @@ Foam::block::block
Istream& is
)
:
blockDescriptor(dict, index, vertices, edges, faces, is)
{
createPoints();
createBoundary();
}
blockDescriptor(dict, index, vertices, edges, faces, is),
points_(),
blockCells_(),
blockPatches_()
{}
Foam::block::block(const blockDescriptor& blockDesc)
:
blockDescriptor(blockDesc)
{
createPoints();
createBoundary();
}
blockDescriptor(blockDesc),
points_(),
blockCells_(),
blockPatches_()
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::block> Foam::block::New
(
const dictionary& dict,
@ -91,10 +93,7 @@ Foam::autoPtr<Foam::block> Foam::block::New
Istream& is
)
{
if (debug)
{
InfoInFunction << "Constructing block" << endl;
}
DebugInFunction << "Constructing block" << endl;
const word blockOrCellShapeType(is);

View File

@ -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
@ -31,7 +31,8 @@ Description
cells in each direction and an expansion ratio.
Note
The vertices and cells for filling the block are demand-driven.
The vertices, cells, boundary patches for filling the block are
demand-driven.
SourceFiles
block.C
@ -43,8 +44,7 @@ SourceFiles
#define block_H
#include "pointField.H"
#include "labelList.H"
#include "faceList.H"
#include "blockDescriptor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,13 +52,6 @@ SourceFiles
namespace Foam
{
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
class block;
Ostream& operator<<(Ostream&, const block&);
/*---------------------------------------------------------------------------*\
Class block Declaration
\*---------------------------------------------------------------------------*/
@ -67,23 +60,38 @@ class block
:
public blockDescriptor
{
// Private data
// Private Data
//- List of points
pointField points_;
//- The cells (hex)
List<FixedList<label, 8>> blockCells_;
//- Boundary patches
FixedList<List<FixedList<label, 4>>, 6> boundaryPatches_;
FixedList<List<FixedList<label, 4>>, 6> blockPatches_;
// Private Member Functions
//- Creates vertices for cells filling the block
//- Create vertices for cells filling the block
void createPoints();
//- Creates boundary patch faces for the block
//- Create cells
void createCells();
//- Create boundary patch faces for the block
void createBoundary();
//- Add boundary faces to output list at iterator location
template<class OutputIterator>
OutputIterator addBoundaryFaces
(
const int shapeFacei,
OutputIterator iter
) const;
//- No copy construct
block(const block&) = delete;
@ -142,7 +150,7 @@ public:
);
//- Construct from a block definition
block(const blockDescriptor&);
block(const blockDescriptor& blockDesc);
//- Clone
autoPtr<block> clone() const
@ -197,30 +205,29 @@ public:
//- Destructor
virtual ~block()
{}
virtual ~block() = default;
// Member Functions
// Access
// Access
//- Return the points for filling the block
inline const pointField& points() const;
//- The points for filling the block
inline const pointField& points() const;
//- Return the cells for filling the block
List<FixedList<label, 8>> cells() const;
//- The cells for filling the block
inline const List<FixedList<label, 8>>& cells() const;
//- Return the boundary patch faces for the block
inline const FixedList<List<FixedList<label, 4>>, 6>&
boundaryPatches() const;
// Ostream Operator
friend Ostream& operator<<(Ostream&, const block&);
//- The boundary patch faces for the block
inline const FixedList<List<FixedList<label, 4>>, 6>&
boundaryPatches() const;
};
//- Ostream Operator
Ostream& operator<<(Ostream& os, const block& blk);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -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
@ -66,7 +66,7 @@ void Foam::block::createPoints()
scalarList w[12];
label nCurvedEdges = edgesPointsWeights(p, w);
points_.setSize(nPoints());
points_.resize(nPoints());
points_[pointLabel(0, 0, 0)] = p000;
points_[pointLabel(ni, 0, 0)] = p100;
@ -190,11 +190,11 @@ void Foam::block::createPoints()
FixedList<pointField, 6> facePoints(this->facePoints(points_));
correctFacePoints(facePoints);
// Loop over points and apply the correction from the from the i-faces
// Loop over points and apply the correction from the i-faces
for (label ii=0; ii<=ni; ii++)
{
// Process the points on the curved faces last
label i = (ii + 1)%(ni + 1);
const label i = (ii + 1)%(ni + 1);
for (label j=0; j<=nj; j++)
{
@ -242,11 +242,11 @@ void Foam::block::createPoints()
}
}
// Loop over points and apply the correction from the from the j-faces
// Loop over points and apply the correction from the j-faces
for (label jj=0; jj<=nj; jj++)
{
// Process the points on the curved faces last
label j = (jj + 1)%(nj + 1);
const label j = (jj + 1)%(nj + 1);
for (label i=0; i<=ni; i++)
{
@ -294,11 +294,11 @@ void Foam::block::createPoints()
}
}
// Loop over points and apply the correction from the from the k-faces
// Loop over points and apply the correction from the k-faces
for (label kk=0; kk<=nk; kk++)
{
// Process the points on the curved faces last
label k = (kk + 1)%(nk + 1);
const label k = (kk + 1)%(nk + 1);
for (label i=0; i<=ni; i++)
{
@ -348,163 +348,213 @@ void Foam::block::createPoints()
}
Foam::List<Foam::FixedList<Foam::label, 8>> Foam::block::cells() const
void Foam::block::createCells()
{
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
List<FixedList<label, 8>> cells(nCells());
blockCells_.resize(nCells()); // (ni*nj*nk)
label celli = 0;
for (label k=0; k<nk; k++)
for (label k=0; k<nk; ++k)
{
for (label j=0; j<nj; j++)
for (label j=0; j<nj; ++j)
{
for (label i=0; i<ni; i++)
for (label i=0; i<ni; ++i)
{
cells[celli][0] = pointLabel(i, j, k);
cells[celli][1] = pointLabel(i+1, j, k);
cells[celli][2] = pointLabel(i+1, j+1, k);
cells[celli][3] = pointLabel(i, j+1, k);
cells[celli][4] = pointLabel(i, j, k+1);
cells[celli][5] = pointLabel(i+1, j, k+1);
cells[celli][6] = pointLabel(i+1, j+1, k+1);
cells[celli][7] = pointLabel(i, j+1, k+1);
blockCells_[celli][0] = pointLabel(i, j, k);
blockCells_[celli][1] = pointLabel(i+1, j, k);
blockCells_[celli][2] = pointLabel(i+1, j+1, k);
blockCells_[celli][3] = pointLabel(i, j+1, k);
blockCells_[celli][4] = pointLabel(i, j, k+1);
blockCells_[celli][5] = pointLabel(i+1, j, k+1);
blockCells_[celli][6] = pointLabel(i+1, j+1, k+1);
blockCells_[celli][7] = pointLabel(i, j+1, k+1);
celli++;
++celli;
}
}
}
}
return cells;
template<class OutputIterator>
OutputIterator Foam::block::addBoundaryFaces
(
const int shapeFacei,
OutputIterator iter
) const
{
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
switch (shapeFacei)
{
// Face 0 == x-min
case 0:
{
for (label k=0; k<nk; ++k)
{
for (label j=0; j<nj; ++j)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(0, j, k);
f[1] = pointLabel(0, j, k+1);
f[2] = pointLabel(0, j+1, k+1);
f[3] = pointLabel(0, j+1, k);
}
}
}
break;
// Face 1 == x-max
case 1:
{
for (label k=0; k<nk; ++k)
{
for (label j=0; j<nj; ++j)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(ni, j, k);
f[1] = pointLabel(ni, j+1, k);
f[2] = pointLabel(ni, j+1, k+1);
f[3] = pointLabel(ni, j, k+1);
}
}
}
break;
// Face 2 == y-min
case 2:
{
for (label i=0; i<ni; ++i)
{
for (label k=0; k<nk; ++k)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(i, 0, k);
f[1] = pointLabel(i+1, 0, k);
f[2] = pointLabel(i+1, 0, k+1);
f[3] = pointLabel(i, 0, k+1);
}
}
}
break;
// Face 3 == y-max
case 3:
{
for (label i=0; i<ni; ++i)
{
for (label k=0; k<nk; ++k)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(i, nj, k);
f[1] = pointLabel(i, nj, k+1);
f[2] = pointLabel(i+1, nj, k+1);
f[3] = pointLabel(i+1, nj, k);
}
}
}
break;
// Face 4 == z-min
case 4:
{
for (label i=0; i<ni; ++i)
{
for (label j=0; j<nj; ++j)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(i, j, 0);
f[1] = pointLabel(i, j+1, 0);
f[2] = pointLabel(i+1, j+1, 0);
f[3] = pointLabel(i+1, j, 0);
}
}
}
break;
// Face 5 == z-max
case 5:
{
for (label i=0; i<ni; ++i)
{
for (label j=0; j<nj; ++j)
{
auto& f = *iter;
++iter;
f.resize(4);
f[0] = pointLabel(i, j, nk);
f[1] = pointLabel(i+1, j, nk);
f[2] = pointLabel(i+1, j+1, nk);
f[3] = pointLabel(i, j+1, nk);
}
}
}
break;
}
return iter;
}
void Foam::block::createBoundary()
{
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
const label countx = (density().y() * density().z());
const label county = (density().z() * density().x());
const label countz = (density().x() * density().y());
label patchi = 0;
label facei = 0;
int patchi = 0;
// x-direction
// 0 == x-min
blockPatches_[patchi].resize(countx);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
// x-min
boundaryPatches_[patchi].setSize(nj*nk);
for (label k=0; k<nk; k++)
{
for (label j=0; j<nj; j++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(0, j, k);
boundaryPatches_[patchi][facei][1] = pointLabel(0, j, k+1);
boundaryPatches_[patchi][facei][2] = pointLabel(0, j+1, k+1);
boundaryPatches_[patchi][facei][3] = pointLabel(0, j+1, k);
// 1 == x-max
blockPatches_[patchi].resize(countx);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
facei++;
}
}
// 2 == y-min
blockPatches_[patchi].resize(county);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
// x-max
patchi++;
facei = 0;
// 3 == y-max
blockPatches_[patchi].resize(county);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
boundaryPatches_[patchi].setSize(nj*nk);
// 4 == z-min
blockPatches_[patchi].resize(countz);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
for (label k=0; k<nk; k++)
{
for (label j=0; j<nj; j++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(ni, j, k);
boundaryPatches_[patchi][facei][1] = pointLabel(ni, j+1, k);
boundaryPatches_[patchi][facei][2] = pointLabel(ni, j+1, k+1);
boundaryPatches_[patchi][facei][3] = pointLabel(ni, j, k+1);
facei++;
}
}
// y-direction
// y-min
patchi++;
facei = 0;
boundaryPatches_[patchi].setSize(ni*nk);
for (label i=0; i<ni; i++)
{
for (label k=0; k<nk; k++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(i, 0, k);
boundaryPatches_[patchi][facei][1] = pointLabel(i+1, 0, k);
boundaryPatches_[patchi][facei][2] = pointLabel(i+1, 0, k+1);
boundaryPatches_[patchi][facei][3] = pointLabel(i, 0, k+1);
facei++;
}
}
// y-max
patchi++;
facei = 0;
boundaryPatches_[patchi].setSize(ni*nk);
for (label i=0; i<ni; i++)
{
for (label k=0; k<nk; k++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(i, nj, k);
boundaryPatches_[patchi][facei][1] = pointLabel(i, nj, k+1);
boundaryPatches_[patchi][facei][2] = pointLabel(i+1, nj, k+1);
boundaryPatches_[patchi][facei][3] = pointLabel(i+1, nj, k);
facei++;
}
}
// z-direction
// z-min
patchi++;
facei = 0;
boundaryPatches_[patchi].setSize(ni*nj);
for (label i=0; i<ni; i++)
{
for (label j=0; j<nj; j++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(i, j, 0);
boundaryPatches_[patchi][facei][1] = pointLabel(i, j+1, 0);
boundaryPatches_[patchi][facei][2] = pointLabel(i+1, j+1, 0);
boundaryPatches_[patchi][facei][3] = pointLabel(i+1, j, 0);
facei++;
}
}
// z-max
patchi++;
facei = 0;
boundaryPatches_[patchi].setSize(ni*nj);
for (label i=0; i<ni; i++)
{
for (label j=0; j<nj; j++)
{
boundaryPatches_[patchi][facei][0] = pointLabel(i, j, nk);
boundaryPatches_[patchi][facei][1] = pointLabel(i+1, j, nk);
boundaryPatches_[patchi][facei][2] = pointLabel(i+1, j+1, nk);
boundaryPatches_[patchi][facei][3] = pointLabel(i, j+1, nk);
facei++;
}
}
// 5 == z-max
blockPatches_[patchi].resize(countz);
addBoundaryFaces(patchi, blockPatches_[patchi].begin());
++patchi;
}

View File

@ -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
@ -29,14 +29,36 @@ License
inline const Foam::pointField& Foam::block::points() const
{
if (points_.empty())
{
const_cast<block&>(*this).createPoints();
}
return points_;
}
inline const Foam::List<Foam::FixedList<Foam::label, 8>>&
Foam::block::cells() const
{
if (blockCells_.empty())
{
const_cast<block&>(*this).createCells();
}
return blockCells_;
}
inline const Foam::FixedList<Foam::List<Foam::FixedList<Foam::label, 4>>, 6>&
Foam::block::boundaryPatches() const
{
return boundaryPatches_;
if (blockPatches_.empty())
{
const_cast<block&>(*this).createBoundary();
}
return blockPatches_;
}

View File

@ -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) 2016 OpenFOAM Foundation
@ -34,7 +34,7 @@ namespace Foam
{
namespace blocks
{
defineTypeNameAndDebug(namedBlock, 0);
defineTypeName(namedBlock);
addToRunTimeSelectionTable(block, namedBlock, Istream);
}
}
@ -57,6 +57,7 @@ Foam::blocks::namedBlock::namedBlock
{
dictionary& d = const_cast<dictionary&>(dict);
dictionary* varDictPtr = d.findDict("namedBlocks");
if (varDictPtr)
{
varDictPtr->add(*this, index);

View File

@ -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) 2016 OpenFOAM Foundation
@ -58,12 +58,12 @@ class namedBlock
public:
//- Runtime type information
TypeName("name");
TypeNameNoDebug("name");
// Constructors
//- Construct from Istream setting pointsList
//- Construct from Istream setting points list
namedBlock
(
const dictionary& dict,
@ -76,8 +76,7 @@ public:
//- Destructor
virtual ~namedBlock()
{}
virtual ~namedBlock() = default;
};

View File

@ -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) 2015 OpenFOAM Foundation
@ -57,8 +57,8 @@ Foam::gradingDescriptor::gradingDescriptor
const scalar expansionRatio
)
:
blockFraction_(1.0),
nDivFraction_(1.0),
blockFraction_(1),
nDivFraction_(1),
expansionRatio_(expansionRatio)
{}
@ -69,12 +69,6 @@ Foam::gradingDescriptor::gradingDescriptor(Istream& is)
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::gradingDescriptor::~gradingDescriptor()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::gradingDescriptor Foam::gradingDescriptor::inv() const

View File

@ -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) 2015 OpenFOAM Foundation
@ -68,7 +68,7 @@ Ostream& operator<<(Ostream&, const gradingDescriptor&);
class gradingDescriptor
{
// Private data
// Private Data
scalar blockFraction_;
scalar nDivFraction_;
@ -94,46 +94,42 @@ public:
);
//- Construct from expansionRatio
gradingDescriptor
(
const scalar expansionRatio
);
explicit gradingDescriptor(const scalar expansionRatio);
//- Construct from Istream
gradingDescriptor(Istream&);
explicit gradingDescriptor(Istream& is);
//- Destructor
~gradingDescriptor();
~gradingDescriptor() = default;
// Member Functions
// Access
// Access
scalar blockFraction() const
{
return blockFraction_;
}
scalar blockFraction() const
{
return blockFraction_;
}
scalar nDivFraction() const
{
return nDivFraction_;
}
scalar nDivFraction() const
{
return nDivFraction_;
}
scalar expansionRatio() const
{
return expansionRatio_;
}
scalar expansionRatio() const
{
return expansionRatio_;
}
// Member functions
// Member Functions
//- Return the inverse gradingDescriptor with 1/expansionRatio
gradingDescriptor inv() const;
// Member operators
// Member Operators
bool operator==(const gradingDescriptor&) const;
bool operator!=(const gradingDescriptor&) const;

View File

@ -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) 2015 OpenFOAM Foundation
@ -31,7 +31,7 @@ License
Foam::gradingDescriptors::gradingDescriptors()
:
List<gradingDescriptor>(1, gradingDescriptor())
gradingDescriptors(gradingDescriptor())
{}

View File

@ -46,12 +46,11 @@ SourceFiles
namespace Foam
{
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
// Forward declarations
class gradingDescriptors;
Istream& operator>>(Istream&, gradingDescriptors&);
class Istream;
Istream& operator>>(Istream& is, gradingDescriptors& gd);
/*---------------------------------------------------------------------------*\
Class gradingDescriptors Declaration
@ -61,7 +60,6 @@ class gradingDescriptors
:
public List<gradingDescriptor>
{
public:
// Constructors
@ -73,7 +71,7 @@ public:
gradingDescriptors(const gradingDescriptor& gd);
// Member functions
// Member Functions
//- Return the inverse gradingDescriptors with 1/expansionRatio
gradingDescriptors inv() const;