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-2022 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 (M x N) rectangular matrix of objects of <Type>,
32  containing M*N elements, derived from Matrix.
33 
34 See also
35  Test-RectangularMatrix.C
36 
37 SourceFiles
38  RectangularMatrixI.H
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef RectangularMatrix_H
43 #define RectangularMatrix_H
44 
45 #include "Matrix.H"
46 #include "SquareMatrix.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class RectangularMatrix Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Type>
59 :
60  public Matrix<RectangularMatrix<Type>, Type>
61 {
62 
63 public:
64 
65  // Generated Methods
66 
67  //- Default construct
68  RectangularMatrix() = default;
69 
70  //- Copy construct
71  RectangularMatrix(const RectangularMatrix&) = default;
72 
73  //- Copy assignment
75 
76 
77  // Constructors
78 
79  //- Construct a square matrix (rows == columns)
80  inline explicit RectangularMatrix(const label n);
81 
82  //- Construct given number of rows/columns
83  inline RectangularMatrix(const label m, const label n);
84 
85  //- Construct given number of rows/columns
86  //- initializing all elements to zero
87  inline RectangularMatrix
88  (
89  const label m,
90  const label n,
91  const Foam::zero
92  );
93 
94  //- Construct given number of rows/columns
95  //- initializing all elements to the given value
96  inline RectangularMatrix(const label m, const label n, const Type& val);
97 
98  //- Construct for given number of rows/columns
99  //- initializing all elements to zero, and diagonal to one
100  template<class AnyType>
101  inline RectangularMatrix
102  (
103  const labelPair& dims,
104  const Identity<AnyType>
105  );
106 
107  //- Construct given number of rows/columns by using a label pair
108  inline explicit RectangularMatrix(const labelPair& dims);
109 
110  //- Construct given number of rows/columns by using a label pair
111  //- and initializing all elements to zero
112  inline RectangularMatrix(const labelPair& dims, const Foam::zero);
113 
114  //- Construct given number of rows/columns by using a label pair
115  //- and initializing all elements to the given value
116  inline RectangularMatrix(const labelPair& dims, const Type& val);
117 
118  //- Construct from a block of another matrix
119  template<class MatrixType>
121 
122  //- Construct from a block of another matrix
123  template<class MatrixType>
124  inline RectangularMatrix(const MatrixBlock<MatrixType>& mat);
125 
126  //- Construct as copy of a square matrix
127  inline RectangularMatrix(const SquareMatrix<Type>& mat);
128 
129  //- Construct from Istream
130  inline explicit RectangularMatrix(Istream& is);
131 
132  //- Clone
133  inline autoPtr<RectangularMatrix<Type>> clone() const;
134 
135 
136  // Member Operators
137 
138  //- Move assignment
139  inline void operator=(RectangularMatrix<Type>&& mat);
140 
141  //- Assign all elements to zero
142  inline void operator=(const Foam::zero);
143 
144  //- Assign all elements to value
145  inline void operator=(const Type& val);
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #include "RectangularMatrixI.H"
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
RectangularMatrix & operator=(const RectangularMatrix &)=default
Copy assignment.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A templated block of an (m x n) matrix of type <MatrixType>.
Definition: Matrix.H:62
label n() const noexcept
The number of columns.
Definition: Matrix.H:258
RectangularMatrix()=default
Default construct.
A templated (M x N) rectangular matrix of objects of <Type>, containing M*N elements, derived from Matrix.
A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: ...
autoPtr< RectangularMatrix< Type > > clone() const
Clone.
label m() const noexcept
The number of rows.
Definition: Matrix.H:248
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:57
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Templated identity and dual space identity tensors derived from SphericalTensor.
Definition: Identity.H:43
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix...
Definition: SquareMatrix.H:59
Namespace for OpenFOAM.