From 6fe6145d97249db1c47260d96cb2ba9e2c01f434 Mon Sep 17 00:00:00 2001 From: Gregor Weiss Date: Mon, 25 Sep 2023 17:16:45 +0200 Subject: [PATCH] ENH: Add simple source code additions --- .../fields/surfaceFields/surfaceFieldsI.H | 426 +++++++++ src/foam/Make/files | 43 + src/foam/Make/options | 14 +- src/foam/containers/Lists/List/DebugIOList.C | 3 + .../containers/Lists/UList/DebugIOUList.C | 3 + .../db/IOstreams/IOstreams/IOstreamOption.C | 168 ++++ .../db/IOstreams/IOstreams/IOstreamOption.H | 375 ++++++++ .../IOstreams/SliceStreams/FileSliceStream.C | 66 ++ .../IOstreams/SliceStreams/FileSliceStream.H | 70 ++ .../db/IOstreams/SliceStreams/IFCstream.C | 316 +++++++ .../db/IOstreams/SliceStreams/IFCstream.H | 278 ++++++ .../db/IOstreams/SliceStreams/IFCstreamI.H | 248 ++++++ .../db/IOstreams/SliceStreams/OFCstream.C | 402 +++++++++ .../db/IOstreams/SliceStreams/OFCstream.H | 222 +++++ .../db/IOstreams/SliceStreams/SliceStream.C | 303 +++++++ .../db/IOstreams/SliceStreams/SliceStream.H | 240 +++++ .../IOstreams/SliceStreams/SliceStreamImpl.H | 207 +++++ .../IOstreams/SliceStreams/SliceStreamPaths.C | 54 ++ .../IOstreams/SliceStreams/SliceStreamPaths.H | 91 ++ .../IOstreams/SliceStreams/SliceStreamRepo.C | 180 ++++ .../IOstreams/SliceStreams/SliceStreamRepo.H | 136 +++ .../IOstreams/SliceStreams/SliceStreamRepoI.H | 86 ++ .../db/IOstreams/SliceStreams/UListProxy.C | 181 ++++ .../db/IOstreams/SliceStreams/UListProxy.H | 140 +++ .../SliceStreams/buffer/SliceBuffer.C | 53 ++ .../SliceStreams/buffer/SliceBuffer.H | 146 +++ .../SliceStreams/buffer/spanBuffer.H | 259 ++++++ .../SliceStreams/buffer/variableBuffer.H | 278 ++++++ .../SliceStreams/create/InputFeatures.C | 86 ++ .../SliceStreams/create/InputFeatures.H | 59 ++ .../SliceStreams/create/OutputFeatures.C | 84 ++ .../SliceStreams/create/OutputFeatures.H | 59 ++ .../SliceStreams/create/SliceReading.C | 52 ++ .../SliceStreams/create/SliceReading.H | 60 ++ .../SliceStreams/create/SliceStreamCreator.H | 56 ++ .../SliceStreams/create/SliceWriting.C | 52 ++ .../SliceStreams/create/SliceWriting.H | 60 ++ .../SliceStreams/create/StreamFeatures.H | 66 ++ .../IOstreams/SliceStreams/fieldDataEntry.C | 176 ++++ .../IOstreams/SliceStreams/fieldDataEntry.H | 207 +++++ src/foam/db/IOstreams/SliceStreams/fieldTag.C | 160 ++++ src/foam/db/IOstreams/SliceStreams/fieldTag.H | 135 +++ .../IOstreams/SliceStreams/formattingEntry.C | 46 + .../IOstreams/SliceStreams/formattingEntry.H | 85 ++ .../SliceStreams/primitives_traits.H | 135 +++ .../SliceStreams/sliceReadPrimitives.C | 102 +++ .../SliceStreams/sliceReadPrimitives.H | 194 ++++ .../SliceStreams/sliceWritePrimitives.C | 176 ++++ .../SliceStreams/sliceWritePrimitives.H | 186 ++++ .../IOstreams/SliceStreams/uListProxyBase.H | 140 +++ .../DebugIODimensionedField.C | 3 + src/foam/fields/Fields/Field/DebugIOField.C | 3 + .../CoherenceComposite/DataComponent.C | 127 +++ .../CoherenceComposite/DataComponent.H | 182 ++++ .../CoherenceComposite/DataComponentFree.C | 45 + .../CoherenceComposite/DataComponentFree.H | 54 ++ .../CoherenceComposite/DataComponentI.H | 84 ++ .../CoherenceComposite/FieldComponent.H | 106 +++ .../CoherenceComposite/FieldComponentI.H | 91 ++ .../CoherenceComposite/IndexComponent.C | 214 +++++ .../CoherenceComposite/IndexComponent.H | 140 +++ .../decorators/ComponentDecorator.H | 87 ++ .../decorators/OffsetDecorator.H | 128 +++ .../decorators/SliceDecorator.C | 122 +++ .../decorators/SliceDecorator.H | 91 ++ .../strategies/InitStrategies.C | 59 ++ .../strategies/InitStrategies.H | 282 ++++++ .../strategies/OffsetStrategies.C | 147 +++ .../strategies/OffsetStrategies.H | 98 ++ .../polyMesh/CoherentMesh/CoherentMesh.C | 838 ++++++++++++++++++ .../polyMesh/CoherentMesh/CoherentMesh.H | 219 +++++ .../CoherentMesh/FragmentPermutation.C | 96 ++ .../CoherentMesh/FragmentPermutation.H | 150 ++++ .../CoherentMesh/FragmentPermutationI.H | 63 ++ .../meshes/polyMesh/CoherentMesh/Offsets.C | 110 +++ .../meshes/polyMesh/CoherentMesh/Offsets.H | 109 +++ .../polyMesh/CoherentMesh/ProcessorPatch.C | 276 ++++++ .../polyMesh/CoherentMesh/ProcessorPatch.H | 166 ++++ .../polyMesh/CoherentMesh/ProcessorPatchI.H | 64 ++ src/foam/meshes/polyMesh/CoherentMesh/Slice.C | 111 +++ src/foam/meshes/polyMesh/CoherentMesh/Slice.H | 130 +++ .../meshes/polyMesh/CoherentMesh/SliceI.H | 98 ++ .../polyMesh/CoherentMesh/SlicePermutation.C | 143 +++ .../polyMesh/CoherentMesh/SlicePermutation.H | 125 +++ .../polyMesh/CoherentMesh/SlicePermutationI.H | 50 ++ .../polyMesh/CoherentMesh/nonblockConsensus.C | 126 +++ .../polyMesh/CoherentMesh/nonblockConsensus.H | 84 ++ .../CoherentMesh/nonblockConsensusI.H | 125 +++ .../meshes/polyMesh/CoherentMesh/sliceMap.C | 57 ++ .../meshes/polyMesh/CoherentMesh/sliceMap.H | 79 ++ .../meshes/polyMesh/CoherentMesh/sliceMapI.H | 54 ++ .../polyMesh/CoherentMesh/sliceMeshHelper.C | 119 +++ .../polyMesh/CoherentMesh/sliceMeshHelper.H | 123 +++ .../polyMesh/CoherentMesh/sliceMeshHelperI.H | 276 ++++++ 94 files changed, 13215 insertions(+), 3 deletions(-) create mode 100644 src/finiteVolume/fields/surfaceFields/surfaceFieldsI.H create mode 100644 src/foam/containers/Lists/List/DebugIOList.C create mode 100644 src/foam/containers/Lists/UList/DebugIOUList.C create mode 100644 src/foam/db/IOstreams/IOstreams/IOstreamOption.C create mode 100644 src/foam/db/IOstreams/IOstreams/IOstreamOption.H create mode 100644 src/foam/db/IOstreams/SliceStreams/FileSliceStream.C create mode 100644 src/foam/db/IOstreams/SliceStreams/FileSliceStream.H create mode 100644 src/foam/db/IOstreams/SliceStreams/IFCstream.C create mode 100644 src/foam/db/IOstreams/SliceStreams/IFCstream.H create mode 100644 src/foam/db/IOstreams/SliceStreams/IFCstreamI.H create mode 100644 src/foam/db/IOstreams/SliceStreams/OFCstream.C create mode 100644 src/foam/db/IOstreams/SliceStreams/OFCstream.H create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStream.C create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStream.H create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamImpl.H create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamPaths.C create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamPaths.H create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamRepo.C create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamRepo.H create mode 100644 src/foam/db/IOstreams/SliceStreams/SliceStreamRepoI.H create mode 100644 src/foam/db/IOstreams/SliceStreams/UListProxy.C create mode 100644 src/foam/db/IOstreams/SliceStreams/UListProxy.H create mode 100644 src/foam/db/IOstreams/SliceStreams/buffer/SliceBuffer.C create mode 100644 src/foam/db/IOstreams/SliceStreams/buffer/SliceBuffer.H create mode 100644 src/foam/db/IOstreams/SliceStreams/buffer/spanBuffer.H create mode 100644 src/foam/db/IOstreams/SliceStreams/buffer/variableBuffer.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/InputFeatures.C create mode 100644 src/foam/db/IOstreams/SliceStreams/create/InputFeatures.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/OutputFeatures.C create mode 100644 src/foam/db/IOstreams/SliceStreams/create/OutputFeatures.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/SliceReading.C create mode 100644 src/foam/db/IOstreams/SliceStreams/create/SliceReading.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/SliceStreamCreator.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/SliceWriting.C create mode 100644 src/foam/db/IOstreams/SliceStreams/create/SliceWriting.H create mode 100644 src/foam/db/IOstreams/SliceStreams/create/StreamFeatures.H create mode 100644 src/foam/db/IOstreams/SliceStreams/fieldDataEntry.C create mode 100644 src/foam/db/IOstreams/SliceStreams/fieldDataEntry.H create mode 100644 src/foam/db/IOstreams/SliceStreams/fieldTag.C create mode 100644 src/foam/db/IOstreams/SliceStreams/fieldTag.H create mode 100644 src/foam/db/IOstreams/SliceStreams/formattingEntry.C create mode 100644 src/foam/db/IOstreams/SliceStreams/formattingEntry.H create mode 100644 src/foam/db/IOstreams/SliceStreams/primitives_traits.H create mode 100644 src/foam/db/IOstreams/SliceStreams/sliceReadPrimitives.C create mode 100644 src/foam/db/IOstreams/SliceStreams/sliceReadPrimitives.H create mode 100644 src/foam/db/IOstreams/SliceStreams/sliceWritePrimitives.C create mode 100644 src/foam/db/IOstreams/SliceStreams/sliceWritePrimitives.H create mode 100644 src/foam/db/IOstreams/SliceStreams/uListProxyBase.H create mode 100644 src/foam/fields/DimensionedFields/DimensionedField/DebugIODimensionedField.C create mode 100644 src/foam/fields/Fields/Field/DebugIOField.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/DataComponent.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/DataComponent.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/DataComponentFree.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/DataComponentFree.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/DataComponentI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/FieldComponent.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/FieldComponentI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/IndexComponent.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/IndexComponent.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/decorators/ComponentDecorator.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/decorators/OffsetDecorator.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/decorators/SliceDecorator.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/decorators/SliceDecorator.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/strategies/InitStrategies.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/strategies/InitStrategies.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/strategies/OffsetStrategies.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherenceComposite/strategies/OffsetStrategies.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherentMesh.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/CoherentMesh.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/FragmentPermutation.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/FragmentPermutation.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/FragmentPermutationI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/Offsets.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/Offsets.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/ProcessorPatch.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/ProcessorPatch.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/ProcessorPatchI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/Slice.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/Slice.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/SliceI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/SlicePermutation.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/SlicePermutation.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/SlicePermutationI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/nonblockConsensus.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/nonblockConsensus.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/nonblockConsensusI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMap.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMap.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMapI.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelper.C create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelper.H create mode 100644 src/foam/meshes/polyMesh/CoherentMesh/sliceMeshHelperI.H diff --git a/src/finiteVolume/fields/surfaceFields/surfaceFieldsI.H b/src/finiteVolume/fields/surfaceFields/surfaceFieldsI.H new file mode 100644 index 000000000..4731c5e91 --- /dev/null +++ b/src/finiteVolume/fields/surfaceFields/surfaceFieldsI.H @@ -0,0 +1,426 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | foam-extend: Open Source CFD + \\ / O peration | Version: 4.1 + \\ / A nd | Web: http://www.foam-extend.org + \\/ M anipulation | For copyright notice see file Copyright +------------------------------------------------------------------------------- +License + This file is part of foam-extend. + + foam-extend 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 3 of the License, or (at your + option) any later version. + + foam-extend 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 foam-extend. If not, see . + +\*---------------------------------------------------------------------------*/ + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::IFCstream::reader::read +( + IFCstream& ifs +) +{ + ifs.readNonProcessorBoundaryFields(); + + // Take care internal and processor fields. Internal surface field in + // coherent format includes processor boundaries. If it is uniform, the + // processor patches need to be created with the same uniform entry. + // Otherwise, the coherent internal field needs to be mapped to FOAM's + // internal and processor fields. + + typedef typename pTraits::cmptType cmptType; + const polyMesh& mesh = ifs.coherentMesh_.mesh(); + const polyBoundaryMesh& bm = mesh.boundaryMesh(); + + // Internal field data + UList internalData; + + // Field data in the coherent format holding internal and processor patch + // fields + List coherentData; + + ITstream& its = ifs.dict_.lookup("internalField"); + dictionary& bfDict = ifs.dict_.subDict("boundaryField"); + + // Traverse the tokens of the internal field entry + while (true) + { + if (its.eof()) + { + FatalErrorInFunction + << "Expected 'uniform' or compoundToken in " << its + << nl << " in file " << ifs.pathname_ + << abort(FatalError); + } + + token currToken(its); + + if (currToken.isCompound()) // non-uniform + { + // Resize the compoundToken according to the mesh of the proc + token::compound& compToken = currToken.compoundToken(); + compToken.resize(mesh.nInternalFaces()); + + // Store the data pointer in a UList for convenience + internalData = UList + ( + reinterpret_cast(compToken.data()), + mesh.nInternalFaces() + ); + + // Current token index points to the token after the compound + // ToDoIO Get rid of globalSize? + const label globalSize = its[its.tokenIndex()++].labelToken(); + const string id = its[its.tokenIndex()++].stringToken(); + if (false) + { + Info<< globalSize; + } // Silence compiler warning + + // Internal surface field in coherent format includes processor + // boundaries. Thus, find out the corresponding size. + const label localSize = + ifs.coherentFieldSize(); + const globalIndex gi(localSize); + const label elemOffset = gi.offset(Pstream::myProcNo()); + const label nElems = gi.localSize(); + const label nCmpts = compToken.nComponents(); + + coherentData.resize(localSize); + + ifs.sliceStreamPtr_->access("fields", ifs.pathname_.path()); + ifs.sliceStreamPtr_->get + ( + id, + reinterpret_cast(coherentData.data()), + List