STYLE: foamyHexMesh: Remove old code related mainly to the deprecated cell sizing methods

This commit is contained in:
laurence
2013-07-19 16:46:24 +01:00
parent f008250b03
commit 1a9329ed48
7 changed files with 5 additions and 413 deletions

View File

@ -570,159 +570,8 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
} }
void Foam::conformalVoronoiMesh::storeSizesAndAlignments()
{
DynamicList<Point> storePts(number_of_vertices());
for
(
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
vit != finite_vertices_end();
vit++
)
{
if (vit->internalPoint())
{
storePts.append(vit->point());
}
}
storePts.shrink();
storeSizesAndAlignments(storePts);
}
void Foam::conformalVoronoiMesh::storeSizesAndAlignments
(
const List<Point>& storePts
)
{
// timeCheck("Start of storeSizesAndAlignments");
//
// Info << nl << "Store size and alignment" << endl;
//
// sizeAndAlignmentLocations_.setSize(storePts.size());
//
// storedSizes_.setSize(sizeAndAlignmentLocations_.size());
//
// storedAlignments_.setSize(sizeAndAlignmentLocations_.size());
//
// label i = 0;
//
// //checkCellSizing();
//
// for
// (
// List<Point>::const_iterator pit = storePts.begin();
// pit != storePts.end();
// ++pit
// )
// {
// pointFromPoint pt = topoint(*pit);
//
//// storedAlignments_[i] = requiredAlignment(pt);
////
//// storedSizes_[i] = cellShapeControls().cellSize(pt);
//
// cellShapeControls().cellSizeAndAlignment
// (
// pt,
// storedSizes_[i],
// storedAlignments_[i]
// );
//
// i++;
// }
//
// timeCheck("Sizes and alignments calculated, build tree");
//
// buildSizeAndAlignmentTree();
//
// timeCheck("Size and alignment tree built");
}
void Foam::conformalVoronoiMesh::updateSizesAndAlignments
(
const List<Point>& storePts
)
{
// This function is only used in serial, the background redistribution
// triggers this when unbalance is detected in parallel.
if
(
!Pstream::parRun()
&& runTime_.run()
&& runTime_.timeIndex()
)
{
storeSizesAndAlignments(storePts);
timeCheck("Updated sizes and alignments");
}
}
const Foam::indexedOctree<Foam::treeDataPoint>&
Foam::conformalVoronoiMesh::sizeAndAlignmentTree() const
{
if (sizeAndAlignmentTreePtr_.empty())
{
buildSizeAndAlignmentTree();
}
return sizeAndAlignmentTreePtr_();
}
void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment() void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
{ {
// Info<< nl << "Looking up target cell alignment and size" << endl;
//
// const indexedOctree<treeDataPoint>& tree = sizeAndAlignmentTree();
//
// for
// (
// Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// vit++
// )
// {
// if
// (
// vit->internalOrBoundaryPoint()
// || vit->referredInternalOrBoundaryPoint()
// )
// {
// pointFromPoint pt = topoint(vit->point());
//
// pointIndexHit info = tree.findNearest(pt, sqr(GREAT));
//
// if (info.hit())
// {
// vit->alignment() = storedAlignments_[info.index()];
//
// vit->targetCellSize() = storedSizes_[info.index()];
// }
// else
// {
// WarningIn
// (
// "void "
// "Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()"
// )
// << "Point " << pt << " did not find a nearest point "
// << " for alignment and size lookup." << endl;
//
// vit->alignment() = cellShapeControls().cellAlignment(pt);
//
// vit->targetCellSize() = cellShapeControls().cellSize(pt);
// }
// }
// }
Info<< nl << "Calculating target cell alignment and size" << endl; Info<< nl << "Calculating target cell alignment and size" << endl;
for for
@ -744,44 +593,6 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment()
); );
} }
} }
// OFstream str(runTime_.path()/"alignments_internal.obj");
//
// for
// (
// Finite_vertices_iterator vit = finite_vertices_begin();
// vit != finite_vertices_end();
// ++vit
// )
// {
// if (!vit->farPoint())
// {
// // Write alignments
// const tensor& alignment = vit->alignment();
// pointFromPoint pt = topoint(vit->point());
//
// if
// (
// alignment.x() == triad::unset[0]
// || alignment.y() == triad::unset[0]
// || alignment.z() == triad::unset[0]
// )
// {
// Info<< "Bad alignment = " << vit->info();
//
// vit->alignment() = tensor::I;
//
// Info<< "New alignment = " << vit->info();
//
// continue;
// }
//
// meshTools::writeOBJ(str, pt, alignment.x() + pt);
// meshTools::writeOBJ(str, pt, alignment.y() + pt);
// meshTools::writeOBJ(str, pt, alignment.z() + pt);
// }
// }
} }
@ -1039,10 +850,6 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
featurePointLocations_(), featurePointLocations_(),
edgeLocationTreePtr_(), edgeLocationTreePtr_(),
surfacePtLocationTreePtr_(), surfacePtLocationTreePtr_(),
sizeAndAlignmentLocations_(),
storedSizes_(),
storedAlignments_(),
sizeAndAlignmentTreePtr_(),
surfaceConformationVertices_(), surfaceConformationVertices_(),
initialPointsMethod_ initialPointsMethod_
( (
@ -1133,10 +940,6 @@ void Foam::conformalVoronoiMesh::initialiseForMotion()
// (potentially) redistributed. // (potentially) redistributed.
storeSurfaceConformation(); storeSurfaceConformation();
// Use storeSizesAndAlignments with no feed points because all background
// points may have been distributed.
storeSizesAndAlignments();
// Report any Delaunay vertices that do not think that they are in the // Report any Delaunay vertices that do not think that they are in the
// domain the processor they are on. // domain the processor they are on.
// reportProcessorOccupancy(); // reportProcessorOccupancy();
@ -1836,8 +1639,6 @@ void Foam::conformalVoronoiMesh::move()
writeMesh(time().timeName()); writeMesh(time().timeName());
} }
updateSizesAndAlignments(pointsToInsert);
Info<< nl Info<< nl
<< "Total displacement = " << totalDisp << nl << "Total displacement = " << totalDisp << nl
<< "Total distance = " << totalDist << nl << "Total distance = " << totalDist << nl

View File

@ -177,19 +177,6 @@ private:
mutable DynamicList<Foam::point> existingSurfacePtLocations_; mutable DynamicList<Foam::point> existingSurfacePtLocations_;
//- Store locations where the cell size and alignments will be
// pre-calculated and looked up
pointField sizeAndAlignmentLocations_;
//- Stored cell size at sizeAndAlignmentLocations_
scalarField storedSizes_;
//- Stored alignments at sizeAndAlignmentLocations_
tensorField storedAlignments_;
//- Search tree for size and alignment lookup points
mutable autoPtr<indexedOctree<treeDataPoint> > sizeAndAlignmentTreePtr_;
//- Store the surface and feature edge conformation locations to be //- Store the surface and feature edge conformation locations to be
// reinserted // reinserted
List<Vb> surfaceConformationVertices_; List<Vb> surfaceConformationVertices_;
@ -271,40 +258,6 @@ private:
//- Return the local maximum surface protrusion distance //- Return the local maximum surface protrusion distance
inline scalar maxSurfaceProtrusion(const Foam::point& pt) const; inline scalar maxSurfaceProtrusion(const Foam::point& pt) const;
//- Insert Point and return its auto-generated index
inline bool insertPoint
(
const Point& P,
const indexedVertexEnum::vertexType type
);
//- Insert Foam::point with specified index and type
inline bool insertPoint
(
const Foam::point& p,
const indexedVertexEnum::vertexType type
);
//- Insert Point with specified index, type and original processor
inline bool insertReferredPoint
(
const Point& P,
const label index,
const indexedVertexEnum::vertexType type,
const label processor
);
inline bool insertReferredPoint(const Vb& P);
//- Insert Foam::point with specified index, type and original processor
inline bool insertReferredPoint
(
const Foam::point& p,
const label index,
const indexedVertexEnum::vertexType type,
const label processor
);
//- Insert Delaunay vertices using the CGAL range insertion method, //- Insert Delaunay vertices using the CGAL range insertion method,
// optionally check processor occupancy and distribute to other // optionally check processor occupancy and distribute to other
// processors // processors
@ -539,22 +492,6 @@ private:
void buildCellSizeAndAlignmentMesh(); void buildCellSizeAndAlignmentMesh();
//- Store data for sizeAndAlignmentLocations_, storedSizes_ and
// storedAlignments_ and initialise the sizeAndAlignmentTreePtr_,
// determining the appropriate sizeAndAlignmentLocations_
// automatically
void storeSizesAndAlignments();
//- Store data for sizeAndAlignmentLocations_, storedSizes_ and
// storedAlignments_ and initialise the sizeAndAlignmentTreePtr_
void storeSizesAndAlignments(const List<Point>& storePts);
//- Restore the sizes and alignments if required
void updateSizesAndAlignments(const List<Point>& storePts);
//- Demand driven construction of octree for and alignment points
const indexedOctree<treeDataPoint>& sizeAndAlignmentTree() const;
//- Set the size and alignment data for each vertex //- Set the size and alignment data for each vertex
void setVertexSizeAndAlignment(); void setVertexSizeAndAlignment();
@ -750,9 +687,6 @@ private:
const DynamicList<Foam::point>& existingSurfacePtLocations const DynamicList<Foam::point>& existingSurfacePtLocations
) const; ) const;
//- Build or rebuild the sizeAndAlignmentTree
void buildSizeAndAlignmentTree() const;
//- Process the surface conformation locations to decide which surface //- Process the surface conformation locations to decide which surface
// and edge conformation locations to add // and edge conformation locations to add
void addSurfaceAndEdgeHits void addSurfaceAndEdgeHits
@ -1063,10 +997,6 @@ public:
// const List<scalar>& radiusSqrs // const List<scalar>& radiusSqrs
// ) const; // ) const;
typedef K::Vector_3 CGALVector;
inline CGALVector toCGALVector(const Foam::vector& v) const;
// Access // Access

View File

@ -211,11 +211,6 @@ void Foam::conformalVoronoiMesh::checkDuals()
List<Point> duals(number_of_finite_cells()); List<Point> duals(number_of_finite_cells());
typedef CGAL::Exact_predicates_exact_constructions_kernel EK2;
typedef CGAL::Regular_triangulation_euclidean_traits_3<EK2> EK;
typedef CGAL::Cartesian_converter<baseK::Kernel, EK2> To_exact;
typedef CGAL::Cartesian_converter<EK2, baseK::Kernel> Back_from_exact;
// PackedBoolList bPoints(number_of_finite_cells()); // PackedBoolList bPoints(number_of_finite_cells());
// indexDualVertices(duals, bPoints); // indexDualVertices(duals, bPoints);
@ -1787,7 +1782,6 @@ void Foam::conformalVoronoiMesh::indexDualVertices
OBJstream snapping1("snapToSurface1.obj"); OBJstream snapping1("snapToSurface1.obj");
OBJstream snapping2("snapToSurface2.obj"); OBJstream snapping2("snapToSurface2.obj");
OFstream tetToSnapTo("tetsToSnapTo.obj"); OFstream tetToSnapTo("tetsToSnapTo.obj");
label offset = 0;
for for
( (

View File

@ -76,10 +76,6 @@ void Foam::conformalVoronoiMesh::conformToSurface()
{ {
sync(decomposition_().procBounds()); sync(decomposition_().procBounds());
} }
// Use storeSizesAndAlignments with no feed points because all
// background points may have been distributed.
storeSizesAndAlignments();
} }
// Do not store the surface conformation until after it has been // Do not store the surface conformation until after it has been
@ -2055,38 +2051,6 @@ void Foam::conformalVoronoiMesh::buildSurfacePtLocationTree
} }
void Foam::conformalVoronoiMesh::buildSizeAndAlignmentTree() const
{
if (sizeAndAlignmentLocations_.empty())
{
FatalErrorIn("buildSizeAndAlignmentTree()")
<< "sizeAndAlignmentLocations empty, must be populated before "
<< "sizeAndAlignmentTree can be built."
<< exit(FatalError);
}
treeBoundBox overallBb
(
geometryToConformTo_.globalBounds().extend(rndGen_, 1e-4)
);
overallBb.min() -= Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
overallBb.max() += Foam::point(ROOTVSMALL, ROOTVSMALL, ROOTVSMALL);
sizeAndAlignmentTreePtr_.reset
(
new indexedOctree<treeDataPoint>
(
treeDataPoint(sizeAndAlignmentLocations_),
overallBb, // overall search domain
10, // max levels
20.0, // maximum ratio of cubes v.s. cells
100.0 // max. duplicity; n/a since no bounding boxes.
)
);
}
void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
( (
const Foam::point& vit, const Foam::point& vit,

View File

@ -236,94 +236,6 @@ inline Foam::scalar Foam::conformalVoronoiMesh::maxSurfaceProtrusion
} }
inline bool Foam::conformalVoronoiMesh::insertPoint
(
const Foam::point& p,
const indexedVertexEnum::vertexType type
)
{
return insertPoint(toPoint<Point>(p), type);
}
inline bool Foam::conformalVoronoiMesh::insertPoint
(
const Point& P,
const indexedVertexEnum::vertexType type
)
{
uint nVert = number_of_vertices();
Vertex_handle vh = insert(P);
bool pointInserted = true;
if (nVert == number_of_vertices())
{
Pout<< "Failed to insert point : " << topoint(P)
<< " of type " << type << endl;
pointInserted = false;
}
else
{
vh->index() = getNewVertexIndex();
vh->type() = type;
}
return pointInserted;
}
inline bool Foam::conformalVoronoiMesh::insertReferredPoint(const Vb& P)
{
return insertReferredPoint(P.point(), P.index(), P.type(), P.procIndex());
}
inline bool Foam::conformalVoronoiMesh::insertReferredPoint
(
const Foam::point& p,
const label index,
const indexedVertexEnum::vertexType type,
const label processor
)
{
return insertReferredPoint(toPoint<Point>(p), index, type, processor);
}
inline bool Foam::conformalVoronoiMesh::insertReferredPoint
(
const Point& P,
const label index,
const indexedVertexEnum::vertexType type,
const label processor
)
{
uint nVert = number_of_vertices();
Vertex_handle vh = insert(P);
bool pointInserted = true;
if (nVert == number_of_vertices())
{
Pout<< "Failed to insert point " << topoint(P)
<< " type: " << type << " index: " << index
<< " proc: " << processor << endl;
pointInserted = false;
}
else
{
vh->index() = index;
vh->type() = type;
vh->procIndex() = processor;
}
return pointInserted;
}
inline void Foam::conformalVoronoiMesh::createPointPair inline void Foam::conformalVoronoiMesh::createPointPair
( (
const scalar ppDist, const scalar ppDist,
@ -663,13 +575,6 @@ inline bool Foam::conformalVoronoiMesh::isProcBoundaryEdge
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::conformalVoronoiMesh::CGALVector
Foam::conformalVoronoiMesh::toCGALVector(const Foam::vector& v) const
{
return CGALVector(v.x(), v.y(), v.z());
}
inline const Foam::Time& Foam::conformalVoronoiMesh::time() const inline const Foam::Time& Foam::conformalVoronoiMesh::time() const
{ {
return runTime_; return runTime_;

View File

@ -108,17 +108,15 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const
#ifdef CGAL_INEXACT #ifdef CGAL_INEXACT
template<class Gt, class Cb> template<class Gt, class Cb>
const Foam::point& CGAL::indexedCell<Gt, Cb>::dual() const Foam::point& CGAL::indexedCell<Gt, Cb>::dual()
{ {
// if (Foam::foamyHexMeshChecks::coplanarTet(*this, 1e-20) == 0)
// {
// Do exact calc
// }
return reinterpret_cast<const Foam::point&>(this->circumcenter()); return reinterpret_cast<const Foam::point&>(this->circumcenter());
} }
#else #else
template<class Gt, class Cb> template<class Gt, class Cb>
const Foam::point CGAL::indexedCell<Gt, Cb>::dual() const Foam::point CGAL::indexedCell<Gt, Cb>::dual()
{ {
@ -131,6 +129,7 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const
CGAL::to_double(P.z()) CGAL::to_double(P.z())
); );
} }
#endif #endif

View File

@ -25,8 +25,7 @@ Class
pointFeatureEdgesTypes pointFeatureEdgesTypes
Description Description
struct for holding information on the types of feature edges attached to Holds information on the types of feature edges attached to feature points.
feature points
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/