RectangularMatrix.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 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 Class
28  Foam::RectangularMatrix
29 
30 Description
31  A templated 2D rectangular m x n matrix of objects of <Type>.
32 
33  The matrix dimensions are used for subscript bounds checking etc.
34 
35 SourceFiles
36  RectangularMatrixI.H
37  RectangularMatrix.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef RectangularMatrix_H
42 #define RectangularMatrix_H
43 
44 #include "Matrix.H"
45 #include "SquareMatrix.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class RectangularMatrix Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type>
58 :
59  public Matrix<RectangularMatrix<Type>, Type>
60 {
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct null
67  inline RectangularMatrix();
68 
69  //- Construct a square matrix (rows == columns)
70  inline explicit RectangularMatrix(const label n);
71 
72  //- Construct given number of rows/columns
73  inline RectangularMatrix(const label m, const label n);
74 
75  //- Construct given number of rows/columns
76  //- initializing all elements to zero
77  inline RectangularMatrix(const label m, const label n, const zero);
78 
79  //- Construct given number of rows/columns
80  //- initializing all elements to the given value
81  inline RectangularMatrix(const label m, const label n, const Type& val);
82 
83  //- Construct for given number of rows/columns
84  //- initializing all elements to zero, and diagonal to one
85  template<class AnyType>
86  inline RectangularMatrix(const labelPair& dims, const Identity<AnyType>);
87 
88  //- Construct given number of rows/columns
89  inline explicit RectangularMatrix(const labelPair& dims);
90 
91  //- Construct given number of rows/columns
92  //- initializing all elements to zero
93  inline RectangularMatrix(const labelPair& dims, const zero);
94 
95  //- Construct given number of rows/columns
96  //- initializing all elements to the given value
97  inline RectangularMatrix(const labelPair& dims, const Type& val);
98 
99  //- Construct from a block of another matrix
100  template<class MatrixType>
102 
103  //- Construct from a block of another matrix
104  template<class MatrixType>
105  inline RectangularMatrix(const MatrixBlock<MatrixType>& mat);
106 
107  //- Construct as copy of a square matrix
108  inline RectangularMatrix(const SquareMatrix<Type>& mat);
109 
110  //- Construct from Istream.
111  inline explicit RectangularMatrix(Istream& is);
112 
113  //- Clone
114  inline autoPtr<RectangularMatrix<Type>> clone() const;
115 
116 
117  // Member Operators
118 
119  //- Assign all elements to zero
120  inline void operator=(const zero);
121 
122  //- Assign all elements to value
123  inline void operator=(const Type& val);
124 };
125 
126 
127 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
128 
129 template<class Type>
131 {
132 public:
133 
135 };
136 
137 
138 template<class Type>
139 class typeOfInnerProduct<Type, RectangularMatrix<Type>, SquareMatrix<Type>>
140 {
141 public:
142 
144 };
145 
146 
147 template<class Type>
148 class typeOfInnerProduct<Type, SquareMatrix<Type>, RectangularMatrix<Type>>
149 {
150 public:
151 
153 };
154 
155 
156 // * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
157 
158 template<class Type>
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #include "RectangularMatrixI.H"
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Foam::val
label ListType::const_reference val
Definition: ListOps.H:407
Matrix.H
Foam::Matrix
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:
Definition: DiagonalMatrix.H:48
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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: RectangularMatrix.H:133
Foam::typeOfInnerProduct< Type, SquareMatrix< Type >, RectangularMatrix< Type > >::type
RectangularMatrix< Type > type
Definition: RectangularMatrix.H:151
Foam::RectangularMatrix
A templated 2D rectangular m x n matrix of objects of <Type>.
Definition: RectangularMatrix.H:56
Foam::Matrix< RectangularMatrix< Type >, Type >::n
label n() const noexcept
The number of columns.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
RectangularMatrixI.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::SquareMatrix
A templated 2D square matrix of objects of <T>, where the n x n matrix dimension is known and used fo...
Definition: SquareMatrix.H:59
Foam::Matrix< RectangularMatrix< Type >, Type >::m
label m() const noexcept
The number of rows.
Definition: MatrixI.H:95
Foam::Pair
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:54
Foam::RectangularMatrix::operator=
void operator=(const zero)
Assign all elements to zero.
Definition: RectangularMatrixI.H:182
Foam::typeOfInnerProduct
Definition: products.H:51
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
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:173
Foam::ConstMatrixBlock
Definition: Matrix.H:65
SquareMatrix.H
Foam::RectangularMatrix::RectangularMatrix
RectangularMatrix()
Construct null.
Definition: RectangularMatrixI.H:32
Foam::typeOfInnerProduct< Type, RectangularMatrix< Type >, SquareMatrix< Type > >::type
RectangularMatrix< Type > type
Definition: RectangularMatrix.H:142
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61