https://mooseframework.inl.gov
Loading...
Searching...
No Matches
EFAPoint.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "EFAPoint.h"
11#include <cmath>
12#include "EFAError.h"
13
14EFAPoint::EFAPoint(const double x, const double y, const double z) : _x(x), _y(y), _z(z) {}
15
16double
17EFAPoint::operator()(const unsigned int i) const
18{
19 switch (i)
20 {
21 case 0:
22 return _x;
23 case 1:
24 return _y;
25 case 2:
26 return _z;
27 default:
28 EFAError("EFAPoint: Out of index range.");
29 }
30}
31
34{
35 _x /= a;
36 _y /= a;
37 _z /= a;
38 return *this;
39}
40
43{
44 _x *= a;
45 _y *= a;
46 _z *= a;
47 return *this;
48}
49
52{
53 _x += point._x;
54 _y += point._y;
55 _z += point._z;
56 return *this;
57}
58
61{
62 return EFAPoint(this->_x * a, this->_y * a, this->_z * a);
63}
64
65double
67{
68 return this->_x * point._x + this->_y * point._y + this->_z * point._z;
69}
70
73{
74 return EFAPoint(this->_x + point._x, this->_y + point._y, this->_z + point._z);
75}
76
79{
80 return EFAPoint(this->_x - point._x, this->_y - point._y, this->_z - point._z);
81}
82
83double
85{
86 return std::sqrt(_x * _x + _y * _y + _z * _z);
87}
88
89void
91{
92 _x = 0.0;
93 _y = 0.0;
94 _z = 0.0;
95}
96
99{
100 double x = this->_y * point._z - this->_z * point._y;
101 double y = this->_z * point._x - this->_x * point._z;
102 double z = this->_x * point._y - this->_y * point._x;
103 return EFAPoint(x, y, z);
104}
const std::vector< double > y
const std::vector< double > x
EFAPoint & operator/=(const double a)
Definition EFAPoint.C:33
EFAPoint operator+(const EFAPoint &point)
Definition EFAPoint.C:72
double operator()(const unsigned int i) const
Definition EFAPoint.C:17
EFAPoint & operator*=(const double a)
Definition EFAPoint.C:42
EFAPoint(const double x=0., const double y=0., const double z=0.)
Definition EFAPoint.C:14
double _x
Definition EFAPoint.h:18
EFAPoint cross(const EFAPoint &point)
Definition EFAPoint.C:98
double norm()
Definition EFAPoint.C:84
double _z
Definition EFAPoint.h:20
EFAPoint & operator+=(const EFAPoint &point)
Definition EFAPoint.C:51
double _y
Definition EFAPoint.h:19
EFAPoint operator*(const double a)
Definition EFAPoint.C:60
EFAPoint operator-(const EFAPoint &point)
Definition EFAPoint.C:78
void zero()
Definition EFAPoint.C:90