mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'cvMesh'
This commit is contained in:
@ -0,0 +1,3 @@
|
|||||||
|
checkCvMesh.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_APPBIN)/checkCvMesh
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/autoMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume \
|
||||||
|
-ldynamicMesh \
|
||||||
|
-ltriSurface \
|
||||||
|
-lautoMesh \
|
||||||
|
-lmeshTools
|
||||||
|
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 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/>.
|
||||||
|
|
||||||
|
Application
|
||||||
|
checkCvMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "autoSnapDriver.H"
|
||||||
|
#include "faceSet.H"
|
||||||
|
#include "motionSmoother.H"
|
||||||
|
#include "timeSelector.H"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
# include "addOverwriteOption.H"
|
||||||
|
|
||||||
|
# include "setRootCase.H"
|
||||||
|
# include "createTime.H"
|
||||||
|
|
||||||
|
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||||
|
|
||||||
|
# include "createMesh.H"
|
||||||
|
|
||||||
|
runTime.functionObjects().off();
|
||||||
|
|
||||||
|
forAll(timeDirs, timeI)
|
||||||
|
{
|
||||||
|
runTime.setTime(timeDirs[timeI], timeI);
|
||||||
|
|
||||||
|
Info<< "Create mesh for time = " << runTime.timeName()
|
||||||
|
<< nl << endl;
|
||||||
|
|
||||||
|
mesh.readUpdate();
|
||||||
|
|
||||||
|
Info<< "Read mesh in = "
|
||||||
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
|
|
||||||
|
// Check patches and faceZones are synchronised
|
||||||
|
mesh.boundaryMesh().checkParallelSync(true);
|
||||||
|
meshRefinement::checkCoupledFaceZones(mesh);
|
||||||
|
|
||||||
|
// Read meshing dictionary
|
||||||
|
IOdictionary cvMeshDict
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"cvMeshDict",
|
||||||
|
runTime.system(),
|
||||||
|
mesh,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// mesh motion and mesh quality parameters
|
||||||
|
const dictionary& meshQualityDict
|
||||||
|
= cvMeshDict.subDict("meshQualityControls");
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Checking initial mesh ..." << endl;
|
||||||
|
faceSet wrongFaces(mesh, "wrongFaces", mesh.nFaces()/100);
|
||||||
|
motionSmoother::checkMesh(false, mesh, meshQualityDict, wrongFaces);
|
||||||
|
|
||||||
|
const label nInitErrors = returnReduce
|
||||||
|
(
|
||||||
|
wrongFaces.size(),
|
||||||
|
sumOp<label>()
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Detected " << nInitErrors << " illegal faces"
|
||||||
|
<< " (concave, zero area or negative cell pyramid volume)"
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
if (nInitErrors > 0)
|
||||||
|
{
|
||||||
|
Info<< "Writing " << nInitErrors
|
||||||
|
<< " faces in error to set "
|
||||||
|
<< wrongFaces.name() << endl;
|
||||||
|
|
||||||
|
wrongFaces.instance() = mesh.pointsInstance();
|
||||||
|
wrongFaces.write();
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl << "End of time " << runTime.timeName() << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -724,6 +724,8 @@ void Foam::backgroundMeshDecomposition::buildPatchAndTree()
|
|||||||
|
|
||||||
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
|
globalBackgroundBounds_ = treeBoundBox(bbMin, bbMax);
|
||||||
|
|
||||||
|
octreeNearestDistances_ = bFTreePtr_().calcNearestDistance();
|
||||||
|
|
||||||
if (cvMesh_.cvMeshControls().objOutput())
|
if (cvMesh_.cvMeshControls().objOutput())
|
||||||
{
|
{
|
||||||
OFstream fStr
|
OFstream fStr
|
||||||
@ -795,6 +797,7 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
|
|||||||
),
|
),
|
||||||
boundaryFacesPtr_(),
|
boundaryFacesPtr_(),
|
||||||
bFTreePtr_(),
|
bFTreePtr_(),
|
||||||
|
octreeNearestDistances_(),
|
||||||
allBackgroundMeshBounds_(Pstream::nProcs()),
|
allBackgroundMeshBounds_(Pstream::nProcs()),
|
||||||
globalBackgroundBounds_(),
|
globalBackgroundBounds_(),
|
||||||
decomposeDict_
|
decomposeDict_
|
||||||
@ -1150,6 +1153,8 @@ bool Foam::backgroundMeshDecomposition::positionOnThisProcessor
|
|||||||
const point& pt
|
const point& pt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
// return bFTreePtr_().findAnyOverlap(pt, 0.0);
|
||||||
|
|
||||||
return
|
return
|
||||||
bFTreePtr_().getVolumeType(pt)
|
bFTreePtr_().getVolumeType(pt)
|
||||||
== indexedOctree<treeDataBPatch>::INSIDE;
|
== indexedOctree<treeDataBPatch>::INSIDE;
|
||||||
@ -1176,6 +1181,7 @@ bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
|||||||
const treeBoundBox& box
|
const treeBoundBox& box
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
// return !procBounds().contains(box);
|
||||||
return !bFTreePtr_().findBox(box).empty();
|
return !bFTreePtr_().findBox(box).empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,9 +1189,11 @@ bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
|||||||
bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
bool Foam::backgroundMeshDecomposition::overlapsThisProcessor
|
||||||
(
|
(
|
||||||
const point& centre,
|
const point& centre,
|
||||||
scalar radiusSqr
|
const scalar radiusSqr
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
//return bFTreePtr_().findAnyOverlap(centre, radiusSqr);
|
||||||
|
|
||||||
return bFTreePtr_().findNearest(centre, radiusSqr).hit();
|
return bFTreePtr_().findNearest(centre, radiusSqr).hit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1645,6 +1653,7 @@ Foam::labelListList Foam::backgroundMeshDecomposition::overlapsProcessors
|
|||||||
|
|
||||||
// If the sphere finds a nearest element of the patch, then it overlaps
|
// If the sphere finds a nearest element of the patch, then it overlaps
|
||||||
sphereOverlapsCandidate[sI] = bFTreePtr_().findNearest(c, rSqr).hit();
|
sphereOverlapsCandidate[sI] = bFTreePtr_().findNearest(c, rSqr).hit();
|
||||||
|
//sphereOverlapsCandidate[sI] = bFTreePtr_().findAnyOverlap(c, rSqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
map().reverseDistribute
|
map().reverseDistribute
|
||||||
|
|||||||
@ -111,6 +111,8 @@ class backgroundMeshDecomposition
|
|||||||
//- Search tree for the boundaryFaces_ patch
|
//- Search tree for the boundaryFaces_ patch
|
||||||
autoPtr<indexedOctree<treeDataBPatch> > bFTreePtr_;
|
autoPtr<indexedOctree<treeDataBPatch> > bFTreePtr_;
|
||||||
|
|
||||||
|
List<scalar> octreeNearestDistances_;
|
||||||
|
|
||||||
//- The bounds of all background meshes on all processors
|
//- The bounds of all background meshes on all processors
|
||||||
treeBoundBoxList allBackgroundMeshBounds_;
|
treeBoundBoxList allBackgroundMeshBounds_;
|
||||||
|
|
||||||
@ -225,16 +227,16 @@ public:
|
|||||||
//- Are the given positions inside the domain of this decomposition
|
//- Are the given positions inside the domain of this decomposition
|
||||||
boolList positionOnThisProcessor(const List<point>& pts) const;
|
boolList positionOnThisProcessor(const List<point>& pts) const;
|
||||||
|
|
||||||
//- Does the given box overlap the faces of the bounday of this
|
//- Does the given box overlap the faces of the boundary of this
|
||||||
// processor
|
// processor
|
||||||
bool overlapsThisProcessor(const treeBoundBox& box) const;
|
bool overlapsThisProcessor(const treeBoundBox& box) const;
|
||||||
|
|
||||||
//- Does the given sphere overlap the faces of the bounday of this
|
//- Does the given sphere overlap the faces of the boundary of this
|
||||||
// processor
|
// processor
|
||||||
bool overlapsThisProcessor
|
bool overlapsThisProcessor
|
||||||
(
|
(
|
||||||
const point& centre,
|
const point& centre,
|
||||||
scalar radiusSqr
|
const scalar radiusSqr
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find nearest intersection of line between start and end, (exposing
|
//- Find nearest intersection of line between start and end, (exposing
|
||||||
@ -289,6 +291,12 @@ public:
|
|||||||
//- Return access to the underlying mesh
|
//- Return access to the underlying mesh
|
||||||
inline const fvMesh& mesh() const;
|
inline const fvMesh& mesh() const;
|
||||||
|
|
||||||
|
//- Return access to the underlying tree
|
||||||
|
inline const indexedOctree<treeDataBPatch>& tree() const;
|
||||||
|
|
||||||
|
//- Return access to the nearest distance of the octree nodes
|
||||||
|
inline const List<scalar>& octreeNearestDistances() const;
|
||||||
|
|
||||||
//- Return the boundBox of this processor
|
//- Return the boundBox of this processor
|
||||||
inline const treeBoundBox& procBounds() const;
|
inline const treeBoundBox& procBounds() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -30,6 +30,18 @@ const Foam::fvMesh& Foam::backgroundMeshDecomposition::mesh() const
|
|||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Foam::indexedOctree<Foam::treeDataBPatch>&
|
||||||
|
Foam::backgroundMeshDecomposition::tree() const
|
||||||
|
{
|
||||||
|
return bFTreePtr_();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Foam::List<Foam::scalar>&
|
||||||
|
Foam::backgroundMeshDecomposition::octreeNearestDistances() const
|
||||||
|
{
|
||||||
|
return octreeNearestDistances_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::treeBoundBox& Foam::backgroundMeshDecomposition::procBounds() const
|
const Foam::treeBoundBox& Foam::backgroundMeshDecomposition::procBounds() const
|
||||||
{
|
{
|
||||||
|
|||||||
@ -240,9 +240,9 @@ void Foam::conformalVoronoiMesh::insertPoints
|
|||||||
{
|
{
|
||||||
label preDistributionSize(points.size());
|
label preDistributionSize(points.size());
|
||||||
|
|
||||||
DynamicList<Foam::point> transferPoints(points.size()/2);
|
DynamicList<Foam::point> transferPoints;
|
||||||
|
|
||||||
DynamicList<Point> pointsOnProcessor(points.size()/2);
|
DynamicList<Point> pointsOnProcessor;
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -277,12 +277,16 @@ void Foam::conformalVoronoiMesh::insertPoints
|
|||||||
decomposition_().distributePoints(transferPoints)
|
decomposition_().distributePoints(transferPoints)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const label oldSize = points.size();
|
||||||
|
|
||||||
|
points.setSize(oldSize + transferPoints.size());
|
||||||
|
|
||||||
forAll(transferPoints, tPI)
|
forAll(transferPoints, tPI)
|
||||||
{
|
{
|
||||||
points.append(toPoint(transferPoints[tPI]));
|
points[tPI + oldSize] = toPoint(transferPoints[tPI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
label sizeChange = preDistributionSize - label(points.size());
|
label sizeChange = preDistributionSize - points.size();
|
||||||
|
|
||||||
// if (mag(sizeChange) > 0)
|
// if (mag(sizeChange) > 0)
|
||||||
// {
|
// {
|
||||||
@ -417,7 +421,6 @@ void Foam::conformalVoronoiMesh::insertPoints
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
rangeInsertWithInfo
|
rangeInsertWithInfo
|
||||||
(
|
(
|
||||||
pts.begin(),
|
pts.begin(),
|
||||||
@ -1246,6 +1249,8 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
|||||||
// better balance the surface conformation load.
|
// better balance the surface conformation load.
|
||||||
distributeBackground();
|
distributeBackground();
|
||||||
|
|
||||||
|
// conformToSurface();
|
||||||
|
|
||||||
buildSurfaceConformation(rmCoarse);
|
buildSurfaceConformation(rmCoarse);
|
||||||
|
|
||||||
// The introduction of the surface conformation may have distorted the
|
// The introduction of the surface conformation may have distorted the
|
||||||
@ -1313,7 +1318,7 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
{
|
{
|
||||||
cit->cellIndex() = dualVertI;
|
cit->cellIndex() = dualVertI;
|
||||||
|
|
||||||
dualVertices[dualVertI] = topoint(dual(cit));
|
dualVertices[dualVertI] = cit->dual();
|
||||||
|
|
||||||
dualVertI++;
|
dualVertI++;
|
||||||
}
|
}
|
||||||
@ -1511,7 +1516,6 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
(
|
(
|
||||||
toPoint(0.5*(dVA + dVB))
|
toPoint(0.5*(dVA + dVB))
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
@ -1671,9 +1675,57 @@ void Foam::conformalVoronoiMesh::move()
|
|||||||
|
|
||||||
insertPoints(pointsToInsert);
|
insertPoints(pointsToInsert);
|
||||||
|
|
||||||
|
// Remove internal points that have been inserted outside the surface.
|
||||||
|
label internalPtIsOutside = 0;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||||
|
vit != finite_vertices_end();
|
||||||
|
++vit
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (vit->internalPoint())
|
||||||
|
{
|
||||||
|
bool inside
|
||||||
|
= geometryToConformTo_.inside(topoint(vit->point()));
|
||||||
|
|
||||||
|
if (!inside)
|
||||||
|
{
|
||||||
|
remove(vit);
|
||||||
|
internalPtIsOutside++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " " << internalPtIsOutside
|
||||||
|
<< " internal points were inserted outside the domain. "
|
||||||
|
<< "They have been removed." << endl;
|
||||||
|
|
||||||
|
// Fix points that have not been significantly displaced
|
||||||
|
// for
|
||||||
|
// (
|
||||||
|
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||||
|
// vit != finite_vertices_end();
|
||||||
|
// ++vit
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// if (vit->internalPoint())
|
||||||
|
// {
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// mag(displacementAccumulator[vit->index()])
|
||||||
|
// < 0.1*targetCellSize(topoint(vit->point()))
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// vit->setVertexFixed();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (cvMeshControls().objOutput() && runTime_.outputTime())
|
if (cvMeshControls().objOutput() && runTime_.outputTime())
|
||||||
{
|
{
|
||||||
writePoints("points_" + runTime_.timeName() + ".obj", false);
|
writePoints("points_" + runTime_.timeName() + ".obj", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeCheck("Internal points inserted");
|
timeCheck("Internal points inserted");
|
||||||
|
|||||||
@ -48,7 +48,6 @@ SourceFiles
|
|||||||
#define CGAL_INEXACT
|
#define CGAL_INEXACT
|
||||||
|
|
||||||
#include "CGALTriangulation3Ddefs.H"
|
#include "CGALTriangulation3Ddefs.H"
|
||||||
#include <CGAL/Spatial_sort_traits_adapter_3.h>
|
|
||||||
#include "uint.H"
|
#include "uint.H"
|
||||||
#include "ulong.H"
|
#include "ulong.H"
|
||||||
#include "searchableSurfaces.H"
|
#include "searchableSurfaces.H"
|
||||||
@ -595,6 +594,12 @@ private:
|
|||||||
Foam::point& b
|
Foam::point& b
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
label removeProcessorBoundarySeeds(bool reinsertBoundPts);
|
||||||
|
|
||||||
|
void seedProcessorBoundarySurfaces(bool seedProcessors);
|
||||||
|
|
||||||
|
label numberOfUnusedReferredPoints() const;
|
||||||
|
|
||||||
//- Build the parallelInterfaces of the mesh
|
//- Build the parallelInterfaces of the mesh
|
||||||
void buildParallelInterface
|
void buildParallelInterface
|
||||||
(
|
(
|
||||||
@ -1240,7 +1245,7 @@ public:
|
|||||||
Traits_for_spatial_sort<Triangulation>()
|
Traits_for_spatial_sort<Triangulation>()
|
||||||
);
|
);
|
||||||
|
|
||||||
typename Triangulation::Cell_handle hint;
|
typename Triangulation::Vertex_handle hint;
|
||||||
|
|
||||||
for
|
for
|
||||||
(
|
(
|
||||||
@ -1250,16 +1255,9 @@ public:
|
|||||||
++p
|
++p
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
typename Triangulation::Locate_type lt;
|
|
||||||
typename Triangulation::Cell_handle c;
|
|
||||||
label li, lj;
|
|
||||||
|
|
||||||
c = T.locate(*(p->first), lt, li, lj, hint);
|
|
||||||
|
|
||||||
const size_t checkInsertion = T.number_of_vertices();
|
const size_t checkInsertion = T.number_of_vertices();
|
||||||
|
|
||||||
typename Triangulation::Vertex_handle v
|
hint = T.insert(*(p->first), hint);
|
||||||
= T.insert(*(p->first), lt, c, li, lj);
|
|
||||||
|
|
||||||
if (checkInsertion != T.number_of_vertices() - 1)
|
if (checkInsertion != T.number_of_vertices() - 1)
|
||||||
{
|
{
|
||||||
@ -1278,12 +1276,11 @@ public:
|
|||||||
// type directly (note that this routine never gets
|
// type directly (note that this routine never gets
|
||||||
// called for referredPoints so type will never be
|
// called for referredPoints so type will never be
|
||||||
// -procI
|
// -procI
|
||||||
type += T.number_of_vertices() - 1;
|
type += checkInsertion;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->index() = indices[oldIndex]
|
hint->index() = indices[oldIndex] + checkInsertion;
|
||||||
+ T.number_of_vertices() - 1;
|
hint->type() = type;
|
||||||
v->type() = type;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1890,7 +1890,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
|||||||
{
|
{
|
||||||
cit->cellIndex() = dualVertI;
|
cit->cellIndex() = dualVertI;
|
||||||
|
|
||||||
pts[dualVertI] = topoint(dual(cit));
|
pts[dualVertI] = cit->dual();
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -125,7 +125,7 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
|
|||||||
os << "# cell index: " << label(c->cellIndex()) << endl;
|
os << "# cell index: " << label(c->cellIndex()) << endl;
|
||||||
|
|
||||||
os << "# circumradius "
|
os << "# circumradius "
|
||||||
<< mag(topoint(dual(c)) - topoint(c->vertex(0)->point()))
|
<< mag(c->dual() - topoint(c->vertex(0)->point()))
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
@ -144,7 +144,7 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
|
|||||||
|
|
||||||
os << "# cicumcentre " << endl;
|
os << "# cicumcentre " << endl;
|
||||||
|
|
||||||
meshTools::writeOBJ(os, topoint(dual(c)));
|
meshTools::writeOBJ(os, c->dual());
|
||||||
|
|
||||||
os << "l " << 1 + offset << " " << 5 + offset << endl;
|
os << "l " << 1 + offset << " " << 5 + offset << endl;
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ void Foam::conformalVoronoiMesh::writePoints
|
|||||||
++vit
|
++vit
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!internalOnly || vit->internalOrBoundaryPoint())
|
if (!internalOnly || vit->internalPoint())
|
||||||
{
|
{
|
||||||
meshTools::writeOBJ(str, topoint(vit->point()));
|
meshTools::writeOBJ(str, topoint(vit->point()));
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ void Foam::conformalVoronoiMesh::writeProcessorInterface
|
|||||||
{
|
{
|
||||||
if (!cit->farCell())
|
if (!cit->farCell())
|
||||||
{
|
{
|
||||||
points[cit->cellIndex()] = topoint(dual(cit));
|
points[cit->cellIndex()] = cit->dual();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,7 @@ SourceFiles
|
|||||||
#include "Swap.H"
|
#include "Swap.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
#include "tetCell.H"
|
#include "tetCell.H"
|
||||||
|
#include "typeInfo.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -154,6 +155,8 @@ public:
|
|||||||
|
|
||||||
inline int cellIndex() const;
|
inline int cellIndex() const;
|
||||||
|
|
||||||
|
inline const Foam::point& dual();
|
||||||
|
|
||||||
inline bool farCell() const;
|
inline bool farCell() const;
|
||||||
|
|
||||||
inline int& filterCount();
|
inline int& filterCount();
|
||||||
@ -163,6 +166,11 @@ public:
|
|||||||
//- Is the Delaunay cell real, i.e. any real vertex
|
//- Is the Delaunay cell real, i.e. any real vertex
|
||||||
inline bool real() const;
|
inline bool real() const;
|
||||||
|
|
||||||
|
//- Does the Delaunay cell have a far point
|
||||||
|
inline bool hasFarPoint() const;
|
||||||
|
|
||||||
|
inline bool hasInternalPoint() const;
|
||||||
|
|
||||||
//- Does the Dual vertex form part of a processor patch
|
//- Does the Dual vertex form part of a processor patch
|
||||||
inline bool parallelDualVertex() const;
|
inline bool parallelDualVertex() const;
|
||||||
|
|
||||||
@ -190,6 +198,8 @@ public:
|
|||||||
// least one Delaunay vertex outside and at least one inside
|
// least one Delaunay vertex outside and at least one inside
|
||||||
inline bool boundaryDualVertex() const;
|
inline bool boundaryDualVertex() const;
|
||||||
|
|
||||||
|
inline bool nearProcBoundary() const;
|
||||||
|
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
|
|
||||||
|
|||||||
@ -86,6 +86,24 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Cb>
|
||||||
|
const Foam::point& CGAL::indexedCell<Gt, Cb>::dual()
|
||||||
|
{
|
||||||
|
#ifdef CGAL_INEXACT
|
||||||
|
return reinterpret_cast<const Foam::point&>(this->circumcenter());
|
||||||
|
#else
|
||||||
|
const typename Gt::Point_3& P = this->circumcenter();
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
CGAL::to_double(P.x()),
|
||||||
|
CGAL::to_double(P.y()),
|
||||||
|
CGAL::to_double(P.z())
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Gt, class Cb>
|
template<class Gt, class Cb>
|
||||||
inline bool CGAL::indexedCell<Gt, Cb>::farCell() const
|
inline bool CGAL::indexedCell<Gt, Cb>::farCell() const
|
||||||
{
|
{
|
||||||
@ -112,10 +130,45 @@ inline bool CGAL::indexedCell<Gt, Cb>::real() const
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
this->vertex(0)->real()
|
(
|
||||||
|| this->vertex(1)->real()
|
this->vertex(0)->real()
|
||||||
|| this->vertex(2)->real()
|
|| this->vertex(1)->real()
|
||||||
|| this->vertex(3)->real()
|
|| this->vertex(2)->real()
|
||||||
|
|| this->vertex(3)->real()
|
||||||
|
)
|
||||||
|
&&
|
||||||
|
!(
|
||||||
|
this->vertex(0)->farPoint()
|
||||||
|
|| this->vertex(1)->farPoint()
|
||||||
|
|| this->vertex(2)->farPoint()
|
||||||
|
|| this->vertex(3)->farPoint()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Cb>
|
||||||
|
inline bool CGAL::indexedCell<Gt, Cb>::hasFarPoint() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this->vertex(0)->farPoint()
|
||||||
|
|| this->vertex(1)->farPoint()
|
||||||
|
|| this->vertex(2)->farPoint()
|
||||||
|
|| this->vertex(3)->farPoint()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Cb>
|
||||||
|
inline bool CGAL::indexedCell<Gt, Cb>::hasInternalPoint() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this->vertex(0)->internalPoint()
|
||||||
|
|| this->vertex(1)->internalPoint()
|
||||||
|
|| this->vertex(2)->internalPoint()
|
||||||
|
|| this->vertex(3)->internalPoint()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,4 +338,17 @@ inline bool CGAL::indexedCell<Gt, Cb>::boundaryDualVertex() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Cb>
|
||||||
|
inline bool CGAL::indexedCell<Gt, Cb>::nearProcBoundary() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this->vertex(0)->nearProcBoundary()
|
||||||
|
|| this->vertex(1)->nearProcBoundary()
|
||||||
|
|| this->vertex(2)->nearProcBoundary()
|
||||||
|
|| this->vertex(3)->nearProcBoundary()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -29,7 +29,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "indexedVertex.H"
|
#include "indexedVertex.H"
|
||||||
//#include "conformalVoronoiMesh.H"
|
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * //
|
||||||
|
|||||||
@ -45,6 +45,7 @@ SourceFiles
|
|||||||
#include <CGAL/Triangulation_3.h>
|
#include <CGAL/Triangulation_3.h>
|
||||||
#include "tensor.H"
|
#include "tensor.H"
|
||||||
#include "InfoProxy.H"
|
#include "InfoProxy.H"
|
||||||
|
#include "point.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -101,6 +102,8 @@ class indexedVertex
|
|||||||
//- Specify whether the vertex is fixed or movable.
|
//- Specify whether the vertex is fixed or movable.
|
||||||
bool vertexFixed_;
|
bool vertexFixed_;
|
||||||
|
|
||||||
|
bool nearProcBoundary_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -198,6 +201,12 @@ public:
|
|||||||
//- Set the point to be near the boundary
|
//- Set the point to be near the boundary
|
||||||
inline void setNearBoundary();
|
inline void setNearBoundary();
|
||||||
|
|
||||||
|
//- Is point internal and near a proc boundary
|
||||||
|
inline bool nearProcBoundary() const;
|
||||||
|
|
||||||
|
//- Set the point to be near a proc boundary
|
||||||
|
inline void setNearProcBoundary();
|
||||||
|
|
||||||
//- Either master or slave of pointPair.
|
//- Either master or slave of pointPair.
|
||||||
inline bool pairPoint() const;
|
inline bool pairPoint() const;
|
||||||
|
|
||||||
@ -227,7 +236,7 @@ public:
|
|||||||
inline bool isVertexFixed() const;
|
inline bool isVertexFixed() const;
|
||||||
|
|
||||||
//- Fix the vertex so that it can't be moved
|
//- Fix the vertex so that it can't be moved
|
||||||
inline void setVertexFixed() const;
|
inline void setVertexFixed();
|
||||||
|
|
||||||
// inline void operator=(const Delaunay::Finite_vertices_iterator vit)
|
// inline void operator=(const Delaunay::Finite_vertices_iterator vit)
|
||||||
// {
|
// {
|
||||||
|
|||||||
@ -38,7 +38,8 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex()
|
|||||||
type_(vtInternal),
|
type_(vtInternal),
|
||||||
alignment_(),
|
alignment_(),
|
||||||
targetCellSize_(0.0),
|
targetCellSize_(0.0),
|
||||||
vertexFixed_(false)
|
vertexFixed_(false),
|
||||||
|
nearProcBoundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +51,8 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p)
|
|||||||
type_(vtInternal),
|
type_(vtInternal),
|
||||||
alignment_(),
|
alignment_(),
|
||||||
targetCellSize_(0.0),
|
targetCellSize_(0.0),
|
||||||
vertexFixed_(false)
|
vertexFixed_(false),
|
||||||
|
nearProcBoundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -67,7 +69,8 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex
|
|||||||
type_(type),
|
type_(type),
|
||||||
alignment_(),
|
alignment_(),
|
||||||
targetCellSize_(0.0),
|
targetCellSize_(0.0),
|
||||||
vertexFixed_(false)
|
vertexFixed_(false),
|
||||||
|
nearProcBoundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -79,7 +82,8 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p, Cell_handle f)
|
|||||||
type_(vtInternal),
|
type_(vtInternal),
|
||||||
alignment_(),
|
alignment_(),
|
||||||
targetCellSize_(0.0),
|
targetCellSize_(0.0),
|
||||||
vertexFixed_(false)
|
vertexFixed_(false),
|
||||||
|
nearProcBoundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +95,8 @@ inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(Cell_handle f)
|
|||||||
type_(vtInternal),
|
type_(vtInternal),
|
||||||
alignment_(),
|
alignment_(),
|
||||||
targetCellSize_(0.0),
|
targetCellSize_(0.0),
|
||||||
vertexFixed_(false)
|
vertexFixed_(false),
|
||||||
|
nearProcBoundary_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -251,6 +256,20 @@ inline void CGAL::indexedVertex<Gt, Vb>::setNearBoundary()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Vb>
|
||||||
|
inline bool CGAL::indexedVertex<Gt, Vb>::nearProcBoundary() const
|
||||||
|
{
|
||||||
|
return nearProcBoundary_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Gt, class Vb>
|
||||||
|
inline void CGAL::indexedVertex<Gt, Vb>::setNearProcBoundary()
|
||||||
|
{
|
||||||
|
nearProcBoundary_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Gt, class Vb>
|
template<class Gt, class Vb>
|
||||||
inline bool CGAL::indexedVertex<Gt, Vb>::pairPoint() const
|
inline bool CGAL::indexedVertex<Gt, Vb>::pairPoint() const
|
||||||
{
|
{
|
||||||
@ -331,7 +350,7 @@ inline bool CGAL::indexedVertex<Gt, Vb>::isVertexFixed() const
|
|||||||
|
|
||||||
|
|
||||||
template<class Gt, class Vb>
|
template<class Gt, class Vb>
|
||||||
inline void CGAL::indexedVertex<Gt, Vb>::setVertexFixed() const
|
inline void CGAL::indexedVertex<Gt, Vb>::setVertexFixed()
|
||||||
{
|
{
|
||||||
vertexFixed_ = true;
|
vertexFixed_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -285,7 +285,9 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Find the nearest points on each feature edge that is within
|
//- Find the nearest points on each feature edge that is within
|
||||||
// a given distance from the sample point
|
// a given distance from the sample point. Will need to check for
|
||||||
|
// a hit or a miss because near edges may not have a nearest point
|
||||||
|
// on them which is perpendicular to the sample point.
|
||||||
void findAllNearestEdges
|
void findAllNearestEdges
|
||||||
(
|
(
|
||||||
const point& sample,
|
const point& sample,
|
||||||
|
|||||||
@ -379,6 +379,124 @@ Foam::label Foam::indexedOctree<Type>::compactContents
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
bool Foam::indexedOctree<Type>::quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
const label nodeI,
|
||||||
|
const point& cc,
|
||||||
|
const scalar crSqr,
|
||||||
|
const List<scalar>& nearestDistances
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const node& nod = nodes_[nodeI];
|
||||||
|
|
||||||
|
volumeType nodeType = volumeType(nodeTypes_.get(nodeI<<3));
|
||||||
|
|
||||||
|
//scalar boxDist = nearestDistances[nodeI] + 0.5*nod.bb_.mag();
|
||||||
|
scalar boxDist = crSqr + magSqr(cc - nod.bb_.midpoint());
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
nodeType == INSIDE
|
||||||
|
//&& (crSqr < sqr(boxDist))
|
||||||
|
&& (boxDist < sqr(nearestDistances[nodeI]))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
direction octant = nod.bb_.subOctant(cc);
|
||||||
|
|
||||||
|
labelBits index = nod.subNodes_[octant];
|
||||||
|
|
||||||
|
if (isNode(index))
|
||||||
|
{
|
||||||
|
return quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
getNode(index),
|
||||||
|
cc,
|
||||||
|
crSqr,
|
||||||
|
nearestDistances
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
bool Foam::indexedOctree<Type>::quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
const point& cc,
|
||||||
|
const scalar crSqr,
|
||||||
|
const List<scalar>& nearestDistances
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (nodes_.size())
|
||||||
|
{
|
||||||
|
return quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
cc,
|
||||||
|
crSqr,
|
||||||
|
nearestDistances
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
Foam::scalar
|
||||||
|
Foam::indexedOctree<Type>::calcNearestDistance
|
||||||
|
(
|
||||||
|
const label nodeI
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const node& nod = nodes_[nodeI];
|
||||||
|
|
||||||
|
const point& nodeCentre = nod.bb_.midpoint();
|
||||||
|
|
||||||
|
scalar nearestDistance = 0.0;
|
||||||
|
|
||||||
|
pointIndexHit pHit = findNearest(nodeCentre, sqr(GREAT));
|
||||||
|
|
||||||
|
if (pHit.hit())
|
||||||
|
{
|
||||||
|
nearestDistance = mag(pHit.hitPoint() - nodeCentre);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningIn("Foam::indexedOctree<Type>::calcNearestDistance(const label)")
|
||||||
|
<< "Cannot calculate distance of nearest point on surface from "
|
||||||
|
<< "the midpoint of the octree node. Returning distance of zero."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nearestDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
Foam::List<Foam::scalar>
|
||||||
|
Foam::indexedOctree<Type>::calcNearestDistance() const
|
||||||
|
{
|
||||||
|
List<scalar> nearestDistances(nodes_.size());
|
||||||
|
|
||||||
|
forAll(nearestDistances, nodeI)
|
||||||
|
{
|
||||||
|
nearestDistances[nodeI] = calcNearestDistance(nodeI);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nearestDistances;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Pre-calculates wherever possible the volume status per node/subnode.
|
// Pre-calculates wherever possible the volume status per node/subnode.
|
||||||
// Recurses to determine status of lowest level boxes. Level above is
|
// Recurses to determine status of lowest level boxes. Level above is
|
||||||
// combination of octants below.
|
// combination of octants below.
|
||||||
@ -540,6 +658,67 @@ Foam::indexedOctree<Type>::getSide
|
|||||||
// ~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
//template <class Type>
|
||||||
|
//bool Foam::indexedOctree<Type>::findAnyOverlap
|
||||||
|
//(
|
||||||
|
// const label nodeI,
|
||||||
|
// const point& sample,
|
||||||
|
// const scalar nearestDistSqr
|
||||||
|
//) const
|
||||||
|
//{
|
||||||
|
// const node& nod = nodes_[nodeI];
|
||||||
|
//
|
||||||
|
// // Determine order to walk through octants
|
||||||
|
// FixedList<direction, 8> octantOrder;
|
||||||
|
// nod.bb_.searchOrder(sample, octantOrder);
|
||||||
|
//
|
||||||
|
// // Go into all suboctants (one containing sample first) and update
|
||||||
|
// // nearest.
|
||||||
|
// for (direction i = 0; i < 8; i++)
|
||||||
|
// {
|
||||||
|
// direction octant = octantOrder[i];
|
||||||
|
//
|
||||||
|
// labelBits index = nod.subNodes_[octant];
|
||||||
|
//
|
||||||
|
// if (isNode(index))
|
||||||
|
// {
|
||||||
|
// label subNodeI = getNode(index);
|
||||||
|
//
|
||||||
|
// const treeBoundBox& subBb = nodes_[subNodeI].bb_;
|
||||||
|
//
|
||||||
|
// if (overlaps(subBb.min(), subBb.max(), nearestDistSqr, sample))
|
||||||
|
// {
|
||||||
|
// return findAnyOverlap
|
||||||
|
// (
|
||||||
|
// subNodeI,
|
||||||
|
// sample,
|
||||||
|
// nearestDistSqr
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (isContent(index))
|
||||||
|
// {
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// overlaps
|
||||||
|
// (
|
||||||
|
// nod.bb_,
|
||||||
|
// octant,
|
||||||
|
// nearestDistSqr,
|
||||||
|
// sample
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// Find nearest point starting from nodeI
|
// Find nearest point starting from nodeI
|
||||||
template <class Type>
|
template <class Type>
|
||||||
void Foam::indexedOctree<Type>::findNearest
|
void Foam::indexedOctree<Type>::findNearest
|
||||||
@ -1614,7 +1793,6 @@ void Foam::indexedOctree<Type>::traverseNode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const node& nod = nodes_[nodeI];
|
const node& nod = nodes_[nodeI];
|
||||||
|
|
||||||
labelBits index = nod.subNodes_[octant];
|
labelBits index = nod.subNodes_[octant];
|
||||||
@ -1781,6 +1959,11 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
|||||||
label i = 0;
|
label i = 0;
|
||||||
for (; i < 100000; i++)
|
for (; i < 100000; i++)
|
||||||
{
|
{
|
||||||
|
// if (isLineInsideOrOutside(nodeI, treeStart, treeEnd))
|
||||||
|
// {
|
||||||
|
// return hitInfo;
|
||||||
|
// }
|
||||||
|
|
||||||
// Ray-trace to end of current node. Updates point (either on triangle
|
// Ray-trace to end of current node. Updates point (either on triangle
|
||||||
// in case of hit or on node bounding box in case of miss)
|
// in case of hit or on node bounding box in case of miss)
|
||||||
|
|
||||||
@ -1935,6 +2118,38 @@ Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//template <class Type>
|
||||||
|
//bool Foam::indexedOctree<Type>::isLineInsideOrOutside
|
||||||
|
//(
|
||||||
|
// const label nodeI,
|
||||||
|
// const point& start,
|
||||||
|
// const point& end
|
||||||
|
//) const
|
||||||
|
//{
|
||||||
|
// const node& nod = nodes_[nodeI];
|
||||||
|
//
|
||||||
|
// direction startOctant = nod.bb_.subOctant(start);
|
||||||
|
// direction endOctant = nod.bb_.subOctant(end);
|
||||||
|
//
|
||||||
|
// if (startOctant == endOctant)
|
||||||
|
// {
|
||||||
|
// volumeType startOctantType
|
||||||
|
// = volumeType(nodeTypes_.get((nodeI<<3) + startOctant));
|
||||||
|
//
|
||||||
|
// if
|
||||||
|
// (
|
||||||
|
// startOctantType == INSIDE || startOctantType == OUTSIDE
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// //Info<< nodeI << " | " << start << " " << end << endl;
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
// Find first intersection
|
// Find first intersection
|
||||||
template <class Type>
|
template <class Type>
|
||||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
Foam::pointIndexHit Foam::indexedOctree<Type>::findLine
|
||||||
@ -2559,6 +2774,27 @@ Foam::scalar& Foam::indexedOctree<Type>::perturbTol()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//template <class Type>
|
||||||
|
//bool Foam::indexedOctree<Type>::findAnyOverlap
|
||||||
|
//(
|
||||||
|
// const point& sample,
|
||||||
|
// const scalar startDistSqr
|
||||||
|
//) const
|
||||||
|
//{
|
||||||
|
// if (nodes_.size())
|
||||||
|
// {
|
||||||
|
// return findAnyOverlap
|
||||||
|
// (
|
||||||
|
// 0,
|
||||||
|
// sample,
|
||||||
|
// startDistSqr
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
template <class Type>
|
template <class Type>
|
||||||
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
Foam::pointIndexHit Foam::indexedOctree<Type>::findNearest
|
||||||
(
|
(
|
||||||
|
|||||||
@ -201,6 +201,16 @@ private:
|
|||||||
label& compactI
|
label& compactI
|
||||||
);
|
);
|
||||||
|
|
||||||
|
scalar calcNearestDistance(const label nodeI) const;
|
||||||
|
|
||||||
|
bool quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
const label nodeI,
|
||||||
|
const point& cc,
|
||||||
|
const scalar crSqr,
|
||||||
|
const List<scalar>& nearestDistances
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Determine inside/outside per node (mixed if cannot be
|
//- Determine inside/outside per node (mixed if cannot be
|
||||||
// determined). Only valid for closed shapes.
|
// determined). Only valid for closed shapes.
|
||||||
volumeType calcVolumeType(const label nodeI) const;
|
volumeType calcVolumeType(const label nodeI) const;
|
||||||
@ -320,6 +330,13 @@ private:
|
|||||||
const bool verbose = false
|
const bool verbose = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
// bool isLineInsideOrOutside
|
||||||
|
// (
|
||||||
|
// const label nodeI,
|
||||||
|
// const point& start,
|
||||||
|
// const point& end
|
||||||
|
// ) const;
|
||||||
|
|
||||||
//- Find any or nearest intersection of line between start and end.
|
//- Find any or nearest intersection of line between start and end.
|
||||||
pointIndexHit findLine
|
pointIndexHit findLine
|
||||||
(
|
(
|
||||||
@ -532,6 +549,19 @@ public:
|
|||||||
const scalar nearestDistSqr
|
const scalar nearestDistSqr
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
// bool findAnyOverlap
|
||||||
|
// (
|
||||||
|
// const point& sample,
|
||||||
|
// const scalar nearestDistSqr
|
||||||
|
// ) const;
|
||||||
|
//
|
||||||
|
// bool findAnyOverlap
|
||||||
|
// (
|
||||||
|
// const label nodeI,
|
||||||
|
// const point& sample,
|
||||||
|
// const scalar nearestDistSqr
|
||||||
|
// ) const;
|
||||||
|
|
||||||
//- Low level: calculate nearest starting from subnode.
|
//- Low level: calculate nearest starting from subnode.
|
||||||
void findNearest
|
void findNearest
|
||||||
(
|
(
|
||||||
@ -628,6 +658,16 @@ public:
|
|||||||
CompareOp& cop
|
CompareOp& cop
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Return a list containing the nearest distance of nodes to any
|
||||||
|
// shapes
|
||||||
|
List<scalar> calcNearestDistance() const;
|
||||||
|
|
||||||
|
bool quickCircumsphereRejection
|
||||||
|
(
|
||||||
|
const point& cc,
|
||||||
|
const scalar crSqr,
|
||||||
|
const List<scalar>& nearestDistances
|
||||||
|
) const;
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
|
|
||||||
|
|||||||
@ -546,6 +546,49 @@ Foam::extendedFeatureEdgeMesh::extendedFeatureEdgeMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
featurePointNormals_ = featurePointNormals;
|
featurePointNormals_ = featurePointNormals;
|
||||||
|
|
||||||
|
|
||||||
|
// Create featurePointEdges_
|
||||||
|
// For each feature point, stores a list of edges which are arranged in
|
||||||
|
// order according to their connectivity
|
||||||
|
|
||||||
|
// featurePointEdges_.setSize(nonFeatureStart_);
|
||||||
|
//
|
||||||
|
// Info<< sFeatEds.size() << " " << surf.pointEdges().size() << " "
|
||||||
|
// << edges().size() << endl;
|
||||||
|
//
|
||||||
|
// forAll(sFeatEds, eI)
|
||||||
|
// {
|
||||||
|
// Info<< "Edge " << eI << " " << sFeatEds[eI] << " "
|
||||||
|
// << edges()[eI] << endl;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// const edgeList& edges = eds;
|
||||||
|
//
|
||||||
|
// for (label i = 0; i < nonFeatureStart_; i++)
|
||||||
|
// {
|
||||||
|
// const labelList& ptEds = surf.pointEdges()[i];
|
||||||
|
//
|
||||||
|
// DynamicList<label> tmpFtEdges;
|
||||||
|
//
|
||||||
|
// forAll(ptEds, eI)
|
||||||
|
// {
|
||||||
|
// const label edgeI = ptEds[eI];
|
||||||
|
// const edge& e = sFeatEds[edgeI];
|
||||||
|
//
|
||||||
|
// Info<< "Edges: " << edgeI << " " << e << endl;
|
||||||
|
//
|
||||||
|
// forAll(sFeatEds, fEdgeI)
|
||||||
|
// {
|
||||||
|
// if (edges[fEdgeI] == e)
|
||||||
|
// {
|
||||||
|
// tmpFtEdges.append(fEdgeI);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// featurePointEdges_[i] = tmpFtEdges;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -821,7 +864,7 @@ void Foam::extendedFeatureEdgeMesh::allNearestFeatureEdges
|
|||||||
|
|
||||||
if (!hitPoint.hit())
|
if (!hitPoint.hit())
|
||||||
{
|
{
|
||||||
nearHit = pointIndexHit(true, hitPoint.missPoint(), hitIndex);
|
nearHit = pointIndexHit(false, hitPoint.missPoint(), hitIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user