diff --git a/applications/test/HashSet/hashSetTest.C b/applications/test/HashSet/hashSetTest.C index 9625b2e0dc..21e1276604 100644 --- a/applications/test/HashSet/hashSetTest.C +++ b/applications/test/HashSet/hashSetTest.C @@ -111,6 +111,33 @@ int main(int argc, char *argv[]) Info<< "setD : " << setD << endl; Info<< "setB ^ setC ^ setD : " << (setB ^ setC ^ setD) << endl; + // test operator[] + + Info<< "setD : " << setD << endl; + if (setD[0]) + { + Info<< "setD has 0" << endl; + } + else + { + Info<< "setD has no 0" << endl; + } + + + if (setD[11]) + { + Info<< "setD has 11" << endl; + } + else + { + Info<< "setD has no 0" << endl; + } + + Info<< "setD : " << setD << endl; + + // this doesn't work (yet?) + // setD[12] = true; + return 0; } diff --git a/applications/test/PackedList/PackedListTest.C b/applications/test/PackedList/PackedListTest.C index b00c703a37..f1f58f3abc 100644 --- a/applications/test/PackedList/PackedListTest.C +++ b/applications/test/PackedList/PackedListTest.C @@ -38,7 +38,6 @@ using namespace Foam; int main(int argc, char *argv[]) { - bool changed; Info<< "PackedList max_bits() = " << PackedList<0>::max_bits() << nl; Info<< "\ntest allocation with value\n"; @@ -46,11 +45,50 @@ int main(int argc, char *argv[]) list1.print(Info); Info<< "\ntest assign uniform value\n"; - list1 = 2; + list1 = 3; + list1.print(Info); + + Info<< "\ntest assign uniform value (with overflow)\n"; + list1 = -1; + list1.print(Info); + + Info<< "\ntest assign between references\n"; + list1[2] = 3; + list1[4] = list1[2]; + list1.print(Info); + + Info<< "\ntest assign between references, with chaining\n"; + list1[4] = list1[2] = 1; + list1.print(Info); + + { + const PackedList<3>& constLst = list1; + Info<< "\ntest operator[] const with out-of-range index\n"; + constLst.print(Info); + if (!constLst[20]) + { + Info<< "[20] is false (expected) list size should be unchanged (const)\n"; + } + constLst.print(Info); + + Info<< "\ntest operator[] non-const with out-of-range index\n"; + if (!list1[20]) + { + Info<< "[20] is false (expected) but list was resized?? (non-const)\n"; + } + list1.print(Info); + } + + + Info<< "\ntest operator[] with out-of-range index\n"; + if (!list1[20]) + { + Info<< "[20] is false, as expected\n"; + } list1.print(Info); Info<< "\ntest resize with value (without reallocation)\n"; - list1.resize(6, 3); + list1.resize(8, list1.max_value()); list1.print(Info); Info<< "\ntest set() function\n"; @@ -96,7 +134,7 @@ int main(int argc, char *argv[]) list1.print(Info); Info<< "\ntest setCapacity() operation\n"; - list1.setCapacity(30); + list1.setCapacity(100); list1.print(Info); Info<< "\ntest operator[] assignment\n"; @@ -108,7 +146,15 @@ int main(int argc, char *argv[]) list1.print(Info); Info<< "\ntest setCapacity smaller\n"; - list1.setCapacity(32); + list1.setCapacity(24); + list1.print(Info); + + Info<< "\ntest resize much smaller\n"; + list1.resize(150); + list1.print(Info); + + Info<< "\ntest trim\n"; + list1.trim(); list1.print(Info); // add in some misc values @@ -118,37 +164,54 @@ int main(int argc, char *argv[]) Info<< "\ntest iterator\n"; PackedList<3>::iterator iter = list1.begin(); - Info<< "iterator:" << iter() << "\n"; + Info<< "begin():"; iter.print(Info) << "\n"; - Info<< "\ntest iterator operator=\n"; - changed = (iter = 5); - Info<< "iterator:" << iter() << "\n"; - Info<< "changed:" << changed << "\n"; - changed = (iter = 5); - Info<< "changed:" << changed << "\n"; + iter() = 5; + iter.print(Info); list1.print(Info); + iter = list1[31]; + Info<< "iterator:" << iter() << "\n"; + iter.print(Info); + + Info<< "\ntest get() method\n"; - Info<< "get(10):" << list1.get(10) - << " and list[10]:" << unsigned(list1[10]) << "\n"; + Info<< "get(10):" << list1.get(10) << " and list[10]:" << list1[10] << "\n"; list1.print(Info); Info<< "\ntest iterator indexing\n"; - Info<< "end() "; - list1.end().print(Info) << "\n"; + Info<< "cend() "; + list1.cend().print(Info) << "\n"; - for (iter = list1[31]; iter != list1.end(); ++iter) { - iter.print(Info); + Info<< "\ntest assignment of iterator\n"; + list1.print(Info); + PackedList<3>::iterator cit = list1[25]; + cit.print(Info); + list1.end().print(Info); } - Info<< "\ntest operator[] auto-vivify\n"; - const unsigned int val = list1[45]; - Info<< "list[45]:" << val << "\n"; - list1.print(Info); + for + ( + PackedList<3>::iterator cit = list1[5]; + cit != list1.end(); + ++cit + ) + { + cit.print(Info); + } + +// Info<< "\ntest operator[] auto-vivify\n"; +// const unsigned int val = list1[45]; +// +// Info<< "list[45]:" << val << "\n"; +// list1[45] = list1.max_value(); +// Info<< "list[45]:" << list1[45] << "\n"; +// list1[49] = list1.max_value(); +// list1.print(Info); Info<< "\ntest copy constructor + append\n"; @@ -161,8 +224,15 @@ int main(int argc, char *argv[]) Info<< "\ntest pattern that fills all bits\n"; PackedList<4> list3(8, 8); - list3[list3.size()-2] = 0; - list3[list3.size()-1] = list3.max_value(); + + label pos = list3.size() - 1; + + list3[pos--] = list3.max_value(); + list3[pos--] = 0; + list3[pos--] = list3.max_value(); + list3.print(Info); + + Info<< "removed final value: " << list3.remove() << endl; list3.print(Info); Info<< "\n\nDone.\n"; diff --git a/applications/test/PackedList2/Make/files b/applications/test/PackedList2/Make/files new file mode 100644 index 0000000000..bb1f3085fa --- /dev/null +++ b/applications/test/PackedList2/Make/files @@ -0,0 +1,3 @@ +PackedListTest2.C + +EXE = $(FOAM_USER_APPBIN)/PackedListTest2 diff --git a/applications/test/PackedList2/Make/options b/applications/test/PackedList2/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/test/PackedList2/PackedListTest2.C b/applications/test/PackedList2/PackedListTest2.C new file mode 100644 index 0000000000..22282058ac --- /dev/null +++ b/applications/test/PackedList2/PackedListTest2.C @@ -0,0 +1,348 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + +Description + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "boolList.H" +#include "PackedBoolList.H" +#include "HashSet.H" +#include "cpuTime.H" +#include + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +// Main program: + +int main(int argc, char *argv[]) +{ + const label n = 1000000; + const label nIters = 1000; + + unsigned int sum = 0; + + PackedBoolList packed(n, 1); + boolList unpacked(n, true); + std::vector stlVector(n, true); + + labelHashSet emptyHash; + labelHashSet fullHash(1000); + for(label i = 0; i < n; i++) + { + fullHash.insert(i); + } + + cpuTime timer; + + for (label iter = 0; iter < nIters; ++iter) + { + packed.resize(40); + packed.shrink(); + packed.resize(n, 1); + } + Info<< "resize/shrink/resize:" << timer.cpuTimeIncrement() << " s\n\n"; + + // set every other bit on: + Info<< "set every other bit on and count\n"; + packed.storage() = 0xAAAAAAAAu; + + // Count packed + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(packed, i) + { + sum += packed[i]; + } + } + Info<< "Counting brute-force:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Count packed + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + sum += packed.count(); + } + Info<< "Counting via count():" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Dummy addition + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(unpacked, i) + { + sum += i + 1; + } + } + Info<< "Dummy loop:" << timer.cpuTimeIncrement() << " s" << endl; + Info<< " sum " << sum << endl; + + // + // Read + // + + // Read stl + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + for(unsigned int i = 0; i < stlVector.size(); i++) + { + sum += stlVector[i]; + } + } + Info<< "Reading stl:" << timer.cpuTimeIncrement() << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read unpacked + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(unpacked, i) + { + sum += unpacked[i]; + } + } + Info<< "Reading unpacked:" << timer.cpuTimeIncrement() << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read packed + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(packed, i) + { + sum += packed.get(i); + } + } + Info<< "Reading packed using get:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read packed + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(packed, i) + { + sum += packed[i]; + } + } + Info<< "Reading packed using reference:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read via iterator + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + for + ( + PackedBoolList::iterator it = packed.begin(); + it != packed.end(); + ++it + ) + { + sum += it; + } + } + Info<< "Reading packed using iterator:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read via iterator + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + for + ( + PackedBoolList::const_iterator cit = packed.cbegin(); + cit != packed.cend(); + ++cit + ) + { + sum += cit(); + } + } + Info<< "Reading packed using const_iterator():" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read empty hash + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(unpacked, i) + { + sum += emptyHash.found(i); + } + } + Info<< "Reading empty labelHashSet:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // Read full hash + sum = 0; + for (label iter = 0; iter < nIters; ++iter) + { + forAll(unpacked, i) + { + sum += fullHash.found(i); + } + } + Info<< "Reading full labelHashSet:" << timer.cpuTimeIncrement() + << " s" << endl; + Info<< " sum " << sum << endl; + + + // + // Write + // + + // Write stl + for (label iter = 0; iter < nIters; ++iter) + { + for (unsigned int i = 0; i < stlVector.size(); i++) + { + stlVector[i] = true; + } + } + Info<< "Writing stl:" << timer.cpuTimeIncrement() << " s" << endl; + + // Write unpacked + for (label iter = 0; iter < nIters; ++iter) + { + forAll(unpacked, i) + { + unpacked[i] = true; + } + } + Info<< "Writing unpacked:" << timer.cpuTimeIncrement() << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + forAll(packed, i) + { + packed[i] = 1; + } + } + Info<< "Writing packed using reference:" << timer.cpuTimeIncrement() + << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + forAll(packed, i) + { + packed.set(i, 1); + } + } + Info<< "Writing packed using set:" << timer.cpuTimeIncrement() + << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + for + ( + PackedBoolList::iterator it = packed.begin(); + it != packed.end(); + ++it + ) + { + it() = 1; + } + } + Info<< "Writing packed using iterator:" << timer.cpuTimeIncrement() + << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + packed = 0; + } + Info<< "Writing packed uniform 0:" << timer.cpuTimeIncrement() + << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + packed = 1; + } + Info<< "Writing packed uniform 1:" << timer.cpuTimeIncrement() + << " s" << endl; + + + PackedList<3> oddPacked(n, 3); + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + packed = 0; + } + Info<< "Writing packed<3> uniform 0:" << timer.cpuTimeIncrement() + << " s" << endl; + + + // Write packed + for (label iter = 0; iter < nIters; ++iter) + { + packed = 1; + } + Info<< "Writing packed<3> uniform 1:" << timer.cpuTimeIncrement() + << " s" << endl; + + + Info << "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/fileName/fileNameTest.C b/applications/test/fileName/fileNameTest.C index c48e4ba2fc..f5a4a93542 100644 --- a/applications/test/fileName/fileNameTest.C +++ b/applications/test/fileName/fileNameTest.C @@ -31,6 +31,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fileName.H" +#include "SubList.H" #include "IOstreams.H" #include "OSspecific.H" @@ -50,19 +51,55 @@ int main() fileName pathName(wrdList); - Info<< "pathName = " << pathName << endl; - Info<< "pathName.name() = " << pathName.name() << endl; - Info<< "pathName.path() = " << pathName.path() << endl; - Info<< "pathName.ext() = " << pathName.ext() << endl; + Info<< "pathName = " << pathName << nl + << "pathName.name() = " << pathName.name() << nl + << "pathName.path() = " << pathName.path() << nl + << "pathName.ext() = " << pathName.ext() << endl; - Info<< "pathName.components() = " << pathName.components() << endl; - Info<< "pathName.component(2) = " << pathName.component(2) << endl; + Info<< "pathName.components() = " << pathName.components() << nl + << "pathName.component(2) = " << pathName.component(2) << nl + << endl; + // try with different combination + for (label start = 0; start < wrdList.size(); ++start) + { + fileName instance, local; + word name; + + fileName path(SubList(wrdList, wrdList.size()-start, start)); + fileName path2 = "." / path; + + path.IOobjectComponents + ( + instance, + local, + name + ); + + Info<< "IOobjectComponents for " << path << nl + << " instance = " << instance << nl + << " local = " << local << nl + << " name = " << name << endl; + + path2.IOobjectComponents + ( + instance, + local, + name + ); + + Info<< "IOobjectComponents for " << path2 << nl + << " instance = " << instance << nl + << " local = " << local << nl + << " name = " << name << endl; + + } // test findEtcFile Info<< "\n\nfindEtcFile tests:" << nl << " controlDict => " << findEtcFile("controlDict") << nl << " badName => " << findEtcFile("badName") << endl; + Info<< "This should emit a fatal error:" << endl; Info<< " badName(die) => " << findEtcFile("badName", true) << nl << endl; diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index 1723fa5101..69439764c7 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -78,10 +78,10 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" + const word dictName("blockMeshDict"); + word regionName; fileName polyMeshDir; - word dictName("blockMeshDict"); - fileName dictPath(runTime.constant()); if (args.options().found("region")) { @@ -98,55 +98,58 @@ int main(int argc, char *argv[]) polyMeshDir = polyMesh::meshSubDir; } - fileName dictLocal = polyMeshDir; + autoPtr meshDictIoPtr; if (args.options().found("dict")) { - wordList elems(fileName(args.options()["dict"]).components()); - dictName = elems[elems.size()-1]; - dictPath = elems[0]; - dictLocal = ""; + fileName dictPath(args.options()["dict"]); - if (elems.size() == 1) - { - dictPath = "."; - } - else if (elems.size() > 2) - { - dictLocal = fileName(SubList(elems, elems.size()-2, 1)); - } + meshDictIoPtr.set + ( + new IOobject + ( + ( dictPath.isDir() ? dictPath/dictName : dictPath ), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + } + else + { + meshDictIoPtr.set + ( + new IOobject + ( + dictName, + runTime.constant(), + polyMeshDir, + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); } - bool writeTopo = args.options().found("blockTopology"); - - IOobject meshDictIo - ( - dictName, - dictPath, - dictLocal, - runTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (!meshDictIo.headerOk()) + if (!meshDictIoPtr->headerOk()) { FatalErrorIn(args.executable()) << "Cannot open mesh description file\n " - << meshDictIo.objectPath() + << meshDictIoPtr->objectPath() << nl << exit(FatalError); } Info<< nl << "Creating block mesh from\n " - << meshDictIo.objectPath() << nl << endl; - - IOdictionary meshDict(meshDictIo); + << meshDictIoPtr->objectPath() << nl << endl; + IOdictionary meshDict(meshDictIoPtr()); blockMesh blocks(meshDict); - if (writeTopo) + + if (args.options().found("blockTopology")) { // Write mesh as edges. { diff --git a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C index 556e9fd21e..13aa25c06d 100644 --- a/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C +++ b/applications/utilities/mesh/manipulation/subsetMesh/subsetMesh.C @@ -276,7 +276,7 @@ int main(int argc, char *argv[]) // Read point fields and subset // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - pointMesh pMesh(mesh); + const pointMesh& pMesh = pointMesh::New(mesh); wordList pointScalarNames(objects.names(pointScalarField::typeName)); PtrList pointScalarFlds(pointScalarNames.size()); diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index cc25676c75..1616bbb662 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -161,6 +161,10 @@ surfaces isoField rho; isoValue 0.5; interpolate true; + + //zone ABC; // Optional: zone only + //exposedPatchName fixedWalls; // Optional: zone only + // regularise false; // Optional: do not simplify } constantIso @@ -171,7 +175,7 @@ surfaces isoField rho; isoValue 0.5; interpolate false; - // regularise false; // Optional: do not simplify + regularise false; // do not simplify } ); diff --git a/applications/utilities/surface/surfaceCoordinateSystemTransform/surfaceCoordinateSystemTransform.C b/applications/utilities/surface/surfaceCoordinateSystemTransform/surfaceCoordinateSystemTransform.C index e5ae6a1100..cabebafc56 100644 --- a/applications/utilities/surface/surfaceCoordinateSystemTransform/surfaceCoordinateSystemTransform.C +++ b/applications/utilities/surface/surfaceCoordinateSystemTransform/surfaceCoordinateSystemTransform.C @@ -78,56 +78,61 @@ int main(int argc, char *argv[]) Time runTime(args.rootPath(), args.caseName()); const stringList& params = args.additionalArgs(); - word dictName("coordinateSystems"); - fileName dictPath(runTime.constant()); - fileName dictLocal; - - if (args.options().found("dict")) - { - wordList elems(fileName(args.options()["dict"]).components()); - dictName = elems[elems.size()-1]; - dictPath = elems[0]; - dictLocal = ""; - - if (elems.size() == 1) - { - dictPath = "."; - } - else if (elems.size() > 2) - { - dictLocal = fileName(SubList(elems, elems.size()-2, 1)); - } - } + const word dictName("coordinateSystems"); autoPtr fromCsys; autoPtr toCsys; if (args.options().found("from") || args.options().found("to")) { - IOobject csDictIo - ( - dictName, - dictPath, - dictLocal, - runTime, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); + autoPtr csDictIoPtr; - if (!csDictIo.headerOk()) + if (args.options().found("dict")) + { + fileName dictPath(args.options()["dict"]); + + csDictIoPtr.set + ( + new IOobject + ( + ( dictPath.isDir() ? dictPath/dictName : dictPath ), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + } + else + { + csDictIoPtr.set + ( + new IOobject + ( + dictName, + runTime.constant(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + } + + + if (!csDictIoPtr->headerOk()) { FatalErrorIn(args.executable()) << "Cannot open coordinateSystems file\n " - << csDictIo.objectPath() << nl + << csDictIoPtr->objectPath() << nl << exit(FatalError); } - coordinateSystems csLst(csDictIo); + coordinateSystems csLst(csDictIoPtr()); if (args.options().found("from")) { - word csName(args.options()["from"]); + const word csName(args.options()["from"]); label csId = csLst.find(csName); if (csId < 0) @@ -143,7 +148,7 @@ int main(int argc, char *argv[]) if (args.options().found("to")) { - word csName(args.options()["to"]); + const word csName(args.options()["to"]); label csId = csLst.find(csName); if (csId < 0) diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C index 65d62f4b67..9b5c2cb8f7 100644 --- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C +++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C @@ -56,6 +56,7 @@ Note #include "Time.H" #include "polyMesh.H" #include "triSurface.H" +#include "PackedBoolList.H" #include "MeshedSurfaces.H" #include "UnsortedMeshedSurfaces.H" @@ -115,7 +116,7 @@ int main(int argc, char *argv[]) if (args.options().found("orient")) { Info<< "Checking surface orientation" << endl; - surf.checkOrientation(true); + PatchTools::checkOrientation(surf, true); Info<< endl; } @@ -154,7 +155,7 @@ int main(int argc, char *argv[]) if (args.options().found("orient")) { Info<< "Checking surface orientation" << endl; - surf.checkOrientation(true); + PatchTools::checkOrientation(surf, true); Info<< endl; } @@ -192,7 +193,7 @@ int main(int argc, char *argv[]) if (args.options().found("orient")) { Info<< "Checking surface orientation" << endl; - surf.checkOrientation(true); + PatchTools::checkOrientation(surf, true); Info<< endl; } @@ -230,7 +231,7 @@ int main(int argc, char *argv[]) if (args.options().found("orient")) { Info<< "Checking surface orientation" << endl; - surf.checkOrientation(true); + PatchTools::checkOrientation(surf, true); Info<< endl; } diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 8fe778aa16..2c4bfce8d7 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -50,7 +50,7 @@ primitives/random/Random.C containers/HashTables/HashTable/HashTableName.C containers/HashTables/StaticHashTable/StaticHashTableName.C containers/Lists/SortableList/ParSortableListName.C -containers/Lists/PackedList/PackedListName.C +containers/Lists/PackedList/PackedListCore.C containers/Lists/ListOps/ListOps.C containers/LinkedLists/linkTypes/SLListBase/SLListBase.C containers/LinkedLists/linkTypes/DLListBase/DLListBase.C diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C index 2136916780..6bf84e0c55 100644 --- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C +++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.C @@ -51,6 +51,13 @@ Foam::HashSet::HashSet(const HashTable& ht) // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // +template +inline bool Foam::HashSet::operator[](const Key& key) const +{ + return found(key); +} + + template bool Foam::HashSet::operator==(const HashSet& rhs) const { diff --git a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H index fbe0baf785..9a4c5951be 100644 --- a/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H +++ b/src/OpenFOAM/containers/HashTables/HashSet/HashSet.H @@ -133,9 +133,11 @@ public: return HashTable::insert(key, nil()); } - // Member Operators + //- Return true if the entry exists, same as found() + inline bool operator[](const Key&) const; + //- Equality. Two hashtables are equal when their contents are equal. // Independent of table size or order. bool operator==(const HashSet&) const; diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C index d4bb3ca826..8667ad47ba 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedList.C @@ -28,20 +28,20 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template +template Foam::PackedList::PackedList(const label size, const unsigned int val) : - List(packedLength(size), 0u), + StorageList(packedLength(size), 0u), size_(size) { operator=(val); } -template +template Foam::PackedList::PackedList(const UList