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