From 0250a1b0bbafd4c1270afed667bc5a0cced41fc2 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 30 Aug 2023 14:54:36 +0200 Subject: [PATCH] ENH: support List sub-slice searching, use std::find() - support UList shallowCopy with pointer/size (eg, for slicing into or from span) ENH: add SubList::reset() functionality - allows modification of a SubList after construction. Previously a SubList had an immutable location after construction and there was no way to shift or change its location. BUG: missed special handling for DynamicList::readList (fixes #2974) - equivalent to List::readList, in which the stream is temporarily toggled from ASCII to BINARY when reading in a List of char data. This specialization was missed when DynamicList::readList() was fully implemented. --- applications/test/SubField/Test-SubField.C | 40 +++++-- .../containers/Buffers/CircularBuffer.C | 2 + .../containers/Buffers/CircularBuffer.H | 15 ++- .../containers/Buffers/CircularBufferI.H | 7 ++ .../IndirectListBase/IndirectListBase.C | 18 ++- .../IndirectListBase/IndirectListBase.H | 22 ++-- .../IndirectListBase/IndirectListBaseI.H | 5 +- .../Lists/DynamicList/DynamicListIO.C | 21 ++++ .../containers/Lists/FixedList/FixedList.C | 47 +++++--- .../containers/Lists/FixedList/FixedList.H | 30 +++-- .../containers/Lists/FixedList/FixedListI.H | 17 ++- src/OpenFOAM/containers/Lists/List/SubList.H | 45 ++++++- src/OpenFOAM/containers/Lists/List/SubListI.H | 110 +++++++++++++++++- src/OpenFOAM/containers/Lists/List/UList.C | 42 ++++--- src/OpenFOAM/containers/Lists/List/UList.H | 31 +++-- src/OpenFOAM/containers/Lists/List/UListI.H | 24 +++- src/OpenFOAM/containers/Lists/List/UListIO.C | 5 +- .../containers/Lists/List/stdVectorIO.C | 3 +- src/OpenFOAM/fields/Fields/Field/SubField.H | 2 +- 19 files changed, 391 insertions(+), 95 deletions(-) diff --git a/applications/test/SubField/Test-SubField.C b/applications/test/SubField/Test-SubField.C index 4e89c0cda3..0b1b3c64ca 100644 --- a/applications/test/SubField/Test-SubField.C +++ b/applications/test/SubField/Test-SubField.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,6 +37,7 @@ Description #include "scalarField.H" #include "SubField.H" #include "labelRange.H" +#include "ListOps.H" #include using namespace Foam; @@ -57,26 +58,26 @@ int main(int argc, char *argv[]) argList::noFunctionObjects(); { - List ident(25); + List