mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Initial state after latest Foundation merge
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ defineTypeNameAndDebug(cellSplitter, 0);
|
||||
|
||||
void Foam::cellSplitter::getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
@ -54,12 +54,12 @@ void Foam::cellSplitter::getFaceInfo
|
||||
{
|
||||
patchID = -1;
|
||||
|
||||
if (!mesh_.isInternalFace(faceI))
|
||||
if (!mesh_.isInternalFace(facei))
|
||||
{
|
||||
patchID = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
patchID = mesh_.boundaryMesh().whichPatch(facei);
|
||||
}
|
||||
|
||||
zoneID = mesh_.faceZones().whichZone(faceI);
|
||||
zoneID = mesh_.faceZones().whichZone(facei);
|
||||
|
||||
zoneFlip = false;
|
||||
|
||||
@ -67,20 +67,20 @@ void Foam::cellSplitter::getFaceInfo
|
||||
{
|
||||
const faceZone& fZone = mesh_.faceZones()[zoneID];
|
||||
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find the new owner of faceI (since the original cell has been split into
|
||||
// Find the new owner of facei (since the original cell has been split into
|
||||
// newCells
|
||||
Foam::label Foam::cellSplitter::newOwner
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Map<labelList>& cellToCells
|
||||
) const
|
||||
{
|
||||
label oldOwn = mesh_.faceOwner()[faceI];
|
||||
label oldOwn = mesh_.faceOwner()[facei];
|
||||
|
||||
Map<labelList>::const_iterator fnd = cellToCells.find(oldOwn);
|
||||
|
||||
@ -97,18 +97,18 @@ Foam::label Foam::cellSplitter::newOwner
|
||||
|
||||
const cell& cFaces = mesh_.cells()[oldOwn];
|
||||
|
||||
return newCells[findIndex(cFaces, faceI)];
|
||||
return newCells[findIndex(cFaces, facei)];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::cellSplitter::newNeighbour
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Map<labelList>& cellToCells
|
||||
) const
|
||||
{
|
||||
label oldNbr = mesh_.faceNeighbour()[faceI];
|
||||
label oldNbr = mesh_.faceNeighbour()[facei];
|
||||
|
||||
Map<labelList>::const_iterator fnd = cellToCells.find(oldNbr);
|
||||
|
||||
@ -125,7 +125,7 @@ Foam::label Foam::cellSplitter::newNeighbour
|
||||
|
||||
const cell& cFaces = mesh_.cells()[oldNbr];
|
||||
|
||||
return newCells[findIndex(cFaces, faceI)];
|
||||
return newCells[findIndex(cFaces, facei)];
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,11 +164,11 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
forAllConstIter(Map<point>, cellToMidPoint, iter)
|
||||
{
|
||||
label cellI = iter.key();
|
||||
label celli = iter.key();
|
||||
|
||||
label anchorPoint = mesh_.cellPoints()[cellI][0];
|
||||
label anchorPoint = mesh_.cellPoints()[celli][0];
|
||||
|
||||
label addedPointI =
|
||||
label addedPointi =
|
||||
meshMod.setAction
|
||||
(
|
||||
polyAddPoint
|
||||
@ -179,11 +179,11 @@ void Foam::cellSplitter::setRefinement
|
||||
true // supports a cell
|
||||
)
|
||||
);
|
||||
addedPoints_.insert(cellI, addedPointI);
|
||||
addedPoints_.insert(celli, addedPointi);
|
||||
|
||||
//Pout<< "Added point " << addedPointI
|
||||
// << iter() << " in cell " << cellI << " with centre "
|
||||
// << mesh_.cellCentres()[cellI] << endl;
|
||||
//Pout<< "Added point " << addedPointi
|
||||
// << iter() << " in cell " << celli << " with centre "
|
||||
// << mesh_.cellCentres()[celli] << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -195,20 +195,20 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
forAllConstIter(Map<point>, cellToMidPoint, iter)
|
||||
{
|
||||
label cellI = iter.key();
|
||||
label celli = iter.key();
|
||||
|
||||
const cell& cFaces = mesh_.cells()[cellI];
|
||||
const cell& cFaces = mesh_.cells()[celli];
|
||||
|
||||
// Cells created for this cell.
|
||||
labelList newCells(cFaces.size());
|
||||
|
||||
// First pyramid is the original cell
|
||||
newCells[0] = cellI;
|
||||
newCells[0] = celli;
|
||||
|
||||
// Add other pyramids
|
||||
for (label i = 1; i < cFaces.size(); i++)
|
||||
{
|
||||
label addedCellI =
|
||||
label addedCelli =
|
||||
meshMod.setAction
|
||||
(
|
||||
polyAddCell
|
||||
@ -216,18 +216,18 @@ void Foam::cellSplitter::setRefinement
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
-1, // master face
|
||||
cellI, // master cell
|
||||
celli, // master cell
|
||||
-1 // zone
|
||||
)
|
||||
);
|
||||
|
||||
newCells[i] = addedCellI;
|
||||
newCells[i] = addedCelli;
|
||||
}
|
||||
|
||||
cellToCells.insert(cellI, newCells);
|
||||
cellToCells.insert(celli, newCells);
|
||||
|
||||
//Pout<< "Split cell " << cellI
|
||||
// << " with centre " << mesh_.cellCentres()[cellI] << nl
|
||||
//Pout<< "Split cell " << celli
|
||||
// << " with centre " << mesh_.cellCentres()[celli] << nl
|
||||
// << " faces:" << cFaces << nl
|
||||
// << " into :" << newCells << endl;
|
||||
}
|
||||
@ -240,13 +240,13 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
forAllConstIter(Map<point>, cellToMidPoint, iter)
|
||||
{
|
||||
label cellI = iter.key();
|
||||
label celli = iter.key();
|
||||
|
||||
label midPointI = addedPoints_[cellI];
|
||||
label midPointi = addedPoints_[celli];
|
||||
|
||||
const cell& cFaces = mesh_.cells()[cellI];
|
||||
const cell& cFaces = mesh_.cells()[celli];
|
||||
|
||||
const labelList& cEdges = mesh_.cellEdges()[cellI];
|
||||
const labelList& cEdges = mesh_.cellEdges()[celli];
|
||||
|
||||
forAll(cEdges, i)
|
||||
{
|
||||
@ -255,11 +255,11 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
// Get the faces on the cell using the edge
|
||||
label face0, face1;
|
||||
meshTools::getEdgeFaces(mesh_, cellI, edgeI, face0, face1);
|
||||
meshTools::getEdgeFaces(mesh_, celli, edgeI, face0, face1);
|
||||
|
||||
// Get the cells on both sides of the face by indexing into cFaces.
|
||||
// (since newly created cells are stored in cFaces order)
|
||||
const labelList& newCells = cellToCells[cellI];
|
||||
const labelList& newCells = cellToCells[celli];
|
||||
|
||||
label cell0 = newCells[findIndex(cFaces, face0)];
|
||||
label cell1 = newCells[findIndex(cFaces, face1)];
|
||||
@ -267,7 +267,7 @@ void Foam::cellSplitter::setRefinement
|
||||
if (cell0 < cell1)
|
||||
{
|
||||
// Construct face to midpoint that is pointing away from
|
||||
// (pyramid split off from) cellI
|
||||
// (pyramid split off from) celli
|
||||
|
||||
const face& f0 = mesh_.faces()[face0];
|
||||
|
||||
@ -275,21 +275,21 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
bool edgeInFaceOrder = (f0[f0.fcIndex(index)] == e[1]);
|
||||
|
||||
// Check if cellI is the face owner
|
||||
// Check if celli is the face owner
|
||||
|
||||
face newF(3);
|
||||
if (edgeInFaceOrder == (mesh_.faceOwner()[face0] == cellI))
|
||||
if (edgeInFaceOrder == (mesh_.faceOwner()[face0] == celli))
|
||||
{
|
||||
// edge used in face order.
|
||||
newF[0] = e[1];
|
||||
newF[1] = e[0];
|
||||
newF[2] = midPointI;
|
||||
newF[2] = midPointi;
|
||||
}
|
||||
else
|
||||
{
|
||||
newF[0] = e[0];
|
||||
newF[1] = e[1];
|
||||
newF[2] = midPointI;
|
||||
newF[2] = midPointi;
|
||||
}
|
||||
|
||||
// Now newF points away from cell0
|
||||
@ -313,7 +313,7 @@ void Foam::cellSplitter::setRefinement
|
||||
else
|
||||
{
|
||||
// Construct face to midpoint that is pointing away from
|
||||
// (pyramid split off from) cellI
|
||||
// (pyramid split off from) celli
|
||||
|
||||
const face& f1 = mesh_.faces()[face1];
|
||||
|
||||
@ -321,21 +321,21 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
bool edgeInFaceOrder = (f1[f1.fcIndex(index)] == e[1]);
|
||||
|
||||
// Check if cellI is the face owner
|
||||
// Check if celli is the face owner
|
||||
|
||||
face newF(3);
|
||||
if (edgeInFaceOrder == (mesh_.faceOwner()[face1] == cellI))
|
||||
if (edgeInFaceOrder == (mesh_.faceOwner()[face1] == celli))
|
||||
{
|
||||
// edge used in face order.
|
||||
newF[0] = e[1];
|
||||
newF[1] = e[0];
|
||||
newF[2] = midPointI;
|
||||
newF[2] = midPointi;
|
||||
}
|
||||
else
|
||||
{
|
||||
newF[0] = e[0];
|
||||
newF[1] = e[1];
|
||||
newF[2] = midPointI;
|
||||
newF[2] = midPointi;
|
||||
}
|
||||
|
||||
// Now newF points away from cell1
|
||||
@ -370,28 +370,28 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
forAllConstIter(Map<point>, cellToMidPoint, iter)
|
||||
{
|
||||
label cellI = iter.key();
|
||||
label celli = iter.key();
|
||||
|
||||
const cell& cFaces = mesh_.cells()[cellI];
|
||||
const cell& cFaces = mesh_.cells()[celli];
|
||||
|
||||
forAll(cFaces, i)
|
||||
{
|
||||
label faceI = cFaces[i];
|
||||
label facei = cFaces[i];
|
||||
|
||||
faceUpToDate[faceI] = false;
|
||||
faceUpToDate[facei] = false;
|
||||
}
|
||||
}
|
||||
|
||||
forAll(faceUpToDate, faceI)
|
||||
forAll(faceUpToDate, facei)
|
||||
{
|
||||
if (!faceUpToDate[faceI])
|
||||
if (!faceUpToDate[facei])
|
||||
{
|
||||
const face& f = mesh_.faces()[faceI];
|
||||
const face& f = mesh_.faces()[facei];
|
||||
|
||||
if (mesh_.isInternalFace(faceI))
|
||||
if (mesh_.isInternalFace(facei))
|
||||
{
|
||||
label newOwn = newOwner(faceI, cellToCells);
|
||||
label newNbr = newNeighbour(faceI, cellToCells);
|
||||
label newOwn = newOwner(facei, cellToCells);
|
||||
label newNbr = newNeighbour(facei, cellToCells);
|
||||
|
||||
if (newOwn < newNbr)
|
||||
{
|
||||
@ -400,7 +400,7 @@ void Foam::cellSplitter::setRefinement
|
||||
polyModifyFace
|
||||
(
|
||||
f,
|
||||
faceI,
|
||||
facei,
|
||||
newOwn, // owner
|
||||
newNbr, // neighbour
|
||||
false, // flux flip
|
||||
@ -418,7 +418,7 @@ void Foam::cellSplitter::setRefinement
|
||||
polyModifyFace
|
||||
(
|
||||
f.reverseFace(),
|
||||
faceI,
|
||||
facei,
|
||||
newNbr, // owner
|
||||
newOwn, // neighbour
|
||||
false, // flux flip
|
||||
@ -433,17 +433,17 @@ void Foam::cellSplitter::setRefinement
|
||||
}
|
||||
else
|
||||
{
|
||||
label newOwn = newOwner(faceI, cellToCells);
|
||||
label newOwn = newOwner(facei, cellToCells);
|
||||
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
getFaceInfo(facei, patchID, zoneID, zoneFlip);
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
(
|
||||
mesh_.faces()[faceI],
|
||||
faceI,
|
||||
mesh_.faces()[facei],
|
||||
facei,
|
||||
newOwn, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
@ -455,7 +455,7 @@ void Foam::cellSplitter::setRefinement
|
||||
);
|
||||
}
|
||||
|
||||
faceUpToDate[faceI] = true;
|
||||
faceUpToDate[facei] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -469,17 +469,17 @@ void Foam::cellSplitter::updateMesh(const mapPolyMesh& morphMap)
|
||||
|
||||
forAllConstIter(Map<label>, addedPoints_, iter)
|
||||
{
|
||||
label oldCellI = iter.key();
|
||||
label oldCelli = iter.key();
|
||||
|
||||
label newCellI = morphMap.reverseCellMap()[oldCellI];
|
||||
label newCelli = morphMap.reverseCellMap()[oldCelli];
|
||||
|
||||
label oldPointI = iter();
|
||||
label oldPointi = iter();
|
||||
|
||||
label newPointI = morphMap.reversePointMap()[oldPointI];
|
||||
label newPointi = morphMap.reversePointMap()[oldPointi];
|
||||
|
||||
if (newCellI >= 0 && newPointI >= 0)
|
||||
if (newCelli >= 0 && newPointi >= 0)
|
||||
{
|
||||
newAddedPoints.insert(newCellI, newPointI);
|
||||
newAddedPoints.insert(newCelli, newPointi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -71,7 +71,7 @@ class cellSplitter
|
||||
//- Get patch and zone info for face
|
||||
void getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
@ -80,14 +80,14 @@ class cellSplitter
|
||||
//- Find the new owner (if any) of the face.
|
||||
label newOwner
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Map<labelList>& cellToCells
|
||||
) const;
|
||||
|
||||
//- Find the new neighbour (if any) of the face.
|
||||
label newNeighbour
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Map<labelList>& cellToCells
|
||||
) const;
|
||||
|
||||
|
||||
@ -82,9 +82,9 @@ label findPoint(const primitivePatch& pp, const point& nearPoint)
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
label pointi = meshPoints[i];
|
||||
|
||||
scalar distSqr = magSqr(nearPoint - points[pointI]);
|
||||
scalar distSqr = magSqr(nearPoint - points[pointi]);
|
||||
|
||||
if (distSqr < minDistSqr)
|
||||
{
|
||||
@ -92,12 +92,12 @@ label findPoint(const primitivePatch& pp, const point& nearPoint)
|
||||
almostMinI = minI;
|
||||
|
||||
minDistSqr = distSqr;
|
||||
minI = pointI;
|
||||
minI = pointi;
|
||||
}
|
||||
else if (distSqr < almostMinDistSqr)
|
||||
{
|
||||
almostMinDistSqr = distSqr;
|
||||
almostMinI = pointI;
|
||||
almostMinI = pointi;
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,9 +226,9 @@ label findFace
|
||||
scalar almostMinDist = GREAT;
|
||||
label almostMinI = -1;
|
||||
|
||||
forAll(pp, patchFaceI)
|
||||
forAll(pp, patchFacei)
|
||||
{
|
||||
pointHit pHit(pp[patchFaceI].nearestPoint(nearPoint, points));
|
||||
pointHit pHit(pp[patchFacei].nearestPoint(nearPoint, points));
|
||||
|
||||
if (pHit.hit())
|
||||
{
|
||||
@ -238,12 +238,12 @@ label findFace
|
||||
almostMinI = minI;
|
||||
|
||||
minDist = pHit.distance();
|
||||
minI = patchFaceI + mesh.nInternalFaces();
|
||||
minI = patchFacei + mesh.nInternalFaces();
|
||||
}
|
||||
else if (pHit.distance() < almostMinDist)
|
||||
{
|
||||
almostMinDist = pHit.distance();
|
||||
almostMinI = patchFaceI + mesh.nInternalFaces();
|
||||
almostMinI = patchFacei + mesh.nInternalFaces();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,35 +282,35 @@ label findFace
|
||||
// Find cell with cell centre close to given point.
|
||||
label findCell(const primitiveMesh& mesh, const point& nearPoint)
|
||||
{
|
||||
label cellI = mesh.findCell(nearPoint);
|
||||
label celli = mesh.findCell(nearPoint);
|
||||
|
||||
if (cellI != -1)
|
||||
if (celli != -1)
|
||||
{
|
||||
scalar distToCcSqr = magSqr(nearPoint - mesh.cellCentres()[cellI]);
|
||||
scalar distToCcSqr = magSqr(nearPoint - mesh.cellCentres()[celli]);
|
||||
|
||||
const labelList& cPoints = mesh.cellPoints()[cellI];
|
||||
const labelList& cPoints = mesh.cellPoints()[celli];
|
||||
|
||||
label minI = -1;
|
||||
scalar minDistSqr = GREAT;
|
||||
|
||||
forAll(cPoints, i)
|
||||
{
|
||||
label pointI = cPoints[i];
|
||||
label pointi = cPoints[i];
|
||||
|
||||
scalar distSqr = magSqr(nearPoint - mesh.points()[pointI]);
|
||||
scalar distSqr = magSqr(nearPoint - mesh.points()[pointi]);
|
||||
|
||||
if (distSqr < minDistSqr)
|
||||
{
|
||||
minDistSqr = distSqr;
|
||||
minI = pointI;
|
||||
minI = pointi;
|
||||
}
|
||||
}
|
||||
|
||||
// Decide if nearPoint unique enough.
|
||||
Info<< "Found to point " << nearPoint << nl
|
||||
<< " nearest cell : " << cellI
|
||||
<< " nearest cell : " << celli
|
||||
<< " distance " << Foam::sqrt(distToCcSqr)
|
||||
<< " to cell centre " << mesh.cellCentres()[cellI] << nl
|
||||
<< " to cell centre " << mesh.cellCentres()[celli] << nl
|
||||
<< " nearest mesh point : " << minI
|
||||
<< " distance " << Foam::sqrt(minDistSqr)
|
||||
<< " to " << mesh.points()[minI] << nl
|
||||
@ -321,11 +321,11 @@ label findCell(const primitiveMesh& mesh, const point& nearPoint)
|
||||
Info<< "Mesh point too close to nearest cell centre. Aborting"
|
||||
<< endl;
|
||||
|
||||
cellI = -1;
|
||||
celli = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return cellI;
|
||||
return celli;
|
||||
}
|
||||
|
||||
|
||||
@ -432,11 +432,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const Pair<point>& pts = pointsToMove[i];
|
||||
|
||||
label pointI = findPoint(allBoundary, pts.first());
|
||||
label pointi = findPoint(allBoundary, pts.first());
|
||||
|
||||
if (pointI == -1 || !pointToPos.insert(pointI, pts.second()))
|
||||
if (pointi == -1 || !pointToPos.insert(pointi, pts.second()))
|
||||
{
|
||||
Info<< "Could not insert mesh point " << pointI
|
||||
Info<< "Could not insert mesh point " << pointi
|
||||
<< " for input point " << pts.first() << nl
|
||||
<< "Perhaps the point is already marked for moving?" << endl;
|
||||
validInputs = false;
|
||||
@ -473,11 +473,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const Pair<point>& pts = facesToTriangulate[i];
|
||||
|
||||
label faceI = findFace(mesh, allBoundary, pts.first());
|
||||
label facei = findFace(mesh, allBoundary, pts.first());
|
||||
|
||||
if (faceI == -1 || !faceToDecompose.insert(faceI, pts.second()))
|
||||
if (facei == -1 || !faceToDecompose.insert(facei, pts.second()))
|
||||
{
|
||||
Info<< "Could not insert mesh face " << faceI
|
||||
Info<< "Could not insert mesh face " << facei
|
||||
<< " for input point " << pts.first() << nl
|
||||
<< "Perhaps the face is already marked for splitting?" << endl;
|
||||
|
||||
@ -494,11 +494,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const Pair<point>& pts = cellsToPyramidise[i];
|
||||
|
||||
label cellI = findCell(mesh, pts.first());
|
||||
label celli = findCell(mesh, pts.first());
|
||||
|
||||
if (cellI == -1 || !cellToPyrCentre.insert(cellI, pts.second()))
|
||||
if (celli == -1 || !cellToPyrCentre.insert(celli, pts.second()))
|
||||
{
|
||||
Info<< "Could not insert mesh cell " << cellI
|
||||
Info<< "Could not insert mesh cell " << celli
|
||||
<< " for input point " << pts.first() << nl
|
||||
<< "Perhaps the cell is already marked for splitting?" << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user