RowVector.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 | Copyright (C) 2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::RowVector
26 
27 Description
28  Templated 3D row-vector derived from MatrixSpace adding construction from
29  3 components and element access using x(), y() and z().
30 
31 SourceFiles
32  RowVectorI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef RowVector_H
37 #define RowVector_H
38 
39 #include "MatrixSpace.H"
40 #include "Vector.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class RowVector Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Cmpt>
52 class RowVector
53 :
54  public MatrixSpace<RowVector<Cmpt>, Cmpt, 1, 3>
55 {
56 
57 public:
58 
59  //- Equivalent type of labels used for valid component indexing
61 
62 
63  //- Component labeling enumeration
64  enum components { X, Y, Z };
65 
66 
67  // Constructors
68 
69  //- Construct null
70  inline RowVector();
71 
72  //- Construct initialized to zero
73  inline RowVector(const Foam::zero);
74 
75  //- Construct given VectorSpace of the same rank
76  template<class Cmpt2>
77  inline RowVector(const MatrixSpace<RowVector<Cmpt2>, Cmpt2, 1, 3>&);
78 
79  //- Construct given three components
80  inline RowVector(const Cmpt& rvx, const Cmpt& rvy, const Cmpt& rvz);
81 
82  //- Construct from Istream
83  inline RowVector(Istream&);
84 
85 
86  // Member Functions
87 
88  // Access
89 
90  inline const Cmpt& x() const;
91  inline const Cmpt& y() const;
92  inline const Cmpt& z() const;
93 
94  inline Cmpt& x();
95  inline Cmpt& y();
96  inline Cmpt& z();
97 };
98 
99 
100 template<class Cmpt>
101 class typeOfTranspose<Cmpt, Vector<Cmpt>>
102 {
103 public:
105  typedef RowVector<Cmpt> type;
106 };
107 
108 
109 template<class Cmpt>
110 class typeOfTranspose<Cmpt, RowVector<Cmpt>>
111 {
112 public:
114  typedef Vector<Cmpt> type;
115 };
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace Foam
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 #include "RowVectorI.H"
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 #endif
129 
130 // ************************************************************************* //
RowVector< label > labelType
Equivalent type of labels used for valid component indexing.
Definition: RowVector.H:59
const Cmpt & x() const
Definition: RowVectorI.H:75
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const Cmpt & y() const
Definition: RowVectorI.H:81
Templated matrix space.
Definition: MatrixSpace.H:55
const Cmpt & z() const
Definition: RowVectorI.H:87
Abstract template class to provide the transpose form of a form.
Definition: products.H:58
Templated 3D Vector derived from VectorSpace adding construction from 3 components, element access using x(), y() and z() member functions and the inner-product (dot-product) and cross product operators.
Definition: Vector.H:57
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
RowVector()
Construct null.
Definition: RowVectorI.H:29
Templated 3D row-vector derived from MatrixSpace adding construction from 3 components and element ac...
Definition: RowVector.H:51
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
Namespace for OpenFOAM.
components
Component labeling enumeration.
Definition: RowVector.H:63