STYLE: code cleanup in fileFormats, conversion

This commit is contained in:
Mark Olesen
2018-07-24 16:12:32 +02:00
parent 4a3bb8a9bc
commit 3963cd95d9
34 changed files with 229 additions and 308 deletions

View File

@ -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<processorPolyPatch>(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

View File

@ -98,14 +98,14 @@ private:
// Parallel merged points
//- Global numbering for merged points
autoPtr<globalIndex> globalPointsPtr_;
//- Global numbering for merged points
autoPtr<globalIndex> 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<face>&,
ensightGeoFile&
const UIndirectList<face>& 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<face>&,
ensightGeoFile&
const UIndirectList<face>& 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;

View File

@ -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<Pstream::nProcs(); ++slave)
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
faceList received(fromSlave);
faceList recv(fromSlave);
writeFaceSizes(received, os);
writeFaceSizes(recv, os);
}
}
else
@ -516,9 +508,9 @@ void Foam::ensightMesh::writeFaceConnectivity
for (int slave=1; slave<Pstream::nProcs(); ++slave)
{
IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
faceList received(fromSlave);
faceList recv(fromSlave);
writeFaceList(received, os);
writeFaceList(recv, os);
}
}
else
@ -541,7 +533,7 @@ void Foam::ensightMesh::writeFaceConnectivity
ensightFaces::elemType elemType,
const label nTotal,
const faceList& faceLst,
const labelList& addr,
const labelUList& addr,
ensightGeoFile& os
) const
{
@ -621,12 +613,13 @@ void Foam::ensightMesh::writeFaceConnectivity
const bool raw
) const
{
if (raw)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const ensightFaces::elemType what =
ensightFaces::elemType(typei);
if (raw)
{
writeFaceConnectivity
(
what,
@ -640,13 +633,8 @@ void Foam::ensightMesh::writeFaceConnectivity
os
);
}
}
else
{
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
else
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeFaceConnectivity
(
what,

View File

@ -25,7 +25,6 @@ License
#include "ensightMesh.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ensightMesh::options::options(IOstream::streamFormat format)

View File

@ -144,7 +144,9 @@ bool Foam::ensightOutput::writeFaceSubField
label start = 0; // start of sublist
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const ensightFaces::elemType what =
ensightFaces::elemType(typei);
const label size = ensFaces.faceIds(what).size();
writeFieldContent
@ -159,10 +161,8 @@ bool Foam::ensightOutput::writeFaceSubField
return true;
}
else
{
return false;
}
return false;
}
@ -183,7 +183,8 @@ bool Foam::ensightOutput::writeCellField
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType what = ensightCells::elemType(typei);
const ensightCells::elemType what =
ensightCells::elemType(typei);
writeFieldContent
(
@ -195,10 +196,8 @@ bool Foam::ensightOutput::writeCellField
return true;
}
else
{
return false;
}
return false;
}
@ -229,9 +228,8 @@ bool Foam::ensightOutput::writeField
// 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 = patchFaces[patchName];
@ -293,9 +291,8 @@ bool Foam::ensightOutput::writeField
}
}
forAll(zoneNames, zonei)
for (const word& zoneName : zoneNames)
{
const word& zoneName = zoneNames[zonei];
const ensightFaces& ensFaces = zoneFaces[zoneName];
// field (local size)
@ -362,9 +359,8 @@ bool Foam::ensightOutput::ensightPointField
// 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 = patchFaces[patchName];
@ -399,9 +395,8 @@ bool Foam::ensightOutput::ensightPointField
// write faceZones, if requested
//
const wordList zoneNames = zoneFaces.sortedToc();
forAll(zoneNames, zonei)
for (const word& zoneName : zoneNames)
{
const word& zoneName = zoneNames[zonei];
const ensightFaces& ensFaces = zoneFaces[zoneName];
uindirectPrimitivePatch p

View File

@ -115,7 +115,8 @@ bool Foam::ensightSerialOutput::writeField
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType what = ensightCells::elemType(typei);
const ensightCells::elemType what =
ensightCells::elemType(typei);
writeFieldContent
(

View File

@ -66,7 +66,8 @@ void Foam::ensightCase::initialize()
}
else
{
Info<<"Warning: re-using existing directory" << nl
DetailInfo
<<"Warning: re-using existing directory" << nl
<< " " << ensightDir_ << endl;
}
}

View File

@ -87,7 +87,7 @@ private:
//- Case name (with ".case" ending)
word caseName_;
//- Output stream
//- Output stream (master only)
mutable OFstream* os_;
//- Track state changes since last write

View File

@ -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 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -123,12 +123,6 @@ Foam::ensightFile::ensightFile
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightFile::~ensightFile()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::ensightFile::allowUndef()
@ -137,10 +131,10 @@ bool Foam::ensightFile::allowUndef()
}
bool Foam::ensightFile::allowUndef(bool value)
bool Foam::ensightFile::allowUndef(bool enabled)
{
bool old = allowUndef_;
allowUndef_ = value;
allowUndef_ = enabled;
return old;
}

View File

@ -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 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -112,7 +112,7 @@ public:
//- Destructor
~ensightFile();
~ensightFile() = default;
// Access
@ -136,12 +136,13 @@ public:
// Edit
static bool allowUndef(bool);
//- Enable/disable use of \c undef keyword and value
static bool allowUndef(bool enabled);
//- Assign the value to represent undef in the results
// Returns the previous value
// NB: do not use values larger than floatScalarVGREAT
static scalar undefValue(const scalar);
static scalar undefValue(const scalar value);
// Output
@ -150,10 +151,10 @@ public:
using Ostream::write;
//- Binary write
virtual Ostream& write(const char*, std::streamsize count);
virtual Ostream& write(const char* buf, std::streamsize count);
//- Write element keyword with trailing newline, optionally with undef
virtual Ostream& writeKeyword(const keyType&);
virtual Ostream& writeKeyword(const keyType& key);
//- Write "C Binary" for binary files (eg, geometry/measured)
Ostream& writeBinaryHeader();
@ -182,7 +183,7 @@ public:
// Convenience Output Methods
//- Begin a part (0-based index).
//- Begin a part (0-based index internally).
void beginPart(const label index);
//- Begin a "particle coordinates" block (measured data)

View File

@ -80,17 +80,11 @@ Foam::ensightGeoFile::ensightGeoFile
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightGeoFile::~ensightGeoFile()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const keyType& key)
{
// ensure we get ensightFile::write(const string&)
// Ensure we get ensightFile::write(const string&)
write(static_cast<const string&>(key));
newline();

View File

@ -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.

View File

@ -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;

View File

@ -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;

View File

@ -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::label, 5> Foam::ensightCells::sizes() const

View File

@ -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

View File

@ -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::label, 3> Foam::ensightFaces::sizes() const

View File

@ -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

View File

@ -37,12 +37,6 @@ Foam::ensightReadFile::ensightReadFile
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightReadFile::~ensightReadFile()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::ensightReadFile::read

View File

@ -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

View File

@ -76,7 +76,7 @@ public:
appendBase64Formatter(std::ostream& os);
//- Destructor
//- Destructor. Closes/flushes the underlying layer.
virtual ~appendBase64Formatter();

View File

@ -55,12 +55,6 @@ Foam::vtk::appendRawFormatter::appendRawFormatter(std::ostream& os)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::appendRawFormatter::~appendRawFormatter()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::vtk::outputOptions&

View File

@ -85,7 +85,7 @@ public:
//- Destructor
virtual ~appendRawFormatter();
virtual ~appendRawFormatter() = default;
// Member Functions

View File

@ -90,7 +90,7 @@ public:
asciiFormatter(std::ostream& os, unsigned precision);
//- Destructor
//- Destructor. Finishes the output line as required.
virtual ~asciiFormatter();

View File

@ -74,7 +74,7 @@ public:
base64Formatter(std::ostream& os);
//- Destructor
//- Destructor. Closes/flushes the underlying layer.
virtual ~base64Formatter();

View File

@ -80,7 +80,7 @@ protected:
public:
//- Destructor
//- Destructor. Closes/flushes the underlying layer
virtual ~foamVtkBase64Layer();

View File

@ -55,12 +55,6 @@ Foam::vtk::legacyAsciiFormatter::legacyAsciiFormatter
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::legacyAsciiFormatter::~legacyAsciiFormatter()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::vtk::outputOptions&

View File

@ -80,7 +80,7 @@ public:
//- Destructor
virtual ~legacyAsciiFormatter();
virtual ~legacyAsciiFormatter() = default;
// Member Functions

View File

@ -58,12 +58,6 @@ Foam::vtk::legacyRawFormatter::legacyRawFormatter
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::vtk::legacyRawFormatter::~legacyRawFormatter()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::vtk::outputOptions&

View File

@ -87,7 +87,7 @@ public:
//- Destructor
virtual ~legacyRawFormatter();
virtual ~legacyRawFormatter() = default;
// Member Functions

View File

@ -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.

View File

@ -376,18 +376,10 @@ void Foam::vtkUnstructuredReader::readField
case VTK_ULONG:
case VTK_ID:
{
autoPtr<labelIOField> fieldVals
auto fieldVals = autoPtr<labelIOField>::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<scalarIOField> fieldVals
auto fieldVals = autoPtr<scalarIOField>::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<stringIOList> fieldVals
auto fieldVals = autoPtr<stringIOList>::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<const scalarField*>(iter()));
reg.erase(iter);
autoPtr<vectorIOField> fieldVals
auto fieldVals = autoPtr<vectorIOField>::New
(
new vectorIOField
(
IOobject
(
dataName,
"",
reg
),
s.size()/3
)
IOobject(dataName, "", reg),
s.size()/3
);
label elemI = 0;

View File

@ -163,7 +163,7 @@ private:
(
Istream& inFile,
const label n,
List<T>& lst
List<T>& list
) const;
void warnUnhandledType

View File

@ -37,13 +37,13 @@ void Foam::vtkUnstructuredReader::readBlock
(
Istream& inFile,
const label n,
List<T>& lst
List<T>& 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<Type>(fieldNames[i]).size()
<< "\t" << fieldNames[i]
Info<< obj.lookupObject<Type>(fieldName).size()
<< "\t" << fieldName
<< endl;
}
Info<< endl;