RectangularMatrixI.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  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 template<class Type>
33 (
34  const label m,
35  const label n
36 )
37 :
39 {}
40 
41 
42 template<class Type>
44 (
45  const label n
46 )
47 :
49 {}
50 
51 
52 template<class Type>
54 (
55  const label m,
56  const label n,
57  const Foam::zero
58 )
59 :
61 {}
62 
63 
64 template<class Type>
66 (
67  const label m,
68  const label n,
69  const Type& val
70 )
71 :
72  Matrix<RectangularMatrix<Type>, Type>(m, n, val)
73 {}
74 
75 
76 template<class Type>
77 template<class AnyType>
79 (
80  const labelPair& dims,
81  const Identity<AnyType>
82 )
83 :
84  Matrix<RectangularMatrix<Type>, Type>(dims.first(), dims.second(), Zero)
85 {
86  for (label i = 0; i < min(dims.first(), dims.second()); ++i)
87  {
88  this->operator()(i, i) = pTraits<Type>::one;
89  }
90 }
91 
92 
93 template<class Type>
95 (
96  const labelPair& dims
97 )
98 :
99  RectangularMatrix<Type>(dims.first(), dims.second())
100 {}
101 
102 
103 template<class Type>
105 (
106  const labelPair& dims,
107  const Foam::zero
108 )
109 :
110  RectangularMatrix<Type>(dims.first(), dims.second(), Zero)
111 {}
112 
113 
114 template<class Type>
116 (
117  const labelPair& dims,
118  const Type& val
119 )
120 :
121  RectangularMatrix<Type>(dims.first(), dims.second(), val)
122 {}
123 
124 
125 template<class Type>
126 template<class MatrixType>
128 (
130 )
131 :
133 {}
134 
135 
136 template<class Type>
137 template<class MatrixType>
139 (
140  const MatrixBlock<MatrixType>& mat
141 )
142 :
144 {}
145 
146 
147 template<class Type>
149 (
150  const SquareMatrix<Type>& mat
151 )
152 :
154 {}
155 
156 
157 template<class Type>
159 :
160  Matrix<RectangularMatrix<Type>, Type>(is)
161 {}
162 
163 
164 template<class Type>
167 {
169 }
170 
171 
172 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
173 
174 template<class Type>
176 {
177  Matrix<RectangularMatrix<Type>, Type>::operator=(Zero);
178 }
179 
180 
181 template<class Type>
182 inline void Foam::RectangularMatrix<Type>::operator=(const Type& val)
183 {
184  Matrix<RectangularMatrix<Type>, Type>::operator=(val);
185 }
186 
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 namespace Foam
191 {
192 
193 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
194 
195 template<class Type>
197 {
198 public:
199 
201 };
202 
203 
204 template<class Type>
206 {
207 public:
208 
210 };
211 
212 
213 template<class Type>
215 {
216 public:
217 
219 };
220 
221 
222 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
223 
224 // Return the outer product of Field-Field as RectangularMatrix
225 template<class Type>
227 (
228  const Field<Type>& f1,
229  const Field<Type>& f2
230 )
231 {
232  RectangularMatrix<Type> f1f2T(f1.size(), f2.size());
233 
234  for (label i = 0; i < f1f2T.m(); ++i)
235  {
236  for (label j = 0; j < f1f2T.n(); ++j)
237  {
238  f1f2T(i, j) = f1[i]*f2[j];
239  }
240  }
241 
242  return f1f2T;
243 }
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // ************************************************************************* //
Foam::Pair::second
const T & second() const noexcept
Return second element, which is also the last element.
Definition: PairI.H:122
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::min
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:33
Foam::Matrix
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
Definition: DiagonalMatrix.H:53
n
label n
Definition: TABSMDCalcMethod2.H:31
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::Identity
Templated identity and dual space identity tensors derived from SphericalTensor.
Definition: Identity.H:49
Foam::MatrixBlock
A templated block of an (m x n) matrix of type <MatrixType>.
Definition: Matrix.H:66
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::typeOfInnerProduct< Type, RectangularMatrix< Type >, RectangularMatrix< Type > >::type
RectangularMatrix< Type > type
Definition: RectangularMatrixI.H:200
Foam::RectangularMatrix::operator=
RectangularMatrix & operator=(const RectangularMatrix &)=default
Copy assignment.
Foam::typeOfInnerProduct< Type, SquareMatrix< Type >, RectangularMatrix< Type > >::type
RectangularMatrix< Type > type
Definition: RectangularMatrixI.H:218
Foam::RectangularMatrix
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements,...
Definition: RectangularMatrix.H:57
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::RectangularMatrix::RectangularMatrix
RectangularMatrix()=default
Default construct.
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SquareMatrix
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SquareMatrix.H:63
Foam::Pair< label >
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::typeOfInnerProduct
Definition: products.H:51
Foam::outer
void outer(FieldField< Field1, typename outerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:942
Foam::RectangularMatrix::clone
autoPtr< RectangularMatrix< Type > > clone() const
Clone.
Definition: RectangularMatrixI.H:166
Foam::ConstMatrixBlock
Definition: Matrix.H:65
Foam::typeOfInnerProduct< Type, RectangularMatrix< Type >, SquareMatrix< Type > >::type
RectangularMatrix< Type > type
Definition: RectangularMatrixI.H:209
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62