From 50b549f3683bdb2922f409cc76ceef3b7d0c1b6e Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 8 Oct 2016 19:48:39 +0100 Subject: [PATCH] blockMesh: rationalizing class and member names --- .../vtkPV3blockMesh/vtkPV3blockMesh.C | 4 +- .../vtkPV3blockMesh/vtkPV3blockMeshConvert.C | 8 +- .../vtkPVblockMesh/vtkPVblockMesh.C | 4 +- .../vtkPVblockMesh/vtkPVblockMeshConvert.C | 6 +- src/mesh/blockMesh/Make/files | 20 +-- src/mesh/blockMesh/block/block.C | 17 ++- src/mesh/blockMesh/block/block.H | 31 ++++- src/mesh/blockMesh/block/blockCreate.C | 29 +++-- src/mesh/blockMesh/block/blockI.H | 6 +- .../blockDescriptor/blockDescriptor.C | 115 ++++-------------- .../blockDescriptor/blockDescriptor.H | 62 ++++------ .../blockDescriptor/blockDescriptorEdges.C | 40 +++--- .../blockDescriptor/blockDescriptorI.H | 88 ++++++++++++++ .../{curvedEdges => blockEdges}/BSpline.C | 2 +- .../{curvedEdges => blockEdges}/BSpline.H | 0 .../{curvedEdges => blockEdges}/BSplineEdge.C | 8 +- .../{curvedEdges => blockEdges}/BSplineEdge.H | 8 +- .../CatmullRomSpline.C | 2 +- .../CatmullRomSpline.H | 0 .../{curvedEdges => blockEdges}/arcEdge.C | 8 +- .../{curvedEdges => blockEdges}/arcEdge.H | 6 +- .../curvedEdge.C => blockEdges/blockEdge.C} | 32 ++--- .../curvedEdge.H => blockEdges/blockEdge.H} | 48 ++++---- .../curvedEdgeI.H => blockEdges/blockEdgeI.H} | 16 +-- .../blockEdgeList.H} | 14 +-- .../{curvedEdges => blockEdges}/lineDivide.C | 6 +- .../{curvedEdges => blockEdges}/lineDivide.H | 6 +- .../{curvedEdges => blockEdges}/lineEdge.C | 8 +- .../{curvedEdges => blockEdges}/lineEdge.H | 6 +- .../{curvedEdges => blockEdges}/polyLine.C | 2 +- .../{curvedEdges => blockEdges}/polyLine.H | 2 +- .../polyLineEdge.C | 8 +- .../polyLineEdge.H | 8 +- .../{curvedEdges => blockEdges}/splineEdge.C | 8 +- .../{curvedEdges => blockEdges}/splineEdge.H | 8 +- src/mesh/blockMesh/blockMesh/blockMesh.C | 6 +- src/mesh/blockMesh/blockMesh/blockMesh.H | 20 +-- .../blockMesh/blockMesh/blockMeshCreate.C | 3 +- .../blockMesh/blockMesh/blockMeshMergeFast.C | 30 ++--- .../blockMesh/blockMesh/blockMeshTopology.C | 76 ++---------- 40 files changed, 373 insertions(+), 398 deletions(-) create mode 100644 src/mesh/blockMesh/blockDescriptor/blockDescriptorI.H rename src/mesh/blockMesh/{curvedEdges => blockEdges}/BSpline.C (97%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/BSpline.H (100%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/BSplineEdge.C (94%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/BSplineEdge.H (94%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/CatmullRomSpline.C (97%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/CatmullRomSpline.H (100%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/arcEdge.C (95%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/arcEdge.H (96%) rename src/mesh/blockMesh/{curvedEdges/curvedEdge.C => blockEdges/blockEdge.C} (78%) rename src/mesh/blockMesh/{curvedEdges/curvedEdge.H => blockEdges/blockEdge.H} (84%) rename src/mesh/blockMesh/{curvedEdges/curvedEdgeI.H => blockEdges/blockEdgeI.H} (75%) rename src/mesh/blockMesh/{curvedEdges/curvedEdgeList.H => blockEdges/blockEdgeList.H} (86%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/lineDivide.C (97%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/lineDivide.H (95%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/lineEdge.C (92%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/lineEdge.H (95%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/polyLine.C (98%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/polyLine.H (98%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/polyLineEdge.C (91%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/polyLineEdge.H (93%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/splineEdge.C (94%) rename src/mesh/blockMesh/{curvedEdges => blockEdges}/splineEdge.H (94%) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C index f79068826b..a3ccb75891 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C @@ -115,7 +115,7 @@ void Foam::vtkPV3blockMesh::updateInfoEdges arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); const int nEdges = edges.size(); forAll(edges, edgeI) @@ -429,7 +429,7 @@ void Foam::vtkPV3blockMesh::renderPointNumbers if (show && meshPtr_) { - const pointField& cornerPts = meshPtr_->blockPointField(); + const pointField& cornerPts = meshPtr_->vertices(); const scalar scaleFactor = meshPtr_->scaleFactor(); pointNumberTextActorsPtrs_.setSize(cornerPts.size()); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C index b54b5dd221..876fc47a3e 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMeshConvert.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-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,7 @@ void Foam::vtkPV3blockMesh::convertMeshBlocks label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const Foam::pointField& blockPoints = blkMesh.blockPointField(); + const Foam::pointField& blockPoints = blkMesh.vertices(); if (debug) { @@ -148,7 +148,7 @@ void Foam::vtkPV3blockMesh::convertMeshEdges label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); int edgeI = 0; const scalar scaleFactor = blkMesh.scaleFactor(); @@ -256,7 +256,7 @@ void Foam::vtkPV3blockMesh::convertMeshCorners range.block(blockNo); // set output block label datasetNo = 0; // restart at dataset 0 - const pointField& blockPoints = meshPtr_->blockPointField(); + const pointField& blockPoints = meshPtr_->vertices(); const scalar& scaleFactor = meshPtr_->scaleFactor(); if (debug) diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C index b855990c68..22cdf2db50 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C @@ -115,7 +115,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() ); const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); const int nEdges = edges.size(); forAll(edges, edgeI) @@ -429,7 +429,7 @@ void Foam::vtkPVblockMesh::renderPointNumbers if (show && meshPtr_) { - const pointField& cornerPts = meshPtr_->blockPointField(); + const pointField& cornerPts = meshPtr_->vertices(); const scalar scaleFactor = meshPtr_->scaleFactor(); pointNumberTextActorsPtrs_.setSize(cornerPts.size()); diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C index b723b36bca..04cac76d95 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C @@ -55,7 +55,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const Foam::pointField& blockPoints = blkMesh.blockPointField(); + const Foam::pointField& blockPoints = blkMesh.vertices(); if (debug) { @@ -148,7 +148,7 @@ void Foam::vtkPVblockMesh::convertMeshEdges label datasetNo = 0; // restart at dataset 0 const blockMesh& blkMesh = *meshPtr_; - const curvedEdgeList& edges = blkMesh.edges(); + const blockEdgeList& edges = blkMesh.edges(); int edgeI = 0; const scalar scaleFactor = blkMesh.scaleFactor(); @@ -256,7 +256,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners range.block(blockNo); // set output block label datasetNo = 0; // restart at dataset 0 - const pointField& blockPoints = meshPtr_->blockPointField(); + const pointField& blockPoints = meshPtr_->vertices(); const scalar& scaleFactor = meshPtr_->scaleFactor(); if (debug) diff --git a/src/mesh/blockMesh/Make/files b/src/mesh/blockMesh/Make/files index 37bbe7ba17..27bed65597 100644 --- a/src/mesh/blockMesh/Make/files +++ b/src/mesh/blockMesh/Make/files @@ -1,14 +1,14 @@ -curvedEdges/BSpline.C -curvedEdges/CatmullRomSpline.C -curvedEdges/polyLine.C +blockEdges/BSpline.C +blockEdges/CatmullRomSpline.C +blockEdges/polyLine.C -curvedEdges/arcEdge.C -curvedEdges/curvedEdge.C -curvedEdges/lineEdge.C -curvedEdges/polyLineEdge.C -curvedEdges/lineDivide.C -curvedEdges/BSplineEdge.C -curvedEdges/splineEdge.C +blockEdges/arcEdge.C +blockEdges/blockEdge.C +blockEdges/lineEdge.C +blockEdges/polyLineEdge.C +blockEdges/lineDivide.C +blockEdges/BSplineEdge.C +blockEdges/splineEdge.C gradingDescriptor/gradingDescriptor.C gradingDescriptor/gradingDescriptors.C diff --git a/src/mesh/blockMesh/block/block.C b/src/mesh/blockMesh/block/block.C index 3130bcef9a..0b345511f6 100644 --- a/src/mesh/blockMesh/block/block.C +++ b/src/mesh/blockMesh/block/block.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,20 +23,19 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "block.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::block::block ( - const pointField& blockPointField, - const curvedEdgeList& edges, + const pointField& vertices, + const blockEdgeList& edges, Istream& is ) : - blockDescriptor(blockPointField, edges, is), - vertices_(0), + blockDescriptor(vertices, edges, is), + points_(0), cells_(0), boundaryPatches_(0) {} @@ -45,7 +44,7 @@ Foam::block::block Foam::block::block(const blockDescriptor& blockDesc) : blockDescriptor(blockDesc), - vertices_(0), + points_(0), cells_(0), boundaryPatches_(0) {} @@ -61,12 +60,12 @@ Foam::block::~block() const Foam::pointField& Foam::block::points() const { - if (vertices_.empty()) + if (points_.empty()) { createPoints(); } - return vertices_; + return points_; } diff --git a/src/mesh/blockMesh/block/block.H b/src/mesh/blockMesh/block/block.H index 3e47a80a6f..0f48b975e0 100644 --- a/src/mesh/blockMesh/block/block.H +++ b/src/mesh/blockMesh/block/block.H @@ -67,8 +67,8 @@ class block { // Private data - //- List of vertices - mutable pointField vertices_; + //- List of points + mutable pointField points_; //- List of cells mutable labelListList cells_; @@ -101,9 +101,9 @@ public: //- Construct from components with Istream block ( - const pointField& blockPointField, - const curvedEdgeList&, - Istream& + const pointField& vertices, + const blockEdgeList& edges, + Istream& is ); //- Construct from a block definition @@ -116,6 +116,27 @@ public: return autoPtr(nullptr); } + //- Class used for the read-construction of + // PtrLists of blocks + class iNew + { + const pointField& points_; + const blockEdgeList& edges_; + + public: + + iNew(const pointField& points, const blockEdgeList& edges) + : + points_(points), + edges_(edges) + {} + + autoPtr operator()(Istream& is) const + { + return autoPtr(new block(points_, edges_, is)); + } + }; + //- Destructor ~block(); diff --git a/src/mesh/blockMesh/block/blockCreate.C b/src/mesh/blockMesh/block/blockCreate.C index b3ce7d3a31..27def57ecd 100644 --- a/src/mesh/blockMesh/block/blockCreate.C +++ b/src/mesh/blockMesh/block/blockCreate.C @@ -23,7 +23,6 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "block.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -31,9 +30,9 @@ License void Foam::block::createPoints() const { // Set local variables for mesh specification - const label ni = meshDensity().x(); - const label nj = meshDensity().y(); - const label nk = meshDensity().z(); + const label ni = density().x(); + const label nj = density().y(); + const label nk = density().z(); const point& p000 = blockPoint(0); const point& p100 = blockPoint(1); @@ -53,8 +52,8 @@ void Foam::block::createPoints() const // // Generate vertices // - vertices_.clear(); - vertices_.setSize(nPoints()); + points_.clear(); + points_.setSize(nPoints()); for (label k = 0; k <= nk; k++) { @@ -218,14 +217,14 @@ void Foam::block::createPoints() const // Add the contributions - vertices_[vertexNo] = + points_[vertexNo] = ( edgex1 + edgex2 + edgex3 + edgex4 + edgey1 + edgey2 + edgey3 + edgey4 + edgez1 + edgez2 + edgez3 + edgez4 ) / 3.0; - vertices_[vertexNo] += + points_[vertexNo] += ( corx1 + corx2 + corx3 + corx4 + cory1 + cory2 + cory3 + cory4 @@ -239,9 +238,9 @@ void Foam::block::createPoints() const void Foam::block::createCells() const { - const label ni = meshDensity().x(); - const label nj = meshDensity().y(); - const label nk = meshDensity().z(); + const label ni = density().x(); + const label nj = density().y(); + const label nk = density().z(); // // Generate cells @@ -276,9 +275,9 @@ void Foam::block::createCells() const void Foam::block::createBoundary() const { - const label ni = meshDensity().x(); - const label nj = meshDensity().y(); - const label nk = meshDensity().z(); + const label ni = density().x(); + const label nj = density().y(); + const label nk = density().z(); // // Generate boundaries on each side of the hex @@ -457,7 +456,7 @@ void Foam::block::createBoundary() const void Foam::block::clearGeom() { - vertices_.clear(); + points_.clear(); cells_.clear(); boundaryPatches_.clear(); } diff --git a/src/mesh/blockMesh/block/blockI.H b/src/mesh/blockMesh/block/blockI.H index 2d9136b726..10ac991eb8 100644 --- a/src/mesh/blockMesh/block/blockI.H +++ b/src/mesh/blockMesh/block/blockI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,8 +30,8 @@ inline Foam::label Foam::block::vtxLabel(label i, label j, label k) const return ( i - + j * (meshDensity().x() + 1) - + k * (meshDensity().x() + 1) * (meshDensity().y() + 1) + + j * (density().x() + 1) + + k * (density().x() + 1) * (density().y() + 1) ); } diff --git a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C index 1f8c9118c1..2433f94489 100644 --- a/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C +++ b/src/mesh/blockMesh/blockDescriptor/blockDescriptor.C @@ -38,17 +38,17 @@ void Foam::blockDescriptor::check(const Istream& is) << " in block " << *this << exit(FatalIOError); } - else if (blockShape_[pi] >= blockPointField_.size()) + else if (blockShape_[pi] >= vertices_.size()) { FatalIOErrorInFunction(is) << "Point label " << blockShape_[pi] - << " out of range 0.." << blockPointField_.size() - 1 + << " out of range 0.." << vertices_.size() - 1 << " in block " << *this << exit(FatalIOError); } } - const point blockCentre(blockShape_.centre(blockPointField_)); + const point blockCentre(blockShape_.centre(vertices_)); const faceList faces(blockShape_.faces()); // Check each face is outward-pointing with respect to the block centre @@ -57,8 +57,8 @@ void Foam::blockDescriptor::check(const Istream& is) forAll(faces, i) { - point faceCentre(faces[i].centre(blockPointField_)); - vector faceNormal(faces[i].normal(blockPointField_)); + point faceCentre(faces[i].centre(vertices_)); + vector faceNormal(faces[i].normal(vertices_)); if (mag(faceNormal) > SMALL) { if (((faceCentre - blockCentre) & faceNormal) > 0) @@ -107,17 +107,17 @@ void Foam::blockDescriptor::check(const Istream& is) Foam::blockDescriptor::blockDescriptor ( const cellShape& bshape, - const pointField& blockPointField, - const curvedEdgeList& edges, - const Vector