Download data/src/polyTopoChange/fvMeshTools/fvMeshTools.C from introvoyz042/OpenFOAM-dev: direct link, hf CLI and curl.
- Browser
- Download file 3.55 kB
-
https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/polyTopoChange/fvMeshTools/fvMeshTools.C
- Command line
-
hf download hf://datasets/introvoyz042/OpenFOAM-dev/data/src/polyTopoChange/fvMeshTools/fvMeshTools.C
-
curl -L -o fvMeshTools.C https://huggingface.co/datasets/introvoyz042/OpenFOAM-dev/resolve/main/data/src/polyTopoChange/fvMeshTools/fvMeshTools.C
3.55 kB
| /*---------------------------------------------------------------------------*\ | |
| ========= | | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | |
| \\ / O peration | Website: https://openfoam.org | |
| \\ / A nd | Copyright (C) 2012-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/>. | |
| \*---------------------------------------------------------------------------*/ | |
| // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | |
| Foam::label Foam::fvMeshTools::addPatch | |
| ( | |
| fvMesh& mesh, | |
| const polyPatch& patch | |
| ) | |
| { | |
| polyBoundaryMesh& polyPatches = | |
| const_cast<polyBoundaryMesh&>(mesh.poly().boundary()); | |
| // Check if it is already there | |
| label patchi = polyPatches.findIndex(patch.name()); | |
| if (patchi != -1) | |
| { | |
| return patchi; | |
| } | |
| // Append at the end ... | |
| label insertPatchi = polyPatches.size(); | |
| // ... unless there are processor patches, in which case append after the | |
| // last global patch | |
| if (!isA<processorPolyPatch>(patch)) | |
| { | |
| forAll(polyPatches, patchi) | |
| { | |
| const polyPatch& pp = polyPatches[patchi]; | |
| if (isA<processorPolyPatch>(pp)) | |
| { | |
| insertPatchi = patchi; | |
| break; | |
| } | |
| } | |
| } | |
| mesh.addPatch(insertPatchi, patch); | |
| return insertPatchi; | |
| } | |
| void Foam::fvMeshTools::addedPatches(fvMesh& mesh) | |
| { | |
| mesh.addedPatches(); | |
| } | |
| void Foam::fvMeshTools::setPatchFields | |
| ( | |
| fvMesh& mesh, | |
| const label patchi, | |
| const dictionary& patchFieldDict | |
| ) | |
| { | |
| FOR_ALL_FIELD_TYPES(SetPatchFieldsType, VolField, mesh); | |
| FOR_ALL_FIELD_TYPES(SetPatchFieldsType, SurfaceField, mesh); | |
| if (mesh.foundObject<pointMesh>(pointMesh::typeName)) | |
| { | |
| FOR_ALL_FIELD_TYPES | |
| ( | |
| SetPatchFieldsType, | |
| PointField, | |
| pointMesh::New(mesh) | |
| ); | |
| } | |
| } | |
| void Foam::fvMeshTools::reorderPatches | |
| ( | |
| fvMesh& mesh, | |
| const labelList& oldToNew, | |
| const label nNewPatches, | |
| const bool validBoundary | |
| ) | |
| { | |
| // Note: oldToNew might have entries beyond nNewPatches so | |
| // cannot use `invert(nNewPatches, oldToNew)` | |
| labelList newToOld(nNewPatches, -1); | |
| forAll(oldToNew, i) | |
| { | |
| label newi = oldToNew[i]; | |
| if (newi >= 0 && newi < nNewPatches) | |
| { | |
| newToOld[newi] = i; | |
| } | |
| } | |
| mesh.reorderPatches(newToOld, validBoundary); | |
| } | |
| // ************************************************************************* // | |