diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C index d78011c9db..7eb8216b00 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.C @@ -122,7 +122,7 @@ Foam::DelaunayMesh::DelaunayMesh if (indices.headerOk()) { vh->index() = indices[ptI]; - vertexCount()++; + vertexCount_++; } else { diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H index 1fbf19c1d6..63d227fcca 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMesh.H @@ -201,7 +201,6 @@ public: inline void resetCellCount(); inline label vertexCount() const; - inline label& vertexCount(); inline void resetVertexCount(); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H index bf2277e356..bad25b2b83 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/DelaunayMesh/DelaunayMeshI.H @@ -124,12 +124,6 @@ Foam::label Foam::DelaunayMesh::vertexCount() const return vertexCount_; } -template -Foam::label& Foam::DelaunayMesh::vertexCount() -{ - return vertexCount_; -} - template void Foam::DelaunayMesh::resetVertexCount() diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C index 37125bb76b..a033e5076d 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C @@ -40,11 +40,15 @@ Foam::cellAspectRatioControl::cellAspectRatioControl aspectRatioDict_.lookupOrDefault ( "aspectRatioDirection", - vector(0, 0, 0) + vector::zero ) ) { - Info<< nl << "Cell Aspect Ratio Control" << nl + // Normalise the direction + aspectRatioDirection_ /= mag(aspectRatioDirection_) + SMALL; + + Info<< nl + << "Cell Aspect Ratio Control" << nl << " Ratio : " << aspectRatio_ << nl << " Direction : " << aspectRatioDirection_ << endl; @@ -66,22 +70,20 @@ void Foam::cellAspectRatioControl::updateCellSizeAndFaceArea scalar& targetCellSize ) const { - const scalar cosAngle = mag - ( - vectorTools::cosPhi(alignmentDir, aspectRatioDirection_) - ); + const scalar cosAngle = + mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)); // Change target face area based on aspect ratio - targetFaceArea - += targetFaceArea - *(aspectRatio_ - 1.0) - *(1.0 - cosAngle); + targetFaceArea += + targetFaceArea + *(aspectRatio_ - 1.0) + *(1.0 - cosAngle); // Change target cell size based on aspect ratio - targetCellSize - += targetCellSize - *(aspectRatio_ - 1.0) - *cosAngle; + targetCellSize += + targetCellSize + *(aspectRatio_ - 1.0) + *cosAngle; alignmentDir *= 0.5*targetCellSize; } @@ -95,16 +97,15 @@ void Foam::cellAspectRatioControl::updateDeltaVector vector& delta ) const { - const scalar cosAngle = mag - ( - vectorTools::cosPhi(alignmentDir, aspectRatioDirection_) - ); + const scalar cosAngle = + mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)); - delta += 0.5 - *delta - *cosAngle - *(targetCellSize/rABMag) - *(aspectRatio_ - 1.0); + delta += + 0.5 + *delta + *cosAngle + *(targetCellSize/rABMag) + *(aspectRatio_ - 1.0); } diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H index cdc7510f23..b3964432b1 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.H @@ -56,7 +56,7 @@ class cellAspectRatioControl const scalar aspectRatio_; - const vector aspectRatioDirection_; + vector aspectRatioDirection_; // Private Member Functions @@ -73,10 +73,7 @@ public: // Constructors //- Construct from dictionary - cellAspectRatioControl - ( - const dictionary& motionDict - ); + cellAspectRatioControl(const dictionary& motionDict); //- Destructor diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 62d0c02afe..3ba5b8c9e7 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 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& 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::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& 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::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& 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 ac11d1a8fa..777f277d58 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 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 > sizeAndAlignmentTreePtr_; - //- Store the surface and feature edge conformation locations to be // reinserted List 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& storePts); - - //- Restore the sizes and alignments if required - void updateSizesAndAlignments(const List& storePts); - - //- Demand driven construction of octree for and alignment points - const indexedOctree& sizeAndAlignmentTree() const; - //- Set the size and alignment data for each vertex void setVertexSizeAndAlignment(); @@ -750,9 +687,6 @@ private: const DynamicList& 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& 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 7c07d12e67..5a45b8ab4f 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 duals(number_of_finite_cells()); - typedef CGAL::Exact_predicates_exact_constructions_kernel EK2; - typedef CGAL::Regular_triangulation_euclidean_traits_3 EK; - typedef CGAL::Cartesian_converter To_exact; - typedef CGAL::Cartesian_converter 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 8be496816f..43feda3654 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(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 a912515fb3..9fa34b82d3 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(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(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 7875d67d39..a812fe4664 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::cellIndex() const #ifdef CGAL_INEXACT + template const Foam::point& CGAL::indexedCell::dual() { - // if (Foam::foamyHexMeshChecks::coplanarTet(*this, 1e-20) == 0) - // { - // Do exact calc - // } - return reinterpret_cast(this->circumcenter()); } + #else + template const Foam::point CGAL::indexedCell::dual() { @@ -131,6 +129,7 @@ int CGAL::indexedCell::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 3dd3761c59..4277f0d3b7 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. \*---------------------------------------------------------------------------*/ diff --git a/etc/caseDicts/foamyHexMeshDict b/etc/caseDicts/foamyHexMeshDict index c866c832ad..cb8ac1517b 100644 --- a/etc/caseDicts/foamyHexMeshDict +++ b/etc/caseDicts/foamyHexMeshDict @@ -5,12 +5,19 @@ | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object foamyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #inputMode merge; surfaceConformation { - locationInMesh (0 0 0); pointPairDistanceCoeff 0.1; mixedFeaturePointPPDistanceCoeff 5.0; featurePointExclusionDistanceCoeff 0.65; @@ -22,11 +29,11 @@ surfaceConformation featurePointControls { - specialiseFeaturePoints on; - edgeAiming on; - guardFeaturePoints off; - snapFeaturePoints off; - circulateEdges off; + specialiseFeaturePoints on; + edgeAiming on; + guardFeaturePoints off; + snapFeaturePoints off; + circulateEdges off; } conformationControls @@ -115,20 +122,18 @@ polyMeshFiltering } +backgroundMeshDecomposition +{ + minLevels 1; + sampleResolution 4; + spanScale 20; + maxCellWeightCoeff 20; +} + + meshQualityControls { - maxNonOrtho 65; - maxBoundarySkewness 50; - maxInternalSkewness 10; - maxConcave 80; - minVol -1E30; - minTetQuality 1e-30; - minArea -1; - minTwist 0.02; - minDeterminant 0.001; - minFaceWeight 0.02; - minVolRatio 0.01; - minTriangleTwist -1; + #include "meshQualityDict" } diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index 21576535e9..41650aad6c 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -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 @@ -829,4 +829,26 @@ Foam::label Foam::face::trianglesQuads } +Foam::label Foam::longestEdge(const face& f, const pointField& pts) +{ + const edgeList& eds = f.edges(); + + label longestEdgeI = -1; + scalar longestEdgeLength = -SMALL; + + forAll(eds, edI) + { + scalar edgeLength = eds[edI].mag(pts); + + if (edgeLength > longestEdgeLength) + { + longestEdgeI = edI; + longestEdgeLength = edgeLength; + } + } + + return longestEdgeI; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index c481258a3c..adedf991bd 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -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 @@ -408,6 +408,12 @@ public: }; +// Global functions + +//- Find the longest edge on a face. Face point labels index into pts. +label longestEdge(const face& f, const pointField& pts); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C index 33e17117c4..eeec0974d6 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -492,7 +492,7 @@ bool Foam::ZoneMesh::checkParallelSync << " of type " << zones[zoneI].type() << " is not correctly synchronised" << " across coupled boundaries." - << " (coupled faces are either not both " + << " (coupled faces are either not both" << " present in set or have same flipmap)" << endl; } } diff --git a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C index ff15dcea3b..30d1161bb7 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/pointZone/pointZone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -154,8 +154,15 @@ bool Foam::pointZone::checkParallelSync(const bool report) const forAll(maxZone, pointI) { - // Check point in zone on both sides - if (maxZone[pointI] != minZone[pointI]) + // Check point in same (or no) zone on all processors + if + ( + ( + maxZone[pointI] != -1 + || minZone[pointI] != labelMax + ) + && (maxZone[pointI] != minZone[pointI]) + ) { if (report && !error) { @@ -167,7 +174,8 @@ bool Foam::pointZone::checkParallelSync(const bool report) const << (minZone[pointI] == labelMax ? -1 : minZone[pointI]) << " on some processors and in zone " << maxZone[pointI] - << " on some other processors." + << " on some other processors." << nl + << "(suppressing further warnings)" << endl; } error = true; diff --git a/src/OpenFOAM/primitives/Pair/Pair.H b/src/OpenFOAM/primitives/Pair/Pair.H index 12c16fc6c3..6715bffd7e 100644 --- a/src/OpenFOAM/primitives/Pair/Pair.H +++ b/src/OpenFOAM/primitives/Pair/Pair.H @@ -108,12 +108,6 @@ public: return this->operator[](1); } - //- Return reverse pair - inline Pair reversePair() const - { - return Pair(second(), first()); - } - //- Return other inline const Type& other(const Type& a) const { @@ -147,11 +141,11 @@ public: // - -1: same pair, but reversed order static inline int compare(const Pair& a, const Pair& b) { - if (a[0] == b[0] && a[1] == b[1]) + if (a == b) { return 1; } - else if (a[0] == b[1] && a[1] == b[0]) + else if (a == reverse(b)) { return -1; } @@ -160,35 +154,66 @@ public: return 0; } } - - - // Friend Operators - - friend bool operator==(const Pair& a, const Pair& b) - { - return (a.first() == b.first() && a.second() == b.second()); - } - - friend bool operator!=(const Pair& a, const Pair& b) - { - return !(a == b); - } - - friend bool operator<(const Pair& a, const Pair& b) - { - return - ( - a.first() < b.first() - || - ( - !(b.first() < a.first()) - && a.second() < b.second() - ) - ); - } }; +template +Pair reverse(const Pair& p) +{ + return Pair(p.second(), p.first()); +} + + +template +bool operator==(const Pair& a, const Pair& b) +{ + return (a.first() == b.first() && a.second() == b.second()); +} + + +template +bool operator!=(const Pair& a, const Pair& b) +{ + return !(a == b); +} + + +template +bool operator<(const Pair& a, const Pair& b) +{ + return + ( + a.first() < b.first() + || + ( + !(b.first() < a.first()) + && a.second() < b.second() + ) + ); +} + + +template +bool operator<=(const Pair& a, const Pair& b) +{ + return !(b < a); +} + + +template +bool operator>(const Pair& a, const Pair& b) +{ + return (b < a); +} + + +template +bool operator>=(const Pair& a, const Pair& b) +{ + return !(a < b); +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/primitives/Tuple2/Tuple2.H b/src/OpenFOAM/primitives/Tuple2/Tuple2.H index b7aae7598c..26ca000575 100644 --- a/src/OpenFOAM/primitives/Tuple2/Tuple2.H +++ b/src/OpenFOAM/primitives/Tuple2/Tuple2.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,20 +47,6 @@ namespace Foam template class Tuple2; -template -inline bool operator== -( - const Tuple2&, - const Tuple2& -); - -template -inline bool operator!= -( - const Tuple2&, - const Tuple2& -); - template inline Istream& operator>>(Istream&, Tuple2&); @@ -129,27 +115,6 @@ public: return s_; } - //- Return reverse pair - inline Tuple2 reverseTuple2() const - { - return Tuple2(second(), first()); - } - - - // Friend Operators - - friend bool operator== - ( - const Tuple2& a, - const Tuple2& b - ); - - friend bool operator!= - ( - const Tuple2& a, - const Tuple2& b - ); - // IOstream operators @@ -169,6 +134,14 @@ public: }; +//- Return reverse of a tuple2 +template +inline Tuple2 reverse(const Tuple2& t) +{ + return Tuple2(t.second(), t.first()); +} + + template inline bool operator== ( diff --git a/src/OpenFOAM/primitives/triad/triad.C b/src/OpenFOAM/primitives/triad/triad.C index ac997d8bd2..a642463f42 100644 --- a/src/OpenFOAM/primitives/triad/triad.C +++ b/src/OpenFOAM/primitives/triad/triad.C @@ -282,6 +282,11 @@ void Foam::triad::align(const vector& v) Foam::triad Foam::triad::sortxyz() const { + if (!this->set()) + { + return *this; + } + triad t; if diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index 70c2e7c558..6ea1e748b0 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -42,32 +42,6 @@ defineTypeNameAndDebug(edgeCollapser, 0); } -Foam::label Foam::edgeCollapser::longestEdge -( - const face& f, - const pointField& pts -) -{ - const edgeList& eds = f.edges(); - - label longestEdgeI = -1; - scalar longestEdgeLength = -SMALL; - - forAll(eds, edI) - { - scalar edgeLength = eds[edI].mag(pts); - - if (edgeLength > longestEdgeLength) - { - longestEdgeI = edI; - longestEdgeLength = edgeLength; - } - } - - return longestEdgeI; -} - - Foam::HashSet Foam::edgeCollapser::checkBadFaces ( const polyMesh& mesh, diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H index 2393458cf7..dab8bd298b 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.H @@ -262,9 +262,6 @@ public: // Check - //- Find the longest edge in a face - static label longestEdge(const face& f, const pointField& pts); - //- Calls motionSmoother::checkMesh and returns a set of bad faces static HashSet