Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	applications/utilities/surface/surfaceCheck/surfaceCheck.C
This commit is contained in:
mattijs
2016-11-02 12:06:05 +00:00
6084 changed files with 146043 additions and 122074 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -136,12 +136,12 @@ int main(int argc, char *argv[])
Info<< "Additional Points:" << extraPoints.size() << endl;
vectorField pointsAll(points1);
label pointI = pointsAll.size();
label pointi = pointsAll.size();
pointsAll.setSize(pointsAll.size() + extraPoints.size());
forAll(extraPoints, i)
{
pointsAll[pointI++] = extraPoints[i];
pointsAll[pointi++] = extraPoints[i];
}
combinedSurf = triSurface(surface1, surface1.patches(), pointsAll);
@ -179,9 +179,9 @@ int main(int argc, char *argv[])
label trianglei = 0;
// Copy triangles1 into trianglesAll
forAll(surface1, faceI)
forAll(surface1, facei)
{
facesAll[trianglei++] = surface1[faceI];
facesAll[trianglei++] = surface1[facei];
}
label nRegions1 = surface1.patches().size();
@ -196,9 +196,9 @@ int main(int argc, char *argv[])
}
// Add (renumbered) surface2 triangles
forAll(surface2, faceI)
forAll(surface2, facei)
{
const labelledTri& tri = surface2[faceI];
const labelledTri& tri = surface2[facei];
labelledTri& destTri = facesAll[trianglei++];
destTri[0] = tri[0] + points1.size();
@ -223,13 +223,13 @@ int main(int argc, char *argv[])
// Overwrite
newPatches.setSize(max(nRegions1, nRegions2));
forAll(surface1.patches(), patchI)
forAll(surface1.patches(), patchi)
{
newPatches[patchI] = surface1.patches()[patchI];
newPatches[patchi] = surface1.patches()[patchi];
}
forAll(surface2.patches(), patchI)
forAll(surface2.patches(), patchi)
{
newPatches[patchI] = surface2.patches()[patchI];
newPatches[patchi] = surface2.patches()[patchi];
}
}
else
@ -247,24 +247,24 @@ int main(int argc, char *argv[])
newPatches.setSize(nRegions1 + nRegions2);
label newPatchI = 0;
label newPatchi = 0;
forAll(surface1.patches(), patchI)
forAll(surface1.patches(), patchi)
{
newPatches[newPatchI++] = surface1.patches()[patchI];
newPatches[newPatchi++] = surface1.patches()[patchi];
}
forAll(surface2.patches(), patchI)
forAll(surface2.patches(), patchi)
{
newPatches[newPatchI++] = surface2.patches()[patchI];
newPatches[newPatchi++] = surface2.patches()[patchi];
}
}
Info<< "New patches:" << nl;
forAll(newPatches, patchI)
forAll(newPatches, patchi)
{
Info<< " " << patchI << '\t' << newPatches[patchI].name() << nl;
Info<< " " << patchi << '\t' << newPatches[patchi].name() << nl;
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -69,19 +69,19 @@ bool validTri
(
const bool verbose,
const triSurface& surf,
const label faceI
const label facei
)
{
// Simple check on indices ok.
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
forAll(f, fp)
{
if (f[fp] < 0 || f[fp] >= surf.points().size())
{
WarningInFunction
<< "triangle " << faceI << " vertices " << f
<< "triangle " << facei << " vertices " << f
<< " uses point indices outside point range 0.."
<< surf.points().size()-1 << endl;
return false;
@ -91,7 +91,7 @@ bool validTri
if ((f[0] == f[1]) || (f[0] == f[2]) || (f[1] == f[2]))
{
WarningInFunction
<< "triangle " << faceI
<< "triangle " << facei
<< " uses non-unique vertices " << f
<< " coords:" << f.points(surf.points())
<< endl;
@ -100,21 +100,21 @@ bool validTri
// duplicate triangle check
const labelList& fFaces = surf.faceFaces()[faceI];
const labelList& fFaces = surf.faceFaces()[facei];
// Check if faceNeighbours use same points as this face.
// Note: discards normal information - sides of baffle are merged.
forAll(fFaces, i)
{
label nbrFaceI = fFaces[i];
label nbrFacei = fFaces[i];
if (nbrFaceI <= faceI)
if (nbrFacei <= facei)
{
// lower numbered faces already checked
continue;
}
const labelledTri& nbrF = surf[nbrFaceI];
const labelledTri& nbrF = surf[nbrFacei];
if
(
@ -124,8 +124,8 @@ bool validTri
)
{
WarningInFunction
<< "triangle " << faceI << " vertices " << f
<< " has the same vertices as triangle " << nbrFaceI
<< "triangle " << facei << " vertices " << f
<< " has the same vertices as triangle " << nbrFacei
<< " vertices " << nbrF
<< " coords:" << f.points(surf.points())
<< endl;
@ -250,11 +250,11 @@ void writeParts
{
boolList includeMap(surf.size(), false);
forAll(faceZone, faceI)
forAll(faceZone, facei)
{
if (faceZone[faceI] == zone)
if (faceZone[facei] == zone)
{
includeMap[faceI] = true;
includeMap[facei] = true;
}
}
@ -297,11 +297,11 @@ void syncEdges(const triSurface& p, labelHashSet& markedEdges)
edgeSet.insert(edges[iter.key()]);
}
forAll(edges, edgeI)
forAll(edges, edgei)
{
if (edgeSet.found(edges[edgeI]))
if (edgeSet.found(edges[edgei]))
{
markedEdges.insert(edgeI);
markedEdges.insert(edgei);
}
}
}
@ -314,9 +314,9 @@ void syncEdges(const triSurface& p, boolList& isMarkedEdge)
const edgeList& edges = p.edges();
label n = 0;
forAll(isMarkedEdge, edgeI)
forAll(isMarkedEdge, edgei)
{
if (isMarkedEdge[edgeI])
if (isMarkedEdge[edgei])
{
n++;
}
@ -324,19 +324,19 @@ void syncEdges(const triSurface& p, boolList& isMarkedEdge)
HashSet<edge, Hash<edge>> edgeSet(2*n);
forAll(isMarkedEdge, edgeI)
forAll(isMarkedEdge, edgei)
{
if (isMarkedEdge[edgeI])
if (isMarkedEdge[edgei])
{
edgeSet.insert(edges[edgeI]);
edgeSet.insert(edges[edgei]);
}
}
forAll(edges, edgeI)
forAll(edges, edgei)
{
if (edgeSet.found(edges[edgeI]))
if (edgeSet.found(edges[edgei]))
{
isMarkedEdge[edgeI] = true;
isMarkedEdge[edgei] = true;
}
}
}
@ -414,9 +414,9 @@ int main(int argc, char *argv[])
Info<< "// blockMeshDict info" << nl << nl;
Info<< "vertices\n(" << nl;
forAll(cornerPts, ptI)
forAll(cornerPts, pti)
{
Info<< " " << cornerPts[ptI] << nl;
Info<< " " << cornerPts[pti] << nl;
}
// number of divisions needs adjustment later
@ -439,14 +439,14 @@ int main(int argc, char *argv[])
{
labelList regionSize(surf.patches().size(), 0);
forAll(surf, faceI)
forAll(surf, facei)
{
label region = surf[faceI].region();
label region = surf[facei].region();
if (region < 0 || region >= regionSize.size())
{
WarningInFunction
<< "Triangle " << faceI << " vertices " << surf[faceI]
<< "Triangle " << facei << " vertices " << surf[facei]
<< " has region " << region << " which is outside the range"
<< " of regions 0.." << surf.patches().size()-1
<< endl;
@ -459,10 +459,10 @@ int main(int argc, char *argv[])
Info<< "Region\tSize" << nl
<< "------\t----" << nl;
forAll(surf.patches(), patchI)
forAll(surf.patches(), patchi)
{
Info<< surf.patches()[patchI].name() << '\t'
<< regionSize[patchI] << nl;
Info<< surf.patches()[patchi].name() << '\t'
<< regionSize[patchi] << nl;
}
Info<< nl << endl;
}
@ -474,11 +474,11 @@ int main(int argc, char *argv[])
{
DynamicList<label> illegalFaces(surf.size()/100 + 1);
forAll(surf, faceI)
forAll(surf, facei)
{
if (!validTri(verbose, surf, faceI))
if (!validTri(verbose, surf, facei))
{
illegalFaces.append(faceI);
illegalFaces.append(facei);
}
}
@ -510,19 +510,19 @@ int main(int argc, char *argv[])
{
scalarField triQ(surf.size(), 0);
forAll(surf, faceI)
forAll(surf, facei)
{
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
{
//WarningInFunction
// << "Illegal triangle " << faceI << " vertices " << f
// << "Illegal triangle " << facei << " vertices " << f
// << " coords " << f.points(surf.points()) << endl;
}
else
{
triQ[faceI] = triPointRef
triQ[facei] = triPointRef
(
surf.points()[f[0]],
surf.points()[f[1]],
@ -542,10 +542,10 @@ int main(int argc, char *argv[])
scalar dist = (1.0 - 0.0)/20.0;
scalar min = 0;
forAll(binCount, binI)
forAll(binCount, bini)
{
Info<< " " << min << " .. " << min+dist << " : "
<< 1.0/surf.size() * binCount[binI]
<< 1.0/surf.size() * binCount[bini]
<< endl;
min += dist;
}
@ -573,11 +573,11 @@ int main(int argc, char *argv[])
{
DynamicList<label> problemFaces(surf.size()/100+1);
forAll(triQ, faceI)
forAll(triQ, facei)
{
if (triQ[faceI] < 1e-11)
if (triQ[facei] < 1e-11)
{
problemFaces.append(faceI);
problemFaces.append(facei);
}
}
@ -604,23 +604,23 @@ int main(int argc, char *argv[])
scalarField edgeMag(edges.size());
forAll(edges, edgeI)
forAll(edges, edgei)
{
edgeMag[edgeI] = edges[edgeI].mag(localPoints);
edgeMag[edgei] = edges[edgei].mag(localPoints);
}
label minEdgeI = findMin(edgeMag);
label maxEdgeI = findMax(edgeMag);
label minEdgei = findMin(edgeMag);
label maxEdgei = findMax(edgeMag);
const edge& minE = edges[minEdgeI];
const edge& maxE = edges[maxEdgeI];
const edge& minE = edges[minEdgei];
const edge& maxE = edges[maxEdgei];
Info<< "Edges:" << nl
<< " min " << edgeMag[minEdgeI] << " for edge " << minEdgeI
<< " min " << edgeMag[minEdgei] << " for edge " << minEdgei
<< " points " << localPoints[minE[0]] << localPoints[minE[1]]
<< nl
<< " max " << edgeMag[maxEdgeI] << " for edge " << maxEdgeI
<< " max " << edgeMag[maxEdgei] << " for edge " << maxEdgei
<< " points " << localPoints[maxE[0]] << localPoints[maxE[1]]
<< nl
<< endl;
@ -648,25 +648,25 @@ int main(int argc, char *argv[])
for (label i = 1; i < sortedMag.size(); i++)
{
label ptI = sortedMag.indices()[i];
label pti = sortedMag.indices()[i];
label prevPtI = sortedMag.indices()[i-1];
label prevPti = sortedMag.indices()[i-1];
if (mag(localPoints[ptI] - localPoints[prevPtI]) < smallDim)
if (mag(localPoints[pti] - localPoints[prevPti]) < smallDim)
{
// Check if neighbours.
const labelList& pEdges = surf.pointEdges()[ptI];
const labelList& pEdges = surf.pointEdges()[pti];
label edgeI = -1;
label edgei = -1;
forAll(pEdges, i)
{
const edge& e = edges[pEdges[i]];
if (e[0] == prevPtI || e[1] == prevPtI)
if (e[0] == prevPti || e[1] == prevPti)
{
// point1 and point0 are connected through edge.
edgeI = pEdges[i];
edgei = pEdges[i];
break;
}
@ -674,24 +674,24 @@ int main(int argc, char *argv[])
nClose++;
if (edgeI == -1)
if (edgei == -1)
{
Info<< " close unconnected points "
<< ptI << ' ' << localPoints[ptI]
<< " and " << prevPtI << ' '
<< localPoints[prevPtI]
<< pti << ' ' << localPoints[pti]
<< " and " << prevPti << ' '
<< localPoints[prevPti]
<< " distance:"
<< mag(localPoints[ptI] - localPoints[prevPtI])
<< mag(localPoints[pti] - localPoints[prevPti])
<< endl;
}
else
{
Info<< " small edge between points "
<< ptI << ' ' << localPoints[ptI]
<< " and " << prevPtI << ' '
<< localPoints[prevPtI]
<< pti << ' ' << localPoints[pti]
<< " and " << prevPti << ' '
<< localPoints[prevPti]
<< " distance:"
<< mag(localPoints[ptI] - localPoints[prevPtI])
<< mag(localPoints[pti] - localPoints[prevPti])
<< endl;
}
}
@ -711,9 +711,9 @@ int main(int argc, char *argv[])
const labelListList& edgeFaces = surf.edgeFaces();
label nSingleEdges = 0;
forAll(edgeFaces, edgeI)
forAll(edgeFaces, edgei)
{
const labelList& myFaces = edgeFaces[edgeI];
const labelList& myFaces = edgeFaces[edgei];
if (myFaces.size() == 1)
{
@ -724,15 +724,15 @@ int main(int argc, char *argv[])
}
label nMultEdges = 0;
forAll(edgeFaces, edgeI)
forAll(edgeFaces, edgei)
{
const labelList& myFaces = edgeFaces[edgeI];
const labelList& myFaces = edgeFaces[edgei];
if (myFaces.size() > 2)
{
forAll(myFaces, myFaceI)
forAll(myFaces, myFacei)
{
problemFaces.append(myFaces[myFaceI]);
problemFaces.append(myFaces[myFacei]);
}
nMultEdges++;
@ -775,11 +775,11 @@ int main(int argc, char *argv[])
boolList borderEdge(surf.nEdges(), false);
if (splitNonManifold)
{
forAll(edgeFaces, edgeI)
forAll(edgeFaces, edgei)
{
if (edgeFaces[edgeI].size() > 2)
if (edgeFaces[edgei].size() > 2)
{
borderEdge[edgeI] = true;
borderEdge[edgei] = true;
}
}
syncEdges(surf, borderEdge);
@ -894,7 +894,7 @@ int main(int argc, char *argv[])
label nInt = 0;
forAll(surf.edges(), edgeI)
forAll(surf.edges(), edgei)
{
const edge& e = surf.edges()[edgeI];
const point& start = surf.points()[surf.meshPoints()[e[0]]];
@ -926,7 +926,6 @@ int main(int argc, char *argv[])
intStreamPtr().write(hitInfo2.hitPoint());
}
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -54,11 +54,11 @@ using namespace Foam;
//
// boolList include(surf.size(), false);
//
// forAll(collapseRegion, faceI)
// forAll(collapseRegion, facei)
// {
// if (collapseRegion[faceI] == regionI)
// if (collapseRegion[facei] == regionI)
// {
// include[faceI] = true;
// include[facei] = true;
// }
// }
//
@ -269,7 +269,7 @@ bool isSliver
const triSurface& surf,
const scalar minLen,
const scalar minQuality,
const label faceI,
const label facei,
const label edgeI
)
{
@ -284,12 +284,12 @@ bool isSliver
triSurfaceTools::oppositeVertex
(
surf,
faceI,
facei,
edgeI
);
const edge& e = surf.edges()[edgeI];
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
pointHit pHit =
e.line(localPoints).nearestDist
@ -306,10 +306,10 @@ bool isSliver
)
)
{
// Remove faceI and split all other faces using this
// Remove facei and split all other faces using this
// edge. This is done by 'replacing' the edgeI with the
// opposite0 vertex
//Pout<< "Splitting face " << faceI << " since distance "
//Pout<< "Splitting face " << facei << " since distance "
// << pHit.distance()
// << " from vertex " << opposite0
// << " to edge " << edgeI
@ -350,23 +350,23 @@ static void markCollapsedFaces
forAll(eFaces, i)
{
label faceI = eFaces[i];
label facei = eFaces[i];
bool isCandidate = isSliver(surf, minLen, minQuality, faceI, edgeI);
bool isCandidate = isSliver(surf, minLen, minQuality, facei, edgeI);
if (isCandidate)
{
// Mark face as being collapsed
if (faceToEdge[faceI] != -1)
if (faceToEdge[facei] != -1)
{
FatalErrorInFunction
<< "Cannot collapse face " << faceI << " since "
<< "Cannot collapse face " << facei << " since "
<< " is marked to be collapsed both to edge "
<< faceToEdge[faceI] << " and " << edgeI
<< faceToEdge[facei] << " and " << edgeI
<< abort(FatalError);
}
faceToEdge[faceI] = edgeI;
faceToEdge[facei] = edgeI;
}
}
}
@ -380,22 +380,22 @@ static void markRegion
const triSurface& surf,
const labelList& faceToEdge,
const label regionI,
const label faceI,
const label facei,
labelList& collapseRegion
)
{
if (faceToEdge[faceI] == -1 || collapseRegion[faceI] != -1)
if (faceToEdge[facei] == -1 || collapseRegion[facei] != -1)
{
FatalErrorInFunction
<< "Problem : crossed into uncollapsed/regionized face"
<< abort(FatalError);
}
collapseRegion[faceI] = regionI;
collapseRegion[facei] = regionI;
// Recurse across edges to collapsed neighbours
const labelList& fEdges = surf.faceEdges()[faceI];
const labelList& fEdges = surf.faceEdges()[facei];
forAll(fEdges, fEdgeI)
{
@ -405,28 +405,28 @@ static void markRegion
forAll(eFaces, i)
{
label nbrFaceI = eFaces[i];
label nbrFacei = eFaces[i];
if (faceToEdge[nbrFaceI] != -1)
if (faceToEdge[nbrFacei] != -1)
{
if (collapseRegion[nbrFaceI] == -1)
if (collapseRegion[nbrFacei] == -1)
{
markRegion
(
surf,
faceToEdge,
regionI,
nbrFaceI,
nbrFacei,
collapseRegion
);
}
else if (collapseRegion[nbrFaceI] != regionI)
else if (collapseRegion[nbrFacei] != regionI)
{
FatalErrorInFunction
<< "Edge:" << edgeI << " between face " << faceI
<< "Edge:" << edgeI << " between face " << facei
<< " with region " << regionI
<< " and face " << nbrFaceI
<< " with region " << collapseRegion[nbrFaceI]
<< " and face " << nbrFacei
<< " with region " << collapseRegion[nbrFacei]
<< endl;
}
}
@ -446,15 +446,15 @@ static label markRegions
{
label regionI = 0;
forAll(faceToEdge, faceI)
forAll(faceToEdge, facei)
{
if (collapseRegion[faceI] == -1 && faceToEdge[faceI] != -1)
if (collapseRegion[facei] == -1 && faceToEdge[facei] != -1)
{
//Pout<< "markRegions : Marking region:" << regionI
// << " starting from face " << faceI << endl;
// << " starting from face " << facei << endl;
// Collapsed face. Mark connected region with current region number
markRegion(surf, faceToEdge, regionI++, faceI, collapseRegion);
markRegion(surf, faceToEdge, regionI++, facei, collapseRegion);
}
}
return regionI;
@ -480,9 +480,9 @@ static label edgeType
forAll(eFaces, i)
{
label faceI = eFaces[i];
label facei = eFaces[i];
label region = collapseRegion[faceI];
label region = collapseRegion[facei];
if (region == -1)
{
@ -926,20 +926,20 @@ label collapseBase
forAll(eFaces, i)
{
label faceI = eFaces[i];
label facei = eFaces[i];
if (!faceHandled[faceI] && faceToEdge[faceI] == -1)
if (!faceHandled[facei] && faceToEdge[facei] == -1)
{
// Split face to use vertices.
splitTri
(
localFaces[faceI],
localFaces[facei],
e,
splitVerts,
newTris
);
faceHandled[faceI] = true;
faceHandled[facei] = true;
nSplit++;
}
@ -949,11 +949,11 @@ label collapseBase
}
// Copy all unsplit faces
forAll(faceHandled, faceI)
forAll(faceHandled, facei)
{
if (!faceHandled[faceI] && faceToEdge[faceI] == -1)
if (!faceHandled[facei] && faceToEdge[facei] == -1)
{
newTris.append(localFaces[faceI]);
newTris.append(localFaces[facei]);
}
}

View File

@ -28,12 +28,12 @@ License
static void markPointNbrs
(
const triSurface& surf,
const label faceI,
const label facei,
const bool val,
boolList& okToCollapse
)
{
const triSurface::FaceType& f = surf.localFaces()[faceI];
const triSurface::FaceType& f = surf.localFaces()[facei];
forAll(f, fp)
{
@ -57,9 +57,9 @@ static triSurface pack
List<labelledTri> newTriangles(surf.size());
label newTriangleI = 0;
forAll(surf, faceI)
forAll(surf, facei)
{
const labelledTri& f = surf.localFaces()[faceI];
const labelledTri& f = surf.localFaces()[facei];
label newA = pointMap[f[0]];
label newB = pointMap[f[1]];
@ -102,12 +102,12 @@ label collapseEdge(triSurface& surf, const scalar minLen)
boolList okToCollapse(surf.size(), true);
label nCollapsed = 0;
forAll(localFaces, faceI)
forAll(localFaces, facei)
{
if (okToCollapse[faceI])
if (okToCollapse[facei])
{
// Check edge lengths.
const triSurface::FaceType& f = localFaces[faceI];
const triSurface::FaceType& f = localFaces[facei];
forAll(f, fp)
{
@ -120,14 +120,14 @@ label collapseEdge(triSurface& surf, const scalar minLen)
pointMap[v1] = v;
newPoints[v] = 0.5*(localPoints[v1] + localPoints[v]);
//Pout<< "Collapsing triange " << faceI
//Pout<< "Collapsing triange " << facei
// << " to edge mid " << newPoints[v] << endl;
nCollapsed++;
okToCollapse[faceI] = false;
okToCollapse[facei] = false;
// Protect point neighbours from collapsing.
markPointNbrs(surf, faceI, false, okToCollapse);
markPointNbrs(surf, facei, false, okToCollapse);
break;
}

View File

@ -34,7 +34,7 @@ template<class Type>
List<Type>::List(int s){
num=0;
array_size = 0;
element = NULL;
element = nullptr;
if(s) {
allocate(s);
}

View File

@ -198,12 +198,12 @@ void ComputeEdgeCostAtVertex(Vertex *v) {
// cost (in member variable objdist).
if(v->neighbor.num==0) {
// v doesn't have neighbors so it costs nothing to collapse
v->collapse=NULL;
v->collapse=nullptr;
v->objdist=-0.01f;
return;
}
v->objdist = 1000000;
v->collapse=NULL;
v->collapse=nullptr;
// search all neighboring edges for "least cost" edge
for(int i=0;i<v->neighbor.num;i++) {
float dist;

View File

@ -271,35 +271,35 @@ HWND CreateOpenGLWindow(char* title)
/* only register the window class once - use hInstance as a flag. */
if (!hInstance) {
hInstance = GetModuleHandle(NULL);
hInstance = GetModuleHandle(nullptr);
wc.style = CS_OWNDC;
wc.lpfnWndProc = (WNDPROC)WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.hIcon = LoadIcon(nullptr, IDI_WINLOGO);
wc.hCursor = LoadCursor(nullptr, IDC_ARROW);
wc.hbrBackground = nullptr;
wc.lpszMenuName = nullptr;
wc.lpszClassName = "OpenGL";
if (!RegisterClass(&wc)) {
MessageBox(NULL, "RegisterClass() failed: "
MessageBox(nullptr, "RegisterClass() failed: "
"Cannot register window class.",
"Error", MB_OK);
return NULL;
return nullptr;
}
}
hWnd = CreateWindow("OpenGL", title, WS_OVERLAPPEDWINDOW |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0,0,Width,Height, NULL, NULL, hInstance, NULL);
0,0,Width,Height, nullptr, nullptr, hInstance, nullptr);
if (hWnd == NULL) {
MessageBox(NULL,
if (hWnd == nullptr) {
MessageBox(nullptr,
"CreateWindow() failed: Cannot create a window.",
"Error", MB_OK);
return NULL;
return nullptr;
}
hDC = GetDC(hWnd);
@ -318,14 +318,14 @@ HWND CreateOpenGLWindow(char* title)
pf = ChoosePixelFormat(hDC, &pfd);
if (pf == 0) {
MessageBox(NULL, "ChoosePixelFormat() failed: "
MessageBox(nullptr, "ChoosePixelFormat() failed: "
"Cannot find a suitable pixel format.",
"Error", MB_OK);
return 0;
}
if (SetPixelFormat(hDC, pf, &pfd) == FALSE) {
MessageBox(NULL, "SetPixelFormat() failed: "
MessageBox(nullptr, "SetPixelFormat() failed: "
"Cannot set format specified.", "Error", MB_OK);
return 0;
}
@ -414,7 +414,7 @@ int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
CalcFPSDeltaT();
hWnd = CreateOpenGLWindow("bunnylod by Stan Melax");
if (hWnd == NULL) exit(1);
if (hWnd == nullptr) exit(1);
hDC = GetDC(hWnd);
hRC = wglCreateContext(hDC);
@ -444,7 +444,7 @@ int APIENTRY WinMain(HINSTANCE hCurrentInst, HINSTANCE hPreviousInst,
}
quit:
wglMakeCurrent(NULL, NULL);
wglMakeCurrent(nullptr, nullptr);
ReleaseDC(hDC, hWnd);
wglDeleteContext(hRC);
DestroyWindow(hWnd);

View File

@ -116,9 +116,9 @@ int main(int argc, char *argv[])
vert.Add( ::Vector(pt.x(), pt.y(), pt.z()));
}
forAll(surf, faceI)
forAll(surf, facei)
{
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
tridata td;
td.v[0]=f[0];

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,16 +31,17 @@ Description
Converts from one surface mesh format to another.
Usage
- surfaceConvert inputFile outputFile [OPTION]
\b surfaceConvert inputFile outputFile [OPTION]
\param -clean \n
Perform some surface checking/cleanup on the input surface
Options:
- \par -clean
Perform some surface checking/cleanup on the input surface
\param -scale \<scale\> \n
Specify a scaling factor for writing the files
- \par -scale \<scale\>
Specify a scaling factor for writing the files
\param -group \n
Orders faces by region
- \par -group
Orders faces by region
Note
The filename extensions are used to determine the file format type.

View File

@ -211,8 +211,8 @@ vectorField calcVertexNormals(const triSurface& surf)
forAll(pFaces, fI)
{
const label faceI = pFaces[fI];
const triFace& f = surf[faceI];
const label facei = pFaces[fI];
const triFace& f = surf[facei];
vector fN = f.normal(points);
@ -378,7 +378,7 @@ triSurfacePointScalarField calcCurvature
);
// Calculate weight
// @todo Voronoi area weighting
// TODO: Voronoi area weighting
scalar weight = calcVertexNormalWeight
(
f,
@ -755,9 +755,9 @@ surfaceFeatures::edgeStatus checkFlatRegionEdge
DynamicList<Foam::vector> normals(2);
DynamicList<labelList> bins(2);
forAll(eFaces, eFaceI)
forAll(eFaces, eFacei)
{
const Foam::vector& n = surf.faceNormals()[eFaces[eFaceI]];
const Foam::vector& n = surf.faceNormals()[eFaces[eFacei]];
// Find the normal in normals
label index = -1;
@ -772,7 +772,7 @@ surfaceFeatures::edgeStatus checkFlatRegionEdge
if (index != -1)
{
bins[index].append(eFaceI);
bins[index].append(eFacei);
}
else if (normals.size() >= 2)
{
@ -786,7 +786,7 @@ surfaceFeatures::edgeStatus checkFlatRegionEdge
else
{
normals.append(n);
bins.append(labelList(1, eFaceI));
bins.append(labelList(1, eFacei));
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -73,13 +73,13 @@ int main(int argc, char *argv[])
label minIndex = -1;
scalar minDist = GREAT;
forAll(localPoints, pointI)
forAll(localPoints, pointi)
{
const scalar dist = mag(localPoints[pointI] - samplePt);
const scalar dist = mag(localPoints[pointi] - samplePt);
if (dist < minDist)
{
minDist = dist;
minIndex = pointI;
minIndex = pointi;
}
}
@ -99,15 +99,15 @@ int main(int argc, char *argv[])
minIndex = -1;
minDist = GREAT;
forAll(surf1, faceI)
forAll(surf1, facei)
{
const point centre = surf1[faceI].centre(points);
const point centre = surf1[facei].centre(points);
const scalar dist = mag(centre - samplePt);
if (dist < minDist)
{
minDist = dist;
minIndex = faceI;
minIndex = facei;
}
}

View File

@ -47,17 +47,17 @@ Usage
using namespace Foam;
// Split faceI along edgeI at position newPointI
// Split facei along edgeI at position newPointi
void greenRefine
(
const triSurface& surf,
const label faceI,
const label facei,
const label edgeI,
const label newPointI,
const label newPointi,
DynamicList<labelledTri>& newFaces
)
{
const labelledTri& f = surf.localFaces()[faceI];
const labelledTri& f = surf.localFaces()[facei];
const edge& e = surf.edges()[edgeI];
// Find index of edge in face.
@ -74,7 +74,7 @@ void greenRefine
labelledTri
(
f[fp0],
newPointI,
newPointi,
f[fp2],
f.region()
)
@ -83,7 +83,7 @@ void greenRefine
(
labelledTri
(
newPointI,
newPointi,
f[fp1],
f[fp2],
f.region()
@ -97,7 +97,7 @@ void greenRefine
labelledTri
(
f[fp2],
newPointI,
newPointi,
f[fp1],
f.region()
)
@ -106,7 +106,7 @@ void greenRefine
(
labelledTri
(
newPointI,
newPointi,
f[fp0],
f[fp1],
f.region()
@ -386,14 +386,14 @@ int main(int argc, char *argv[])
const labelListList& pointEdges = surf.pointEdges();
forAll(bPointsTobEdges, bPointI)
forAll(bPointsTobEdges, bPointi)
{
pointIndexHit& nearestHit = bPointsTobEdges[bPointI];
pointIndexHit& nearestHit = bPointsTobEdges[bPointi];
const label pointI = surf.boundaryPoints()[bPointI];
const point& samplePt = surf.localPoints()[pointI];
const label pointi = surf.boundaryPoints()[bPointi];
const point& samplePt = surf.localPoints()[pointi];
const labelList& pEdges = pointEdges[pointI];
const labelList& pEdges = pointEdges[pointi];
// Add edges connected to the edge to the shapeMask
DynamicList<label> shapeMask;
@ -431,7 +431,7 @@ int main(int argc, char *argv[])
)
{
nearestHit = currentHit;
bPointsHitTree[bPointI] = treeI;
bPointsHitTree[bPointi] = treeI;
}
}
@ -444,7 +444,7 @@ int main(int argc, char *argv[])
// (
// surf,
// nearestHit.index(),
// pointI,
// pointi,
// 30
// );
@ -455,20 +455,20 @@ int main(int argc, char *argv[])
}
}
forAll(bPointsTobEdges, bPointI)
forAll(bPointsTobEdges, bPointi)
{
const pointIndexHit& eHit = bPointsTobEdges[bPointI];
const pointIndexHit& eHit = bPointsTobEdges[bPointi];
if (eHit.hit())
{
const label hitSurfI = bPointsHitTree[bPointI];
const label hitSurfI = bPointsHitTree[bPointi];
const triSurface& hitSurf = newSurfaces[hitSurfI];
const label eIndex =
treeBoundaryEdges[hitSurfI][eHit.index()];
const edge& e = hitSurf.edges()[eIndex];
const label pointI = surf.boundaryPoints()[bPointI];
const label pointi = surf.boundaryPoints()[bPointi];
const labelList& eFaces = hitSurf.edgeFaces()[eIndex];
@ -481,16 +481,16 @@ int main(int argc, char *argv[])
continue;
}
const label faceI = eFaces[0];
const label facei = eFaces[0];
if (visitedFace[hitSurfI][faceI])
if (visitedFace[hitSurfI][facei])
{
continue;
}
DynamicList<labelledTri> newFacesFromSplit(2);
const point& pt = surf.localPoints()[pointI];
const point& pt = surf.localPoints()[pointi];
if
(
@ -509,38 +509,38 @@ int main(int argc, char *argv[])
nChanged++;
label newPointI = -1;
label newPointi = -1;
// Keep the points in the same place and move the edge
if (hitSurfI == surfI)
{
newPointI = pointI;
newPointi = pointi;
}
else
{
newPoints[hitSurfI].append(newPoints[surfI][pointI]);
newPointI = newPoints[hitSurfI].size() - 1;
newPoints[hitSurfI].append(newPoints[surfI][pointi]);
newPointi = newPoints[hitSurfI].size() - 1;
}
// Split the other face.
greenRefine
(
hitSurf,
faceI,
facei,
eIndex,
newPointI,
newPointi,
newFacesFromSplit
);
visitedFace[hitSurfI][faceI] = true;
visitedFace[hitSurfI][facei] = true;
forAll(newFacesFromSplit, newFaceI)
forAll(newFacesFromSplit, newFacei)
{
const labelledTri& fN = newFacesFromSplit[newFaceI];
const labelledTri& fN = newFacesFromSplit[newFacei];
if (newFaceI == 0)
if (newFacei == 0)
{
newFaces[hitSurfI][faceI] = fN;
newFaces[hitSurfI][facei] = fN;
}
else
{

View File

@ -335,14 +335,14 @@ int main(int argc, char *argv[])
scalar surfaceArea = 0;
forAll(surf, faceI)
forAll(surf, facei)
{
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
{
WarningInFunction
<< "Illegal triangle " << faceI << " vertices " << f
<< "Illegal triangle " << facei << " vertices " << f
<< " coords " << f.points(surf.points()) << endl;
}
else

View File

@ -32,28 +32,29 @@ Description
transformations (rotate/translate) on a coordinateSystem.
Usage
- surfaceMeshConvert inputFile outputFile [OPTION]
\b surfaceMeshConvert inputFile outputFile [OPTION]
\param -clean \n
Perform some surface checking/cleanup on the input surface.
Options:
- \par -clean
Perform some surface checking/cleanup on the input surface.
\param -scaleIn \<scale\> \n
Specify a scaling factor when reading files.
- \par -scaleIn \<scale\>
Specify a scaling factor when reading files.
\param -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
- \par -scaleOut \<scale\>
Specify a scaling factor when writing files.
\param -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
- \par -dict \<dictionary\>
Specify an alternative dictionary for constant/coordinateSystems.
\param -from \<coordinateSystem\> \n
Specify a coordinate System when reading files.
- \par -from \<coordinateSystem\>
Specify a coordinate System when reading files.
\param -to \<coordinateSystem\> \n
Specify a coordinate System when writing files.
- \par -to \<coordinateSystem\>
Specify a coordinate System when writing files.
\param -tri \n
Triangulate surface.
- \par -tri
Triangulate surface.
Note
The filename extensions are used to determine the file format type.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -32,22 +32,23 @@ Description
used for testing functionality.
Usage
- surfaceMeshConvertTesting inputFile outputFile [OPTION]
\b surfaceMeshConvertTesting inputFile outputFile [OPTION]
\param -clean \n
Perform some surface checking/cleanup on the input surface
Options:
- \par -clean
Perform some surface checking/cleanup on the input surface
\param -orient \n
Check face orientation on the input surface
- \par -orient
Check face orientation on the input surface
\param -scale \<scale\> \n
Specify a scaling factor for writing the files
- \par -scale \<scale\>
Specify a scaling factor for writing the files
\param -triSurface \n
Use triSurface library for input/output
- \par -triSurface
Use triSurface library for input/output
\param -keyed \n
Use keyedSurface for input/output
- \par -keyed
Use keyedSurface for input/output
Note
The filename extensions are used to determine the file format type.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,28 +33,29 @@ Description
coordinateSystem.
Usage
- surfaceMeshExport outputFile [OPTION]
\b surfaceMeshExport outputFile [OPTION]
\param -clean \n
Perform some surface checking/cleanup on the input surface.
Options:
- \par -clean
Perform some surface checking/cleanup on the input surface.
\param -name \<name\> \n
Specify an alternative surface name when writing.
- \par -name \<name\>
Specify an alternative surface name when writing.
\param -scaleIn \<scale\> \n
Specify a scaling factor when reading files.
- \par -scaleIn \<scale\>
Specify a scaling factor when reading files.
\param -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
- \par -scaleOut \<scale\>
Specify a scaling factor when writing files.
\param -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
- \par -dict \<dictionary\>
Specify an alternative dictionary for constant/coordinateSystems.
\param -from \<coordinateSystem\> \n
Specify a coordinate system when reading files.
- \par -from \<coordinateSystem\>
Specify a coordinate system when reading files.
\param -to \<coordinateSystem\> \n
Specify a coordinate system when writing files.
- \par -to \<coordinateSystem\>
Specify a coordinate system when writing files.
Note
The filename extensions are used to determine the file format type.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,28 +33,29 @@ Description
on a coordinateSystem.
Usage
- surfaceMeshImport inputFile [OPTION]
\b surfaceMeshImport inputFile [OPTION]
\param -clean \n
Perform some surface checking/cleanup on the input surface.
Options:
- \par -clean
Perform some surface checking/cleanup on the input surface.
\param -name \<name\> \n
Specify an alternative surface name when writing.
- \par -name \<name\>
Specify an alternative surface name when writing.
\param -scaleIn \<scale\> \n
Specify a scaling factor when reading files.
- \par -scaleIn \<scale\>
Specify a scaling factor when reading files.
\param -scaleOut \<scale\> \n
Specify a scaling factor when writing files.
- \par -scaleOut \<scale\>
Specify a scaling factor when writing files.
\param -dict \<dictionary\> \n
Specify an alternative dictionary for constant/coordinateSystems.
- \par -dict \<dictionary\>
Specify an alternative dictionary for constant/coordinateSystems.
\param -from \<coordinateSystem\> \n
Specify a coordinate system when reading files.
- \par -from \<coordinateSystem\>
Specify a coordinate system when reading files.
\param -to \<coordinateSystem\> \n
Specify a coordinate system when writing files.
- \par -to \<coordinateSystem\>
Specify a coordinate system when writing files.
Note
The filename extensions are used to determine the file format type.

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -33,16 +33,17 @@ Description
is suppressed.
Usage
- surfaceMeshInfo surfaceFile [OPTION]
\b surfaceMeshInfo surfaceFile [OPTION]
\param -areas \n
Report area for each face.
Options:
- \par -areas
Report area for each face.
\param -scale \<scale\> \n
Specify a scaling factor when reading files.
- \par -scale \<scale\>
Specify a scaling factor when reading files.
\param -xml \n
Write output in XML format.
- \par -xml
Write output in XML format.
Note
The filename extensions are used to determine the file format type.
@ -148,9 +149,9 @@ int main(int argc, char *argv[])
}
}
forAll(surf, faceI)
forAll(surf, facei)
{
const scalar fArea(surf[faceI].mag(surf.points()));
const scalar fArea(surf[facei].mag(surf.points()));
areaTotal += fArea;
if (writeAreas)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,13 +132,13 @@ int main(int argc, char *argv[])
}
else
{
forAll(bMesh, patchI)
forAll(bMesh, patchi)
{
const polyPatch& patch = bMesh[patchI];
const polyPatch& patch = bMesh[patchi];
if (includeProcPatches || !isA<processorPolyPatch>(patch))
{
includePatches.insert(patchI);
includePatches.insert(patchi);
}
}
}
@ -233,10 +233,10 @@ int main(int argc, char *argv[])
labelList faceZoneToCompactZone(bMesh.size(), -1);
forAllConstIter(HashTable<label>, compactZoneID, iter)
{
label patchI = bMesh.findPatchID(iter.key());
if (patchI != -1)
label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchI] = iter();
patchToCompactZone[patchi] = iter();
}
else
{

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,7 +46,7 @@ namespace searchableSurfaceModifiers
{
/*---------------------------------------------------------------------------*\
Class autoPatch Declaration
Class autoPatch Declaration
\*---------------------------------------------------------------------------*/
class autoPatch
@ -76,7 +76,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>(NULL);
return autoPtr<searchableSurfaceModifier>(nullptr);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -53,7 +53,7 @@ namespace searchableSurfaceModifiers
{
/*---------------------------------------------------------------------------*\
Class cut Declaration
Class cut Declaration
\*---------------------------------------------------------------------------*/
class cut
@ -100,7 +100,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>(NULL);
return autoPtr<searchableSurfaceModifier>(nullptr);
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,7 +52,7 @@ class searchableSurface;
class searchableSurfaces;
/*---------------------------------------------------------------------------*\
Class searchableSurfaceModifier Declaration
Class searchableSurfaceModifier Declaration
\*---------------------------------------------------------------------------*/
class searchableSurfaceModifier
@ -96,7 +96,7 @@ public:
autoPtr<searchableSurfaceModifier> clone() const
{
NotImplemented;
return autoPtr<searchableSurfaceModifier>(NULL);
return autoPtr<searchableSurfaceModifier>(nullptr);
}

View File

@ -76,11 +76,11 @@ void writeProcStats
Pstream::gatherList(nFaces);
Pstream::scatterList(nFaces);
forAll(surfBb, procI)
forAll(surfBb, proci)
{
Info<< "processor" << procI << nl;
Info<< "processor" << proci << nl;
const List<treeBoundBox>& bbs = meshBb[procI];
const List<treeBoundBox>& bbs = meshBb[proci];
if (bbs.size())
{
Info<< "\tMesh bounds : " << bbs[0] << nl;
@ -89,9 +89,9 @@ void writeProcStats
Info<< "\t " << bbs[i]<< nl;
}
}
Info<< "\tSurface bounding box : " << surfBb[procI] << nl
<< "\tTriangles : " << nFaces[procI] << nl
<< "\tVertices : " << nPoints[procI]
Info<< "\tSurface bounding box : " << surfBb[proci] << nl
<< "\tTriangles : " << nFaces[proci] << nl
<< "\tVertices : " << nPoints[proci]
<< endl;
}
Info<< endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,15 +66,15 @@ int main(int argc, char *argv[])
const geometricSurfacePatchList& patches = surf.patches();
forAll(patches, patchI)
forAll(patches, patchi)
{
const geometricSurfacePatch& pp = patches[patchI];
const geometricSurfacePatch& pp = patches[patchi];
word patchName = pp.name();
if (patchName.empty())
{
patchName = "patch" + Foam::name(patchI);
patchName = "patch" + Foam::name(patchi);
}
fileName outFile(surfBase + '_' + patchName + '.' + extension);
@ -86,13 +86,13 @@ int main(int argc, char *argv[])
// Collect faces of region
boolList includeMap(surf.size(), false);
forAll(surf, faceI)
forAll(surf, facei)
{
const labelledTri& f = surf[faceI];
const labelledTri& f = surf[facei];
if (f.region() == patchI)
if (f.region() == patchi)
{
includeMap[faceI] = true;
includeMap[facei] = true;
}
}

View File

@ -50,10 +50,10 @@ int main(int argc, char *argv[])
argList::validArgs.append("output surface file");
argList args(argc, argv);
fileName surfFileName(args.additionalArgs()[0]);
fileName surfFileName(args[1]);
Info<< "Reading surface from " << surfFileName << endl;
fileName outFileName(args.additionalArgs()[1]);
fileName outFileName(args[2]);
fileName outFileBaseName = outFileName.lessExt();
word outExtension = outFileName.ext();

View File

@ -87,11 +87,11 @@ void dumpPoints(const triSurface& surf, const labelList& borderPoint)
OFstream os(fName);
forAll(borderPoint, pointI)
forAll(borderPoint, pointi)
{
if (borderPoint[pointI] != -1)
if (borderPoint[pointi] != -1)
{
const point& pt = surf.localPoints()[pointI];
const point& pt = surf.localPoints()[pointi];
os << "v " << pt.x() << ' ' << pt.y() << ' ' << pt.z() << endl;
}
@ -216,9 +216,9 @@ label markBorderPoints
const labelListList& pointEdges = surf.pointEdges();
forAll(pointEdges, pointI)
forAll(pointEdges, pointi)
{
const labelList& pEdges = pointEdges[pointI];
const labelList& pEdges = pointEdges[pointi];
label nBorderEdges = 0;
@ -230,9 +230,9 @@ label markBorderPoints
}
}
if (nBorderEdges == 2 && borderPoint[pointI] == -1)
if (nBorderEdges == 2 && borderPoint[pointi] == -1)
{
borderPoint[pointI] = nPoints++;
borderPoint[pointi] = nPoints++;
}
}
@ -247,13 +247,13 @@ label markBorderPoints
}
// Get minumum length of edges connected to pointI
// Get minumum length of edges connected to pointi
// Serves to get some local length scale.
scalar minEdgeLen(const triSurface& surf, const label pointI)
scalar minEdgeLen(const triSurface& surf, const label pointi)
{
const pointField& points = surf.localPoints();
const labelList& pEdges = surf.pointEdges()[pointI];
const labelList& pEdges = surf.pointEdges()[pointi];
scalar minLen = GREAT;
@ -313,16 +313,16 @@ label findEdge
}
// Get the other edge connected to pointI on faceI.
// Get the other edge connected to pointi on facei.
label otherEdge
(
const triSurface& surf,
const label faceI,
const label facei,
const label otherEdgeI,
const label pointI
const label pointi
)
{
const labelList& fEdges = surf.faceEdges()[faceI];
const labelList& fEdges = surf.faceEdges()[facei];
forAll(fEdges, i)
{
@ -334,8 +334,8 @@ label otherEdge
(
edgeI != otherEdgeI
&& (
e.start() == pointI
|| e.end() == pointI
e.start() == pointi
|| e.end() == pointi
)
)
{
@ -344,8 +344,8 @@ label otherEdge
}
FatalErrorInFunction
<< " verts:" << surf.localPoints()[faceI]
<< " connected to point " << pointI
<< " verts:" << surf.localPoints()[facei]
<< " connected to point " << pointi
<< " faceEdges:" << UIndirectList<edge>(surf.edges(), fEdges)()
<< abort(FatalError);
@ -362,32 +362,32 @@ void walkSplitLine
const boolList& borderEdge,
const labelList& borderPoint,
const label startFaceI,
const label startFacei,
const label startEdgeI, // is border edge
const label startPointI, // is border point
const label startPointi, // is border point
Map<label>& faceToEdge,
Map<label>& faceToPoint
)
{
label faceI = startFaceI;
label facei = startFacei;
label edgeI = startEdgeI;
label pointI = startPointI;
label pointi = startPointi;
do
{
//
// Stick to pointI and walk face-edge-face until back on border edge.
// Stick to pointi and walk face-edge-face until back on border edge.
//
do
{
// Cross face to next edge.
edgeI = otherEdge(surf, faceI, edgeI, pointI);
edgeI = otherEdge(surf, facei, edgeI, pointi);
if (borderEdge[edgeI])
{
if (!faceToEdge.insert(faceI, edgeI))
if (!faceToEdge.insert(facei, edgeI))
{
// Was already visited.
return;
@ -398,7 +398,7 @@ void walkSplitLine
break;
}
}
else if (!faceToPoint.insert(faceI, pointI))
else if (!faceToPoint.insert(facei, pointi))
{
// Was already visited.
return;
@ -414,13 +414,13 @@ void walkSplitLine
<< abort(FatalError);
}
if (eFaces[0] == faceI)
if (eFaces[0] == facei)
{
faceI = eFaces[1];
facei = eFaces[1];
}
else if (eFaces[1] == faceI)
else if (eFaces[1] == facei)
{
faceI = eFaces[0];
facei = eFaces[0];
}
else
{
@ -434,9 +434,9 @@ void walkSplitLine
// Back on border edge. Cross to other point on edge.
//
pointI = surf.edges()[edgeI].otherVertex(pointI);
pointi = surf.edges()[edgeI].otherVertex(pointi);
if (borderPoint[pointI] == -1)
if (borderPoint[pointi] == -1)
{
return;
}
@ -451,7 +451,7 @@ void walkSplitLine
label sharedFace
(
const triSurface& surf,
const label firstFaceI,
const label firstFacei,
const label sharedEdgeI
)
{
@ -459,7 +459,7 @@ label sharedFace
const edge& e = surf.edges()[sharedEdgeI];
const triSurface::FaceType& f = surf.localFaces()[firstFaceI];
const triSurface::FaceType& f = surf.localFaces()[firstFacei];
label startIndex = findIndex(f, e.start());
@ -472,16 +472,16 @@ label sharedFace
const labelList& eFaces = surf.sortedEdgeFaces()[sharedEdgeI];
// Get position of face in sorted edge faces
label faceIndex = findIndex(eFaces, firstFaceI);
label faceIndex = findIndex(eFaces, firstFacei);
if (edgeOrder)
{
// Get face before firstFaceI
// Get face before firstFacei
return eFaces[eFaces.rcIndex(faceIndex)];
}
else
{
// Get face after firstFaceI
// Get face after firstFacei
return eFaces[eFaces.fcIndex(faceIndex)];
}
}
@ -521,17 +521,17 @@ void calcPointVecs
forAll(eFaces, i)
{
label faceI = eFaces[i];
label facei = eFaces[i];
if (faceToEdge.found(faceI))
if (faceToEdge.found(facei))
{
if (face0I == -1)
{
face0I = faceI;
face0I = facei;
}
else if (face1I == -1)
{
face1I = faceI;
face1I = facei;
break;
}
@ -608,14 +608,14 @@ void renumberFaces
{
forAllConstIter(Map<label>, faceToEdge, iter)
{
const label faceI = iter.key();
const triSurface::FaceType& f = surf.localFaces()[faceI];
const label facei = iter.key();
const triSurface::FaceType& f = surf.localFaces()[facei];
forAll(f, fp)
{
if (pointMap[f[fp]] != -1)
{
newTris[faceI][fp] = pointMap[f[fp]];
newTris[facei][fp] = pointMap[f[fp]];
}
}
}
@ -778,7 +778,7 @@ int main(int argc, char *argv[])
//
label startEdgeI = -1;
label startPointI = -1;
label startPointi = -1;
forAll(borderEdge, edgeI)
{
@ -789,14 +789,14 @@ int main(int argc, char *argv[])
if ((borderPoint[e[0]] != -1) && (borderPoint[e[1]] == -1))
{
startEdgeI = edgeI;
startPointI = e[0];
startPointi = e[0];
break;
}
else if ((borderPoint[e[0]] == -1) && (borderPoint[e[1]] != -1))
{
startEdgeI = edgeI;
startPointI = e[1];
startPointi = e[1];
break;
}
@ -813,17 +813,17 @@ int main(int argc, char *argv[])
// Pick any face using edge to start from.
const labelList& eFaces = surf.edgeFaces()[startEdgeI];
label firstFaceI = eFaces[0];
label firstFacei = eFaces[0];
// Find second face which is from same surface i.e. has outwards
// pointing normal as well (actually bit more complex than this)
label secondFaceI = sharedFace(surf, firstFaceI, startEdgeI);
label secondFacei = sharedFace(surf, firstFacei, startEdgeI);
Info<< "Starting local walk from:" << endl
<< " edge :" << startEdgeI << endl
<< " point:" << startPointI << endl
<< " face0:" << firstFaceI << endl
<< " face1:" << secondFaceI << endl
<< " point:" << startPointi << endl
<< " face0:" << firstFacei << endl
<< " face1:" << secondFacei << endl
<< endl;
// From face on border edge to edge.
@ -831,7 +831,7 @@ int main(int argc, char *argv[])
// From face connected to border point (but not border edge) to point.
Map<label> faceToPoint(2*nBorderPoints);
faceToEdge.insert(firstFaceI, startEdgeI);
faceToEdge.insert(firstFacei, startEdgeI);
walkSplitLine
(
@ -839,15 +839,15 @@ int main(int argc, char *argv[])
borderEdge,
borderPoint,
firstFaceI,
firstFacei,
startEdgeI,
startPointI,
startPointi,
faceToEdge,
faceToPoint
);
faceToEdge.insert(secondFaceI, startEdgeI);
faceToEdge.insert(secondFacei, startEdgeI);
walkSplitLine
(
@ -855,9 +855,9 @@ int main(int argc, char *argv[])
borderEdge,
borderPoint,
secondFaceI,
secondFacei,
startEdgeI,
startPointI,
startPointi,
faceToEdge,
faceToPoint
@ -890,18 +890,18 @@ int main(int argc, char *argv[])
pointField newPoints(surf.localPoints());
newPoints.setSize(newPoints.size() + nBorderPoints);
forAll(borderPoint, pointI)
forAll(borderPoint, pointi)
{
label newPointI = borderPoint[pointI];
label newPointi = borderPoint[pointi];
if (newPointI != -1)
if (newPointi != -1)
{
scalar minLen = minEdgeLen(surf, pointI);
scalar minLen = minEdgeLen(surf, pointi);
vector n = borderPointVec[pointI];
vector n = borderPointVec[pointi];
n /= mag(n);
newPoints[newPointI] = newPoints[pointI] + 0.1 * minLen * n;
newPoints[newPointi] = newPoints[pointi] + 0.1 * minLen * n;
}
}
@ -913,10 +913,10 @@ int main(int argc, char *argv[])
// Start off from copy of faces.
List<labelledTri> newTris(surf.size());
forAll(surf, faceI)
forAll(surf, facei)
{
newTris[faceI] = surf.localFaces()[faceI];
newTris[faceI].region() = surf[faceI].region();
newTris[facei] = surf.localFaces()[facei];
newTris[facei].region() = surf[facei].region();
}
// Renumber all faces in faceToEdge
@ -926,9 +926,9 @@ int main(int argc, char *argv[])
// Check if faces use unmoved points.
forAll(newTris, faceI)
forAll(newTris, facei)
{
const triSurface::FaceType& f = newTris[faceI];
const triSurface::FaceType& f = newTris[facei];
forAll(f, fp)
{
@ -936,7 +936,7 @@ int main(int argc, char *argv[])
if (mag(pt) >= GREAT/2)
{
Info<< "newTri:" << faceI << " verts:" << f
Info<< "newTri:" << facei << " verts:" << f
<< " vert:" << f[fp] << " point:" << pt << endl;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
@ -127,16 +127,16 @@ int main(int argc, char *argv[])
// pick up cells sharing the point
forAll(markedPoints, pointI)
forAll(markedPoints, pointi)
{
if
(
markedPoints[pointI] < 0
|| markedPoints[pointI] >= surf1.nPoints()
markedPoints[pointi] < 0
|| markedPoints[pointi] >= surf1.nPoints()
)
{
FatalErrorInFunction
<< "localPoint label " << markedPoints[pointI]
<< "localPoint label " << markedPoints[pointi]
<< "out of range."
<< " The mesh has got "
<< surf1.nPoints() << " localPoints."
@ -144,7 +144,7 @@ int main(int argc, char *argv[])
}
const labelList& curFaces =
surf1.pointFaces()[markedPoints[pointI]];
surf1.pointFaces()[markedPoints[pointi]];
forAll(curFaces, i)
{
@ -202,9 +202,9 @@ int main(int argc, char *argv[])
Info<< "Using zone min:" << min << " max:" << max << endl;
forAll(surf1, faceI)
forAll(surf1, facei)
{
const point centre = surf1[faceI].centre(surf1.points());
const point centre = surf1[facei].centre(surf1.points());
if
(
@ -216,7 +216,7 @@ int main(int argc, char *argv[])
&& (centre.z() <= max.z())
)
{
facesToSubset[faceI] = true;
facesToSubset[facei] = true;
}
}
}
@ -259,11 +259,11 @@ int main(int argc, char *argv[])
searchSelectSurf.tree();
// Check if face (centre) is in outside or inside.
forAll(facesToSubset, faceI)
forAll(facesToSubset, facei)
{
if (!facesToSubset[faceI])
if (!facesToSubset[facei])
{
const point fc(surf1[faceI].centre(surf1.points()));
const point fc(surf1[facei].centre(surf1.points()));
volumeType t = selectTree.getVolumeType(fc);
@ -274,7 +274,7 @@ int main(int argc, char *argv[])
: (t == volumeType::INSIDE)
)
{
facesToSubset[faceI] = true;
facesToSubset[facei] = true;
}
}
}
@ -292,14 +292,14 @@ int main(int argc, char *argv[])
// Select all triangles that are close to the plane and
// whose normal aligns with the plane as well.
forAll(surf1.faceCentres(), faceI)
forAll(surf1.faceCentres(), facei)
{
const point& fc = surf1.faceCentres()[faceI];
const point& nf = surf1.faceNormals()[faceI];
const point& fc = surf1.faceCentres()[facei];
const point& nf = surf1.faceNormals()[facei];
if (pl.distance(fc) < distance && mag(pl.normal() & nf) > cosAngle)
{
facesToSubset[faceI] = true;
facesToSubset[facei] = true;
}
}
}
@ -318,37 +318,37 @@ int main(int argc, char *argv[])
Info<< "Found " << markedFaces.size() << " marked face(s)." << endl;
// Check and mark faces to pick up
forAll(markedFaces, faceI)
forAll(markedFaces, facei)
{
if
(
markedFaces[faceI] < 0
|| markedFaces[faceI] >= surf1.size()
markedFaces[facei] < 0
|| markedFaces[facei] >= surf1.size()
)
{
FatalErrorInFunction
<< "Face label " << markedFaces[faceI] << "out of range."
<< "Face label " << markedFaces[facei] << "out of range."
<< " The mesh has got "
<< surf1.size() << " faces."
<< exit(FatalError);
}
// Mark the face
facesToSubset[markedFaces[faceI]] = true;
facesToSubset[markedFaces[facei]] = true;
// mark its neighbours if requested
if (addFaceNeighbours)
{
const labelList& curFaces =
surf1.faceFaces()[markedFaces[faceI]];
surf1.faceFaces()[markedFaces[facei]];
forAll(curFaces, i)
{
label faceI = curFaces[i];
label facei = curFaces[i];
if (!facesToSubset[faceI])
if (!facesToSubset[facei])
{
facesToSubset[faceI] = true;
facesToSubset[facei] = true;
nFaceNeighbours++;
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,41 +49,41 @@ using namespace Foam;
// Adds empty patch if not yet there. Returns patchID.
label addPatch(polyMesh& mesh, const word& patchName)
{
label patchI = mesh.boundaryMesh().findPatchID(patchName);
label patchi = mesh.boundaryMesh().findPatchID(patchName);
if (patchI == -1)
if (patchi == -1)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
List<polyPatch*> newPatches(patches.size() + 1);
patchI = 0;
patchi = 0;
// Copy all old patches
forAll(patches, i)
{
const polyPatch& pp = patches[i];
newPatches[patchI] =
newPatches[patchi] =
pp.clone
(
patches,
patchI,
patchi,
pp.size(),
pp.start()
).ptr();
patchI++;
patchi++;
}
// Add zero-sized patch
newPatches[patchI] =
newPatches[patchi] =
new polyPatch
(
patchName,
0,
mesh.nFaces(),
patchI,
patchi,
patches,
polyPatch::typeName
);
@ -91,14 +91,14 @@ label addPatch(polyMesh& mesh, const word& patchName)
mesh.removeBoundary();
mesh.addPatches(newPatches);
Pout<< "Created patch " << patchName << " at " << patchI << endl;
Pout<< "Created patch " << patchName << " at " << patchi << endl;
}
else
{
Pout<< "Reusing patch " << patchName << " at " << patchI << endl;
Pout<< "Reusing patch " << patchName << " at " << patchi << endl;
}
return patchI;
return patchi;
}
@ -109,26 +109,26 @@ bool repatchFace
const boundaryMesh& bMesh,
const labelList& nearest,
const labelList& surfToMeshPatch,
const label faceI,
const label facei,
polyTopoChange& meshMod
)
{
bool changed = false;
label bFaceI = faceI - mesh.nInternalFaces();
label bFacei = facei - mesh.nInternalFaces();
if (nearest[bFaceI] != -1)
if (nearest[bFacei] != -1)
{
// Use boundary mesh one.
label bMeshPatchID = bMesh.whichPatch(nearest[bFaceI]);
label bMeshPatchID = bMesh.whichPatch(nearest[bFacei]);
label patchID = surfToMeshPatch[bMeshPatchID];
if (patchID != mesh.boundaryMesh().whichPatch(faceI))
if (patchID != mesh.boundaryMesh().whichPatch(facei))
{
label own = mesh.faceOwner()[faceI];
label own = mesh.faceOwner()[facei];
label zoneID = mesh.faceZones().whichZone(faceI);
label zoneID = mesh.faceZones().whichZone(facei);
bool zoneFlip = false;
@ -136,15 +136,15 @@ bool repatchFace
{
const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
}
meshMod.setAction
(
polyModifyFace
(
mesh.faces()[faceI],// modified face
faceI, // label of face being modified
mesh.faces()[facei],// modified face
facei, // label of face being modified
own, // owner
-1, // neighbour
false, // face flip
@ -225,10 +225,10 @@ int main(int argc, char *argv[])
Info<< "Before patching:" << nl
<< " patch\tsize" << endl;
forAll(mesh.boundaryMesh(), patchI)
forAll(mesh.boundaryMesh(), patchi)
{
Info<< " " << mesh.boundaryMesh()[patchI].name() << '\t'
<< mesh.boundaryMesh()[patchI].size() << nl;
Info<< " " << mesh.boundaryMesh()[patchi].name() << '\t'
<< mesh.boundaryMesh()[patchi].size() << nl;
}
Info<< endl;
@ -258,11 +258,11 @@ int main(int argc, char *argv[])
// Dump unmatched faces to faceSet for debugging.
faceSet unmatchedFaces(mesh, "unmatchedFaces", nearest.size()/100);
forAll(nearest, bFaceI)
forAll(nearest, bFacei)
{
if (nearest[bFaceI] == -1)
if (nearest[bFacei] == -1)
{
unmatchedFaces.insert(mesh.nInternalFaces() + bFaceI);
unmatchedFaces.insert(mesh.nInternalFaces() + bFacei);
}
}
@ -286,9 +286,9 @@ int main(int argc, char *argv[])
forAllConstIter(faceSet, faceLabels, iter)
{
label faceI = iter.key();
label facei = iter.key();
if (repatchFace(mesh, bMesh, nearest, patchMap, faceI, meshMod))
if (repatchFace(mesh, bMesh, nearest, patchMap, facei, meshMod))
{
nChanged++;
}
@ -296,11 +296,11 @@ int main(int argc, char *argv[])
}
else
{
forAll(nearest, bFaceI)
forAll(nearest, bFacei)
{
label faceI = mesh.nInternalFaces() + bFaceI;
label facei = mesh.nInternalFaces() + bFacei;
if (repatchFace(mesh, bMesh, nearest, patchMap, faceI, meshMod))
if (repatchFace(mesh, bMesh, nearest, patchMap, facei, meshMod))
{
nChanged++;
}
@ -316,10 +316,10 @@ int main(int argc, char *argv[])
Info<< "After patching:" << nl
<< " patch\tsize" << endl;
forAll(mesh.boundaryMesh(), patchI)
forAll(mesh.boundaryMesh(), patchi)
{
Info<< " " << mesh.boundaryMesh()[patchI].name() << '\t'
<< mesh.boundaryMesh()[patchI].size() << endl;
Info<< " " << mesh.boundaryMesh()[patchi].name() << '\t'
<< mesh.boundaryMesh()[patchi].size() << endl;
}
Info<< endl;