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