OOPS
Vector3D.cc
Go to the documentation of this file.
1
/*
2
* (C) Crown copyright 2020, Met Office
3
*
4
* This software is licensed under the terms of the Apache Licence Version 2.0
5
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6
*/
7
8
#include "
test/assimilation/Vector3D.h
"
9
10
namespace
test
{
11
12
Vector3D::Vector3D
(
const
double
& x,
13
const
double
& y,
14
const
double
& z)
15
: x_(x), y_(y), z_(z)
16
{}
17
18
Vector3D::Vector3D
(
const
Vector3D
& rhs,
19
const
bool
copy)
20
: x_(rhs.x_), y_(rhs.y_), z_(rhs.z_)
21
{
22
// NB the argument 'copy' is present in order to match the signature
23
// required by various minimiser functions.
24
}
25
26
Vector3D
&
Vector3D::operator=
(
const
Vector3D
& rhs)
27
{
28
this->
x_
= rhs.
x_
;
29
this->
y_
= rhs.
y_
;
30
this->
z_
= rhs.
z_
;
31
return
*
this
;
32
}
33
34
Vector3D
&
Vector3D::operator+=
(
const
Vector3D
& rhs)
35
{
36
this->
x_
+= rhs.
x_
;
37
this->
y_
+= rhs.
y_
;
38
this->
z_
+= rhs.
z_
;
39
return
*
this
;
40
}
41
42
Vector3D
&
Vector3D::operator-=
(
const
Vector3D
& rhs)
43
{
44
this->
x_
-= rhs.
x_
;
45
this->
y_
-= rhs.
y_
;
46
this->
z_
-= rhs.
z_
;
47
return
*
this
;
48
}
49
50
Vector3D
&
Vector3D::operator*=
(
const
double
mult)
51
{
52
this->
x_
*= mult;
53
this->
y_
*= mult;
54
this->
z_
*= mult;
55
return
*
this
;
56
}
57
58
Vector3D
&
Vector3D::operator*=
(
const
Vector3D
& rhs)
59
{
60
this->
x_
*= rhs.
x_
;
61
this->
y_
*= rhs.
y_
;
62
this->
z_
*= rhs.
z_
;
63
return
*
this
;
64
}
65
66
Vector3D
&
Vector3D::operator/=
(
const
Vector3D
& rhs)
67
{
68
this->
x_
/= rhs.
x_
;
69
this->
y_
/= rhs.
y_
;
70
this->
z_
/= rhs.
z_
;
71
return
*
this
;
72
}
73
74
void
Vector3D::axpy
(
const
double
mult,
const
Vector3D
& rhs)
75
{
76
this->
x_
+= mult * rhs.
x_
;
77
this->
y_
+= mult * rhs.
y_
;
78
this->
z_
+= mult * rhs.
z_
;
79
}
80
81
double
Vector3D::dot_product_with
(
const
Vector3D
& rhs)
const
82
{
83
return
this->
x_
* rhs.
x_
+ this->
y_
* rhs.
y_
+ this->
z_
* rhs.
z_
;
84
}
85
86
void
Vector3D::print
(std::ostream & os)
const
{
87
os <<
x_
<<
", "
<<
y_
<<
", "
<<
z_
<< std::endl;
88
}
89
}
// namespace test
test::Vector3D::operator-=
Vector3D & operator-=(const Vector3D &)
Definition:
Vector3D.cc:42
test::Vector3D::operator+=
Vector3D & operator+=(const Vector3D &)
Definition:
Vector3D.cc:34
test::Vector3D::operator/=
Vector3D & operator/=(const Vector3D &)
Definition:
Vector3D.cc:66
test::Vector3D::axpy
void axpy(const double, const Vector3D &)
x -> x + mult * rhs
Definition:
Vector3D.cc:74
test::Vector3D::dot_product_with
double dot_product_with(const Vector3D &) const
Definition:
Vector3D.cc:81
test::Vector3D::Vector3D
Vector3D(const double &x, const double &y, const double &z)
Definition:
Vector3D.cc:12
test::Vector3D
Definition:
Vector3D.h:15
test
Definition:
LinearModelFactory.cc:20
test::Vector3D::operator*=
Vector3D & operator*=(const double)
Definition:
Vector3D.cc:50
test::Vector3D::x_
double x_
Definition:
Vector3D.h:37
Vector3D.h
test::Vector3D::print
void print(std::ostream &os) const
Definition:
Vector3D.cc:86
test::Vector3D::y_
double y_
Definition:
Vector3D.h:38
test::Vector3D::z_
double z_
Definition:
Vector3D.h:39
test::Vector3D::operator=
Vector3D & operator=(const Vector3D &)
Definition:
Vector3D.cc:26
fv3-bundle
oops
src
test
assimilation
Vector3D.cc
Generated on Sun Oct 25 2020 12:42:59 for OOPS by
1.8.18