Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
primitives
Vector
Vector_.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) 1991-2010 OpenCFD Ltd.
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::Vector
26
27
Description
28
Templated 3D Vector derived from VectorSpace adding construction from
29
3 components, element access using x(), y() and z() member functions and
30
the inner-product (dot-product) and cross product operators.
31
32
A centre() member function which returns the Vector for which it is called
33
is defined so that point which is a typedef to Vector<scalar> behaves as
34
other shapes in the shape hierachy.
35
36
SourceFiles
37
VectorI.H
38
39
\*---------------------------------------------------------------------------*/
40
41
#ifndef Vector_H
42
#define Vector_H
43
44
#include <
OpenFOAM/VectorSpace.H
>
45
46
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48
namespace
Foam
49
{
50
51
template
<
class
T>
class
List;
52
53
/*---------------------------------------------------------------------------*\
54
Class Vector Declaration
55
\*---------------------------------------------------------------------------*/
56
57
template
<
class
Cmpt>
58
class
Vector
59
:
60
public
VectorSpace
<Vector<Cmpt>, Cmpt, 3>
61
{
62
63
public
:
64
65
//- Equivalent type of labels used for valid component indexing
66
typedef
Vector<label>
labelType
;
67
68
69
// Member constants
70
71
enum
72
{
73
rank
= 1
// Rank of Vector is 1
74
};
75
76
77
// Static data members
78
79
static
const
char
*
const
typeName
;
80
static
const
char
*
componentNames
[];
81
static
const
Vector
zero
;
82
static
const
Vector
one
;
83
static
const
Vector
max
;
84
static
const
Vector
min
;
85
86
87
//- Component labeling enumeration
88
enum
components
{
X
,
Y
,
Z
};
89
90
91
// Constructors
92
93
//- Construct null
94
inline
Vector
();
95
96
//- Construct given VectorSpace
97
inline
Vector
(
const
VectorSpace
<
Vector<Cmpt>
, Cmpt, 3>&);
98
99
//- Construct given three components
100
inline
Vector
(
const
Cmpt& vx,
const
Cmpt& vy,
const
Cmpt& vz);
101
102
//- Construct from Istream
103
inline
Vector
(
Istream
&);
104
105
106
// Member Functions
107
108
// Access
109
110
inline
const
Cmpt&
x
()
const
;
111
inline
const
Cmpt&
y
()
const
;
112
inline
const
Cmpt&
z
()
const
;
113
114
inline
Cmpt&
x
();
115
inline
Cmpt&
y
();
116
inline
Cmpt&
z
();
117
118
//- Return *this (used for point which is a typedef to Vector<scalar>.
119
inline
const
Vector<Cmpt>
&
centre
120
(
121
const
Foam::List
<
Vector<Cmpt>
>&
122
)
const
;
123
};
124
125
126
template
<
class
Cmpt>
127
class
typeOfRank
<Cmpt, 1>
128
{
129
public
:
130
131
typedef
Vector<Cmpt>
type
;
132
};
133
134
135
template
<
class
Cmpt>
136
class
symmTypeOfRank
<Cmpt, 1>
137
{
138
public
:
139
140
typedef
Vector<Cmpt>
type
;
141
};
142
143
144
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145
146
}
// End namespace Foam
147
148
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149
150
#include "
VectorI_.H
"
151
152
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153
154
#endif
155
156
// ************************ vim: set sw=4 sts=4 et: ************************ //