rename xfer<T> class to Xfer<T>

- The capitalization is consistent with most other template classes, but
  more importantly frees up xfer() for use as method name without needing
  special treatment to avoid ambiguities.

  It seems reasonable to have different names for transfer(...) and xfer()
  methods, since the transfer is occuring in different directions.
  The xfer() method can thus replace the recently introduced zero-parameter
  transfer() methods.
  Other name candidates (eg, yield, release, etc.) were deemed too abstract.
This commit is contained in:
Mark Olesen
2009-01-05 12:30:19 +01:00
parent 461ac4b4cc
commit 19503c93e1
98 changed files with 449 additions and 475 deletions

View File

@ -145,14 +145,22 @@ int main(int argc, char *argv[])
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: " Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl; << " " << dlC.size() << "/" << dlC.capacity() << endl;
List<label> lstB(dlC.transfer()); List<label> lstB(dlC.xfer());
Info<< "Transferred to normal list via the transfer() method" << endl; Info<< "Transferred to normal list via the xfer() method" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: " Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
<< " " << lstB.size() << endl; << " " << lstB.size() << endl;
Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: " Info<< "<dlC>" << dlC << "</dlC>" << nl << "sizes: "
<< " " << dlC.size() << "/" << dlC.capacity() << endl; << " " << dlC.size() << "/" << dlC.capacity() << endl;
DynamicList<label> dlD(lstB.xfer());
Info<< "Transfer construct from normal list" << endl;
Info<< "<lstB>" << lstB << "</lstB>" << nl << "sizes: "
<< " " << lstB.size() << endl;
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
return 0; return 0;
} }

View File

@ -91,10 +91,10 @@ int main()
HASHTABLE_CLASS<double> table2(table1); HASHTABLE_CLASS<double> table2(table1);
HASHTABLE_CLASS<double> table3(table1.transfer()); HASHTABLE_CLASS<double> table3(table1.xfer());
Info<< "\ncopy table1 -> table2" << nl Info<< "\ncopy table1 -> table2" << nl
<< "transfer table1 -> table3 via the transfer() method" << nl; << "transfer table1 -> table3 via the xfer() method" << nl;
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table1 << nl << "\ntable2" << table1 << nl

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << table3.toc() << endl;
Map<label> table4(table3.transfer()); Map<label> table4(table3.xfer());
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << table3.toc() << endl;

View File

@ -54,10 +54,10 @@ int main(int argc, char *argv[])
list2.setSize(10, vector(1, 2, 3)); list2.setSize(10, vector(1, 2, 3));
Info<< list2 << endl; Info<< list2 << endl;
List<vector> list3(list2.transfer()); List<vector> list3(list2.xfer());
Info<< "Transferred via the transfer() method" << endl; Info<< "Transferred via the xfer() method" << endl;
Info<< list2 << endl; Info<< list2 << nl
Info<< list3 << endl; << list3 << endl;
return 0; return 0;
} }

View File

@ -104,8 +104,8 @@ int main(int argc, char *argv[])
Info<<"list1: " << list1 << endl; Info<<"list1: " << list1 << endl;
PtrList<Scalar> list3(list1.transfer()); PtrList<Scalar> list3(list1.xfer());
Info<< "Transferred via the transfer() method" << endl; Info<< "Transferred via the xfer() method" << endl;
Info<<"list1: " << list1 << endl; Info<<"list1: " << list1 << endl;
Info<<"list2: " << list2 << endl; Info<<"list2: " << list2 << endl;

View File

@ -91,10 +91,10 @@ int main()
HASHTABLE_CLASS<double> table2(table1); HASHTABLE_CLASS<double> table2(table1);
HASHTABLE_CLASS<double> table3(table1.transfer()); HASHTABLE_CLASS<double> table3(table1.xfer());
Info<< "\ncopy table1 -> table2" << nl Info<< "\ncopy table1 -> table2" << nl
<< "transfer table1 -> table3 via the transfer() method" << nl; << "transfer table1 -> table3 via the xfer() method" << nl;
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table1 << nl << "\ntable2" << table1 << nl

View File

@ -48,7 +48,7 @@ int main(int argc, char *argv[])
<< "keys: " << dict1.keys() << nl << "keys: " << dict1.keys() << nl
<< "patterns: " << dict1.keys(true) << endl; << "patterns: " << dict1.keys(true) << endl;
dictionary dict2(dict1.transfer()); dictionary dict2(dict1.xfer());
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl; << "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl;

View File

@ -56,8 +56,8 @@ int main(int argc, char *argv[])
Info<< "lstA: " << lstA << endl; Info<< "lstA: " << lstA << endl;
Info<< "lstC: " << lstC << endl; Info<< "lstC: " << lstC << endl;
xfer<List<label> > xA = xferMove(lstA); Xfer<List<label> > xA = xferMove(lstA);
xfer<List<label> > xB; Xfer<List<label> > xB;
List<label> lstB( xA ); List<label> lstB( xA );
@ -112,8 +112,8 @@ int main(int argc, char *argv[])
Info<< "f1: " << f1 << endl; Info<< "f1: " << f1 << endl;
Info<< "f2: " << f2 << endl; Info<< "f2: " << f2 << endl;
// note: using xferMoveTo to ensure the correct transfer() method is called // note: xfer() method returns a plain labelList
face f3( xferMoveTo<labelList>(dl) ); face f3( dl.xfer() );
Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl; Info<< "dl[" << dl.size() << "/" << dl.capacity() << "] " << dl << endl;
Info<< "f3: " << f3 << endl; Info<< "f3: " << f3 << endl;

View File

@ -48,7 +48,7 @@ template
template<class> class FaceList, template<class> class FaceList,
class PointField class PointField
> >
Foam::xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints Foam::Xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -82,7 +82,7 @@ Foam::xfer<Foam::pointField> Foam::extrudedMesh::extrudedPoints
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Foam::xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces Foam::Xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model
@ -184,7 +184,7 @@ Foam::xfer<Foam::faceList> Foam::extrudedMesh::extrudedFaces
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
Foam::xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells Foam::Xfer<Foam::cellList> Foam::extrudedMesh::extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& model const extrudeModel& model

View File

@ -63,7 +63,7 @@ class extrudedMesh
//- Construct and return the extruded mesh points //- Construct and return the extruded mesh points
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
xfer<pointField> extrudedPoints Xfer<pointField> extrudedPoints
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -71,7 +71,7 @@ class extrudedMesh
//- Construct and return the extruded mesh faces //- Construct and return the extruded mesh faces
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
xfer<faceList> extrudedFaces Xfer<faceList> extrudedFaces
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&
@ -79,7 +79,7 @@ class extrudedMesh
//- Construct and return the extruded mesh cells //- Construct and return the extruded mesh cells
template<class Face, template<class> class FaceList, class PointField> template<class Face, template<class> class FaceList, class PointField>
xfer<cellList> extrudedCells Xfer<cellList> extrudedCells
( (
const PrimitivePatch<Face, FaceList, PointField>& extrudePatch, const PrimitivePatch<Face, FaceList, PointField>& extrudePatch,
const extrudeModel& const extrudeModel&

View File

@ -316,7 +316,7 @@ autoPtr<mapPolyMesh> reorderMesh
mesh.resetPrimitives mesh.resetPrimitives
( (
xfer<pointField>::null(), Xfer<pointField>::null(),
xferMove(newFaces), xferMove(newFaces),
xferMove(newOwner), xferMove(newOwner),
xferMove(newNeighbour), xferMove(newNeighbour),

View File

@ -175,13 +175,10 @@ Istream& operator>>(Istream& is, HashPtrTable<T, Key, Hash>& L)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Ostream& operator<<(Ostream& os, const HashPtrTable<T, Key, Hash>& L) Ostream& operator<<(Ostream& os, const HashPtrTable<T, Key, Hash>& L)
{ {
// Write size of HashPtrTable // Write size and start delimiter
os << nl << L.size(); os << nl << L.size() << nl << token::BEGIN_LIST << nl;
// Write beginning of contents // Write contents
os << nl << token::BEGIN_LIST << nl;
// Write HashPtrTable contents
for for
( (
typename HashPtrTable<T, Key, Hash>::const_iterator iter = L.begin(); typename HashPtrTable<T, Key, Hash>::const_iterator iter = L.begin();
@ -192,7 +189,7 @@ Ostream& operator<<(Ostream& os, const HashPtrTable<T, Key, Hash>& L)
os << iter.key() << token::SPACE << *iter() << nl; os << iter.key() << token::SPACE << *iter() << nl;
} }
// Write end of contents // Write end delimiter
os << token::END_LIST; os << token::END_LIST;
// Check state of IOstream // Check state of IOstream

View File

@ -101,13 +101,13 @@ public:
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashSet(const xfer<HashSet<Key, Hash> >& hs) HashSet(const Xfer<HashSet<Key, Hash> >& hs)
: :
HashTable<empty, Key, Hash>(hs) HashTable<empty, Key, Hash>(hs)
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashSet(const xfer<HashTable<empty, Key, Hash> >& hs) HashSet(const Xfer<HashTable<empty, Key, Hash> >& hs)
: :
HashTable<empty, Key, Hash>(hs) HashTable<empty, Key, Hash>(hs)
{} {}

View File

@ -81,7 +81,7 @@ Foam::HashTable<T, Key, Hash>::HashTable(const HashTable<T, Key, Hash>& ht)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::HashTable<T, Key, Hash>::HashTable Foam::HashTable<T, Key, Hash>::HashTable
( (
const xfer<HashTable<T, Key, Hash> >& ht const Xfer<HashTable<T, Key, Hash> >& ht
) )
: :
HashTableName(), HashTableName(),

View File

@ -41,7 +41,7 @@ SourceFiles
#include "label.H" #include "label.H"
#include "word.H" #include "word.H"
#include "className.H" #include "className.H"
#include "xfer.H" #include "Xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -156,7 +156,7 @@ public:
HashTable(const HashTable<T, Key, Hash>&); HashTable(const HashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
HashTable(const xfer<HashTable<T, Key, Hash> >&); HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor // Destructor
@ -214,8 +214,8 @@ public:
// and annull the argument table. // and annull the argument table.
void transfer(HashTable<T, Key, Hash>&); void transfer(HashTable<T, Key, Hash>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<HashTable<T, Key, Hash> > transfer(); inline Xfer<HashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators

View File

@ -74,12 +74,10 @@ inline bool Foam::HashTable<T, Key, Hash>::set
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::xfer<Foam::HashTable<T, Key, Hash> > inline Foam::Xfer<Foam::HashTable<T, Key, Hash> >
Foam::HashTable<T, Key, Hash>::transfer() Foam::HashTable<T, Key, Hash>::xfer()
{ {
Foam::xfer<HashTable<T, Key, Hash> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -168,7 +168,7 @@ Foam::Istream& Foam::operator>>(Istream& is, HashTable<T, Key, Hash>& L)
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::Ostream& Foam::operator<<(Ostream& os, const HashTable<T, Key, Hash>& L) Foam::Ostream& Foam::operator<<(Ostream& os, const HashTable<T, Key, Hash>& L)
{ {
// Write size of HashTable and start contents delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST << nl; os << nl << L.size() << nl << token::BEGIN_LIST << nl;
// Write contents // Write contents
@ -182,7 +182,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const HashTable<T, Key, Hash>& L)
os << iter.key() << token::SPACE << iter() << nl; os << iter.key() << token::SPACE << iter() << nl;
} }
// Write end of contents delimiter // Write end delimiter
os << token::END_LIST; os << token::END_LIST;
// Check state of IOstream // Check state of IOstream

View File

@ -81,13 +81,13 @@ public:
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
Map(const xfer<Map<T> >& map) Map(const Xfer<Map<T> >& map)
: :
HashTable<T, label, Hash<label> >(map) HashTable<T, label, Hash<label> >(map)
{} {}
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
Map(const xfer<HashTable<T, label, Hash<label> > >& map) Map(const Xfer<HashTable<T, label, Hash<label> > >& map)
: :
HashTable<T, label, Hash<label> >(map) HashTable<T, label, Hash<label> >(map)
{} {}

View File

@ -75,7 +75,7 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
( (
const xfer<StaticHashTable<T, Key, Hash> >& ht const Xfer<StaticHashTable<T, Key, Hash> >& ht
) )
: :
StaticHashTableName(), StaticHashTableName(),

View File

@ -47,7 +47,7 @@ SourceFiles
#include "label.H" #include "label.H"
#include "word.H" #include "word.H"
#include "className.H" #include "className.H"
#include "xfer.H" #include "Xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -150,7 +150,7 @@ public:
StaticHashTable(const StaticHashTable<T, Key, Hash>&); StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
StaticHashTable(const xfer<StaticHashTable<T, Key, Hash> >&); StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor // Destructor
@ -207,8 +207,8 @@ public:
// and annull the argument table. // and annull the argument table.
void transfer(StaticHashTable<T, Key, Hash>&); void transfer(StaticHashTable<T, Key, Hash>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<StaticHashTable<T, Key, Hash> > transfer(); inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators

View File

@ -61,12 +61,10 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::xfer<Foam::StaticHashTable<T, Key, Hash> > inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> >
Foam::StaticHashTable<T, Key, Hash>::transfer() Foam::StaticHashTable<T, Key, Hash>::xfer()
{ {
Foam::xfer<StaticHashTable<T, Key, Hash> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -180,7 +180,7 @@ Foam::Ostream& Foam::operator<<
Ostream& os, Ostream& os,
const StaticHashTable<T, Key, Hash>& L) const StaticHashTable<T, Key, Hash>& L)
{ {
// Write size of HashTable and start contents delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST << nl; os << nl << L.size() << nl << token::BEGIN_LIST << nl;
// Write contents // Write contents
@ -194,7 +194,7 @@ Foam::Ostream& Foam::operator<<
os << iter.key() << token::SPACE << iter() << nl; os << iter.key() << token::SPACE << iter() << nl;
} }
// Write end of contents delimiter // Write end delimiter
os << token::END_LIST; os << token::END_LIST;
// Check state of IOstream // Check state of IOstream

View File

@ -39,7 +39,6 @@ SourceFiles
#define Keyed_H #define Keyed_H
#include "List.H" #include "List.H"
#include "xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,7 +48,6 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
template<class T> class Keyed; template<class T> class Keyed;
template<class T> class xfer;
template<class T> Istream& operator>>(Istream&, Keyed<T>&); template<class T> Istream& operator>>(Istream&, Keyed<T>&);
template<class T> Ostream& operator<<(Ostream&, const Keyed<T>&); template<class T> Ostream& operator<<(Ostream&, const Keyed<T>&);
@ -95,7 +93,7 @@ public:
inline Keyed(const T& item, const label key=0); inline Keyed(const T& item, const label key=0);
//- Construct by transferring the item, with a key //- Construct by transferring the item, with a key
inline Keyed(const xfer<T>& item, const label key=0); inline Keyed(const Xfer<T>& item, const label key=0);
//- Construct from Istream //- Construct from Istream
inline Keyed(Istream&); inline Keyed(Istream&);

View File

@ -46,7 +46,7 @@ inline Foam::Keyed<T>::Keyed(const T& item, const label key)
template<class T> template<class T>
inline Foam::Keyed<T>::Keyed(const xfer<T>& item, const label key) inline Foam::Keyed<T>::Keyed(const Xfer<T>& item, const label key)
: :
T(item), T(item),
key_(key) key_(key)

View File

@ -26,8 +26,7 @@ Class
Foam::BiIndirectList Foam::BiIndirectList
Description Description
Indexes into left list (negative index) or right list (zero or positive Indexes into negList (negative index) or posList (zero or positive index).
index).
SourceFiles SourceFiles
BiIndirectListI.H BiIndirectListI.H
@ -82,8 +81,8 @@ public:
inline List<label>& addressing(); inline List<label>& addressing();
//- Calculate index given whether index is into posList or negList //- Calculate index given whether index is into posList or negList
inline static label posIndex(const label i); inline static label posIndex(const label);
inline static label negIndex(const label i); inline static label negIndex(const label);
// Member Operators // Member Operators

View File

@ -97,7 +97,7 @@ Foam::CompactListList<T>::CompactListList
template<class T> template<class T>
Foam::CompactListList<T>::CompactListList Foam::CompactListList<T>::CompactListList
( (
const xfer<CompactListList<T> >& lst const Xfer<CompactListList<T> >& lst
) )
{ {
transfer(lst()); transfer(lst());

View File

@ -104,7 +104,7 @@ public:
CompactListList(const UList<label>& rowSizes, const T&); CompactListList(const UList<label>& rowSizes, const T&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
CompactListList(const xfer<CompactListList<T> >&); CompactListList(const Xfer<CompactListList<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
CompactListList(CompactListList<T>&, bool reUse); CompactListList(CompactListList<T>&, bool reUse);
@ -164,8 +164,8 @@ public:
// into this CompactListList and annull the argument list. // into this CompactListList and annull the argument list.
void transfer(CompactListList<T>&); void transfer(CompactListList<T>&);
//- Transfer the contents to the xfer container //- Transfer the contents to the Xfer container
inline xfer<CompactListList<T> > transfer(); inline Xfer<CompactListList<T> > xfer();
// Other // Other

View File

@ -82,7 +82,7 @@ inline const Foam::List<Foam::label>& Foam::CompactListList<T>::offsets() const
template<class T> template<class T>
inline Foam::List<label>& Foam::CompactListList<T>::offsets() inline Foam::List<Foam::label>& Foam::CompactListList<T>::offsets()
{ {
return offsets_; return offsets_;
} }
@ -127,7 +127,7 @@ inline Foam::label Foam::CompactListList<T>::whichRow(const label i) const
{ {
FatalErrorIn FatalErrorIn
( (
"CompactListList<T>::whichRow(const label i) const" "CompactListList<T>::whichRow(const label) const"
) << "Index " << i << " outside 0.." << m_.size() ) << "Index " << i << " outside 0.." << m_.size()
<< abort(FatalError); << abort(FatalError);
} }
@ -156,12 +156,9 @@ inline Foam::label Foam::CompactListList<T>::whichColumn
template<class T> template<class T>
inline Foam::xfer<Foam::CompactListList<T> > inline Foam::Xfer<Foam::CompactListList<T> > Foam::CompactListList<T>::xfer()
Foam::CompactListList<T>::transfer()
{ {
Foam::xfer<CompactListList<T> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -104,6 +104,9 @@ public:
//- Construct from UList. Size set to UList size. //- Construct from UList. Size set to UList size.
explicit inline DynamicList(const UList<T>&); explicit inline DynamicList(const UList<T>&);
//- Construct by transferring the parameter contents
explicit inline DynamicList(const Xfer<List<T> >&);
//- Construct from Istream. Size set to size of read list. //- Construct from Istream. Size set to size of read list.
explicit DynamicList(Istream&); explicit DynamicList(Istream&);
@ -153,8 +156,8 @@ public:
//- Transfer contents of the argument DynamicList into this DynamicList //- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer the contents to the xfer container as a plain List //- Transfer contents to the Xfer container as a plain List
inline xfer<List<T> > transfer(); inline Xfer<List<T> > xfer();
// Member Operators // Member Operators

View File

@ -60,6 +60,18 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
{} {}
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
(
const Xfer<List<T> >& lst
)
:
List<T>(lst),
capacity_(List<T>::size())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
@ -212,12 +224,10 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::xfer<Foam::List<T> > inline Foam::Xfer<Foam::List<T> >
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer() Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer()
{ {
Foam::xfer<List<T> > xf; return xferMoveTo<List<T> >(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -77,19 +77,15 @@ class FixedList
public: public:
//- Hashing function class //- Hashing function class
// Rotating hash from http://burtleburtle.net/bob/hash/doobs.html
template<class HashT=Hash<T> > template<class HashT=Hash<T> >
class Hash class Hash
: :
public Foam::Hash<FixedList<T, Size> > public Foam::Hash<FixedList<T, Size> >
{ {
public: public:
inline Hash(); inline Hash();
//- Rotating Hash. From http://burtleburtle.net/bob/hash/doobs.html.
label operator()(const FixedList<T, Size>&) const; label operator()(const FixedList<T, Size>&) const;
label operator() label operator()
( (
const FixedList<T, Size>&, const FixedList<T, Size>&,
@ -165,10 +161,10 @@ public:
void transfer(const FixedList<T, Size>&); void transfer(const FixedList<T, Size>&);
//- Write the FixedList as a dictionary entry //- Write the FixedList as a dictionary entry
void writeEntry(Ostream& os) const; void writeEntry(Ostream&) const;
//- Write the FixedList as a dictionary entry with keyword //- Write the FixedList as a dictionary entry with keyword
void writeEntry(const word& keyword, Ostream& os) const; void writeEntry(const word& keyword, Ostream&) const;
// Member operators // Member operators

View File

@ -190,43 +190,42 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const FixedList<T, Size>& L)
if (uniform) if (uniform)
{ {
// Write size of list (so it is valid dictionary entry) and // Write size (so it is valid dictionary entry) and start delimiter
// start contents delimiter
os << L.size() << token::BEGIN_BLOCK; os << L.size() << token::BEGIN_BLOCK;
// Write list contents // Write contents
os << L[0]; os << L[0];
// Write end of contents delimiter // Write end delimiter
os << token::END_BLOCK; os << token::END_BLOCK;
} }
else if (Size < 11 && contiguous<T>()) else if (Size < 11 && contiguous<T>())
{ {
// Write start of contents delimiter // Write start delimiter
os << token::BEGIN_LIST; os << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
if (i > 0) os << token::SPACE; if (i > 0) os << token::SPACE;
os << L[i]; os << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << token::END_LIST; os << token::END_LIST;
} }
else else
{ {
// Write start of contents delimiter // Write start delimiter
os << nl << token::BEGIN_LIST; os << nl << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
os << nl << L[i]; os << nl << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << nl << token::END_LIST << nl; os << nl << token::END_LIST << nl;
} }
} }

View File

@ -72,7 +72,7 @@ Foam::List<T>::List(const label s, const T& a)
{ {
if (this->size_ < 0) if (this->size_ < 0)
{ {
FatalErrorIn("List<T>::List(const label size, const T a)") FatalErrorIn("List<T>::List(const label size, const T&)")
<< "bad size " << this->size_ << "bad size " << this->size_
<< abort(FatalError); << abort(FatalError);
} }
@ -127,7 +127,7 @@ Foam::List<T>::List(const List<T>& a)
// Construct by transferring the parameter contents // Construct by transferring the parameter contents
template<class T> template<class T>
Foam::List<T>::List(const xfer<List<T> >& lst) Foam::List<T>::List(const Xfer<List<T> >& lst)
{ {
transfer(lst()); transfer(lst());
} }

View File

@ -43,7 +43,7 @@ SourceFiles
#include "UList.H" #include "UList.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "xfer.H" #include "Xfer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -102,7 +102,7 @@ public:
List(const List<T>&); List(const List<T>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
List(const xfer<List<T> >&); List(const Xfer<List<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
List(List<T>&, bool reUse); List(List<T>&, bool reUse);
@ -178,8 +178,8 @@ public:
// and annull the argument list. // and annull the argument list.
void transfer(SortableList<T>&); void transfer(SortableList<T>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<List<T> > transfer(); inline Xfer<List<T> > xfer();
//- Return subscript-checked element of UList. //- Return subscript-checked element of UList.
inline T& newElmt(const label); inline T& newElmt(const label);

View File

@ -67,11 +67,9 @@ inline Foam::label Foam::List<T>::size() const
template<class T> template<class T>
inline Foam::xfer<Foam::List<T> > Foam::List<T>::transfer() inline Foam::Xfer<Foam::List<T> > Foam::List<T>::xfer()
{ {
Foam::xfer<List<T> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -47,7 +47,7 @@ Foam::PackedList<nBits>::PackedList(const PackedList<nBits>& lst)
template<int nBits> template<int nBits>
Foam::PackedList<nBits>::PackedList(const xfer<PackedList<nBits> >& lst) Foam::PackedList<nBits>::PackedList(const Xfer<PackedList<nBits> >& lst)
{ {
transfer(lst()); transfer(lst());
} }

View File

@ -135,7 +135,7 @@ public:
PackedList(const PackedList<nBits>& PList); PackedList(const PackedList<nBits>& PList);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
PackedList(const xfer<PackedList<nBits> >&); PackedList(const Xfer<PackedList<nBits> >&);
//- Construct from a list of labels //- Construct from a list of labels
PackedList(const UList<label>&); PackedList(const UList<label>&);
@ -157,8 +157,8 @@ public:
// and annull the argument list. // and annull the argument list.
void transfer(PackedList<nBits>&); void transfer(PackedList<nBits>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<PackedList<nBits> > transfer(); inline Xfer<PackedList<nBits> > xfer();
// Access // Access

View File

@ -187,12 +187,10 @@ inline Foam::List<unsigned int>& Foam::PackedList<nBits>::storage()
template<int nBits> template<int nBits>
inline Foam::xfer<Foam::PackedList<nBits> > inline Foam::Xfer<Foam::PackedList<nBits> >
Foam::PackedList<nBits>::transfer() Foam::PackedList<nBits>::xfer()
{ {
Foam::xfer<PackedList<nBits> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -72,7 +72,7 @@ Foam::PtrList<T>::PtrList(const PtrList<T>& a, const CloneArg& cloneArg)
template<class T> template<class T>
Foam::PtrList<T>::PtrList(const xfer<PtrList<T> >& lst) Foam::PtrList<T>::PtrList(const Xfer<PtrList<T> >& lst)
{ {
transfer(lst()); transfer(lst());
} }

View File

@ -130,7 +130,7 @@ public:
PtrList(const PtrList<T>&, const CloneArg&); PtrList(const PtrList<T>&, const CloneArg&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
PtrList(const xfer<PtrList<T> >&); PtrList(const Xfer<PtrList<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
PtrList(PtrList<T>&, bool reUse); PtrList(PtrList<T>&, bool reUse);
@ -175,8 +175,8 @@ public:
// and annull the argument list. // and annull the argument list.
void transfer(PtrList<T>&); void transfer(PtrList<T>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<PtrList<T> > transfer(); inline Xfer<PtrList<T> > xfer();
//- Is element set //- Is element set
inline bool set(const label) const; inline bool set(const label) const;

View File

@ -79,11 +79,9 @@ inline Foam::autoPtr<T> Foam::PtrList<T>::set
template<class T> template<class T>
inline Foam::xfer<Foam::PtrList<T> > Foam::PtrList<T>::transfer() inline Foam::Xfer<Foam::PtrList<T> > Foam::PtrList<T>::xfer()
{ {
Foam::xfer<PtrList<T> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -36,13 +36,13 @@ template<class T>
template<class INew> template<class INew>
void Foam::PtrList<T>::read(Istream& is, const INew& inewt) void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
{ {
is.fatalCheck("PtrList<T>::read(Istream& is, const INew& inewt)"); is.fatalCheck("PtrList<T>::read(Istream&, const INew&)");
token firstToken(is); token firstToken(is);
is.fatalCheck is.fatalCheck
( (
"PtrList<T>::read(Istream& is, const INew& inewt) : " "PtrList<T>::read(Istream&, const INew&) : "
"reading first token" "reading first token"
); );
@ -66,7 +66,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
is.fatalCheck is.fatalCheck
( (
"PtrList<T>::read(Istream& is, const INew& inewt) : " "PtrList<T>::read(Istream&, const INew&) : "
"reading entry" "reading entry"
); );
} }
@ -78,7 +78,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
is.fatalCheck is.fatalCheck
( (
"PtrList<T>::read(Istream& is, const INew& inewt) : " "PtrList<T>::read(Istream&, const INew&) : "
"reading the single entry" "reading the single entry"
); );
@ -98,7 +98,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"PtrList<T>::read(Istream& is, const INew& inewt)", "PtrList<T>::read(Istream&, const INew&)",
is is
) << "incorrect first token, '(', found " << firstToken.info() ) << "incorrect first token, '(', found " << firstToken.info()
<< exit(FatalIOError); << exit(FatalIOError);
@ -137,7 +137,7 @@ void Foam::PtrList<T>::read(Istream& is, const INew& inewt)
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"PtrList<T>::read(Istream& is, const INew& inewt)", "PtrList<T>::read(Istream&, const INew&)",
is is
) << "incorrect first token, expected <int> or '(', found " ) << "incorrect first token, expected <int> or '(', found "
<< firstToken.info() << firstToken.info()
@ -180,16 +180,16 @@ Foam::Istream& Foam::operator>>(Istream& is, PtrList<T>& L)
template<class T> template<class T>
Foam::Ostream& Foam::operator<<(Ostream& os, const PtrList<T>& L) Foam::Ostream& Foam::operator<<(Ostream& os, const PtrList<T>& L)
{ {
// Write size of list and start contents delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST; os << nl << L.size() << nl << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
os << nl << L[i]; os << nl << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << nl << token::END_LIST << nl; os << nl << token::END_LIST << nl;
// Check state of IOstream // Check state of IOstream

View File

@ -26,8 +26,8 @@ License
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template <class Type> template<class T>
void Foam::SortableList<Type>::sortIndices(List<label>& ind) const void Foam::SortableList<T>::sortIndices(List<label>& ind) const
{ {
// list lengths must be identical // list lengths must be identical
ind.setSize(this->size()); ind.setSize(this->size());
@ -37,53 +37,53 @@ void Foam::SortableList<Type>::sortIndices(List<label>& ind) const
ind[i] = i; ind[i] = i;
} }
Foam::stableSort(ind, typename UList<Type>::less(*this)); Foam::stableSort(ind, typename UList<T>::less(*this));
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList() Foam::SortableList<T>::SortableList()
{} {}
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList(const UList<Type>& values) Foam::SortableList<T>::SortableList(const UList<T>& values)
: :
List<Type>(values) List<T>(values)
{ {
sort(); sort();
} }
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList(const xfer<List<Type> >& values) Foam::SortableList<T>::SortableList(const Xfer<List<T> >& values)
: :
List<Type>(values) List<T>(values)
{ {
sort(); sort();
} }
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList(const label size) Foam::SortableList<T>::SortableList(const label size)
: :
List<Type>(size) List<T>(size)
{} {}
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList(const label size, const Type& val) Foam::SortableList<T>::SortableList(const label size, const T& val)
: :
List<Type>(size, val) List<T>(size, val)
{} {}
template <class Type> template<class T>
Foam::SortableList<Type>::SortableList(const SortableList<Type>& lst) Foam::SortableList<T>::SortableList(const SortableList<T>& lst)
: :
List<Type>(lst), List<T>(lst),
indices_(lst.indices()) indices_(lst.indices())
{} {}
@ -91,83 +91,81 @@ Foam::SortableList<Type>::SortableList(const SortableList<Type>& lst)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template <class Type> template<class T>
void Foam::SortableList<Type>::clear() void Foam::SortableList<T>::clear()
{ {
List<Type>::clear(); List<T>::clear();
indices_.clear(); indices_.clear();
} }
template <class Type> template<class T>
Foam::List<Type>& Foam::SortableList<Type>::shrink() Foam::List<T>& Foam::SortableList<T>::shrink()
{ {
indices_.clear(); indices_.clear();
return static_cast<List<Type>&>(*this); return static_cast<List<T>&>(*this);
} }
template <class Type> template<class T>
void Foam::SortableList<Type>::sort() void Foam::SortableList<T>::sort()
{ {
sortIndices(indices_); sortIndices(indices_);
List<Type> lst(this->size()); List<T> lst(this->size());
forAll(indices_, i) forAll(indices_, i)
{ {
lst[i] = this->operator[](indices_[i]); lst[i] = this->operator[](indices_[i]);
} }
List<Type>::transfer(lst); List<T>::transfer(lst);
} }
template <class Type> template<class T>
void Foam::SortableList<Type>::reverseSort() void Foam::SortableList<T>::reverseSort()
{ {
sortIndices(indices_); sortIndices(indices_);
List<Type> lst(this->size()); List<T> lst(this->size());
label endI = indices_.size(); label endI = indices_.size();
forAll(indices_, i) forAll(indices_, i)
{ {
lst[--endI] = this->operator[](indices_[i]); lst[--endI] = this->operator[](indices_[i]);
} }
List<Type>::transfer(lst); List<T>::transfer(lst);
} }
template <class Type> template<class T>
Foam::xfer<Foam::List<Type> > Foam::SortableList<Type>::transfer() Foam::Xfer<Foam::List<T> > Foam::SortableList<T>::xfer()
{ {
Foam::xfer<List<T> > xf; return xferMoveTo<List<T> >(*this);
xf().transfer(*this);
return xf;
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template <class Type> template<class T>
inline void Foam::SortableList<Type>::operator=(const Type& t) inline void Foam::SortableList<T>::operator=(const T& t)
{ {
UList<Type>::operator=(t); UList<T>::operator=(t);
} }
template <class Type> template<class T>
inline void Foam::SortableList<Type>::operator=(const UList<Type>& rhs) inline void Foam::SortableList<T>::operator=(const UList<T>& rhs)
{ {
List<Type>::operator=(rhs); List<T>::operator=(rhs);
indices_.clear(); indices_.clear();
} }
template <class Type> template<class T>
inline void Foam::SortableList<Type>::operator=(const SortableList<Type>& rhs) inline void Foam::SortableList<T>::operator=(const SortableList<T>& rhs)
{ {
List<Type>::operator=(rhs); List<T>::operator=(rhs);
indices_ = rhs.indices(); indices_ = rhs.indices();
} }

View File

@ -50,10 +50,10 @@ namespace Foam
Class SortableList Declaration Class SortableList Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template <class Type> template<class T>
class SortableList class SortableList
: :
public List<Type> public List<T>
{ {
// Private data // Private data
@ -71,10 +71,10 @@ public:
SortableList(); SortableList();
//- Construct from UList, sorting immediately. //- Construct from UList, sorting immediately.
explicit SortableList(const UList<Type>&); explicit SortableList(const UList<T>&);
//- Construct from transferred List, sorting immediately. //- Construct from transferred List, sorting immediately.
explicit SortableList(const xfer<List<Type> >&); explicit SortableList(const Xfer<List<T> >&);
//- Construct given size. Sort later on. //- Construct given size. Sort later on.
// The indices remain empty until the list is sorted // The indices remain empty until the list is sorted
@ -82,10 +82,10 @@ public:
//- Construct given size and initial value. Sort later on. //- Construct given size and initial value. Sort later on.
// The indices remain empty until the list is sorted // The indices remain empty until the list is sorted
SortableList(const label size, const Type&); SortableList(const label size, const T&);
//- Construct as copy. //- Construct as copy.
SortableList(const SortableList<Type>&); SortableList(const SortableList<T>&);
// Member Functions // Member Functions
@ -106,7 +106,7 @@ public:
void clear(); void clear();
//- Clear the indices and return a reference to the underlying List //- Clear the indices and return a reference to the underlying List
List<Type>& shrink(); List<T>& shrink();
//- (stable) sort the list (if changed after construction time) //- (stable) sort the list (if changed after construction time)
// also resizes the indices as required // also resizes the indices as required
@ -115,19 +115,20 @@ public:
//- Reverse (stable) sort the list //- Reverse (stable) sort the list
void reverseSort(); void reverseSort();
//- Transfer the contents to the xfer container as a plain List //- Transfer contents to the Xfer container as a plain List
inline Foam::xfer<List<T> > transfer(); inline Xfer<List<T> > xfer();
// Member Operators // Member Operators
//- Assignment of all entries to the given value //- Assignment of all entries to the given value
inline void operator=(const Type&); inline void operator=(const T&);
//- Assignment from UList operator. Takes linear time. //- Assignment from UList operator. Takes linear time.
inline void operator=(const UList<Type>&); inline void operator=(const UList<T>&);
//- Assignment operator. Takes linear time. //- Assignment operator. Takes linear time.
inline void operator=(const SortableList<Type>&); inline void operator=(const SortableList<T>&);
}; };

View File

@ -61,14 +61,14 @@ public:
// Constructors // Constructors
//- Construct from UList and SubList size //- Construct from UList and sub-list size
inline SubList inline SubList
( (
const UList<T>& list, const UList<T>& list,
const label subSize const label subSize
); );
//- Construct from UList, start and end indices //- Construct from UList, sub-list size and start index
inline SubList inline SubList
( (
const UList<T>& list, const UList<T>& list,

View File

@ -51,18 +51,12 @@ SourceFiles
namespace Foam namespace Foam
{ {
//- Pre-declare related List type // Forward declaration of friend classes
template<class T> template<class T> class List;
class List; template<class T> class SubList;
//- Pre-declare related SubList type
template<class T>
class SubList;
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
template<class T> class UList; template<class T> class UList;
template<class T> Ostream& operator<<(Ostream&, const UList<T>&); template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
@ -157,10 +151,10 @@ public:
//- Write the UList as a dictionary entry. //- Write the UList as a dictionary entry.
void writeEntry(Ostream& os) const; void writeEntry(Ostream&) const;
//- Write the UList as a dictionary entry with keyword. //- Write the UList as a dictionary entry with keyword.
void writeEntry(const word& keyword, Ostream& os) const; void writeEntry(const word& keyword, Ostream&) const;
//- Assign elements to those from UList. //- Assign elements to those from UList.
void assign(const UList<T>&); void assign(const UList<T>&);
@ -306,11 +300,11 @@ public:
// Reverse the first n elements of the list // Reverse the first n elements of the list
template<class T> template<class T>
inline void reverse(UList<T>& ul, const label n); inline void reverse(UList<T>&, const label n);
// Reverse all the elements of the list // Reverse all the elements of the list
template<class T> template<class T>
inline void reverse(UList<T>& ul); inline void reverse(UList<T>&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -83,42 +83,42 @@ Foam::Ostream& Foam::operator<<(Foam::Ostream& os, const Foam::UList<T>& L)
if (uniform) if (uniform)
{ {
// Write size of list and start contents delimiter // Write size and start delimiter
os << L.size() << token::BEGIN_BLOCK; os << L.size() << token::BEGIN_BLOCK;
// Write list contents // Write contents
os << L[0]; os << L[0];
// Write end of contents delimiter // Write end delimiter
os << token::END_BLOCK; os << token::END_BLOCK;
} }
else if (L.size() < 11 && contiguous<T>()) else if (L.size() < 11 && contiguous<T>())
{ {
// Write size of list and start contents delimiter // Write size and start delimiter
os << L.size() << token::BEGIN_LIST; os << L.size() << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
if (i > 0) os << token::SPACE; if (i > 0) os << token::SPACE;
os << L[i]; os << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << token::END_LIST; os << token::END_LIST;
} }
else else
{ {
// Write size of list and start contents delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST; os << nl << L.size() << nl << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
os << nl << L[i]; os << nl << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << nl << token::END_LIST << nl; os << nl << token::END_LIST << nl;
} }
} }

View File

@ -29,36 +29,31 @@ License
#include "UPtrList.H" #include "UPtrList.H"
#include "PtrListLoopM.H" #include "PtrListLoopM.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class T> template<class T>
UPtrList<T>::UPtrList() Foam::UPtrList<T>::UPtrList()
: :
ptrs_() ptrs_()
{} {}
template<class T> template<class T>
UPtrList<T>::UPtrList(const label s) Foam::UPtrList<T>::UPtrList(const label s)
: :
ptrs_(s, reinterpret_cast<T*>(NULL)) ptrs_(s, reinterpret_cast<T*>(NULL))
{} {}
template<class T> template<class T>
UPtrList<T>::UPtrList(const xfer<UPtrList<T> >& lst) Foam::UPtrList<T>::UPtrList(const Xfer<UPtrList<T> >& lst)
{ {
transfer(lst()); transfer(lst());
} }
template<class T> template<class T>
UPtrList<T>::UPtrList(UPtrList<T>& a, bool reUse) Foam::UPtrList<T>::UPtrList(UPtrList<T>& a, bool reUse)
: :
ptrs_(a.ptrs_, reUse) ptrs_(a.ptrs_, reUse)
{} {}
@ -67,11 +62,11 @@ UPtrList<T>::UPtrList(UPtrList<T>& a, bool reUse)
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T> template<class T>
void UPtrList<T>::setSize(const label newSize) void Foam::UPtrList<T>::setSize(const label newSize)
{ {
label oldSize = size(); label oldSize = size();
if (newSize == 0) if (newSize <= 0)
{ {
clear(); clear();
} }
@ -83,8 +78,8 @@ void UPtrList<T>::setSize(const label newSize)
{ {
ptrs_.setSize(newSize); ptrs_.setSize(newSize);
register label i; // set new elements to NULL
for (i=oldSize; i<newSize; i++) for (register label i=oldSize; i<newSize; i++)
{ {
ptrs_[i] = NULL; ptrs_[i] = NULL;
} }
@ -93,7 +88,7 @@ void UPtrList<T>::setSize(const label newSize)
template<class T> template<class T>
void UPtrList<T>::clear() void Foam::UPtrList<T>::clear()
{ {
ptrs_.clear(); ptrs_.clear();
} }
@ -102,14 +97,14 @@ void UPtrList<T>::clear()
// Transfer the contents of the argument List into this List // Transfer the contents of the argument List into this List
// and anull the argument list // and anull the argument list
template<class T> template<class T>
void UPtrList<T>::transfer(UPtrList<T>& a) void Foam::UPtrList<T>::transfer(UPtrList<T>& a)
{ {
ptrs_.transfer(a.ptrs_); ptrs_.transfer(a.ptrs_);
} }
template<class T> template<class T>
void UPtrList<T>::reorder(const UList<label>& oldToNew) void Foam::UPtrList<T>::reorder(const UList<label>& oldToNew)
{ {
if (oldToNew.size() != size()) if (oldToNew.size() != size())
{ {
@ -156,10 +151,6 @@ void UPtrList<T>::reorder(const UList<label>& oldToNew)
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "UPtrListIO.C" #include "UPtrListIO.C"

View File

@ -111,7 +111,7 @@ public:
explicit UPtrList(const label); explicit UPtrList(const label);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
UPtrList(const xfer<UPtrList<T> >&); UPtrList(const Xfer<UPtrList<T> >&);
//- Construct as copy or re-use as specified. //- Construct as copy or re-use as specified.
UPtrList(UPtrList<T>&, bool reUse); UPtrList(UPtrList<T>&, bool reUse);
@ -139,8 +139,8 @@ public:
// UPtrList and annull the argument list. // UPtrList and annull the argument list.
void transfer(UPtrList<T>&); void transfer(UPtrList<T>&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
inline xfer<UPtrList<T> > transfer(); inline Xfer<UPtrList<T> > xfer();
//- Is element set //- Is element set
inline bool set(const label) const; inline bool set(const label) const;

View File

@ -51,11 +51,9 @@ inline T* Foam::UPtrList<T>::set(const label i, T* ptr)
} }
template<class T> template<class T>
inline Foam::xfer<Foam::UPtrList<T> > Foam::UPtrList<T>::transfer() inline Foam::Xfer<Foam::UPtrList<T> > Foam::UPtrList<T>::xfer()
{ {
Foam::xfer<UPtrList<T> > xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -32,16 +32,16 @@ License
template<class T> template<class T>
Foam::Ostream& Foam::operator<<(Ostream& os, const UPtrList<T>& L) Foam::Ostream& Foam::operator<<(Ostream& os, const UPtrList<T>& L)
{ {
// Write size of list and start contents delimiter // Write size and start delimiter
os << nl << L.size() << nl << token::BEGIN_LIST; os << nl << L.size() << nl << token::BEGIN_LIST;
// Write list contents // Write contents
forAll(L, i) forAll(L, i)
{ {
os << nl << L[i]; os << nl << L[i];
} }
// Write end of contents delimiter // Write end delimiter
os << nl << token::END_LIST << nl; os << nl << token::END_LIST << nl;
// Check state of IOstream // Check state of IOstream

View File

@ -40,7 +40,7 @@ Foam::NamedEnum<Enum, nEnum>::NamedEnum()
{ {
stringList goodNames(i); stringList goodNames(i);
for (label j = 0; j < i; j++) for (int j = 0; j < i; j++)
{ {
goodNames[j] = names[j]; goodNames[j] = names[j];
} }
@ -70,10 +70,9 @@ Enum Foam::NamedEnum<Enum, nEnum>::read(Istream& is) const
{ {
FatalIOErrorIn FatalIOErrorIn
( (
"NamedEnum<Enum, nEnum>::read(Istream& is) const", "NamedEnum<Enum, nEnum>::read(Istream&) const", is
is ) << name << " is not in enumeration: "
) << name << " is not in enumeration " << toc() << toc() << exit(FatalIOError);
<< exit(FatalIOError);
} }
return Enum(iter()); return Enum(iter());

View File

@ -79,10 +79,10 @@ public:
//- Read a word from Istream and return the corresponding //- Read a word from Istream and return the corresponding
// enumeration element // enumeration element
Enum read(Istream& is) const; Enum read(Istream&) const;
//- Write the name representation of the enumeration to an Ostream //- Write the name representation of the enumeration to an Ostream
void write(const Enum e, Ostream& os) const; void write(const Enum e, Ostream&) const;
// Member Operators // Member Operators

View File

@ -88,7 +88,7 @@ Foam::IOField<Type>::IOField(const IOobject& io, const Field<Type>& f)
template<class Type> template<class Type>
Foam::IOField<Type>::IOField(const IOobject& io, const xfer<Field<Type> >& f) Foam::IOField<Type>::IOField(const IOobject& io, const Xfer<Field<Type> >& f)
: :
regIOobject(io) regIOobject(io)
{ {

View File

@ -72,7 +72,7 @@ public:
IOField(const IOobject&, const Field<Type>&); IOField(const IOobject&, const Field<Type>&);
//- Construct by transferring the Field contents //- Construct by transferring the Field contents
IOField(const IOobject&, const xfer<Field<Type> >&); IOField(const IOobject&, const Xfer<Field<Type> >&);
// Destructor // Destructor

View File

@ -88,7 +88,7 @@ Foam::IOList<T>::IOList(const IOobject& io, const List<T>& list)
template<class T> template<class T>
Foam::IOList<T>::IOList(const IOobject& io, const xfer<List<T> >& list) Foam::IOList<T>::IOList(const IOobject& io, const Xfer<List<T> >& list)
: :
regIOobject(io) regIOobject(io)
{ {

View File

@ -73,7 +73,7 @@ public:
IOList(const IOobject&, const List<T>&); IOList(const IOobject&, const List<T>&);
//- Construct by transferring the List contents //- Construct by transferring the List contents
IOList(const IOobject&, const xfer<List<T> >&); IOList(const IOobject&, const Xfer<List<T> >&);
// Destructor // Destructor

View File

@ -87,7 +87,7 @@ Foam::IOMap<T>::IOMap(const IOobject& io, const Map<T>& map)
template<class T> template<class T>
Foam::IOMap<T>::IOMap(const IOobject& io, const xfer<Map<T> >& map) Foam::IOMap<T>::IOMap(const IOobject& io, const Xfer<Map<T> >& map)
: :
regIOobject(io) regIOobject(io)
{ {

View File

@ -73,7 +73,7 @@ public:
IOMap(const IOobject&, const Map<T>&); IOMap(const IOobject&, const Map<T>&);
//- Construct by transferring the Map contents //- Construct by transferring the Map contents
IOMap(const IOobject&, const xfer<Map<T> >&); IOMap(const IOobject&, const Xfer<Map<T> >&);
// Destructor // Destructor

View File

@ -85,7 +85,7 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
template<class T> template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const xfer<PtrList<T> >& list) Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const Xfer<PtrList<T> >& list)
: :
regIOobject(io) regIOobject(io)
{ {

View File

@ -74,7 +74,7 @@ public:
IOPtrList(const IOobject&, const PtrList<T>&); IOPtrList(const IOobject&, const PtrList<T>&);
//- Construct by transferring the PtrList contents //- Construct by transferring the PtrList contents
IOPtrList(const IOobject&, const xfer<PtrList<T> >&); IOPtrList(const IOobject&, const Xfer<PtrList<T> >&);
// Destructor // Destructor

View File

@ -170,7 +170,7 @@ Foam::dictionary::dictionary
Foam::dictionary::dictionary Foam::dictionary::dictionary
( (
const dictionary& parentDict, const dictionary& parentDict,
const xfer<dictionary>& dict const Xfer<dictionary>& dict
) )
: :
parent_(parentDict) parent_(parentDict)
@ -181,7 +181,7 @@ Foam::dictionary::dictionary
Foam::dictionary::dictionary Foam::dictionary::dictionary
( (
const xfer<dictionary>& dict const Xfer<dictionary>& dict
) )
: :
parent_(dictionary::null) parent_(dictionary::null)
@ -832,11 +832,9 @@ void Foam::dictionary::transfer(dictionary& dict)
} }
Foam::xfer<Foam::dictionary> Foam::dictionary::transfer() Foam::Xfer<Foam::dictionary> Foam::dictionary::xfer()
{ {
Foam::xfer<dictionary> xf; return xferMove(*this);
xf().transfer(*this);
return xf;
} }

View File

@ -167,10 +167,10 @@ public:
dictionary(const dictionary&); dictionary(const dictionary&);
//- Construct by transferring parameter contents given parent dictionary //- Construct by transferring parameter contents given parent dictionary
dictionary(const dictionary& parentDict, const xfer<dictionary>&); dictionary(const dictionary& parentDict, const Xfer<dictionary>&);
//- Construct top-level dictionary by transferring parameter contents //- Construct top-level dictionary by transferring parameter contents
dictionary(const xfer<dictionary>&); dictionary(const Xfer<dictionary>&);
//- Construct and return clone //- Construct and return clone
autoPtr<dictionary> clone() const; autoPtr<dictionary> clone() const;
@ -394,8 +394,8 @@ public:
//- Transfer the contents of the argument and annull the argument. //- Transfer the contents of the argument and annull the argument.
void transfer(dictionary&); void transfer(dictionary&);
//- Transfer the contents to the xfer container //- Transfer contents to the Xfer container
xfer<dictionary> transfer(); Xfer<dictionary> xfer();
// Write // Write

View File

@ -141,7 +141,7 @@ DimensionedField<Type, GeoMesh>::DimensionedField
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
DimensionedField<Type, GeoMesh>::DimensionedField DimensionedField<Type, GeoMesh>::DimensionedField
( (
const xfer<DimensionedField<Type, GeoMesh> >& df const Xfer<DimensionedField<Type, GeoMesh> >& df
) )
: :
regIOobject(df(), true), regIOobject(df(), true),
@ -219,7 +219,7 @@ template<class Type, class GeoMesh>
DimensionedField<Type, GeoMesh>::DimensionedField DimensionedField<Type, GeoMesh>::DimensionedField
( (
const word& newName, const word& newName,
const xfer<DimensionedField<Type, GeoMesh> >& df const Xfer<DimensionedField<Type, GeoMesh> >& df
) )
: :
regIOobject(IOobject(newName, df->time().timeName(), df->db())), regIOobject(IOobject(newName, df->time().timeName(), df->db())),

View File

@ -159,7 +159,7 @@ public:
//- Construct by transferring the DimensionedField //- Construct by transferring the DimensionedField
DimensionedField DimensionedField
( (
const xfer<DimensionedField<Type, GeoMesh> >& const Xfer<DimensionedField<Type, GeoMesh> >&
); );
//- Construct as copy of tmp<DimensionedField> deleting argument //- Construct as copy of tmp<DimensionedField> deleting argument
@ -196,7 +196,7 @@ public:
DimensionedField DimensionedField
( (
const word& newName, const word& newName,
const xfer<DimensionedField<Type, GeoMesh> >& const Xfer<DimensionedField<Type, GeoMesh> >&
); );
//- Construct as copy resetting name //- Construct as copy resetting name

View File

@ -37,7 +37,6 @@ SourceFiles
#define FieldField_H #define FieldField_H
#include "tmp.H" #include "tmp.H"
#include "xfer.H"
#include "PtrList.H" #include "PtrList.H"
#include "scalar.H" #include "scalar.H"
#include "direction.H" #include "direction.H"

View File

@ -156,7 +156,7 @@ Field<Type>::Field(Field<Type>& f, bool reUse)
template<class Type> template<class Type>
Field<Type>::Field(const xfer<Field<Type> >& f) Field<Type>::Field(const Xfer<Field<Type> >& f)
: :
List<Type>(f) List<Type>(f)
{} {}

View File

@ -43,7 +43,6 @@ SourceFiles
#define Field_H #define Field_H
#include "tmp.H" #include "tmp.H"
#include "xfer.H"
#include "direction.H" #include "direction.H"
#include "VectorSpace.H" #include "VectorSpace.H"
#include "scalarList.H" #include "scalarList.H"
@ -166,7 +165,7 @@ public:
Field(Field<Type>&, bool reUse); Field(Field<Type>&, bool reUse);
//- Construct by transferring the Field contents //- Construct by transferring the Field contents
Field(const xfer<Field<Type> >&); Field(const Xfer<Field<Type> >&);
//- Construct as copy of subField //- Construct as copy of subField
Field(const typename Field<Type>::subField&); Field(const typename Field<Type>::subField&);

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::xfer Foam::Xfer
Description Description
A simple container for copying or transferring objects of type \<T\>. A simple container for copying or transferring objects of type \<T\>.
@ -31,9 +31,9 @@ Description
The wrapped object of type \<T\> must implement a transfer() method and The wrapped object of type \<T\> must implement a transfer() method and
an operator=() copy method. an operator=() copy method.
Since it is decided upon construction of the xfer object whether the Since it is decided upon construction of the Xfer object whether the
parameter is to be copied or transferred, the contents of the resulting parameter is to be copied or transferred, the contents of the resulting
xfer object can be transferred unconditionally. This greatly simplifies Xfer object can be transferred unconditionally. This greatly simplifies
defining constructors or methods in other classes with mixed defining constructors or methods in other classes with mixed
transfer/copy semantics without requiring 2^N different versions. transfer/copy semantics without requiring 2^N different versions.
@ -54,12 +54,12 @@ SeeAlso
xferCopy, xferCopyTo, xferMove, xferMoveTo, xferTmp xferCopy, xferCopyTo, xferMove, xferMoveTo, xferTmp
SourceFiles SourceFiles
xferI.H XferI.H
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef xfer_H #ifndef Xfer_H
#define xfer_H #define Xfer_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -70,11 +70,11 @@ namespace Foam
template<class T> class tmp; template<class T> class tmp;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class xfer Declaration Class Xfer Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class T> template<class T>
class xfer class Xfer
{ {
// Private data // Private data
@ -87,25 +87,25 @@ public:
//- Store object pointer and manage its deletion //- Store object pointer and manage its deletion
// Can also be used later to transfer by assignment // Can also be used later to transfer by assignment
inline explicit xfer(T* = 0); inline explicit Xfer(T* = 0);
//- Construct by copying or by transferring the parameter contents //- Construct by copying or by transferring the parameter contents
inline explicit xfer(T&, bool allowTransfer=false); inline explicit Xfer(T&, bool allowTransfer=false);
//- Construct by copying the parameter contents //- Construct by copying the parameter contents
inline explicit xfer(const T&); inline explicit Xfer(const T&);
//- Construct by transferring the contents //- Construct by transferring the contents
inline xfer(const xfer<T>&); inline Xfer(const Xfer<T>&);
// Destructor // Destructor
inline ~xfer(); inline ~Xfer();
// Member Functions // Member Functions
//- Return a null object reference //- Return a null object reference
inline static const xfer<T>& null(); inline static const Xfer<T>& null();
// Member Operators // Member Operators
@ -113,7 +113,7 @@ public:
inline void operator=(T&); inline void operator=(T&);
//- Transfer the contents into the object //- Transfer the contents into the object
inline void operator=(const xfer<T>&); inline void operator=(const Xfer<T>&);
//- Reference to the underlying datatype //- Reference to the underlying datatype
inline T& operator()() const; inline T& operator()() const;
@ -129,37 +129,37 @@ public:
/** /**
* Construct by copying the contents of the @a arg * Construct by copying the contents of the @a arg
* *
* @sa xferCopyTo, xferMove, xferMoveTo, xferTmp and Foam::xfer * @sa xferCopyTo, xferMove, xferMoveTo, xferTmp and Foam::Xfer
*/ */
template<class T> template<class T>
inline xfer<T> xferCopy(const T&); inline Xfer<T> xferCopy(const T&);
/** /**
* Construct by transferring the contents of the @a arg * Construct by transferring the contents of the @a arg
* *
* @sa xferCopy, xferCopyTo, xferMoveTo, xferTmp and Foam::xfer * @sa xferCopy, xferCopyTo, xferMoveTo, xferTmp and Foam::Xfer
*/ */
template<class T> template<class T>
inline xfer<T> xferMove(T&); inline Xfer<T> xferMove(T&);
/** /**
* Construct by transferring the contents of the @a arg * Construct by transferring the contents of the @a arg
* *
* @sa xferCopy, xferCopyTo, xferMove, xferMoveTo and Foam::xfer * @sa xferCopy, xferCopyTo, xferMove, xferMoveTo and Foam::Xfer
*/ */
template<class T> template<class T>
inline xfer<T> xferTmp(Foam::tmp<T>&); inline Xfer<T> xferTmp(Foam::tmp<T>&);
/** /**
* Construct by copying the contents of the @a arg * Construct by copying the contents of the @a arg
* between dissimilar types * between dissimilar types
* *
* @sa xferCopy, xferMove, xferMoveTo, xferTmp and Foam::xfer * @sa xferCopy, xferMove, xferMoveTo, xferTmp and Foam::Xfer
*/ */
template<class To, class From> template<class To, class From>
inline xfer<To> xferCopyTo(const From&); inline Xfer<To> xferCopyTo(const From&);
/** /**
@ -173,10 +173,10 @@ inline xfer<To> xferCopyTo(const From&);
* labelList plainLst( xferMoveTo<labelList>(dynLst) ); * labelList plainLst( xferMoveTo<labelList>(dynLst) );
* @endcode * @endcode
* *
* @sa xferCopy, xferCopyTo, xferMove, xferTmp and Foam::xfer * @sa xferCopy, xferCopyTo, xferMove, xferTmp and Foam::Xfer
*/ */
template<class To, class From> template<class To, class From>
inline xfer<To> xferMoveTo(From&); inline Xfer<To> xferMoveTo(From&);
} // End namespace Foam } // End namespace Foam
@ -184,7 +184,7 @@ inline xfer<To> xferMoveTo(From&);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "xferI.H" #include "XferI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -27,14 +27,14 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T> template<class T>
inline Foam::xfer<T>::xfer(T* p) inline Foam::Xfer<T>::Xfer(T* p)
: :
ptr_(p ? p : new T) ptr_(p ? p : new T)
{} {}
template<class T> template<class T>
inline Foam::xfer<T>::xfer(T& t, bool allowTransfer) inline Foam::Xfer<T>::Xfer(T& t, bool allowTransfer)
: :
ptr_(new T) ptr_(new T)
{ {
@ -50,7 +50,7 @@ inline Foam::xfer<T>::xfer(T& t, bool allowTransfer)
template<class T> template<class T>
inline Foam::xfer<T>::xfer(const T& t) inline Foam::Xfer<T>::Xfer(const T& t)
: :
ptr_(new T) ptr_(new T)
{ {
@ -59,7 +59,7 @@ inline Foam::xfer<T>::xfer(const T& t)
template<class T> template<class T>
inline Foam::xfer<T>::xfer(const xfer<T>& t) inline Foam::Xfer<T>::Xfer(const Xfer<T>& t)
: :
ptr_(new T) ptr_(new T)
{ {
@ -70,7 +70,7 @@ inline Foam::xfer<T>::xfer(const xfer<T>& t)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class T> template<class T>
inline Foam::xfer<T>::~xfer() inline Foam::Xfer<T>::~Xfer()
{ {
delete ptr_; delete ptr_;
ptr_ = 0; ptr_ = 0;
@ -80,9 +80,9 @@ inline Foam::xfer<T>::~xfer()
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
template<class T> template<class T>
inline const Foam::xfer<T>& Foam::xfer<T>::null() inline const Foam::Xfer<T>& Foam::Xfer<T>::null()
{ {
xfer<T>* nullPtr = reinterpret_cast<xfer<T>*>(0); Xfer<T>* nullPtr = reinterpret_cast<Xfer<T>*>(0);
return *nullPtr; return *nullPtr;
} }
@ -90,14 +90,14 @@ inline const Foam::xfer<T>& Foam::xfer<T>::null()
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class T> template<class T>
inline void Foam::xfer<T>::operator=(T& t) inline void Foam::Xfer<T>::operator=(T& t)
{ {
ptr_->transfer(t); ptr_->transfer(t);
} }
template<class T> template<class T>
inline void Foam::xfer<T>::operator=(const xfer<T>& t) inline void Foam::Xfer<T>::operator=(const Xfer<T>& t)
{ {
// silently ignore attempted copy to self // silently ignore attempted copy to self
if (this != &t) if (this != &t)
@ -108,14 +108,14 @@ inline void Foam::xfer<T>::operator=(const xfer<T>& t)
template<class T> template<class T>
inline T& Foam::xfer<T>::operator()() const inline T& Foam::Xfer<T>::operator()() const
{ {
return *ptr_; return *ptr_;
} }
template<class T> template<class T>
inline T* Foam::xfer<T>::operator->() const inline T* Foam::Xfer<T>::operator->() const
{ {
return ptr_; return ptr_;
} }
@ -125,38 +125,39 @@ inline T* Foam::xfer<T>::operator->() const
template<class T> template<class T>
inline Foam::xfer<T> Foam::xferCopy(const T& t) inline Foam::Xfer<T> Foam::xferCopy(const T& t)
{ {
return Foam::xfer<T>(t); return Foam::Xfer<T>(t);
}
template<class T>
inline Foam::xfer<T> Foam::xferMove(T& t)
{
return Foam::xfer<T>(t, true);
} }
template<class T> template<class T>
inline Foam::xfer<T> Foam::xferTmp(Foam::tmp<T>& tt) inline Foam::Xfer<T> Foam::xferMove(T& t)
{ {
return Foam::xfer<T>(tt(), tt.isTmp()); return Foam::Xfer<T>(t, true);
}
template<class T>
inline Foam::Xfer<T> Foam::xferTmp(Foam::tmp<T>& tt)
{
return Foam::Xfer<T>(tt(), tt.isTmp());
} }
template<class To, class From> template<class To, class From>
inline Foam::xfer<To> Foam::xferCopyTo(const From& t) inline Foam::Xfer<To> Foam::xferCopyTo(const From& t)
{ {
Foam::xfer<To> xf; Foam::Xfer<To> xf;
xf() = t; xf() = t;
return xf; return xf;
} }
template<class To, class From> template<class To, class From>
inline Foam::xfer<To> Foam::xferMoveTo(From& t) inline Foam::Xfer<To> Foam::xferMoveTo(From& t)
{ {
Foam::xfer<To> xf; Foam::Xfer<To> xf;
xf().transfer(t); xf().transfer(t);
return xf; return xf;
} }

View File

@ -79,7 +79,7 @@ public:
explicit inline cell(const UList<label>&); explicit inline cell(const UList<label>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
explicit inline cell(const xfer<labelList>&); explicit inline cell(const Xfer<labelList>&);
//- Construct from Istream //- Construct from Istream
inline cell(Istream&); inline cell(Istream&);

View File

@ -47,7 +47,7 @@ inline Foam::cell::cell(const UList<label>& lst)
{} {}
inline Foam::cell::cell(const xfer<labelList>& lst) inline Foam::cell::cell(const Xfer<labelList>& lst)
: :
labelList(lst) labelList(lst)
{} {}

View File

@ -147,7 +147,7 @@ public:
explicit inline face(const labelList&); explicit inline face(const labelList&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
explicit inline face(const xfer<labelList>&); explicit inline face(const Xfer<labelList>&);
//- Copy construct from triFace //- Copy construct from triFace
face(const triFace&); face(const triFace&);

View File

@ -64,7 +64,7 @@ inline Foam::face::face(const labelList& lst)
{} {}
inline Foam::face::face(const xfer<labelList>& lst) inline Foam::face::face(const Xfer<labelList>& lst)
: :
labelList(lst) labelList(lst)
{} {}

View File

@ -273,10 +273,10 @@ Foam::polyMesh::polyMesh(const IOobject& io)
Foam::polyMesh::polyMesh Foam::polyMesh::polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& owner, const Xfer<labelList>& owner,
const xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const bool syncPar const bool syncPar
) )
: :
@ -429,9 +429,9 @@ Foam::polyMesh::polyMesh
Foam::polyMesh::polyMesh Foam::polyMesh::polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<cellList>& cells, const Xfer<cellList>& cells,
const bool syncPar const bool syncPar
) )
: :
@ -566,9 +566,9 @@ Foam::polyMesh::polyMesh
"polyMesh::polyMesh\n" "polyMesh::polyMesh\n"
"(\n" "(\n"
" const IOobject&,\n" " const IOobject&,\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const xfer<faceList>&,\n" " const Xfer<faceList>&,\n"
" const xfer<cellList>&\n" " const Xfer<cellList>&\n"
")\n" ")\n"
) << "Face " << faceI << "contains vertex labels out of range: " ) << "Face " << faceI << "contains vertex labels out of range: "
<< curFace << " Max point index = " << points_.size() << curFace << " Max point index = " << points_.size()
@ -591,9 +591,9 @@ Foam::polyMesh::polyMesh
"polyMesh::polyMesh\n" "polyMesh::polyMesh\n"
"(\n" "(\n"
" const IOobject&,\n" " const IOobject&,\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const xfer<faceList>&,\n" " const Xfer<faceList>&,\n"
" const xfer<cellList>&\n" " const Xfer<cellList>&\n"
")\n" ")\n"
) << "Cell " << cellI << "contains face labels out of range: " ) << "Cell " << cellI << "contains face labels out of range: "
<< curCell << " Max face index = " << faces_.size() << curCell << " Max face index = " << faces_.size()
@ -608,10 +608,10 @@ Foam::polyMesh::polyMesh
void Foam::polyMesh::resetPrimitives void Foam::polyMesh::resetPrimitives
( (
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& owner, const Xfer<labelList>& owner,
const xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const labelList& patchSizes, const labelList& patchSizes,
const labelList& patchStarts, const labelList& patchStarts,
const bool validBoundary const bool validBoundary
@ -672,10 +672,10 @@ void Foam::polyMesh::resetPrimitives
( (
"polyMesh::polyMesh::resetPrimitives\n" "polyMesh::polyMesh::resetPrimitives\n"
"(\n" "(\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const xfer<faceList>&,\n" " const Xfer<faceList>&,\n"
" const xfer<labelList>& owner,\n" " const Xfer<labelList>& owner,\n"
" const xfer<labelList>& neighbour,\n" " const Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n" " const labelList& patchSizes,\n"
" const labelList& patchStarts\n" " const labelList& patchStarts\n"
")\n" ")\n"
@ -710,10 +710,10 @@ void Foam::polyMesh::resetPrimitives
( (
"polyMesh::polyMesh::resetPrimitives\n" "polyMesh::polyMesh::resetPrimitives\n"
"(\n" "(\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const xfer<faceList>&,\n" " const Xfer<faceList>&,\n"
" const xfer<labelList>& owner,\n" " const Xfer<labelList>& owner,\n"
" const xfer<labelList>& neighbour,\n" " const Xfer<labelList>& neighbour,\n"
" const labelList& patchSizes,\n" " const labelList& patchSizes,\n"
" const labelList& patchStarts\n" " const labelList& patchStarts\n"
")\n" ")\n"

View File

@ -219,10 +219,10 @@ public:
polyMesh polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& owner, const Xfer<labelList>& owner,
const xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const bool syncPar = true const bool syncPar = true
); );
@ -231,9 +231,9 @@ public:
polyMesh polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<cellList>& cells, const Xfer<cellList>& cells,
const bool syncPar = true const bool syncPar = true
); );
@ -241,7 +241,7 @@ public:
polyMesh polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& shapes, const cellShapeList& shapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames, const wordList& boundaryPatchNames,
@ -434,10 +434,10 @@ public:
// patch ends at nActiveFaces) and change patches with addPatches. // patch ends at nActiveFaces) and change patches with addPatches.
void resetPrimitives void resetPrimitives
( (
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& owner, const Xfer<labelList>& owner,
const xfer<labelList>& neighbour, const Xfer<labelList>& neighbour,
const labelList& patchSizes, const labelList& patchSizes,
const labelList& patchStarts, const labelList& patchStarts,
const bool validBoundary = true const bool validBoundary = true

View File

@ -136,7 +136,7 @@ Foam::labelList Foam::polyMesh::facePatchFaceCells
Foam::polyMesh::polyMesh Foam::polyMesh::polyMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const cellShapeList& cellsAsShapes, const cellShapeList& cellsAsShapes,
const faceListList& boundaryFaces, const faceListList& boundaryFaces,
const wordList& boundaryPatchNames, const wordList& boundaryPatchNames,
@ -415,7 +415,7 @@ Foam::polyMesh::polyMesh
"polyMesh::polyMesh\n" "polyMesh::polyMesh\n"
"(\n" "(\n"
" const IOobject&,\n" " const IOobject&,\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const cellShapeList& cellsAsShapes,\n" " const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n" " const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchTypes,\n" " const wordList& boundaryPatchTypes,\n"
@ -473,7 +473,7 @@ Foam::polyMesh::polyMesh
"polyMesh::polyMesh\n" "polyMesh::polyMesh\n"
"(\n" "(\n"
" const IOobject&,\n" " const IOobject&,\n"
" const xfer<pointField>&,\n" " const Xfer<pointField>&,\n"
" const cellShapeList& cellsAsShapes,\n" " const cellShapeList& cellsAsShapes,\n"
" const faceListList& boundaryFaces,\n" " const faceListList& boundaryFaces,\n"
" const wordList& boundaryPatchTypes,\n" " const wordList& boundaryPatchTypes,\n"

View File

@ -117,7 +117,7 @@ Foam::cellZone::cellZone
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const cellZoneMesh& zm const cellZoneMesh& zm
) )
@ -167,7 +167,7 @@ Foam::cellZone::cellZone
Foam::cellZone::cellZone Foam::cellZone::cellZone
( (
const cellZone& cz, const cellZone& cz,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const cellZoneMesh& zm const cellZoneMesh& zm
) )

View File

@ -135,7 +135,7 @@ public:
cellZone cellZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const cellZoneMesh& const cellZoneMesh&
); );
@ -164,7 +164,7 @@ public:
cellZone cellZone
( (
const cellZone&, const cellZone&,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const cellZoneMesh& const cellZoneMesh&
); );

View File

@ -245,8 +245,8 @@ Foam::faceZone::faceZone
Foam::faceZone::faceZone Foam::faceZone::faceZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const xfer<boolList>& fm, const Xfer<boolList>& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
) )
@ -319,8 +319,8 @@ Foam::faceZone::faceZone
Foam::faceZone::faceZone Foam::faceZone::faceZone
( (
const faceZone& fz, const faceZone& fz,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const xfer<boolList>& fm, const Xfer<boolList>& fm,
const label index, const label index,
const faceZoneMesh& zm const faceZoneMesh& zm
) )

View File

@ -167,8 +167,8 @@ public:
faceZone faceZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const xfer<boolList>& fm, const Xfer<boolList>& fm,
const label index, const label index,
const faceZoneMesh& const faceZoneMesh&
); );
@ -198,8 +198,8 @@ public:
faceZone faceZone
( (
const faceZone&, const faceZone&,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const xfer<boolList>& fm, const Xfer<boolList>& fm,
const label index, const label index,
const faceZoneMesh& const faceZoneMesh&
); );

View File

@ -115,7 +115,7 @@ Foam::pointZone::pointZone
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const pointZoneMesh& zm const pointZoneMesh& zm
) )
@ -166,7 +166,7 @@ Foam::pointZone::pointZone
Foam::pointZone::pointZone Foam::pointZone::pointZone
( (
const pointZone& pz, const pointZone& pz,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const pointZoneMesh& zm const pointZoneMesh& zm
) )

View File

@ -137,7 +137,7 @@ public:
pointZone pointZone
( (
const word& name, const word& name,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const pointZoneMesh& const pointZoneMesh&
); );
@ -166,7 +166,7 @@ public:
pointZone pointZone
( (
const pointZone&, const pointZone&,
const xfer<labelList>& addr, const Xfer<labelList>& addr,
const label index, const label index,
const pointZoneMesh& const pointZoneMesh&
); );

View File

@ -288,7 +288,7 @@ void Foam::primitiveMesh::reset
const label nInternalFaces, const label nInternalFaces,
const label nFaces, const label nFaces,
const label nCells, const label nCells,
const xfer<cellList>& clst const Xfer<cellList>& clst
) )
{ {
reset reset

View File

@ -382,7 +382,7 @@ public:
const label nInternalFaces, const label nInternalFaces,
const label nFaces, const label nFaces,
const label nCells, const label nCells,
const xfer<cellList>& cells const Xfer<cellList>& cells
); );

View File

@ -228,10 +228,10 @@ Foam::fvMesh::fvMesh(const IOobject& io)
Foam::fvMesh::fvMesh Foam::fvMesh::fvMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& allOwner, const Xfer<labelList>& allOwner,
const xfer<labelList>& allNeighbour, const Xfer<labelList>& allNeighbour,
const bool syncPar const bool syncPar
) )
: :
@ -259,9 +259,9 @@ Foam::fvMesh::fvMesh
Foam::fvMesh::fvMesh Foam::fvMesh::fvMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<cellList>& cells, const Xfer<cellList>& cells,
const bool syncPar const bool syncPar
) )
: :

View File

@ -173,10 +173,10 @@ public:
fvMesh fvMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<labelList>& allOwner, const Xfer<labelList>& allOwner,
const xfer<labelList>& allNeighbour, const Xfer<labelList>& allNeighbour,
const bool syncPar = true const bool syncPar = true
); );
@ -185,9 +185,9 @@ public:
fvMesh fvMesh
( (
const IOobject& io, const IOobject& io,
const xfer<pointField>& points, const Xfer<pointField>& points,
const xfer<faceList>& faces, const Xfer<faceList>& faces,
const xfer<cellList>& cells, const Xfer<cellList>& cells,
const bool syncPar = true const bool syncPar = true
); );

View File

@ -57,7 +57,7 @@ Foam::coordinateSystems::coordinateSystems
Foam::coordinateSystems::coordinateSystems Foam::coordinateSystems::coordinateSystems
( (
const IOobject& io, const IOobject& io,
const xfer<PtrList<coordinateSystem> >& lst const Xfer<PtrList<coordinateSystem> >& lst
) )
: :
IOPtrList<coordinateSystem>(io, lst) IOPtrList<coordinateSystem>(io, lst)

View File

@ -85,7 +85,7 @@ public:
coordinateSystems coordinateSystems
( (
const IOobject&, const IOobject&,
const xfer<PtrList<coordinateSystem> >& const Xfer<PtrList<coordinateSystem> >&
); );
// Selectors // Selectors

View File

@ -756,10 +756,10 @@ bool Foam::polyMeshZipUpCells(polyMesh& mesh)
// (patches guaranteed to be in increasing order) // (patches guaranteed to be in increasing order)
mesh.resetPrimitives mesh.resetPrimitives
( (
xfer<pointField>::null(), Xfer<pointField>::null(),
xferMove(newFaces), xferMove(newFaces),
xfer<labelList>::null(), Xfer<labelList>::null(),
xfer<labelList>::null(), Xfer<labelList>::null(),
patchSizes, patchSizes,
patchStarts, patchStarts,
true // boundary forms valid boundary mesh. true // boundary forms valid boundary mesh.

View File

@ -48,8 +48,8 @@ Foam::BasicMeshedSurface<Face>::BasicMeshedSurface()
template<class Face> template<class Face>
Foam::BasicMeshedSurface<Face>::BasicMeshedSurface Foam::BasicMeshedSurface<Face>::BasicMeshedSurface
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst const Xfer<List<Face> >& faceLst
) )
: :
ParentType(List<Face>(), pointField()) ParentType(List<Face>(), pointField())
@ -111,8 +111,8 @@ void Foam::BasicMeshedSurface<Face>::scalePoints(const scalar& scaleFactor)
template<class Face> template<class Face>
void Foam::BasicMeshedSurface<Face>::reset void Foam::BasicMeshedSurface<Face>::reset
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst const Xfer<List<Face> >& faceLst
) )
{ {
ParentType::clearOut(); ParentType::clearOut();

View File

@ -38,7 +38,6 @@ SourceFiles
#include "PrimitivePatchExtra.H" #include "PrimitivePatchExtra.H"
#include "pointField.H" #include "pointField.H"
#include "xfer.H"
#include "face.H" #include "face.H"
#include "triFace.H" #include "triFace.H"
@ -103,8 +102,8 @@ public:
//- Construct by transferring components (points, faces). //- Construct by transferring components (points, faces).
BasicMeshedSurface BasicMeshedSurface
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >& const Xfer<List<Face> >&
); );
// Destructor // Destructor
@ -135,8 +134,8 @@ public:
//- Transfer components (points, faces). //- Transfer components (points, faces).
virtual void reset virtual void reset
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >& const Xfer<List<Face> >&
); );
//- Remove invalid faces //- Remove invalid faces

View File

@ -164,9 +164,9 @@ Foam::MeshedSurface<Face>::MeshedSurface()
template<class Face> template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface Foam::MeshedSurface<Face>::MeshedSurface
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst, const Xfer<List<Face> >& faceLst,
const xfer<surfGroupList>& patchLst const Xfer<surfGroupList>& patchLst
) )
: :
ParentType(pointLst, faceLst), ParentType(pointLst, faceLst),
@ -177,8 +177,8 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face> template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface Foam::MeshedSurface<Face>::MeshedSurface
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst, const Xfer<List<Face> >& faceLst,
const UList<label>& patchSizes, const UList<label>& patchSizes,
const UList<word>& patchNames const UList<word>& patchNames
) )
@ -395,7 +395,7 @@ Foam::MeshedSurface<Face>::MeshedSurface(const MeshedSurface& surf)
template<class Face> template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface Foam::MeshedSurface<Face>::MeshedSurface
( (
const xfer<UnsortedMeshedSurface<Face> >& surf const Xfer<UnsortedMeshedSurface<Face> >& surf
) )
{ {
transfer(surf()); transfer(surf());
@ -403,7 +403,7 @@ Foam::MeshedSurface<Face>::MeshedSurface
template<class Face> template<class Face>
Foam::MeshedSurface<Face>::MeshedSurface(const xfer<MeshedSurface>& surf) Foam::MeshedSurface<Face>::MeshedSurface(const Xfer<MeshedSurface>& surf)
{ {
transfer(surf()); transfer(surf());
} }
@ -493,8 +493,8 @@ void Foam::MeshedSurface<Face>::checkPatches()
template<class Face> template<class Face>
void Foam::MeshedSurface<Face>::sortFacesAndStore void Foam::MeshedSurface<Face>::sortFacesAndStore
( (
const xfer<List<Face> >& unsortedFaces, const Xfer<List<Face> >& unsortedFaces,
const xfer<List<label> >& regionIds, const Xfer<List<label> >& regionIds,
const bool sorted const bool sorted
) )
{ {

View File

@ -107,8 +107,8 @@ protected:
//- sort faces by regions and store sorted faces //- sort faces by regions and store sorted faces
void sortFacesAndStore void sortFacesAndStore
( (
const xfer<List<Face> >& unsortedFaces, const Xfer<List<Face> >& unsortedFaces,
const xfer<List<label> >& regionIds, const Xfer<List<label> >& regionIds,
const bool sorted const bool sorted
); );
@ -142,17 +142,17 @@ public:
//- Construct by transferring components (points, faces, patches). //- Construct by transferring components (points, faces, patches).
MeshedSurface MeshedSurface
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >&, const Xfer<List<Face> >&,
const xfer<surfGroupList>& const Xfer<surfGroupList>&
); );
//- Construct by transferring points, faces. //- Construct by transferring points, faces.
// Use patch information, or set single default patch. // Use patch information, or set single default patch.
MeshedSurface MeshedSurface
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >&, const Xfer<List<Face> >&,
const UList<label>& patchSizes = UList<label>::null(), const UList<label>& patchSizes = UList<label>::null(),
const UList<word>& patchNames = UList<word>::null() const UList<word>& patchNames = UList<word>::null()
); );
@ -171,10 +171,10 @@ public:
MeshedSurface(const surfMesh&); MeshedSurface(const surfMesh&);
//- Construct by transferring the contents from a UnsortedMeshedSurface //- Construct by transferring the contents from a UnsortedMeshedSurface
MeshedSurface(const xfer<UnsortedMeshedSurface<Face> >&); MeshedSurface(const Xfer<UnsortedMeshedSurface<Face> >&);
//- Construct by transferring the contents from a MeshedSurface //- Construct by transferring the contents from a MeshedSurface
MeshedSurface(const xfer<MeshedSurface<Face> >&); MeshedSurface(const Xfer<MeshedSurface<Face> >&);
//- Construct from file name (uses extension to determine type) //- Construct from file name (uses extension to determine type)
MeshedSurface(const fileName&); MeshedSurface(const fileName&);

View File

@ -61,7 +61,7 @@ bool Foam::MeshedSurface<Face>::read(Istream& is)
MeshedSurface<face> surf; MeshedSurface<face> surf;
surf.reset surf.reset
( (
xfer<pointField>::null(), Xfer<pointField>::null(),
xferMove(faceLst) xferMove(faceLst)
); );
surf.addPatches(patches_); surf.addPatches(patches_);

View File

@ -161,10 +161,10 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface()
template<class Face> template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst, const Xfer<List<Face> >& faceLst,
const xfer<List<label> >& regionIds, const Xfer<List<label> >& regionIds,
const xfer<surfPatchIdentifierList>& patchLst const Xfer<surfPatchIdentifierList>& patchLst
) )
: :
ParentType(pointLst, faceLst), ParentType(pointLst, faceLst),
@ -176,8 +176,8 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face> template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst, const Xfer<List<Face> >& faceLst,
const UList<label>& patchSizes, const UList<label>& patchSizes,
const UList<word>& patchNames const UList<word>& patchNames
) )
@ -274,7 +274,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face> template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
( (
const xfer<UnsortedMeshedSurface<Face> >& surf const Xfer<UnsortedMeshedSurface<Face> >& surf
) )
{ {
transfer(surf()); transfer(surf());
@ -284,7 +284,7 @@ Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
template<class Face> template<class Face>
Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface Foam::UnsortedMeshedSurface<Face>::UnsortedMeshedSurface
( (
const xfer<MeshedSurface<Face> >& surf const Xfer<MeshedSurface<Face> >& surf
) )
{ {
transfer(surf()); transfer(surf());
@ -532,9 +532,9 @@ Foam::UnsortedMeshedSurface<Face> Foam::UnsortedMeshedSurface<Face>::subsetMesh
template<class Face> template<class Face>
void Foam::UnsortedMeshedSurface<Face>::reset void Foam::UnsortedMeshedSurface<Face>::reset
( (
const xfer<pointField>& pointLst, const Xfer<pointField>& pointLst,
const xfer<List<Face> >& faceLst, const Xfer<List<Face> >& faceLst,
const xfer<List<label> >& regionIds const Xfer<List<label> >& regionIds
) )
{ {
ParentType::reset(pointLst, faceLst); ParentType::reset(pointLst, faceLst);

View File

@ -155,18 +155,18 @@ public:
// (points, faces, region ids, patches). // (points, faces, region ids, patches).
UnsortedMeshedSurface UnsortedMeshedSurface
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >&, const Xfer<List<Face> >&,
const xfer<List<label> >& regionIds, const Xfer<List<label> >& regionIds,
const xfer<surfPatchIdentifierList>& const Xfer<surfPatchIdentifierList>&
); );
//- Construct by transferring points, faces. //- Construct by transferring points, faces.
// Use patch information, or set single default patch // Use patch information, or set single default patch
UnsortedMeshedSurface UnsortedMeshedSurface
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >&, const Xfer<List<Face> >&,
const UList<label>& patchSizes = UList<label>::null(), const UList<label>& patchSizes = UList<label>::null(),
const UList<word>& patchNames = UList<word>::null() const UList<word>& patchNames = UList<word>::null()
); );
@ -182,10 +182,10 @@ public:
UnsortedMeshedSurface(const MeshedSurface<Face>&); UnsortedMeshedSurface(const MeshedSurface<Face>&);
//- Construct by transferring the contents from a UnsortedMeshedSurface //- Construct by transferring the contents from a UnsortedMeshedSurface
UnsortedMeshedSurface(const xfer<UnsortedMeshedSurface<Face> >&); UnsortedMeshedSurface(const Xfer<UnsortedMeshedSurface<Face> >&);
//- Construct by transferring the contents from a meshedSurface //- Construct by transferring the contents from a meshedSurface
UnsortedMeshedSurface(const xfer<MeshedSurface<Face> >&); UnsortedMeshedSurface(const Xfer<MeshedSurface<Face> >&);
//- Construct from file name (uses extension to determine type) //- Construct from file name (uses extension to determine type)
UnsortedMeshedSurface(const fileName&); UnsortedMeshedSurface(const fileName&);
@ -317,9 +317,9 @@ public:
//- Transfer components (points, faces, region ids). //- Transfer components (points, faces, region ids).
virtual void reset virtual void reset
( (
const xfer<pointField>&, const Xfer<pointField>&,
const xfer<List<Face> >&, const Xfer<List<Face> >&,
const xfer<List<label> >& regionIds = xfer<List<label> >::null() const Xfer<List<label> >& regionIds = Xfer<List<label> >::null()
); );
//- Transfer the contents of the argument and annull the argument //- Transfer the contents of the argument and annull the argument