mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
blockMesh: misc code cleanup
This commit is contained in:
@ -146,7 +146,9 @@ public:
|
||||
const labelListListList& boundaryPatches() const;
|
||||
|
||||
|
||||
//- Clear geometry
|
||||
// Edit
|
||||
|
||||
//- Clear geometry (internal points, cells, boundaryPatches)
|
||||
void clearGeom();
|
||||
|
||||
|
||||
|
||||
@ -165,6 +165,11 @@ public:
|
||||
label numZonedBlocks() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Clear geometry (internal points, cells, boundaryPatches)
|
||||
void clearGeom();
|
||||
|
||||
// Write
|
||||
|
||||
//- Writes edges of blockMesh in OBJ format.
|
||||
|
||||
@ -32,7 +32,7 @@ License
|
||||
|
||||
void Foam::blockMesh::createPoints() const
|
||||
{
|
||||
const blockMesh& blocks = *this;
|
||||
const blockList& blocks = *this;
|
||||
|
||||
Info<< "Creating points with scale " << scaleFactor_ << endl;
|
||||
|
||||
@ -62,7 +62,7 @@ void Foam::blockMesh::createPoints() const
|
||||
|
||||
void Foam::blockMesh::createCells() const
|
||||
{
|
||||
const blockMesh& blocks = *this;
|
||||
const blockList& blocks = *this;
|
||||
const cellModel& hex = *(cellModeller::lookup("hex"));
|
||||
|
||||
Info<< "Creating cells" << endl;
|
||||
@ -107,7 +107,7 @@ Foam::faceList Foam::blockMesh::createPatchFaces
|
||||
const polyPatch& patchTopologyFaces
|
||||
) const
|
||||
{
|
||||
const blockMesh& blocks = *this;
|
||||
const blockList& blocks = *this;
|
||||
|
||||
labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
|
||||
|
||||
@ -237,4 +237,15 @@ void Foam::blockMesh::createPatches() const
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Foam::blockMesh::clearGeom()
|
||||
{
|
||||
blockList& blocks = *this;
|
||||
|
||||
forAll(blocks, blockI)
|
||||
{
|
||||
blocks[blockI].clearGeom();
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
|
||||
void Foam::blockMesh::calcMergeInfo()
|
||||
{
|
||||
const blockMesh& blocks = *this;
|
||||
const blockList& blocks = *this;
|
||||
|
||||
Info<< "Creating block offsets" << endl;
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
|
||||
{
|
||||
bool topologyOK = true;
|
||||
|
||||
blockMesh& blocks = *this;
|
||||
blockList& blocks = *this;
|
||||
|
||||
word defaultPatchName = "defaultFaces";
|
||||
word defaultPatchType = emptyPolyPatch::typeName;
|
||||
|
||||
@ -119,7 +119,7 @@ Foam::BSpline::BSpline
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::BSpline::realPosition(scalar mu)
|
||||
Foam::vector Foam::BSpline::realPosition(const scalar mu) const
|
||||
{
|
||||
return spline::position(mu);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public:
|
||||
|
||||
//- Return the real position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
vector realPosition(scalar lambda);
|
||||
vector realPosition(const scalar lambda) const;
|
||||
|
||||
//- Return the position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
|
||||
@ -108,7 +108,7 @@ Foam::autoPtr<Foam::curvedEdge> Foam::curvedEdge::New
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointField Foam::knotlist
|
||||
Foam::pointField Foam::curvedEdge::knotlist
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
@ -116,19 +116,19 @@ Foam::pointField Foam::knotlist
|
||||
const pointField& otherknots
|
||||
)
|
||||
{
|
||||
label listsize(otherknots.size() + 2);
|
||||
pointField tmp(listsize);
|
||||
pointField newPoints(otherknots.size() + 2);
|
||||
|
||||
tmp[0] = points[start];
|
||||
// start/end knots
|
||||
newPoints[0] = points[start];
|
||||
newPoints[otherknots.size() + 1] = points[end];
|
||||
|
||||
for (register label i=1; i<listsize-1; i++)
|
||||
// intermediate knots
|
||||
forAll(otherknots, knotI)
|
||||
{
|
||||
tmp[i] = otherknots[i-1];
|
||||
newPoints[knotI+1] = otherknots[knotI];
|
||||
}
|
||||
|
||||
tmp[listsize-1] = points[end];
|
||||
|
||||
return tmp;
|
||||
return newPoints;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -66,7 +66,6 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("curvedEdge");
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
@ -113,36 +112,22 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return label of start point
|
||||
label start() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
inline label start() const;
|
||||
|
||||
//- Return label of end point
|
||||
label end() const
|
||||
{
|
||||
return end_;
|
||||
}
|
||||
inline label end() const;
|
||||
|
||||
//- Compare the given start and end points with this curve
|
||||
// - 0: different
|
||||
// - +1: identical
|
||||
// - -1: same edge, but different orientation
|
||||
int compare(const label start, const label end) const
|
||||
{
|
||||
if (start_ == start && end_ == end)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (start_ == end && end_ == start)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
inline int compare(const curvedEdge&) const;
|
||||
|
||||
//- Compare the given start and end points with this curve
|
||||
// - 0: different
|
||||
// - +1: identical
|
||||
// - -1: same edge, but different orientation
|
||||
inline int compare(const label start, const label end) const;
|
||||
|
||||
//- Return the position of a point on the curve given by
|
||||
// the parameter 0 <= lambda <= 1
|
||||
@ -151,6 +136,17 @@ public:
|
||||
//- Return the length of the curve
|
||||
virtual scalar length() const = 0;
|
||||
|
||||
//- Return a complete knotList by adding the start/end points
|
||||
// to the given list
|
||||
static pointField knotlist
|
||||
(
|
||||
const pointField&,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots
|
||||
);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
void operator=(const curvedEdge&);
|
||||
@ -161,23 +157,16 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//- Return the complete knotList by adding the start and end points to the
|
||||
// given list
|
||||
pointField knotlist
|
||||
(
|
||||
const pointField& points,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "curvedEdgeI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
78
src/mesh/blockMesh/curvedEdges/curvedEdgeI.H
Normal file
78
src/mesh/blockMesh/curvedEdges/curvedEdgeI.H
Normal file
@ -0,0 +1,78 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::label Foam::curvedEdge::start() const
|
||||
{
|
||||
return start_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::curvedEdge::end() const
|
||||
{
|
||||
return end_;
|
||||
}
|
||||
|
||||
|
||||
inline int Foam::curvedEdge::compare(const curvedEdge& ce) const
|
||||
{
|
||||
if (start_ == ce.start_ && end_ == ce.end_)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (start_ == ce.end_ && end_ == ce.start_)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline int Foam::curvedEdge::compare(const label start, const label end) const
|
||||
{
|
||||
if (start_ == start && end_ == end)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (start_ == end && end_ == start)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -48,8 +48,8 @@ Foam::lineDivide::lineDivide
|
||||
|
||||
if (xratio == 1.0)
|
||||
{
|
||||
scalar y(1.0/np);
|
||||
for (label i=0; i<=noPoints_; i++)
|
||||
const scalar y(1.0/np);
|
||||
for (label i=0; i <= noPoints_; i++)
|
||||
{
|
||||
lambda = scalar(i)/np;
|
||||
points_[i] = bc.position(lambda);
|
||||
@ -62,7 +62,7 @@ Foam::lineDivide::lineDivide
|
||||
divisions_[0] = 0.0;
|
||||
scalar xrpower = 1.0;
|
||||
|
||||
for (label i=1; i<=noPoints_; i++)
|
||||
for (label i=1; i <= noPoints_; i++)
|
||||
{
|
||||
lambda = (1.0 - pow(xratio, i))/(1.0 - pow(xratio, np));
|
||||
points_[i] = bc.position(lambda);
|
||||
|
||||
@ -54,8 +54,11 @@ class lineEdge
|
||||
{
|
||||
// Private data
|
||||
|
||||
vector startPoint_;
|
||||
vector direction_;
|
||||
//- Avoid repetitive calculation of the start point
|
||||
const vector startPoint_;
|
||||
|
||||
//- Avoid repetitive calculation of the direction (end - start)
|
||||
const vector direction_;
|
||||
|
||||
|
||||
public:
|
||||
@ -66,10 +69,10 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
lineEdge(const pointField& points, const label start, const label end);
|
||||
lineEdge(const pointField&, const label start, const label end);
|
||||
|
||||
//- Construct from Istream setting pointsList
|
||||
lineEdge(const pointField& points, Istream&);
|
||||
lineEdge(const pointField&, Istream&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -48,7 +48,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polyLine Declaration
|
||||
Class polyLine Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
polyLine(const pointField& ps);
|
||||
polyLine(const pointField&);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::polyLineEdge::polyLineEdge
|
||||
)
|
||||
:
|
||||
curvedEdge(ps, start, end),
|
||||
polyLine(knotlist(ps,start,end,otherpoints))
|
||||
polyLine(knotlist(ps, start, end, otherpoints))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polyLineEdge Declaration
|
||||
Class polyLineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class polyLineEdge
|
||||
@ -66,14 +66,14 @@ public:
|
||||
//- Construct from components
|
||||
polyLineEdge
|
||||
(
|
||||
const pointField& ps,
|
||||
const pointField&,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherpoints
|
||||
const pointField& otherPoints
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
polyLineEdge(const pointField& ps, Istream&);
|
||||
polyLineEdge(const pointField&, Istream&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class polySplineEdge Declaration
|
||||
Class polySplineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class polySplineEdge
|
||||
@ -62,14 +62,15 @@ class polySplineEdge
|
||||
|
||||
pointField intervening
|
||||
(
|
||||
const pointField& otherknots,
|
||||
const label nbetweenKnots,
|
||||
const vector&, const vector&
|
||||
const pointField& otherKnots,
|
||||
const label nBetweenKnots,
|
||||
const vector&,
|
||||
const vector&
|
||||
);
|
||||
|
||||
label nsize(const label otherknotsSize, const label nbetweenKnots)
|
||||
label nsize(const label otherKnotsSize, const label nBetweenKnots)
|
||||
{
|
||||
return otherknotsSize*(1 + nbetweenKnots) + nbetweenKnots + 2;
|
||||
return otherKnotsSize*(1 + nBetweenKnots) + nBetweenKnots + 2;
|
||||
}
|
||||
|
||||
|
||||
@ -84,15 +85,15 @@ public:
|
||||
//- Construct from components
|
||||
polySplineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const pointField&,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots,
|
||||
const pointField& otherKnots,
|
||||
const label nInterKnots = 20
|
||||
);
|
||||
|
||||
//- Construct from Istream setting pointsList
|
||||
polySplineEdge(const pointField& points, Istream& is);
|
||||
polySplineEdge(const pointField&, Istream&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
@ -45,7 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class simpleSplineEdge Declaration
|
||||
Class simpleSplineEdge Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class simpleSplineEdge
|
||||
@ -65,19 +65,19 @@ public:
|
||||
//- Construct from components
|
||||
simpleSplineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const pointField&,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots
|
||||
const pointField& otherKnots
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
simpleSplineEdge
|
||||
(
|
||||
const pointField& points,
|
||||
const pointField&,
|
||||
const label start,
|
||||
const label end,
|
||||
const pointField& otherknots,
|
||||
const pointField& otherKnots,
|
||||
const vector& fstend,
|
||||
const vector& sndend
|
||||
);
|
||||
|
||||
@ -46,7 +46,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class spline Declaration
|
||||
Class spline Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class spline
|
||||
|
||||
Reference in New Issue
Block a user