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
VectorSpace
VectorSpace.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::VectorSpace
26
27
Description
28
Templated vector space.
29
30
Template arguments are the Form the vector space will be used to create,
31
the type of the elements and the number of elements.
32
33
SourceFiles
34
VectorSpaceI.H
35
VectorSpace.C
36
37
\*---------------------------------------------------------------------------*/
38
39
#ifndef VectorSpace_H
40
#define VectorSpace_H
41
42
#include <
OpenFOAM/direction.H
>
43
#include <
OpenFOAM/scalar.H
>
44
#include <
OpenFOAM/word.H
>
45
46
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48
namespace
Foam
49
{
50
51
// Forward declaration of friend functions and operators
52
53
template
<
class
Form,
class
Cmpt,
int
nCmpt>
class
VectorSpace;
54
55
template
<
class
Form,
class
Cmpt,
int
nCmpt>
56
Istream&
operator
>>
57
(
58
Istream&,
59
VectorSpace<Form, Cmpt, nCmpt>&
60
);
61
62
template
<
class
Form,
class
Cmpt,
int
nCmpt>
63
Ostream&
operator
<<
64
(
65
Ostream&,
66
const
VectorSpace<Form, Cmpt, nCmpt>&
67
);
68
69
70
/*---------------------------------------------------------------------------*\
71
Class VectorSpace Declaration
72
\*---------------------------------------------------------------------------*/
73
74
template
<
class
Form,
class
Cmpt,
int
nCmpt>
75
class
VectorSpace
76
{
77
78
public
:
79
80
//- Component type
81
typedef
Cmpt
cmptType
;
82
83
84
// Member constants
85
86
enum
87
{
88
dim
= 3,
// Dimensionality of space
89
nComponents
= nCmpt
// Number of components in this vector space
90
};
91
92
93
// Static data members
94
95
//- The components of this vector space
96
Cmpt
v_
[nCmpt];
97
98
99
// Constructors
100
101
//- Construct null
102
inline
VectorSpace
();
103
104
//- Construct from Istream
105
VectorSpace
(
Istream
&);
106
107
//- Construct as copy
108
inline
VectorSpace
(
const
VectorSpace<Form, Cmpt, nCmpt>
&);
109
110
111
// Member Functions
112
113
//- Return the number of elements in the VectorSpace = nCmpt.
114
inline
label
size
()
const
;
115
116
inline
const
Cmpt&
component
(
const
direction
)
const
;
117
inline
Cmpt&
component
(
const
direction
);
118
119
inline
void
component
(Cmpt&,
const
direction
)
const
;
120
inline
void
replace
(
const
direction
,
const
Cmpt&);
121
122
123
// Member Operators
124
125
inline
const
Cmpt&
operator[]
(
const
direction
)
const
;
126
inline
Cmpt&
operator[]
(
const
direction
);
127
128
inline
void
operator=
(
const
VectorSpace<Form, Cmpt, nCmpt>
&);
129
inline
void
operator+=
(
const
VectorSpace<Form, Cmpt, nCmpt>
&);
130
inline
void
operator-=
(
const
VectorSpace<Form, Cmpt, nCmpt>
&);
131
132
inline
void
operator*=
(
const
scalar);
133
inline
void
operator/=
(
const
scalar);
134
135
136
// IOstream Operators
137
138
friend
Istream
&
operator
>> <Form, Cmpt, nCmpt>
139
(
140
Istream
&,
141
VectorSpace<Form, Cmpt, nCmpt>
&
142
);
143
144
friend
Ostream
& operator<< <Form, Cmpt, nCmpt>
145
(
146
Ostream
&,
147
const
VectorSpace<Form, Cmpt, nCmpt>
&
148
);
149
};
150
151
152
// * * * * * * * * * * * * * * Global functions * * * * * * * * * * * * * * //
153
154
//- Return a string representation of a VectorSpace
155
template
<
class
Form,
class
Cmpt,
int
nCmpt>
156
word
name
(
const
VectorSpace<Form, Cmpt, nCmpt>
&);
157
158
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160
}
// End namespace Foam
161
162
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164
#include <
OpenFOAM/VectorSpaceI.H
>
165
166
#ifdef NoRepository
167
# include <
OpenFOAM/VectorSpace.C
>
168
#endif
169
170
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172
#endif
173
174
// ************************ vim: set sw=4 sts=4 et: ************************ //