.. _program_listing_file_samplers_SingleCellSampler_SingleCellSampler.C: Program Listing for File SingleCellSampler.C ============================================ |exhale_lsh| :ref:`Return to documentation for file ` (``samplers/SingleCellSampler/SingleCellSampler.C``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /*---------------------------------------------------------------------------* \ License This file is part of libWallModelledLES. libWallModelledLES 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. libWallModelledLES 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 libWallModelledLES. If not, see . \*---------------------------------------------------------------------------*/ #include "SingleCellSampler.H" #include "meshSearch.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "wallFvPatch.H" #include "objectRegistry.H" #include "IOField.H" #include "SampledVelocityField.H" #include "SampledWallGradUField.H" #include "codeRules.H" #include "patchDistMethod.H" #include "scalarListIOList.H" #include "CrawlingCellFinder.H" #include "TreeCellFinder.H" #include "surfaceMesh.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #if !defined(DOXYGEN_SHOULD_SKIP_THIS) namespace Foam { defineTypeNameAndDebug(SingleCellSampler, 0); addToRunTimeSelectionTable(Sampler, SingleCellSampler, SamplerRTSTable); } #endif // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::SingleCellSampler::createIndexList() { const label patchIndex = patch().index(); word hName; // Grab h for the current patch if (mesh_.foundObject("hSampler")) { hName = "hSampler"; } else { hName = "h"; } // Grab h for the current patch volScalarField & h = const_cast(mesh_.lookupObject (hName)); scalarField hPatch = h.boundaryField()[patchIndex]; if (hIsIndex_ && interpolationType_ != "cell") { Warning << "SingleCellSampler: hIsIndex is set to true, there is no sense " << "to interpolate within the cell." << nl << "Will fall back to the 'cell' interpolation type, i.e. use the " << "cell-centred values." << nl; interpolationType_ = "cell"; } if (cellFinderType() == "Crawling") { CrawlingCellFinder cellFinder(patch()); cellFinder.findCellIndices(indexList_, hPatch, hIsIndex_); } else if (cellFinderType() == word("Tree")) { if (hIsIndex_) { FatalErrorInFunction << "SingleCellSampler: hIsIndex is not supported by the Tree " << "sampler. Please use the Crawling sampler or provide h as " << "distances." << abort(FatalError); } TreeCellFinder cellFinder(patch()); cellFinder.findCellIndices(indexList_, hPatch); } else { FatalErrorInFunction << "SingleCellSampler: the sampler should be either Tree or " << "Crawling. Current input is " << cellFinderType() << abort(FatalError); } const vectorField & patchFaceCentres = patch().Cf(); const volVectorField & C = mesh_.C(); const UList