diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 62d0c02afe63e1249e0300fd95f54a09e8a18223..3ba5b8c9e733793b5a9b7669bdf84b62a20e3efb 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -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() { -// 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; 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_(), edgeLocationTreePtr_(), surfacePtLocationTreePtr_(), - sizeAndAlignmentLocations_(), - storedSizes_(), - storedAlignments_(), - sizeAndAlignmentTreePtr_(), surfaceConformationVertices_(), initialPointsMethod_ ( @@ -1133,10 +940,6 @@ void Foam::conformalVoronoiMesh::initialiseForMotion() // (potentially) redistributed. 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 // domain the processor they are on. // reportProcessorOccupancy(); @@ -1836,8 +1639,6 @@ void Foam::conformalVoronoiMesh::move() writeMesh(time().timeName()); } - updateSizesAndAlignments(pointsToInsert); - Info<< nl << "Total displacement = " << totalDisp << nl << "Total distance = " << totalDist << nl diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index ac11d1a8fabbbc8ec14d1b51c951b4521476fd80..777f277d58a1d7c6a89e8a37e8d700470455f4c0 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -177,19 +177,6 @@ private: 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 // reinserted List<Vb> surfaceConformationVertices_; @@ -271,40 +258,6 @@ private: //- Return the local maximum surface protrusion distance 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, // optionally check processor occupancy and distribute to other // processors @@ -539,22 +492,6 @@ private: 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 void setVertexSizeAndAlignment(); @@ -750,9 +687,6 @@ private: const DynamicList<Foam::point>& existingSurfacePtLocations ) const; - //- Build or rebuild the sizeAndAlignmentTree - void buildSizeAndAlignmentTree() const; - //- Process the surface conformation locations to decide which surface // and edge conformation locations to add void addSurfaceAndEdgeHits @@ -1063,10 +997,6 @@ public: // const List<scalar>& radiusSqrs // ) const; - typedef K::Vector_3 CGALVector; - - inline CGALVector toCGALVector(const Foam::vector& v) const; - // Access diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 7c07d12e67c435b97b38d121bf3ffe1fd7fe2d1f..5a45b8ab4f7f0ed22a8b821f1d29b108cfd82338 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -211,11 +211,6 @@ void Foam::conformalVoronoiMesh::checkDuals() 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()); // indexDualVertices(duals, bPoints); @@ -1787,7 +1782,6 @@ void Foam::conformalVoronoiMesh::indexDualVertices OBJstream snapping1("snapToSurface1.obj"); OBJstream snapping2("snapToSurface2.obj"); OFstream tetToSnapTo("tetsToSnapTo.obj"); - label offset = 0; for ( diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index 8be496816f11bbd9eb8cf95b1be6b14eda63b6f3..43feda36545c50ef926888cef64020a36a44df96 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -76,10 +76,6 @@ void Foam::conformalVoronoiMesh::conformToSurface() { 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 @@ -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 ( const Foam::point& vit, diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H index a912515fb311b84588d33f190f6e51ca5b510dc5..9fa34b82d389f50cff6d725762c0e69b8ff15ed2 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshI.H @@ -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 ( const scalar ppDist, @@ -663,13 +575,6 @@ inline bool Foam::conformalVoronoiMesh::isProcBoundaryEdge // * * * * * * * * * * * * * * * 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 { return runTime_; diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H index 7875d67d392e25ebefbe6d127bf05797112ac9a4..a812fe466455221b262f56ce17a8185d7383ee45 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H @@ -108,17 +108,15 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const #ifdef CGAL_INEXACT + template<class Gt, class Cb> 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()); } + #else + template<class Gt, class Cb> const Foam::point CGAL::indexedCell<Gt, Cb>::dual() { @@ -131,6 +129,7 @@ int CGAL::indexedCell<Gt, Cb>::cellIndex() const CGAL::to_double(P.z()) ); } + #endif diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H index 3dd3761c59eedad38b32423461aebbf81dea2502..4277f0d3b78acf546414814c0865a533cac26214 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/pointFeatureEdgesTypes.H @@ -25,8 +25,7 @@ Class pointFeatureEdgesTypes Description - struct for holding information on the types of feature edges attached to - feature points + Holds information on the types of feature edges attached to feature points. \*---------------------------------------------------------------------------*/