mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Merge searchableSurface and indexedOctree volumeType
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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -155,10 +155,10 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
// For each cell in the mesh has it been determined if it is fully
|
||||
// inside, outside, or overlaps the surface
|
||||
labelList volumeStatus
|
||||
List<volumeType> volumeStatus
|
||||
(
|
||||
mesh_.nCells(),
|
||||
searchableSurface::UNKNOWN
|
||||
volumeType::UNKNOWN
|
||||
);
|
||||
|
||||
// Surface refinement
|
||||
@ -168,7 +168,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
// Determine/update the status of each cell
|
||||
forAll(volumeStatus, cellI)
|
||||
{
|
||||
if (volumeStatus[cellI] == searchableSurface::UNKNOWN)
|
||||
if (volumeStatus[cellI] == volumeType::UNKNOWN)
|
||||
{
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
@ -181,16 +181,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
if (geometry.overlaps(cellBb))
|
||||
{
|
||||
volumeStatus[cellI] = searchableSurface::MIXED;
|
||||
volumeStatus[cellI] = volumeType::MIXED;
|
||||
}
|
||||
else if (geometry.inside(cellBb.midpoint()))
|
||||
{
|
||||
volumeStatus[cellI] = searchableSurface::INSIDE;
|
||||
volumeStatus[cellI] = volumeType::INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volumeStatus[cellI] =
|
||||
searchableSurface::OUTSIDE;
|
||||
volumeStatus[cellI] = volumeType::OUTSIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,9 +215,9 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
{
|
||||
label cellI = newCellsToRefine[nCTRI];
|
||||
|
||||
if (volumeStatus[cellI] == searchableSurface::MIXED)
|
||||
if (volumeStatus[cellI] == volumeType::MIXED)
|
||||
{
|
||||
volumeStatus[cellI] = searchableSurface::UNKNOWN;
|
||||
volumeStatus[cellI] = volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
icellWeights[cellI] = max
|
||||
@ -260,7 +259,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
const labelList& cellMap = map().cellMap();
|
||||
|
||||
labelList newVolumeStatus(cellMap.size());
|
||||
List<volumeType> newVolumeStatus(cellMap.size());
|
||||
|
||||
forAll(cellMap, newCellI)
|
||||
{
|
||||
@ -268,8 +267,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
if (oldCellI == -1)
|
||||
{
|
||||
newVolumeStatus[newCellI] =
|
||||
searchableSurface::UNKNOWN;
|
||||
newVolumeStatus[newCellI] = volumeType::UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -289,7 +287,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
// Determine/update the status of each cell
|
||||
forAll(volumeStatus, cellI)
|
||||
{
|
||||
if (volumeStatus[cellI] == searchableSurface::UNKNOWN)
|
||||
if (volumeStatus[cellI] == volumeType::UNKNOWN)
|
||||
{
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
@ -302,16 +300,15 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
if (geometry.overlaps(cellBb))
|
||||
{
|
||||
volumeStatus[cellI] = searchableSurface::MIXED;
|
||||
volumeStatus[cellI] = volumeType::MIXED;
|
||||
}
|
||||
else if (geometry.inside(cellBb.midpoint()))
|
||||
{
|
||||
volumeStatus[cellI] = searchableSurface::INSIDE;
|
||||
volumeStatus[cellI] = volumeType::INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volumeStatus[cellI] =
|
||||
searchableSurface::OUTSIDE;
|
||||
volumeStatus[cellI] = volumeType::OUTSIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -325,7 +322,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
forAll(volumeStatus, cellI)
|
||||
{
|
||||
if (volumeStatus[cellI] == searchableSurface::OUTSIDE)
|
||||
if (volumeStatus[cellI] == volumeType::OUTSIDE)
|
||||
{
|
||||
cellsToRemove.append(cellI);
|
||||
}
|
||||
@ -372,7 +369,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
const labelList& cellMap = map().cellMap();
|
||||
|
||||
labelList newVolumeStatus(cellMap.size());
|
||||
List<volumeType> newVolumeStatus(cellMap.size());
|
||||
|
||||
forAll(cellMap, newCellI)
|
||||
{
|
||||
@ -380,13 +377,11 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
|
||||
if (oldCellI == -1)
|
||||
{
|
||||
newVolumeStatus[newCellI] =
|
||||
searchableSurface::UNKNOWN;
|
||||
newVolumeStatus[newCellI] = volumeType::UNKNOWN;
|
||||
}
|
||||
else
|
||||
{
|
||||
newVolumeStatus[newCellI] =
|
||||
volumeStatus[oldCellI];
|
||||
newVolumeStatus[newCellI] = volumeStatus[oldCellI];
|
||||
}
|
||||
}
|
||||
|
||||
@ -511,7 +506,7 @@ void Foam::backgroundMeshDecomposition::printMeshData
|
||||
bool Foam::backgroundMeshDecomposition::refineCell
|
||||
(
|
||||
label cellI,
|
||||
label volType,
|
||||
volumeType volType,
|
||||
scalar& weightEstimate
|
||||
) const
|
||||
{
|
||||
@ -531,7 +526,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
|
||||
weightEstimate = 1.0;
|
||||
|
||||
if (volType == searchableSurface::MIXED)
|
||||
if (volType == volumeType::MIXED)
|
||||
{
|
||||
// // Assess the cell size at the nearest point on the surface for the
|
||||
// // MIXED cells, if the cell is large with respect to the cell size,
|
||||
@ -611,7 +606,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
// return true;
|
||||
// }
|
||||
}
|
||||
else if (volType == searchableSurface::INSIDE)
|
||||
else if (volType == volumeType::INSIDE)
|
||||
{
|
||||
// scalar s = cvMesh_.cellShapeControl_.cellSize(cellBb.midpoint());
|
||||
|
||||
@ -634,7 +629,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
|
||||
Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
|
||||
(
|
||||
labelList& volumeStatus,
|
||||
List<volumeType>& volumeStatus,
|
||||
volScalarField& cellWeights
|
||||
) const
|
||||
{
|
||||
@ -645,7 +640,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
|
||||
// Determine/update the status of each cell
|
||||
forAll(volumeStatus, cellI)
|
||||
{
|
||||
if (volumeStatus[cellI] == searchableSurface::MIXED)
|
||||
if (volumeStatus[cellI] == volumeType::MIXED)
|
||||
{
|
||||
if (meshCutter_.cellLevel()[cellI] < minLevels_)
|
||||
{
|
||||
@ -653,7 +648,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
|
||||
}
|
||||
}
|
||||
|
||||
if (volumeStatus[cellI] != searchableSurface::OUTSIDE)
|
||||
if (volumeStatus[cellI] != volumeType::OUTSIDE)
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -705,7 +700,12 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
||||
(
|
||||
new indexedOctree<treeDataBPatch>
|
||||
(
|
||||
treeDataBPatch(false, boundaryFacesPtr_()),
|
||||
treeDataBPatch
|
||||
(
|
||||
false,
|
||||
boundaryFacesPtr_(),
|
||||
indexedOctree<treeDataBPatch>::perturbTol()
|
||||
),
|
||||
overallBb.extend(rnd, 1e-4),
|
||||
10, // maxLevel
|
||||
10, // leafSize
|
||||
@ -1064,11 +1064,7 @@ bool Foam::backgroundMeshDecomposition::positionOnThisProcessor
|
||||
{
|
||||
// return bFTreePtr_().findAnyOverlap(pt, 0.0);
|
||||
|
||||
return
|
||||
(
|
||||
bFTreePtr_().getVolumeType(pt)
|
||||
== indexedOctree<treeDataBPatch>::INSIDE
|
||||
);
|
||||
return (bFTreePtr_().getVolumeType(pt) == volumeType::INSIDE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -71,6 +71,7 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataPrimitivePatch.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -166,7 +167,7 @@ class backgroundMeshDecomposition
|
||||
bool refineCell
|
||||
(
|
||||
label cellI,
|
||||
label volType,
|
||||
volumeType volType,
|
||||
scalar& weightEstimate
|
||||
) const;
|
||||
|
||||
@ -174,7 +175,7 @@ class backgroundMeshDecomposition
|
||||
// meshed
|
||||
labelList selectRefinementCells
|
||||
(
|
||||
labelList& volumeStatus,
|
||||
List<volumeType>& volumeStatus,
|
||||
volScalarField& cellWeights
|
||||
) const;
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
#include "triSurfaceFields.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -125,7 +126,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
|
||||
}
|
||||
|
||||
pointField ptF(1, pt);
|
||||
List<searchableSurface::volumeType> vTL;
|
||||
List<volumeType> vTL;
|
||||
|
||||
surface_.getVolumeType(ptF, vTL);
|
||||
|
||||
@ -134,7 +135,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
|
||||
if
|
||||
(
|
||||
sideMode_ == smInside
|
||||
&& vTL[0] == searchableSurface::INSIDE
|
||||
&& vTL[0] == volumeType::INSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(hitPt, dist, hitIndex);
|
||||
@ -144,7 +145,7 @@ bool linearDistance::cellSize(const point& pt, scalar& size) const
|
||||
else if
|
||||
(
|
||||
sideMode_ == smOutside
|
||||
&& vTL[0] == searchableSurface::OUTSIDE
|
||||
&& vTL[0] == volumeType::OUTSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(hitPt, dist, hitIndex);
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "linearSpatial.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -108,7 +109,7 @@ bool linearSpatial::cellSize
|
||||
}
|
||||
|
||||
pointField ptF(1, pt);
|
||||
List<searchableSurface::volumeType> vTL;
|
||||
List<volumeType> vTL;
|
||||
|
||||
surface_.getVolumeType(ptF, vTL);
|
||||
|
||||
@ -117,7 +118,7 @@ bool linearSpatial::cellSize
|
||||
if
|
||||
(
|
||||
sideMode_ == smInside
|
||||
&& vTL[0] == searchableSurface::INSIDE
|
||||
&& vTL[0] == volumeType::INSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(pt);
|
||||
@ -127,7 +128,7 @@ bool linearSpatial::cellSize
|
||||
else if
|
||||
(
|
||||
sideMode_ == smOutside
|
||||
&& vTL[0] == searchableSurface::OUTSIDE
|
||||
&& vTL[0] == volumeType::OUTSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(pt);
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "surfaceOffsetLinearDistance.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -194,7 +195,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
||||
}
|
||||
|
||||
pointField ptF(1, pt);
|
||||
List<searchableSurface::volumeType> vTL;
|
||||
List<volumeType> vTL;
|
||||
|
||||
surface_.getVolumeType(ptF, vTL);
|
||||
|
||||
@ -203,7 +204,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
||||
if
|
||||
(
|
||||
sideMode_ == smInside
|
||||
&& vTL[0] == searchableSurface::INSIDE
|
||||
&& vTL[0] == volumeType::INSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(hitPt, dist, hitIndex);
|
||||
@ -213,7 +214,7 @@ bool surfaceOffsetLinearDistance::cellSize
|
||||
else if
|
||||
(
|
||||
sideMode_ == smOutside
|
||||
&& vTL[0] == searchableSurface::OUTSIDE
|
||||
&& vTL[0] == volumeType::OUTSIDE
|
||||
)
|
||||
{
|
||||
size = sizeFunction(hitPt, dist, hitIndex);
|
||||
|
||||
@ -25,6 +25,7 @@ License
|
||||
|
||||
#include "uniform.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -103,7 +104,7 @@ bool uniform::cellSize
|
||||
}
|
||||
|
||||
pointField ptF(1, pt);
|
||||
List<searchableSurface::volumeType> vTL(1);
|
||||
List<volumeType> vTL(1);
|
||||
|
||||
surface_.getVolumeType(ptF, vTL);
|
||||
|
||||
@ -112,7 +113,7 @@ bool uniform::cellSize
|
||||
if
|
||||
(
|
||||
sideMode_ == smInside
|
||||
&& vTL[0] == searchableSurface::INSIDE
|
||||
&& vTL[0] == volumeType::INSIDE
|
||||
)
|
||||
{
|
||||
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||
@ -122,7 +123,7 @@ bool uniform::cellSize
|
||||
else if
|
||||
(
|
||||
sideMode_ == smOutside
|
||||
&& vTL[0] == searchableSurface::OUTSIDE
|
||||
&& vTL[0] == volumeType::OUTSIDE
|
||||
)
|
||||
{
|
||||
size = surfaceCellSizeFunction_().interpolate(hitPt, index);
|
||||
|
||||
@ -25,7 +25,7 @@ License
|
||||
|
||||
#include "uniformDistance.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "dimensionSet.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,7 +95,7 @@ bool uniformDistance::cellSize
|
||||
}
|
||||
|
||||
pointField ptF(1, pt);
|
||||
List<searchableSurface::volumeType> vTL;
|
||||
List<volumeType> vTL;
|
||||
|
||||
surface_.getVolumeType(ptF, vTL);
|
||||
|
||||
@ -104,7 +104,7 @@ bool uniformDistance::cellSize
|
||||
if
|
||||
(
|
||||
sideMode_ == smInside
|
||||
&& vTL[0] == searchableSurface::INSIDE
|
||||
&& vTL[0] == volumeType::INSIDE
|
||||
)
|
||||
{
|
||||
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||
@ -114,7 +114,7 @@ bool uniformDistance::cellSize
|
||||
else if
|
||||
(
|
||||
sideMode_ == smOutside
|
||||
&& vTL[0] == searchableSurface::OUTSIDE
|
||||
&& vTL[0] == volumeType::OUTSIDE
|
||||
)
|
||||
{
|
||||
size = surfaceCellSizeFunction_().surfaceSize(hitInfo.index());
|
||||
|
||||
@ -27,11 +27,19 @@ License
|
||||
#include "conformalVoronoiMesh.H"
|
||||
#include "triSurface.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(conformationSurfaces, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::conformationSurfaces::hasBoundedVolume
|
||||
(
|
||||
List<searchableSurface::volumeType>& referenceVolumeTypes
|
||||
List<volumeType>& referenceVolumeTypes
|
||||
) const
|
||||
{
|
||||
vector sum(vector::zero);
|
||||
@ -41,14 +49,18 @@ void Foam::conformationSurfaces::hasBoundedVolume
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
if
|
||||
(
|
||||
surface.hasVolumeType()
|
||||
&& !baffleSurfaces_[regionOffset_[s]]
|
||||
)
|
||||
{
|
||||
pointField pts(1, locationInMesh_);
|
||||
|
||||
List<searchableSurface::volumeType> vTypes
|
||||
List<volumeType> vTypes
|
||||
(
|
||||
pts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
volumeType::UNKNOWN
|
||||
);
|
||||
|
||||
surface.getVolumeType(pts, vTypes);
|
||||
@ -56,7 +68,7 @@ void Foam::conformationSurfaces::hasBoundedVolume
|
||||
referenceVolumeTypes[s] = vTypes[0];
|
||||
|
||||
Info<< " is "
|
||||
<< searchableSurface::volumeTypeNames[referenceVolumeTypes[s]]
|
||||
<< volumeType::names[referenceVolumeTypes[s]]
|
||||
<< " surface " << surface.name()
|
||||
<< endl;
|
||||
}
|
||||
@ -407,7 +419,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
referenceVolumeTypes_.setSize
|
||||
(
|
||||
surfaces_.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
volumeType::UNKNOWN
|
||||
);
|
||||
|
||||
Info<< endl
|
||||
@ -471,24 +483,24 @@ bool Foam::conformationSurfaces::outside
|
||||
const point& samplePt
|
||||
) const
|
||||
{
|
||||
return !inside(samplePt);
|
||||
return wellOutside(pointField(1, samplePt), scalarField(1, 0))[0];
|
||||
//return !inside(samplePt);
|
||||
}
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
|
||||
Foam::Field<bool> Foam::conformationSurfaces::wellInside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalarField& testDistSqr,
|
||||
bool testForInside
|
||||
const scalarField& testDistSqr
|
||||
) const
|
||||
{
|
||||
List<List<searchableSurface::volumeType> > surfaceVolumeTests
|
||||
List<List<volumeType> > surfaceVolumeTests
|
||||
(
|
||||
surfaces_.size(),
|
||||
List<searchableSurface::volumeType>
|
||||
List<volumeType>
|
||||
(
|
||||
samplePts.size(),
|
||||
searchableSurface::UNKNOWN
|
||||
volumeType::UNKNOWN
|
||||
)
|
||||
);
|
||||
|
||||
@ -497,7 +509,9 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if (surface.hasVolumeType())
|
||||
const label regionI = regionOffset_[s];
|
||||
|
||||
if (!baffleSurfaces_[regionI])
|
||||
{
|
||||
surface.getVolumeType(samplePts, surfaceVolumeTests[s]);
|
||||
}
|
||||
@ -508,7 +522,7 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
|
||||
// distanceSquared
|
||||
|
||||
// Assume that the point is wellInside until demonstrated otherwise.
|
||||
Field<bool> inOutSidePoint(samplePts.size(), testForInside);
|
||||
Field<bool> insidePoint(samplePts.size(), true);
|
||||
|
||||
//Check if the points are inside the surface by the given distance squared
|
||||
|
||||
@ -534,37 +548,47 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInOutSide
|
||||
{
|
||||
// If the point is within range of the surface, then it can't be
|
||||
// well (in|out)side
|
||||
inOutSidePoint[i] = false;
|
||||
insidePoint[i] = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const label regionI = regionOffset_[s];
|
||||
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if
|
||||
(
|
||||
!surface.hasVolumeType()
|
||||
&& !surface.bounds().contains(samplePts[i])
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If one of the pattern tests is failed, then the point cannot be
|
||||
// inside, therefore, if this is a testForInside = true call, the
|
||||
// result is false. If this is a testForInside = false call, then
|
||||
// the result is true.
|
||||
if (surfaceVolumeTests[s][i] != referenceVolumeTypes_[s])
|
||||
if (baffleSurfaces_[regionI])
|
||||
{
|
||||
inOutSidePoint[i] = !testForInside;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (surfaceVolumeTests[s][i] == volumeType::OUTSIDE)
|
||||
{
|
||||
insidePoint[i] = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return inOutSidePoint;
|
||||
}
|
||||
return insidePoint;
|
||||
|
||||
|
||||
Foam::Field<bool> Foam::conformationSurfaces::wellInside
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalarField& testDistSqr
|
||||
) const
|
||||
{
|
||||
return wellInOutSide(samplePts, testDistSqr, true);
|
||||
//return wellInOutSide(samplePts, testDistSqr, true);
|
||||
}
|
||||
|
||||
|
||||
@ -584,7 +608,103 @@ Foam::Field<bool> Foam::conformationSurfaces::wellOutside
|
||||
const scalarField& testDistSqr
|
||||
) const
|
||||
{
|
||||
return wellInOutSide(samplePts, testDistSqr, false);
|
||||
// First check if it is outside any closed surface
|
||||
|
||||
List<List<volumeType> > surfaceVolumeTests
|
||||
(
|
||||
surfaces_.size(),
|
||||
List<volumeType>
|
||||
(
|
||||
samplePts.size(),
|
||||
volumeType::UNKNOWN
|
||||
)
|
||||
);
|
||||
|
||||
// Get lists for the volumeTypes for each sample wrt each surface
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
const label regionI = regionOffset_[s];
|
||||
|
||||
if (!baffleSurfaces_[regionI])
|
||||
{
|
||||
surface.getVolumeType(samplePts, surfaceVolumeTests[s]);
|
||||
}
|
||||
}
|
||||
|
||||
// Compare the volumeType result for each point wrt to each surface with the
|
||||
// reference value and if the points are inside the surface by a given
|
||||
// distanceSquared
|
||||
|
||||
// Assume that the point is wellInside until demonstrated otherwise.
|
||||
Field<bool> outsidePoint(samplePts.size(), true);
|
||||
|
||||
//Check if the points are inside the surface by the given distance squared
|
||||
|
||||
labelList hitSurfaces;
|
||||
|
||||
List<pointIndexHit> hitInfo;
|
||||
|
||||
searchableSurfacesQueries::findNearest
|
||||
(
|
||||
allGeometry_,
|
||||
surfaces_,
|
||||
samplePts,
|
||||
testDistSqr,
|
||||
hitSurfaces,
|
||||
hitInfo
|
||||
);
|
||||
|
||||
forAll(samplePts, i)
|
||||
{
|
||||
const pointIndexHit& pHit = hitInfo[i];
|
||||
|
||||
if (pHit.hit())
|
||||
{
|
||||
// If the point is within range of the surface, then it can't be
|
||||
// well (in|out)side
|
||||
outsidePoint[i] = false;
|
||||
|
||||
//continue;
|
||||
}
|
||||
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
const searchableSurface& surface(allGeometry_[surfaces_[s]]);
|
||||
|
||||
if
|
||||
(
|
||||
!surface.hasVolumeType()
|
||||
&& !surface.bounds().contains(samplePts[i])
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const label regionI = regionOffset_[s];
|
||||
|
||||
// If one of the pattern tests is failed, then the point cannot be
|
||||
// inside, therefore, if this is a testForInside = true call, the
|
||||
// result is false. If this is a testForInside = false call, then
|
||||
// the result is true.
|
||||
if (baffleSurfaces_[regionI])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (surfaceVolumeTests[s][i] == volumeType::INSIDE)
|
||||
{
|
||||
outsidePoint[i] = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outsidePoint;
|
||||
|
||||
//return wellInOutSide(samplePts, testDistSqr, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#include "searchableSurfacesQueries.H"
|
||||
#include "extendedFeatureEdgeMesh.H"
|
||||
#include "boolList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,15 +96,12 @@ class conformationSurfaces
|
||||
|
||||
//- The pattern/signature of volumeTypes representing a point in the
|
||||
// domain to be meshed
|
||||
List<searchableSurface::volumeType> referenceVolumeTypes_;
|
||||
List<volumeType> referenceVolumeTypes_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
void hasBoundedVolume
|
||||
(
|
||||
List<searchableSurface::volumeType>& referenceVolumeTypes
|
||||
) const;
|
||||
void hasBoundedVolume(List<volumeType>& referenceVolumeTypes) const;
|
||||
|
||||
//- Read into features_ from a dictionary
|
||||
void readFeatures
|
||||
@ -122,6 +120,10 @@ class conformationSurfaces
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("conformationSurfaces");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary and references to conformalVoronoiMesh and
|
||||
@ -186,12 +188,12 @@ public:
|
||||
//- Check if point is closer to the surfaces to conform to than
|
||||
// testDistSqr, in which case return false, otherwise assess in or
|
||||
// outside and return a result depending on the testForInside flag
|
||||
Field<bool> wellInOutSide
|
||||
(
|
||||
const pointField& samplePts,
|
||||
const scalarField& testDistSqr,
|
||||
bool testForInside
|
||||
) const;
|
||||
// Field<bool> wellInOutSide
|
||||
// (
|
||||
// const pointField& samplePts,
|
||||
// const scalarField& testDistSqr,
|
||||
// bool testForInside
|
||||
// ) const;
|
||||
|
||||
//- Check if point is inside surfaces to conform to by at least
|
||||
// testDistSqr
|
||||
|
||||
@ -31,6 +31,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "triSurface.H"
|
||||
#include "triSurfaceSearch.H"
|
||||
#include "argList.H"
|
||||
#include "OFstream.H"
|
||||
#include "IFstream.H"
|
||||
@ -40,6 +41,7 @@ Description
|
||||
#include "indexedOctree.H"
|
||||
#include "treeDataTriSurface.H"
|
||||
#include "Random.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -242,26 +244,16 @@ int main(int argc, char *argv[])
|
||||
// Read surface to select on
|
||||
triSurface selectSurf(surfName);
|
||||
|
||||
// bb of surface
|
||||
treeBoundBox bb(selectSurf.localPoints());
|
||||
|
||||
// Random number generator
|
||||
Random rndGen(354543);
|
||||
|
||||
// search engine
|
||||
indexedOctree<treeDataTriSurface> selectTree
|
||||
triSurfaceSearch searchSelectSurf
|
||||
(
|
||||
treeDataTriSurface
|
||||
(
|
||||
selectSurf,
|
||||
indexedOctree<treeDataTriSurface>::perturbTol()
|
||||
),
|
||||
bb.extend(rndGen, 1e-4), // slightly randomize bb
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
selectSurf,
|
||||
indexedOctree<treeDataTriSurface>::perturbTol(),
|
||||
8
|
||||
);
|
||||
|
||||
const indexedOctree<treeDataTriSurface>& selectTree =
|
||||
searchSelectSurf.tree();
|
||||
|
||||
// Check if face (centre) is in outside or inside.
|
||||
forAll(facesToSubset, faceI)
|
||||
{
|
||||
@ -269,14 +261,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const point fc(surf1[faceI].centre(surf1.points()));
|
||||
|
||||
indexedOctree<treeDataTriSurface>::volumeType t =
|
||||
selectTree.getVolumeType(fc);
|
||||
volumeType t = selectTree.getVolumeType(fc);
|
||||
|
||||
if
|
||||
(
|
||||
outside
|
||||
? (t == indexedOctree<treeDataTriSurface>::OUTSIDE)
|
||||
: (t == indexedOctree<treeDataTriSurface>::INSIDE)
|
||||
? (t == volumeType::OUTSIDE)
|
||||
: (t == volumeType::INSIDE)
|
||||
)
|
||||
{
|
||||
facesToSubset[faceI] = true;
|
||||
|
||||
@ -606,6 +606,7 @@ $(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C
|
||||
|
||||
algorithms/indexedOctree/indexedOctreeName.C
|
||||
algorithms/indexedOctree/treeDataCell.C
|
||||
algorithms/indexedOctree/volumeType.C
|
||||
|
||||
|
||||
algorithms/dynamicIndexedOctree/dynamicIndexedOctreeName.C
|
||||
|
||||
@ -334,15 +334,14 @@ void Foam::dynamicIndexedOctree<Type>::recursiveSubDivision
|
||||
// Recurses to determine status of lowest level boxes. Level above is
|
||||
// combination of octants below.
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
(
|
||||
const label nodeI
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
volumeType myType = UNKNOWN;
|
||||
volumeType myType = volumeType::UNKNOWN;
|
||||
|
||||
for (direction octant = 0; octant < nod.subNodes_.size(); octant++)
|
||||
{
|
||||
@ -359,7 +358,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
{
|
||||
// Contents. Depending on position in box might be on either
|
||||
// side.
|
||||
subType = MIXED;
|
||||
subType = volumeType::MIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -378,13 +377,13 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
|
||||
// Combine sub node types into type for treeNode. Result is 'mixed' if
|
||||
// types differ among subnodes.
|
||||
if (myType == UNKNOWN)
|
||||
if (myType == volumeType::UNKNOWN)
|
||||
{
|
||||
myType = subType;
|
||||
}
|
||||
else if (subType != myType)
|
||||
{
|
||||
myType = MIXED;
|
||||
myType = volumeType::MIXED;
|
||||
}
|
||||
}
|
||||
return myType;
|
||||
@ -392,8 +391,7 @@ Foam::dynamicIndexedOctree<Type>::calcVolumeType
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const label nodeI,
|
||||
const point& sample
|
||||
@ -403,22 +401,22 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
|
||||
direction octant = nod.bb_.subOctant(sample);
|
||||
|
||||
volumeType octantType = volumeType(nodeTypes_.get((nodeI<<3)+octant));
|
||||
volumeType octantType = volumeType::type(nodeTypes_.get((nodeI<<3)+octant));
|
||||
|
||||
if (octantType == INSIDE)
|
||||
if (octantType == volumeType::INSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == OUTSIDE)
|
||||
else if (octantType == volumeType::OUTSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == UNKNOWN)
|
||||
else if (octantType == volumeType::UNKNOWN)
|
||||
{
|
||||
// Can happen for e.g. non-manifold surfaces.
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == MIXED)
|
||||
else if (octantType == volumeType::MIXED)
|
||||
{
|
||||
labelBits index = nod.subNodes_[octant];
|
||||
|
||||
@ -447,7 +445,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
<< "Empty subnode has invalid volume type MIXED."
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -462,14 +460,13 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
<< "Node has invalid volume type " << octantType
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getSide
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getSide
|
||||
(
|
||||
const vector& outsideNormal,
|
||||
const vector& vec
|
||||
@ -477,11 +474,11 @@ Foam::dynamicIndexedOctree<Type>::getSide
|
||||
{
|
||||
if ((outsideNormal&vec) >= 0)
|
||||
{
|
||||
return OUTSIDE;
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return INSIDE;
|
||||
return volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2582,15 +2579,14 @@ const Foam::labelList& Foam::dynamicIndexedOctree<Type>::findIndices
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
typename Foam::dynamicIndexedOctree<Type>::volumeType
|
||||
Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
if (nodes_.empty())
|
||||
{
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
if (nodeTypes_.size() != 8*nodes_.size())
|
||||
@ -2598,7 +2594,7 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
// Calculate type for every octant of node.
|
||||
|
||||
nodeTypes_.setSize(8*nodes_.size());
|
||||
nodeTypes_ = UNKNOWN;
|
||||
nodeTypes_ = volumeType::UNKNOWN;
|
||||
|
||||
calcVolumeType(0);
|
||||
|
||||
@ -2611,21 +2607,21 @@ Foam::dynamicIndexedOctree<Type>::getVolumeType
|
||||
|
||||
forAll(nodeTypes_, i)
|
||||
{
|
||||
volumeType type = volumeType(nodeTypes_.get(i));
|
||||
volumeType type = volumeType::type(nodeTypes_.get(i));
|
||||
|
||||
if (type == UNKNOWN)
|
||||
if (type == volumeType::UNKNOWN)
|
||||
{
|
||||
nUNKNOWN++;
|
||||
}
|
||||
else if (type == MIXED)
|
||||
else if (type == volumeType::MIXED)
|
||||
{
|
||||
nMIXED++;
|
||||
}
|
||||
else if (type == INSIDE)
|
||||
else if (type == volumeType::INSIDE)
|
||||
{
|
||||
nINSIDE++;
|
||||
}
|
||||
else if (type == OUTSIDE)
|
||||
else if (type == volumeType::OUTSIDE)
|
||||
{
|
||||
nOUTSIDE++;
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "HashSet.H"
|
||||
#include "labelBits.H"
|
||||
#include "PackedList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -83,16 +84,6 @@ public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- volume types
|
||||
enum volumeType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1,
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
|
||||
//- Tree node. Has up pointer and down pointers.
|
||||
class node
|
||||
{
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -57,13 +57,13 @@ Foam::dynamicTreeDataPoint::shapePoints() const
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::label Foam::dynamicTreeDataPoint::getVolumeType
|
||||
Foam::volumeType Foam::dynamicTreeDataPoint::getVolumeType
|
||||
(
|
||||
const dynamicIndexedOctree<dynamicTreeDataPoint>& oc,
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
return dynamicIndexedOctree<dynamicTreeDataPoint>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "linePointRef.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -92,7 +93,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const dynamicIndexedOctree<dynamicTreeDataPoint>&,
|
||||
const point&
|
||||
|
||||
@ -356,15 +356,14 @@ Foam::label Foam::indexedOctree<Type>::compactContents
|
||||
// Recurses to determine status of lowest level boxes. Level above is
|
||||
// combination of octants below.
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::calcVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::calcVolumeType
|
||||
(
|
||||
const label nodeI
|
||||
) const
|
||||
{
|
||||
const node& nod = nodes_[nodeI];
|
||||
|
||||
volumeType myType = UNKNOWN;
|
||||
volumeType myType = volumeType::UNKNOWN;
|
||||
|
||||
for (direction octant = 0; octant < nod.subNodes_.size(); octant++)
|
||||
{
|
||||
@ -381,7 +380,7 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
{
|
||||
// Contents. Depending on position in box might be on either
|
||||
// side.
|
||||
subType = MIXED;
|
||||
subType = volumeType::MIXED;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -389,10 +388,7 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
// of its bounding box.
|
||||
const treeBoundBox subBb = nod.bb_.subBbox(octant);
|
||||
|
||||
subType = volumeType
|
||||
(
|
||||
shapes_.getVolumeType(*this, subBb.midpoint())
|
||||
);
|
||||
subType = shapes_.getVolumeType(*this, subBb.midpoint());
|
||||
}
|
||||
|
||||
// Store octant type
|
||||
@ -400,13 +396,13 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
|
||||
// Combine sub node types into type for treeNode. Result is 'mixed' if
|
||||
// types differ among subnodes.
|
||||
if (myType == UNKNOWN)
|
||||
if (myType == volumeType::UNKNOWN)
|
||||
{
|
||||
myType = subType;
|
||||
}
|
||||
else if (subType != myType)
|
||||
{
|
||||
myType = MIXED;
|
||||
myType = volumeType::MIXED;
|
||||
}
|
||||
}
|
||||
return myType;
|
||||
@ -414,8 +410,7 @@ Foam::indexedOctree<Type>::calcVolumeType
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const label nodeI,
|
||||
const point& sample
|
||||
@ -425,22 +420,22 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
|
||||
direction octant = nod.bb_.subOctant(sample);
|
||||
|
||||
volumeType octantType = volumeType(nodeTypes_.get((nodeI<<3)+octant));
|
||||
volumeType octantType = volumeType::type(nodeTypes_.get((nodeI<<3)+octant));
|
||||
|
||||
if (octantType == INSIDE)
|
||||
if (octantType == volumeType::INSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == OUTSIDE)
|
||||
else if (octantType == volumeType::OUTSIDE)
|
||||
{
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == UNKNOWN)
|
||||
else if (octantType == volumeType::UNKNOWN)
|
||||
{
|
||||
// Can happen for e.g. non-manifold surfaces.
|
||||
return octantType;
|
||||
}
|
||||
else if (octantType == MIXED)
|
||||
else if (octantType == volumeType::MIXED)
|
||||
{
|
||||
labelBits index = nod.subNodes_[octant];
|
||||
|
||||
@ -469,7 +464,7 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
<< "Empty subnode has invalid volume type MIXED."
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -484,14 +479,13 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
<< "Node has invalid volume type " << octantType
|
||||
<< abort(FatalError);
|
||||
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getSide
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getSide
|
||||
(
|
||||
const vector& outsideNormal,
|
||||
const vector& vec
|
||||
@ -499,11 +493,11 @@ Foam::indexedOctree<Type>::getSide
|
||||
{
|
||||
if ((outsideNormal&vec) >= 0)
|
||||
{
|
||||
return OUTSIDE;
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return INSIDE;
|
||||
return volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2972,23 +2966,29 @@ const Foam::labelList& Foam::indexedOctree<Type>::findIndices
|
||||
|
||||
// Determine type (inside/outside/mixed) per node.
|
||||
template<class Type>
|
||||
typename Foam::indexedOctree<Type>::volumeType
|
||||
Foam::indexedOctree<Type>::getVolumeType
|
||||
Foam::volumeType Foam::indexedOctree<Type>::getVolumeType
|
||||
(
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
if (nodes_.empty())
|
||||
{
|
||||
return UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
// // If the sample is not within the octree, then have to query shapes
|
||||
// // directly
|
||||
// if (!nodes_[0].bb_.contains(sample))
|
||||
// {
|
||||
// return volumeType(shapes_.getVolumeType(*this, sample));
|
||||
// }
|
||||
|
||||
if (nodeTypes_.size() != 8*nodes_.size())
|
||||
{
|
||||
// Calculate type for every octant of node.
|
||||
|
||||
nodeTypes_.setSize(8*nodes_.size());
|
||||
nodeTypes_ = UNKNOWN;
|
||||
nodeTypes_ = volumeType::UNKNOWN;
|
||||
|
||||
calcVolumeType(0);
|
||||
|
||||
@ -3001,21 +3001,21 @@ Foam::indexedOctree<Type>::getVolumeType
|
||||
|
||||
forAll(nodeTypes_, i)
|
||||
{
|
||||
volumeType type = volumeType(nodeTypes_.get(i));
|
||||
volumeType type = volumeType::type(nodeTypes_.get(i));
|
||||
|
||||
if (type == UNKNOWN)
|
||||
if (type == volumeType::UNKNOWN)
|
||||
{
|
||||
nUNKNOWN++;
|
||||
}
|
||||
else if (type == MIXED)
|
||||
else if (type == volumeType::MIXED)
|
||||
{
|
||||
nMIXED++;
|
||||
}
|
||||
else if (type == INSIDE)
|
||||
else if (type == volumeType::INSIDE)
|
||||
{
|
||||
nINSIDE++;
|
||||
}
|
||||
else if (type == OUTSIDE)
|
||||
else if (type == volumeType::OUTSIDE)
|
||||
{
|
||||
nOUTSIDE++;
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ SourceFiles
|
||||
#include "HashSet.H"
|
||||
#include "labelBits.H"
|
||||
#include "PackedList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -74,16 +75,6 @@ public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- volume types
|
||||
enum volumeType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1,
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
|
||||
//- Tree node. Has up pointer and down pointers.
|
||||
class node
|
||||
{
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
|
||||
#include "polyMesh.H"
|
||||
#include "treeBoundBoxList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -196,7 +197,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataCell>&,
|
||||
const point&
|
||||
@ -207,7 +208,7 @@ public:
|
||||
"treeDataCell::getVolumeType"
|
||||
"(const indexedOctree<treeDataCell>&, const point&)"
|
||||
);
|
||||
return -1;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
//- Does (bb of) shape at index overlap bb
|
||||
|
||||
79
src/OpenFOAM/algorithms/indexedOctree/volumeType.C
Normal file
79
src/OpenFOAM/algorithms/indexedOctree/volumeType.C
Normal file
@ -0,0 +1,79 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::volumeType,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"unknown",
|
||||
"mixed",
|
||||
"inside",
|
||||
"outside"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::volumeType, 4> Foam::volumeType::names;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::operator>>(Istream& is, volumeType& vt)
|
||||
{
|
||||
// Read beginning of volumeType
|
||||
is.readBegin("volumeType");
|
||||
|
||||
int type;
|
||||
is >> type;
|
||||
|
||||
vt.t_ = static_cast<volumeType::type>(type);
|
||||
|
||||
// Read end of volumeType
|
||||
is.readEnd("volumeType");
|
||||
|
||||
// Check state of Istream
|
||||
is.check("operator>>(Istream&, volumeType&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const volumeType& vt)
|
||||
{
|
||||
os << static_cast<int>(vt.t_);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
127
src/OpenFOAM/algorithms/indexedOctree/volumeType.H
Normal file
127
src/OpenFOAM/algorithms/indexedOctree/volumeType.H
Normal file
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::volumeType
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
volumeType.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef volumeType_H
|
||||
#define volumeType_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
class volumeType;
|
||||
Istream& operator>>(Istream& is, volumeType&);
|
||||
Ostream& operator<<(Ostream& os, const volumeType& C);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class volumeType Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class volumeType
|
||||
{
|
||||
public:
|
||||
|
||||
//- Volume types
|
||||
enum type
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1,
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Volume type
|
||||
type t_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static data
|
||||
|
||||
static const NamedEnum<volumeType, 4> names;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
volumeType()
|
||||
:
|
||||
t_(UNKNOWN)
|
||||
{}
|
||||
|
||||
//- Construct from components
|
||||
volumeType(type t)
|
||||
:
|
||||
t_(t)
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
operator type() const
|
||||
{
|
||||
return t_;
|
||||
}
|
||||
|
||||
|
||||
// IOstream operators
|
||||
|
||||
friend Istream& operator>>(Istream& is, volumeType& vt);
|
||||
friend Ostream& operator<<(Ostream& os, const volumeType& vt);
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with volumeType type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<volumeType>() {return true;}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "labelPair.H"
|
||||
#include "searchableSurfacesQueries.H"
|
||||
#include "UPtrList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -1302,7 +1303,7 @@ void Foam::refinementSurfaces::findInside
|
||||
|
||||
if (allGeometry_[surfaces_[surfI]].hasVolumeType())
|
||||
{
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
allGeometry_[surfaces_[surfI]].getVolumeType(pt, volType);
|
||||
|
||||
forAll(volType, pointI)
|
||||
@ -1312,11 +1313,11 @@ void Foam::refinementSurfaces::findInside
|
||||
if
|
||||
(
|
||||
(
|
||||
volType[pointI] == triSurfaceMesh::INSIDE
|
||||
volType[pointI] == volumeType::INSIDE
|
||||
&& zoneInside_[surfI] == INSIDE
|
||||
)
|
||||
|| (
|
||||
volType[pointI] == triSurfaceMesh::OUTSIDE
|
||||
volType[pointI] == volumeType::OUTSIDE
|
||||
&& zoneInside_[surfI] == OUTSIDE
|
||||
)
|
||||
)
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "searchableSurfaces.H"
|
||||
#include "orientedSurface.H"
|
||||
#include "pointIndexHit.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -329,7 +330,7 @@ void Foam::shellSurfaces::findHigherLevel
|
||||
candidateMap.setSize(candidateI);
|
||||
|
||||
// Do the expensive nearest test only for the candidate points.
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
allGeometry_[shells_[shellI]].getVolumeType(candidates, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
@ -340,11 +341,11 @@ void Foam::shellSurfaces::findHigherLevel
|
||||
(
|
||||
(
|
||||
modes_[shellI] == INSIDE
|
||||
&& volType[i] == searchableSurface::INSIDE
|
||||
&& volType[i] == volumeType::INSIDE
|
||||
)
|
||||
|| (
|
||||
modes_[shellI] == OUTSIDE
|
||||
&& volType[i] == searchableSurface::OUTSIDE
|
||||
&& volType[i] == volumeType::OUTSIDE
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
@ -132,13 +132,13 @@ Foam::pointField Foam::treeDataEdge::shapePoints() const
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::label Foam::treeDataEdge::getVolumeType
|
||||
Foam::volumeType Foam::treeDataEdge::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataEdge>& oc,
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
return indexedOctree<treeDataEdge>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "treeBoundBoxList.H"
|
||||
#include "linePointRef.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -197,7 +198,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataEdge>&,
|
||||
const point&
|
||||
|
||||
@ -180,7 +180,7 @@ Foam::pointField Foam::treeDataFace::shapePoints() const
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::label Foam::treeDataFace::getVolumeType
|
||||
Foam::volumeType Foam::treeDataFace::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataFace>& oc,
|
||||
const point& sample
|
||||
@ -433,7 +433,7 @@ Foam::label Foam::treeDataFace::getVolumeType
|
||||
// - tolerances are wrong. (if e.g. face has zero area)
|
||||
// - or (more likely) surface is not closed.
|
||||
|
||||
return indexedOctree<treeDataFace>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ SourceFiles
|
||||
#include "treeBoundBoxList.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -200,7 +201,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataFace>&,
|
||||
const point&
|
||||
|
||||
@ -92,13 +92,13 @@ Foam::pointField Foam::treeDataPoint::shapePoints() const
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
Foam::label Foam::treeDataPoint::getVolumeType
|
||||
Foam::volumeType Foam::treeDataPoint::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPoint>& oc,
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
return indexedOctree<treeDataPoint>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "pointField.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "linePointRef.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -172,7 +173,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPoint>&,
|
||||
const point&
|
||||
|
||||
@ -206,7 +206,7 @@ Foam::pointField Foam::treeDataPrimitivePatch<PatchType>::shapePoints() const
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
template<class PatchType>
|
||||
Foam::label Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
|
||||
Foam::volumeType Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch<PatchType> >& oc,
|
||||
const point& sample
|
||||
@ -436,7 +436,7 @@ Foam::label Foam::treeDataPrimitivePatch<PatchType>::getVolumeType
|
||||
// - tolerances are wrong. (if e.g. face has zero area)
|
||||
// - or (more likely) surface is not closed.
|
||||
|
||||
return indexedOctree<treeDataPrimitivePatch>::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ SourceFiles
|
||||
#define treeDataPrimitivePatch_H
|
||||
|
||||
#include "treeBoundBoxList.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -213,7 +214,7 @@ public:
|
||||
|
||||
//- Get type (inside,outside,mixed,unknown) of point w.r.t. surface.
|
||||
// Only makes sense for closed surfaces.
|
||||
label getVolumeType
|
||||
volumeType getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch<PatchType> >&,
|
||||
const point&
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::label Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
|
||||
Foam::volumeType Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc,
|
||||
const point& sample
|
||||
@ -60,21 +60,21 @@ Foam::label Foam::treeDataPrimitivePatch<Foam::triSurface>::getVolumeType
|
||||
|
||||
if (t == triSurfaceTools::UNKNOWN)
|
||||
{
|
||||
return indexedOctree<treeDataPrimitivePatch<triSurface> >::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
else if (t == triSurfaceTools::INSIDE)
|
||||
{
|
||||
return indexedOctree<treeDataPrimitivePatch<triSurface> >::INSIDE;
|
||||
return volumeType::INSIDE;
|
||||
}
|
||||
else if (t == triSurfaceTools::OUTSIDE)
|
||||
{
|
||||
return indexedOctree<treeDataPrimitivePatch<triSurface> >::OUTSIDE;
|
||||
return volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("treeDataPrimitivePatch<PatchType>::getVolumeType(..)")
|
||||
<< "problem" << abort(FatalError);
|
||||
return indexedOctree<treeDataPrimitivePatch<triSurface> >::UNKNOWN;
|
||||
return volumeType::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#include "triSurface.H"
|
||||
#include "point.H"
|
||||
#include "indexedOctree.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -48,7 +49,7 @@ namespace Foam
|
||||
|
||||
//- Template specialisation of getVolumeType for treeDataTriSurface
|
||||
template<>
|
||||
label treeDataPrimitivePatch<triSurface>::getVolumeType
|
||||
volumeType treeDataPrimitivePatch<triSurface>::getVolumeType
|
||||
(
|
||||
const indexedOctree<treeDataPrimitivePatch<triSurface> >& oc,
|
||||
const point& sample
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -947,9 +947,7 @@ Foam::List<Foam::pointIndexHit> Foam::meshSearch::intersections
|
||||
|
||||
bool Foam::meshSearch::isInside(const point& p) const
|
||||
{
|
||||
return
|
||||
boundaryTree().getVolumeType(p)
|
||||
== indexedOctree<treeDataFace>::INSIDE;
|
||||
return (boundaryTree().getVolumeType(p) == volumeType::INSIDE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -583,7 +583,7 @@ void Foam::searchableBox::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = INSIDE;
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
forAll(points, pointI)
|
||||
{
|
||||
@ -593,7 +593,7 @@ void Foam::searchableBox::getVolumeType
|
||||
{
|
||||
if (pt[dir] < min()[dir] || pt[dir] > max()[dir])
|
||||
{
|
||||
volType[pointI] = OUTSIDE;
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -673,7 +673,7 @@ void Foam::searchableCylinder::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = INSIDE;
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
forAll(points, pointI)
|
||||
{
|
||||
@ -687,12 +687,12 @@ void Foam::searchableCylinder::getVolumeType
|
||||
if (parallel < 0)
|
||||
{
|
||||
// left of point1 endcap
|
||||
volType[pointI] = OUTSIDE;
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
else if (parallel > magDir_)
|
||||
{
|
||||
// right of point2 endcap
|
||||
volType[pointI] = OUTSIDE;
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -701,11 +701,11 @@ void Foam::searchableCylinder::getVolumeType
|
||||
|
||||
if (mag(v) > radius_)
|
||||
{
|
||||
volType[pointI] = OUTSIDE;
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volType[pointI] = INSIDE;
|
||||
volType[pointI] = volumeType::INSIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -334,7 +334,7 @@ void Foam::searchableSphere::getVolumeType
|
||||
) const
|
||||
{
|
||||
volType.setSize(points.size());
|
||||
volType = INSIDE;
|
||||
volType = volumeType::INSIDE;
|
||||
|
||||
forAll(points, pointI)
|
||||
{
|
||||
@ -342,11 +342,11 @@ void Foam::searchableSphere::getVolumeType
|
||||
|
||||
if (magSqr(pt - centre_) <= sqr(radius_))
|
||||
{
|
||||
volType[pointI] = INSIDE;
|
||||
volType[pointI] = volumeType::INSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
volType[pointI] = OUTSIDE;
|
||||
volType[pointI] = volumeType::OUTSIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,26 +30,12 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(searchableSurface, 0);
|
||||
defineRunTimeSelectionTable(searchableSurface, dict);
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::searchableSurface::volumeType,
|
||||
4
|
||||
>::names[] =
|
||||
{
|
||||
"unknown",
|
||||
"mixed",
|
||||
"inside",
|
||||
"outside"
|
||||
};
|
||||
defineTypeNameAndDebug(searchableSurface, 0);
|
||||
defineRunTimeSelectionTable(searchableSurface, dict);
|
||||
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::searchableSurface::volumeType, 4>
|
||||
Foam::searchableSurface::volumeTypeNames;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ SourceFiles
|
||||
#include "pointIndexHit.H"
|
||||
#include "linePointRef.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -67,25 +68,6 @@ class searchableSurface
|
||||
:
|
||||
public regIOobject
|
||||
{
|
||||
public:
|
||||
|
||||
// Data types
|
||||
|
||||
//- Volume types
|
||||
enum volumeType
|
||||
{
|
||||
UNKNOWN = 0,
|
||||
MIXED = 1, // not used. only here to maintain consistency with
|
||||
// indexedOctree volumeType.
|
||||
INSIDE = 2,
|
||||
OUTSIDE = 3
|
||||
};
|
||||
|
||||
static const NamedEnum<volumeType, 4> volumeTypeNames;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
const word name_;
|
||||
|
||||
@ -735,7 +735,7 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
const searchableSurface::volumeType illegalHandling,
|
||||
const volumeType illegalHandling,
|
||||
labelList& nearestSurfaces,
|
||||
scalarField& distance
|
||||
)
|
||||
@ -775,7 +775,7 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
}
|
||||
|
||||
// Calculate sideness of these surface points
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
allSurfaces[surfacesToTest[testI]].getVolumeType(surfPoints, volType);
|
||||
|
||||
// Push back to original
|
||||
@ -784,13 +784,13 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
label pointI = surfIndices[i];
|
||||
scalar dist = mag(samples[pointI] - nearestInfo[pointI].hitPoint());
|
||||
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
volumeType vT = volType[i];
|
||||
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
if (vT == volumeType::OUTSIDE)
|
||||
{
|
||||
distance[pointI] = dist;
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
else if (vT == volumeType::INSIDE)
|
||||
{
|
||||
distance[i] = -dist;
|
||||
}
|
||||
@ -798,12 +798,12 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
{
|
||||
switch (illegalHandling)
|
||||
{
|
||||
case searchableSurface::OUTSIDE:
|
||||
case volumeType::OUTSIDE:
|
||||
{
|
||||
distance[pointI] = dist;
|
||||
break;
|
||||
}
|
||||
case searchableSurface::INSIDE:
|
||||
case volumeType::INSIDE:
|
||||
{
|
||||
distance[pointI] = -dist;
|
||||
break;
|
||||
@ -817,7 +817,7 @@ void Foam::searchableSurfacesQueries::signedDistance
|
||||
<< " surface:"
|
||||
<< allSurfaces[surfacesToTest[testI]].name()
|
||||
<< " volType:"
|
||||
<< searchableSurface::volumeTypeNames[vT]
|
||||
<< volumeType::names[vT]
|
||||
<< exit(FatalError);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public:
|
||||
const labelList& surfacesToTest,
|
||||
const pointField& samples,
|
||||
const scalarField& nearestDistSqr,
|
||||
const searchableSurface::volumeType illegalHandling,
|
||||
const volumeType illegalHandling,
|
||||
labelList& nearestSurfaces,
|
||||
scalarField& distance
|
||||
);
|
||||
|
||||
@ -740,7 +740,7 @@ void Foam::triSurfaceMesh::getVolumeType
|
||||
|
||||
// - use cached volume type per each tree node
|
||||
// - cheat conversion since same values
|
||||
volType[pointI] = static_cast<volumeType>(tree().getVolumeType(pt));
|
||||
volType[pointI] = tree().getVolumeType(pt);
|
||||
}
|
||||
|
||||
indexedOctree<treeDataTriSurface>::perturbTol() = oldTol;
|
||||
|
||||
@ -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-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "volPointInterpolation.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volumeType.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,19 +95,19 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
|
||||
surfPtr_().getVolumeType(cc, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
volumeType vT = volType[i];
|
||||
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
if (vT == volumeType::OUTSIDE)
|
||||
{
|
||||
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
else if (vT == volumeType::INSIDE)
|
||||
{
|
||||
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
@ -146,19 +147,19 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
|
||||
surfPtr_().getVolumeType(cc, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
volumeType vT = volType[i];
|
||||
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
if (vT == volumeType::OUTSIDE)
|
||||
{
|
||||
fld[i] = Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
else if (vT == volumeType::INSIDE)
|
||||
{
|
||||
fld[i] = -Foam::mag(cc[i] - nearest[i].hitPoint());
|
||||
}
|
||||
@ -203,20 +204,20 @@ void Foam::distanceSurface::createGeometry()
|
||||
|
||||
if (signed_)
|
||||
{
|
||||
List<searchableSurface::volumeType> volType;
|
||||
List<volumeType> volType;
|
||||
|
||||
surfPtr_().getVolumeType(pts, volType);
|
||||
|
||||
forAll(volType, i)
|
||||
{
|
||||
searchableSurface::volumeType vT = volType[i];
|
||||
volumeType vT = volType[i];
|
||||
|
||||
if (vT == searchableSurface::OUTSIDE)
|
||||
if (vT == volumeType::OUTSIDE)
|
||||
{
|
||||
pointDistance_[i] =
|
||||
Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||
}
|
||||
else if (vT == searchableSurface::INSIDE)
|
||||
else if (vT == volumeType::INSIDE)
|
||||
{
|
||||
pointDistance_[i] =
|
||||
-Foam::mag(pts[i] - nearest[i].hitPoint());
|
||||
|
||||
Reference in New Issue
Block a user