Download data/src/finiteVolume/pointMesh/pointMeshMapper/pointPatchMapper.C from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 4.83 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/pointMesh/pointMeshMapper/pointPatchMapper.C
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/finiteVolume/pointMesh/pointMeshMapper/pointPatchMapper.C
-
curl -L -o pointPatchMapper.C https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/finiteVolume/pointMesh/pointMeshMapper/pointPatchMapper.C
4.83 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / 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 <http://www.gnu.org/licenses/>. | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | |
| void Foam::pointPatchMapper::calcAddressing() const | |
| { | |
| if | |
| ( | |
| directAddrPtr_ | |
| || interpolationAddrPtr_ | |
| || weightsPtr_ | |
| ) | |
| { | |
| FatalErrorInFunction | |
| << "Addressing already calculated" | |
| << abort(FatalError); | |
| } | |
| if (direct()) | |
| { | |
| // Direct mapping. | |
| directAddrPtr_ = new labelList(map_.patchPointMap()[patch_.index()]); | |
| } | |
| else | |
| { | |
| // Interpolative mapping. | |
| // NOTE: Incorrect: | |
| // FOR NOW only takes first patch point instead of averaging all | |
| // patch points. Problem is we don't know what points were in the patch | |
| // for points that were merged. | |
| interpolationAddrPtr_ = new labelListList(patch_.size()); | |
| labelListList& addr = *interpolationAddrPtr_; | |
| weightsPtr_ = new scalarListList(addr.size()); | |
| scalarListList& w = *weightsPtr_; | |
| const labelList& ppm = map_.patchPointMap()[patch_.index()]; | |
| forAll(ppm, i) | |
| { | |
| if (ppm[i] >= 0) | |
| { | |
| addr[i] = labelList(1, ppm[i]); | |
| w[i] = scalarList(1, 1.0); | |
| } | |
| else | |
| { | |
| // Inserted point. | |
| ///// Map from point0 (arbitrary choice) | |
| // addr[i] = labelList(1, label(0)); | |
| // w[i] = scalarList(1, 1.0); | |
| } | |
| } | |
| } | |
| } | |
| void Foam::pointPatchMapper::clearOut() | |
| { | |
| deleteDemandDrivenData(directAddrPtr_); | |
| deleteDemandDrivenData(interpolationAddrPtr_); | |
| deleteDemandDrivenData(weightsPtr_); | |
| } | |
| // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | |
| Foam::pointPatchMapper::pointPatchMapper | |
| ( | |
| const pointPatch& patch, | |
| const pointMapper& pointMap, | |
| const polyTopoChangeMap& map | |
| ) | |
| : | |
| generalFieldMapper(), | |
| patch_(patch), | |
| pointMapper_(pointMap), | |
| map_(map), | |
| sizeBeforeMapping_ | |
| ( | |
| patch_.index() < map_.oldPatchNMeshPoints().size() | |
| ? map_.oldPatchNMeshPoints()[patch_.index()] | |
| : 0 | |
| ), | |
| directAddrPtr_(nullptr), | |
| interpolationAddrPtr_(nullptr), | |
| weightsPtr_(nullptr) | |
| {} | |
| // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | |
| Foam::pointPatchMapper::~pointPatchMapper() | |
| { | |
| clearOut(); | |
| } | |
| // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | |
| const Foam::labelUList& Foam::pointPatchMapper::directAddressing() const | |
| { | |
| if (!direct()) | |
| { | |
| FatalErrorInFunction | |
| << "Requested direct addressing for an interpolative mapper." | |
| << abort(FatalError); | |
| } | |
| if (!directAddrPtr_) | |
| { | |
| calcAddressing(); | |
| } | |
| return *directAddrPtr_; | |
| } | |
| const Foam::labelListList& Foam::pointPatchMapper::addressing() const | |
| { | |
| if (direct()) | |
| { | |
| FatalErrorInFunction | |
| << "Requested interpolative addressing for a direct mapper." | |
| << abort(FatalError); | |
| } | |
| if (!interpolationAddrPtr_) | |
| { | |
| calcAddressing(); | |
| } | |
| return *interpolationAddrPtr_; | |
| } | |
| const Foam::scalarListList& Foam::pointPatchMapper::weights() const | |
| { | |
| if (direct()) | |
| { | |
| FatalErrorInFunction | |
| << "Requested interpolative weights for a direct mapper." | |
| << abort(FatalError); | |
| } | |
| if (!weightsPtr_) | |
| { | |
| calcAddressing(); | |
| } | |
| return *weightsPtr_; | |
| } | |
| // ************************************************************************* // | |