Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-03-17 14:56:04 +01:00
38 changed files with 2833 additions and 196 deletions

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
mesh
),
mesh,
dimensionedVector("n", dimLength, wallPoint::greatPoint)
dimensionedVector("n", dimLength, point::max)
);
// Fill wall patches with unit normal

View File

@ -187,8 +187,6 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
);
const pointField& localPoints = allBoundary.localPoints();
const point greatPoint(GREAT, GREAT, GREAT);
// Point data
// ~~~~~~~~~~
@ -196,7 +194,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
// Create some data. Use slightly perturbed positions.
Map<vector> sparseData;
pointField fullData(mesh.nPoints(), greatPoint);
pointField fullData(mesh.nPoints(), point::max);
forAll(localPoints, i)
{
@ -222,7 +220,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh,
fullData,
minEqOp<vector>(),
greatPoint,
point::max,
true // apply separation
);
@ -232,7 +230,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
const point& fullPt = fullData[meshPointI];
if (fullPt != greatPoint)
if (fullPt != point::max)
{
const point& sparsePt = sparseData[meshPointI];
@ -272,7 +270,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
// Create some data. Use slightly perturbed positions.
EdgeMap<vector> sparseData;
pointField fullData(mesh.nEdges(), greatPoint);
pointField fullData(mesh.nEdges(), point::max);
const edgeList& edges = allBoundary.edges();
const labelList meshEdges = allBoundary.meshEdges
@ -307,7 +305,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh,
fullData,
minEqOp<vector>(),
greatPoint,
point::max,
true
);
@ -317,7 +315,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
const point& fullPt = fullData[meshEdgeI];
if (fullPt != greatPoint)
if (fullPt != point::max)
{
const point& sparsePt = sparseData[mesh.edges()[meshEdgeI]];
@ -364,8 +362,6 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
{
Info<< nl << "Testing point-wise data synchronisation." << endl;
const point greatPoint(GREAT, GREAT, GREAT);
// Test position.
{
@ -379,7 +375,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
mesh,
syncedPoints,
minEqOp<point>(),
greatPoint,
point::max,
true
);
@ -444,8 +440,6 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
const edgeList& edges = mesh.edges();
const point greatPoint(GREAT, GREAT, GREAT);
// Test position.
{
@ -463,7 +457,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
mesh,
syncedMids,
minEqOp<point>(),
greatPoint,
point::max,
true
);

View File

@ -0,0 +1,7 @@
patchPointEdgeCirculator.C
createShellMesh.C
extrudeToRegionMesh.C
EXE = $(FOAM_APPBIN)/extrudeToRegionMesh

View File

@ -0,0 +1,14 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
/* -I$(LIB_SRC)/surfMesh/lnInclude */ \
/* -I$(LIB_SRC)/lagrangian/basic/lnInclude */ \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
/* -lsurfMesh */ \
/* -llagrangian */ \
-lmeshTools \
-ldynamicMesh

View File

@ -0,0 +1,592 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "createShellMesh.H"
#include "polyTopoChange.H"
#include "meshTools.H"
#include "mapPolyMesh.H"
#include "polyAddPoint.H"
#include "polyAddFace.H"
#include "polyModifyFace.H"
#include "polyAddCell.H"
#include "patchPointEdgeCirculator.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::createShellMesh, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::createShellMesh::calcPointRegions
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
faceList& pointRegions,
labelList& regionPoints
)
{
pointRegions.setSize(patch.size());
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
pointRegions[faceI].setSize(f.size(), -1);
}
label nRegions = 0;
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
forAll(f, fp)
{
if (pointRegions[faceI][fp] == -1)
{
// Found unassigned point. Distribute current region.
label pointI = f[fp];
label edgeI = patch.faceEdges()[faceI][fp];
patchPointEdgeCirculator circ
(
patch,
nonManifoldEdge,
edgeI,
findIndex(patch.edgeFaces()[edgeI], faceI),
pointI
);
for
(
patchPointEdgeCirculator iter = circ.begin();
iter != circ.end();
++iter
)
{
label face2 = iter.faceID();
if (face2 != -1)
{
const face& f2 = patch.localFaces()[face2];
label fp2 = findIndex(f2, pointI);
label& region = pointRegions[face2][fp2];
if (region != -1)
{
FatalErrorIn
(
"createShellMesh::calcPointRegions(..)"
) << "On point " << pointI
<< " at:" << patch.localPoints()[pointI]
<< " found region:" << region
<< abort(FatalError);
}
region = nRegions;
}
}
nRegions++;
}
}
}
// From region back to originating point (many to one, a point might
// have multiple regions though)
regionPoints.setSize(nRegions);
forAll(pointRegions, faceI)
{
const face& f = patch.localFaces()[faceI];
forAll(f, fp)
{
regionPoints[pointRegions[faceI][fp]] = f[fp];
}
}
if (debug)
{
const labelListList& pointFaces = patch.pointFaces();
forAll(pointFaces, pointI)
{
label region = -1;
const labelList& pFaces = pointFaces[pointI];
forAll(pFaces, i)
{
label faceI = pFaces[i];
const face& f = patch.localFaces()[faceI];
label fp = findIndex(f, pointI);
if (region == -1)
{
region = pointRegions[faceI][fp];
}
else if (region != pointRegions[faceI][fp])
{
Pout<< "Non-manifold point:" << pointI
<< " at " << patch.localPoints()[pointI]
<< " region:" << region
<< " otherRegion:" << pointRegions[faceI][fp]
<< endl;
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::createShellMesh::createShellMesh
(
const primitiveFacePatch& patch,
const faceList& pointRegions,
const labelList& regionPoints
)
:
patch_(patch),
pointRegions_(pointRegions),
regionPoints_(regionPoints)
{
if (pointRegions_.size() != patch_.size())
{
FatalErrorIn("createShellMesh::createShellMesh(..)")
<< "nFaces:" << patch_.size()
<< " pointRegions:" << pointRegions.size()
<< exit(FatalError);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::createShellMesh::setRefinement
(
const pointField& thickness,
const labelList& extrudeMasterPatchID,
const labelList& extrudeSlavePatchID,
const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod
)
{
if (thickness.size() != regionPoints_.size())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nRegions:" << regionPoints_.size()
<< " thickness:" << thickness.size()
<< exit(FatalError);
}
if
(
extrudeMasterPatchID.size() != patch_.size()
&& extrudeSlavePatchID.size() != patch_.size()
)
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nFaces:" << patch_.size()
<< " extrudeMasterPatchID:" << extrudeMasterPatchID.size()
<< " extrudeSlavePatchID:" << extrudeSlavePatchID.size()
<< exit(FatalError);
}
if (extrudeEdgePatches.size() != patch_.nEdges())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "nEdges:" << patch_.nEdges()
<< " extrudeEdgePatches:" << extrudeEdgePatches.size()
<< exit(FatalError);
}
// From cell to patch (trivial)
DynamicList<label> cellToFaceMap(patch_.size());
// From face to patch+turning index
DynamicList<label> faceToFaceMap(2*patch_.size()+patch_.nEdges());
// From face to patch edge index
DynamicList<label> faceToEdgeMap(patch_.nEdges()+patch_.nEdges());
// From point to patch point index
DynamicList<label> pointToPointMap(2*patch_.nPoints());
// Introduce new cell for every face
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedCells(patch_.size());
forAll(patch_, faceI)
{
addedCells[faceI] = meshMod.addCell
(
-1, // masterPointID
-1, // masterEdgeID
-1, // masterFaceID
cellToFaceMap.size(), // masterCellID
-1 // zoneID
);
cellToFaceMap.append(faceI);
}
// Introduce original points
// ~~~~~~~~~~~~~~~~~~~~~~~~~
// Original point numbers in local point ordering so no need to store.
forAll(patch_.localPoints(), pointI)
{
//label addedPointI =
meshMod.addPoint
(
patch_.localPoints()[pointI], // point
pointToPointMap.size(), // masterPointID
-1, // zoneID
true // inCell
);
pointToPointMap.append(pointI);
//Pout<< "Added bottom point " << addedPointI
// << " at " << patch_.localPoints()[pointI]
// << " from point " << pointI
// << endl;
}
// Introduce new points (one for every region)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
labelList addedPoints(regionPoints_.size());
forAll(regionPoints_, regionI)
{
label pointI = regionPoints_[regionI];
point extrudedPt = patch_.localPoints()[pointI] + thickness[regionI];
addedPoints[regionI] = meshMod.addPoint
(
extrudedPt, // point
pointToPointMap.size(), // masterPointID - used only addressing
-1, // zoneID
true // inCell
);
pointToPointMap.append(pointI);
//Pout<< "Added top point " << addedPoints[regionI]
// << " at " << extrudedPt
// << " from point " << pointI
// << endl;
}
// Add face on patch' master side
//labelList masterFaces(patch_.localFaces().size());
forAll(patch_.localFaces(), faceI)
{
//masterFaces[faceI] =
meshMod.addFace
(
patch_.localFaces()[faceI].reverseFace(),// vertices
addedCells[faceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
true, // flipFaceFlux
extrudeMasterPatchID[faceI],// patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(faceI+1); // points to unflipped original face
faceToEdgeMap.append(-1);
//Pout<< "Added master face "
// << patch_.localFaces()[faceI].reverseFace()
// << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI]
// << endl;
}
// Add face on patch' slave side
//labelList slaveFaces(patch_.localFaces().size());
forAll(patch_.localFaces(), faceI)
{
// Get face in original ordering
const face& f = patch_.localFaces()[faceI];
// Pick up point based on region
face newF(f.size());
forAll(f, fp)
{
label region = pointRegions_[faceI][fp];
newF[fp] = addedPoints[region];
}
//slaveFaces[faceI] =
meshMod.addFace
(
newF, // vertices
addedCells[faceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID : current faceI
false, // flipFaceFlux
extrudeSlavePatchID[faceI], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(-faceI-1);
faceToEdgeMap.append(-1);
//Pout<< "Added slave face " << newF
// << " own " << addedCells[faceI]
// << " at " << patch_.faceCentres()[faceI]
// << endl;
}
// Add side faces
// ~~~~~~~~~~~~~~
// Note that we loop over edges multiple times so for edges with
// two cyclic faces they get added in two passes (for correct ordering)
// Pass1. Internal edges and first face of other edges
forAll(extrudeEdgePatches, edgeI)
{
const labelList& eFaces = patch_.edgeFaces()[edgeI];
const labelList& ePatches = extrudeEdgePatches[edgeI];
if (ePatches.size() == 0)
{
// internal face.
if (eFaces.size() != 2)
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "edge:" << edgeI
<< " not internal but does not have side-patches defined."
<< exit(FatalError);
}
// Extrude
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[eFaces[0]];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[eFaces[0]][fp1]];
newF[3] = addedPoints[pointRegions_[eFaces[0]][fp0]];
label minCellI = addedCells[eFaces[0]];
label maxCellI = addedCells[eFaces[1]];
if (minCellI > maxCellI)
{
// Swap
Swap(minCellI, maxCellI);
newF = newF.reverseFace();
}
//Pout<< "for internal edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding face:" << newF
// << " from f:" << f
// << " inbetween " << minCellI << " and " << maxCellI << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
minCellI, // own
maxCellI, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
-1, // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
else
{
if (eFaces.size() != ePatches.size())
{
FatalErrorIn("createShellMesh::setRefinement(..)")
<< "external/feature edge:" << edgeI
<< " has " << eFaces.size() << " connected extruded faces "
<< " but only " << ePatches.size()
<< " boundary faces defined." << exit(FatalError);
}
// Extrude eFaces[0]
label minFaceI = eFaces[0];
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[minFaceI];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
//Pout<< "for external edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding first patch face:" << newF
// << " from:" << f
// << " into patch:" << ePatches[0]
// << " own:" << addedCells[minFaceI]
// << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
addedCells[minFaceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[0], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
}
// Pass2. Other faces of boundary edges
forAll(extrudeEdgePatches, edgeI)
{
const labelList& eFaces = patch_.edgeFaces()[edgeI];
const labelList& ePatches = extrudeEdgePatches[edgeI];
if (ePatches.size() >= 2)
{
for (label i = 1; i < ePatches.size(); i++)
{
// Extrude eFaces[i]
label minFaceI = eFaces[i];
// Make face pointing in to eFaces[0] so out of new master face
const face& f = patch_.localFaces()[minFaceI];
const edge& e = patch_.edges()[edgeI];
label fp0 = findIndex(f, e[0]);
label fp1 = f.fcIndex(fp0);
if (f[fp1] != e[1])
{
fp1 = fp0;
fp0 = f.rcIndex(fp1);
}
face newF(4);
newF[0] = f[fp0];
newF[1] = f[fp1];
newF[2] = addedPoints[pointRegions_[minFaceI][fp1]];
newF[3] = addedPoints[pointRegions_[minFaceI][fp0]];
//Pout<< "for external edge:" << e
// << " at:" << patch_.localPoints()[e[0]]
// << patch_.localPoints()[e[1]]
// << " adding patch face:" << newF
// << " from:" << f
// << " into patch:" << ePatches[i]
// << endl;
// newF already outwards pointing.
meshMod.addFace
(
newF, // vertices
addedCells[minFaceI], // own
-1, // nei
-1, // masterPointID
-1, // masterEdgeID
faceToFaceMap.size(), // masterFaceID
false, // flipFaceFlux
ePatches[i], // patchID
-1, // zoneID
false // zoneFlip
);
faceToFaceMap.append(0);
faceToEdgeMap.append(edgeI);
}
}
}
cellToFaceMap_.transfer(cellToFaceMap);
faceToFaceMap_.transfer(faceToFaceMap);
faceToEdgeMap_.transfer(faceToEdgeMap);
pointToPointMap_.transfer(pointToPointMap);
}
void Foam::createShellMesh::updateMesh(const mapPolyMesh& map)
{
inplaceReorder(map.reverseCellMap(), cellToFaceMap_);
inplaceReorder(map.reverseFaceMap(), faceToFaceMap_);
inplaceReorder(map.reverseFaceMap(), faceToEdgeMap_);
inplaceReorder(map.reversePointMap(), pointToPointMap_);
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::createShellMesh
Description
Creates mesh by extruding a patch.
SourceFiles
createShellMesh.C
\*---------------------------------------------------------------------------*/
#ifndef createShellMesh_H
#define createShellMesh_H
#include "primitiveFacePatch.H"
#include "PackedBoolList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class mapPolyMesh;
class polyTopoChange;
/*---------------------------------------------------------------------------*\
Class createShellMesh Declaration
\*---------------------------------------------------------------------------*/
class createShellMesh
{
// Private data
//- Reference to patch to extrude
const primitiveFacePatch& patch_;
// //- Non-manifold edges on patch
// const PackedBoolList& nonManifoldEdge_;
//- Per point on face the region
const faceList& pointRegions_;
//- From region to original patch point
const labelList& regionPoints_;
labelList cellToFaceMap_;
labelList faceToFaceMap_;
labelList faceToEdgeMap_;
labelList pointToPointMap_;
// Private Member Functions
//- Disallow default bitwise copy construct
createShellMesh(const createShellMesh&);
//- Disallow default bitwise assignment
void operator=(const createShellMesh&);
public:
//- Runtime type information
ClassName("createShellMesh");
// Constructors
//- Construct from mesh.
createShellMesh
(
const primitiveFacePatch& patch,
// const PackedBoolList& nonManifoldEdge,
const faceList& pointRegions,
const labelList& regionPoints
);
// Member Functions
// Access
//- From region cell to patch face
const labelList& cellToFaceMap() const
{
return cellToFaceMap_;
}
//- From region face to patch face. Contains turning index:
// > 0 : face originating from master side
// (owner side for unflipped face)
// < 0 : (bottom) face originating from slave side
// (neighbour side for unflipped face)
// = 0 : for all side faces
const labelList& faceToFaceMap() const
{
return faceToFaceMap_;
}
//- From region side-face to patch edge. -1 for non-edge faces.
const labelList& faceToEdgeMap() const
{
return faceToEdgeMap_;
}
//- From region point to patch point.
const labelList& pointToPointMap() const
{
return pointToPointMap_;
}
// Other
//- Helper: calculate point regions
static void calcPointRegions
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
faceList& pointRegions,
labelList& regionPoints
);
//- Play commands into polyTopoChange to create layer mesh.
void setRefinement
(
const pointField& thickness,
const labelList& extrudeMasterPatchID,
const labelList& extrudeSlavePatchID,
const labelListList& extrudeEdgePatches,
polyTopoChange& meshMod
);
//- Update any locally stored mesh information.
void updateMesh(const mapPolyMesh&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "patchPointEdgeCirculator.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::patchPointEdgeCirculator
Foam::patchPointEdgeCirculator::endConstIter
(
*reinterpret_cast<primitiveFacePatch*>(0), // primitiveFacePatch
*reinterpret_cast<PackedBoolList*>(0), // PackedBoolList
-1, // edgeID
-1, // index
-1 // pointID
);
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const InfoProxy<patchPointEdgeCirculator>& ip
)
{
const patchPointEdgeCirculator& c = ip.t_;
const pointField& pts = c.patch_.localPoints();
const edge& e = c.patch_.edges()[c.edgeID_];
label faceI = c.faceID();
os << "around point:" << c.pointID_
<< " coord:" << pts[c.pointID_]
<< " at edge:" << c.edgeID_
<< " coord:" << pts[e.otherVertex(c.pointID_)]
<< " in direction of face:" << faceI;
if (faceI != -1)
{
os<< " fc:" << c.patch_.localFaces()[faceI].centre(pts);
}
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::patchPointEdgeCirculator
Description
Walks from starting edge/face around point on patch.
-# Use in-place: \n
@code
patchPointEdgeCirculator circ(..);
// Walk
do
{
Info<< "edge:" << circ.edgeID() << endl;
++circ;
}
while (circ != circ.end());
@endcode
-# Use like STL iterator: \n
@code
patchPointEdgeCirculator circ(..);
for
(
patchPointEdgeCirculator iter = circ.begin();
iter != circ.end();
++iter
)
{
Info<< "edge:" << iter.edgeID() << endl;
}
@endcode
SourceFiles
patchPointEdgeCirculator.C
\*---------------------------------------------------------------------------*/
#ifndef patchPointEdgeCirculator_H
#define patchPointEdgeCirculator_H
#include "face.H"
#include "ListOps.H"
#include "primitiveFacePatch.H"
#include "PackedBoolList.H"
#include "InfoProxy.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
/*---------------------------------------------------------------------------*\
Class patchPointEdgeCirculator Declaration
\*---------------------------------------------------------------------------*/
class patchPointEdgeCirculator
{
// Static data members
//- end iterator
static const patchPointEdgeCirculator endConstIter;
// Private data
//- Patch
const primitiveFacePatch& patch_;
const PackedBoolList& nonManifoldEdge_;
//- Current edge
label edgeID_;
//- Current direction (face, expressed as index into edgeFaces()[edgeID]
label index_;
//- Point
label pointID_;
//- Starting edge so we know when to stop.
label startEdgeID_;
// Private Member Functions
//- Set to end() iterator
inline void setEnd();
//- Set edgeID_ to be the other edge on the face that uses the
// point.
inline void otherEdge(const label cellI);
public:
// Constructors
//- Construct from components
inline patchPointEdgeCirculator
(
const primitiveFacePatch&,
const PackedBoolList& nonManifoldEdge,
const label edgeID,
const label index,
const label pointID
);
//- Construct as copy
inline patchPointEdgeCirculator(const patchPointEdgeCirculator&);
// Member Functions
inline label edgeID() const;
inline label index() const;
inline label pointID() const;
//- Helper: get face according to the index.
// Returns -1 if on end.
inline label faceID() const;
//- Walk back until non-manifold edge (if any) or minimum edge.
inline void setCanonical();
// Member Operators
inline void operator=(const patchPointEdgeCirculator& iter);
inline bool operator==(const patchPointEdgeCirculator& iter) const;
inline bool operator!=(const patchPointEdgeCirculator& iter) const;
//- Step to next face.
inline patchPointEdgeCirculator& operator++();
//- iterator set to the beginning face. For internal edges this is
// the current face. For boundary edges this is the first boundary face
// reached from walking back (i.e. in opposite direction to ++)
inline patchPointEdgeCirculator begin() const;
inline patchPointEdgeCirculator cbegin() const;
//- iterator set to beyond the end of the walk.
inline const patchPointEdgeCirculator& end() const;
inline const patchPointEdgeCirculator& cend() const;
// Info
//- Return info proxy.
// Used to print token information to a stream
InfoProxy<patchPointEdgeCirculator> info() const
{
return *this;
}
friend Ostream& operator<<
(
Ostream&,
const InfoProxy<patchPointEdgeCirculator>&
);
};
Ostream& operator<<(Ostream&, const InfoProxy<patchPointEdgeCirculator>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "patchPointEdgeCirculatorI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,309 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::patchPointEdgeCirculator::setEnd()
{
edgeID_ = -1;
pointID_ = -1;
}
// Cross face to other edge on point
void Foam::patchPointEdgeCirculator::otherEdge(const label faceI)
{
const labelList& fEdges = patch_.faceEdges()[faceI];
const face& f = patch_.localFaces()[faceI];
label fp = findIndex(f, pointID_);
if (fEdges[fp] == edgeID_)
{
edgeID_ = fEdges[f.rcIndex(fp)];
}
else
{
// Check for now
if (fEdges[f.rcIndex(fp)] != edgeID_)
{
FatalErrorIn("patchPointEdgeCirculator::otherEdge(const label)")
<< "face:" << faceI
<< " verts:" << f
<< " edges:" << fEdges
<< " looking for other edge than " << edgeID_
<< abort(FatalError);
}
edgeID_ = fEdges[fp];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from components
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
(
const primitiveFacePatch& patch,
const PackedBoolList& nonManifoldEdge,
const label edgeID,
const label index,
const label pointID
)
:
patch_(patch),
nonManifoldEdge_(nonManifoldEdge),
edgeID_(edgeID),
index_(index),
pointID_(pointID),
startEdgeID_(edgeID_)
{
if (edgeID_ != -1)
{
const edge& e = patch_.edges()[edgeID_];
if (pointID_ != e[0] && pointID_ != e[1])
{
FatalErrorIn
(
"patchPointEdgeCirculator::patchPointEdgeCirculator(..)"
) << "edge " << edgeID_ << " verts " << e
<< " does not contain point " << pointID_ << abort(FatalError);
}
}
}
//- Construct copy
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator
(
const patchPointEdgeCirculator& circ
)
:
patch_(circ.patch_),
nonManifoldEdge_(circ.nonManifoldEdge_),
edgeID_(circ.edgeID_),
index_(circ.index_),
pointID_(circ.pointID_),
startEdgeID_(circ.startEdgeID_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::label Foam::patchPointEdgeCirculator::edgeID() const
{
return edgeID_;
}
Foam::label Foam::patchPointEdgeCirculator::index() const
{
return index_;
}
Foam::label Foam::patchPointEdgeCirculator::pointID() const
{
return pointID_;
}
Foam::label Foam::patchPointEdgeCirculator::faceID() const
{
if (edgeID_ != -1 && index_ != -1)
{
return patch_.edgeFaces()[edgeID_][index_];
}
else
{
return -1;
}
}
void Foam::patchPointEdgeCirculator::operator=
(
const patchPointEdgeCirculator& circ
)
{
edgeID_ = circ.edgeID_;
index_ = circ.index_;
pointID_ = circ.pointID_;
startEdgeID_ = circ.startEdgeID_;
}
bool Foam::patchPointEdgeCirculator::operator==
(
const patchPointEdgeCirculator& circ
) const
{
// Do just enough to have setEnd() produce an iterator equal to end().
// Could include the direction(i.e. index_) to make sure that two
// circulators around same point but in different direction are not equal.
return edgeID_ == circ.edgeID_ && pointID_ == circ.pointID_;
}
bool Foam::patchPointEdgeCirculator::operator!=
(
const patchPointEdgeCirculator& circ
) const
{
return !(*this == circ);
}
void Foam::patchPointEdgeCirculator::setCanonical()
{
if (edgeID_ == -1)
{
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
<< "Already reached end(). Cannot walk any further."
<< abort(FatalError);
}
label minEdgeID = edgeID_;
label minIndex = index_;
while (true)
{
if (nonManifoldEdge_[edgeID_])
{
break;
}
// Step back
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
if (eFaces.size() != 2)
{
FatalErrorIn("patchPointEdgeCirculator::setCanonical()")
<< "problem eFaces:" << eFaces << abort(FatalError);
}
label faceI = (index_ == 0 ? eFaces[1] : eFaces[0]);
// Step to other edge on face
otherEdge(faceI);
// Update index
index_ = findIndex(patch_.edgeFaces()[edgeID_], faceI);
if (edgeID_ < minEdgeID)
{
minEdgeID = edgeID_;
minIndex = index_;
}
if (edgeID_ == startEdgeID_)
{
edgeID_ = minEdgeID;
index_ = minIndex;
break;
}
}
startEdgeID_ = edgeID_;
}
//- Step to next edge.
Foam::patchPointEdgeCirculator::patchPointEdgeCirculator&
Foam::patchPointEdgeCirculator::operator++()
{
if (index_ == -1)
{
setEnd();
}
else
{
// Step to other edge on face
label faceI = patch_.edgeFaces()[edgeID_][index_];
otherEdge(faceI);
if (edgeID_ == startEdgeID_)
{
setEnd();
}
else if (nonManifoldEdge_[edgeID_])
{
// Reached non-manifold edge. Cannot walk further.
// Mark so it gets set to end next time.
index_ = -1;
}
else
{
const labelList& eFaces = patch_.edgeFaces()[edgeID_];
if (eFaces.size() != 2)
{
FatalErrorIn("patchPointEdgeCirculator:::operator++()")
<< "problem eFaces:" << eFaces << abort(FatalError);
}
// Point to the face that is not faceI
index_ = (eFaces[0] != faceI ? 0 : 1);
}
}
return *this;
}
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::begin() const
{
patchPointEdgeCirculator iter(*this);
iter.setCanonical();
return iter;
}
Foam::patchPointEdgeCirculator Foam::patchPointEdgeCirculator::cbegin() const
{
patchPointEdgeCirculator iter(*this);
iter.setCanonical();
return iter;
}
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::end()
const
{
return endConstIter;
}
const Foam::patchPointEdgeCirculator& Foam::patchPointEdgeCirculator::cend()
const
{
return endConstIter;
}
// ************************************************************************* //

View File

@ -162,15 +162,13 @@ void Foam::domainDecomposition::distributeCells()
// somewhere in the middle of the domain which might not be anywhere
// near any of the cells.
const point greatPoint(GREAT, GREAT, GREAT);
pointField regionCentres(globalRegion.nRegions(), greatPoint);
pointField regionCentres(globalRegion.nRegions(), point::max);
forAll(globalRegion, cellI)
{
label regionI = globalRegion[cellI];
if (regionCentres[regionI] == greatPoint)
if (regionCentres[regionI] == point::max)
{
regionCentres[regionI] = cellCentres()[cellI];
}

View File

@ -300,7 +300,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
{
// Rotation, no separation
// Assume per-face differening transformation, correct later
// Assume per-face differing transformation, correct later
separation_.setSize(0);

View File

@ -47,14 +47,15 @@ namespace Foam
template<>
const char* NamedEnum<cyclicPolyPatch::transformType, 3>::names[] =
const char* NamedEnum<cyclicPolyPatch::transformType, 4>::names[] =
{
"unknown",
"rotational",
"translational"
"translational",
"noOrdering"
};
const NamedEnum<cyclicPolyPatch::transformType, 3>
const NamedEnum<cyclicPolyPatch::transformType, 4>
cyclicPolyPatch::transformTypeNames;
}
@ -1153,6 +1154,16 @@ bool Foam::cyclicPolyPatch::order
<< ". It is " << pp.size() << abort(FatalError);
}
if (transform_ == NOORDERING)
{
if (debug)
{
Pout<< "cyclicPolyPatch::order : noOrdering mode." << endl;
}
return false;
}
label halfSize = pp.size()/2;
// Supplied primitivePatch already with new points.
@ -1630,7 +1641,7 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const
{
case ROTATIONAL:
{
os.writeKeyword("transform") << transformTypeNames[ROTATIONAL]
os.writeKeyword("transform") << transformTypeNames[transform_]
<< token::END_STATEMENT << nl;
os.writeKeyword("rotationAxis") << rotationAxis_
<< token::END_STATEMENT << nl;
@ -1640,12 +1651,18 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const
}
case TRANSLATIONAL:
{
os.writeKeyword("transform") << transformTypeNames[TRANSLATIONAL]
os.writeKeyword("transform") << transformTypeNames[transform_]
<< token::END_STATEMENT << nl;
os.writeKeyword("separationVector") << separationVector_
<< token::END_STATEMENT << nl;
break;
}
case NOORDERING:
{
os.writeKeyword("transform") << transformTypeNames[transform_]
<< token::END_STATEMENT << nl;
break;
}
default:
{
// no additional info to write

View File

@ -42,7 +42,6 @@ Description
SourceFiles
cyclicPolyPatch.C
cyclicPolyPatchMorph.C
\*---------------------------------------------------------------------------*/
@ -72,11 +71,12 @@ public:
enum transformType
{
UNKNOWN,
ROTATIONAL,
TRANSLATIONAL
UNKNOWN, // unspecified; automatic ordering
ROTATIONAL, // rotation along coordinate axis
TRANSLATIONAL, // translation
NOORDERING // unspecified, no automatic ordering
};
static const NamedEnum<transformType, 3> transformTypeNames;
static const NamedEnum<transformType, 4> transformTypeNames;
private:
@ -118,8 +118,6 @@ private:
//- Find amongst selected faces the one with the largest area
static label findMaxArea(const pointField&, const faceList&);
void calcTransforms();
// Face ordering
@ -175,6 +173,9 @@ protected:
// Protected Member functions
//- Recalculate the transformation tensors
virtual void calcTransforms();
//- Initialise the calculation of the patch geometry
virtual void initGeometry(PstreamBuffers&);

View File

@ -34,7 +34,6 @@ License
#include "polyAddFace.H"
#include "polyModifyFace.H"
#include "polyAddCell.H"
#include "wallPoint.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -713,14 +712,14 @@ void Foam::addPatchCellLayer::setRefinement
}
{
pointField d(mesh_.nPoints(), wallPoint::greatPoint);
pointField d(mesh_.nPoints(), vector::max);
UIndirectList<point>(d, meshPoints) = firstLayerDisp;
syncTools::syncPointList
(
mesh_,
d,
minEqOp<vector>(),
wallPoint::greatPoint,
vector::max,
false
);

View File

@ -49,14 +49,6 @@ namespace Foam
}
const Foam::point Foam::polyTopoChange::greatPoint
(
GREAT,
GREAT,
GREAT
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Renumber with special handling for merged items (marked with <-1)
@ -2695,7 +2687,7 @@ void Foam::polyTopoChange::removePoint
<< abort(FatalError);
}
points_[pointI] = greatPoint;
points_[pointI] = point::max;
pointMap_[pointI] = -1;
if (mergePointI >= 0)
{

View File

@ -45,7 +45,7 @@ Description
- no item can be removed more than once.
- removed cell: cell set to 0 faces.
- removed face: face set to 0 vertices.
- removed point: coordinate set to greatPoint (GREAT,GREAT,GREAT).
- removed point: coordinate set to vector::max (VGREAT,VGREAT,VGREAT).
Note that this might give problems if this value is used already.
To see if point is equal to above value we don't use == (which might give
problems with roundoff error) but instead compare the individual component
@ -98,12 +98,6 @@ template<class T, class Container> class CompactListList;
class polyTopoChange
{
// Static data members
//- Value of deleted point
static const point greatPoint;
// Private data
//- Whether to allow referencing illegal points/cells/faces

View File

@ -33,9 +33,9 @@ inline bool Foam::polyTopoChange::pointRemoved(const label pointI) const
const point& pt = points_[pointI];
return
pt.x() > 0.5*greatPoint.x()
&& pt.y() > 0.5*greatPoint.y()
&& pt.z() > 0.5*greatPoint.z();
pt.x() > 0.5*vector::max.x()
&& pt.y() > 0.5*vector::max.y()
&& pt.z() > 0.5*vector::max.z();
}

View File

@ -33,7 +33,6 @@ License
#include "polyAddPoint.H"
#include "polyModifyFace.H"
#include "syncTools.H"
#include "wallPoint.H" // only to use 'greatPoint'
#include "faceSet.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -570,7 +569,7 @@ void Foam::removePoints::getUnrefimentSet
{
label savedPointI = -savedFace[fp]-1;
if (savedPoints_[savedPointI] == wallPoint::greatPoint)
if (savedPoints_[savedPointI] == vector::max)
{
FatalErrorIn
(
@ -745,7 +744,7 @@ void Foam::removePoints::setUnrefinement
{
label localI = localPoints[i];
if (savedPoints_[localI] == wallPoint::greatPoint)
if (savedPoints_[localI] == vector::max)
{
FatalErrorIn
(
@ -767,7 +766,7 @@ void Foam::removePoints::setUnrefinement
);
// Mark the restored points so they are not restored again.
savedPoints_[localI] = wallPoint::greatPoint;
savedPoints_[localI] = vector::max;
}
forAll(localFaces, i)

View File

@ -26,7 +26,6 @@ License
#include "nearWallDistNoSearch.H"
#include "fvMesh.H"
#include "wallPoint.H"
#include "wallFvPatch.H"
#include "surfaceFields.H"

View File

@ -51,7 +51,7 @@ namespace Foam
void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask
(
const label cellZoneI,
const label cellZoneI,
PackedBoolList& isZonePoint,
PackedBoolList& isZoneEdge
) const
@ -133,16 +133,14 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
vectorField& data
) const
{
const pointField& points = mesh().points();
List<pointEdgeStructuredWalk> seedInfo(seedPoints.size());
forAll(seedPoints, i)
{
seedInfo[i] = pointEdgeStructuredWalk
(
true,
points[seedPoints[i]],
points0()[seedPoints[i]], // location of data
points0()[seedPoints[i]], // previous location
0.0,
seedData[i]
);
@ -150,12 +148,22 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
// Current info on points
List<pointEdgeStructuredWalk> allPointInfo(mesh().nPoints());
// Mark points inside cellZone
// Mark points inside cellZone.
// Note that we use points0, not mesh.points()
// so as not to accumulate errors.
forAll(isZonePoint, pointI)
{
if (isZonePoint[pointI])
{
allPointInfo[pointI].inZone() = true;
allPointInfo[pointI] = pointEdgeStructuredWalk
(
points0()[pointI], // location of data
vector::max, // not valid
0.0,
vector::zero // passive data
);
}
}
@ -166,7 +174,13 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
{
if (isZoneEdge[edgeI])
{
allEdgeInfo[edgeI].inZone() = true;
allEdgeInfo[edgeI] = pointEdgeStructuredWalk
(
mesh().edges()[edgeI].centre(points0()), // location of data
vector::max, // not valid
0.0,
vector::zero
);
}
}

View File

@ -88,7 +88,7 @@ class displacementLayeredMotionFvMotionSolver
void calcZoneMask
(
const label cellZoneI,
const label cellZoneI,
PackedBoolList& isZonePoint,
PackedBoolList& isZoneEdge
) const;

View File

@ -35,7 +35,7 @@ Foam::Ostream& Foam::operator<<
)
{
return os
<< wDist.inZone_ << wDist.previousPoint_
<< wDist.point0_ << wDist.previousPoint_
<< wDist.dist_ << wDist.data_;
}
@ -46,7 +46,7 @@ Foam::Istream& Foam::operator>>
)
{
return is
>> wDist.inZone_ >> wDist.previousPoint_
>> wDist.point0_ >> wDist.previousPoint_
>> wDist.dist_ >> wDist.data_;
}

View File

@ -61,10 +61,10 @@ class pointEdgeStructuredWalk
{
// Private data
//- Is this point/edge inside the walk zone
bool inZone_;
//- Starting location
point point0_;
//- Previuos point
//- Previous point
point previousPoint_;
//- Sum of distance
@ -77,15 +77,6 @@ class pointEdgeStructuredWalk
//- Evaluate distance to point.
inline bool update
(
const point&,
const pointEdgeStructuredWalk& w2,
const scalar tol
);
//- Combine current with w2. Update distSqr, origin if w2 has smaller
// quantities and returns true.
inline bool update
(
const pointEdgeStructuredWalk& w2,
const scalar tol
@ -101,7 +92,7 @@ public:
//- Construct from components
inline pointEdgeStructuredWalk
(
const bool,
const point&,
const point&,
const scalar,
const vector&
@ -114,10 +105,6 @@ public:
inline bool inZone() const;
inline bool& inZone();
inline const point& previousPoint() const;
inline scalar dist() const;
inline const vector& data() const;

View File

@ -32,16 +32,15 @@ License
// Update this with w2.
inline bool Foam::pointEdgeStructuredWalk::update
(
const point& pt,
const pointEdgeStructuredWalk& w2,
const scalar tol
)
{
if (!valid())
{
// current not yet set. Walked from w2 to here (=pt)
dist_ = w2.dist_ + mag(pt-w2.previousPoint_);
previousPoint_ = pt;
// current not yet set. Walked from w2 to here (=point0)
dist_ = w2.dist_ + mag(point0_-w2.previousPoint_);
previousPoint_ = point0_;
data_ = w2.data_;
return true;
@ -52,36 +51,13 @@ inline bool Foam::pointEdgeStructuredWalk::update
}
}
// Update this with w2 (information on same point)
inline bool Foam::pointEdgeStructuredWalk::update
(
const pointEdgeStructuredWalk& w2,
const scalar tol
)
{
if (!valid())
{
// current not yet set so use neighbour
dist_ = w2.dist_;
previousPoint_ = w2.previousPoint_;
data_ = w2.data_;
return true;
}
else
{
// already nearer to pt
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
:
inZone_(false),
point0_(vector::max),
previousPoint_(vector::max),
dist_(0),
data_(vector::zero)
@ -91,13 +67,13 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
// Construct from origin, distance
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
(
const bool inZone,
const point& previousPoint,
const point& point0,
const point& previousPoint,
const scalar dist,
const vector& data
)
:
inZone_(inZone),
point0_(point0),
previousPoint_(previousPoint),
dist_(dist),
data_(data)
@ -108,20 +84,14 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
inline bool Foam::pointEdgeStructuredWalk::inZone() const
{
return inZone_;
return point0_ != vector::max;
}
inline bool& Foam::pointEdgeStructuredWalk::inZone()
{
return inZone_;
}
inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
{
return previousPoint_;
}
//inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
//{
// return previousPoint_;
//}
inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const
@ -210,15 +180,15 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
const scalar tol
)
{
if (inZone_)
if (inZone())
{
return update(mesh.points()[pointI], edgeInfo, tol);
return update(edgeInfo, tol);
}
else
{
return false;
}
}
}
// Update this with new information on same point
@ -230,9 +200,9 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
const scalar tol
)
{
if (inZone_)
if (inZone())
{
return update(mesh.points()[pointI], newPointInfo, tol);
return update(newPointInfo, tol);
}
else
{
@ -249,7 +219,7 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
)
{
return update(newPointInfo, tol);
}
}
// Update this with information from connected point
@ -262,21 +232,15 @@ inline bool Foam::pointEdgeStructuredWalk::updateEdge
const scalar tol
)
{
if (inZone_)
if (inZone())
{
const pointField& points = mesh.points();
const edge& e = mesh.edges()[edgeI];
const point edgeMid(0.5*(points[e[0]] + points[e[1]]));
return update(edgeMid, pointInfo, tol);
return update(pointInfo, tol);
}
else
{
return false;
}
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
@ -286,7 +250,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator==
const Foam::pointEdgeStructuredWalk& rhs
) const
{
return previousPoint() == rhs.previousPoint();
return previousPoint_ == rhs.previousPoint_;
}

View File

@ -38,7 +38,6 @@ SourceFiles
#include "autoPtr.H"
#include "dictionary.H"
#include "wallPoint.H"
#include "searchableSurfaces.H"
#include "refinementSurfaces.H"
#include "shellSurfaces.H"
@ -95,9 +94,9 @@ class autoHexMeshDriver
void operator()(vector& x, const vector& y) const
{
if (y != wallPoint::greatPoint)
if (y != point::max)
{
if (x == wallPoint::greatPoint)
if (x == point::max)
{
x = y;
}

View File

@ -991,7 +991,7 @@ void Foam::autoLayerDriver::handleFeatureAngle
if (minCos < 1-SMALL)
{
// Normal component of normals of connected faces.
vectorField edgeNormal(mesh.nEdges(), wallPoint::greatPoint);
vectorField edgeNormal(mesh.nEdges(), point::max);
const labelListList& edgeFaces = pp.edgeFaces();
@ -1016,7 +1016,7 @@ void Foam::autoLayerDriver::handleFeatureAngle
mesh,
edgeNormal,
nomalsCombine(),
wallPoint::greatPoint, // null value
point::max, // null value
false // no separation
);
@ -1040,7 +1040,7 @@ void Foam::autoLayerDriver::handleFeatureAngle
const vector& n = edgeNormal[meshEdgeI];
if (n != wallPoint::greatPoint)
if (n != point::max)
{
scalar cos = n & pp.faceNormals()[eFaces[0]];
@ -1640,7 +1640,7 @@ void Foam::autoLayerDriver::syncPatchDisplacement
meshPoints,
patchDisp,
minEqOp<vector>(),
wallPoint::greatPoint, // null value
point::max, // null value
false // no separation
);

View File

@ -37,7 +37,6 @@ SourceFiles
#define autoLayerDriver_H
#include "meshRefinement.H"
#include "wallPoint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,7 +49,6 @@ class pointSet;
class motionSmoother;
class addPatchCellLayer;
class pointData;
class wallPoint;
class faceSet;
class layerParameters;
@ -81,9 +79,9 @@ class autoLayerDriver
void operator()(vector& x, const vector& y) const
{
if (y != wallPoint::greatPoint)
if (y != point::max)
{
if (x == wallPoint::greatPoint)
if (x == point::max)
{
x = y;
}

View File

@ -26,7 +26,6 @@ License
#include "polyMesh.H"
#include "transform.H"
#include "wallPoint.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -138,10 +137,10 @@ inline bool Foam::pointData::update
// Null constructor
inline Foam::pointData::pointData()
:
origin_(wallPoint::greatPoint),
origin_(point::max),
distSqr_(GREAT),
s_(GREAT),
v_(wallPoint::greatPoint)
v_(point::max)
{}
@ -199,7 +198,7 @@ inline const Foam::vector& Foam::pointData::v() const
inline bool Foam::pointData::valid() const
{
return origin_ != wallPoint::greatPoint;
return origin_ != point::max;
}

View File

@ -26,10 +26,6 @@ License
#include "pointEdgePoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::point Foam::pointEdgePoint::greatPoint(GREAT, GREAT, GREAT);
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<

View File

@ -92,12 +92,6 @@ class pointEdgePoint
public:
// Static data members
//- initial point far away.
static point greatPoint;
// Constructors
//- Construct null

View File

@ -117,7 +117,7 @@ inline bool Foam::pointEdgePoint::update
// Null constructor
inline Foam::pointEdgePoint::pointEdgePoint()
:
origin_(greatPoint),
origin_(point::max),
distSqr_(GREAT)
{}
@ -158,7 +158,7 @@ inline Foam::scalar Foam::pointEdgePoint::distSqr() const
inline bool Foam::pointEdgePoint::valid() const
{
return origin_ != greatPoint;
return origin_ != point::max;
}

View File

@ -106,7 +106,7 @@ Foam::label Foam::patchDataWave<TransferType>::getValues
distance_[cellI] = dist;
//cellData_[cellI] = wallPoint::greatPoint;
//cellData_[cellI] = point::max;
cellData_[cellI] = cellInfo[cellI].data();
nIllegal++;
@ -153,7 +153,7 @@ Foam::label Foam::patchDataWave<TransferType>::getValues
patchField[patchFaceI] = dist;
//patchDataField[patchFaceI] = wallPoint::greatPoint;
//patchDataField[patchFaceI] = point::max;
patchDataField[patchFaceI] = faceInfo[meshFaceI].data();
nIllegal++;

View File

@ -26,11 +26,6 @@ License
#include "wallPoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
Foam::point Foam::wallPoint::greatPoint(GREAT, GREAT, GREAT);
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::wallPoint& wDist)

View File

@ -87,12 +87,6 @@ class wallPoint
public:
// Static data members
//- initial point far away.
static point greatPoint;
// Constructors
//- Construct null

View File

@ -84,7 +84,7 @@ inline bool Foam::wallPoint::update
// Null constructor
inline Foam::wallPoint::wallPoint()
:
origin_(greatPoint),
origin_(point::max),
distSqr_(GREAT)
{}
@ -131,7 +131,7 @@ inline Foam::scalar& Foam::wallPoint::distSqr()
inline bool Foam::wallPoint::valid() const
{
return origin_ != greatPoint;
return origin_ != point::max;
}

View File

@ -800,9 +800,7 @@ void Foam::isoSurface::calcSnappedPoint
const pointField& pts = mesh_.points();
const pointField& cc = mesh_.cellCentres();
const point greatPoint(VGREAT, VGREAT, VGREAT);
pointField collapsedPoint(mesh_.nPoints(), greatPoint);
pointField collapsedPoint(mesh_.nPoints(), point::max);
// Work arrays
@ -966,7 +964,7 @@ void Foam::isoSurface::calcSnappedPoint
// Synchronise snap location
syncUnseparatedPoints(collapsedPoint, greatPoint);
syncUnseparatedPoints(collapsedPoint, point::max);
snappedPoint.setSize(mesh_.nPoints());
@ -974,7 +972,7 @@ void Foam::isoSurface::calcSnappedPoint
forAll(collapsedPoint, pointI)
{
if (collapsedPoint[pointI] != greatPoint)
if (collapsedPoint[pointI] != point::max)
{
snappedPoint[pointI] = snappedPoints.size();
snappedPoints.append(collapsedPoint[pointI]);

View File

@ -630,8 +630,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint
labelList& snappedPoint
) const
{
const point greatPoint(VGREAT, VGREAT, VGREAT);
pointField collapsedPoint(mesh_.nPoints(), greatPoint);
pointField collapsedPoint(mesh_.nPoints(), point::max);
// Work arrays
@ -764,7 +763,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint
mesh_,
collapsedPoint,
minEqOp<point>(),
greatPoint,
point::max,
true // are coordinates so separate
);
@ -773,7 +772,7 @@ void Foam::isoSurfaceCell::calcSnappedPoint
forAll(collapsedPoint, pointI)
{
if (collapsedPoint[pointI] != greatPoint)
if (collapsedPoint[pointI] != point::max)
{
snappedPoint[pointI] = snappedPoints.size();
snappedPoints.append(collapsedPoint[pointI]);