ECOGEN 4.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
Coord.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef COORD_H
32#define COORD_H
33
34#include <cmath>
35#include <iostream>
36
37class Coord;
38#include "Tensor.h"
39
42class Coord
43{
44 public:
45 Coord();
50 Coord(const double& x, const double& y = 0., const double& z = 0.);
51 ~Coord();
52
55 static const Coord defaultCoord;
59
64 void setXYZ(const double& x, const double& y, const double& z);
67 void setX(const double& x);
70 void setY(const double& y);
73 void setZ(const double& z);
75 const double& getX() const { return m_x; }
77 const double& getY() const { return m_y; }
79 const double& getZ() const { return m_z; }
81 double norm() const;
83 double squaredNorm() const;
85 Coord abs() const;
86
89 double scalar(const Coord& a) const;
92 Coord scalar(const Tensor& t) const;
95 Coord cross(const Coord& a) const;
100 void localProjection(const Coord& normal, const Coord& tangent, const Coord& binormal);
105 void reverseProjection(const Coord& normal, const Coord& tangent, const Coord& binormal);
106
110 void setFromSubtractedVectors(const Coord& a, const Coord& b);
114 static double scalarProduct(const Coord& v1, const Coord& v2);
118 static Coord crossProduct(const Coord& v1, const Coord& v2);
120 void changeSign();
122 void normalized();
124 void printInfo() const;
125
130 static double determinant(const Coord& v1, const Coord& v2, const Coord& v3);
131
135 static double cos(const Coord& v1, const Coord& v2);
139 static Coord sin(const Coord& v1, const Coord& v2);
146 void buildRelativeVelForRiemannMRF(const Coord &omega, const Coord& normal, const Coord& tangent, const Coord& binormal, const Coord& position);
147
148 //Operator surcharges
149 Coord& operator=(const double& scalar);
150 Coord& operator+= (const double& scalar);
151 Coord& operator-= (const double& scalar);
152 Coord& operator*= (const double& scalar);
153 Coord& operator/= (const double& scalar);
154 Coord operator* (const double& scalar) const;
155 Coord operator/ (const double& scalar) const;
156 Coord& operator+= (const Coord& a);
157 Coord& operator-= (const Coord& a);
158
159 protected:
160 double m_x;
161 double m_y;
162 double m_z;
163};
164
165extern Coord coordBuff;
166extern Coord velocity;
167extern Coord vFaceToElt;
168
169//Extern operator surcharges of the class because they take two arguments
170Coord operator* (const double& scalar, const Coord& a);
171Coord operator+ (const Coord& a, const Coord& b);
172Coord operator- (const Coord& a, const Coord& b);
173
174#endif // COORD_H
Coord operator-(const Coord &a, const Coord &b)
Definition Coord.cpp:353
Coord velocity
Definition Coord.cpp:34
Coord vFaceToElt
Definition Coord.cpp:35
Coord operator+(const Coord &a, const Coord &b)
Definition Coord.cpp:344
Coord operator*(const double &scalar, const Coord &a)
Definition Coord.cpp:335
Coord coordBuff
Definition Coord.cpp:33
Class for a coordinate system object such as coordinates of the vertex or a vector.
Definition Coord.h:43
void changeSign()
Change the sign if the present vector.
Definition Coord.cpp:181
const double & getX() const
Return the value in the x-direction of the Coord object.
Definition Coord.h:75
double norm() const
Return the value of the norm of the Coord object.
Definition Coord.cpp:82
~Coord()
Definition Coord.cpp:49
const double & getY() const
Return the value in the y-direction of the Coord object.
Definition Coord.h:77
Coord & operator+=(const double &scalar)
Definition Coord.cpp:256
void printInfo() const
Print the information of the vector.
Definition Coord.cpp:239
void reverseProjection(const Coord &normal, const Coord &tangent, const Coord &binormal)
Reverse projection in the absolute Cartesian coordinate system.
Definition Coord.cpp:144
Coord abs() const
Return a Coord object with absolute values of each component.
Definition Coord.cpp:96
double m_y
Value in the x-direction.
Definition Coord.h:161
void setY(const double &y)
Set the value in the y-direction of the Coord object.
Definition Coord.cpp:74
void setX(const double &x)
Set the value in the x-direction of the Coord object.
Definition Coord.cpp:70
void setZ(const double &z)
Set the value in the z-direction of the Coord object.
Definition Coord.cpp:78
static Coord crossProduct(const Coord &v1, const Coord &v2)
Return the cross product bewteen two vectors.
Definition Coord.cpp:171
static Coord defaultCoordNonConst
Default Coord object (non-const version)
Definition Coord.h:58
Coord & operator/=(const double &scalar)
Definition Coord.cpp:286
Coord cross(const Coord &a) const
Cross product between the present vector and vector a.
Definition Coord.cpp:123
void localProjection(const Coord &normal, const Coord &tangent, const Coord &binormal)
Projection in the local coordinate system which is defined by the transmitted normal,...
Definition Coord.cpp:133
Coord & operator*=(const double &scalar)
Definition Coord.cpp:276
void setFromSubtractedVectors(const Coord &a, const Coord &b)
Set a vector from the result of the substraction of the vector a from the vector b.
Definition Coord.cpp:155
Coord operator*(const double &scalar) const
Definition Coord.cpp:296
static double cos(const Coord &v1, const Coord &v2)
Compute some sort of cosinus between two vectors.
Definition Coord.cpp:207
Coord & operator-=(const double &scalar)
Definition Coord.cpp:266
void normalized()
Divide the present vector by its norm.
Definition Coord.cpp:190
double m_z
Value in the y-direction.
Definition Coord.h:162
static double determinant(const Coord &v1, const Coord &v2, const Coord &v3)
Compute the determinant of the matrix formed by the vectors v1, v2 and v3.
Definition Coord.cpp:197
double scalar(const Coord &a) const
Scalar product between the present vector and vector a.
Definition Coord.cpp:106
void buildRelativeVelForRiemannMRF(const Coord &omega, const Coord &normal, const Coord &tangent, const Coord &binormal, const Coord &position)
Build relative velocity from absolute one (relevant with MRF only)
Definition Coord.cpp:227
static double scalarProduct(const Coord &v1, const Coord &v2)
Return the scalar product bewteen two vectors.
Definition Coord.cpp:164
const double & getZ() const
Return the value in the z-direction of the Coord object.
Definition Coord.h:79
static Coord sin(const Coord &v1, const Coord &v2)
Compute some sort of sinus between two vectors.
Definition Coord.cpp:217
Coord operator/(const double &scalar) const
Definition Coord.cpp:305
Coord()
Definition Coord.cpp:39
static const Coord defaultCoord
Default Coord object (const version)
Definition Coord.h:55
Coord & operator=(const double &scalar)
Definition Coord.cpp:246
double m_x
Definition Coord.h:160
void setXYZ(const double &x, const double &y, const double &z)
Set the values of the Coord object.
Definition Coord.cpp:61
double squaredNorm() const
Return the value of the squared norm of the Coord object.
Definition Coord.cpp:89
Class for a matrix 3x3 system object.
Definition Tensor.h:46