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-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 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(const label m, const label n, const zero);
88 
89  //- Construct given number of rows/columns
90  //- initializing all elements to the given value
91  inline RectangularMatrix(const label m, const label n, const Type& val);
92 
93  //- Construct for given number of rows/columns
94  //- initializing all elements to zero, and diagonal to one
95  template<class AnyType>
96  inline RectangularMatrix(const labelPair& dims, const Identity<AnyType>);
97 
98  //- Construct given number of rows/columns by using a label pair
99  inline explicit RectangularMatrix(const labelPair& dims);
100 
101  //- Construct given number of rows/columns by using a label pair
102  //- and initializing all elements to zero
103  inline RectangularMatrix(const labelPair& dims, const zero);
104 
105  //- Construct given number of rows/columns by using a label pair
106  //- and initializing all elements to the given value
107  inline RectangularMatrix(const labelPair& dims, const Type& val);
108 
109  //- Construct from a block of another matrix
110  template<class MatrixType>
112 
113  //- Construct from a block of another matrix
114  template<class MatrixType>
115  inline RectangularMatrix(const MatrixBlock<MatrixType>& mat);
116 
117  //- Construct as copy of a square matrix
118  inline RectangularMatrix(const SquareMatrix<Type>& mat);
119 
120  //- Construct from Istream
121  inline explicit RectangularMatrix(Istream& is);
122 
123  //- Clone
124  inline autoPtr<RectangularMatrix<Type>> clone() const;
125 
126 
127  // Member Operators
128 
129  //- Assign all elements to zero
130  inline void operator=(const zero);
131 
132  //- Assign all elements to value
133  inline void operator=(const Type& val);
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace Foam
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 #include "RectangularMatrixI.H"
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 #endif
148 
149 // ************************************************************************* //
Foam::Matrix< RectangularMatrix< Type >, Type >::n
label n() const noexcept
The number of columns.
Definition: MatrixI.H:102
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:53
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::RectangularMatrix::operator=
RectangularMatrix & operator=(const RectangularMatrix &)=default
Copy assignment.
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.
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 (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Definition: SquareMatrix.H:63
Foam::Matrix< RectangularMatrix< Type >, Type >::m
label m() const noexcept
The number of rows.
Definition: MatrixI.H:95
Foam::Pair< label >
Foam::RectangularMatrix::clone
autoPtr< RectangularMatrix< Type > > clone() const
Clone.
Definition: RectangularMatrixI.H:166
Foam::ConstMatrixBlock
Definition: Matrix.H:65
SquareMatrix.H
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62