add xfer constructors to cell/face/point Zone and (Static)HashTable

This commit is contained in:
Mark Olesen
2008-10-10 10:22:08 +02:00
parent 56702ea99d
commit 8c23f5423c
10 changed files with 226 additions and 18 deletions

View File

@ -83,6 +83,19 @@ HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
} }
} }
template<class T, class Key, class Hash>
HashTable<T, Key, Hash>::HashTable(const xfer<HashTable<T, Key, Hash> >& ht)
:
HashTableName(),
tableSize_(0),
table_(NULL),
nElmts_(0),
endIter_(*this, NULL, 0),
endConstIter_(*this, NULL, 0)
{
transfer(*ht);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -41,6 +41,7 @@ SourceFiles
#include "label.H" #include "label.H"
#include "word.H" #include "word.H"
#include "className.H" #include "className.H"
#include "xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,6 +156,9 @@ public:
//- Construct as copy //- Construct as copy
HashTable(const HashTable<T, Key, Hash>&); HashTable(const HashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents
HashTable(const xfer<HashTable<T, Key, Hash> >&);
// Destructor // Destructor

View File

@ -76,6 +76,24 @@ StaticHashTable<T, Key, Hash>::StaticHashTable
{} {}
template<class T, class Key, class Hash>
StaticHashTable<T, Key, Hash>::StaticHashTable
(
const xfer<StaticHashTable<T, Key, Hash> >& ht
)
:
StaticHashTableName(),
keys_(0),
objects_(0),
nElmts_(0),
endIter_(*this, 0, 0),
endConstIter_(*this, 0, 0)
{
transfer(*ht);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class T, class Key, class Hash> template<class T, class Key, class Hash>

View File

@ -46,6 +46,7 @@ SourceFiles
#include "label.H" #include "label.H"
#include "word.H" #include "word.H"
#include "className.H" #include "className.H"
#include "xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -146,6 +147,8 @@ public:
//- Construct as copy //- Construct as copy
StaticHashTable(const StaticHashTable<T, Key, Hash>&); StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct as copy
StaticHashTable(const xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor // Destructor

View File

@ -114,6 +114,22 @@ Foam::cellZone::cellZone
{} {}
Foam::cellZone::cellZone
(
const word& name,
const xfer<labelList>& addr,
const label index,
const cellZoneMesh& zm
)
:
labelList(addr),
name_(name),
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{}
// Construct from dictionary // Construct from dictionary
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
@ -148,6 +164,21 @@ Foam::cellZone::cellZone
cellLookupMapPtr_(NULL) cellLookupMapPtr_(NULL)
{} {}
Foam::cellZone::cellZone
(
const cellZone& cz,
const xfer<labelList>& addr,
const label index,
const cellZoneMesh& zm
)
:
labelList(addr),
name_(cz.name()),
index_(index),
zoneMesh_(zm),
cellLookupMapPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -128,26 +128,45 @@ public:
const word& name, const word& name,
const labelList& addr, const labelList& addr,
const label index, const label index,
const cellZoneMesh& zm const cellZoneMesh&
);
//- Construct from components, transferring contents
cellZone
(
const word& name,
const xfer<labelList>& addr,
const label index,
const cellZoneMesh&
); );
//- Construct from dictionary //- Construct from dictionary
cellZone cellZone
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const cellZoneMesh& zm const cellZoneMesh&
); );
//- Construct given the original zone and resetting the //- Construct given the original zone and resetting the
// cell list and zone mesh information // cell list and zone mesh information
cellZone cellZone
( (
const cellZone& cz, const cellZone&,
const labelList& addr, const labelList& addr,
const label index, const label index,
const cellZoneMesh& zm const cellZoneMesh&
);
//- Construct given the original zone, resetting the
// cell list and zone mesh information
cellZone
(
const cellZone&,
const xfer<labelList>& addr,
const label index,
const cellZoneMesh&
); );
//- Construct and return a clone, resetting the zone mesh //- Construct and return a clone, resetting the zone mesh
@ -182,7 +201,7 @@ public:
static autoPtr<cellZone> New static autoPtr<cellZone> New
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const cellZoneMesh& const cellZoneMesh&
); );

View File

@ -242,6 +242,30 @@ Foam::faceZone::faceZone
} }
Foam::faceZone::faceZone
(
const word& name,
const xfer<labelList>& addr,
const xfer<boolList>& fm,
const label index,
const faceZoneMesh& zm
)
:
labelList(addr),
name_(name),
flipMap_(fm),
index_(index),
zoneMesh_(zm),
patchPtr_(NULL),
masterCellsPtr_(NULL),
slaveCellsPtr_(NULL),
mePtr_(NULL),
faceLookupMapPtr_(NULL)
{
checkAddressing();
}
// Construct from dictionary // Construct from dictionary
Foam::faceZone::faceZone Foam::faceZone::faceZone
( (
@ -292,6 +316,30 @@ Foam::faceZone::faceZone
} }
Foam::faceZone::faceZone
(
const faceZone& fz,
const xfer<labelList>& addr,
const xfer<boolList>& fm,
const label index,
const faceZoneMesh& zm
)
:
labelList(addr),
name_(fz.name()),
flipMap_(fm),
index_(index),
zoneMesh_(zm),
patchPtr_(NULL),
masterCellsPtr_(NULL),
slaveCellsPtr_(NULL),
mePtr_(NULL),
faceLookupMapPtr_(NULL)
{
checkAddressing();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::faceZone::~faceZone() Foam::faceZone::~faceZone()

View File

@ -163,24 +163,45 @@ public:
const faceZoneMesh& zm const faceZoneMesh& zm
); );
//- Construct from components, transferring contents
faceZone
(
const word& name,
const xfer<labelList>& addr,
const xfer<boolList>& fm,
const label index,
const faceZoneMesh&
);
//- Construct from dictionary //- Construct from dictionary
faceZone faceZone
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh&
); );
//- Construct given the original zone and resetting the //- Construct given the original zone and resetting the
// face list and zone mesh information // face list and zone mesh information
faceZone faceZone
( (
const faceZone& fz, const faceZone&,
const labelList& addr, const labelList& addr,
const boolList& fm, const boolList& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh&
);
//- Construct given the original zone, resetting the
// face list and zone mesh information
faceZone
(
const faceZone&,
const xfer<labelList>& addr,
const xfer<boolList>& fm,
const label index,
const faceZoneMesh&
); );
//- Construct and return a clone, resetting the zone mesh //- Construct and return a clone, resetting the zone mesh
@ -216,9 +237,9 @@ public:
static autoPtr<faceZone> New static autoPtr<faceZone> New
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh&
); );

View File

@ -112,6 +112,22 @@ Foam::pointZone::pointZone
{} {}
Foam::pointZone::pointZone
(
const word& name,
const xfer<labelList>& addr,
const label index,
const pointZoneMesh& zm
)
:
labelList(addr),
name_(name),
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{}
// Construct from dictionary // Construct from dictionary
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
@ -147,6 +163,22 @@ Foam::pointZone::pointZone
{} {}
Foam::pointZone::pointZone
(
const pointZone& pz,
const xfer<labelList>& addr,
const label index,
const pointZoneMesh& zm
)
:
labelList(addr),
name_(pz.name()),
index_(index),
zoneMesh_(zm),
pointLookupMapPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::pointZone::~pointZone() Foam::pointZone::~pointZone()

View File

@ -130,26 +130,45 @@ public:
const word& name, const word& name,
const labelList& addr, const labelList& addr,
const label index, const label index,
const pointZoneMesh& zm const pointZoneMesh&
);
//- Construct from components, transferring contents
pointZone
(
const word& name,
const xfer<labelList>& addr,
const label index,
const pointZoneMesh&
); );
//- Construct from dictionary //- Construct from dictionary
pointZone pointZone
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const pointZoneMesh& zm const pointZoneMesh&
); );
//- Construct given the original zone and resetting the //- Construct given the original zone and resetting the
// point list and zone mesh information // point list and zone mesh information
pointZone pointZone
( (
const pointZone& pz, const pointZone&,
const labelList& addr, const labelList& addr,
const label index, const label index,
const pointZoneMesh& zm const pointZoneMesh&
);
//- Construct given the original zone, resetting the
// face list and zone mesh information
pointZone
(
const pointZone&,
const xfer<labelList>& addr,
const label index,
const pointZoneMesh&
); );
//- Construct and return a clone, resetting the zone mesh //- Construct and return a clone, resetting the zone mesh
@ -184,7 +203,7 @@ public:
static autoPtr<pointZone> New static autoPtr<pointZone> New
( (
const word& name, const word& name,
const dictionary& dict, const dictionary&,
const label index, const label index,
const pointZoneMesh& const pointZoneMesh&
); );