blockMesh: Correct multi-grading support for polyLine
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1809
This commit is contained in:
@ -30,7 +30,7 @@ License
|
||||
|
||||
void Foam::block::createPoints() const
|
||||
{
|
||||
// set local variables for mesh specification
|
||||
// Set local variables for mesh specification
|
||||
const label ni = meshDensity().x();
|
||||
const label nj = meshDensity().y();
|
||||
const label nk = meshDensity().z();
|
||||
@ -46,12 +46,12 @@ void Foam::block::createPoints() const
|
||||
const point& p011 = blockPoint(7);
|
||||
|
||||
|
||||
// list of edge point and weighting factors
|
||||
// List of edge point and weighting factors
|
||||
const List< List<point> >& p = blockEdgePoints();
|
||||
const scalarListList& w = blockEdgeWeights();
|
||||
|
||||
//
|
||||
// generate vertices
|
||||
// Generate vertices
|
||||
//
|
||||
vertices_.clear();
|
||||
vertices_.setSize(nPoints());
|
||||
@ -64,7 +64,7 @@ void Foam::block::createPoints() const
|
||||
{
|
||||
const label vertexNo = vtxLabel(i, j, k);
|
||||
|
||||
// points on edges
|
||||
// Points on edges
|
||||
vector edgex1 = p000 + (p100 - p000)*w[0][i];
|
||||
vector edgex2 = p010 + (p110 - p010)*w[1][i];
|
||||
vector edgex3 = p011 + (p111 - p011)*w[2][i];
|
||||
@ -81,7 +81,7 @@ void Foam::block::createPoints() const
|
||||
vector edgez4 = p010 + (p011 - p010)*w[11][k];
|
||||
|
||||
|
||||
// calculate the importance factors for all edges
|
||||
// Calculate the importance factors for all edges
|
||||
|
||||
// x-direction
|
||||
scalar impx1 =
|
||||
@ -179,7 +179,7 @@ void Foam::block::createPoints() const
|
||||
impz4 /= magImpz;
|
||||
|
||||
|
||||
// calculate the correction vectors
|
||||
// Calculate the correction vectors
|
||||
vector corx1 = impx1*(p[0][i] - edgex1);
|
||||
vector corx2 = impx2*(p[1][i] - edgex2);
|
||||
vector corx3 = impx3*(p[2][i] - edgex3);
|
||||
@ -196,7 +196,7 @@ void Foam::block::createPoints() const
|
||||
vector corz4 = impz4*(p[11][k] - edgez4);
|
||||
|
||||
|
||||
// multiply by the importance factor
|
||||
// Multiply by the importance factor
|
||||
|
||||
// x-direction
|
||||
edgex1 *= impx1;
|
||||
@ -217,7 +217,7 @@ void Foam::block::createPoints() const
|
||||
edgez4 *= impz4;
|
||||
|
||||
|
||||
// add the contributions
|
||||
// Add the contributions
|
||||
vertices_[vertexNo] =
|
||||
(
|
||||
edgex1 + edgex2 + edgex3 + edgex4
|
||||
@ -244,7 +244,7 @@ void Foam::block::createCells() const
|
||||
const label nk = meshDensity().z();
|
||||
|
||||
//
|
||||
// generate cells
|
||||
// Generate cells
|
||||
//
|
||||
cells_.clear();
|
||||
cells_.setSize(nCells());
|
||||
@ -281,7 +281,7 @@ void Foam::block::createBoundary() const
|
||||
const label nk = meshDensity().z();
|
||||
|
||||
//
|
||||
// generate boundaries on each side of the hex
|
||||
// Generate boundaries on each side of the hex
|
||||
//
|
||||
boundaryPatches_.clear();
|
||||
boundaryPatches_.setSize(6);
|
||||
@ -300,7 +300,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(0, j, k);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -310,7 +310,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(0, j + 1, k);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(ni, j, k);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -337,7 +337,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(ni, j, k+1);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
@ -355,7 +355,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(i, 0, k);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -365,7 +365,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(i, 0, k + 1);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
@ -382,7 +382,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(i, nj, k);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -392,7 +392,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(i + 1, nj, k);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
@ -411,7 +411,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(i, j, 0);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -421,7 +421,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(i + 1, j, 0);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
@ -438,7 +438,7 @@ void Foam::block::createBoundary() const
|
||||
{
|
||||
boundaryPatches_[wallLabel][wallCellLabel].setSize(4);
|
||||
|
||||
// set the points
|
||||
// Set the points
|
||||
boundaryPatches_[wallLabel][wallCellLabel][0] =
|
||||
vtxLabel(i, j, nk);
|
||||
boundaryPatches_[wallLabel][wallCellLabel][1] =
|
||||
@ -448,7 +448,7 @@ void Foam::block::createBoundary() const
|
||||
boundaryPatches_[wallLabel][wallCellLabel][3] =
|
||||
vtxLabel(i, j + 1, nk);
|
||||
|
||||
// update the counter
|
||||
// Update the counter
|
||||
wallCellLabel++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Foam::blockDescriptor::blockDescriptor
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// create a list of edges
|
||||
// Create a list of edges
|
||||
makeBlockEdges();
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ Foam::blockDescriptor::blockDescriptor
|
||||
|
||||
if (t.isPunctuation())
|
||||
{
|
||||
// new-style: read a list of 3 values
|
||||
// New-style: read a list of 3 values
|
||||
if (t.pToken() == token::BEGIN_LIST)
|
||||
{
|
||||
is >> meshDensity_;
|
||||
@ -118,7 +118,7 @@ Foam::blockDescriptor::blockDescriptor
|
||||
}
|
||||
else
|
||||
{
|
||||
// old-style: read three labels
|
||||
// Old-style: read three labels
|
||||
is >> meshDensity_.x()
|
||||
>> meshDensity_.y()
|
||||
>> meshDensity_.z();
|
||||
@ -134,7 +134,7 @@ Foam::blockDescriptor::blockDescriptor
|
||||
|
||||
if (expRatios.size() == 1)
|
||||
{
|
||||
// identical in x/y/z-directions
|
||||
// Identical in x/y/z-directions
|
||||
expand_ = expRatios[0];
|
||||
}
|
||||
else if (expRatios.size() == 3)
|
||||
@ -171,7 +171,7 @@ Foam::blockDescriptor::blockDescriptor
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// create a list of edges
|
||||
// Create a list of edges
|
||||
makeBlockEdges();
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const blockDescriptor& bd)
|
||||
|
||||
const List<gradingDescriptors>& expand = bd.expand_;
|
||||
|
||||
// can we use a compact notation?
|
||||
// Can we use a compact notation?
|
||||
if
|
||||
(
|
||||
// x-direction
|
||||
|
||||
@ -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-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -117,11 +117,11 @@ Foam::pointField Foam::curvedEdge::appendEndPoints
|
||||
{
|
||||
pointField allKnots(otherKnots.size() + 2);
|
||||
|
||||
// start/end knots
|
||||
// Start/end knots
|
||||
allKnots[0] = points[start];
|
||||
allKnots[otherKnots.size() + 1] = points[end];
|
||||
|
||||
// intermediate knots
|
||||
// Intermediate knots
|
||||
forAll(otherKnots, knotI)
|
||||
{
|
||||
allKnots[knotI+1] = otherKnots[knotI];
|
||||
|
||||
@ -130,7 +130,6 @@ Foam::lineDivide::lineDivide
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Calculate the points
|
||||
for (label i = 0; i <= nDiv; i++)
|
||||
{
|
||||
|
||||
@ -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-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,7 +23,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
#include "polyLine.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -41,7 +40,7 @@ void Foam::polyLine::calcParam()
|
||||
param_[i] = param_[i-1] + mag(points_[i] - points_[i-1]);
|
||||
}
|
||||
|
||||
// normalize on the interval 0-1
|
||||
// Normalize on the interval 0-1
|
||||
lineLength_ = param_.last();
|
||||
for (label i=1; i < param_.size() - 1; i++)
|
||||
{
|
||||
@ -85,7 +84,7 @@ Foam::label Foam::polyLine::nSegments() const
|
||||
|
||||
Foam::label Foam::polyLine::localParameter(scalar& lambda) const
|
||||
{
|
||||
// check endpoints
|
||||
// Check endpoints
|
||||
if (lambda < SMALL)
|
||||
{
|
||||
lambda = 0;
|
||||
@ -97,22 +96,20 @@ Foam::label Foam::polyLine::localParameter(scalar& lambda) const
|
||||
return nSegments();
|
||||
}
|
||||
|
||||
// search table of cumulative distances to find which line-segment
|
||||
// we are on. Check the upper bound.
|
||||
// Search table of cumulative distances to find which line-segment
|
||||
// we are on.
|
||||
// Check the upper bound.
|
||||
|
||||
label segmentI = 1;
|
||||
while (param_[segmentI] < lambda)
|
||||
{
|
||||
segmentI++;
|
||||
}
|
||||
segmentI--; // we want the corresponding lower bound
|
||||
segmentI--; // We want the corresponding lower bound
|
||||
|
||||
// the local parameter [0-1] on this line segment
|
||||
// The local parameter [0-1] on this line segment
|
||||
lambda =
|
||||
(
|
||||
( lambda - param_[segmentI] )
|
||||
/ ( param_[segmentI+1] - param_[segmentI] )
|
||||
);
|
||||
(lambda - param_[segmentI])/(param_[segmentI+1] - param_[segmentI]);
|
||||
|
||||
return segmentI;
|
||||
}
|
||||
@ -120,7 +117,7 @@ Foam::label Foam::polyLine::localParameter(scalar& lambda) const
|
||||
|
||||
Foam::point Foam::polyLine::position(const scalar mu) const
|
||||
{
|
||||
// check endpoints
|
||||
// Check end-points
|
||||
if (mu < SMALL)
|
||||
{
|
||||
return points_.first();
|
||||
@ -130,7 +127,6 @@ Foam::point Foam::polyLine::position(const scalar mu) const
|
||||
return points_.last();
|
||||
}
|
||||
|
||||
|
||||
scalar lambda = mu;
|
||||
label segment = localParameter(lambda);
|
||||
return position(segment, lambda);
|
||||
@ -143,7 +139,7 @@ Foam::point Foam::polyLine::position
|
||||
const scalar mu
|
||||
) const
|
||||
{
|
||||
// out-of-bounds
|
||||
// Out-of-bounds
|
||||
if (segment < 0)
|
||||
{
|
||||
return points_.first();
|
||||
@ -156,7 +152,7 @@ Foam::point Foam::polyLine::position
|
||||
const point& p0 = points()[segment];
|
||||
const point& p1 = points()[segment+1];
|
||||
|
||||
// special cases - no calculation needed
|
||||
// Special cases - no calculation needed
|
||||
if (mu <= 0.0)
|
||||
{
|
||||
return p0;
|
||||
@ -167,8 +163,8 @@ Foam::point Foam::polyLine::position
|
||||
}
|
||||
else
|
||||
{
|
||||
// linear interpolation
|
||||
return points_[segment] + mu * (p1 - p0);
|
||||
// Linear interpolation
|
||||
return points_[segment] + mu*(p1 - p0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ Foam::gradingDescriptors Foam::gradingDescriptors::inv() const
|
||||
|
||||
forAll(ret, i)
|
||||
{
|
||||
ret[i] = operator[](i).inv();
|
||||
ret[i] = operator[](ret.size() - i - 1).inv();
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user