diff --git a/applications/test/PackedList2/Test-PackedList2.C b/applications/test/PackedList2/Test-PackedList2.C index 2926118ff9..26981b484f 100644 --- a/applications/test/PackedList2/Test-PackedList2.C +++ b/applications/test/PackedList2/Test-PackedList2.C @@ -84,6 +84,12 @@ int main(int argc, char *argv[]) packed.resize(n, 1); } Info<< "resize/shrink/resize:" << timer.cpuTimeIncrement() << " s\n\n"; + Info<< "packed bool size=" << packed.size() << nl; + + // Neither of these should affect the size + packed.unset(2*n-1); + packed.set(2*n-1, 0); + Info<< "packed bool size=" << packed.size() << nl; // set every other bit on: Info<< "set every other bit on and count\n"; @@ -99,8 +105,8 @@ int main(int argc, char *argv[]) } } Info<< "Counting brute-force:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Count packed @@ -110,8 +116,8 @@ int main(int argc, char *argv[]) sum += packed.count(); } Info<< "Counting via count():" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Dummy addition @@ -123,8 +129,8 @@ int main(int argc, char *argv[]) sum += i + 1; } } - Info<< "Dummy loop:" << timer.cpuTimeIncrement() << " s" << endl; - Info<< " sum " << sum << endl; + Info<< "Dummy loop:" << timer.cpuTimeIncrement() << " s" << nl + << " sum " << sum << " (sum is meaningless)" << endl; // // Read @@ -139,8 +145,8 @@ int main(int argc, char *argv[]) sum += stlVector[i]; } } - Info<< "Reading stl:" << timer.cpuTimeIncrement() << " s" << endl; - Info<< " sum " << sum << endl; + Info<< "Reading stl:" << timer.cpuTimeIncrement() << " s" << nl + << " sum " << sum << endl; // Read unpacked @@ -152,8 +158,8 @@ int main(int argc, char *argv[]) sum += unpacked[i]; } } - Info<< "Reading unpacked:" << timer.cpuTimeIncrement() << " s" << endl; - Info<< " sum " << sum << endl; + Info<< "Reading unpacked:" << timer.cpuTimeIncrement() << " s" << nl + << " sum " << sum << endl; // Read packed @@ -166,8 +172,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading packed using get:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read packed @@ -180,8 +186,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading packed using reference:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read via iterator @@ -194,8 +200,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading packed using iterator:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read via iterator @@ -208,8 +214,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading packed using const_iterator():" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read empty hash @@ -222,8 +228,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading empty labelHashSet:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read full hash @@ -236,8 +242,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading full labelHashSet:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; // Read empty static hash @@ -250,8 +256,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading empty StaticHash:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; #if 0 // we can skip this test - it is usually quite slow @@ -265,8 +271,8 @@ int main(int argc, char *argv[]) } } Info<< "Reading full StaticHash:" << timer.cpuTimeIncrement() - << " s" << endl; - Info<< " sum " << sum << endl; + << " s" << nl + << " sum " << sum << endl; #endif Info<< "Starting write tests" << endl; @@ -319,7 +325,6 @@ int main(int argc, char *argv[]) Info<< "Writing packed using set:" << timer.cpuTimeIncrement() << " s" << endl; - // Write packed for (label iter = 0; iter < nIters; ++iter) { diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C index 791d53cc59..4b01a43dd6 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C @@ -286,7 +286,7 @@ Foam::Xfer Foam::PackedBoolList::used() const // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // -void Foam::PackedBoolList::operator=(const Foam::UList& lst) +void Foam::PackedBoolList::operator=(const UList& lst) { this->setSize(lst.size()); diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H index b2ca0037f8..f98545a9bd 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H @@ -94,7 +94,7 @@ public: inline PackedBoolList(); //- Construct from Istream - PackedBoolList(Istream&); + PackedBoolList(Istream& is); //- Construct with given size, initializes list to 0 explicit inline PackedBoolList(const label size); @@ -103,19 +103,19 @@ public: inline PackedBoolList(const label size, const bool val); //- Copy constructor - inline PackedBoolList(const PackedBoolList&); + inline PackedBoolList(const PackedBoolList& lst); //- Copy constructor - explicit inline PackedBoolList(const PackedList<1>&); + explicit inline PackedBoolList(const PackedList<1>& lst); //- Construct by transferring the parameter contents - inline PackedBoolList(const Xfer&); + inline PackedBoolList(const Xfer& lst); //- Construct by transferring the parameter contents - inline PackedBoolList(const Xfer>&); + inline PackedBoolList(const Xfer>& lst); //- Construct from a list of bools - explicit inline PackedBoolList(const Foam::UList&); + explicit inline PackedBoolList(const UList& lst); //- Construct from a list of labels // using the labels as indices to indicate which bits are set @@ -131,132 +131,132 @@ public: // Member Functions - // Access + // Access - using PackedList<1>::set; - using PackedList<1>::unset; + using PackedList<1>::set; + using PackedList<1>::unset; - //- Set specified bits. - void set(const PackedList<1>&); + //- Set specified bits. + void set(const PackedList<1>& lst); - //- Set the listed indices. Return number of elements changed. - // Does auto-vivify for non-existent entries. - label set(const labelUList& indices); + //- Set the listed indices. Return number of elements changed. + // Does auto-vivify for non-existent entries. + label set(const labelUList& indices); - //- Set the listed indices. Return number of elements changed. - // Does auto-vivify for non-existent entries. - label set(const UIndirectList