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 Foam_RectangularMatrix_H
43 #define Foam_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 public:
63 
64  // Generated Methods
65 
66  //- Default construct
67  RectangularMatrix() = default;
68 
69  //- Copy construct
70  RectangularMatrix(const RectangularMatrix&) = default;
71 
72  //- Copy assignment
74 
75 
76  // Constructors
77 
78  //- Construct a square matrix (rows == columns), uninitialised content
79  inline explicit RectangularMatrix(const label n);
80 
81  //- Construct given number of rows/columns
82  inline RectangularMatrix(const label m, const label n);
83 
84  //- Construct given number of rows/columns
85  //- initializing all elements to zero
86  inline RectangularMatrix
87  (
88  const label m,
89  const label n,
90  const Foam::zero
91  );
92 
93  //- Construct given number of rows/columns
94  //- initializing all elements to the given value
95  inline RectangularMatrix(const label m, const label n, const Type& val);
96 
97  //- Construct for given number of rows/columns
98  //- initializing all elements to zero, and diagonal to one
99  template<class AnyType>
100  inline RectangularMatrix
101  (
102  const labelPair& dims,
103  const Identity<AnyType>
104  );
105 
106  //- Construct given number of rows/columns by using a label pair
107  inline explicit RectangularMatrix(const labelPair& dims);
108 
109  //- Construct given number of rows/columns by using a label pair
110  //- and initializing all elements to zero
111  inline RectangularMatrix(const labelPair& dims, const Foam::zero);
112 
113  //- Construct given number of rows/columns by using a label pair
114  //- and initializing all elements to the given value
115  inline RectangularMatrix(const labelPair& dims, const Type& val);
116 
117  //- Construct from a block of another matrix
118  template<class MatrixType>
120 
121  //- Construct from a block of another matrix
122  template<class MatrixType>
123  inline RectangularMatrix(const MatrixBlock<MatrixType>& mat);
124 
125  //- Construct as copy of a square matrix
126  inline RectangularMatrix(const SquareMatrix<Type>& mat);
127 
128  //- Construct from Istream
129  inline explicit RectangularMatrix(Istream& is);
130 
131  //- Clone
132  inline autoPtr<RectangularMatrix<Type>> clone() const;
133 
134 
135  // Member Operators
136 
137  //- Move assignment
138  inline void operator=(RectangularMatrix<Type>&& mat);
139 
140  //- Assign all elements to zero
141  inline void operator=(const Foam::zero);
142 
143  //- Assign all elements to value
144  inline void operator=(const Type& val);
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #include "RectangularMatrixI.H"
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #endif
159 
160 // ************************************************************************* //
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:262
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:252
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.