diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 07a9ba76d5..cca2391916 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -708,11 +708,7 @@ fields/GeometricFields/pointFields/pointFields.C meshes/bandCompression/bandCompression.C meshes/preservePatchTypes/preservePatchTypes.C -interpolations = interpolations -interpolation = $(interpolations)/interpolation -$(interpolations)/patchToPatchInterpolation/PatchToPatchInterpolationName.C - -interpolationWeights = $(interpolations)/interpolationWeights +interpolationWeights = interpolations/interpolationWeights $(interpolationWeights)/interpolationWeights/interpolationWeights.C $(interpolationWeights)/linearInterpolationWeights/linearInterpolationWeights.C $(interpolationWeights)/splineInterpolationWeights/splineInterpolationWeights.C diff --git a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C b/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C deleted file mode 100644 index e715823cd7..0000000000 --- a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.C +++ /dev/null @@ -1,125 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 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 "interpolateSplineXY.H" -#include "primitiveFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -Foam::Field Foam::interpolateSplineXY -( - const scalarField& xNew, - const scalarField& xOld, - const Field& yOld -) -{ - Field yNew(xNew.size()); - - forAll(xNew, i) - { - yNew[i] = interpolateSplineXY(xNew[i], xOld, yOld); - } - - return yNew; -} - - -template -Type Foam::interpolateSplineXY -( - const scalar x, - const scalarField& xOld, - const Field& yOld -) -{ - label n = xOld.size(); - - // early exit if out of bounds or only one value - if (n == 1 || x < xOld[0]) - { - return yOld[0]; - } - if (x > xOld[n - 1]) - { - return yOld[n - 1]; - } - - // linear interpolation if only two values - if (n == 2) - { - return (x - xOld[0])/(xOld[1] - xOld[0])*(yOld[1] - yOld[0]) + yOld[0]; - } - - // find bounding knots - label hi = 0; - while (hi < n && xOld[hi] < x) - { - hi++; - } - - label lo = hi - 1; - - const Type& y1 = yOld[lo]; - const Type& y2 = yOld[hi]; - - Type y0; - if (lo == 0) - { - y0 = 2*y1 - y2; - } - else - { - y0 = yOld[lo - 1]; - } - - Type y3; - if (hi + 1 == n) - { - y3 = 2*y2 - y1; - } - else - { - y3 = yOld[hi + 1]; - } - - // weighting - scalar mu = (x - xOld[lo])/(xOld[hi] - xOld[lo]); - - // interpolate - return - 0.5 - *( - 2*y1 - + mu - *( - -y0 + y2 - + mu*((2*y0 - 5*y1 + 4*y2 - y3) + mu*(-y0 + 3*y1 - 3*y2 + y3)) - ) - ); -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.H b/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.H deleted file mode 100644 index 0cf1ffe00f..0000000000 --- a/src/OpenFOAM/interpolations/interpolateSplineXY/interpolateSplineXY.H +++ /dev/null @@ -1,83 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 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 . - -InNamespace - Foam - -Description - Interpolates y values from one curve to another with a different x - distribution. - - Uses Catmull-Rom spline interpolation between points. - -SourceFiles - interpolateSplineXY.C - -\*---------------------------------------------------------------------------*/ - -#ifndef interpolateSplineXY_H -#define interpolateSplineXY_H - -#include "scalar.H" -#include "primitiveFieldsFwd.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -template -Field interpolateSplineXY -( - const scalarField& xNew, - const scalarField& xOld, - const Field& yOld -); - - -template -Type interpolateSplineXY -( - const scalar x, - const scalarField& xOld, - const Field& yOld -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "interpolateSplineXY.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C deleted file mode 100644 index a6219a8c2b..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/CalcPatchToPatchWeights.C +++ /dev/null @@ -1,359 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 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 "PatchToPatchInterpolation.H" -#include "objectHit.H" -#include "pointHit.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -scalar PatchToPatchInterpolation::projectionTol_ = 0.05; - - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -void PatchToPatchInterpolation::calcPointAddressing() const -{ - // Calculate pointWeights - - pointWeightsPtr_ = new FieldField(toPatch_.nPoints()); - FieldField& pointWeights = *pointWeightsPtr_; - - pointDistancePtr_ = new scalarField(toPatch_.nPoints(), great); - scalarField& pointDistance = *pointDistancePtr_; - - const pointField& fromPatchPoints = fromPatch_.localPoints(); - const List& fromPatchFaces = - fromPatch_.localFaces(); - - const pointField& toPatchPoints = toPatch_.localPoints(); - const vectorField& projectionDirection = toPatch_.pointNormals(); - const edgeList& toPatchEdges = toPatch_.edges(); - const labelListList& toPatchPointEdges = toPatch_.pointEdges(); - - if (debug) - { - Info<< "projecting points" << endl; - } - - List proj = - toPatch_.projectPoints(fromPatch_, projectionDirection, alg_, dir_); - - pointAddressingPtr_ = new labelList(proj.size(), -1); - labelList& pointAddressing = *pointAddressingPtr_; - - bool doWeights = false; - - forAll(pointAddressing, pointi) - { - doWeights = false; - - const typename FromPatch::FaceType& hitFace = - fromPatchFaces[proj[pointi].hitObject()]; - - point hitPoint = Zero; - - if (proj[pointi].hit()) - { - // A hit exists - doWeights = true; - - pointAddressing[pointi] = proj[pointi].hitObject(); - - pointHit curHit = - hitFace.ray - ( - toPatchPoints[pointi], - projectionDirection[pointi], - fromPatchPoints, - alg_, - dir_ - ); - - // Grab distance to target - if (dir_ == intersection::direction::contactSphere) - { - pointDistance[pointi] = - hitFace.contactSphereDiameter - ( - toPatchPoints[pointi], - projectionDirection[pointi], - fromPatchPoints - ); - } - else - { - pointDistance[pointi] = curHit.distance(); - } - - // Grab hit point - hitPoint = curHit.hitPoint(); - } - else if (projectionTol_ > small) - { - // Check for a near miss - pointHit ph = - hitFace.ray - ( - toPatchPoints[pointi], - projectionDirection[pointi], - fromPatchPoints, - alg_, - dir_ - ); - - scalar dist = - Foam::mag - ( - toPatchPoints[pointi] - + projectionDirection[pointi]*ph.distance() - - ph.missPoint() - ); - - // Calculate the local tolerance - scalar minEdgeLength = great; - - // Do shortest edge of hit object - edgeList hitFaceEdges = - fromPatchFaces[proj[pointi].hitObject()].edges(); - - forAll(hitFaceEdges, edgeI) - { - minEdgeLength = - min - ( - minEdgeLength, - hitFaceEdges[edgeI].mag(fromPatchPoints) - ); - } - - const labelList& curEdges = toPatchPointEdges[pointi]; - - forAll(curEdges, edgeI) - { - minEdgeLength = - min - ( - minEdgeLength, - toPatchEdges[curEdges[edgeI]].mag(toPatchPoints) - ); - } - - if (dist < minEdgeLength*projectionTol_) - { - // This point is being corrected - doWeights = true; - - pointAddressing[pointi] = proj[pointi].hitObject(); - - // Grab nearest point on face as hit point - hitPoint = ph.missPoint(); - - // Grab distance to target - if (dir_ == intersection::direction::contactSphere) - { - pointDistance[pointi] = - hitFace.contactSphereDiameter - ( - toPatchPoints[pointi], - projectionDirection[pointi], - fromPatchPoints - ); - } - else - { - pointDistance[pointi] = - ( - projectionDirection[pointi] - /mag(projectionDirection[pointi]) - ) - & (hitPoint - toPatchPoints[pointi]); - } - } - } - - if (doWeights) - { - // Set interpolation pointWeights - pointWeights.set(pointi, new scalarField(hitFace.size())); - - pointField hitFacePoints = hitFace.points(fromPatchPoints); - - forAll(hitFacePoints, masterPointi) - { - pointWeights[pointi][masterPointi] = - 1.0/ - ( - mag - ( - hitFacePoints[masterPointi] - - hitPoint - ) - + vSmall - ); - } - - pointWeights[pointi] /= sum(pointWeights[pointi]); - } - else - { - pointWeights.set(pointi, new scalarField(0)); - } - } -} - - -template -void PatchToPatchInterpolation::calcFaceAddressing() const -{ - faceWeightsPtr_ = new FieldField(toPatch_.size()); - FieldField& faceWeights = *faceWeightsPtr_; - - faceDistancePtr_ = new scalarField(toPatch_.size(), great); - scalarField& faceDistance = *faceDistancePtr_; - - if (debug) - { - Info<< "projecting face centres" << endl; - } - - const pointField& fromPatchPoints = fromPatch_.points(); - const typename FromPatch::FaceListType& fromPatchFaces = fromPatch_; - const labelListList& fromPatchFaceFaces = fromPatch_.faceFaces(); - - vectorField fromPatchFaceCentres(fromPatchFaces.size()); - - forAll(fromPatchFaceCentres, facei) - { - fromPatchFaceCentres[facei] = - fromPatchFaces[facei].centre(fromPatchPoints); - } - - const pointField& toPatchPoints = toPatch_.points(); - const typename ToPatch::FaceListType& toPatchFaces = toPatch_; - - const vectorField& projectionDirection = toPatch_.faceNormals(); - - List proj = - toPatch_.projectFaceCentres - ( - fromPatch_, - projectionDirection, - alg_, - dir_ - ); - - faceAddressingPtr_ = new labelList(proj.size(), -1); - labelList& faceAddressing = *faceAddressingPtr_; - - forAll(faceAddressing, facei) - { - if (proj[facei].hit()) - { - // A hit exists - faceAddressing[facei] = proj[facei].hitObject(); - - const typename FromPatch::FaceType& hitFace = - fromPatchFaces[faceAddressing[facei]]; - - pointHit curHit = - hitFace.ray - ( - toPatchFaces[facei].centre(toPatchPoints), - projectionDirection[facei], - fromPatchPoints, - alg_, - dir_ - ); - - // grab distance to target - faceDistance[facei] = curHit.distance(); - - // grab face centre of the hit face - const point& hitFaceCentre = - fromPatchFaceCentres[faceAddressing[facei]]; - - // grab neighbours of hit face - const labelList& neighbours = - fromPatchFaceFaces[faceAddressing[facei]]; - - scalar m = mag(curHit.hitPoint() - hitFaceCentre); - - if - ( - m < directHitTol // Direct hit - || neighbours.empty() - ) - { - faceWeights.set(facei, new scalarField(1)); - faceWeights[facei][0] = 1.0; - } - else - { - // set interpolation faceWeights - - // The first coefficient corresponds to the centre face. - // The rest is ordered in the same way as the faceFaces list. - faceWeights.set(facei, new scalarField(neighbours.size() + 1)); - - faceWeights[facei][0] = 1.0/m; - - forAll(neighbours, nI) - { - faceWeights[facei][nI + 1] = - 1.0/ - ( - mag - ( - fromPatchFaceCentres[neighbours[nI]] - - curHit.hitPoint() - ) - + vSmall - ); - } - } - - faceWeights[facei] /= sum(faceWeights[facei]); - } - else - { - faceWeights.set(facei, new scalarField(0)); - } - } -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolate.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolate.C deleted file mode 100644 index c4393ff392..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolate.C +++ /dev/null @@ -1,170 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 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 . - -Description - Patch to patch interpolation functions - -\*---------------------------------------------------------------------------*/ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -template -tmp> -PatchToPatchInterpolation::pointInterpolate -( - const Field& pf -) const -{ - if (pf.size() != fromPatch_.nPoints()) - { - FatalErrorInFunction - << "given field does not correspond to patch. Patch size: " - << fromPatch_.nPoints() << " field size: " << pf.size() - << abort(FatalError); - } - - tmp> tresult - ( - new Field(toPatch_.nPoints(), Zero) - ); - - Field& result = tresult.ref(); - - const List& fromPatchLocalFaces = - fromPatch_.localFaces(); - - const FieldField& weights = pointWeights(); - - const labelList& addr = pointAddr(); - - forAll(result, pointi) - { - const scalarField& curWeights = weights[pointi]; - - if (addr[pointi] > -1) - { - const labelList& hitFacePoints = - fromPatchLocalFaces[addr[pointi]]; - - forAll(curWeights, wI) - { - result[pointi] += curWeights[wI]*pf[hitFacePoints[wI]]; - } - } - } - - return tresult; -} - - -template -template -tmp> -PatchToPatchInterpolation::pointInterpolate -( - const tmp>& tpf -) const -{ - tmp> tint = pointInterpolate(tpf()); - tpf.clear(); - return tint; -} - - -template -template -tmp> -PatchToPatchInterpolation::faceInterpolate -( - const Field& ff -) const -{ - if (ff.size() != fromPatch_.size()) - { - FatalErrorInFunction - << "given field does not correspond to patch. Patch size: " - << fromPatch_.size() << " field size: " << ff.size() - << abort(FatalError); - } - - tmp> tresult - ( - new Field(toPatch_.size(), Zero) - ); - - Field& result = tresult.ref(); - - const labelListList& fromPatchFaceFaces = fromPatch_.faceFaces(); - - const FieldField& weights = faceWeights(); - - const labelList& addr = faceAddr(); - - forAll(result, facei) - { - const scalarField& curWeights = weights[facei]; - - if (addr[facei] > -1) - { - const labelList& hitFaceFaces = - fromPatchFaceFaces[addr[facei]]; - - // first add the hit face - result[facei] += ff[addr[facei]]*curWeights[0]; - - for (label wI = 1; wI < curWeights.size(); wI++) - { - result[facei] += ff[hitFaceFaces[wI - 1]]*curWeights[wI]; - } - } - } - - return tresult; -} - - -template -template -tmp> -PatchToPatchInterpolation::faceInterpolate -( - const tmp>& tff -) const -{ - tmp> tint = faceInterpolate(tff()); - tff.clear(); - return tint; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C deleted file mode 100644 index 45896f4a96..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C +++ /dev/null @@ -1,187 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 "PatchToPatchInterpolation.H" -#include "demandDrivenData.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const scalar -PatchToPatchInterpolation::directHitTol = 1e-5; - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -const labelList& -PatchToPatchInterpolation::pointAddr() const -{ - if (!pointAddressingPtr_) - { - calcPointAddressing(); - } - - return *pointAddressingPtr_; -} - - -template -const FieldField& -PatchToPatchInterpolation::pointWeights() const -{ - if (!pointWeightsPtr_) - { - calcPointAddressing(); - } - - return *pointWeightsPtr_; -} - - -template -const labelList& -PatchToPatchInterpolation::faceAddr() const -{ - if (!faceAddressingPtr_) - { - calcFaceAddressing(); - } - - return *faceAddressingPtr_; -} - - -template -const FieldField& -PatchToPatchInterpolation::faceWeights() const -{ - if (!faceWeightsPtr_) - { - calcFaceAddressing(); - } - - return *faceWeightsPtr_; -} - - -template -void PatchToPatchInterpolation::clearOut() -{ - deleteDemandDrivenData(pointAddressingPtr_); - deleteDemandDrivenData(pointWeightsPtr_); - deleteDemandDrivenData(pointDistancePtr_); - deleteDemandDrivenData(faceAddressingPtr_); - deleteDemandDrivenData(faceWeightsPtr_); - deleteDemandDrivenData(faceDistancePtr_); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -PatchToPatchInterpolation::PatchToPatchInterpolation -( - const FromPatch& fromPatch, - const ToPatch& toPatch, - intersection::algorithm alg, - const intersection::direction dir -) -: - fromPatch_(fromPatch), - toPatch_(toPatch), - alg_(alg), - dir_(dir), - pointAddressingPtr_(nullptr), - pointWeightsPtr_(nullptr), - pointDistancePtr_(nullptr), - faceAddressingPtr_(nullptr), - faceWeightsPtr_(nullptr), - faceDistancePtr_(nullptr) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -PatchToPatchInterpolation::~PatchToPatchInterpolation() -{ - clearOut(); -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -const scalarField& -PatchToPatchInterpolation:: -pointDistanceToIntersection() const -{ - if (!pointDistancePtr_) - { - calcPointAddressing(); - } - - return *pointDistancePtr_; -} - - -template -const scalarField& -PatchToPatchInterpolation:: -faceDistanceToIntersection() const -{ - if (!faceDistancePtr_) - { - calcFaceAddressing(); - } - - return *faceDistancePtr_; -} - - -template -bool PatchToPatchInterpolation::movePoints() -{ - clearOut(); - - return true; -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "CalcPatchToPatchWeights.C" -#include "PatchToPatchInterpolate.C" - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.H b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.H deleted file mode 100644 index 66ecb2f7e5..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.H +++ /dev/null @@ -1,241 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 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 . - -Class - Foam::PatchToPatchInterpolation - -Description - Interpolation class dealing with transfer of data between two - primitivePatches - -SourceFiles - PatchToPatchInterpolation.C - PatchToPatchInterpolate.C - CalcPatchToPatchWeights.C - -\*---------------------------------------------------------------------------*/ - -#ifndef PatchToPatchInterpolation_H -#define PatchToPatchInterpolation_H - -#include "className.H" -#include "labelList.H" -#include "scalarField.H" -#include "pointField.H" -#include "FieldFields.H" -#include "faceList.H" -#include "intersection.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class PatchToPatchInterpolationName Declaration -\*---------------------------------------------------------------------------*/ - -TemplateName(PatchToPatchInterpolation); - - -/*---------------------------------------------------------------------------*\ - Class PatchToPatchInterpolation Declaration -\*---------------------------------------------------------------------------*/ - -template -class PatchToPatchInterpolation -: - public PatchToPatchInterpolationName -{ - // Private Data - - //- Reference to the source patch - const FromPatch& fromPatch_; - - //- Reference to the target patch - const ToPatch& toPatch_; - - //- Type of intersection algorithm to use in projection - intersection::algorithm alg_; - - //- Direction projection to use in projection - intersection::direction dir_; - - - // Static data - - //- Relative merge tolerance for projected points missing the target - // Expressed as the fraction of min involved edge size - static scalar projectionTol_; - - - // Point addressing - - //- Face into which each point of target patch is projected - mutable labelList* pointAddressingPtr_; - - //- Weighting factors - mutable FieldField* pointWeightsPtr_; - - //- Distance to intersection for patch points - mutable scalarField* pointDistancePtr_; - - // Face addressing - - //- Face into which each face centre of target patch is projected - mutable labelList* faceAddressingPtr_; - - //- Weighting factors - mutable FieldField* faceWeightsPtr_; - - //- Distance to intersection for patch face centres - mutable scalarField* faceDistancePtr_; - - - // Private Member Functions - - //- Calculate point weights - void calcPointAddressing() const; - - //- Calculate face weights - void calcFaceAddressing() const; - - //- Clear all geometry and addressing - void clearOut(); - - - //- Return reference to point addressing - const labelList& pointAddr() const; - - //- Return reference to point weights - const FieldField& pointWeights() const; - - //- Return reference to face addressing - const labelList& faceAddr() const; - - //- Return reference to face weights - const FieldField& faceWeights() const; - - - // Private static data members - - //- Direct hit tolerance - static const scalar directHitTol; - - -public: - - // Constructors - - //- Construct from components - PatchToPatchInterpolation - ( - const FromPatch& fromPatch, - const ToPatch& toPatch, - const intersection::algorithm alg = - intersection::algorithm::fullRay, - const intersection::direction dir = intersection::direction::vector - ); - - //- Disallow default bitwise copy construction - PatchToPatchInterpolation(const PatchToPatchInterpolation&) = delete; - - - //- Destructor - ~PatchToPatchInterpolation(); - - - // Member Functions - - //- Set the projection tolerance, returning the previous value - static scalar setProjectionTol(const scalar t) - { - if (t < -vSmall) - { - FatalErrorInFunction - << abort(FatalError); - } - - scalar oldTol = projectionTol_; - projectionTol_ = t; - - return oldTol; - } - - //- Return ype of intersection algorithm to use in projection - intersection::algorithm projectionAlgo() const - { - return alg_; - } - - //- Return direction projection to use in projection - intersection::direction projectionDir() const - { - return dir_; - } - - //- Return distance to intersection for patch points - const scalarField& pointDistanceToIntersection() const; - - //- Return distance to intersection for patch face centres - const scalarField& faceDistanceToIntersection() const; - - //- Correct weighting factors for moving mesh. - bool movePoints(); - - - //- Interpolate point field - template - tmp> pointInterpolate(const Field& pf) const; - - template - tmp> pointInterpolate(const tmp>& tpf) const; - - //- Interpolate face field - template - tmp> faceInterpolate(const Field& pf) const; - - template - tmp> faceInterpolate(const tmp>& tpf) const; - - - // Member Operators - - //- Disallow default bitwise assignment - void operator=(const PatchToPatchInterpolation&) = delete; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -#ifdef NoRepository - #include "PatchToPatchInterpolation.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C deleted file mode 100644 index 7022574b07..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolationName.C +++ /dev/null @@ -1,36 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 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 "PatchToPatchInterpolation.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -defineTypeNameAndDebug(PatchToPatchInterpolationName, 0); -} - - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/patchToPatchInterpolation.H b/src/OpenFOAM/interpolations/patchToPatchInterpolation/patchToPatchInterpolation.H deleted file mode 100644 index dfa2438ef0..0000000000 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/patchToPatchInterpolation.H +++ /dev/null @@ -1,46 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 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 . - -\*---------------------------------------------------------------------------*/ - -#ifndef patchToPatchInterpolation_H -#define patchToPatchInterpolation_H - -#include "PatchToPatchInterpolation.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef PatchToPatchInterpolation - < - PrimitivePatch, const pointField&>, - PrimitivePatch, const pointField&> - > patchToPatchInterpolation; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H b/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H deleted file mode 100644 index cf3f5bc57d..0000000000 --- a/src/OpenFOAM/interpolations/primitivePatchInterpolation/primitivePatchInterpolation.H +++ /dev/null @@ -1,56 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 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 . - -Typedef - Foam::primitivePatchInterpolation - -Description - Foam::primitivePatchInterpolation - -\*---------------------------------------------------------------------------*/ - -#ifndef primitivePatchInterpolation_H -#define primitivePatchInterpolation_H - -#include "PrimitivePatchInterpolation.H" -#include "PrimitivePatch.H" -#include "face.H" -#include "SubList.H" -#include "pointField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef PrimitivePatchInterpolation - < - PrimitivePatch, const pointField&> - > - primitivePatchInterpolation; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* //