Commit a8f01535 authored by Andrew Heather's avatar Andrew Heather
Browse files

code clean-up

parent be9f2b33
......@@ -26,13 +26,9 @@ License
#include "MeshedSurfaceIOAllocator.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::MeshedSurfaceIOAllocator::MeshedSurfaceIOAllocator
(
const IOobject& ioPoints,
......
......@@ -63,6 +63,7 @@ class MeshedSurfaceIOAllocator
//- Surface zones
surfZoneIOList zones_;
// Private Member Functions
//- Disallow default bitwise copy construct
......@@ -71,6 +72,7 @@ class MeshedSurfaceIOAllocator
//- Disallow default bitwise assignment
void operator=(const MeshedSurfaceIOAllocator&);
public:
// Constructors
......@@ -179,7 +181,6 @@ public:
const Xfer< faceList >& faces,
const Xfer< surfZoneList >& zones
);
};
......
......@@ -216,7 +216,6 @@ void Foam::MeshedSurfaceProxy<Face>::write
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Face>
......@@ -242,20 +241,4 @@ Foam::MeshedSurfaceProxy<Face>::~MeshedSurfaceProxy()
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
......@@ -76,13 +76,14 @@ class MeshedSurfaceProxy
const List<label>& faceMap_;
public:
// Static
//- Runtime type information
ClassName("MeshedSurfaceProxy");
// Static
//- The file format types that can be written via MeshedSurfaceProxy
static wordHashSet writeTypes();
......@@ -101,6 +102,7 @@ public:
const List<label>& faceMap = List<label>()
);
// Destructor
virtual ~MeshedSurfaceProxy();
......@@ -127,53 +129,50 @@ public:
// Member Functions
// Access
//- Return const access to the points
inline const pointField& points() const
{
return points_;
}
//- Return const access to the faces
inline const List<Face>& faces() const
{
return faces_;
}
//- Const access to the surface zones.
// If zones are defined, they must be contiguous and cover the entire
// surface.
inline const List<surfZone>& surfZones() const
{
return zones_;
}
//- Const access to the faceMap, zero-sized when unused
inline const List<label>& faceMap() const
{
return faceMap_;
}
//- Use faceMap?
inline bool useFaceMap() const
{
return faceMap_.size() == faces_.size();
}
// Write
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
//- Write to database
virtual void write(const Time&, const word& surfName = "") const;
//?? void writeStats(Ostream& os) const;
// Access
//- Return const access to the points
inline const pointField& points() const
{
return points_;
}
//- Return const access to the faces
inline const List<Face>& faces() const
{
return faces_;
}
//- Const access to the surface zones.
// If zones are defined, they must be contiguous and cover the
// entire surface
inline const List<surfZone>& surfZones() const
{
return zones_;
}
//- Const access to the faceMap, zero-sized when unused
inline const List<label>& faceMap() const
{
return faceMap_;
}
//- Use faceMap?
inline bool useFaceMap() const
{
return faceMap_.size() == faces_.size();
}
// Write
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
//- Write to database
virtual void write(const Time&, const word& surfName = "") const;
};
......
......@@ -33,8 +33,6 @@ License
#include "polyBoundaryMesh.H"
#include "polyMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
template<class Face>
......@@ -301,10 +299,6 @@ Foam::UnsortedMeshedSurface<Face>::~UnsortedMeshedSurface()
{}
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Face>
......@@ -694,7 +688,6 @@ Foam::UnsortedMeshedSurface<Face>::xfer()
}
// Read from file, determine format from extension
template<class Face>
bool Foam::UnsortedMeshedSurface<Face>::read(const fileName& name)
......@@ -773,11 +766,6 @@ Foam::MeshedSurfaceProxy<Face>() const
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "UnsortedMeshedSurfaceNew.C"
......
......@@ -91,6 +91,7 @@ private:
typedef MeshedSurface<Face> FriendType;
typedef MeshedSurfaceProxy<Face> ProxyType;
// Private Member Data
//- The zone Id associated with each face
......@@ -100,6 +101,7 @@ private:
// during reading and writing)
List<surfZoneIdentifier> zoneToc_;
// Private member functions
//- Disable resize with value
......@@ -111,6 +113,7 @@ private:
//- Read OpenFOAM Surface format
bool read(Istream&);
protected:
// Protected Member functions
......@@ -130,11 +133,13 @@ protected:
//- Set new zones from faceMap
virtual void remapFaces(const UList<label>& faceMap);
public:
//- Runtime type information
TypeName("UnsortedMeshedSurface");
// Static
//- Can we read this file format?
......@@ -149,6 +154,7 @@ public:
static wordHashSet readTypes();
static wordHashSet writeTypes();
// Constructors
//- Construct null
......@@ -198,6 +204,7 @@ public:
//- Construct from objectRegistry and a named surface
UnsortedMeshedSurface(const Time&, const word& surfName="");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
......@@ -211,6 +218,7 @@ public:
(name)
);
// Selectors
//- Select constructed from filename (explicit extension)
......@@ -223,6 +231,7 @@ public:
//- Select constructed from filename (implicit extension)
static autoPtr<UnsortedMeshedSurface> New(const fileName&);
// Destructor
virtual ~UnsortedMeshedSurface();
......@@ -249,120 +258,119 @@ public:
// Member Functions
// Access
// Access
//- The surface size is the number of faces
label size() const
{
return ParentType::size();
}
//- The surface size is the number of faces
label size() const
{
return ParentType::size();
}
//- Reset size of face and zone list
void setSize(const label);
//- Reset size of face and zone list
void setSize(const label);
//- Return const access to the zone ids
const List<label>& zoneIds() const
{
return zoneIds_;
}
//- Return const access to the zone ids
const List<label>& zoneIds() const
{
return zoneIds_;
}
//- Return const access to the zone table-of-contents
const List<surfZoneIdentifier>& zoneToc() const
{
return zoneToc_;
}
//- Return const access to the zone table-of-contents
const List<surfZoneIdentifier>& zoneToc() const
{
return zoneToc_;
}
//- Sort faces according to zoneIds
// Returns a surfZoneList and sets faceMap to index within faces()
surfZoneList sortedZones(labelList& faceMap) const;
//- Sort faces according to zoneIds
// Returns a surfZoneList and sets faceMap to index within faces()
surfZoneList sortedZones(labelList& faceMap) const;
//- Set zones to 0 and set a single zone
void setOneZone();
//- Set zones to 0 and set a single zone
void setOneZone();
//- Set zone ids and zones
void setZones(const surfZoneList&);
//- Set zone ids and zones
void setZones(const surfZoneList&);
//- Set zone ids and zones
void setZones(const UList<label>& sizes, const UList<word>& names);
//- Set zone ids and zones
void setZones(const UList<label>& sizes, const UList<word>& names);
//- Set zone ids and zones with default names
void setZones(const UList<label>& sizes);
//- Set zone ids and zones with default names
void setZones(const UList<label>& sizes);
// Edit
// Edit
//- Clear all storage
virtual void clear();
//- Clear all storage
virtual void clear();
//- Return new surface.
// Returns return pointMap, faceMap from subsetMeshMap
UnsortedMeshedSurface subsetMesh
(
const labelHashSet& include,
labelList& pointMap,
labelList& faceMap
) const;
//- Return new surface.
UnsortedMeshedSurface subsetMesh
(
const labelHashSet& include
) const;
//- Return new surface.
// Returns return pointMap, faceMap from subsetMeshMap
UnsortedMeshedSurface subsetMesh
(
const labelHashSet& include,
labelList& pointMap,
labelList& faceMap
) const;
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
);
//- Return new surface.
UnsortedMeshedSurface subsetMesh
(
const labelHashSet& include
) const;
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< List<point> >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
);
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< pointField >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
);
//- Transfer the contents of the argument and annull the argument
void transfer(UnsortedMeshedSurface<Face>&);
//- Transfer components (points, faces, zone ids).
virtual void reset
(
const Xfer< List<point> >&,
const Xfer< List<Face> >&,
const Xfer< List<label> >& zoneIds
);
//- Transfer the contents of the argument and annull the argument
void transfer(MeshedSurface<Face>&);
//- Transfer the contents of the argument and annull the argument
void transfer(UnsortedMeshedSurface<Face>&);
//- Transfer contents to the Xfer container
Xfer< UnsortedMeshedSurface<Face> > xfer();
//- Transfer the contents of the argument and annull the argument
void transfer(MeshedSurface<Face>&);
//- Transfer contents to the Xfer container
Xfer< UnsortedMeshedSurface<Face> > xfer();
// Read
//- Read from file. Chooses reader based on explicit extension
bool read(const fileName&, const word& ext);
// Read
//- Read from file. Chooses reader based on detected extension
virtual bool read(const fileName&);
//- Read from file. Chooses reader based on explicit extension
bool read(const fileName&, const word& ext);
//- Read from file. Chooses reader based on detected extension
virtual bool read(const fileName&);
// Write
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
// Write
//- Write to database
void write(const Time&, const word& surfName="") const;
//- Generic write routine. Chooses writer based on extension.
virtual void write(const fileName& name) const
{
write(name, *this);
}
//- Write to database
void write(const Time&, const word& surfName="") const;
// Member operators
void operator=(const UnsortedMeshedSurface<Face>&);
// Member operators
//- Conversion operator to MeshedSurfaceProxy
operator MeshedSurfaceProxy<Face>() const;
void operator=(const UnsortedMeshedSurface<Face>&);
//- Conversion operator to MeshedSurfaceProxy
operator MeshedSurfaceProxy<Face>() const;
};
......
......@@ -28,7 +28,6 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Face>
Foam::autoPtr< Foam::UnsortedMeshedSurface<Face> >
Foam::UnsortedMeshedSurface<Face>::New(const fileName& name, const word& ext)
......@@ -68,7 +67,7 @@ Foam::UnsortedMeshedSurface<Face>::New(const fileName& name, const word& ext)
"(const fileName&, const word&) : "
"constructing UnsortedMeshedSurface"
) << "Unknown file extension " << ext << nl << nl
<< "Valid types are :" << nl
<< "Valid types are:" << nl
<< supported
<< exit(FatalError);
}
......@@ -90,4 +89,5 @@ Foam::UnsortedMeshedSurface<Face>::New(const fileName& name)
return New(name, ext);
}
// ************************************************************************* //
......@@ -31,6 +31,8 @@ License
namespace Foam
{
// Forward declaration of classes
class face;
class triFace;
......
......@@ -76,7 +76,6 @@ public:
{
return size(mesh_);
}
};
......
......@@ -76,7 +76,6 @@ public:
{
return size(mesh_);
}
};
......
......@@ -70,7 +70,6 @@ Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfMesh::surfMesh(const IOobject& io, const word& surfName)
:
surfaceRegistry(io.db(), (surfName.size() ? surfName : io.name())),
......@@ -215,6 +214,7 @@ Foam::surfMesh::surfMesh
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfMesh::~surfMesh()
......@@ -271,7 +271,6 @@ void Foam::surfMesh::resetPrimitives
}
void Foam::surfMesh::transfer
(
MeshedSurface<face>& surf
......@@ -330,21 +329,25 @@ Foam::label Foam::surfMesh::nPoints() const
return this->points().size();
}
Foam::label Foam::surfMesh::nFaces() const
{
return this->faces().size();
}
const Foam::pointField& Foam::surfMesh::points() const
{
return this->storedIOPoints();
}