Commit c21cbfb3 authored by mattijs's avatar mattijs
Browse files

ENH: use CompactIOList for binary face and cell IOList.

parent 5d97b8dc
......@@ -166,10 +166,10 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << endl;
// Convert all the standard mesh files
writeMeshObject<cellIOList>("cells", meshDir, runTime);
writeMeshObject<cellCompactIOList>("cells", meshDir, runTime);
writeMeshObject<labelIOList>("owner", meshDir, runTime);
writeMeshObject<labelIOList>("neighbour", meshDir, runTime);
writeMeshObject<faceIOList>("faces", meshDir, runTime);
writeMeshObject<faceCompactIOList>("faces", meshDir, runTime);
writeMeshObject<pointIOField>("points", meshDir, runTime);
writeMeshObject<labelIOList>("pointProcAddressing", meshDir, runTime);
writeMeshObject<labelIOList>("faceProcAddressing", meshDir, runTime);
......
......@@ -23,13 +23,13 @@ License
\*---------------------------------------------------------------------------*/
#include "IOListList.H"
#include "CompactIOList.H"
#include "labelList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::readFromStream()
void Foam::CompactIOList<T, BaseType>::readFromStream()
{
Istream& is = readStream(word::null);
......@@ -47,7 +47,7 @@ void Foam::IOListList<T, BaseType>::readFromStream()
{
FatalIOErrorIn
(
"IOListList<T, BaseType>::readFromStream()",
"CompactIOList<T, BaseType>::readFromStream()",
is
) << "unexpected class name " << headerClassName()
<< " expected " << typeName << " or " << IOList<T>::typeName
......@@ -61,7 +61,7 @@ void Foam::IOListList<T, BaseType>::readFromStream()
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList(const IOobject& io)
Foam::CompactIOList<T, BaseType>::CompactIOList(const IOobject& io)
:
regIOobject(io)
{
......@@ -77,7 +77,11 @@ Foam::IOListList<T, BaseType>::IOListList(const IOobject& io)
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList(const IOobject& io, const label size)
Foam::CompactIOList<T, BaseType>::CompactIOList
(
const IOobject& io,
const label size
)
:
regIOobject(io)
{
......@@ -97,7 +101,7 @@ Foam::IOListList<T, BaseType>::IOListList(const IOobject& io, const label size)
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList
Foam::CompactIOList<T, BaseType>::CompactIOList
(
const IOobject& io,
const List<T>& list
......@@ -121,7 +125,7 @@ Foam::IOListList<T, BaseType>::IOListList
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::IOListList
Foam::CompactIOList<T, BaseType>::CompactIOList
(
const IOobject& io,
const Xfer<List<T> >& list
......@@ -145,7 +149,7 @@ Foam::IOListList<T, BaseType>::IOListList
// * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
template<class T, class BaseType>
Foam::IOListList<T, BaseType>::~IOListList()
Foam::CompactIOList<T, BaseType>::~CompactIOList()
{}
......@@ -153,7 +157,7 @@ Foam::IOListList<T, BaseType>::~IOListList()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, class BaseType>
bool Foam::IOListList<T, BaseType>::writeObject
bool Foam::CompactIOList<T, BaseType>::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
......@@ -182,7 +186,7 @@ bool Foam::IOListList<T, BaseType>::writeObject
template<class T, class BaseType>
bool Foam::IOListList<T, BaseType>::writeData(Ostream& os) const
bool Foam::CompactIOList<T, BaseType>::writeData(Ostream& os) const
{
return (os << *this).good();
}
......@@ -191,9 +195,9 @@ bool Foam::IOListList<T, BaseType>::writeData(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::operator=
void Foam::CompactIOList<T, BaseType>::operator=
(
const IOListList<T, BaseType>& rhs
const CompactIOList<T, BaseType>& rhs
)
{
List<T>::operator=(rhs);
......@@ -201,7 +205,7 @@ void Foam::IOListList<T, BaseType>::operator=
template<class T, class BaseType>
void Foam::IOListList<T, BaseType>::operator=(const List<T>& rhs)
void Foam::CompactIOList<T, BaseType>::operator=(const List<T>& rhs)
{
List<T>::operator=(rhs);
}
......@@ -213,7 +217,7 @@ template<class T, class BaseType>
Foam::Istream& Foam::operator>>
(
Foam::Istream& is,
Foam::IOListList<T, BaseType>& L
Foam::CompactIOList<T, BaseType>& L
)
{
// Read compact
......@@ -244,7 +248,7 @@ template<class T, class BaseType>
Foam::Ostream& Foam::operator<<
(
Foam::Ostream& os,
const Foam::IOListList<T, BaseType>& L
const Foam::CompactIOList<T, BaseType>& L
)
{
// Keep ascii writing same.
......
......@@ -22,18 +22,22 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IOListList
Foam::CompactIOList
Description
A List of objects of type \<T\> with automated input and output.
A List of objects of type \<T\> with automated input and output using
a compact storage. Behaves like IOList except when binary output in
case it writes a CompactListList.
Useful for lists of small sublists e.g. faceList, cellList.
SourceFiles
IOListList.C
CompactIOList.C
\*---------------------------------------------------------------------------*/
#ifndef IOListList_H
#define IOListList_H
#ifndef CompactIOList_H
#define CompactIOList_H
#include "IOList.H"
#include "regIOobject.H"
......@@ -47,25 +51,25 @@ class Istream;
class Ostream;
// Forward declaration of friend functions and operators
template<class T, class BaseType> class IOListList;
template<class T, class BaseType> class CompactIOList;
template<class T, class BaseType> Istream& operator>>
(
Istream&,
IOListList<T, BaseType>&
CompactIOList<T, BaseType>&
);
template<class T, class BaseType> Ostream& operator<<
(
Ostream&,
const IOListList<T, BaseType>&
const CompactIOList<T, BaseType>&
);
/*---------------------------------------------------------------------------*\
Class IOListList Declaration
Class CompactIOList Declaration
\*---------------------------------------------------------------------------*/
template<class T, class BaseType>
class IOListList
class CompactIOList
:
public regIOobject,
public List<T>
......@@ -78,27 +82,27 @@ class IOListList
public:
//- Runtime type information
TypeName("ListList");
TypeName("CompactList");
// Constructors
//- Construct from IOobject
IOListList(const IOobject&);
CompactIOList(const IOobject&);
//- Construct from IOobject and size of IOListList
IOListList(const IOobject&, const label);
//- Construct from IOobject and size of CompactIOList
CompactIOList(const IOobject&, const label);
//- Construct from IOobject and a List
IOListList(const IOobject&, const List<T>&);
CompactIOList(const IOobject&, const List<T>&);
//- Construct by transferring the List contents
IOListList(const IOobject&, const Xfer<List<T> >&);
CompactIOList(const IOobject&, const Xfer<List<T> >&);
// Destructor
virtual ~IOListList();
virtual ~CompactIOList();
// Member functions
......@@ -115,7 +119,7 @@ public:
// Member operators
void operator=(const IOListList<T, BaseType>&);
void operator=(const CompactIOList<T, BaseType>&);
void operator=(const List<T>&);
......@@ -126,14 +130,14 @@ public:
friend Istream& operator>> <T, BaseType>
(
Istream&,
IOListList<T, BaseType>&
CompactIOList<T, BaseType>&
);
// Write List to Ostream.
friend Ostream& operator<< <T, BaseType>
(
Ostream&,
const IOListList<T, BaseType>&
const CompactIOList<T, BaseType>&
);
};
......@@ -145,7 +149,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IOListList.C"
# include "CompactIOList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -35,7 +35,8 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0);
defineTemplateTypeNameAndDebugWithName(cellIOList, "cellList", 0);
defineTemplateTypeNameAndDebugWithName(cellCompactIOList, "cellCompactList", 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,13 +33,14 @@ Description
#define cellIOList_H
#include "cell.H"
#include "IOList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<cell> cellIOList;
typedef CompactIOList<cell, label> cellCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,10 +33,14 @@ Description
namespace Foam
{
defineCompoundTypeName(List<edge>, edgeList);
addCompoundToRunTimeSelectionTable(List<edge>, edgeList);
defineTemplateTypeNameAndDebugWithName(edgeIOList, "edgeList", 0);
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineCompoundTypeName(List<edge>, edgeList);
addCompoundToRunTimeSelectionTable(List<edge>, edgeList);
defineTemplateTypeNameAndDebugWithName(edgeIOList, "edgeList", 0);
defineTemplateTypeNameAndDebugWithName(edgeCompactIOList, "edgeCompactList", 0);
}
// ************************************************************************* //
......@@ -33,13 +33,14 @@ Description
#define edgeIOList_H
#include "edge.H"
#include "IOList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<edge> edgeIOList;
typedef CompactIOList<edge, label> edgeCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -36,6 +36,12 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplateTypeNameAndDebugWithName(faceIOList, "faceList", 0);
defineTemplateTypeNameAndDebugWithName
(
faceCompactIOList,
"faceCompactList",
0
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,13 +33,14 @@ Description
#define faceIOList_H
#include "face.H"
#include "IOList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<face> faceIOList;
typedef CompactIOList<face, label> faceCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -272,7 +272,7 @@ Foam::polyMesh::polyMesh(const IOobject& io)
}
else
{
cellIOList cLst
cellCompactIOList cLst
(
IOobject
(
......
......@@ -101,7 +101,7 @@ private:
pointIOField points_;
//- Faces
faceIOList faces_;
faceCompactIOList faces_;
//- Face owner
labelIOList owner_;
......
......@@ -112,7 +112,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
)
);
faces_ = faceIOList
faces_ = faceCompactIOList
(
IOobject
(
......@@ -238,7 +238,7 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate()
}
else
{
cellIOList cells
cellCompactIOList cells
(
IOobject
(
......
......@@ -21,10 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of IOList and IOListList ClassNames for IOListLists that
do not have .C files.
\*---------------------------------------------------------------------------*/
#include "labelListIOList.H"
......@@ -38,8 +34,8 @@ namespace Foam
defineTemplateTypeNameAndDebugWithName
(
labelIOListList,
"labelCompactListList",
labelListCompactIOList,
"labelListCompactList",
0
);
}
......
......@@ -33,15 +33,14 @@ Description
#define labelListIOList_H
#include "labelList.H"
#include "IOList.H"
#include "IOListList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<labelList> labelListIOList;
typedef IOListList<labelList, label> labelIOListList;
typedef CompactIOList<labelList, label> labelListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -21,10 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of IOList and IOListList ClassNames for IOListLists that
do not have .C files.
\*---------------------------------------------------------------------------*/
#include "scalarListIOList.H"
......@@ -43,8 +39,8 @@ namespace Foam
defineTemplateTypeNameAndDebugWithName
(
scalarIOListList,
"scalarCompactListList",
scalarListCompactIOList,
"scalarListCompactList",
0
);
}
......
......@@ -33,15 +33,14 @@ Description
#define scalarListIOList_H
#include "scalarList.H"
#include "IOList.H"
#include "IOListList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<scalarList> scalarListIOList;
typedef IOListList<scalarList, scalar> scalarIOListList;
typedef CompactIOList<scalarList, scalar> scalarListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -21,10 +21,6 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Declaration of IOList and IOListList ClassNames for IOListLists that
do not have .C files.
\*---------------------------------------------------------------------------*/
#include "vectorListIOList.H"
......@@ -43,8 +39,8 @@ namespace Foam
defineTemplateTypeNameAndDebugWithName
(
vectorIOListList,
"vectorCompactListList",
vectorListCompactIOList,
"vectorListCompactList",
0
);
}
......
......@@ -25,7 +25,7 @@ Typedef
Foam::vectorListIOList
Description
Scalar container classes
Lists of vectors container class
\*---------------------------------------------------------------------------*/
......@@ -33,15 +33,14 @@ Description
#define vectorListIOList_H
#include "vectorList.H"
#include "IOList.H"
#include "IOListList.H"
#include "CompactIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<vectorList> vectorListIOList;
typedef IOListList<vectorList, vector> vectorIOListList;
typedef CompactIOList<vectorList, vector> vectorListCompactIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -56,7 +56,7 @@ class MeshedSurfaceIOAllocator
pointIOField points_;
//- Faces
faceIOList faces_;
faceCompactIOList faces_;
//- Surface zones
surfZoneIOList zones_;
......@@ -117,7 +117,7 @@ public:
}
//- Non-const access to the faces
faceIOList& storedIOFaces()
faceCompactIOList& storedIOFaces()
{
return faces_;
}
......@@ -135,7 +135,7 @@ public:
}
//- Const access to the faces
const faceIOList& storedIOFaces() const
const faceCompactIOList& storedIOFaces() const
{
return faces_;
}
......
......@@ -150,7 +150,7 @@ void Foam::MeshedSurfaceProxy<Face>::write
// write surfMesh/faces
{
faceIOList io
faceCompactIOList io
(
IOobject
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment