Skip to content
Snippets Groups Projects
Commit 2dbe05dc authored by mark's avatar mark
Browse files

STYLE: Remove meshReaders/meshWriters namespace (issue #204)

- Relocate classes (STARCDMeshReader, STARCDMeshWriter)
  into fileFormats namespace instead.
parent 1d57cfec
Branches
Tags
2 merge requests!69Merge preconvert,!60Merge foundation
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -48,7 +48,7 @@ Note
creating the cellTable information.
See also
Foam::cellTable, Foam::meshWriter and Foam::meshWriters::STARCD
Foam::cellTable, Foam::meshWriter and Foam::fileFormats::STARCDMeshWriter
\*---------------------------------------------------------------------------*/
......@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
if (!timeI || state != polyMesh::UNCHANGED)
{
meshWriters::STARCD writer(mesh, scaleFactor);
fileFormats::STARCDMeshWriter writer(mesh, scaleFactor);
if (args.optionFound("noBnd"))
{
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -48,6 +48,9 @@ Usage
Note
Baffles are written as interfaces for later use
See Also
Foam::cellTable, Foam::meshReader and Foam::fileFormats::STARCDMeshReader
\*---------------------------------------------------------------------------*/
#include "argList.H"
......@@ -95,7 +98,7 @@ int main(int argc, char *argv[])
scaleFactor = 1;
}
meshReaders::STARCD::keepSolids = args.optionFound("solids");
fileFormats::STARCDMeshReader::keepSolids = args.optionFound("solids");
// default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY;
......@@ -110,7 +113,7 @@ int main(int argc, char *argv[])
// remove extensions and/or trailing '.'
const fileName prefix = fileName(args[1]).lessExt();
meshReaders::STARCD reader(prefix, runTime, scaleFactor);
fileFormats::STARCDMeshReader reader(prefix, runTime, scaleFactor);
autoPtr<polyMesh> mesh = reader.mesh(runTime);
reader.writeMesh(mesh, format);
......
......@@ -35,15 +35,15 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* const Foam::meshReaders::STARCD::defaultBoundaryName =
const char* const Foam::fileFormats::STARCDMeshReader::defaultBoundaryName =
"Default_Boundary_Region";
const char* const Foam::meshReaders::STARCD::defaultSolidBoundaryName =
const char* const Foam::fileFormats::STARCDMeshReader::defaultSolidBoundaryName =
"Default_Boundary_Solid";
bool Foam::meshReaders::STARCD::keepSolids = false;
bool Foam::fileFormats::STARCDMeshReader::keepSolids = false;
const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] =
const int Foam::fileFormats::STARCDMeshReader::starToFoamFaceAddr[4][6] =
{
{ 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex
{ 0, 1, 4, -1, 2, 3 }, // 12 = pro-STAR prism
......@@ -54,7 +54,7 @@ const int Foam::meshReaders::STARCD::starToFoamFaceAddr[4][6] =
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void Foam::meshReaders::STARCD::readToNewline(IFstream& is)
void Foam::fileFormats::STARCDMeshReader::readToNewline(IFstream& is)
{
char ch = '\n';
do
......@@ -65,7 +65,7 @@ void Foam::meshReaders::STARCD::readToNewline(IFstream& is)
}
bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
bool Foam::fileFormats::STARCDMeshReader::readHeader(IFstream& is, word fileSignature)
{
if (!is.good())
{
......@@ -95,7 +95,10 @@ bool Foam::meshReaders::STARCD::readHeader(IFstream& is, word fileSignature)
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::meshReaders::STARCD::readAux(const objectRegistry& registry)
void Foam::fileFormats::STARCDMeshReader::readAux
(
const objectRegistry& registry
)
{
boundaryRegion_.readDict(registry);
cellTable_.readDict(registry);
......@@ -115,7 +118,7 @@ Body:
<vertexId> <x> <y> <z> [newline]
\*---------------------------------------------------------------------------*/
void Foam::meshReaders::STARCD::readPoints
void Foam::fileFormats::STARCDMeshReader::readPoints
(
const fileName& inputName,
const scalar scaleFactor
......@@ -197,7 +200,6 @@ void Foam::meshReaders::STARCD::readPoints
<< "no points in file " << inputName
<< abort(FatalError);
}
}
......@@ -241,7 +243,7 @@ for each cell face.
Strictly speaking, we only need the cellModeller for adding boundaries.
\*---------------------------------------------------------------------------*/
void Foam::meshReaders::STARCD::readCells(const fileName& inputName)
void Foam::fileFormats::STARCDMeshReader::readCells(const fileName& inputName)
{
const word fileSignature = "PROSTAR_CELL";
label nFluids = 0, nSolids = 0, nBaffles = 0, nShells = 0;
......@@ -632,7 +634,10 @@ BAFFLE
etc,
\*---------------------------------------------------------------------------*/
void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
void Foam::fileFormats::STARCDMeshReader::readBoundary
(
const fileName& inputName
)
{
const word fileSignature = "PROSTAR_BOUNDARY";
label nPatches = 0, nFaces = 0, nBafflePatches = 0, maxId = 0;
......@@ -979,7 +984,7 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
//
// remove unused points
//
void Foam::meshReaders::STARCD::cullPoints()
void Foam::fileFormats::STARCDMeshReader::cullPoints()
{
label nPoints = points_.size();
labelList oldToNew(nPoints, -1);
......@@ -1039,7 +1044,7 @@ void Foam::meshReaders::STARCD::cullPoints()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor)
bool Foam::fileFormats::STARCDMeshReader::readGeometry(const scalar scaleFactor)
{
readPoints(geometryFile_ + ".vrt", scaleFactor);
readCells(geometryFile_ + ".cel");
......@@ -1052,7 +1057,7 @@ bool Foam::meshReaders::STARCD::readGeometry(const scalar scaleFactor)
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshReaders::STARCD::STARCD
Foam::fileFormats::STARCDMeshReader::STARCDMeshReader
(
const fileName& prefix,
const objectRegistry& registry,
......@@ -1070,7 +1075,7 @@ Foam::meshReaders::STARCD::STARCD
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::meshReaders::STARCD::~STARCD()
Foam::fileFormats::STARCDMeshReader::~STARCDMeshReader()
{}
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::meshReaders::STARCD
Foam::fileFormats::STARCDMeshReader
Description
Read pro-STAR vrt/cel/bnd files.
......@@ -52,14 +52,14 @@ SourceFiles
namespace Foam
{
namespace meshReaders
namespace fileFormats
{
/*---------------------------------------------------------------------------*\
Class meshReaders::STARCD Declaration
Class fileFormats::STARCDMeshReader Declaration
\*---------------------------------------------------------------------------*/
class STARCD
class STARCDMeshReader
:
public meshReader
{
......@@ -119,10 +119,10 @@ private:
// Private member functions
//- Disallow default bitwise copy construct
STARCD(const STARCD&);
STARCDMeshReader(const STARCDMeshReader&) = delete;
//- Disallow default bitwise assignment
void operator=(const STARCD&);
void operator=(const STARCDMeshReader&) = delete;
protected:
......@@ -161,7 +161,7 @@ public:
// Constructors
//- Construct from case name
STARCD
STARCDMeshReader
(
const fileName& prefix,
const objectRegistry&,
......@@ -170,13 +170,13 @@ public:
//- Destructor
virtual ~STARCD();
virtual ~STARCDMeshReader();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace meshReaders
} // End namespace fileFormats
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -31,10 +31,10 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const char* Foam::meshWriters::STARCD::defaultBoundaryName =
const char* Foam::fileFormats::STARCDMeshWriter::defaultBoundaryName =
"Default_Boundary_Region";
const Foam::label Foam::meshWriters::STARCD::foamToStarFaceAddr[4][6] =
const Foam::label Foam::fileFormats::STARCDMeshWriter::foamToStarFaceAddr[4][6] =
{
{ 4, 5, 2, 3, 0, 1 }, // 11 = pro-STAR hex
{ 0, 1, 4, 5, 2, -1 }, // 12 = pro-STAR prism
......@@ -45,7 +45,7 @@ const Foam::label Foam::meshWriters::STARCD::foamToStarFaceAddr[4][6] =
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label Foam::meshWriters::STARCD::findDefaultBoundary() const
Foam::label Foam::fileFormats::STARCDMeshWriter::findDefaultBoundary() const
{
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
......@@ -64,7 +64,7 @@ Foam::label Foam::meshWriters::STARCD::findDefaultBoundary() const
}
void Foam::meshWriters::STARCD::getCellTable()
void Foam::fileFormats::STARCDMeshWriter::getCellTable()
{
// read constant/polyMesh/propertyName
IOList<label> ioList
......@@ -171,7 +171,7 @@ void Foam::meshWriters::STARCD::getCellTable()
}
void Foam::meshWriters::STARCD::writeHeader(Ostream& os, const char* filetype)
void Foam::fileFormats::STARCDMeshWriter::writeHeader(Ostream& os, const char* filetype)
{
os << "PROSTAR_" << filetype << nl
<< 4000
......@@ -186,7 +186,7 @@ void Foam::meshWriters::STARCD::writeHeader(Ostream& os, const char* filetype)
}
void Foam::meshWriters::STARCD::writePoints(const fileName& prefix) const
void Foam::fileFormats::STARCDMeshWriter::writePoints(const fileName& prefix) const
{
OFstream os(prefix + ".vrt");
writeHeader(os, "VERTEX");
......@@ -216,7 +216,10 @@ void Foam::meshWriters::STARCD::writePoints(const fileName& prefix) const
}
void Foam::meshWriters::STARCD::writeCells(const fileName& prefix) const
void Foam::fileFormats::STARCDMeshWriter::writeCells
(
const fileName& prefix
) const
{
OFstream os(prefix + ".cel");
writeHeader(os, "CELL");
......@@ -358,7 +361,10 @@ void Foam::meshWriters::STARCD::writeCells(const fileName& prefix) const
}
void Foam::meshWriters::STARCD::writeBoundary(const fileName& prefix) const
void Foam::fileFormats::STARCDMeshWriter::writeBoundary
(
const fileName& prefix
) const
{
OFstream os(prefix + ".bnd");
writeHeader(os, "BOUNDARY");
......@@ -464,7 +470,7 @@ void Foam::meshWriters::STARCD::writeBoundary(const fileName& prefix) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::meshWriters::STARCD::STARCD
Foam::fileFormats::STARCDMeshWriter::STARCDMeshWriter
(
const polyMesh& mesh,
const scalar scaleFactor
......@@ -480,13 +486,13 @@ Foam::meshWriters::STARCD::STARCD
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::meshWriters::STARCD::~STARCD()
Foam::fileFormats::STARCDMeshWriter::~STARCDMeshWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::meshWriters::STARCD::rmFiles(const fileName& baseName) const
void Foam::fileFormats::STARCDMeshWriter::rmFiles(const fileName& baseName) const
{
rm(baseName + ".vrt");
rm(baseName + ".cel");
......@@ -495,7 +501,7 @@ void Foam::meshWriters::STARCD::rmFiles(const fileName& baseName) const
}
bool Foam::meshWriters::STARCD::write(const fileName& meshName) const
bool Foam::fileFormats::STARCDMeshWriter::write(const fileName& meshName) const
{
fileName baseName(meshName);
......
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::meshWriters::STARCD
Foam::fileFormats::STARCDMeshWriter
Description
Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
......@@ -46,14 +46,14 @@ SourceFiles
namespace Foam
{
namespace meshWriters
namespace fileFormats
{
/*---------------------------------------------------------------------------*\
Class meshWriters::STARCD Declaration
Class fileFormats::STARCDMeshWriter Declaration
\*---------------------------------------------------------------------------*/
class STARCD
class STARCDMeshWriter
:
public meshWriter
{
......@@ -65,10 +65,10 @@ class STARCD
// Private Member Functions
//- Disallow default bitwise copy construct
STARCD(const STARCD&);
STARCDMeshWriter(const STARCDMeshWriter&) = delete;
//- Disallow default bitwise assignment
void operator=(const STARCD&);
void operator=(const STARCDMeshWriter&) = delete;
//- Pro-STAR 4+ header format
static void writeHeader(Ostream&, const char* filetype);
......@@ -97,16 +97,12 @@ public:
// Constructors
//- Open a file for writing
STARCD
(
const polyMesh&,
const scalar scaleFactor = 1.0
);
//- Write mesh files in PROSTAR format
STARCDMeshWriter(const polyMesh&, const scalar scaleFactor = 1.0);
//- Destructor
virtual ~STARCD();
virtual ~STARCDMeshWriter();
// Member Functions
......@@ -130,7 +126,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace meshWriters
} // End namespace fileFormats
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment