blockMesh: rationalizing class and member names

This commit is contained in:
Henry Weller
2016-10-08 19:48:39 +01:00
parent 5d93489fe7
commit 3542700432
40 changed files with 373 additions and 398 deletions

View File

@ -115,7 +115,7 @@ void Foam::vtkPV3blockMesh::updateInfoEdges
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges(); const blockEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size(); const int nEdges = edges.size();
forAll(edges, edgeI) forAll(edges, edgeI)
@ -429,7 +429,7 @@ void Foam::vtkPV3blockMesh::renderPointNumbers
if (show && meshPtr_) if (show && meshPtr_)
{ {
const pointField& cornerPts = meshPtr_->blockPointField(); const pointField& cornerPts = meshPtr_->vertices();
const scalar scaleFactor = meshPtr_->scaleFactor(); const scalar scaleFactor = meshPtr_->scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size()); pointNumberTextActorsPtrs_.setSize(cornerPts.size());

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -55,7 +55,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField(); const Foam::pointField& blockPoints = blkMesh.vertices();
if (debug) if (debug)
{ {
@ -148,7 +148,7 @@ void Foam::vtkPV3blockMesh::convertMeshEdges
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges(); const blockEdgeList& edges = blkMesh.edges();
int edgeI = 0; int edgeI = 0;
const scalar scaleFactor = blkMesh.scaleFactor(); const scalar scaleFactor = blkMesh.scaleFactor();
@ -256,7 +256,7 @@ void Foam::vtkPV3blockMesh::convertMeshCorners
range.block(blockNo); // set output block range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const pointField& blockPoints = meshPtr_->blockPointField(); const pointField& blockPoints = meshPtr_->vertices();
const scalar& scaleFactor = meshPtr_->scaleFactor(); const scalar& scaleFactor = meshPtr_->scaleFactor();
if (debug) if (debug)

View File

@ -115,7 +115,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges(); const blockEdgeList& edges = blkMesh.edges();
const int nEdges = edges.size(); const int nEdges = edges.size();
forAll(edges, edgeI) forAll(edges, edgeI)
@ -429,7 +429,7 @@ void Foam::vtkPVblockMesh::renderPointNumbers
if (show && meshPtr_) if (show && meshPtr_)
{ {
const pointField& cornerPts = meshPtr_->blockPointField(); const pointField& cornerPts = meshPtr_->vertices();
const scalar scaleFactor = meshPtr_->scaleFactor(); const scalar scaleFactor = meshPtr_->scaleFactor();
pointNumberTextActorsPtrs_.setSize(cornerPts.size()); pointNumberTextActorsPtrs_.setSize(cornerPts.size());

View File

@ -55,7 +55,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.blockPointField(); const Foam::pointField& blockPoints = blkMesh.vertices();
if (debug) if (debug)
{ {
@ -148,7 +148,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_; const blockMesh& blkMesh = *meshPtr_;
const curvedEdgeList& edges = blkMesh.edges(); const blockEdgeList& edges = blkMesh.edges();
int edgeI = 0; int edgeI = 0;
const scalar scaleFactor = blkMesh.scaleFactor(); const scalar scaleFactor = blkMesh.scaleFactor();
@ -256,7 +256,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
range.block(blockNo); // set output block range.block(blockNo); // set output block
label datasetNo = 0; // restart at dataset 0 label datasetNo = 0; // restart at dataset 0
const pointField& blockPoints = meshPtr_->blockPointField(); const pointField& blockPoints = meshPtr_->vertices();
const scalar& scaleFactor = meshPtr_->scaleFactor(); const scalar& scaleFactor = meshPtr_->scaleFactor();
if (debug) if (debug)

View File

@ -1,14 +1,14 @@
curvedEdges/BSpline.C blockEdges/BSpline.C
curvedEdges/CatmullRomSpline.C blockEdges/CatmullRomSpline.C
curvedEdges/polyLine.C blockEdges/polyLine.C
curvedEdges/arcEdge.C blockEdges/arcEdge.C
curvedEdges/curvedEdge.C blockEdges/blockEdge.C
curvedEdges/lineEdge.C blockEdges/lineEdge.C
curvedEdges/polyLineEdge.C blockEdges/polyLineEdge.C
curvedEdges/lineDivide.C blockEdges/lineDivide.C
curvedEdges/BSplineEdge.C blockEdges/BSplineEdge.C
curvedEdges/splineEdge.C blockEdges/splineEdge.C
gradingDescriptor/gradingDescriptor.C gradingDescriptor/gradingDescriptor.C
gradingDescriptor/gradingDescriptors.C gradingDescriptor/gradingDescriptors.C

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,20 +23,19 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H" #include "block.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::block::block Foam::block::block
( (
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList& edges, const blockEdgeList& edges,
Istream& is Istream& is
) )
: :
blockDescriptor(blockPointField, edges, is), blockDescriptor(vertices, edges, is),
vertices_(0), points_(0),
cells_(0), cells_(0),
boundaryPatches_(0) boundaryPatches_(0)
{} {}
@ -45,7 +44,7 @@ Foam::block::block
Foam::block::block(const blockDescriptor& blockDesc) Foam::block::block(const blockDescriptor& blockDesc)
: :
blockDescriptor(blockDesc), blockDescriptor(blockDesc),
vertices_(0), points_(0),
cells_(0), cells_(0),
boundaryPatches_(0) boundaryPatches_(0)
{} {}
@ -61,12 +60,12 @@ Foam::block::~block()
const Foam::pointField& Foam::block::points() const const Foam::pointField& Foam::block::points() const
{ {
if (vertices_.empty()) if (points_.empty())
{ {
createPoints(); createPoints();
} }
return vertices_; return points_;
} }

View File

@ -67,8 +67,8 @@ class block
{ {
// Private data // Private data
//- List of vertices //- List of points
mutable pointField vertices_; mutable pointField points_;
//- List of cells //- List of cells
mutable labelListList cells_; mutable labelListList cells_;
@ -101,9 +101,9 @@ public:
//- Construct from components with Istream //- Construct from components with Istream
block block
( (
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList&, const blockEdgeList& edges,
Istream& Istream& is
); );
//- Construct from a block definition //- Construct from a block definition
@ -116,6 +116,27 @@ public:
return autoPtr<block>(nullptr); 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 //- Destructor
~block(); ~block();

View File

@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "block.H" #include "block.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -31,9 +30,9 @@ License
void Foam::block::createPoints() const void Foam::block::createPoints() const
{ {
// Set local variables for mesh specification // Set local variables for mesh specification
const label ni = meshDensity().x(); const label ni = density().x();
const label nj = meshDensity().y(); const label nj = density().y();
const label nk = meshDensity().z(); const label nk = density().z();
const point& p000 = blockPoint(0); const point& p000 = blockPoint(0);
const point& p100 = blockPoint(1); const point& p100 = blockPoint(1);
@ -53,8 +52,8 @@ void Foam::block::createPoints() const
// //
// Generate vertices // Generate vertices
// //
vertices_.clear(); points_.clear();
vertices_.setSize(nPoints()); points_.setSize(nPoints());
for (label k = 0; k <= nk; k++) for (label k = 0; k <= nk; k++)
{ {
@ -218,14 +217,14 @@ void Foam::block::createPoints() const
// Add the contributions // Add the contributions
vertices_[vertexNo] = points_[vertexNo] =
( (
edgex1 + edgex2 + edgex3 + edgex4 edgex1 + edgex2 + edgex3 + edgex4
+ edgey1 + edgey2 + edgey3 + edgey4 + edgey1 + edgey2 + edgey3 + edgey4
+ edgez1 + edgez2 + edgez3 + edgez4 + edgez1 + edgez2 + edgez3 + edgez4
) / 3.0; ) / 3.0;
vertices_[vertexNo] += points_[vertexNo] +=
( (
corx1 + corx2 + corx3 + corx4 corx1 + corx2 + corx3 + corx4
+ cory1 + cory2 + cory3 + cory4 + cory1 + cory2 + cory3 + cory4
@ -239,9 +238,9 @@ void Foam::block::createPoints() const
void Foam::block::createCells() const void Foam::block::createCells() const
{ {
const label ni = meshDensity().x(); const label ni = density().x();
const label nj = meshDensity().y(); const label nj = density().y();
const label nk = meshDensity().z(); const label nk = density().z();
// //
// Generate cells // Generate cells
@ -276,9 +275,9 @@ void Foam::block::createCells() const
void Foam::block::createBoundary() const void Foam::block::createBoundary() const
{ {
const label ni = meshDensity().x(); const label ni = density().x();
const label nj = meshDensity().y(); const label nj = density().y();
const label nk = meshDensity().z(); const label nk = density().z();
// //
// Generate boundaries on each side of the hex // Generate boundaries on each side of the hex
@ -457,7 +456,7 @@ void Foam::block::createBoundary() const
void Foam::block::clearGeom() void Foam::block::clearGeom()
{ {
vertices_.clear(); points_.clear();
cells_.clear(); cells_.clear();
boundaryPatches_.clear(); boundaryPatches_.clear();
} }

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -30,8 +30,8 @@ inline Foam::label Foam::block::vtxLabel(label i, label j, label k) const
return return
( (
i i
+ j * (meshDensity().x() + 1) + j * (density().x() + 1)
+ k * (meshDensity().x() + 1) * (meshDensity().y() + 1) + k * (density().x() + 1) * (density().y() + 1)
); );
} }

View File

@ -38,17 +38,17 @@ void Foam::blockDescriptor::check(const Istream& is)
<< " in block " << *this << " in block " << *this
<< exit(FatalIOError); << exit(FatalIOError);
} }
else if (blockShape_[pi] >= blockPointField_.size()) else if (blockShape_[pi] >= vertices_.size())
{ {
FatalIOErrorInFunction(is) FatalIOErrorInFunction(is)
<< "Point label " << blockShape_[pi] << "Point label " << blockShape_[pi]
<< " out of range 0.." << blockPointField_.size() - 1 << " out of range 0.." << vertices_.size() - 1
<< " in block " << *this << " in block " << *this
<< exit(FatalIOError); << exit(FatalIOError);
} }
} }
const point blockCentre(blockShape_.centre(blockPointField_)); const point blockCentre(blockShape_.centre(vertices_));
const faceList faces(blockShape_.faces()); const faceList faces(blockShape_.faces());
// Check each face is outward-pointing with respect to the block centre // 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) forAll(faces, i)
{ {
point faceCentre(faces[i].centre(blockPointField_)); point faceCentre(faces[i].centre(vertices_));
vector faceNormal(faces[i].normal(blockPointField_)); vector faceNormal(faces[i].normal(vertices_));
if (mag(faceNormal) > SMALL) if (mag(faceNormal) > SMALL)
{ {
if (((faceCentre - blockCentre) & faceNormal) > 0) if (((faceCentre - blockCentre) & faceNormal) > 0)
@ -107,17 +107,17 @@ void Foam::blockDescriptor::check(const Istream& is)
Foam::blockDescriptor::blockDescriptor Foam::blockDescriptor::blockDescriptor
( (
const cellShape& bshape, const cellShape& bshape,
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList& edges, const blockEdgeList& edges,
const Vector<label>& meshDensity, const Vector<label>& density,
const UList<gradingDescriptors>& expand, const UList<gradingDescriptors>& expand,
const word& zoneName const word& zoneName
) )
: :
blockPointField_(blockPointField), vertices_(vertices),
curvedEdges_(edges), edges_(edges),
blockShape_(bshape), blockShape_(bshape),
meshDensity_(meshDensity), density_(density),
edgePoints_(12), edgePoints_(12),
edgeWeights_(12), edgeWeights_(12),
expand_(expand), expand_(expand),
@ -137,15 +137,15 @@ Foam::blockDescriptor::blockDescriptor
Foam::blockDescriptor::blockDescriptor Foam::blockDescriptor::blockDescriptor
( (
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList& edges, const blockEdgeList& edges,
Istream& is Istream& is
) )
: :
blockPointField_(blockPointField), vertices_(vertices),
curvedEdges_(edges), edges_(edges),
blockShape_(is), blockShape_(is),
meshDensity_(), density_(),
edgePoints_(12), edgePoints_(12),
edgeWeights_(12), edgeWeights_(12),
expand_ expand_
@ -173,7 +173,7 @@ Foam::blockDescriptor::blockDescriptor
// New-style: read a list of 3 values // New-style: read a list of 3 values
if (t.pToken() == token::BEGIN_LIST) if (t.pToken() == token::BEGIN_LIST)
{ {
is >> meshDensity_; is >> density_;
} }
else else
{ {
@ -188,9 +188,9 @@ Foam::blockDescriptor::blockDescriptor
else else
{ {
// Old-style: read three labels // Old-style: read three labels
is >> meshDensity_.x() is >> density_.x()
>> meshDensity_.y() >> density_.y()
>> meshDensity_.z(); >> density_.z();
} }
is >> t; 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 * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd) 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.zoneName();
} }
os << ' ' << bd.meshDensity() os << ' ' << bd.density()
<< " simpleGrading ("; << " simpleGrading (";
@ -374,13 +307,13 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
} }
else else
{ {
forAll(expand, edgeI) forAll(expand, edgei)
{ {
if (edgeI) if (edgei)
{ {
os << ' '; os << ' ';
} }
os << expand[edgeI]; os << expand[edgei];
} }
} }

View File

@ -55,7 +55,7 @@ SourceFiles
#include "cellShape.H" #include "cellShape.H"
#include "pointField.H" #include "pointField.H"
#include "scalarList.H" #include "scalarList.H"
#include "curvedEdgeList.H" #include "blockEdgeList.H"
#include "gradingDescriptors.H" #include "gradingDescriptors.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,16 +79,16 @@ class blockDescriptor
// Private data // Private data
//- Reference to point field defining the block mesh //- Reference to point field defining the block mesh
const pointField& blockPointField_; const pointField& vertices_;
//- Reference to a list of curved edges //- Reference to a list of block edges
const curvedEdgeList& curvedEdges_; const blockEdgeList& edges_;
//- Block shape //- Block shape
cellShape blockShape_; cellShape blockShape_;
//- The number of cells in the i,j,k directions //- The number of cells in the i,j,k directions
Vector<label> meshDensity_; Vector<label> density_;
//- Block edge points //- Block edge points
List<List<point>> edgePoints_; List<List<point>> edgePoints_;
@ -99,7 +99,7 @@ class blockDescriptor
//- Expansion ratios in all directions //- Expansion ratios in all directions
List<gradingDescriptors> expand_; List<gradingDescriptors> expand_;
//- Name of the zone (empty string if none) //- Name of the zone (empty word if none)
word zoneName_; word zoneName_;
@ -112,7 +112,7 @@ class blockDescriptor
void makeBlockEdges(); void makeBlockEdges();
//- Set the edge points/weights //- 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 // Private Member Functions
@ -129,9 +129,9 @@ public:
blockDescriptor blockDescriptor
( (
const cellShape&, const cellShape&,
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList&, const blockEdgeList&,
const Vector<label>& meshDensity, const Vector<label>& density,
const UList<gradingDescriptors>& expand, const UList<gradingDescriptors>& expand,
const word& zoneName = "" const word& zoneName = ""
); );
@ -139,18 +139,11 @@ public:
//- Construct from Istream //- Construct from Istream
blockDescriptor blockDescriptor
( (
const pointField& blockPointField, const pointField& vertices,
const curvedEdgeList&, const blockEdgeList&,
Istream& Istream&
); );
//- Clone
autoPtr<blockDescriptor> clone() const
{
NotImplemented;
return autoPtr<blockDescriptor>(nullptr);
}
//- Destructor //- Destructor
~blockDescriptor(); ~blockDescriptor();
@ -160,38 +153,29 @@ public:
// Access // Access
//- Return the number of cells in the i,j,k directions
const Vector<label>& density() const
{
return meshDensity_;
}
//- Reference to point field defining the block mesh
const pointField& blockPointField() const;
//- Return the block shape //- Return the block shape
const cellShape& blockShape() const; inline const cellShape& blockShape() const;
//- Return the block points along each edge //- Return the block points along each edge
const List<List<point>>& blockEdgePoints() const; inline const List<List<point>>& blockEdgePoints() const;
//- Return the weightings along each edge //- Return the weightings along each edge
const scalarListList& blockEdgeWeights() const; inline const scalarListList& blockEdgeWeights() const;
//- Return the mesh density (number of cells) in the i,j,k directions //- Return the mesh density (number of cells) in the i,j,k directions
const Vector<label>& meshDensity() const; inline const Vector<label>& density() const;
//- Return the (optional) zone name //- Return the (optional) zone name
const word& zoneName() const; inline const word& zoneName() const;
//- Return the number of points //- Return the number of points
label nPoints() const; inline label nPoints() const;
//- Return the number of cells //- Return the number of cells
label nCells() const; inline label nCells() const;
//- Return block point at local label i //- Return block point for local label i
const point& blockPoint(const label i) const; inline const point& blockPoint(const label i) const;
// IOstream Operators // IOstream Operators
@ -206,6 +190,10 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "blockDescriptorI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,9 +31,9 @@ License
void Foam::blockDescriptor::makeBlockEdges() void Foam::blockDescriptor::makeBlockEdges()
{ {
const label ni = meshDensity_.x(); const label ni = density_.x();
const label nj = meshDensity_.y(); const label nj = density_.y();
const label nk = meshDensity_.z(); const label nk = density_.z();
// These edges correspond to the "hex" cellModel // These edges correspond to the "hex" cellModel
@ -59,7 +59,7 @@ void Foam::blockDescriptor::makeBlockEdges()
void Foam::blockDescriptor::setEdge void Foam::blockDescriptor::setEdge
( (
label edgeI, label edgei,
label start, label start,
label end, label end,
label nDiv label nDiv
@ -69,14 +69,14 @@ void Foam::blockDescriptor::setEdge
const labelList& blockLabels = blockShape_; const labelList& blockLabels = blockShape_;
// Get list of points for this block // Get list of points for this block
const pointField blockPoints = blockShape_.points(blockPointField_); const pointField blockPoints = blockShape_.points(vertices_);
// Set the edge points/weights // Set the edge points/weights
// The edge is a straight-line if it is not in the list of curvedEdges // The edge is a straight-line if it is not in the list of blockEdges
forAll(curvedEdges_, cedgeI) forAll(edges_, cedgei)
{ {
const curvedEdge& cedge = curvedEdges_[cedgeI]; const blockEdge& cedge = edges_[cedgei];
int cmp = cedge.compare(blockLabels[start], blockLabels[end]); int cmp = cedge.compare(blockLabels[start], blockLabels[end]);
@ -87,29 +87,29 @@ void Foam::blockDescriptor::setEdge
// Curve has the same orientation // Curve has the same orientation
// Divide the line // Divide the line
lineDivide divEdge(cedge, nDiv, expand_[edgeI]); lineDivide divEdge(cedge, nDiv, expand_[edgei]);
edgePoints_[edgeI] = divEdge.points(); edgePoints_[edgei] = divEdge.points();
edgeWeights_[edgeI] = divEdge.lambdaDivisions(); edgeWeights_[edgei] = divEdge.lambdaDivisions();
} }
else else
{ {
// Curve has the opposite orientation // Curve has the opposite orientation
// Divide the line // Divide the line
lineDivide divEdge(cedge, nDiv, expand_[edgeI].inv()); lineDivide divEdge(cedge, nDiv, expand_[edgei].inv());
const pointField& p = divEdge.points(); const pointField& p = divEdge.points();
const scalarList& d = divEdge.lambdaDivisions(); const scalarList& d = divEdge.lambdaDivisions();
edgePoints_[edgeI].setSize(p.size()); edgePoints_[edgei].setSize(p.size());
edgeWeights_[edgeI].setSize(d.size()); edgeWeights_[edgei].setSize(d.size());
label pMax = p.size() - 1; label pMax = p.size() - 1;
forAll(p, pI) forAll(p, pI)
{ {
edgePoints_[edgeI][pI] = p[pMax - pI]; edgePoints_[edgei][pI] = p[pMax - pI];
edgeWeights_[edgeI][pI] = 1.0 - d[pMax - pI]; edgeWeights_[edgei][pI] = 1.0 - d[pMax - pI];
} }
} }
@ -124,11 +124,11 @@ void Foam::blockDescriptor::setEdge
( (
lineEdge(blockPoints, start, end), lineEdge(blockPoints, start, end),
nDiv, nDiv,
expand_[edgeI] expand_[edgei]
); );
edgePoints_[edgeI] = divEdge.points(); edgePoints_[edgei] = divEdge.points();
edgeWeights_[edgeI] = divEdge.lambdaDivisions(); edgeWeights_[edgei] = divEdge.lambdaDivisions();
} }

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::cellShape& Foam::blockDescriptor::blockShape() const
{
return blockShape_;
}
inline const Foam::List<Foam::List<Foam::point>>&
Foam::blockDescriptor::blockEdgePoints() const
{
return edgePoints_;
}
inline const Foam::scalarListList&
Foam::blockDescriptor::blockEdgeWeights() const
{
return edgeWeights_;
}
inline const Foam::Vector<Foam::label>& Foam::blockDescriptor::density() const
{
return density_;
}
inline const Foam::word& Foam::blockDescriptor::zoneName() const
{
return zoneName_;
}
inline Foam::label Foam::blockDescriptor::nPoints() const
{
return
(
(density_.x() + 1)
* (density_.y() + 1)
* (density_.z() + 1)
);
}
inline Foam::label Foam::blockDescriptor::nCells() const
{
return
(
density_.x()
* density_.y()
* density_.z()
);
}
inline const Foam::point& Foam::blockDescriptor::blockPoint(const label i) const
{
return vertices_[blockShape_[i]];
}
// ************************************************************************* //

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -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) 2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ namespace Foam
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
curvedEdge, blockEdge,
BSplineEdge, BSplineEdge,
Istream Istream
); );
@ -52,14 +52,14 @@ Foam::BSplineEdge::BSplineEdge
const pointField& internalPoints const pointField& internalPoints
) )
: :
curvedEdge(points, start, end), blockEdge(points, start, end),
BSpline(appendEndPoints(points, start, end, internalPoints)) BSpline(appendEndPoints(points, start, end, internalPoints))
{} {}
Foam::BSplineEdge::BSplineEdge(const pointField& points, Istream& is) Foam::BSplineEdge::BSplineEdge(const pointField& points, Istream& is)
: :
curvedEdge(points, is), blockEdge(points, is),
BSpline(appendEndPoints(points, start_, end_, pointField(is))) BSpline(appendEndPoints(points, start_, end_, pointField(is)))
{ {
token t(is); token t(is);

View File

@ -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) 2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::BSplineEdge Foam::BSplineEdge
Description Description
A curvedEdge interface for B-splines. A blockEdge interface for B-splines.
SourceFiles SourceFiles
BSplineEdge.C BSplineEdge.C
@ -35,7 +35,7 @@ SourceFiles
#ifndef BSplineEdge_H #ifndef BSplineEdge_H
#define BSplineEdge_H #define BSplineEdge_H
#include "curvedEdge.H" #include "blockEdge.H"
#include "BSpline.H" #include "BSpline.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class BSplineEdge class BSplineEdge
: :
public curvedEdge, public blockEdge,
public BSpline public BSpline
{ {
// Private Member Functions // Private Member Functions

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(arcEdge, 0); defineTypeNameAndDebug(arcEdge, 0);
addToRunTimeSelectionTable(curvedEdge, arcEdge, Istream); addToRunTimeSelectionTable(blockEdge, arcEdge, Istream);
} }
@ -110,7 +110,7 @@ Foam::arcEdge::arcEdge
const point& pMid const point& pMid
) )
: :
curvedEdge(points, start, end), blockEdge(points, start, end),
p1_(points_[start_]), p1_(points_[start_]),
p2_(pMid), p2_(pMid),
p3_(points_[end_]), p3_(points_[end_]),
@ -120,7 +120,7 @@ Foam::arcEdge::arcEdge
Foam::arcEdge::arcEdge(const pointField& points, Istream& is) Foam::arcEdge::arcEdge(const pointField& points, Istream& is)
: :
curvedEdge(points, is), blockEdge(points, is),
p1_(points_[start_]), p1_(points_[start_]),
p2_(is), p2_(is),
p3_(points_[end_]), p3_(points_[end_]),

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ SourceFiles
#ifndef arcEdge_H #ifndef arcEdge_H
#define arcEdge_H #define arcEdge_H
#include "curvedEdge.H" #include "blockEdge.H"
#include "cylindricalCS.H" #include "cylindricalCS.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class arcEdge class arcEdge
: :
public curvedEdge public blockEdge
{ {
// Private data // Private data

View File

@ -24,20 +24,20 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H" #include "error.H"
#include "curvedEdge.H" #include "blockEdge.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(curvedEdge, 0); defineTypeNameAndDebug(blockEdge, 0);
defineRunTimeSelectionTable(curvedEdge, Istream); defineRunTimeSelectionTable(blockEdge, Istream);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::curvedEdge::curvedEdge Foam::blockEdge::blockEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -50,7 +50,7 @@ Foam::curvedEdge::curvedEdge
{} {}
Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is) Foam::blockEdge::blockEdge(const pointField& points, Istream& is)
: :
points_(points), points_(points),
start_(readLabel(is)), start_(readLabel(is)),
@ -58,7 +58,7 @@ Foam::curvedEdge::curvedEdge(const pointField& points, Istream& is)
{} {}
Foam::curvedEdge::curvedEdge(const curvedEdge& c) Foam::blockEdge::blockEdge(const blockEdge& c)
: :
points_(c.points_), points_(c.points_),
start_(c.start_), start_(c.start_),
@ -66,14 +66,14 @@ Foam::curvedEdge::curvedEdge(const curvedEdge& c)
{} {}
Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::clone() const Foam::autoPtr<Foam::blockEdge> Foam::blockEdge::clone() const
{ {
NotImplemented; NotImplemented;
return autoPtr<curvedEdge>(nullptr); return autoPtr<blockEdge>(nullptr);
} }
Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New Foam::autoPtr<Foam::blockEdge> Foam::blockEdge::New
( (
const pointField& points, const pointField& points,
Istream& is Istream& is
@ -81,7 +81,7 @@ Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
{ {
if (debug) if (debug)
{ {
InfoInFunction << "Constructing curvedEdge" << endl; InfoInFunction << "Constructing blockEdge" << endl;
} }
const word edgeType(is); const word edgeType(is);
@ -92,20 +92,20 @@ Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
if (cstrIter == IstreamConstructorTablePtr_->end()) if (cstrIter == IstreamConstructorTablePtr_->end())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown curvedEdge type " << "Unknown blockEdge type "
<< edgeType << nl << nl << edgeType << nl << nl
<< "Valid curvedEdge types are" << endl << "Valid blockEdge types are" << endl
<< IstreamConstructorTablePtr_->sortedToc() << IstreamConstructorTablePtr_->sortedToc()
<< abort(FatalError); << abort(FatalError);
} }
return autoPtr<curvedEdge>(cstrIter()(points, is)); return autoPtr<blockEdge>(cstrIter()(points, is));
} }
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::pointField Foam::curvedEdge::appendEndPoints Foam::pointField Foam::blockEdge::appendEndPoints
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -131,13 +131,13 @@ Foam::pointField Foam::curvedEdge::appendEndPoints
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::curvedEdge::operator=(const curvedEdge&) void Foam::blockEdge::operator=(const blockEdge&)
{ {
NotImplemented; NotImplemented;
} }
Foam::Ostream& Foam::operator<<(Ostream& os, const curvedEdge& p) Foam::Ostream& Foam::operator<<(Ostream& os, const blockEdge& p)
{ {
os << p.start_ << tab << p.end_ << endl; os << p.start_ << tab << p.end_ << endl;

View File

@ -22,19 +22,19 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::curvedEdge Foam::blockEdge
Description Description
Define a curved edge that is parameterized for 0<lambda<1 Define a curved edge that is parameterized for 0<lambda<1
between the start and end point. between the start and end point.
SourceFiles SourceFiles
curvedEdge.C blockEdge.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef curvedEdges_H #ifndef blockEdges_H
#define curvedEdges_H #define blockEdges_H
#include "edge.H" #include "edge.H"
#include "pointField.H" #include "pointField.H"
@ -49,16 +49,16 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class curvedEdge; class blockEdge;
Ostream& operator<<(Ostream&, const curvedEdge&); Ostream& operator<<(Ostream&, const blockEdge&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class curvedEdge Declaration Class blockEdge Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class curvedEdge class blockEdge
{ {
protected: protected:
@ -84,14 +84,14 @@ protected:
public: public:
//- Runtime type information //- Runtime type information
TypeName("curvedEdge"); TypeName("blockEdge");
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
declareRunTimeSelectionTable declareRunTimeSelectionTable
( (
autoPtr, autoPtr,
curvedEdge, blockEdge,
Istream, Istream,
( (
const pointField& points, const pointField& points,
@ -104,7 +104,7 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
curvedEdge blockEdge
( (
const pointField& points, const pointField& points,
const label start, const label start,
@ -112,19 +112,19 @@ public:
); );
//- Construct from Istream setting pointsList //- Construct from Istream setting pointsList
curvedEdge(const pointField&, Istream&); blockEdge(const pointField&, Istream&);
//- Copy construct //- Copy construct
curvedEdge(const curvedEdge&); blockEdge(const blockEdge&);
//- Clone function //- Clone function
virtual autoPtr<curvedEdge> clone() const; virtual autoPtr<blockEdge> clone() const;
//- New function which constructs and returns pointer to a curvedEdge //- New function which constructs and returns pointer to a blockEdge
static autoPtr<curvedEdge> New(const pointField&, Istream&); static autoPtr<blockEdge> New(const pointField&, Istream&);
//- Class used for the read-construction of //- Class used for the read-construction of
// PtrLists of curvedEdge // PtrLists of blockEdge
class iNew class iNew
{ {
const pointField& points_; const pointField& points_;
@ -136,15 +136,15 @@ public:
points_(points) points_(points)
{} {}
autoPtr<curvedEdge> operator()(Istream& is) const autoPtr<blockEdge> operator()(Istream& is) const
{ {
return curvedEdge::New(points_, is); return blockEdge::New(points_, is);
} }
}; };
//- Destructor //- Destructor
virtual ~curvedEdge(){} virtual ~blockEdge(){}
// Member Functions // Member Functions
@ -160,7 +160,7 @@ public:
// - 0: different // - 0: different
// - +1: identical // - +1: identical
// - -1: same edge, but different orientation // - -1: same edge, but different orientation
inline int compare(const curvedEdge&) const; inline int compare(const blockEdge&) const;
//- Compare the given start and end points with this curve //- Compare the given start and end points with this curve
// Return: // Return:
@ -186,12 +186,12 @@ public:
// Member operators // Member operators
void operator=(const curvedEdge&); void operator=(const blockEdge&);
// Ostream operator // Ostream operator
friend Ostream& operator<<(Ostream&, const curvedEdge&); friend Ostream& operator<<(Ostream&, const blockEdge&);
}; };
@ -201,7 +201,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "curvedEdgeI.H" #include "blockEdgeI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,19 +25,19 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::curvedEdge::start() const inline Foam::label Foam::blockEdge::start() const
{ {
return start_; return start_;
} }
inline Foam::label Foam::curvedEdge::end() const inline Foam::label Foam::blockEdge::end() const
{ {
return end_; return end_;
} }
inline int Foam::curvedEdge::compare(const label start, const label end) const inline int Foam::blockEdge::compare(const label start, const label end) const
{ {
if (start_ == start && end_ == end) if (start_ == start && end_ == end)
{ {
@ -54,15 +54,15 @@ inline int Foam::curvedEdge::compare(const label start, const label end) const
} }
inline int Foam::curvedEdge::compare(const curvedEdge& e) const inline int Foam::blockEdge::compare(const blockEdge& e) const
{ {
return Foam::curvedEdge::compare(e.start(), e.end()); return Foam::blockEdge::compare(e.start(), e.end());
} }
inline int Foam::curvedEdge::compare(const edge& e) const inline int Foam::blockEdge::compare(const edge& e) const
{ {
return Foam::curvedEdge::compare(e.start(), e.end()); return Foam::blockEdge::compare(e.start(), e.end());
} }

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,17 +22,17 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef Typedef
Foam::curvedEdgeList Foam::blockEdgeList
Description Description
A PtrList of curvedEdges A PtrList of blockEdges
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef curvedEdgeList_H #ifndef blockEdgeList_H
#define curvedEdgeList_H #define blockEdgeList_H
#include "curvedEdge.H" #include "blockEdge.H"
#include "PtrList.H" #include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,7 +42,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef PtrList<curvedEdge> curvedEdgeList; typedef PtrList<blockEdge> blockEdgeList;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "lineDivide.H" #include "lineDivide.H"
#include "curvedEdge.H" #include "blockEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,7 +42,7 @@ namespace Foam
Foam::lineDivide::lineDivide Foam::lineDivide::lineDivide
( (
const curvedEdge& cedge, const blockEdge& cedge,
const label nDiv, const label nDiv,
const gradingDescriptors& gd const gradingDescriptors& gd
) )

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,7 +44,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class curvedEdge; class blockEdge;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class lineDivide Declaration Class lineDivide Declaration
@ -65,7 +65,7 @@ public:
//- Construct from components //- Construct from components
lineDivide lineDivide
( (
const curvedEdge&, const blockEdge&,
const label ndiv, const label ndiv,
const gradingDescriptors& gd = gradingDescriptors() const gradingDescriptors& gd = gradingDescriptors()
); );

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(lineEdge, 0); defineTypeNameAndDebug(lineEdge, 0);
addToRunTimeSelectionTable(curvedEdge, lineEdge, Istream); addToRunTimeSelectionTable(blockEdge, lineEdge, Istream);
} }
@ -45,13 +45,13 @@ Foam::lineEdge::lineEdge
const label end const label end
) )
: :
curvedEdge(points, start, end) blockEdge(points, start, end)
{} {}
Foam::lineEdge::lineEdge(const pointField& points, Istream& is) Foam::lineEdge::lineEdge(const pointField& points, Istream& is)
: :
curvedEdge(points, is) blockEdge(points, is)
{} {}

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ SourceFiles
#ifndef lineEdge_H #ifndef lineEdge_H
#define lineEdge_H #define lineEdge_H
#include "curvedEdge.H" #include "blockEdge.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class lineEdge class lineEdge
: :
public curvedEdge public blockEdge
{ {
public: public:

View File

@ -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-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,7 +32,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(polyLineEdge, 0); defineTypeNameAndDebug(polyLineEdge, 0);
addToRunTimeSelectionTable(curvedEdge, polyLineEdge, Istream); addToRunTimeSelectionTable(blockEdge, polyLineEdge, Istream);
} }
@ -46,14 +46,14 @@ Foam::polyLineEdge::polyLineEdge
const pointField& otherPoints const pointField& otherPoints
) )
: :
curvedEdge(ps, start, end), blockEdge(ps, start, end),
polyLine(appendEndPoints(ps, start_, end_, otherPoints)) polyLine(appendEndPoints(ps, start_, end_, otherPoints))
{} {}
Foam::polyLineEdge::polyLineEdge(const pointField& ps, Istream& is) Foam::polyLineEdge::polyLineEdge(const pointField& ps, Istream& is)
: :
curvedEdge(ps, is), blockEdge(ps, is),
polyLine(appendEndPoints(ps, start_, end_, pointField(is))) polyLine(appendEndPoints(ps, start_, end_, pointField(is)))
{} {}

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::polyLineEdge Foam::polyLineEdge
Description Description
A curvedEdge defined in terms of a series of straight line segments. A blockEdge defined in terms of a series of straight line segments.
SourceFiles SourceFiles
polyLineEdge.C polyLineEdge.C
@ -35,7 +35,7 @@ SourceFiles
#ifndef polyLineEdge_H #ifndef polyLineEdge_H
#define polyLineEdge_H #define polyLineEdge_H
#include "curvedEdge.H" #include "blockEdge.H"
#include "polyLine.H" #include "polyLine.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class polyLineEdge class polyLineEdge
: :
public curvedEdge, public blockEdge,
public polyLine public polyLine
{ {
// Private Member Functions // Private Member Functions

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ namespace Foam
addToRunTimeSelectionTable addToRunTimeSelectionTable
( (
curvedEdge, blockEdge,
splineEdge, splineEdge,
Istream Istream
); );
@ -52,14 +52,14 @@ Foam::splineEdge::splineEdge
const pointField& internalPoints const pointField& internalPoints
) )
: :
curvedEdge(points, start, end), blockEdge(points, start, end),
CatmullRomSpline(appendEndPoints(points, start, end, internalPoints)) CatmullRomSpline(appendEndPoints(points, start, end, internalPoints))
{} {}
Foam::splineEdge::splineEdge(const pointField& points, Istream& is) Foam::splineEdge::splineEdge(const pointField& points, Istream& is)
: :
curvedEdge(points, is), blockEdge(points, is),
CatmullRomSpline(appendEndPoints(points, start_, end_, pointField(is))) CatmullRomSpline(appendEndPoints(points, start_, end_, pointField(is)))
{ {
token t(is); token t(is);

View File

@ -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-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::splineEdge Foam::splineEdge
Description Description
A curvedEdge interface for Catmull-Rom splines. A blockEdge interface for Catmull-Rom splines.
SourceFiles SourceFiles
splineEdge.C splineEdge.C
@ -35,7 +35,7 @@ SourceFiles
#ifndef splineEdge_H #ifndef splineEdge_H
#define splineEdge_H #define splineEdge_H
#include "curvedEdge.H" #include "blockEdge.H"
#include "CatmullRomSpline.H" #include "CatmullRomSpline.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace Foam
class splineEdge class splineEdge
: :
public curvedEdge, public blockEdge,
public CatmullRomSpline public CatmullRomSpline
{ {
// Private Member Functions // Private Member Functions

View File

@ -40,8 +40,8 @@ namespace Foam
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName) Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
: :
blockPointField_(dict.lookup("vertices")),
scaleFactor_(1.0), scaleFactor_(1.0),
vertices_(dict.lookup("vertices")),
topologyPtr_(createTopology(dict, regionName)) topologyPtr_(createTopology(dict, regionName))
{ {
Switch fastMerge(dict.lookupOrDefault<Switch>("fastMerge", false)); Switch fastMerge(dict.lookupOrDefault<Switch>("fastMerge", false));
@ -73,9 +73,9 @@ void Foam::blockMesh::verbose(const bool on)
} }
const Foam::pointField& Foam::blockMesh::blockPointField() const const Foam::pointField& Foam::blockMesh::vertices() const
{ {
return blockPointField_; return vertices_;
} }

View File

@ -45,7 +45,7 @@ SourceFiles
#include "blockList.H" #include "blockList.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "curvedEdgeList.H" #include "blockEdgeList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -65,15 +65,15 @@ class blockMesh
//- Switch for verbose output //- Switch for verbose output
static bool verboseOutput; static bool verboseOutput;
//- Point field defining the block mesh (corners)
pointField blockPointField_;
//- The list of curved edges
curvedEdgeList edges_;
//- The scaling factor to convert to metres //- The scaling factor to convert to metres
scalar scaleFactor_; scalar scaleFactor_;
//- Vertices defining the block mesh (corners)
pointField vertices_;
//- The list of curved edges
blockEdgeList edges_;
//- The blocks themselves (the topology) as a polyMesh //- The blocks themselves (the topology) as a polyMesh
polyMesh* topologyPtr_; polyMesh* topologyPtr_;
@ -166,15 +166,15 @@ public:
// Access // Access
//- Reference to point field defining the block mesh //- Reference to point field defining the blockMesh
// these points have not been scaled by scaleFactor // these points have not been scaled by scaleFactor
const pointField& blockPointField() const; const pointField& vertices() const;
//- Return the blockMesh topology as a polyMesh //- Return the blockMesh topology as a polyMesh
const polyMesh& topology() const; const polyMesh& topology() const;
//- Return the curved edges //- Return the curved edges
const curvedEdgeList& edges() const const blockEdgeList& edges() const
{ {
return edges_; return edges_;
} }

View File

@ -23,7 +23,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "error.H"
#include "blockMesh.H" #include "blockMesh.H"
#include "cellModeller.H" #include "cellModeller.H"
@ -50,7 +49,7 @@ void Foam::blockMesh::createPoints() const
if (verboseOutput) if (verboseOutput)
{ {
const Vector<label>& density = blocks[blockI].meshDensity(); const Vector<label>& density = blocks[blockI].density();
label v0 = blocks[blockI].vtxLabel(0, 0, 0); label v0 = blocks[blockI].vtxLabel(0, 0, 0);
label vi1 = blocks[blockI].vtxLabel(1, 0, 0); label vi1 = blocks[blockI].vtxLabel(1, 0, 0);

View File

@ -162,18 +162,18 @@ Pair<label> faceNij(const label facei, const block& block)
if (i == 0) if (i == 0)
{ {
fnij.first() = block.meshDensity().y() + 1; fnij.first() = block.density().y() + 1;
fnij.second() = block.meshDensity().z() + 1; fnij.second() = block.density().z() + 1;
} }
else if (i == 1) else if (i == 1)
{ {
fnij.first() = block.meshDensity().x() + 1; fnij.first() = block.density().x() + 1;
fnij.second() = block.meshDensity().z() + 1; fnij.second() = block.density().z() + 1;
} }
else if (i == 2) else if (i == 2)
{ {
fnij.first() = block.meshDensity().x() + 1; fnij.first() = block.density().x() + 1;
fnij.second() = block.meshDensity().y() + 1; fnij.second() = block.density().y() + 1;
} }
return fnij; return fnij;
@ -211,15 +211,15 @@ inline label facePoint
case 0: case 0:
return block.vtxLabel(0, i, j); return block.vtxLabel(0, i, j);
case 1: case 1:
return block.vtxLabel(block.meshDensity().x(), i, j); return block.vtxLabel(block.density().x(), i, j);
case 2: case 2:
return block.vtxLabel(i, 0, j); return block.vtxLabel(i, 0, j);
case 3: case 3:
return block.vtxLabel(i, block.meshDensity().y(), j); return block.vtxLabel(i, block.density().y(), j);
case 4: case 4:
return block.vtxLabel(i, j, 0); return block.vtxLabel(i, j, 0);
case 5: case 5:
return block.vtxLabel(i, j, block.meshDensity().z()); return block.vtxLabel(i, j, block.density().z());
default: default:
return -1; return -1;
} }
@ -236,9 +236,9 @@ inline label facePointN
{ {
return block.vtxLabel return block.vtxLabel
( (
unsignIndex(i, block.meshDensity().x()), unsignIndex(i, block.density().x()),
unsignIndex(j, block.meshDensity().y()), unsignIndex(j, block.density().y()),
unsignIndex(k, block.meshDensity().z()) unsignIndex(k, block.density().z())
); );
} }
@ -256,15 +256,15 @@ inline label facePointN
case 0: case 0:
return facePointN(block, 0, i, j); return facePointN(block, 0, i, j);
case 1: case 1:
return facePointN(block, block.meshDensity().x(), i, j); return facePointN(block, block.density().x(), i, j);
case 2: case 2:
return facePointN(block, i, 0, j); return facePointN(block, i, 0, j);
case 3: case 3:
return facePointN(block, i, block.meshDensity().y(), j); return facePointN(block, i, block.density().y(), j);
case 4: case 4:
return facePointN(block, i, j, 0); return facePointN(block, i, j, 0);
case 5: case 5:
return facePointN(block, i, j, block.meshDensity().z()); return facePointN(block, i, j, block.density().z());
default: default:
return -1; return -1;
} }

View File

@ -179,7 +179,7 @@ void Foam::blockMesh::readPatches
( (
patchStream, patchStream,
patchNames[nPatches], patchNames[nPatches],
blockPointField_, vertices_,
tmpBlocksPatches[nPatches] tmpBlocksPatches[nPatches]
); );
@ -292,7 +292,7 @@ void Foam::blockMesh::readBoundary
( (
patchInfo.dict(), patchInfo.dict(),
patchNames[patchi], patchNames[patchi],
blockPointField_, vertices_,
tmpBlocksPatches[patchi] tmpBlocksPatches[patchi]
); );
} }
@ -351,13 +351,13 @@ Foam::polyMesh* Foam::blockMesh::createTopology
Info<< "Creating block edges" << endl; Info<< "Creating block edges" << endl;
} }
curvedEdgeList blockEdges blockEdgeList edges
( (
meshDescription.lookup("edges"), meshDescription.lookup("edges"),
curvedEdge::iNew(blockPointField_) blockEdge::iNew(vertices_)
); );
edges_.transfer(blockEdges); edges_.transfer(edges);
} }
else if (verboseOutput) else if (verboseOutput)
{ {
@ -370,65 +370,13 @@ Foam::polyMesh* Foam::blockMesh::createTopology
{ {
Info<< "Creating topology blocks" << endl; Info<< "Creating topology blocks" << endl;
} }
{ {
ITstream& is(meshDescription.lookup("blocks")); blockList blocks
// Read number of blocks in mesh
label nBlocks = 0;
token firstToken(is);
if (firstToken.isLabel())
{
nBlocks = firstToken.labelToken();
blocks.setSize(nBlocks);
}
else
{
is.putBack(firstToken);
}
// Read beginning of blocks
is.readBegin("blocks");
nBlocks = 0;
token lastToken(is);
while
( (
!( meshDescription.lookup("blocks"),
lastToken.isPunctuation() block::iNew(vertices_, edges_)
&& lastToken.pToken() == token::END_LIST );
) transfer(blocks);
)
{
if (blocks.size() <= nBlocks)
{
blocks.setSize(nBlocks + 1);
}
is.putBack(lastToken);
blocks.set
(
nBlocks,
new block
(
blockPointField_,
edges_,
is
)
);
nBlocks++;
is >> lastToken;
}
is.putBack(lastToken);
// Read end of blocks
is.readEnd("blocks");
} }
@ -525,7 +473,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferCopy(blockPointField_), // Copy these points, do NOT move xferCopy(vertices_), // Copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames, patchNames,
@ -564,7 +512,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
), ),
xferCopy(blockPointField_), // Copy these points, do NOT move xferCopy(vertices_), // Copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames, patchNames,