Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2008-10-29 13:19:27 +00:00
16 changed files with 3236 additions and 148 deletions

View File

@ -284,12 +284,28 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
pointZones_.setSize(newPointZones.size());
forAll (pointZones_, pzI)
label oldSize = pointZones_.size();
if (newPointZones.size() <= pointZones_.size())
{
pointZones_[pzI] = newPointZones[pzI];
pointZones_.setSize(newPointZones.size());
}
// Reset existing ones
forAll (pointZones_, czI)
{
pointZones_[czI] = newPointZones[czI];
}
// Extend with extra ones
pointZones_.setSize(newPointZones.size());
for (label czI = oldSize; czI < newPointZones.size(); czI++)
{
pointZones_.set(czI, newPointZones[czI].clone(pointZones_));
}
faceZoneMesh newFaceZones
(
IOobject
@ -305,7 +321,14 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
faceZones_.setSize(newFaceZones.size());
oldSize = faceZones_.size();
if (newFaceZones.size() <= faceZones_.size())
{
faceZones_.setSize(newFaceZones.size());
}
// Reset existing ones
forAll (faceZones_, fzI)
{
faceZones_[fzI].resetAddressing
@ -315,6 +338,15 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
);
}
// Extend with extra ones
faceZones_.setSize(newFaceZones.size());
for (label fzI = oldSize; fzI < newFaceZones.size(); fzI++)
{
faceZones_.set(fzI, newFaceZones[fzI].clone(faceZones_));
}
cellZoneMesh newCellZones
(
IOobject
@ -330,12 +362,28 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
*this
);
cellZones_.setSize(newCellZones.size());
oldSize = cellZones_.size();
if (newCellZones.size() <= cellZones_.size())
{
cellZones_.setSize(newCellZones.size());
}
// Reset existing ones
forAll (cellZones_, czI)
{
cellZones_[czI] = newCellZones[czI];
}
// Extend with extra ones
cellZones_.setSize(newCellZones.size());
for (label czI = oldSize; czI < newCellZones.size(); czI++)
{
cellZones_.set(czI, newCellZones[czI].clone(cellZones_));
}
if (boundaryChanged)
{
return polyMesh::TOPO_PATCH_CHANGE;

View File

@ -218,7 +218,8 @@ Foam::label Foam::autoSnapDriver::getCollocatedPoints
// Calculate displacement as average of patch points.
Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
(
const motionSmoother& meshMover
const motionSmoother& meshMover,
const List<labelPair>& baffles
) const
{
const indirectPrimitivePatch& pp = meshMover.patch();
@ -253,6 +254,34 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
const pointField& points = pp.points();
const polyMesh& mesh = meshMover.mesh();
// Get labels of faces to count (master of coupled faces and baffle pairs)
PackedList<1> isMasterFace(syncTools::getMasterFaces(mesh));
{
forAll(baffles, i)
{
label f0 = baffles[i].first();
label f1 = baffles[i].second();
if (isMasterFace.get(f0) == 1)
{
// Make f1 a slave
isMasterFace.set(f1, 0);
}
else if (isMasterFace.get(f1) == 1)
{
isMasterFace.set(f0, 0);
}
else
{
FatalErrorIn("autoSnapDriver::smoothPatchDisplacement(..)")
<< "Both sides of baffle consisting of faces " << f0
<< " and " << f1 << " are already slave faces."
<< abort(FatalError);
}
}
}
// Get average position of boundary face centres
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -266,9 +295,14 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
forAll(pFaces, pfI)
{
avgBoundary[patchPointI] += pp[pFaces[pfI]].centre(points);
label faceI = pFaces[pfI];
if (isMasterFace.get(pp.addressing()[faceI]) == 1)
{
avgBoundary[patchPointI] += pp[faceI].centre(points);
nBoundary[patchPointI]++;
}
}
nBoundary[patchPointI] = pFaces.size();
}
syncTools::syncPointList
@ -886,7 +920,7 @@ void Foam::autoSnapDriver::preSmoothPatch
checkFaces[faceI] = faceI;
}
pointField patchDisp(smoothPatchDisplacement(meshMover));
pointField patchDisp(smoothPatchDisplacement(meshMover, baffles));
// The current mesh is the starting mesh to smooth from.
meshMover.setDisplacement(patchDisp);
@ -1008,9 +1042,11 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
// Displacement per patch point
vectorField patchDisp(localPoints.size(), vector::zero);
if (returnReduce(localPoints.size(), sumOp<label>()) > 0)
{
// Current surface snapped to
labelList snapSurf(localPoints.size(), -1);
// Divide surfaces into zoned and unzoned
labelList zonedSurfaces;
labelList unzonedSurfaces;
@ -1039,16 +1075,9 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
patchDisp[pointI] =
hitInfo[pointI].hitPoint()
- localPoints[pointI];
snapSurf[pointI] = hitSurface[pointI];
}
//else
//{
// WarningIn("autoSnapDriver::calcNearestSurface(..)")
// << "For point:" << pointI
// << " coordinate:" << localPoints[pointI]
// << " did not find any surface within:"
// << 4*snapDist[pointI]
// << " meter." << endl;
//}
}
}
@ -1060,6 +1089,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
// Surfaces with zone information
const wordList& faceZoneNames = surfaces.faceZoneNames();
// Current best snap distance
scalarField minSnapDist(snapDist);
forAll(zonedSurfaces, i)
@ -1105,19 +1135,25 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface
minSnapDist[pointI],
mag(patchDisp[pointI])
);
}
else
{
WarningIn("autoSnapDriver::calcNearestSurface(..)")
<< "For point:" << pointI
<< " coordinate:" << localPoints[pointI]
<< " did not find any surface within:"
<< 4*minSnapDist[pointI]
<< " meter." << endl;
snapSurf[pointI] = zoneSurfI;
}
}
}
// Check if all points are being snapped
forAll(snapSurf, pointI)
{
if (snapSurf[pointI] == -1)
{
WarningIn("autoSnapDriver::calcNearestSurface(..)")
<< "For point:" << pointI
<< " coordinate:" << localPoints[pointI]
<< " did not find any surface within:"
<< minSnapDist[pointI]
<< " meter." << endl;
}
}
{
scalarField magDisp(mag(patchDisp));

View File

@ -100,7 +100,11 @@ class autoSnapDriver
//- Calculate displacement per patch point to smooth out patch.
// Quite complicated in determining which points to move where.
pointField smoothPatchDisplacement(const motionSmoother&) const;
pointField smoothPatchDisplacement
(
const motionSmoother&,
const List<labelPair>&
) const;
//- Check that face zones are synced
void checkCoupledFaceZones() const;

View File

@ -382,10 +382,12 @@ private:
//- Finds zone per cell for cells inside closed named surfaces.
// (uses geometric test for insideness)
// Adapts namedSurfaceIndex so all faces on boundary of cellZone
// have corresponding faceZone.
void findCellZoneGeometric
(
const labelList& closedNamedSurfaces,
const labelList& namedSurfaceIndex,
labelList& namedSurfaceIndex,
const labelList& surfaceToCellZone,
labelList& cellToZone
) const;

View File

@ -47,6 +47,7 @@ License
#include "motionSmoother.H"
#include "polyMeshGeometry.H"
#include "IOmanip.H"
#include "cellSet.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -1490,7 +1491,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
void Foam::meshRefinement::findCellZoneGeometric
(
const labelList& closedNamedSurfaces, // indices of closed surfaces
const labelList& namedSurfaceIndex, // per face index of named surface
labelList& namedSurfaceIndex, // per face index of named surface
const labelList& surfaceToCellZone, // cell zone index per surface
labelList& cellToZone
@ -1627,6 +1628,76 @@ void Foam::meshRefinement::findCellZoneGeometric
}
}
}
// Adapt the namedSurfaceIndex
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
// for if any cells were not completely covered.
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
{
label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
label neiZone = cellToZone[mesh_.faceNeighbour()[faceI]];
if (namedSurfaceIndex[faceI] == -1 && (ownZone != neiZone))
{
// Give face the zone of the owner
namedSurfaceIndex[faceI] = findIndex
(
surfaceToCellZone,
max(ownZone, neiZone)
);
}
}
labelList neiCellZone(mesh_.nFaces()-mesh_.nInternalFaces());
for
(
label faceI = mesh_.nInternalFaces();
faceI < mesh_.nFaces();
faceI++
)
{
label own = mesh_.faceOwner()[faceI];
neiCellZone[faceI-mesh_.nInternalFaces()] = cellToZone[own];
}
syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false);
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (pp.coupled())
{
forAll(pp, i)
{
label faceI = pp.start()+i;
label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()];
if (namedSurfaceIndex[faceI] == -1 && (ownZone != neiZone))
{
// Give face the zone of the owner
namedSurfaceIndex[faceI] = findIndex
(
surfaceToCellZone,
max(ownZone, neiZone)
);
}
}
}
}
// Sync
syncTools::syncFaceList
(
mesh_,
namedSurfaceIndex,
maxEqOp<label>(),
false
);
}
@ -1656,7 +1727,7 @@ void Foam::meshRefinement::findCellZoneTopo
blockedFace[faceI] = true;
}
}
syncTools::syncFaceList(mesh_, blockedFace, orEqOp<bool>(), false);
// No need to sync since namedSurfaceIndex already is synced
// Set region per cell based on walking
regionSplit cellRegion(mesh_, blockedFace);
@ -2149,8 +2220,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
{
FatalErrorIn
(
"meshRefinement::findCellZoneTopo"
"(const point&, const labelList&, const labelList&, labelList&)"
"meshRefinement::splitMesh"
"(const label, const labelList&, const point&)"
) << "Point " << keepPoint
<< " is not inside the mesh." << nl
<< "Bounding box of the mesh:" << mesh_.globalData().bb()
@ -2703,6 +2774,79 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
}
// Put the cells into the correct zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Closed surfaces with cellZone specified.
labelList closedNamedSurfaces(surfaces_.getClosedNamedSurfaces());
// Zone per cell:
// -2 : unset
// -1 : not in any zone
// >=0: zoneID
labelList cellToZone(mesh_.nCells(), -2);
// Set using geometric test
// ~~~~~~~~~~~~~~~~~~~~~~~~
if (closedNamedSurfaces.size() > 0)
{
findCellZoneGeometric
(
closedNamedSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface
surfaceToCellZone, // cell zone index per surface
cellToZone
);
}
//{
// Pout<< "** finding out blocked faces." << endl;
//
// cellSet zonedCellsGeom(mesh_, "zonedCellsGeom", 100);
// forAll(cellToZone, cellI)
// {
// if (cellToZone[cellI] >= 0)
// {
// zonedCellsGeom.insert(cellI);
// }
// }
// Pout<< "Writing zoned cells to " << zonedCellsGeom.objectPath()
// << endl;
// zonedCellsGeom.write();
//
//
// faceSet zonedFaces(mesh_, "zonedFaces", 100);
// forAll(namedSurfaceIndex, faceI)
// {
// label surfI = namedSurfaceIndex[faceI];
//
// if (surfI != -1)
// {
// zonedFaces.insert(faceI);
// }
// }
// Pout<< "Writing zoned faces to " << zonedFaces.objectPath() << endl;
// zonedFaces.write();
//}
// Set using walking
// ~~~~~~~~~~~~~~~~~
//if (returnReduce(nSet, sumOp<label>()) < mesh_.globalData().nTotalCells())
{
// Topological walk
findCellZoneTopo
(
keepPoint,
namedSurfaceIndex,
surfaceToCellZone,
cellToZone
);
}
// Topochange container
polyTopoChange meshMod(mesh_);
@ -2770,50 +2914,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// Put the cells into the correct zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Closed surfaces with cellZone specified.
labelList closedNamedSurfaces(surfaces_.getClosedNamedSurfaces());
// Zone per cell:
// -2 : unset
// -1 : not in any zone
// >=0: zoneID
labelList cellToZone(mesh_.nCells(), -2);
// Set using geometric test
// ~~~~~~~~~~~~~~~~~~~~~~~~
if (closedNamedSurfaces.size() > 0)
{
findCellZoneGeometric
(
closedNamedSurfaces, // indices of closed surfaces
namedSurfaceIndex, // per face index of named surface
surfaceToCellZone, // cell zone index per surface
cellToZone
);
}
// Set using walking
// ~~~~~~~~~~~~~~~~~
//if (returnReduce(nSet, sumOp<label>()) < mesh_.globalData().nTotalCells())
{
// Topological walk
findCellZoneTopo
(
keepPoint,
namedSurfaceIndex,
surfaceToCellZone,
cellToZone
);
}
// Actually move the cells to their zone
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(cellToZone, cellI)
{
label zoneI = cellToZone[cellI];

View File

@ -107,6 +107,7 @@ $(pointSources)/faceToPoint/faceToPoint.C
$(pointSources)/boxToPoint/boxToPoint.C
$(pointSources)/surfaceToPoint/surfaceToPoint.C
$(pointSources)/zoneToPoint/zoneToPoint.C
$(pointSources)/nearestToPoint/nearestToPoint.C
surfaceSets/surfaceSets.C

View File

@ -1904,8 +1904,8 @@ void Foam::distributedTriSurfaceMesh::distribute
}
else
{
dict_.set("bounds", procBb_[Pstream::myProcNo()]);
procBb_.transfer(newProcBb);
dict_.set("bounds", procBb_[Pstream::myProcNo()]);
}
}

View File

@ -26,7 +26,6 @@ License
#include "searchableSurfaceWithGaps.H"
#include "addToRunTimeSelectionTable.H"
#include "SortableList.H"
#include "Time.H"
#include "ListOps.H"
@ -82,7 +81,7 @@ Foam::Pair<Foam::vector> Foam::searchableSurfaceWithGaps::offsetVecs
// Do second offset vector perp to original edge and first offset vector
offsets[1] = n ^ offsets[0];
offsets[1] *= gap_/mag(offsets[1]);
offsets[1] *= gap_;
}
return offsets;
@ -207,6 +206,10 @@ void Foam::searchableSurfaceWithGaps::findLine
List<pointIndexHit>& info
) const
{
// Test with unperturbed vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
surface().findLine(start, end, info);
// Count number of misses. Determine map
@ -215,6 +218,10 @@ void Foam::searchableSurfaceWithGaps::findLine
if (returnReduce(nMiss, sumOp<label>()) > 0)
{
//Pout<< "** retesting with offset0 " << nMiss << " misses out of "
// << start.size() << endl;
// extract segments according to map
pointField compactStart(start, compactMap);
pointField compactEnd(end, compactMap);
@ -228,20 +235,36 @@ void Foam::searchableSurfaceWithGaps::findLine
offset1
);
// Test with offset0 perturbed vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// test in pairs: only if both perturbations hit something
// do we accept the hit.
const vectorField smallVec(SMALL*(compactEnd-compactStart));
List<pointIndexHit> plusInfo;
surface().findLine(compactStart+offset0, compactEnd+offset0, plusInfo);
surface().findLine
(
compactStart+offset0-smallVec,
compactEnd+offset0+smallVec,
plusInfo
);
List<pointIndexHit> minInfo;
surface().findLine(compactStart-offset0, compactEnd-offset0, minInfo);
surface().findLine
(
compactStart-offset0-smallVec,
compactEnd-offset0+smallVec,
minInfo
);
// Extract any hits
forAll(plusInfo, i)
{
if (plusInfo[i].hit() && minInfo[i].hit())
{
info[compactMap[i]] = plusInfo[i].hitPoint()-offset0[i];
info[compactMap[i]] = plusInfo[i];
info[compactMap[i]].rawPoint() -= offset0[i];
}
}
@ -250,6 +273,12 @@ void Foam::searchableSurfaceWithGaps::findLine
if (returnReduce(nMiss, sumOp<label>()) > 0)
{
//Pout<< "** retesting with offset1 " << nMiss << " misses out of "
// << start.size() << endl;
// Test with offset1 perturbed vectors
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Extract (inplace possible because of order)
forAll(plusMissMap, i)
{
@ -266,17 +295,18 @@ void Foam::searchableSurfaceWithGaps::findLine
offset0.setSize(plusMissMap.size());
offset1.setSize(plusMissMap.size());
const vectorField smallVec(SMALL*(compactEnd-compactStart));
surface().findLine
(
compactStart+offset1,
compactEnd+offset1,
compactStart+offset1-smallVec,
compactEnd+offset1+smallVec,
plusInfo
);
surface().findLine
(
compactStart-offset1,
compactEnd-offset1,
compactStart-offset1-smallVec,
compactEnd-offset1+smallVec,
minInfo
);
@ -285,7 +315,8 @@ void Foam::searchableSurfaceWithGaps::findLine
{
if (plusInfo[i].hit() && minInfo[i].hit())
{
info[compactMap[i]] = plusInfo[i].hitPoint()-offset1[i];
info[compactMap[i]] = plusInfo[i];
info[compactMap[i]].rawPoint() -= offset1[i];
}
}
}

View File

@ -27,7 +27,13 @@ Class
Description
searchableSurface using multiple slightly shifted underlying surfaces
to make sure pierces don't go through gaps.
to make sure pierces don't go through gaps:
- shift test vector with two small vectors (of size gap_) perpendicular
to the original.
Test with + and - this vector. Only if both register a hit is it seen
as one.
- extend the test vector slightly (with SMALL) to account for numerical
inaccuracies.
SourceFiles
searchableSurfaceWithGaps.C

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 "nearestToPoint.H"
#include "polyMesh.H"
#include "meshSearch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(nearestToPoint, 0);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, word);
addToRunTimeSelectionTable(topoSetSource, nearestToPoint, istream);
}
Foam::topoSetSource::addToUsageTable Foam::nearestToPoint::usage_
(
nearestToPoint::typeName,
"\n Usage: nearestToPoint (pt0 .. ptn)\n\n"
" Select the nearest point for each of the points pt0 ..ptn\n\n"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::nearestToPoint::combine(topoSet& set, const bool add) const
{
// Do linear search since usually just a few points.
forAll(points_, pointI)
{
const pointField& pts = mesh_.points();
if (pts.size() > 0)
{
label minPointI = 0;
scalar minDistSqr = magSqr(pts[minPointI] - points_[pointI]);
for (label i = 1; i < pts.size(); i++)
{
scalar distSqr = magSqr(pts[i] - points_[pointI]);
if (distSqr < minDistSqr)
{
minDistSqr = distSqr;
minPointI = i;
}
}
addOrDelete(set, minPointI, add);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
Foam::nearestToPoint::nearestToPoint
(
const polyMesh& mesh,
const pointField& points
)
:
topoSetSource(mesh),
points_(points)
{}
// Construct from dictionary
Foam::nearestToPoint::nearestToPoint
(
const polyMesh& mesh,
const dictionary& dict
)
:
topoSetSource(mesh),
points_(dict.lookup("points"))
{}
// Construct from Istream
Foam::nearestToPoint::nearestToPoint
(
const polyMesh& mesh,
Istream& is
)
:
topoSetSource(mesh),
points_(checkIs(is))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::nearestToPoint::~nearestToPoint()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::nearestToPoint::applyToSet
(
const topoSetSource::setAction action,
topoSet& set
) const
{
if ((action == topoSetSource::NEW) || (action == topoSetSource::ADD))
{
Info<< " Adding points nearest to " << points_ << endl;
combine(set, true);
}
else if (action == topoSetSource::DELETE)
{
Info<< " Removing points nearest to " << points_ << endl;
combine(set, false);
}
}
// ************************************************************************* //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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::nearestToPoint
Description
A topoSetSource to select points nearest to points.
SourceFiles
nearestToPoint.C
\*---------------------------------------------------------------------------*/
#ifndef nearestToPoint_H
#define nearestToPoint_H
#include "topoSetSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class nearestToPoint Declaration
\*---------------------------------------------------------------------------*/
class nearestToPoint
:
public topoSetSource
{
// Private data
//- Add usage string
static addToUsageTable usage_;
//- points to select nearest to
pointField points_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("nearestToPoint");
// Constructors
//- Construct from components
nearestToPoint
(
const polyMesh& mesh,
const pointField& points
);
//- Construct from dictionary
nearestToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
nearestToPoint
(
const polyMesh& mesh,
Istream&
);
// Destructor
virtual ~nearestToPoint();
// Member Functions
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //