mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: cvMesh: Replace std::list with List where possible.
CGAL algorithms such as incident_faces take a list and an output iterator as arguments. They require the list to have push_back defined. Some std::lists remain where this is the case.
This commit is contained in:
@ -78,17 +78,17 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
||||
norm
|
||||
);
|
||||
|
||||
vector np = norm[0];
|
||||
const vector np = norm[0];
|
||||
|
||||
// Generate equally spaced 'spokes' in a circle normal to the
|
||||
// direction from the vertex to the closest point on the surface
|
||||
// and look for a secondary intersection.
|
||||
|
||||
vector d = surfHit.hitPoint() - pt;
|
||||
const vector d = surfHit.hitPoint() - pt;
|
||||
|
||||
tensor Rp = rotationTensor(vector(0,0,1), np);
|
||||
const tensor Rp = rotationTensor(vector(0,0,1), np);
|
||||
|
||||
label s = cvMeshControls().alignmentSearchSpokes();
|
||||
const label s = cvMeshControls().alignmentSearchSpokes();
|
||||
|
||||
scalar closestSpokeHitDistance = GREAT;
|
||||
|
||||
@ -96,7 +96,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
||||
|
||||
label closestSpokeSurface = -1;
|
||||
|
||||
scalar spanMag = geometryToConformTo_.globalBounds().mag();
|
||||
const scalar spanMag = geometryToConformTo_.globalBounds().mag();
|
||||
|
||||
for (label i = 0; i < s; i++)
|
||||
{
|
||||
@ -198,7 +198,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
||||
// Secondary alignment
|
||||
vector ns = np ^ na;
|
||||
|
||||
if (mag(ns) < SMALL)
|
||||
if (mag(ns) < SMALL)
|
||||
{
|
||||
FatalErrorIn("conformalVoronoiMesh::requiredAlignment")
|
||||
<< "Parallel normals detected in spoke search." << nl
|
||||
@ -220,7 +220,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment
|
||||
|
||||
void Foam::conformalVoronoiMesh::insertPoints
|
||||
(
|
||||
std::list<Point>& points,
|
||||
List<Point>& points,
|
||||
bool distribute
|
||||
)
|
||||
{
|
||||
@ -241,11 +241,13 @@ void Foam::conformalVoronoiMesh::insertPoints
|
||||
|
||||
DynamicList<Foam::point> transferPoints;
|
||||
|
||||
List<Point> pointsOnProcessor;
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Point>::iterator pit=points.begin();
|
||||
List<Point>::iterator pit = points.begin();
|
||||
pit != points.end();
|
||||
// No action
|
||||
++pit
|
||||
)
|
||||
{
|
||||
Foam::point p(topoint(*pit));
|
||||
@ -253,15 +255,20 @@ void Foam::conformalVoronoiMesh::insertPoints
|
||||
if (!positionOnThisProc(p))
|
||||
{
|
||||
transferPoints.append(p);
|
||||
|
||||
pit = points.erase(pit);
|
||||
}
|
||||
else
|
||||
{
|
||||
++pit;
|
||||
pointsOnProcessor.append(*pit);
|
||||
}
|
||||
}
|
||||
|
||||
points.setSize(pointsOnProcessor.size());
|
||||
forAll(pointsOnProcessor, pI)
|
||||
{
|
||||
points[pI] = pointsOnProcessor[pI];
|
||||
}
|
||||
pointsOnProcessor.clear();
|
||||
|
||||
// Send the points that are not on this processor to the appropriate
|
||||
// place
|
||||
Foam::autoPtr<Foam::mapDistribute> map
|
||||
@ -271,7 +278,7 @@ void Foam::conformalVoronoiMesh::insertPoints
|
||||
|
||||
forAll(transferPoints, tPI)
|
||||
{
|
||||
points.push_back(toPoint(transferPoints[tPI]));
|
||||
points.append(toPoint(transferPoints[tPI]));
|
||||
}
|
||||
|
||||
label sizeChange = preDistributionSize - label(points.size());
|
||||
@ -310,7 +317,7 @@ void Foam::conformalVoronoiMesh::insertPoints
|
||||
// Info<< "USING INDIVIDUAL INSERTION TO DETECT FAILURE" << endl;
|
||||
// for
|
||||
// (
|
||||
// std::list<Point>::iterator pit=points.begin();
|
||||
//List:list<Point>::iterator pit=points.begin();
|
||||
// pit != points.end();
|
||||
// ++pit
|
||||
// )
|
||||
@ -569,7 +576,7 @@ void Foam::conformalVoronoiMesh::insertInitialPoints()
|
||||
|
||||
timeCheck("Before initial points call");
|
||||
|
||||
std::list<Point> initPts = initialPointsMethod_->initialPoints();
|
||||
List<Point> initPts = initialPointsMethod_->initialPoints();
|
||||
|
||||
timeCheck("After initial points call");
|
||||
|
||||
@ -784,7 +791,7 @@ bool Foam::conformalVoronoiMesh::distributeBackground()
|
||||
|
||||
void Foam::conformalVoronoiMesh::storeSizesAndAlignments()
|
||||
{
|
||||
std::list<Point> storePts;
|
||||
List<Point> storePts;
|
||||
|
||||
for
|
||||
(
|
||||
@ -795,7 +802,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments()
|
||||
{
|
||||
if (vit->internalPoint())
|
||||
{
|
||||
storePts.push_back(vit->point());
|
||||
storePts.append(vit->point());
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,7 +812,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments()
|
||||
|
||||
void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
(
|
||||
const std::list<Point>& storePts
|
||||
const List<Point>& storePts
|
||||
)
|
||||
{
|
||||
timeCheck("Start of storeSizesAndAlignments");
|
||||
@ -822,7 +829,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Point>::const_iterator pit=storePts.begin();
|
||||
List<Point>::const_iterator pit = storePts.begin();
|
||||
pit != storePts.end();
|
||||
++pit
|
||||
)
|
||||
@ -849,7 +856,7 @@ void Foam::conformalVoronoiMesh::storeSizesAndAlignments
|
||||
|
||||
void Foam::conformalVoronoiMesh::updateSizesAndAlignments
|
||||
(
|
||||
const std::list<Point>& storePts
|
||||
const List<Point>& storePts
|
||||
)
|
||||
{
|
||||
// This function is only used in serial, the background redistribution
|
||||
@ -1352,7 +1359,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
true
|
||||
);
|
||||
|
||||
std::list<Point> pointsToInsert;
|
||||
List<Point> pointsToInsert;
|
||||
|
||||
for
|
||||
(
|
||||
@ -1389,15 +1396,15 @@ void Foam::conformalVoronoiMesh::move()
|
||||
|
||||
forAll(alignmentDirsA, aA)
|
||||
{
|
||||
const vector& a(alignmentDirsA[aA]);
|
||||
const vector& a = alignmentDirsA[aA];
|
||||
|
||||
scalar maxDotProduct = 0.0;
|
||||
|
||||
forAll(alignmentDirsB, aB)
|
||||
{
|
||||
const vector& b(alignmentDirsB[aB]);
|
||||
const vector& b = alignmentDirsB[aB];
|
||||
|
||||
scalar dotProduct = a & b;
|
||||
const scalar dotProduct = a & b;
|
||||
|
||||
if (mag(dotProduct) > maxDotProduct)
|
||||
{
|
||||
@ -1431,7 +1438,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
&& pointToBeRetained[vB->index()] == true
|
||||
)
|
||||
{
|
||||
pointsToInsert.push_back
|
||||
pointsToInsert.append
|
||||
(
|
||||
toPoint(0.5*(dVA + dVB))
|
||||
);
|
||||
@ -1464,7 +1471,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
alignmentDir *= -1;
|
||||
}
|
||||
|
||||
scalar alignmentDotProd = ((rAB/rABMag) & alignmentDir);
|
||||
const scalar alignmentDotProd = ((rAB/rABMag) & alignmentDir);
|
||||
|
||||
if
|
||||
(
|
||||
@ -1472,9 +1479,9 @@ void Foam::conformalVoronoiMesh::move()
|
||||
> cvMeshControls().cosAlignmentAcceptanceAngle()
|
||||
)
|
||||
{
|
||||
scalar targetCellSize = averageCellSize(vA, vB);
|
||||
const scalar targetCellSize = averageCellSize(vA, vB);
|
||||
|
||||
scalar targetFaceArea = sqr(targetCellSize);
|
||||
const scalar targetFaceArea = sqr(targetCellSize);
|
||||
|
||||
alignmentDir *= 0.5*targetCellSize;
|
||||
|
||||
@ -1483,7 +1490,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
// directions.
|
||||
vector delta = alignmentDir - 0.5*rAB;
|
||||
|
||||
scalar faceArea = dualFace.mag(dualVertices);
|
||||
const scalar faceArea = dualFace.mag(dualVertices);
|
||||
|
||||
delta *= faceAreaWeightModel_->faceAreaWeight
|
||||
(
|
||||
@ -1514,8 +1521,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
)
|
||||
{
|
||||
// Prevent insertions spanning surfaces
|
||||
|
||||
pointsToInsert.push_back
|
||||
pointsToInsert.append
|
||||
(
|
||||
toPoint(0.5*(dVA + dVB))
|
||||
);
|
||||
@ -1537,14 +1543,13 @@ void Foam::conformalVoronoiMesh::move()
|
||||
// the short edge if neither attached
|
||||
// point has already been identified to be
|
||||
// removed.
|
||||
|
||||
if
|
||||
(
|
||||
pointToBeRetained[vA->index()] == true
|
||||
&& pointToBeRetained[vB->index()] == true
|
||||
)
|
||||
{
|
||||
pointsToInsert.push_back
|
||||
pointsToInsert.append
|
||||
(
|
||||
toPoint(0.5*(dVA + dVB))
|
||||
);
|
||||
@ -1623,7 +1628,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
// Only necessary if using an exact constructions kernel
|
||||
// (extended precision)
|
||||
|
||||
pointsToInsert.push_back
|
||||
pointsToInsert.append
|
||||
(
|
||||
toPoint
|
||||
(
|
||||
@ -1635,6 +1640,42 @@ void Foam::conformalVoronoiMesh::move()
|
||||
}
|
||||
}
|
||||
|
||||
// Save displacements to file. To view, convert to vtk so that the times can
|
||||
// be viewed in paraview:
|
||||
//
|
||||
// for i in {0..N}
|
||||
// do
|
||||
// objToVTK displacements$i.obj displacement$i.vtk
|
||||
// done
|
||||
if (cvMeshControls().objOutput() && runTime_.outputTime())
|
||||
{
|
||||
Pout<< "Writing point displacement vectors to file." << endl;
|
||||
OFstream str("displacements_" + runTime_.timeName() + ".obj");
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
vit != finite_vertices_end();
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (vit->internalPoint())
|
||||
{
|
||||
if (pointToBeRetained[vit->index()] == true)
|
||||
{
|
||||
meshTools::writeOBJ(str, topoint(vit->point()));
|
||||
|
||||
str << "vn "
|
||||
<< displacementAccumulator[vit->index()][0] << " "
|
||||
<< displacementAccumulator[vit->index()][1] << " "
|
||||
<< displacementAccumulator[vit->index()][2] << " "
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove the entire tessellation
|
||||
reset();
|
||||
|
||||
@ -1656,6 +1697,7 @@ void Foam::conformalVoronoiMesh::move()
|
||||
if (cvMeshControls().objOutput() && runTime_.outputTime())
|
||||
{
|
||||
writePoints("points_" + runTime_.timeName() + ".obj", false);
|
||||
writeBoundaryPoints("boundaryPoints_" + runTime_.timeName() + ".obj");
|
||||
}
|
||||
|
||||
timeCheck("After conformToSurface");
|
||||
|
||||
@ -151,7 +151,7 @@ private:
|
||||
|
||||
//- Store the feature constraining points to be reinserted after a
|
||||
// triangulation clear. Maintained with relative types and indices.
|
||||
std::list<Vb> featureVertices_;
|
||||
List<Vb> featureVertices_;
|
||||
|
||||
//- Storing the locations of all of the features to be conformed to.
|
||||
// Single pointField required by the featurePointTree.
|
||||
@ -175,7 +175,7 @@ private:
|
||||
|
||||
//- Store the surface and feature edge conformation locations to be
|
||||
// reinserted
|
||||
std::list<Vb> surfaceConformationVertices_;
|
||||
List<Vb> surfaceConformationVertices_;
|
||||
|
||||
//- Method for inserting initial points. Runtime selectable.
|
||||
autoPtr<initialPointsMethod> initialPointsMethod_;
|
||||
@ -284,7 +284,7 @@ private:
|
||||
// processors
|
||||
void insertPoints
|
||||
(
|
||||
std::list<Point>& points,
|
||||
List<Point>& points,
|
||||
bool distribute = true
|
||||
);
|
||||
|
||||
@ -490,10 +490,10 @@ private:
|
||||
|
||||
//- Store data for sizeAndAlignmentLocations_, storedSizes_ and
|
||||
// storedAlignments_ and initialise the sizeAndAlignmentTreePtr_
|
||||
void storeSizesAndAlignments(const std::list<Point>& storePts);
|
||||
void storeSizesAndAlignments(const List<Point>& storePts);
|
||||
|
||||
//- Restore the sizes and alignments if required
|
||||
void updateSizesAndAlignments(const std::list<Point>& storePts);
|
||||
void updateSizesAndAlignments(const List<Point>& storePts);
|
||||
|
||||
//- Demand driven construction of octree for and alignment points
|
||||
const indexedOctree<treeDataPoint>& sizeAndAlignmentTree() const;
|
||||
@ -1018,6 +1018,9 @@ public:
|
||||
//- Write Delaunay points to .obj file
|
||||
void writePoints(const fileName& fName, bool internalOnly) const;
|
||||
|
||||
//- Write the boundary Delaunay points to .obj file
|
||||
void writeBoundaryPoints(const fileName& fName) const;
|
||||
|
||||
//- Write list of points to file
|
||||
void writePoints
|
||||
(
|
||||
|
||||
@ -93,7 +93,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Cell_handle>::iterator cit=cells.begin();
|
||||
std::list<Cell_handle>::iterator cit = cells.begin();
|
||||
cit != cells.end();
|
||||
++cit
|
||||
)
|
||||
@ -116,7 +116,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh
|
||||
{
|
||||
for
|
||||
(
|
||||
std::list<Cell_handle>::iterator cit=cells.begin();
|
||||
std::list<Cell_handle>::iterator cit = cells.begin();
|
||||
cit != cells.end();
|
||||
++cit
|
||||
)
|
||||
|
||||
@ -167,10 +167,10 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
||||
|
||||
// Initial surface protrusion conformation - nearest surface point
|
||||
{
|
||||
scalar edgeSearchDistCoeffSqr =
|
||||
const scalar edgeSearchDistCoeffSqr =
|
||||
cvMeshControls().edgeSearchDistCoeffSqrInitial(reconfMode);
|
||||
|
||||
scalar surfacePtReplaceDistCoeffSqr =
|
||||
const scalar surfacePtReplaceDistCoeffSqr =
|
||||
cvMeshControls().surfacePtReplaceDistCoeffSqrInitial(reconfMode);
|
||||
|
||||
DynamicList<pointIndexHit> surfaceHits;
|
||||
@ -188,8 +188,9 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
||||
{
|
||||
if (vit->internalPoint())
|
||||
{
|
||||
Foam::point vert(topoint(vit->point()));
|
||||
scalar searchDistanceSqr = surfaceSearchDistanceSqr(vert);
|
||||
const Foam::point vert = topoint(vit->point());
|
||||
const scalar searchDistanceSqr = surfaceSearchDistanceSqr(vert);
|
||||
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
|
||||
@ -342,7 +343,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
||||
|| vit->referredInternalOrBoundaryPoint()
|
||||
)
|
||||
{
|
||||
Foam::point vert(topoint(vit->point()));
|
||||
const Foam::point vert = topoint(vit->point());
|
||||
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
|
||||
@ -372,7 +374,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation
|
||||
}
|
||||
else if (vit->ppSlave() || vit->referredExternal())
|
||||
{
|
||||
Foam::point vert(topoint(vit->point()));
|
||||
const Foam::point vert = topoint(vit->point());
|
||||
|
||||
pointIndexHit surfHit;
|
||||
label hitSurface;
|
||||
|
||||
@ -1222,7 +1225,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Facet>::iterator fit=facets.begin();
|
||||
std::list<Facet>::iterator fit = facets.begin();
|
||||
fit != facets.end();
|
||||
++fit
|
||||
)
|
||||
@ -1314,7 +1317,7 @@ void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Facet>::iterator fit=facets.begin();
|
||||
std::list<Facet>::iterator fit = facets.begin();
|
||||
fit != facets.end();
|
||||
++fit
|
||||
)
|
||||
@ -1738,7 +1741,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
||||
|
||||
labelList featuresHit;
|
||||
|
||||
scalar targetCellSizeSqr = sqr(targetCellSize(vert));
|
||||
const scalar targetCellSizeSqr = sqr(targetCellSize(vert));
|
||||
|
||||
geometryToConformTo_.findEdgeNearestByType
|
||||
(
|
||||
@ -1756,9 +1759,9 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
||||
|
||||
forAll(edHits, i)
|
||||
{
|
||||
const pointIndexHit& edHit(edHits[i]);
|
||||
const pointIndexHit& edHit = edHits[i];
|
||||
|
||||
label featureHit = featuresHit[i];
|
||||
const label featureHit = featuresHit[i];
|
||||
|
||||
if (edHit.hit())
|
||||
{
|
||||
@ -1838,7 +1841,7 @@ void Foam::conformalVoronoiMesh::storeSurfaceConformation()
|
||||
&& vit->index() >= startOfInternalPoints_
|
||||
)
|
||||
{
|
||||
surfaceConformationVertices_.push_back
|
||||
surfaceConformationVertices_.append
|
||||
(
|
||||
Vb
|
||||
(
|
||||
@ -1871,7 +1874,7 @@ void Foam::conformalVoronoiMesh::reinsertSurfaceConformation()
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Vb>::iterator vit=surfaceConformationVertices_.begin();
|
||||
List<Vb>::iterator vit=surfaceConformationVertices_.begin();
|
||||
vit != surfaceConformationVertices_.end();
|
||||
++vit
|
||||
)
|
||||
|
||||
@ -161,6 +161,13 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
|
||||
const vector& concaveEdgePlaneBNormal =
|
||||
normals[edgeNormals[concaveEdgeI][1]];
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< featPt << nl
|
||||
<< concaveEdgePlaneANormal << nl
|
||||
<< concaveEdgePlaneBNormal << endl;
|
||||
}
|
||||
|
||||
// Intersect planes parallel to the concave edge planes offset
|
||||
// by ppDist and the plane defined by featPt and the edge vector.
|
||||
plane planeA
|
||||
@ -181,6 +188,12 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
|
||||
ptI
|
||||
);
|
||||
|
||||
Info<< "pt " << featPt << nl
|
||||
<< "concave edge dir " << concaveEdgeDir << nl
|
||||
<< "convex edge dir 1 " << feMesh.edgeDirection(convexEdgesI[0], ptI) << nl
|
||||
<< "convex edge dir 2 " << feMesh.edgeDirection(convexEdgesI[1], ptI) << nl<<endl;
|
||||
|
||||
|
||||
// Todo,needed later but want to get rid of this.
|
||||
const Foam::point concaveEdgeLocalFeatPt = featPt + ppDist*concaveEdgeDir;
|
||||
|
||||
@ -203,7 +216,7 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
|
||||
|
||||
const Foam::point internalPtA =
|
||||
concaveEdgeExternalPt
|
||||
- 2*planeA.distance(concaveEdgeExternalPt)
|
||||
- 2.0*planeA.distance(concaveEdgeExternalPt)
|
||||
*concaveEdgePlaneANormal;
|
||||
|
||||
pts.append(internalPtA);
|
||||
@ -212,7 +225,7 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
|
||||
|
||||
const Foam::point internalPtB =
|
||||
concaveEdgeExternalPt
|
||||
- 2*planeB.distance(concaveEdgeExternalPt)
|
||||
- 2.0*planeB.distance(concaveEdgeExternalPt)
|
||||
*concaveEdgePlaneBNormal;
|
||||
|
||||
pts.append(internalPtB);
|
||||
@ -294,6 +307,15 @@ bool Foam::conformalVoronoiMesh::createSpecialisedFeaturePoint
|
||||
acos(mag(concaveEdgePlaneANormal & concaveEdgePlaneBNormal))
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< internalPtA << " " << internalPtB << nl
|
||||
<< externalPtD << " " << externalPtE << endl;
|
||||
Info<< "normals: " << nl
|
||||
<< normals[concaveEdgeNormals[0]] << nl
|
||||
<< normals[concaveEdgeNormals[1]] << endl;
|
||||
}
|
||||
|
||||
if (totalAngle > cvMeshControls().maxQuadAngle())
|
||||
{
|
||||
// Add additional mitering points
|
||||
|
||||
@ -328,7 +328,7 @@ void Foam::conformalVoronoiMesh::createFlatEdgePointGroup
|
||||
|
||||
// Average normal to remove any bias to one side, although as this
|
||||
// is a flat edge, the normals should be essentially the same
|
||||
vector n = 0.5*(nA + nB);
|
||||
const vector n = 0.5*(nA + nB);
|
||||
|
||||
// Direction along the surface to the control point, sense of edge
|
||||
// direction not important, as +s and -s can be used because this
|
||||
@ -391,7 +391,7 @@ void Foam::conformalVoronoiMesh::reinsertFeaturePoints(bool distribute)
|
||||
|
||||
for
|
||||
(
|
||||
std::list<Vb>::iterator vit=featureVertices_.begin();
|
||||
List<Vb>::iterator vit=featureVertices_.begin();
|
||||
vit != featureVertices_.end();
|
||||
++vit
|
||||
)
|
||||
@ -406,20 +406,19 @@ void Foam::conformalVoronoiMesh::reinsertFeaturePoints(bool distribute)
|
||||
|
||||
// Save points in new distribution
|
||||
featureVertices_.clear();
|
||||
featureVertices_.setSize(pointsToInsert.size());
|
||||
|
||||
forAll(pointsToInsert, pI)
|
||||
{
|
||||
featureVertices_.push_back
|
||||
(
|
||||
Vb(toPoint(pointsToInsert[pI]), indices[pI], types[pI])
|
||||
);
|
||||
featureVertices_[pI] =
|
||||
Vb(toPoint(pointsToInsert[pI]), indices[pI], types[pI]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for
|
||||
(
|
||||
std::list<Vb>::iterator vit=featureVertices_.begin();
|
||||
List<Vb>::iterator vit=featureVertices_.begin();
|
||||
vit != featureVertices_.end();
|
||||
++vit
|
||||
)
|
||||
@ -476,13 +475,13 @@ void Foam::conformalVoronoiMesh::createConvexFeaturePoints
|
||||
continue;
|
||||
}
|
||||
|
||||
vectorField featPtNormals = feMesh.featurePointNormals(ptI);
|
||||
const vectorField& featPtNormals = feMesh.featurePointNormals(ptI);
|
||||
const scalar ppDist = - pointPairDistance(featPt);
|
||||
|
||||
vector cornerNormal = sum(featPtNormals);
|
||||
cornerNormal /= mag(cornerNormal);
|
||||
|
||||
Foam::point internalPt =
|
||||
featPt - pointPairDistance(featPt)*cornerNormal;
|
||||
Foam::point internalPt = featPt + ppDist*cornerNormal;
|
||||
|
||||
// Result when the points are eventually inserted (example n = 4)
|
||||
// Add number_of_vertices() at insertion of first vertex to all
|
||||
@ -548,13 +547,13 @@ void Foam::conformalVoronoiMesh::createConcaveFeaturePoints
|
||||
continue;
|
||||
}
|
||||
|
||||
vectorField featPtNormals = feMesh.featurePointNormals(ptI);
|
||||
const vectorField& featPtNormals = feMesh.featurePointNormals(ptI);
|
||||
const scalar ppDist = pointPairDistance(featPt);
|
||||
|
||||
vector cornerNormal = sum(featPtNormals);
|
||||
cornerNormal /= mag(cornerNormal);
|
||||
|
||||
Foam::point externalPt =
|
||||
featPt + pointPairDistance(featPt)*cornerNormal;
|
||||
Foam::point externalPt = featPt + ppDist*cornerNormal;
|
||||
|
||||
label externalPtIndex = featPtNormals.size();
|
||||
|
||||
@ -573,9 +572,9 @@ void Foam::conformalVoronoiMesh::createConcaveFeaturePoints
|
||||
{
|
||||
const vector& n = featPtNormals[nI];
|
||||
|
||||
plane planeN = plane(featPt, n);
|
||||
const plane planeN = plane(featPt, n);
|
||||
|
||||
Foam::point internalPt =
|
||||
const Foam::point internalPt =
|
||||
externalPt - 2.0 * planeN.distance(externalPt) * n;
|
||||
|
||||
pts.append(internalPt);
|
||||
@ -600,7 +599,7 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints
|
||||
{
|
||||
if (cvMeshControls().mixedFeaturePointPPDistanceCoeff() < 0)
|
||||
{
|
||||
Info<<nl << "Skipping specialised handling for mixed feature points"
|
||||
Info<< nl << "Skipping specialised handling for mixed feature points"
|
||||
<< endl;
|
||||
return;
|
||||
}
|
||||
@ -654,8 +653,8 @@ void Foam::conformalVoronoiMesh::createMixedFeaturePoints
|
||||
{
|
||||
const label edgeI = pEds[e];
|
||||
|
||||
const extendedFeatureEdgeMesh::edgeStatus edStatus =
|
||||
feMesh.getEdgeStatus(edgeI);
|
||||
const extendedFeatureEdgeMesh::edgeStatus edStatus
|
||||
= feMesh.getEdgeStatus(edgeI);
|
||||
|
||||
if
|
||||
(
|
||||
@ -743,13 +742,11 @@ void Foam::conformalVoronoiMesh::insertFeaturePoints()
|
||||
}
|
||||
|
||||
featureVertices_.clear();
|
||||
featureVertices_.setSize(pts.size());
|
||||
|
||||
forAll(pts, pI)
|
||||
{
|
||||
featureVertices_.push_back
|
||||
(
|
||||
Vb(toPoint(pts[pI]), indices[pI], types[pI])
|
||||
);
|
||||
featureVertices_[pI] = Vb(toPoint(pts[pI]), indices[pI], types[pI]);
|
||||
}
|
||||
|
||||
constructFeaturePointLocations();
|
||||
@ -769,7 +766,6 @@ void Foam::conformalVoronoiMesh::constructFeaturePointLocations()
|
||||
{
|
||||
const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
|
||||
|
||||
|
||||
if (cvMeshControls().mixedFeaturePointPPDistanceCoeff() < 0)
|
||||
{
|
||||
// Ignoring mixed feature points
|
||||
|
||||
@ -175,6 +175,30 @@ void Foam::conformalVoronoiMesh::writePoints
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::writeBoundaryPoints
|
||||
(
|
||||
const fileName& fName
|
||||
) const
|
||||
{
|
||||
OFstream str(runTime_.path()/fName);
|
||||
|
||||
Pout<< nl << "Writing boundary points to " << str.name() << endl;
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
vit != finite_vertices_end();
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (vit->pairPoint())
|
||||
{
|
||||
meshTools::writeOBJ(str, topoint(vit->point()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::writePoints
|
||||
(
|
||||
const fileName& fName,
|
||||
@ -597,27 +621,6 @@ void Foam::conformalVoronoiMesh::writeMesh
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// pointIOField cellCs
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "cellCentres",
|
||||
// mesh.pointsInstance(),
|
||||
// polyMesh::meshSubDir,
|
||||
// mesh,
|
||||
// IOobject::NO_READ,
|
||||
// IOobject::AUTO_WRITE
|
||||
// ),
|
||||
// cellCentres
|
||||
// );
|
||||
|
||||
// Info<< nl
|
||||
// << "Writing " << cellCs.name()
|
||||
// << " to " << cellCs.instance()
|
||||
// << endl;
|
||||
|
||||
// cellCs.write();
|
||||
|
||||
writeCellSizes(mesh);
|
||||
|
||||
writeCellCentres(mesh);
|
||||
|
||||
@ -177,7 +177,7 @@ bool Foam::autoDensity::combinedWellInside
|
||||
|
||||
void Foam::autoDensity::recurseAndFill
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
List<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
label levelLimit,
|
||||
word recursionName
|
||||
@ -272,7 +272,7 @@ void Foam::autoDensity::recurseAndFill
|
||||
|
||||
bool Foam::autoDensity::fillBox
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
List<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
bool overlapping
|
||||
) const
|
||||
@ -677,7 +677,7 @@ bool Foam::autoDensity::fillBox
|
||||
// Pout<< "Final volume probability break accept"
|
||||
// << endl;
|
||||
|
||||
initialPoints.push_back
|
||||
initialPoints.append
|
||||
(
|
||||
Vb::Point(p.x(), p.y(), p.z())
|
||||
);
|
||||
@ -688,7 +688,7 @@ bool Foam::autoDensity::fillBox
|
||||
break;
|
||||
}
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
|
||||
volumeAdded += localVolume;
|
||||
}
|
||||
@ -800,7 +800,7 @@ bool Foam::autoDensity::fillBox
|
||||
// Pout<< "Final volume probability break accept"
|
||||
// << endl;
|
||||
|
||||
initialPoints.push_back
|
||||
initialPoints.append
|
||||
(
|
||||
Vb::Point(p.x(), p.y(), p.z())
|
||||
);
|
||||
@ -811,7 +811,7 @@ bool Foam::autoDensity::fillBox
|
||||
break;
|
||||
}
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
|
||||
volumeAdded += localVolume;
|
||||
}
|
||||
@ -882,7 +882,7 @@ autoDensity::autoDensity
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> autoDensity::initialPoints() const
|
||||
List<Vb::Point> autoDensity::initialPoints() const
|
||||
{
|
||||
treeBoundBox hierBB;
|
||||
|
||||
@ -902,7 +902,7 @@ std::list<Vb::Point> autoDensity::initialPoints() const
|
||||
);
|
||||
}
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
List<Vb::Point> initialPoints;
|
||||
|
||||
Info<< nl << " " << typeName << endl;
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ private:
|
||||
//- Descend into octants of the supplied bound box
|
||||
void recurseAndFill
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
List<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
label levelLimit,
|
||||
word recursionName
|
||||
@ -127,7 +127,7 @@ private:
|
||||
// in favour of further recursion.
|
||||
bool fillBox
|
||||
(
|
||||
std::list<Vb::Point>& initialPoints,
|
||||
List<Vb::Point>& initialPoints,
|
||||
const treeBoundBox& bb,
|
||||
bool overlapping
|
||||
) const;
|
||||
@ -156,7 +156,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
virtual List<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ bodyCentredCubic::bodyCentredCubic
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
List<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
{
|
||||
boundBox bb;
|
||||
|
||||
@ -91,7 +91,7 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
List<Vb::Point> initialPoints;
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
@ -177,7 +177,7 @@ std::list<Vb::Point> bodyCentredCubic::initialPoints() const
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
virtual List<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ faceCentredCubic::faceCentredCubic
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
List<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
{
|
||||
boundBox bb;
|
||||
|
||||
@ -91,7 +91,7 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
List<Vb::Point> initialPoints;
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
@ -238,7 +238,7 @@ std::list<Vb::Point> faceCentredCubic::initialPoints() const
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
virtual List<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -139,7 +139,7 @@ public:
|
||||
}
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const = 0;
|
||||
virtual List<Vb::Point> initialPoints() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ pointFile::pointFile
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> pointFile::initialPoints() const
|
||||
List<Vb::Point> pointFile::initialPoints() const
|
||||
{
|
||||
pointIOField points
|
||||
(
|
||||
@ -69,7 +69,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
|
||||
|
||||
if (points.empty())
|
||||
{
|
||||
FatalErrorIn("std::list<Vb::Point> pointFile::initialPoints() const")
|
||||
FatalErrorIn("List<Vb::Point> pointFile::initialPoints() const")
|
||||
<< "Point file contain no points"
|
||||
<< exit(FatalError) << endl;
|
||||
}
|
||||
@ -126,7 +126,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
|
||||
}
|
||||
}
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
List<Vb::Point> initialPoints;
|
||||
|
||||
Field<bool> insidePoints = cvMesh_.geometryToConformTo().wellInside
|
||||
(
|
||||
@ -144,7 +144,7 @@ std::list<Vb::Point> pointFile::initialPoints() const
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
virtual List<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ uniformGrid::uniformGrid
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
List<Vb::Point> uniformGrid::initialPoints() const
|
||||
{
|
||||
boundBox bb;
|
||||
|
||||
@ -91,7 +91,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
|
||||
scalar pert = randomPerturbationCoeff_*cmptMin(delta);
|
||||
|
||||
std::list<Vb::Point> initialPoints;
|
||||
List<Vb::Point> initialPoints;
|
||||
|
||||
for (label i = 0; i < ni; i++)
|
||||
{
|
||||
@ -153,7 +153,7 @@ std::list<Vb::Point> uniformGrid::initialPoints() const
|
||||
{
|
||||
const point& p(points[i]);
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
initialPoints.append(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::list<Vb::Point> initialPoints() const;
|
||||
virtual List<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user