ENH: support HashTable iterator pointer dereference

This commit is contained in:
Mark Olesen
2019-04-06 16:00:21 +02:00
committed by Andrew Heather
parent d4eb17a9ff
commit 39c91d8440
20 changed files with 300 additions and 115 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation | Copyright (C) 2011-2016 OpenFOAM Foundation
@ -31,9 +31,53 @@ Description
#include "HashTable.H" #include "HashTable.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "Map.H" #include "Map.H"
#include "FlatOutput.H"
using namespace Foam; using namespace Foam;
// Simple wrapper for testing purposes
class Label
{
label data_;
public:
Label()
:
data_(0)
{}
Label(label val)
:
data_(val)
{}
~Label()
{
Info<<"delete label: " << data_ << endl;
}
// Some arbitrary non-const method (for testing)
label increment()
{
return ++data_;
}
// Some arbitrary method (for testing)
std::string info() const
{
return "boxed label=" + std::to_string(data_);
}
friend Ostream& operator<<(Ostream& os, const Label& val)
{
os << val.data_;
return os;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
@ -46,7 +90,7 @@ int main(int argc, char *argv[])
}; };
Info<< "table1: " << table1 << nl Info<< "table1: " << table1 << nl
<< "toc: " << table1.toc() << endl; << "toc: " << flatOutput(table1.toc()) << nl;
HashTable<label, label, Hash<label>> table2 HashTable<label, label, Hash<label>> table2
{ {
@ -56,31 +100,156 @@ int main(int argc, char *argv[])
}; };
Info<< "table2: " << table2 << nl Info<< "table2: " << table2 << nl
<< "toc: " << table2.toc() << endl; << "toc: " << flatOutput(table2.toc()) << nl;
Map<label> table3(1); Map<label> table3(1);
table3.transfer(table2); table3.transfer(table2);
Info<< "table2: " << table2 << nl Info<< "table2: " << table2 << nl
<< "toc: " << table2.toc() << endl; << "toc: " << flatOutput(table2.toc()) << nl;
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << flatOutput(table3.toc()) << nl;
Map<label> table4(std::move(table3)); Map<label> table4(std::move(table3));
Info<< "table3: " << table3 << nl Info<< "table3: " << table3 << nl
<< "toc: " << table3.toc() << endl; << "toc: " << flatOutput(table3.toc()) << nl;
Info<< "table4: " << table4 << nl Info<< "table4: " << table4 << nl
<< "toc: " << table4.toc() << endl; << "toc: " << flatOutput(table4.toc()) << nl;
HashPtrTable<label, Foam::string> ptable1(0); {
ptable1.insert("kjhkjh", autoPtr<label>::New(10)); HashTable<Label, Foam::string> table1(0);
table1.insert("abc", 5);
table1.insert("def", 10);
table1.insert("ghi", 15);
table1.insert("jkl", 20);
Info<< "PtrTable toc: " << ptable1.toc() << endl; Info<< nl << "Table toc: " << flatOutput(table1.toc()) << nl;
Info<< "End\n" << endl; for (const word k : { "abc" })
{
const auto iter = table1.cfind(k);
if (iter.good())
{
Info<< "have " << k << nl
<< " info: " << (*iter).info() << nl
// Good: does not compile
// << " info: " << iter->info() << nl
;
}
auto iter2 = table1.find(k);
if (iter2.good())
{
Info<< "have " << k << nl
<< " incr: " << (*iter2).increment() << nl
// Good: does not compile
// << " incr: " << iter2->increment() << nl
;
}
}
}
{
HashPtrTable<Label> ptable1(0);
ptable1.insert("abc", autoPtr<Label>::New(5));
ptable1.insert("def", autoPtr<Label>::New(10));
ptable1.insert("ghi", autoPtr<Label>::New(15));
ptable1.insert("jkl", autoPtr<Label>::New(20));
Info<< nl << "PtrTable toc: " << flatOutput(ptable1.toc()) << nl;
for (const word k : { "abc" })
{
const auto iter = ptable1.cfind(k);
// Note: increment() changes contents of pointers,
// not the pointers themselves.
if (iter.good())
{
Info<< "have " << k << nl
<< " addr: " << long(*iter) << nl
<< " info: " << (*iter)->info() << nl
<< " info: " << iter->info() << nl
<< " incr: " << iter->increment() << nl
;
}
auto iter2 = ptable1.find(k);
if (iter2.good())
{
Info<< "have " << k << nl
<< " incr: " << (*iter2)->increment() << nl
<< " incr: " << iter2->increment() << nl
;
}
}
// Attempt the same again
HashTable<Label*> tableView1;
HashTable<const Label*> tableView2;
forAllConstIters(ptable1, iter)
{
tableView1.insert(iter.key(), iter.val());
tableView2.insert(iter.key(), iter.val());
}
Info<< nl << "Table<pointer> toc: "
<< flatOutput(tableView1.toc()) << nl;
for (const word k : { "abc" })
{
const auto iter1 = tableView1.cfind(k);
// Note that increment changes contents of the pointers
// not the table
if (iter1.good())
{
Info<< "have " << k << nl
<< " addr: " << long(*iter1) << nl
<< " info: " << (*iter1)->info() << nl
<< " info: " << iter1->info() << nl
<< " incr: " << iter1->increment() << nl
;
}
auto iter2 = tableView2.cfind(k);
if (iter2.good())
{
Info<< "have " << k << nl
<< " addr: " << long(*iter2) << nl
<< " info: " << (*iter2)->info() << nl
<< " info: " << iter2->info() << nl
// Good: does not compile
// << " incr: " << iter2->increment() << nl
;
}
auto iter3 = tableView2.find(k);
if (iter3.good())
{
Info<< "have " << k << nl
<< " addr: " << long(*iter3) << nl
<< " info: " << (*iter3)->info() << nl
<< " info: " << iter3->info() << nl
// Good: does not compile
// << " incr: " << iter3->increment() << nl
;
}
}
Info<< nl << "Ending scope" << nl;
}
Info<< "\nEnd\n" << endl;
return 0; return 0;
} }

View File

@ -30,7 +30,6 @@ Description
#include "argList.H" #include "argList.H"
#include "HashTable.H" #include "HashTable.H"
#include "HashPtrTable.H"
#include "Map.H" #include "Map.H"
#include "cpuTime.H" #include "cpuTime.H"

View File

@ -58,7 +58,7 @@ void RotateFields
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
Info<< " Rotating " << fieldIter()->name() << endl; Info<< " Rotating " << fieldIter->name() << endl;
GeometricField fld(*fieldIter(), mesh); GeometricField fld(*fieldIter(), mesh);
transform(fld, dimensionedTensor(rotT), fld); transform(fld, dimensionedTensor(rotT), fld);

View File

@ -360,7 +360,7 @@ int main(int argc, char *argv[])
forAllConstIters(objects, iter) forAllConstIters(objects, iter)
{ {
const word& headerClassName = iter()->headerClassName(); const word& headerClassName = iter->headerClassName();
if if
( (
@ -390,11 +390,11 @@ int main(int argc, char *argv[])
) )
{ {
Info<< " Reading " << headerClassName Info<< " Reading " << headerClassName
<< " : " << iter()->name() << endl; << " : " << iter->name() << endl;
fieldDictionary fDict(*iter(), headerClassName); fieldDictionary fDict(*iter(), headerClassName);
Info<< " Writing " << iter()->name() << endl; Info<< " Writing " << iter->name() << endl;
fDict.regIOobject::write(); fDict.regIOobject::write();
} }
} }

View File

@ -73,8 +73,8 @@ void Foam::vtkPVFoam::convertVolFields()
Info<< "<beg> " << FUNCTION_NAME << nl; Info<< "<beg> " << FUNCTION_NAME << nl;
forAllConstIters(objects, iter) forAllConstIters(objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter->objectPath() << nl;
} }
printMemory(); printMemory();
} }
@ -149,8 +149,8 @@ void Foam::vtkPVFoam::convertPointFields()
Info<< "<beg> convert volume -> point fields" << nl; Info<< "<beg> convert volume -> point fields" << nl;
forAllConstIters(objects, iter) forAllConstIters(objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter->objectPath() << nl;
} }
printMemory(); printMemory();
} }
@ -205,8 +205,8 @@ void Foam::vtkPVFoam::convertAreaFields()
Info<< "<beg> " << FUNCTION_NAME << nl; Info<< "<beg> " << FUNCTION_NAME << nl;
forAllConstIters(objects, iter) forAllConstIters(objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter->objectPath() << nl;
} }
printMemory(); printMemory();
} }
@ -282,8 +282,8 @@ void Foam::vtkPVFoam::convertLagrangianFields()
Info<< "converting OpenFOAM lagrangian fields" << nl; Info<< "converting OpenFOAM lagrangian fields" << nl;
forAllConstIters(objects, iter) forAllConstIters(objects, iter)
{ {
Info<< " " << iter()->name() Info<< " " << iter->name()
<< " == " << iter()->objectPath() << nl; << " == " << iter->objectPath() << nl;
} }
} }

View File

@ -55,7 +55,7 @@ void MapConsistentVolFields
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
Info<< " interpolating " << fieldIter()->name() Info<< " interpolating " << fieldIter->name()
<< endl; << endl;
// Read field. Do not auto-load old-time field // Read field. Do not auto-load old-time field
@ -63,7 +63,7 @@ void MapConsistentVolFields
IOobject fieldTargetIOobject IOobject fieldTargetIOobject
( (
fieldIter()->name(), fieldIter->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
meshTarget, meshTarget,
IOobject::MUST_READ, IOobject::MUST_READ,

View File

@ -65,7 +65,7 @@ void MapLagrangianFields
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
Info<< " mapping lagrangian field " Info<< " mapping lagrangian field "
<< fieldIter()->name() << endl; << fieldIter->name() << endl;
// Read field (does not need mesh) // Read field (does not need mesh)
IOField<Type> fieldSource(*fieldIter()); IOField<Type> fieldSource(*fieldIter());
@ -75,7 +75,7 @@ void MapLagrangianFields
( (
IOobject IOobject
( (
fieldIter()->name(), fieldIter->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
cloud::prefix/cloudName, cloud::prefix/cloudName,
meshTarget, meshTarget,
@ -103,7 +103,7 @@ void MapLagrangianFields
forAllConstIters(fieldFields, fieldIter) forAllConstIters(fieldFields, fieldIter)
{ {
Info<< " mapping lagrangian fieldField " Info<< " mapping lagrangian fieldField "
<< fieldIter()->name() << endl; << fieldIter->name() << endl;
// Read field (does not need mesh) // Read field (does not need mesh)
IOField<Field<Type>> fieldSource(*fieldIter()); IOField<Field<Type>> fieldSource(*fieldIter());
@ -114,7 +114,7 @@ void MapLagrangianFields
( (
IOobject IOobject
( (
fieldIter()->name(), fieldIter->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
cloud::prefix/cloudName, cloud::prefix/cloudName,
meshTarget, meshTarget,
@ -142,7 +142,7 @@ void MapLagrangianFields
forAllConstIters(fieldFields, fieldIter) forAllConstIters(fieldFields, fieldIter)
{ {
Info<< " mapping lagrangian fieldField " Info<< " mapping lagrangian fieldField "
<< fieldIter()->name() << endl; << fieldIter->name() << endl;
// Read field (does not need mesh) // Read field (does not need mesh)
CompactIOField<Field<Type>, Type> fieldSource(*fieldIter()); CompactIOField<Field<Type>, Type> fieldSource(*fieldIter());
@ -152,7 +152,7 @@ void MapLagrangianFields
( (
IOobject IOobject
( (
fieldIter()->name(), fieldIter->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
cloud::prefix/cloudName, cloud::prefix/cloudName,
meshTarget, meshTarget,

View File

@ -57,7 +57,7 @@ void MapVolFields
{ {
IOobject fieldTargetIOobject IOobject fieldTargetIOobject
( (
fieldIter()->name(), fieldIter->name(),
meshTarget.time().timeName(), meshTarget.time().timeName(),
meshTarget, meshTarget,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -66,7 +66,7 @@ void MapVolFields
if (fieldTargetIOobject.typeHeaderOk<fieldType>(true)) if (fieldTargetIOobject.typeHeaderOk<fieldType>(true))
{ {
Info<< " interpolating " << fieldIter()->name() << endl; Info<< " interpolating " << fieldIter->name() << endl;
// Read field fieldSource. Do not auto-load old-time fields // Read field fieldSource. Do not auto-load old-time fields
fieldType fieldSource(*fieldIter(), meshSource, false); fieldType fieldSource(*fieldIter(), meshSource, false);

View File

@ -43,7 +43,7 @@ void UnMapped(const IOobjectList& objects)
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
mvBak(fieldIter()->objectPath(), "unmapped"); mvBak(fieldIter->objectPath(), "unmapped");
} }
} }

View File

@ -62,7 +62,7 @@ void MapLagrangianFields
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
const word& fieldName = fieldIter()->name(); const word& fieldName = fieldIter->name();
Info<< " mapping lagrangian field " << fieldName << endl; Info<< " mapping lagrangian field " << fieldName << endl;
@ -101,7 +101,7 @@ void MapLagrangianFields
forAllConstIters(fieldFields, fieldIter) forAllConstIters(fieldFields, fieldIter)
{ {
const word& fieldName = fieldIter()->name(); const word& fieldName = fieldIter->name();
Info<< " mapping lagrangian fieldField " << fieldName << endl; Info<< " mapping lagrangian fieldField " << fieldName << endl;
@ -153,7 +153,7 @@ void MapLagrangianFields
forAllConstIters(fieldFields, fieldIter) forAllConstIters(fieldFields, fieldIter)
{ {
const word& fieldName = fieldIter()->name(); const word& fieldName = fieldIter->name();
Info<< " mapping lagrangian fieldField " << fieldName << endl; Info<< " mapping lagrangian fieldField " << fieldName << endl;

View File

@ -43,7 +43,7 @@ void UnMapped(const IOobjectList& objects)
forAllConstIters(fields, fieldIter) forAllConstIters(fields, fieldIter)
{ {
mvBak(fieldIter()->objectPath(), "unmapped"); mvBak(fieldIter->objectPath(), "unmapped");
} }
} }

View File

@ -715,6 +715,14 @@ public:
inline reference operator*() const { return this->val(); } inline reference operator*() const { return this->val(); }
inline reference operator()() const { return this->val(); } inline reference operator()() const { return this->val(); }
//- For pointer types, allow direct pointer dereferencing
template<class TypeT = T>
typename std::enable_if
<
std::is_pointer<TypeT>::value,
T
>::type operator->() const { return this->val(); }
inline iterator& operator++(); inline iterator& operator++();
inline iterator operator++(int); inline iterator operator++(int);
}; };
@ -777,9 +785,18 @@ public:
inline reference operator*() const { return this->val(); } inline reference operator*() const { return this->val(); }
inline reference operator()() const { return this->val(); } inline reference operator()() const { return this->val(); }
//- For pointer types, allow direct pointer dereferencing
template<class TypeT = T>
typename std::enable_if
<
std::is_pointer<TypeT>::value,
const T
>::type operator->() const { return this->val(); }
inline const_iterator& operator++(); inline const_iterator& operator++();
inline const_iterator operator++(int); inline const_iterator operator++(int);
// Assignment // Assignment
const_iterator& operator=(const const_iterator&) = default; const_iterator& operator=(const const_iterator&) = default;

View File

@ -635,7 +635,7 @@ Foam::label Foam::IOobjectList::filterClasses
// Matches? either prune (pruning) or keep (!pruning) // Matches? either prune (pruning) or keep (!pruning)
if if
( (
(pred(iter.val()->headerClassName()) ? pruning : !pruning) (pred(iter->headerClassName()) ? pruning : !pruning)
&& erase(iter) && erase(iter)
) )
{ {

View File

@ -410,7 +410,7 @@ bool Foam::objectRegistry::modified() const
{ {
for (const_iterator iter = cbegin(); iter != cend(); ++iter) for (const_iterator iter = cbegin(); iter != cend(); ++iter)
{ {
if (iter()->modified()) if (iter->modified())
{ {
return true; return true;
} }
@ -431,7 +431,7 @@ void Foam::objectRegistry::readModifiedObjects()
<< iter.key() << endl; << iter.key() << endl;
} }
iter()->readIfModified(); iter->readIfModified();
} }
} }
@ -460,15 +460,15 @@ bool Foam::objectRegistry::writeObject
Pout<< "objectRegistry::write() : " Pout<< "objectRegistry::write() : "
<< name() << " : Considering writing object " << name() << " : Considering writing object "
<< iter.key() << iter.key()
<< " of type " << iter()->type() << " of type " << iter->type()
<< " with writeOpt " << iter()->writeOpt() << " with writeOpt " << iter->writeOpt()
<< " to file " << iter()->objectPath() << " to file " << iter->objectPath()
<< endl; << endl;
} }
if (iter()->writeOpt() != NO_WRITE) if (iter->writeOpt() != NO_WRITE)
{ {
ok = iter()->writeObject(fmt, ver, cmp, valid) && ok; ok = iter->writeObject(fmt, ver, cmp, valid) && ok;
} }
} }

View File

@ -49,7 +49,7 @@ Foam::HashTable<Foam::wordHashSet> Foam::objectRegistry::classesImpl
if (matchName(obj->name())) if (matchName(obj->name()))
{ {
// Create entry (if needed) and insert // Create entry (if needed) and insert
summary(iter.val()->type()).insert(obj->name()); summary(obj->type()).insert(obj->name());
} }
} }
@ -451,7 +451,7 @@ const Type& Foam::objectRegistry::lookupObject
<< " lookup of " << name << " from objectRegistry " << " lookup of " << name << " from objectRegistry "
<< this->name() << this->name()
<< " successful\n but it is not a " << Type::typeName << " successful\n but it is not a " << Type::typeName
<< ", it is a " << iter()->type() << ", it is a " << iter->type()
<< abort(FatalError); << abort(FatalError);
} }
else if (recursive && this->parentNotTime()) else if (recursive && this->parentNotTime())

View File

@ -133,7 +133,7 @@ void Foam::meshObject::movePoints(objectRegistry& obr)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Moving " << iter()->name() << endl; Pout<< " Moving " << iter->name() << endl;
} }
objectPtr->movePoints(); objectPtr->movePoints();
} }
@ -141,7 +141,7 @@ void Foam::meshObject::movePoints(objectRegistry& obr)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Destroying " << iter()->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter());
} }
@ -174,7 +174,7 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Updating " << iter()->name() << endl; Pout<< " Updating " << iter->name() << endl;
} }
objectPtr->updateMesh(mpm); objectPtr->updateMesh(mpm);
} }
@ -182,7 +182,7 @@ void Foam::meshObject::updateMesh(objectRegistry& obr, const mapPolyMesh& mpm)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Destroying " << iter()->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter());
} }
@ -209,7 +209,7 @@ void Foam::meshObject::clear(objectRegistry& obr)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Destroying " << iter()->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter());
} }
@ -242,7 +242,7 @@ void Foam::meshObject::clearUpto(objectRegistry& obr)
{ {
if (meshObject::debug) if (meshObject::debug)
{ {
Pout<< " Destroying " << iter()->name() << endl; Pout<< " Destroying " << iter->name() << endl;
} }
obr.checkOut(*iter()); obr.checkOut(*iter());
} }

View File

@ -517,27 +517,27 @@ void Foam::genericFaPatchField<Type>::autoMap
forAllIters(scalarFields_, iter) forAllIters(scalarFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(vectorFields_, iter) forAllIters(vectorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(sphTensorFields_, iter) forAllIters(sphTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(symmTensorFields_, iter) forAllIters(symmTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(tensorFields_, iter) forAllIters(tensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
} }
@ -560,7 +560,7 @@ void Foam::genericFaPatchField<Type>::rmap
if (iter.found()) if (iter.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -570,7 +570,7 @@ void Foam::genericFaPatchField<Type>::rmap
if (iter.found()) if (iter.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -580,7 +580,7 @@ void Foam::genericFaPatchField<Type>::rmap
if (iter.found()) if (iter.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -590,7 +590,7 @@ void Foam::genericFaPatchField<Type>::rmap
if (iter.found()) if (iter.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -600,7 +600,7 @@ void Foam::genericFaPatchField<Type>::rmap
if (iter.found()) if (iter.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
} }
@ -713,23 +713,23 @@ void Foam::genericFaPatchField<Type>::write(Ostream& os) const
{ {
if (scalarFields_.found(key)) if (scalarFields_.found(key))
{ {
scalarFields_.cfind(key)()->writeEntry(key, os); scalarFields_.cfind(key)->writeEntry(key, os);
} }
else if (vectorFields_.found(key)) else if (vectorFields_.found(key))
{ {
vectorFields_.cfind(key)()->writeEntry(key, os); vectorFields_.cfind(key)->writeEntry(key, os);
} }
else if (sphTensorFields_.found(key)) else if (sphTensorFields_.found(key))
{ {
sphTensorFields_.cfind(key)()->writeEntry(key, os); sphTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (symmTensorFields_.found(key)) else if (symmTensorFields_.found(key))
{ {
symmTensorFields_.cfind(key)()->writeEntry(key, os); symmTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (tensorFields_.found(key)) else if (tensorFields_.found(key))
{ {
tensorFields_.cfind(key)()->writeEntry(key, os); tensorFields_.cfind(key)->writeEntry(key, os);
} }
} }
else else

View File

@ -517,27 +517,27 @@ void Foam::genericFvPatchField<Type>::autoMap
forAllIters(scalarFields_, iter) forAllIters(scalarFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(vectorFields_, iter) forAllIters(vectorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(sphTensorFields_, iter) forAllIters(sphTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(symmTensorFields_, iter) forAllIters(symmTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(tensorFields_, iter) forAllIters(tensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
} }
@ -560,7 +560,7 @@ void Foam::genericFvPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -570,7 +570,7 @@ void Foam::genericFvPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -580,7 +580,7 @@ void Foam::genericFvPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -590,7 +590,7 @@ void Foam::genericFvPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -600,7 +600,7 @@ void Foam::genericFvPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
} }
@ -713,23 +713,23 @@ void Foam::genericFvPatchField<Type>::write(Ostream& os) const
{ {
if (scalarFields_.found(key)) if (scalarFields_.found(key))
{ {
scalarFields_.cfind(key)()->writeEntry(key, os); scalarFields_.cfind(key)->writeEntry(key, os);
} }
else if (vectorFields_.found(key)) else if (vectorFields_.found(key))
{ {
vectorFields_.cfind(key)()->writeEntry(key, os); vectorFields_.cfind(key)->writeEntry(key, os);
} }
else if (sphTensorFields_.found(key)) else if (sphTensorFields_.found(key))
{ {
sphTensorFields_.cfind(key)()->writeEntry(key, os); sphTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (symmTensorFields_.found(key)) else if (symmTensorFields_.found(key))
{ {
symmTensorFields_.cfind(key)()->writeEntry(key, os); symmTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (tensorFields_.found(key)) else if (tensorFields_.found(key))
{ {
tensorFields_.cfind(key)()->writeEntry(key, os); tensorFields_.cfind(key)->writeEntry(key, os);
} }
} }
else else

View File

@ -515,27 +515,27 @@ void Foam::genericFvsPatchField<Type>::autoMap
forAllIters(scalarFields_, iter) forAllIters(scalarFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(vectorFields_, iter) forAllIters(vectorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(sphTensorFields_, iter) forAllIters(sphTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(symmTensorFields_, iter) forAllIters(symmTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(tensorFields_, iter) forAllIters(tensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
} }
@ -558,7 +558,7 @@ void Foam::genericFvsPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -568,7 +568,7 @@ void Foam::genericFvsPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -578,7 +578,7 @@ void Foam::genericFvsPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -588,7 +588,7 @@ void Foam::genericFvsPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -598,7 +598,7 @@ void Foam::genericFvsPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
} }
@ -711,23 +711,23 @@ void Foam::genericFvsPatchField<Type>::write(Ostream& os) const
{ {
if (scalarFields_.found(key)) if (scalarFields_.found(key))
{ {
scalarFields_.cfind(key)()->writeEntry(key, os); scalarFields_.cfind(key)->writeEntry(key, os);
} }
else if (vectorFields_.found(key)) else if (vectorFields_.found(key))
{ {
vectorFields_.cfind(key)()->writeEntry(key, os); vectorFields_.cfind(key)->writeEntry(key, os);
} }
else if (sphTensorFields_.found(key)) else if (sphTensorFields_.found(key))
{ {
sphTensorFields_.cfind(key)()->writeEntry(key, os); sphTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (symmTensorFields_.found(key)) else if (symmTensorFields_.found(key))
{ {
symmTensorFields_.cfind(key)()->writeEntry(key, os); symmTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (tensorFields_.found(key)) else if (tensorFields_.found(key))
{ {
tensorFields_.cfind(key)()->writeEntry(key, os); tensorFields_.cfind(key)->writeEntry(key, os);
} }
} }
else else

View File

@ -377,27 +377,27 @@ void Foam::genericPointPatchField<Type>::autoMap
{ {
forAllIters(scalarFields_, iter) forAllIters(scalarFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(vectorFields_, iter) forAllIters(vectorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(sphTensorFields_, iter) forAllIters(sphTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(symmTensorFields_, iter) forAllIters(symmTensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
forAllIters(tensorFields_, iter) forAllIters(tensorFields_, iter)
{ {
iter()->autoMap(m); iter->autoMap(m);
} }
} }
@ -418,7 +418,7 @@ void Foam::genericPointPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -428,7 +428,7 @@ void Foam::genericPointPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -438,7 +438,7 @@ void Foam::genericPointPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -448,7 +448,7 @@ void Foam::genericPointPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
@ -458,7 +458,7 @@ void Foam::genericPointPatchField<Type>::rmap
if (iter2.found()) if (iter2.found())
{ {
iter()->rmap(*iter2(), addr); iter->rmap(*iter2(), addr);
} }
} }
} }
@ -494,23 +494,23 @@ void Foam::genericPointPatchField<Type>::write(Ostream& os) const
{ {
if (scalarFields_.found(key)) if (scalarFields_.found(key))
{ {
scalarFields_.cfind(key)()->writeEntry(key, os); scalarFields_.cfind(key)->writeEntry(key, os);
} }
else if (vectorFields_.found(key)) else if (vectorFields_.found(key))
{ {
vectorFields_.cfind(key)()->writeEntry(key, os); vectorFields_.cfind(key)->writeEntry(key, os);
} }
else if (sphTensorFields_.found(key)) else if (sphTensorFields_.found(key))
{ {
sphTensorFields_.cfind(key)()->writeEntry(key, os); sphTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (symmTensorFields_.found(key)) else if (symmTensorFields_.found(key))
{ {
symmTensorFields_.cfind(key)()->writeEntry(key, os); symmTensorFields_.cfind(key)->writeEntry(key, os);
} }
else if (tensorFields_.found(key)) else if (tensorFields_.found(key))
{ {
tensorFields_.cfind(key)()->writeEntry(key, os); tensorFields_.cfind(key)->writeEntry(key, os);
} }
} }
else else