/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM 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. OpenFOAM 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 OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "streamlinesParticle.H" #include "streamlinesCloud.H" #include "vectorFieldIOField.H" #include "scalarFieldIOField.H" #include "transformerIOList.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::vector Foam::streamlinesParticle::interpolateFields ( const trackingData& td, const point& position, const label celli, const label facei ) { if (celli == -1) { FatalErrorInFunction << "Cell:" << celli << abort(FatalError); } bool interpolatedU = false; vector U = vector::uniform(NaN); forAll(td.scalarInterp_, fieldi) { #define InterpolateType(Type, nullArg) \ if (td.Type##Interp_.set(fieldi)) \ { \ const Type s = \ td.Type##Interp_[fieldi].interpolate \ ( \ position, \ celli, \ facei \ ); \ \ sampled##Type##s_.setSize(td.Type##Interp_.size()); \ sampled##Type##s_[fieldi].append \ ( \ td.trackOutside_ ? transform_.invTransform(s) : s \ ); \ } FOR_ALL_FIELD_TYPES(InterpolateType); #undef InterpolateType if ( td.vectorInterp_.set(fieldi) && &td.vectorInterp_[fieldi] == &td.UInterp_ ) { interpolatedU = true; U = sampledvectors_[fieldi].last(); } } // Interpolate the velocity if it has not already been done if (!interpolatedU) { U = td.UInterp_.interpolate(position, celli, facei); } return U; } void Foam::streamlinesParticle::endTrack(trackingData& td) { const label n = sampledPositions_.size(); const label trackPartIndex = td.trackForward_ ? trackPartIndex_ : -1 - trackPartIndex_; if (!td.trackForward_) reverse(sampledPositions_); td.allPositions_.append(sampledPositions_); sampledPositions_.clear(); td.allTracks_.append(List