1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 Frank Bos, TU Delft. All rights reserved.
26 Dubravko Matijasevic, FSB Zagreb.
28 \*---------------------------------------------------------------------------*/
30 #include "RBFInterpolation.H"
31 #include "demandDrivenData.H"
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 const Foam::scalarSquareMatrix& Foam::RBFInterpolation::B() const
46 void Foam::RBFInterpolation::calcB() const
48 // Determine inverse of boundary connectivity matrix
56 // Fill Nb x Nb matrix
57 simpleMatrix<scalar> A(controlPoints_.size()+polySize);
59 const label nControlPoints = controlPoints_.size();
60 for (label i = 0; i < nControlPoints; i++)
62 scalarField weights = RBF_->weights(controlPoints_, controlPoints_[i]);
64 for (label col = 0; col < nControlPoints; col++)
66 A[i][col] = weights[col];
74 label row = nControlPoints;
75 row < nControlPoints + 1;
79 for (label col = 0; col < nControlPoints; col++)
86 // Fill in X components of polynomial part of matrix
89 label row = nControlPoints + 1;
90 row < nControlPoints + 2;
94 for (label col = 0; col < nControlPoints; col++)
96 A[col][row] = controlPoints_[col].x();
97 A[row][col] = controlPoints_[col].x();
101 // Fill in Y components of polynomial part of matrix
104 label row = nControlPoints + 2;
105 row < nControlPoints + 3;
109 for (label col = 0; col < nControlPoints; col++)
111 A[col][row] = controlPoints_[col].y();
112 A[row][col] = controlPoints_[col].y();
115 // Fill in Z components of polynomial part of matrix
118 label row = nControlPoints + 3;
119 row < nControlPoints + 4;
123 for (label col = 0; col < nControlPoints; col++)
125 A[col][row] = controlPoints_[col].z();
126 A[row][col] = controlPoints_[col].z();
130 // Fill 4x4 zero part of matrix
133 label row = nControlPoints;
134 row < nControlPoints + 4;
140 label col = nControlPoints;
141 col < nControlPoints + 4;
150 // HJ and FB (05 Jan 2009)
151 // Collect ALL control points from ALL CPUs
152 // Create an identical inverse for all CPUs
154 Info<< "Inverting RBF motion matrix" << endl;
156 BPtr_ = new scalarSquareMatrix(A.LUinvert());
160 void Foam::RBFInterpolation::clearOut()
162 deleteDemandDrivenData(BPtr_);
166 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
168 Foam::RBFInterpolation::RBFInterpolation
170 const dictionary& dict,
171 const vectorField& controlPoints,
172 const vectorField& dataPoints
175 controlPoints_(controlPoints),
176 dataPoints_(dataPoints),
177 RBF_(RBFFunction::New(word(dict.lookup("RBF")), dict)),
179 focalPoint_(dict.lookup("focalPoint")),
180 innerRadius_(readScalar(dict.lookup("innerRadius"))),
181 outerRadius_(readScalar(dict.lookup("outerRadius"))),
182 polynomials_(dict.lookup("polynomials"))
186 Foam::RBFInterpolation::RBFInterpolation
188 const RBFInterpolation& rbf
191 controlPoints_(rbf.controlPoints_),
192 dataPoints_(rbf.dataPoints_),
193 RBF_(rbf.RBF_->clone()),
195 focalPoint_(rbf.focalPoint_),
196 innerRadius_(rbf.innerRadius_),
197 outerRadius_(rbf.outerRadius_),
198 polynomials_(rbf.polynomials_)
202 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
204 Foam::RBFInterpolation::~RBFInterpolation()
210 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
212 void Foam::RBFInterpolation::movePoints()
218 // ************************************************************************* //