From 15c53a2ef12b0d6d0edf3a19622a9c7fce9a9b26 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 7 Jan 2019 09:20:51 +0100 Subject: [PATCH] ENH: for-range, forAllIters() ... in genericPatchFields/ - reduced clutter when iterating over containers --- .../genericFaPatchField/genericFaPatchField.C | 154 +++++------------- .../genericFaPatchField/genericFaPatchField.H | 13 +- .../genericFvPatchField/genericFvPatchField.C | 154 +++++------------- .../genericFvPatchField/genericFvPatchField.H | 13 +- .../genericFvsPatchField.C | 125 ++++---------- .../genericFvsPatchField.H | 15 +- .../genericFvsPatchFields.C | 4 +- .../genericFvsPatchFields.H | 4 +- .../genericPointPatchField.C | 51 +++--- .../genericPointPatchField.H | 11 +- 10 files changed, 160 insertions(+), 384 deletions(-) diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C index 98f6d2706f..1a7d060a67 100644 --- a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C +++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.C @@ -227,7 +227,7 @@ Foam::genericFaPatchField::genericFaPatchField << exit(FatalIOError); } - sphericalTensorFields_.insert(key, fPtr); + sphTensorFields_.insert(key, fPtr); } else if ( @@ -356,7 +356,7 @@ Foam::genericFaPatchField::genericFaPatchField { sphericalTensor vs(l[0]); - sphericalTensorFields_.insert + sphTensorFields_.insert ( key, autoPtr::New @@ -431,12 +431,7 @@ Foam::genericFaPatchField::genericFaPatchField actualTypeName_(ptf.actualTypeName_), dict_(ptf.dict_) { - forAllConstIter - ( - HashPtrTable, - ptf.scalarFields_, - iter - ) + forAllConstIters(ptf.scalarFields_, iter) { scalarFields_.insert ( @@ -445,12 +440,7 @@ Foam::genericFaPatchField::genericFaPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.vectorFields_, - iter - ) + forAllConstIters(ptf.vectorFields_, iter) { vectorFields_.insert ( @@ -459,26 +449,16 @@ Foam::genericFaPatchField::genericFaPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.sphericalTensorFields_, - iter - ) + forAllConstIters(ptf.sphTensorFields_, iter) { - sphericalTensorFields_.insert + sphTensorFields_.insert ( iter.key(), autoPtr::New(*iter(), mapper) ); } - forAllConstIter - ( - HashPtrTable, - ptf.symmTensorFields_, - iter - ) + forAllConstIters(ptf.symmTensorFields_, iter) { symmTensorFields_.insert ( @@ -487,12 +467,7 @@ Foam::genericFaPatchField::genericFaPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.tensorFields_, - iter - ) + forAllConstIters(ptf.tensorFields_, iter) { tensorFields_.insert ( @@ -514,7 +489,7 @@ Foam::genericFaPatchField::genericFaPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -532,7 +507,7 @@ Foam::genericFaPatchField::genericFaPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -548,52 +523,27 @@ void Foam::genericFaPatchField::autoMap { calculatedFaPatchField::autoMap(m); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { iter()->autoMap(m); } @@ -612,83 +562,53 @@ void Foam::genericFaPatchField::rmap const genericFaPatchField& dptf = refCast>(ptf); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter ) { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); + const auto iter2 = dptf.scalarFields_.cfind(iter.key()); - if (dptfIter != dptf.scalarFields_.end()) + if (iter.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); + const auto iter2 = dptf.vectorFields_.cfind(iter.key()); - if (dptfIter != dptf.vectorFields_.end()) + if (iter.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); + const auto iter2 = dptf.sphTensorFields_.cfind(iter.key()); - if (dptfIter != dptf.sphericalTensorFields_.end()) + if (iter.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); + const auto iter2 = dptf.symmTensorFields_.cfind(iter.key()); - if (dptfIter != dptf.symmTensorFields_.end()) + if (iter.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); + const auto iter2 = dptf.tensorFields_.find(iter.key()); - if (dptfIter != dptf.tensorFields_.end()) + if (iter.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } } @@ -807,9 +727,9 @@ void Foam::genericFaPatchField::write(Ostream& os) const vectorFields_.find(key)() ->writeEntry(key, os); } - else if (sphericalTensorFields_.found(key)) + else if (sphTensorFields_.found(key)) { - sphericalTensorFields_.find(key)() + sphTensorFields_.find(key)() ->writeEntry(key, os); } else if (symmTensorFields_.found(key)) diff --git a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.H b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.H index 19da9419b8..6fccf72fb8 100644 --- a/src/genericPatchFields/genericFaPatchField/genericFaPatchField.H +++ b/src/genericPatchFields/genericFaPatchField/genericFaPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -59,14 +59,15 @@ class genericFaPatchField : public calculatedFaPatchField { - // Private data + // Private Data const word actualTypeName_; + dictionary dict_; HashPtrTable scalarFields_; HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; + HashPtrTable sphTensorFields_; HashPtrTable symmTensorFields_; HashPtrTable tensorFields_; @@ -138,9 +139,9 @@ public: } - // Member functions + // Member Functions - // Mapping functions + // Mapping Functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap @@ -156,7 +157,7 @@ public: ); - // Evaluation functions + // Evaluation Functions //- Return the matrix diagonal coefficients corresponding to the // evaluation of the value of this patchField with given weights diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C index 55e22e71ab..079ac85dc7 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.C @@ -227,7 +227,7 @@ Foam::genericFvPatchField::genericFvPatchField << exit(FatalIOError); } - sphericalTensorFields_.insert(key, fPtr); + sphTensorFields_.insert(key, fPtr); } else if ( @@ -356,7 +356,7 @@ Foam::genericFvPatchField::genericFvPatchField { sphericalTensor vs(l[0]); - sphericalTensorFields_.insert + sphTensorFields_.insert ( key, autoPtr::New @@ -431,12 +431,7 @@ Foam::genericFvPatchField::genericFvPatchField actualTypeName_(ptf.actualTypeName_), dict_(ptf.dict_) { - forAllConstIter - ( - HashPtrTable, - ptf.scalarFields_, - iter - ) + forAllConstIters(ptf.scalarFields_, iter) { scalarFields_.insert ( @@ -445,12 +440,7 @@ Foam::genericFvPatchField::genericFvPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.vectorFields_, - iter - ) + forAllConstIters(ptf.vectorFields_, iter) { vectorFields_.insert ( @@ -459,26 +449,16 @@ Foam::genericFvPatchField::genericFvPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.sphericalTensorFields_, - iter - ) + forAllConstIters(ptf.sphTensorFields_, iter) { - sphericalTensorFields_.insert + sphTensorFields_.insert ( iter.key(), autoPtr::New(*iter(), mapper) ); } - forAllConstIter - ( - HashPtrTable, - ptf.symmTensorFields_, - iter - ) + forAllConstIters(ptf.symmTensorFields_, iter) { symmTensorFields_.insert ( @@ -487,12 +467,7 @@ Foam::genericFvPatchField::genericFvPatchField ); } - forAllConstIter - ( - HashPtrTable, - ptf.tensorFields_, - iter - ) + forAllConstIters(ptf.tensorFields_, iter) { tensorFields_.insert ( @@ -514,7 +489,7 @@ Foam::genericFvPatchField::genericFvPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -532,7 +507,7 @@ Foam::genericFvPatchField::genericFvPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -548,52 +523,27 @@ void Foam::genericFvPatchField::autoMap { calculatedFvPatchField::autoMap(m); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { iter()->autoMap(m); } @@ -612,83 +562,53 @@ void Foam::genericFvPatchField::rmap const genericFvPatchField& dptf = refCast>(ptf); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); + const auto iter2 = dptf.scalarFields_.cfind(iter.key()); - if (dptfIter != dptf.scalarFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); + const auto iter2 = dptf.vectorFields_.find(iter.key()); - if (dptfIter != dptf.vectorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); + const auto iter2 = dptf.sphTensorFields_.find(iter.key()); - if (dptfIter != dptf.sphericalTensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); + const auto iter2 = dptf.symmTensorFields_.find(iter.key()); - if (dptfIter != dptf.symmTensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); + const auto iter2 = dptf.tensorFields_.find(iter.key()); - if (dptfIter != dptf.tensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } } @@ -807,9 +727,9 @@ void Foam::genericFvPatchField::write(Ostream& os) const vectorFields_.find(key)() ->writeEntry(key, os); } - else if (sphericalTensorFields_.found(key)) + else if (sphTensorFields_.found(key)) { - sphericalTensorFields_.find(key)() + sphTensorFields_.find(key)() ->writeEntry(key, os); } else if (symmTensorFields_.found(key)) diff --git a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H index c8957b6415..e04dbfebdf 100644 --- a/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H +++ b/src/genericPatchFields/genericFvPatchField/genericFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011, 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -59,14 +59,15 @@ class genericFvPatchField : public calculatedFvPatchField { - // Private data + // Private Data const word actualTypeName_; + dictionary dict_; HashPtrTable scalarFields_; HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; + HashPtrTable sphTensorFields_; HashPtrTable symmTensorFields_; HashPtrTable tensorFields_; @@ -138,9 +139,9 @@ public: } - // Member functions + // Member Functions - // Mapping functions + // Mapping Functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap @@ -156,7 +157,7 @@ public: ); - // Evaluation functions + // Evaluation Functions //- Return the matrix diagonal coefficients corresponding to the // evaluation of the value of this patchField with given weights diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C index e207a58162..aea6b9a04e 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.C @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011,2019 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011-2016 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -227,7 +225,7 @@ Foam::genericFvsPatchField::genericFvsPatchField << exit(FatalIOError); } - sphericalTensorFields_.insert(key, fPtr); + sphTensorFields_.insert(key, fPtr); } else if ( @@ -356,7 +354,7 @@ Foam::genericFvsPatchField::genericFvsPatchField { sphericalTensor vs(l[0]); - sphericalTensorFields_.insert + sphTensorFields_.insert ( key, autoPtr::New @@ -462,11 +460,11 @@ Foam::genericFvsPatchField::genericFvsPatchField forAllConstIter ( HashPtrTable, - ptf.sphericalTensorFields_, + ptf.sphTensorFields_, iter ) { - sphericalTensorFields_.insert + sphTensorFields_.insert ( iter.key(), autoPtr::New(*iter(), mapper) @@ -514,7 +512,7 @@ Foam::genericFvsPatchField::genericFvsPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -532,7 +530,7 @@ Foam::genericFvsPatchField::genericFvsPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -548,52 +546,27 @@ void Foam::genericFvsPatchField::autoMap { calculatedFvsPatchField::autoMap(m); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { iter()->autoMap(m); } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { iter()->autoMap(m); } @@ -612,83 +585,53 @@ void Foam::genericFvsPatchField::rmap const genericFvsPatchField& dptf = refCast>(ptf); - forAllIter - ( - HashPtrTable, - scalarFields_, - iter - ) + forAllIters(scalarFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); + const auto iter2 = dptf.scalarFields_.cfind(iter.key()); - if (dptfIter != dptf.scalarFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - vectorFields_, - iter - ) + forAllIters(vectorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); + const auto iter2 = dptf.vectorFields_.find(iter.key()); - if (dptfIter != dptf.vectorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - sphericalTensorFields_, - iter - ) + forAllIters(sphTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); + const auto iter2 = dptf.sphTensorFields_.find(iter.key()); - if (dptfIter != dptf.sphericalTensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - symmTensorFields_, - iter - ) + forAllIters(symmTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); + const auto iter2 = dptf.symmTensorFields_.find(iter.key()); - if (dptfIter != dptf.symmTensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIter - ( - HashPtrTable, - tensorFields_, - iter - ) + forAllIters(tensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); + const auto iter2 = dptf.tensorFields_.find(iter.key()); - if (dptfIter != dptf.tensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } } @@ -807,9 +750,9 @@ void Foam::genericFvsPatchField::write(Ostream& os) const vectorFields_.find(key)() ->writeEntry(key, os); } - else if (sphericalTensorFields_.found(key)) + else if (sphTensorFields_.found(key)) { - sphericalTensorFields_.find(key)() + sphTensorFields_.find(key)() ->writeEntry(key, os); } else if (symmTensorFields_.found(key)) diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.H b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.H index 43a37f8929..37fa857fde 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.H +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchField.H @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011,2019 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011-2016 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,14 +57,15 @@ class genericFvsPatchField : public calculatedFvsPatchField { - // Private data + // Private Data const word actualTypeName_; + dictionary dict_; HashPtrTable scalarFields_; HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; + HashPtrTable sphTensorFields_; HashPtrTable symmTensorFields_; HashPtrTable tensorFields_; @@ -138,9 +137,9 @@ public: } - // Member functions + // Member Functions - // Mapping functions + // Mapping Functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap @@ -156,7 +155,7 @@ public: ); - // Evaluation functions + // Evaluation Functions //- Return the matrix diagonal coefficients corresponding to the // evaluation of the value of this patchField with given weights diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C index e367cdf9f1..c232c0bc59 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.C @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011,2019 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H index f63bff442d..e4e4162b30 100644 --- a/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H +++ b/src/genericPatchFields/genericFvsPatchField/genericFvsPatchFields.H @@ -2,10 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C index 176c2f43e8..a2dd073dda 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.C @@ -207,7 +207,7 @@ Foam::genericPointPatchField::genericPointPatchField << exit(FatalIOError); } - sphericalTensorFields_.insert(key, fPtr); + sphTensorFields_.insert(key, fPtr); } else if ( @@ -328,9 +328,9 @@ Foam::genericPointPatchField::genericPointPatchField ); } - forAllConstIters(ptf.sphericalTensorFields_, iter) + forAllConstIters(ptf.sphTensorFields_, iter) { - sphericalTensorFields_.insert + sphTensorFields_.insert ( iter.key(), autoPtr::New(*iter(), mapper) @@ -369,7 +369,7 @@ Foam::genericPointPatchField::genericPointPatchField dict_(ptf.dict_), scalarFields_(ptf.scalarFields_), vectorFields_(ptf.vectorFields_), - sphericalTensorFields_(ptf.sphericalTensorFields_), + sphTensorFields_(ptf.sphTensorFields_), symmTensorFields_(ptf.symmTensorFields_), tensorFields_(ptf.tensorFields_) {} @@ -393,7 +393,7 @@ void Foam::genericPointPatchField::autoMap iter()->autoMap(m); } - forAllIters(sphericalTensorFields_, iter) + forAllIters(sphTensorFields_, iter) { iter()->autoMap(m); } @@ -422,56 +422,51 @@ void Foam::genericPointPatchField::rmap forAllIters(scalarFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.scalarFields_.find(iter.key()); + const auto iter2 = dptf.scalarFields_.cfind(iter.key()); - if (dptfIter.found()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } forAllIters(vectorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.vectorFields_.find(iter.key()); + const auto iter2 = dptf.vectorFields_.cfind(iter.key()); - if (dptfIter.found()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } - forAllIters(sphericalTensorFields_, iter) + forAllIters(sphTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.sphericalTensorFields_.find(iter.key()); + const auto iter2 = dptf.sphTensorFields_.find(iter.key()); - if (dptfIter.found()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } forAllIters(symmTensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.symmTensorFields_.find(iter.key()); + const auto iter2 = dptf.symmTensorFields_.find(iter.key()); - if (dptfIter.found()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } forAllIters(tensorFields_, iter) { - HashPtrTable::const_iterator dptfIter = - dptf.tensorFields_.find(iter.key()); + const auto iter2 = dptf.tensorFields_.find(iter.key()); - if (dptfIter != tensorFields_.end()) + if (iter2.found()) { - iter()->rmap(*dptfIter(), addr); + iter()->rmap(*iter2(), addr); } } } @@ -511,9 +506,9 @@ void Foam::genericPointPatchField::write(Ostream& os) const { vectorFields_.find(key)()->writeEntry(key, os); } - else if (sphericalTensorFields_.found(key)) + else if (sphTensorFields_.found(key)) { - sphericalTensorFields_.find(key)()->writeEntry(key, os); + sphTensorFields_.find(key)()->writeEntry(key, os); } else if (symmTensorFields_.found(key)) { diff --git a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H index d55c5a8979..6282626e44 100644 --- a/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H +++ b/src/genericPatchFields/genericPointPatchField/genericPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2009-2011, 2016 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011, 2016-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -55,14 +55,15 @@ class genericPointPatchField : public calculatedPointPatchField { - // Private data + // Private Data const word actualTypeName_; + dictionary dict_; HashPtrTable scalarFields_; HashPtrTable vectorFields_; - HashPtrTable sphericalTensorFields_; + HashPtrTable sphTensorFields_; HashPtrTable symmTensorFields_; HashPtrTable tensorFields_; @@ -135,9 +136,9 @@ public: } - // Member functions + // Member Functions - // Mapping functions + // Mapping Functions //- Map (and resize as needed) from self given a mapping object virtual void autoMap