Commit 50b549f3 authored by Henry Weller's avatar Henry Weller
Browse files

blockMesh: rationalizing class and member names

parent da70f673
......@@ -115,7 +115,7 @@ void Foam::vtkPV3blockMesh::updateInfoEdges
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const blockEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size();
forAll(edges, edgeI)
......@@ -429,7 +429,7 @@ void Foam::vtkPV3blockMesh::renderPointNumbers
if (show && meshPtr_)
{
const pointField& cornerPts = meshPtr_->blockPointField();
const pointField& cornerPts = meshPtr_->vertices();
const scalar scaleFactor = meshPtr_->scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
......
......@@ -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-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -55,7 +55,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField();
const Foam::pointField& blockPoints = blkMesh.vertices();
if (debug)
{
......@@ -148,7 +148,7 @@ void Foam::vtkPV3blockMesh::convertMeshEdges
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const blockEdgeList& edges = blkMesh.edges();
int edgeI = 0;
const scalar scaleFactor = blkMesh.scaleFactor();
......@@ -256,7 +256,7 @@ void Foam::vtkPV3blockMesh::convertMeshCorners
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const pointField& blockPoints = meshPtr_->blockPointField();
const pointField& blockPoints = meshPtr_->vertices();
const scalar& scaleFactor = meshPtr_->scaleFactor();
if (debug)
......
......@@ -115,7 +115,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const blockEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size();
forAll(edges, edgeI)
......@@ -429,7 +429,7 @@ void Foam::vtkPVblockMesh::renderPointNumbers
if (show && meshPtr_)
{
const pointField& cornerPts = meshPtr_->blockPointField();
const pointField& cornerPts = meshPtr_->vertices();
const scalar scaleFactor = meshPtr_->scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size());
......
......@@ -55,7 +55,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField();
const Foam::pointField& blockPoints = blkMesh.vertices();
if (debug)
{
......@@ -148,7 +148,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges();
const blockEdgeList& edges = blkMesh.edges();
int edgeI = 0;
const scalar scaleFactor = blkMesh.scaleFactor();
......@@ -256,7 +256,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0
const pointField& blockPoints = meshPtr_->blockPointField();
const pointField& blockPoints = meshPtr_->vertices();
const scalar& scaleFactor = meshPtr_->scaleFactor();
if (debug)
......
curvedEdges/BSpline.C
curvedEdges/CatmullRomSpline.C
curvedEdges/polyLine.C
blockEdges/BSpline.C
blockEdges/CatmullRomSpline.C
blockEdges/polyLine.C
curvedEdges/arcEdge.C
curvedEdges/curvedEdge.C
curvedEdges/lineEdge.C
curvedEdges/polyLineEdge.C
curvedEdges/lineDivide.C
curvedEdges/BSplineEdge.C
curvedEdges/splineEdge.C
blockEdges/arcEdge.C
blockEdges/blockEdge.C
blockEdges/lineEdge.C
blockEdges/polyLineEdge.C
blockEdges/lineDivide.C
blockEdges/BSplineEdge.C
blockEdges/splineEdge.C
gradingDescriptor/gradingDescriptor.C
gradingDescriptor/gradingDescriptors.C
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -23,20 +23,19 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::block::block
(
const pointField& blockPointField,
const curvedEdgeList& edges,
const pointField& vertices,
const blockEdgeList& edges,
Istream& is
)
:
blockDescriptor(blockPointField, edges, is),
vertices_(0),
blockDescriptor(vertices, edges, is),
points_(0),
cells_(0),
boundaryPatches_(0)
{}
......@@ -45,7 +44,7 @@ Foam::block::block
Foam::block::block(const blockDescriptor& blockDesc)
:
blockDescriptor(blockDesc),
vertices_(0),
points_(0),
cells_(0),
boundaryPatches_(0)
{}
......@@ -61,12 +60,12 @@ Foam::block::~block()
const Foam::pointField& Foam::block::points() const
{
if (vertices_.empty())
if (points_.empty())
{
createPoints();
}
return vertices_;
return points_;
}
......
......@@ -67,8 +67,8 @@ class block
{
// Private data
//- List of vertices
mutable pointField vertices_;
//- List of points
mutable pointField points_;
//- List of cells
mutable labelListList cells_;
......@@ -101,9 +101,9 @@ public:
//- Construct from components with Istream
block
(
const pointField& blockPointField,
const curvedEdgeList&,
Istream&
const pointField& vertices,
const blockEdgeList& edges,
Istream& is
);
//- Construct from a block definition
......@@ -116,6 +116,27 @@ public:
return autoPtr<block>(nullptr);
}
//- Class used for the read-construction of
// PtrLists of blocks
class iNew
{
const pointField& points_;
const blockEdgeList& edges_;
public:
iNew(const pointField& points, const blockEdgeList& edges)
:
points_(points),
edges_(edges)
{}
autoPtr<block> operator()(Istream& is) const
{
return autoPtr<block>(new block(points_, edges_, is));
}
};
//- Destructor
~block();
......
......@@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
......@@ -31,9 +30,9 @@ License
void Foam::block::createPoints() const
{
// Set local variables for mesh specification
const label ni = meshDensity().x();
const label nj = meshDensity().y();
const label nk = meshDensity().z();
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
const point& p000 = blockPoint(0);
const point& p100 = blockPoint(1);
......@@ -53,8 +52,8 @@ void Foam::block::createPoints() const
//
// Generate vertices
//
vertices_.clear();
vertices_.setSize(nPoints());
points_.clear();
points_.setSize(nPoints());
for (label k = 0; k <= nk; k++)
{
......@@ -218,14 +217,14 @@ void Foam::block::createPoints() const
// Add the contributions
vertices_[vertexNo] =
points_[vertexNo] =
(
edgex1 + edgex2 + edgex3 + edgex4
+ edgey1 + edgey2 + edgey3 + edgey4
+ edgez1 + edgez2 + edgez3 + edgez4
) / 3.0;
vertices_[vertexNo] +=
points_[vertexNo] +=
(
corx1 + corx2 + corx3 + corx4
+ cory1 + cory2 + cory3 + cory4
......@@ -239,9 +238,9 @@ void Foam::block::createPoints() const
void Foam::block::createCells() const
{
const label ni = meshDensity().x();
const label nj = meshDensity().y();
const label nk = meshDensity().z();
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
//
// Generate cells
......@@ -276,9 +275,9 @@ void Foam::block::createCells() const
void Foam::block::createBoundary() const
{
const label ni = meshDensity().x();
const label nj = meshDensity().y();
const label nk = meshDensity().z();
const label ni = density().x();
const label nj = density().y();
const label nk = density().z();
//
// Generate boundaries on each side of the hex
......@@ -457,7 +456,7 @@ void Foam::block::createBoundary() const
void Foam::block::clearGeom()
{
vertices_.clear();
points_.clear();
cells_.clear();
boundaryPatches_.clear();
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -30,8 +30,8 @@ inline Foam::label Foam::block::vtxLabel(label i, label j, label k) const
return
(
i
+ j * (meshDensity().x() + 1)
+ k * (meshDensity().x() + 1) * (meshDensity().y() + 1)
+ j * (density().x() + 1)
+ k * (density().x() + 1) * (density().y() + 1)
);
}
......
......@@ -38,17 +38,17 @@ void Foam::blockDescriptor::check(const Istream& is)
<< " in block " << *this
<< exit(FatalIOError);
}
else if (blockShape_[pi] >= blockPointField_.size())
else if (blockShape_[pi] >= vertices_.size())
{
FatalIOErrorInFunction(is)
<< "Point label " << blockShape_[pi]
<< " out of range 0.." << blockPointField_.size() - 1
<< " out of range 0.." << vertices_.size() - 1
<< " in block " << *this
<< exit(FatalIOError);
}
}
const point blockCentre(blockShape_.centre(blockPointField_));
const point blockCentre(blockShape_.centre(vertices_));
const faceList faces(blockShape_.faces());
// Check each face is outward-pointing with respect to the block centre
......@@ -57,8 +57,8 @@ void Foam::blockDescriptor::check(const Istream& is)
forAll(faces, i)
{
point faceCentre(faces[i].centre(blockPointField_));
vector faceNormal(faces[i].normal(blockPointField_));
point faceCentre(faces[i].centre(vertices_));
vector faceNormal(faces[i].normal(vertices_));
if (mag(faceNormal) > SMALL)
{
if (((faceCentre - blockCentre) & faceNormal) > 0)
......@@ -107,17 +107,17 @@ void Foam::blockDescriptor::check(const Istream& is)
Foam::blockDescriptor::blockDescriptor
(
const cellShape& bshape,
const pointField& blockPointField,
const curvedEdgeList& edges,
const Vector<label>& meshDensity,
const pointField& vertices,
const blockEdgeList& edges,
const Vector<label>& density,
const UList<gradingDescriptors>& expand,
const word& zoneName
)
:
blockPointField_(blockPointField),
curvedEdges_(edges),
vertices_(vertices),
edges_(edges),
blockShape_(bshape),
meshDensity_(meshDensity),
density_(density),
edgePoints_(12),
edgeWeights_(12),
expand_(expand),
......@@ -137,15 +137,15 @@ Foam::blockDescriptor::blockDescriptor
Foam::blockDescriptor::blockDescriptor
(
const pointField& blockPointField,
const curvedEdgeList& edges,
const pointField& vertices,
const blockEdgeList& edges,
Istream& is
)
:
blockPointField_(blockPointField),
curvedEdges_(edges),
vertices_(vertices),
edges_(edges),
blockShape_(is),
meshDensity_(),
density_(),
edgePoints_(12),
edgeWeights_(12),
expand_
......@@ -173,7 +173,7 @@ Foam::blockDescriptor::blockDescriptor
// New-style: read a list of 3 values
if (t.pToken() == token::BEGIN_LIST)
{
is >> meshDensity_;
is >> density_;
}
else
{
......@@ -188,9 +188,9 @@ Foam::blockDescriptor::blockDescriptor
else
{
// Old-style: read three labels
is >> meshDensity_.x()
>> meshDensity_.y()
>> meshDensity_.z();
is >> density_.x()
>> density_.y()
>> density_.z();
}
is >> t;
......@@ -250,73 +250,6 @@ Foam::blockDescriptor::~blockDescriptor()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::pointField& Foam::blockDescriptor::blockPointField() const
{
return blockPointField_;
}
const Foam::cellShape& Foam::blockDescriptor::blockShape() const
{
return blockShape_;
}
const Foam::List<Foam::List<Foam::point>>&
Foam::blockDescriptor::blockEdgePoints() const
{
return edgePoints_;
}
const Foam::scalarListList& Foam::blockDescriptor::blockEdgeWeights() const
{
return edgeWeights_;
}
const Foam::Vector<Foam::label>& Foam::blockDescriptor::meshDensity() const
{
return meshDensity_;
}
const Foam::word& Foam::blockDescriptor::zoneName() const
{
return zoneName_;
}
Foam::label Foam::blockDescriptor::nPoints() const
{
return
(
(meshDensity_.x() + 1)
* (meshDensity_.y() + 1)
* (meshDensity_.z() + 1)
);
}
Foam::label Foam::blockDescriptor::nCells() const
{
return
(
meshDensity_.x()
* meshDensity_.y()
* meshDensity_.z()
);
}
const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const
{
return blockPointField_[blockShape_[i]];
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
......@@ -341,7 +274,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
os << ' ' << bd.zoneName();
}
os << ' ' << bd.meshDensity()
os << ' ' << bd.density()
<< " simpleGrading (";
......@@ -374,13 +307,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
}
else
{
forAll(expand, edgeI)
forAll(expand, edgei)
{
if (edgeI)
if (edgei)
{
os << ' ';
}
os << expand[edgeI];
os << expand[edgei];
}
}
......
......@@ -55,7 +55,7 @@ SourceFiles
#include "cellShape.H"
#include "pointField.H"
#include "scalarList.H"
#include "curvedEdgeList.H"
#include "blockEdgeList.H"
#include "gradingDescriptors.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -79,16 +79,16 @@ class blockDescriptor
// Private data
//- Reference to point field defining the block mesh
const pointField& blockPointField_;
const pointField& vertices_;
//- Reference to a list of curved edges
const curvedEdgeList& curvedEdges_;
//- Reference to a list of block edges
const blockEdgeList& edges_;
//- Block shape
cellShape blockShape_;
//- The number of cells in the i,j,k directions
Vector<label> meshDensity_;
Vector<label> density_;
//- Block edge points
List<List<point>> edgePoints_;
......@@ -99,7 +99,7 @@ class blockDescriptor
//- Expansion ratios in all directions
List<gradingDescriptors> expand_;
//- Name of the zone (empty string if none)
//- Name of the zone (empty word if none)
word zoneName_;
......@@ -112,7 +112,7 @@ class blockDescriptor
void makeBlockEdges();
//- Set the edge points/weights
void setEdge(label edgeI, label start, label end, label dim);
void setEdge(label edgei, label start, label end, label dim);
// Private Member Functions
......@@ -129,9 +129,9 @@ public:
blockDescriptor
(
const cellShape&,
const pointField& blockPointField,
const curvedEdgeList&,
const Vector<label>& meshDensity,
const pointField& vertices,
const blockEdgeList&,
const Vector<label>& density,
const UList<gradingDescriptors>& expand,
const word& zoneName = ""
);
......@@ -139,18 +139,11 @@ public:
//- Construct from Istream
blockDescriptor
(
const pointField& blockPointField,
const curvedEdgeList&,
const pointField& vertices,
const blockEdgeList&,
Istream&
);
//- Clone
autoPtr<blockDescriptor> clone() const
{
NotImplemented;
return autoPtr<blockDescriptor>(nullptr);
}