Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::RectangularMatrix
29
30Description
31 A templated (M x N) rectangular matrix of objects of <Type>,
32 containing M*N elements, derived from Matrix.
33
34See also
35 Test-RectangularMatrix.C
36
37SourceFiles
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
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class RectangularMatrix Declaration
55\*---------------------------------------------------------------------------*/
56
57template<class Type>
59:
60 public Matrix<RectangularMatrix<Type>, Type>
61{
62public:
63
64 // Generated Methods
65
66 //- Default construct
67 RectangularMatrix() = default;
68
69 //- Copy construct
70 RectangularMatrix(const RectangularMatrix&) = default;
71
72 //- Copy assignment
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
87 (
88 const label m,
89 const label n,
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,
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
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>
121 //- Construct from a block of another matrix
122 template<class MatrixType>
124
125 //- Construct as copy of a square matrix
127
128 //- Construct from Istream
129 inline explicit RectangularMatrix(Istream& is);
130
131 //- Clone
133
134
135 // Member Operators
136
137 //- Move assignment
139
140 //- Assign all elements to zero
141 inline void operator=(Foam::zero);
142
143 //- Assign all elements to value
144 inline void operator=(const Type& val);
145};
146
147
148// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150} // End namespace Foam
151
152// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158#endif
160// ************************************************************************* //
Templated identity and dual space identity tensors derived from SphericalTensor.
Definition Identity.H:46
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A templated block of an (m x n) matrix of type <MatrixType>.
label m() const noexcept
The number of rows.
Definition Matrix.H:261
label n() const noexcept
The number of columns.
Definition Matrix.H:271
void operator=(Foam::zero)
Assign all elements to zero.
RectangularMatrix & operator=(const RectangularMatrix &)=default
Copy assignment.
RectangularMatrix(const RectangularMatrix &)=default
Copy construct.
RectangularMatrix(const label n)
Construct a square matrix (rows == columns), uninitialised content.
RectangularMatrix(const ConstMatrixBlock< MatrixType > &mat)
Construct from a block of another matrix.
RectangularMatrix(const MatrixBlock< MatrixType > &mat)
Construct from a block of another matrix.
RectangularMatrix(const SquareMatrix< Type > &mat)
Construct as copy of a square matrix.
void operator=(RectangularMatrix< Type > &&mat)
Move assignment.
RectangularMatrix(const label m, const label n, const Type &val)
Construct given number of rows/columns initializing all elements to the given value.
RectangularMatrix(const labelPair &dims, const Identity< AnyType >)
Construct for given number of rows/columns initializing all elements to zero, and diagonal to one.
RectangularMatrix(Istream &is)
Construct from Istream.
RectangularMatrix(const labelPair &dims, const Type &val)
Construct given number of rows/columns by using a label pair and initializing all elements to the giv...
void operator=(const Type &val)
Assign all elements to value.
autoPtr< RectangularMatrix< Type > > clone() const
Clone.
RectangularMatrix(const labelPair &dims)
Construct given number of rows/columns by using a label pair.
RectangularMatrix(const labelPair &dims, Foam::zero)
Construct given number of rows/columns by using a label pair and initializing all elements to zero.
RectangularMatrix()=default
Default construct.
RectangularMatrix(const label m, const label n)
Construct given number of rows/columns.
RectangularMatrix(const label m, const label n, Foam::zero)
Construct given number of rows/columns initializing all elements to zero.
A templated (N x N) square matrix of objects of <Type>, containing N*N elements, derived from Matrix.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition zero.H:58
Namespace for OpenFOAM.
Pair< label > labelPair
A pair of labels.
Definition Pair.H:54