SVDI.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
29
30template<class T>
31inline const T Foam::SVD::sign(const T& a, const T& b)
32{
33 //return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
34 return b >= 0 ? a : -a;
35}
36
37
38// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39
41{
42 return U_;
43}
44
45
47{
48 return V_;
49}
50
51
53{
54 return S_;
55}
56
57
58inline bool Foam::SVD::converged() const
59{
60 return converged_;
61}
62
63
64inline Foam::label Foam::SVD::nZeros() const
65{
66 return nZeros_;
67}
68
69
70inline Foam::scalar Foam::SVD::minNonZeroS() const
71{
72 scalar minS = S_[0];
73 for (label i=1; i<S_.size(); i++)
74 {
75 scalar s = S_[i];
76 if (s > VSMALL && s < minS) minS = s;
77 }
78 return minS;
79}
80
81
82// ************************************************************************* //
const scalarRectangularMatrix & V() const
Return the square matrix V.
Definition: SVDI.H:46
const scalarRectangularMatrix & U() const
Return U.
Definition: SVDI.H:40
scalar minNonZeroS() const
Return the minimum non-zero singular value.
Definition: SVDI.H:70
label nZeros() const
Return the number of zero singular values.
Definition: SVDI.H:64
bool converged() const
Return the minimum non-zero singular value.
Definition: SVDI.H:58
const scalarDiagonalMatrix & S() const
Return the singular values.
Definition: SVDI.H:52
friend complex sign(const complex &c)
sgn() https://en.wikipedia.org/wiki/Sign_function#Complex_signum
Definition: complexI.H:228
const volScalarField & T
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
volScalarField & b
Definition: createFields.H:27