diff --git a/src/conversion/ensight/mesh/ensightMesh.C b/src/conversion/ensight/mesh/ensightMesh.C index c17901fb03..918ef73253 100644 --- a/src/conversion/ensight/mesh/ensightMesh.C +++ b/src/conversion/ensight/mesh/ensightMesh.C @@ -131,11 +131,8 @@ void Foam::ensightMesh::correct() wordList patchNames = mesh_.boundaryMesh().names(); if (Pstream::parRun()) { - patchNames.setSize - ( - mesh_.boundary().size() - - mesh_.globalData().processorPatches().size() - ); + // Do not include processor patches in matching + patchNames.setSize(mesh_.boundaryMesh().nNonProcessor()); } labelList matched; @@ -158,9 +155,8 @@ void Foam::ensightMesh::correct() matched = identity(patchNames.size()); } - forAll(matched, matchi) + for (const label patchId : matched) { - const label patchId = matched[matchi]; const word& patchName = patchNames[patchId]; // use fvPatch (not polyPatch) to automatically remove empty patches @@ -224,9 +220,8 @@ void Foam::ensightMesh::correct() // Mark boundary faces to be excluded from export bitSet excludeFace(mesh_.nFaces()); // all false - forAll(mesh_.boundaryMesh(), patchi) + for (const polyPatch& pp : mesh_.boundaryMesh()) { - const polyPatch& pp = mesh_.boundaryMesh()[patchi]; if ( isA(pp) @@ -250,9 +245,8 @@ void Foam::ensightMesh::correct() Foam::sort(selectZones); // Count face types in each selected faceZone - forAll(selectZones, zonei) + for (const word& zoneName : selectZones) { - const word& zoneName = selectZones[zonei]; const label zoneID = mesh_.faceZones().findZoneID(zoneName); const faceZone& fz = mesh_.faceZones()[zoneID]; @@ -318,9 +312,8 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // use sortedToc for extra safety // const labelList patchIds = patchLookup_.sortedToc(); - forAll(patchIds, listi) + for (const label patchId : patchIds) { - const label patchId = patchIds[listi]; const word& patchName = patchLookup_[patchId]; const ensightFaces& ensFaces = boundaryPatchFaces_[patchName]; @@ -341,9 +334,9 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // Renumber the patch faces, // from local patch indexing to unique global index faceList patchFaces(pp.localFaces()); - forAll(patchFaces, i) + for (face& f : patchFaces) { - inplaceRenumber(pointToGlobal, patchFaces[i]); + inplaceRenumber(pointToGlobal, f); } writeAllPoints @@ -363,9 +356,8 @@ void Foam::ensightMesh::write(ensightGeoFile& os) const // write faceZones, if requested // const wordList zoneNames = faceZoneFaces_.sortedToc(); - forAll(zoneNames, zonei) + for (const word& zoneName : zoneNames) { - const word& zoneName = zoneNames[zonei]; const ensightFaces& ensFaces = faceZoneFaces_[zoneName]; // Use the properly sorted faceIds (ensightFaces) and do NOT use the diff --git a/src/conversion/ensight/mesh/ensightMesh.H b/src/conversion/ensight/mesh/ensightMesh.H index ee4bed65ed..16ec9645b9 100644 --- a/src/conversion/ensight/mesh/ensightMesh.H +++ b/src/conversion/ensight/mesh/ensightMesh.H @@ -98,14 +98,14 @@ private: // Parallel merged points - //- Global numbering for merged points - autoPtr globalPointsPtr_; + //- Global numbering for merged points + autoPtr globalPointsPtr_; - //- From mesh point to global merged point - labelList pointToGlobal_; + //- From mesh point to global merged point + labelList pointToGlobal_; - //- Local points that are unique - labelList uniquePointMap_; + //- Local points that are unique + labelList uniquePointMap_; // Private Member Functions @@ -117,122 +117,130 @@ private: //- Inplace renumber of cell-shapes static cellShapeList& renumberShapes ( - cellShapeList&, + cellShapeList& shapes, const labelUList& pointToGlobal ); static cellShapeList map ( - const cellShapeList&, - const labelUList& prims, + const cellShapeList& shapes, + const labelUList& addr, const labelUList& pointToGlobal ); //- Write list of faces static void writeFaceList ( - const faceList&, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ); //- Write list of faces static void writeFaceList ( - const UIndirectList&, - ensightGeoFile& + const UIndirectList& faces, + ensightGeoFile& os ); //- Write sizes of faces in the list static void writeFaceSizes ( - const faceList&, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ); //- Write sizes of faces in the list static void writeFaceSizes ( - const UIndirectList&, - ensightGeoFile& + const UIndirectList& faces, + ensightGeoFile& os ); - //- Write cell connectivity via shell shapes + //- Write cell connectivity via cell shapes static void writeCellShapes ( - const cellShapeList&, - ensightGeoFile& + const cellShapeList& shapes, + ensightGeoFile& os ); + //- Write the number of faces per poly element void writePolysNFaces ( - const labelList& polys, + const labelUList& polys, const cellList& cellFaces, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the number of points per poly element void writePolysNPointsPerFace ( - const labelList& polys, + const labelUList& polys, const cellList& cellFaces, const faceList& faces, ensightGeoFile& ) const; + //- Write the point ids per poly element void writePolysPoints ( - const labelList& polys, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, const labelList& faceOwner, ensightGeoFile& ) const; + //- Write the poly connectivity void writePolysConnectivity ( - const labelList& addr, + const labelUList& polys, const labelList& pointToGlobal, ensightGeoFile& ) const; + //- Write the regular cell connectivity for all types void writeCellConnectivity ( - const ensightCells&, + const ensightCells& ensCells, const labelList& pointToGlobal, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the regular cell connectivity for specified type void writeCellConnectivity ( ensightCells::elemType elemType, - const ensightCells&, + const ensightCells& ensCells, const labelList& pointToGlobal, - ensightGeoFile& + ensightGeoFile& os ) const; + //- Write the regular face connectivity for specified type and + //- and specified faces void writeFaceConnectivity ( ensightFaces::elemType elemType, const label nTotal, - const faceList& faceLst, - const labelList& addr, + const faceList& faces, + const labelUList& addr, ensightGeoFile& ) const; - + //- Write the regular face connectivity for specified type void writeFaceConnectivity ( ensightFaces::elemType elemType, const label nTotal, - const faceList& faceLst, - ensightGeoFile& + const faceList& faces, + ensightGeoFile& os ) const; void writeFaceConnectivity ( - const ensightFaces&, - const faceList& faceLst, - ensightGeoFile&, + const ensightFaces& ensFaces, + const faceList& faces, + ensightGeoFile& os, const bool raw = false ) const; diff --git a/src/conversion/ensight/mesh/ensightMeshIO.C b/src/conversion/ensight/mesh/ensightMeshIO.C index 037b8d98a2..6e342bf223 100644 --- a/src/conversion/ensight/mesh/ensightMeshIO.C +++ b/src/conversion/ensight/mesh/ensightMeshIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -42,9 +42,9 @@ Foam::cellShapeList& Foam::ensightMesh::renumberShapes const labelUList& pointToGlobal ) { - forAll(shapes, i) + for (cellShape& shape : shapes) { - inplaceRenumber(pointToGlobal, shapes[i]); + inplaceRenumber(pointToGlobal, shape); } return shapes; @@ -58,15 +58,15 @@ Foam::cellShapeList Foam::ensightMesh::map const labelUList& pointToGlobal ) { - cellShapeList lst(addr.size()); + cellShapeList list(addr.size()); forAll(addr, i) { - lst[i] = shapes[addr[i]]; - inplaceRenumber(pointToGlobal, lst[i]); + list[i] = shapes[addr[i]]; + inplaceRenumber(pointToGlobal, list[i]); } - return lst; + return list; } @@ -76,13 +76,11 @@ void Foam::ensightMesh::writeFaceList ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - - forAll(f, fp) + for (const label labi : f) { - os.write(f[fp] + 1); + os.write(labi + 1); } os.newline(); @@ -96,13 +94,11 @@ void Foam::ensightMesh::writeFaceList ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - - forAll(f, fp) + for (const label labi : f) { - os.write(f[fp] + 1); + os.write(labi + 1); } os.newline(); @@ -116,10 +112,8 @@ void Foam::ensightMesh::writeFaceSizes ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - os.write(f.size()); os.newline(); } @@ -132,10 +126,8 @@ void Foam::ensightMesh::writeFaceSizes ensightGeoFile& os ) { - forAll(faceLst, i) + for (const face& f : faceLst) { - const face& f = faceLst[i]; - os.write(f.size()); os.newline(); } @@ -148,17 +140,15 @@ void Foam::ensightMesh::writeCellShapes ensightGeoFile& os ) { - forAll(shapes, i) + for (const cellShape& cellPoints : shapes) { - const cellShape& cellPoints = shapes[i]; - // convert global -> local index // (note: Ensight indices start with 1) // In ASCII, write one cell per line - forAll(cellPoints, pointI) + for (const label pointi : cellPoints) { - os.write(cellPoints[pointI] + 1); + os.write(pointi + 1); } os.newline(); @@ -170,15 +160,15 @@ void Foam::ensightMesh::writeCellShapes void Foam::ensightMesh::writePolysNFaces ( - const labelList& addr, - const cellList& cellFaces, + const labelUList& addr, + const cellList& cellFaces, ensightGeoFile& os ) const { - // write the number of faces per element (1/line in ASCII) - forAll(addr, i) + // Write the number of faces per element (1/line in ASCII) + for (const label cellId : addr) { - const labelUList& cf = cellFaces[addr[i]]; + const labelUList& cf = cellFaces[cellId]; os.write(cf.size()); os.newline(); @@ -188,20 +178,20 @@ void Foam::ensightMesh::writePolysNFaces void Foam::ensightMesh::writePolysNPointsPerFace ( - const labelList& addr, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, ensightGeoFile& os ) const { - // write the number of points per element face (1/line in ASCII) - forAll(addr, i) + // Write the number of points per element face (1/line in ASCII) + for (const label cellId : addr) { - const labelUList& cf = cellFaces[addr[i]]; + const labelUList& cf = cellFaces[cellId]; - forAll(cf, facei) + for (const label facei : cf) { - os.write(faces[cf[facei]].size()); + os.write(faces[facei].size()); os.newline(); } } @@ -210,21 +200,19 @@ void Foam::ensightMesh::writePolysNPointsPerFace void Foam::ensightMesh::writePolysPoints ( - const labelList& addr, + const labelUList& addr, const cellList& cellFaces, const faceList& faces, const labelList& faceOwner, ensightGeoFile& os ) const { - forAll(addr, i) + for (const label cellId : addr) { - const label cellId = addr[i]; const labelUList& cf = cellFaces[cellId]; - forAll(cf, facei) + for (const label faceId : cf) { - const label faceId = cf[facei]; const face& f = faces[faceId]; // face points (in global points) if (faceId < faceOwner.size() && faceOwner[faceId] != cellId) @@ -234,16 +222,16 @@ void Foam::ensightMesh::writePolysPoints // as per face::reverseFace(), but without copying os.write(f[0] + 1); - for (label ptI = f.size()-1; ptI > 0; --ptI) + for (label pti = f.size()-1; pti > 0; --pti) { - os.write(f[ptI] + 1); + os.write(f[pti] + 1); } } else { - forAll(f, ptI) + for (const label labi : f) { - os.write(f[ptI] + 1); + os.write(labi + 1); } } @@ -255,7 +243,7 @@ void Foam::ensightMesh::writePolysPoints void Foam::ensightMesh::writePolysConnectivity ( - const labelList& addr, + const labelUList& addr, const labelList& pointToGlobal, ensightGeoFile& os ) const @@ -329,9 +317,9 @@ void Foam::ensightMesh::writePolysConnectivity // Renumber faces to use global point numbers faceList faces(mesh_.faces()); - forAll(faces, i) + for (face& f : faces) { - inplaceRenumber(pointToGlobal, faces[i]); + inplaceRenumber(pointToGlobal, f); } // List of points id for each face of the above list @@ -409,11 +397,14 @@ void Foam::ensightMesh::writeCellConnectivity } else { - const cellShapeList shapes = map + const cellShapeList shapes ( - mesh_.cellShapes(), - addr, - pointToGlobal + map + ( + mesh_.cellShapes(), + addr, + pointToGlobal + ) ); @@ -454,7 +445,8 @@ void Foam::ensightMesh::writeCellConnectivity { for (label typei=0; typei < ensightCells::nTypes; ++typei) { - const ensightCells::elemType what = ensightCells::elemType(typei); + const ensightCells::elemType what = + ensightCells::elemType(typei); writeCellConnectivity(what, ensCells, pointToGlobal, os); } @@ -489,9 +481,9 @@ void Foam::ensightMesh::writeFaceConnectivity for (int slave=1; slave(key)); newline(); diff --git a/src/fileFormats/ensight/file/ensightGeoFile.H b/src/fileFormats/ensight/file/ensightGeoFile.H index eb83526c65..6abc98adb5 100644 --- a/src/fileFormats/ensight/file/ensightGeoFile.H +++ b/src/fileFormats/ensight/file/ensightGeoFile.H @@ -91,7 +91,7 @@ public: //- Destructor - ~ensightGeoFile(); + ~ensightGeoFile() = default; // Output @@ -102,6 +102,7 @@ public: // Convenience Output Methods + //- Begin a part (0-based index). using ensightFile::beginPart; //- Begin a "part" (0-based index), with a description. diff --git a/src/fileFormats/ensight/name/ensightFileName.H b/src/fileFormats/ensight/name/ensightFileName.H index 1452730107..57971ad6a0 100644 --- a/src/fileFormats/ensight/name/ensightFileName.H +++ b/src/fileFormats/ensight/name/ensightFileName.H @@ -65,25 +65,25 @@ public: // Constructors - //- Construct as copy - inline explicit FileName(const FileName&); + //- Copy construct + inline FileName(const FileName& fn); //- Construct as copy of character array - inline explicit FileName(const char*); + inline explicit FileName(const char* s); //- Construct as copy of std::string - inline explicit FileName(const std::string&); + inline explicit FileName(const std::string& s); // Member functions //- Is this character valid for an ensight file-name - inline static bool valid(char); + inline static bool valid(char c); - // Member operators + // Member Operators - // Assignment (disabled) + // Assignment (disabled) void operator=(const fileName&) = delete; void operator=(const word&) = delete; diff --git a/src/fileFormats/ensight/name/ensightVarName.H b/src/fileFormats/ensight/name/ensightVarName.H index 2ffff6ae19..4158240ef6 100644 --- a/src/fileFormats/ensight/name/ensightVarName.H +++ b/src/fileFormats/ensight/name/ensightVarName.H @@ -67,25 +67,26 @@ public: // Constructors - //- Construct as copy - inline explicit VarName(const VarName&); + //- Copy construct + inline VarName(const VarName& vn); //- Construct as copy of character array - inline explicit VarName(const char*); + inline explicit VarName(const char* s); //- Construct as copy of std::string - inline explicit VarName(const std::string&); + inline explicit VarName(const std::string& s); - // Member functions + // Member Functions //- Is this character valid for an ensight var-name - inline static bool valid(char); + inline static bool valid(char c); - // Member operators + // Member Operators + + // Assignment (disabled) - // Assignment (disabled) void operator=(const word&) = delete; void operator=(const string&) = delete; void operator=(const std::string&) = delete; diff --git a/src/fileFormats/ensight/part/ensightCells.C b/src/fileFormats/ensight/part/ensightCells.C index 039f62c1cc..8d734bf7f4 100644 --- a/src/fileFormats/ensight/part/ensightCells.C +++ b/src/fileFormats/ensight/part/ensightCells.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,8 +30,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::label Foam::ensightCells::nTypes = 5; - const char* Foam::ensightCells::elemNames[5] = { "tetra4", "pyramid5", "penta6", "hexa8", "nfaced" }; @@ -62,6 +60,12 @@ void Foam::ensightCells::resizeAll() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +Foam::ensightCells::ensightCells() +: + ensightCells(0) +{} + + Foam::ensightCells::ensightCells(const label partIndex) : index_(partIndex), @@ -93,12 +97,6 @@ Foam::ensightCells::ensightCells(const ensightCells& obj) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightCells::~ensightCells() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::FixedList Foam::ensightCells::sizes() const diff --git a/src/fileFormats/ensight/part/ensightCells.H b/src/fileFormats/ensight/part/ensightCells.H index 8dd096dd87..54b4dbb35b 100644 --- a/src/fileFormats/ensight/part/ensightCells.H +++ b/src/fileFormats/ensight/part/ensightCells.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,7 @@ Description namespace Foam { +// Forward declarations class polyMesh; /*---------------------------------------------------------------------------*\ @@ -64,7 +65,7 @@ public: }; //- Number of element types (5) - static const label nTypes; + static constexpr label nTypes = 5; //- The ensight element type names static const char* elemNames[5]; @@ -108,15 +109,18 @@ public: // Constructors - //- Construct null, optionally with index - ensightCells(label partIndex = 0); + //- Construct null, with part index 0 + ensightCells(); + + //- Construct null, with specified part index + explicit ensightCells(const label partIndex); //- Copy constructor. Needed for lists etc. ensightCells(const ensightCells& obj); //- Destructor - ~ensightCells(); + ~ensightCells() = default; // Member Functions diff --git a/src/fileFormats/ensight/part/ensightFaces.C b/src/fileFormats/ensight/part/ensightFaces.C index 21489d7d01..8eda22616e 100644 --- a/src/fileFormats/ensight/part/ensightFaces.C +++ b/src/fileFormats/ensight/part/ensightFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,8 +30,6 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::label Foam::ensightFaces::nTypes = 3; - const char* Foam::ensightFaces::elemNames[3] = { "tria3", "quad4", "nsided" }; @@ -101,7 +99,13 @@ void Foam::ensightFaces::resizeAll() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::ensightFaces::ensightFaces(label partIndex) +Foam::ensightFaces::ensightFaces() +: + ensightFaces(0) +{} + + +Foam::ensightFaces::ensightFaces(const label partIndex) : index_(partIndex), address_(), @@ -134,12 +138,6 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj) } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightFaces::~ensightFaces() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::FixedList Foam::ensightFaces::sizes() const diff --git a/src/fileFormats/ensight/part/ensightFaces.H b/src/fileFormats/ensight/part/ensightFaces.H index abea086e3b..b159832617 100644 --- a/src/fileFormats/ensight/part/ensightFaces.H +++ b/src/fileFormats/ensight/part/ensightFaces.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,7 +62,7 @@ public: }; //- Number of element types (3) - static const label nTypes; + static constexpr label nTypes = 3; //- The ensight element type names static const char* elemNames[3]; @@ -115,15 +115,18 @@ public: // Constructors - //- Construct null, optionally with index - ensightFaces(label partIndex = 0); + //- Construct null, with part index 0 + ensightFaces(); + + //- Construct null, with specified part index + explicit ensightFaces(const label partIndex); //- Copy constructor. Needed for lists etc. ensightFaces(const ensightFaces& obj); //- Destructor - ~ensightFaces(); + ~ensightFaces() = default; // Member Functions diff --git a/src/fileFormats/ensight/read/ensightReadFile.C b/src/fileFormats/ensight/read/ensightReadFile.C index 3331176816..c2b0d4c4ca 100644 --- a/src/fileFormats/ensight/read/ensightReadFile.C +++ b/src/fileFormats/ensight/read/ensightReadFile.C @@ -37,12 +37,6 @@ Foam::ensightReadFile::ensightReadFile {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::ensightReadFile::~ensightReadFile() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::Istream& Foam::ensightReadFile::read diff --git a/src/fileFormats/ensight/read/ensightReadFile.H b/src/fileFormats/ensight/read/ensightReadFile.H index 680056f27f..055face546 100644 --- a/src/fileFormats/ensight/read/ensightReadFile.H +++ b/src/fileFormats/ensight/read/ensightReadFile.H @@ -62,7 +62,7 @@ public: // Constructors - //- Construct from pathname + //- Construct from pathname. Default format is binary. ensightReadFile ( const fileName& pathname, @@ -71,7 +71,7 @@ public: //- Destructor - ~ensightReadFile(); + ~ensightReadFile() = default; // Output diff --git a/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H b/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H index 77e3c5ee67..2384289f67 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H +++ b/src/fileFormats/vtk/format/foamVtkAppendBase64Formatter.H @@ -76,7 +76,7 @@ public: appendBase64Formatter(std::ostream& os); - //- Destructor + //- Destructor. Closes/flushes the underlying layer. virtual ~appendBase64Formatter(); diff --git a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C index 0ff9e5c4cd..ee230f3d36 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.C @@ -55,12 +55,6 @@ Foam::vtk::appendRawFormatter::appendRawFormatter(std::ostream& os) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::appendRawFormatter::~appendRawFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H index 4f6d58336a..dbbcf0788a 100644 --- a/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkAppendRawFormatter.H @@ -85,7 +85,7 @@ public: //- Destructor - virtual ~appendRawFormatter(); + virtual ~appendRawFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H index 588d80b58a..b050d6573c 100644 --- a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H @@ -90,7 +90,7 @@ public: asciiFormatter(std::ostream& os, unsigned precision); - //- Destructor + //- Destructor. Finishes the output line as required. virtual ~asciiFormatter(); diff --git a/src/fileFormats/vtk/format/foamVtkBase64Formatter.H b/src/fileFormats/vtk/format/foamVtkBase64Formatter.H index 94a009da99..cd733e643e 100644 --- a/src/fileFormats/vtk/format/foamVtkBase64Formatter.H +++ b/src/fileFormats/vtk/format/foamVtkBase64Formatter.H @@ -74,7 +74,7 @@ public: base64Formatter(std::ostream& os); - //- Destructor + //- Destructor. Closes/flushes the underlying layer. virtual ~base64Formatter(); diff --git a/src/fileFormats/vtk/format/foamVtkBase64Layer.H b/src/fileFormats/vtk/format/foamVtkBase64Layer.H index 79b5397ea5..d965c6348d 100644 --- a/src/fileFormats/vtk/format/foamVtkBase64Layer.H +++ b/src/fileFormats/vtk/format/foamVtkBase64Layer.H @@ -80,7 +80,7 @@ protected: public: - //- Destructor + //- Destructor. Closes/flushes the underlying layer virtual ~foamVtkBase64Layer(); diff --git a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C index fe8728854c..d1c3bb2369 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.C @@ -55,12 +55,6 @@ Foam::vtk::legacyAsciiFormatter::legacyAsciiFormatter {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::legacyAsciiFormatter::~legacyAsciiFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H index f298a545f6..e191d1eb93 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H @@ -80,7 +80,7 @@ public: //- Destructor - virtual ~legacyAsciiFormatter(); + virtual ~legacyAsciiFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C index 28b042c195..3582033eb2 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.C @@ -58,12 +58,6 @@ Foam::vtk::legacyRawFormatter::legacyRawFormatter {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::vtk::legacyRawFormatter::~legacyRawFormatter() -{} - - // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // const Foam::vtk::outputOptions& diff --git a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H index 2633328676..ae88684b05 100644 --- a/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkLegacyRawFormatter.H @@ -87,7 +87,7 @@ public: //- Destructor - virtual ~legacyRawFormatter(); + virtual ~legacyRawFormatter() = default; // Member Functions diff --git a/src/fileFormats/vtk/output/foamVtkOutputOptions.H b/src/fileFormats/vtk/output/foamVtkOutputOptions.H index 00e715b15c..fb15f9dd00 100644 --- a/src/fileFormats/vtk/output/foamVtkOutputOptions.H +++ b/src/fileFormats/vtk/output/foamVtkOutputOptions.H @@ -92,7 +92,7 @@ public: // Member Functions - // Access + // Access //- The output format type inline formatType fmt() const; @@ -116,7 +116,7 @@ public: inline unsigned precision() const; - // Edit + // Edit //- Toggle ASCII mode on/off. // In XML append mode, this switches between base64 and raw binary. diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.C b/src/fileFormats/vtk/read/vtkUnstructuredReader.C index 3094f203e3..a79283fb8e 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.C @@ -376,18 +376,10 @@ void Foam::vtkUnstructuredReader::readField case VTK_ULONG: case VTK_ID: { - autoPtr fieldVals + auto fieldVals = autoPtr::New ( - new labelIOField - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); readBlock(inFile, fieldVals().size(), fieldVals()); regIOobject::store(fieldVals); @@ -397,18 +389,10 @@ void Foam::vtkUnstructuredReader::readField case VTK_FLOAT: case VTK_DOUBLE: { - autoPtr fieldVals + auto fieldVals = autoPtr::New ( - new scalarIOField - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); readBlock(inFile, fieldVals().size(), fieldVals()); regIOobject::store(fieldVals); @@ -421,18 +405,10 @@ void Foam::vtkUnstructuredReader::readField { Info<< "Reading strings:" << size << endl; } - autoPtr fieldVals + auto fieldVals = autoPtr::New ( - new stringIOList - ( - IOobject - ( - arrayName, - "", - obj - ), - size - ) + IOobject(arrayName, "", obj), + size ); // Consume current line. inFile.getLine(fieldVals()[0]); @@ -536,10 +512,8 @@ Foam::objectRegistry& Foam::vtkUnstructuredReader::selectRegistry { return pointData_; } - else - { - return otherData_; - } + + return otherData_; } @@ -827,18 +801,10 @@ void Foam::vtkUnstructuredReader::read(ISstream& inFile) objectRegistry::iterator iter = reg.find(dataName); scalarField s(*dynamic_cast(iter())); reg.erase(iter); - autoPtr fieldVals + auto fieldVals = autoPtr::New ( - new vectorIOField - ( - IOobject - ( - dataName, - "", - reg - ), - s.size()/3 - ) + IOobject(dataName, "", reg), + s.size()/3 ); label elemI = 0; diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReader.H b/src/fileFormats/vtk/read/vtkUnstructuredReader.H index 159fbdb730..482d553f7b 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReader.H +++ b/src/fileFormats/vtk/read/vtkUnstructuredReader.H @@ -163,7 +163,7 @@ private: ( Istream& inFile, const label n, - List& lst + List& list ) const; void warnUnhandledType diff --git a/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C b/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C index 17e6ec326b..3e21d23079 100644 --- a/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C +++ b/src/fileFormats/vtk/read/vtkUnstructuredReaderTemplates.C @@ -37,13 +37,13 @@ void Foam::vtkUnstructuredReader::readBlock ( Istream& inFile, const label n, - List& lst + List& list ) const { - lst.setSize(n); - forAll(lst, i) + list.setSize(n); + forAll(list, i) { - inFile >> lst[i]; + inFile >> list[i]; } } @@ -59,13 +59,14 @@ void Foam::vtkUnstructuredReader::printFieldStats if (fieldNames.size()) { Info<< "Read " << fieldNames.size() << " " << Type::typeName - << " fields:" << endl; - Info<< "Size\tName" << nl + << " fields:" << nl + << "Size\tName" << nl << "----\t----" << endl; - forAll(fieldNames, i) + + for (const word& fieldName : fieldNames) { - Info<< obj.lookupObject(fieldNames[i]).size() - << "\t" << fieldNames[i] + Info<< obj.lookupObject(fieldName).size() + << "\t" << fieldName << endl; } Info<< endl;