Commit 6578ada1 authored by Andrew Heather's avatar Andrew Heather
Browse files

minor formatting changes/clean-up

parent 26ef8829
......@@ -28,16 +28,12 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// allow undef in results
bool Foam::ensightFile::allowUndef_ = false;
// value to represent undef in results
Foam::scalar Foam::ensightFile::undefValue_ = Foam::floatScalarVGREAT;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from pathname
Foam::ensightFile::ensightFile
(
const fileName& pathname,
......@@ -55,6 +51,7 @@ Foam::ensightFile::ensightFile
precision(5);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightFile::~ensightFile()
......@@ -88,7 +85,6 @@ Foam::scalar Foam::ensightFile::undefValue(const scalar& value)
}
// binary write
Foam::Ostream& Foam::ensightFile::write
(
const char* buf,
......@@ -100,11 +96,7 @@ Foam::Ostream& Foam::ensightFile::write
}
// write string as "%80s" or as binary
Foam::Ostream& Foam::ensightFile::write
(
const string& value
)
Foam::Ostream& Foam::ensightFile::write(const string& value)
{
char buf[80];
......@@ -141,11 +133,7 @@ Foam::Ostream& Foam::ensightFile::write
}
// write integer as "%10d" or as binary
Foam::Ostream& Foam::ensightFile::write
(
const label& value
)
Foam::Ostream& Foam::ensightFile::write(const label& value)
{
if (format() == IOstream::BINARY)
{
......@@ -167,7 +155,6 @@ Foam::Ostream& Foam::ensightFile::write
}
// write integer with specified width or as binary
Foam::Ostream& Foam::ensightFile::write
(
const label& value,
......@@ -194,11 +181,7 @@ Foam::Ostream& Foam::ensightFile::write
}
// write float as "%12.5e" or as binary
Foam::Ostream& Foam::ensightFile::write
(
const scalar& value
)
Foam::Ostream& Foam::ensightFile::write(const scalar& value)
{
if (format() == IOstream::BINARY)
{
......@@ -220,7 +203,6 @@ Foam::Ostream& Foam::ensightFile::write
}
// Add carriage return to ascii stream
void Foam::ensightFile::newline()
{
if (format() == IOstream::ASCII)
......@@ -230,7 +212,6 @@ void Foam::ensightFile::newline()
}
// write undef value
Foam::Ostream& Foam::ensightFile::writeUndef()
{
write(undefValue_);
......@@ -238,11 +219,7 @@ Foam::Ostream& Foam::ensightFile::writeUndef()
}
// write element keyword with trailing newline, optionally with undef
Foam::Ostream& Foam::ensightFile::writeKeyword
(
const string& key
)
Foam::Ostream& Foam::ensightFile::writeKeyword(const string& key)
{
if (allowUndef_)
{
......@@ -260,7 +237,6 @@ Foam::Ostream& Foam::ensightFile::writeKeyword
}
// write "C Binary" for binary files
Foam::Ostream& Foam::ensightFile::writeBinaryHeader()
{
if (format() == IOstream::BINARY)
......@@ -274,8 +250,6 @@ Foam::Ostream& Foam::ensightFile::writeBinaryHeader()
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// '*' mask appropriate for subDir
Foam::string Foam::ensightFile::mask()
{
char buf[16] = "********";
......@@ -283,7 +257,6 @@ Foam::string Foam::ensightFile::mask()
}
// consistent zero-padded numbers for subdirectories
Foam::string Foam::ensightFile::subDir(const label n)
{
char buf[16];
......@@ -293,6 +266,4 @@ Foam::string Foam::ensightFile::subDir(const label n)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -30,12 +30,15 @@ Description
Correctly handles binary write as well.
\*---------------------------------------------------------------------------*/
#ifndef ensightFile_H
#define ensightFile_H
#include "OFstream.H"
#include "IOstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
......@@ -47,19 +50,26 @@ class ensightFile
:
public OFstream
{
//- allow undef in results
static bool allowUndef_;
// Private data
//- allow undef in results
static bool allowUndef_;
//- value to represent undef in results
static scalar undefValue_;
//- value to represent undef in results
static scalar undefValue_;
//- Disallow default bitwise assignment
void operator=(const ensightFile&);
//- Disallow default copy constructor
ensightFile(const ensightFile&);
// Private member functions
//- Disallow default bitwise assignment
void operator=(const ensightFile&);
//- Disallow default copy constructor
ensightFile(const ensightFile&);
public:
// Constructors
//- Construct from pathname
......@@ -69,10 +79,13 @@ public:
IOstream::streamFormat format=IOstream::BINARY
);
// Destructor
~ensightFile();
~ensightFile();
// Access
//- Return setting for whether 'undef' values are allowed in results
static bool allowUndef();
......@@ -82,7 +95,9 @@ public:
//- consistent zero-padded numbers for subdirectories
static string subDir(const label);
// Edit
static bool allowUndef(bool);
//- Assign the value to represent undef in the results
......@@ -90,6 +105,7 @@ public:
// NB: do not use values larger than floatScalarVGREAT
static scalar undefValue(const scalar&);
// Output
//- binary write
......@@ -125,6 +141,8 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -28,8 +28,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from pathname
Foam::ensightGeoFile::ensightGeoFile
(
const fileName& pathname,
......@@ -53,11 +51,7 @@ Foam::ensightGeoFile::~ensightGeoFile()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// write keyword with trailing newline
Foam::Ostream& Foam::ensightGeoFile::writeKeyword
(
const string& key
)
Foam::Ostream& Foam::ensightGeoFile::writeKeyword(const string& key)
{
write(key);
newline();
......@@ -65,6 +59,5 @@ Foam::Ostream& Foam::ensightGeoFile::writeKeyword
return *this;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -29,28 +29,36 @@ Description
Specialized Ensight output with extra geometry file header
\*---------------------------------------------------------------------------*/
#ifndef ensightGeoFile_H
#define ensightGeoFile_H
#include "ensightFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ensightGeoFile Declaration
\*---------------------------------------------------------------------------*/
class ensightGeoFile
:
public ensightFile
{
//- Disallow default bitwise assignment
void operator=(const ensightGeoFile&);
// Private member functions
//- Disallow default bitwise assignment
void operator=(const ensightGeoFile&);
//- Disallow default copy constructor
ensightGeoFile(const ensightGeoFile&);
//- Disallow default copy constructor
ensightGeoFile(const ensightGeoFile&);
public:
// Constructors
//- Construct from pathname
......@@ -60,21 +68,23 @@ public:
IOstream::streamFormat format=IOstream::BINARY
);
// Destructor
~ensightGeoFile();
//- Destructor
~ensightGeoFile();
// Output
//- write keyword with trailing newline
virtual Ostream& writeKeyword(const string& key);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
......@@ -41,11 +41,7 @@ Foam::List<Foam::word> Foam::ensightPart::elemTypes_(0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
//- check for fully defined fields
bool Foam::ensightPart::isFieldDefined
(
const List<scalar>& field
) const
bool Foam::ensightPart::isFieldDefined(const List<scalar>& field) const
{
forAll(elemLists_, elemI)
{
......@@ -67,7 +63,6 @@ bool Foam::ensightPart::isFieldDefined
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
Foam::ensightPart::ensightPart
()
:
......@@ -82,7 +77,6 @@ Foam::ensightPart::ensightPart
{}
// Construct empty part with number and description
Foam::ensightPart::ensightPart
(
label partNumber,
......@@ -100,7 +94,6 @@ Foam::ensightPart::ensightPart
{}
// Construct empty part with number and description
Foam::ensightPart::ensightPart
(
label partNumber,
......@@ -119,11 +112,7 @@ Foam::ensightPart::ensightPart
{}
// Construct as copy
Foam::ensightPart::ensightPart
(
const ensightPart& part
)
Foam::ensightPart::ensightPart(const ensightPart& part)
:
number_(part.number_),
name_(part.name_),
......@@ -138,7 +127,6 @@ Foam::ensightPart::ensightPart
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
// runtime selection
Foam::autoPtr<Foam::ensightPart> Foam::ensightPart::New(Istream& is)
{
word partType(is);
......@@ -161,6 +149,7 @@ Foam::autoPtr<Foam::ensightPart> Foam::ensightPart::New(Istream& is)
return autoPtr<ensightPart>(cstrIter()(is));
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightPart::~ensightPart()
......@@ -169,7 +158,6 @@ Foam::ensightPart::~ensightPart()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// reconstruct from Istream
void Foam::ensightPart::reconstruct(Istream& is)
{
dictionary dict(is);
......@@ -198,7 +186,6 @@ void Foam::ensightPart::reconstruct(Istream& is)
}
// renumber elements
void Foam::ensightPart::renumber(labelList const& origId)
{
// transform to global values first
......@@ -226,6 +213,4 @@ void Foam::ensightPart::renumber(labelList const& origId)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -63,9 +63,9 @@ class ensightPart
// Static data members
static List<word> elemTypes_;
// Private Member Functions
protected:
// Protected data
//- part number
......@@ -92,6 +92,7 @@ protected:
//- mesh reference used
const polyMesh* meshPtr_;
// Protected Classes
//- track the points used by the part and map global to local indices
......@@ -155,12 +156,12 @@ protected:
) const
{}
public:
//- Runtime type information
TypeName("ensightPart");
// Public data
// Constructors
......@@ -206,9 +207,9 @@ public:
static autoPtr<ensightPart> New(Istream& is);
// Destructor
//- Destructor
virtual ~ensightPart();
virtual ~ensightPart();
// Static members
......@@ -217,6 +218,7 @@ public:
return elemTypes_;
}
// Access
//- number of elements in this part
......@@ -272,6 +274,7 @@ public:
return offset_;
}
// Edit
//- renumber elements
......@@ -332,7 +335,6 @@ public:
ensightGeoFile&,
const ensightPart&
);
};
......
......@@ -40,7 +40,6 @@ namespace Foam
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream);
}
// names for addressable ensight element types
Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
(
IStringStream
......@@ -52,11 +51,7 @@ Foam::List<Foam::word> Foam::ensightPartCells::elemTypes_
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// classify the cell types, track the points used
void Foam::ensightPartCells::classify
(
const labelList& idList
)
void Foam::ensightPartCells::classify(const labelList& idList)
{
// References to cell shape models
const cellModel& tet = *(cellModeller::lookup("tet"));
......@@ -229,7 +224,6 @@ void Foam::ensightPartCells::classify
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct empty part with number and description
Foam::ensightPartCells::ensightPartCells
(
label partNumber,
......@@ -240,7 +234,6 @@ Foam::ensightPartCells::ensightPartCells
{}
// Construct from polyMesh without zones
Foam::ensightPartCells::ensightPartCells
(
label partNumber,
......@@ -253,7 +246,6 @@ Foam::ensightPartCells::ensightPartCells
}
// Construct from polyMesh and list of (non-zoned) cells
Foam::ensightPartCells::ensightPartCells
(
label partNumber,
......@@ -267,7 +259,6 @@ Foam::ensightPartCells::ensightPartCells
}
// Construct from polyMesh and cellZone
Foam::ensightPartCells::ensightPartCells
(
label partNumber,
......@@ -281,21 +272,13 @@ Foam::ensightPartCells::ensightPartCells
}
// Construct as copy
Foam::ensightPartCells::ensightPartCells
(
const ensightPartCells& part
)
Foam::ensightPartCells::ensightPartCells(const ensightPartCells& part)
:
ensightPart(part)
{}
// Construct from Istream
Foam::ensightPartCells::ensightPartCells
(
Istream& is
)
Foam::ensightPartCells::ensightPartCells(Istream& is)
:
ensightPart()
{
......@@ -305,15 +288,12 @@ Foam::ensightPartCells::ensightPartCells
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::ensightPartCells::~ensightPartCells()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// track the points used
Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const
{
const polyMesh& mesh = *meshPtr_;
......@@ -362,7 +342,6 @@ Foam::ensightPart::localPoints Foam::ensightPartCells::calcLocalPoints() const
}
// write cell connectivities
void Foam::ensightPartCells::writeConnectivity
(
ensightGeoFile& os,
......@@ -449,6 +428,4 @@ void Foam::ensightPartCells::writeConnectivity
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -52,8 +52,6 @@ class ensightPartCells
:
public ensightPart
{
// Private data
// Private Member Functions
//- Disallow default bitwise assignment
......@@ -77,6 +75,7 @@ class ensightPartCells
const labelList& pointMap
) const;
protected:
//- addressable Ensight element types
......@@ -135,9 +134,8 @@ public:
}
// Destructor
virtual ~ensightPartCells();
//- Destructor
virtual ~ensightPartCells();
// Member Functions
......@@ -147,7 +145,6 @@ public:
{
return elemTypes_;
}
};
......
......@@ -31,13 +31,14 @@ License
#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(ensightPartFaces, 0);
addToRunTimeSelectionTable(ensightPart, ensightPartFaces, istream);
}
// names for addressable ensight element types
Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
(
IStringStream
......@@ -46,9 +47,9 @@ Foam::List<Foam::word> Foam::ensightPartFaces::elemTypes_
)()
);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct empty part with number and description
Foam::ensightPartFaces::ensightPartFaces
(
label partNumber,
......@@ -61,7 +62,6 @@ Foam::ensightPartFaces::ensightPartFaces
}