1 | #ifndef SINGLEVECTOR_HPP_
|
---|
2 | #define SINGLEVECTOR_HPP_
|
---|
3 |
|
---|
4 | using namespace std;
|
---|
5 |
|
---|
6 | /*********************************************** includes ***********************************/
|
---|
7 |
|
---|
8 | // include config.h
|
---|
9 | #ifdef HAVE_CONFIG_H
|
---|
10 | #include <config.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #include <iostream>
|
---|
14 | #include <gsl/gsl_vector.h>
|
---|
15 | #include <gsl/gsl_multimin.h>
|
---|
16 | #include "vector.hpp"
|
---|
17 |
|
---|
18 | #include "defs.hpp"
|
---|
19 |
|
---|
20 | /********************************************** declarations *******************************/
|
---|
21 |
|
---|
22 | /** Single vector.
|
---|
23 | * basically, just a x[3] but with helpful functions
|
---|
24 | */
|
---|
25 | class SingleVector : public Vector {
|
---|
26 | public:
|
---|
27 |
|
---|
28 | SingleVector();
|
---|
29 | SingleVector(const double x1, const double x2, const double x3);
|
---|
30 | SingleVector(const Vector& src);
|
---|
31 | virtual ~SingleVector();
|
---|
32 |
|
---|
33 | virtual double DistanceSquared(const Vector &y) const;
|
---|
34 | virtual double DistanceToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const;
|
---|
35 | virtual double PeriodicDistance(const Vector &y, const double * const cell_size) const;
|
---|
36 | virtual double PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const;
|
---|
37 | virtual double ScalarProduct(const Vector &y) const;
|
---|
38 | virtual double Angle(const Vector &y) const;
|
---|
39 | virtual bool IsZero() const;
|
---|
40 | virtual bool IsOne() const;
|
---|
41 | virtual bool IsNormalTo(const Vector &normal) const;
|
---|
42 | virtual bool IsEqualTo(const Vector &a) const;
|
---|
43 |
|
---|
44 | virtual void AddVector(const Vector &y);
|
---|
45 | virtual void SubtractVector(const Vector &y);
|
---|
46 | virtual void VectorProduct(const Vector &y);
|
---|
47 | virtual void ProjectOntoPlane(const Vector &y);
|
---|
48 | virtual void ProjectIt(const Vector &y);
|
---|
49 | virtual Vector Projection(const Vector &y) const;
|
---|
50 | virtual void Mirror(const Vector &x);
|
---|
51 | virtual void ScaleAll(const double *factor);
|
---|
52 | virtual void Scale(const double factor);
|
---|
53 | virtual void MatrixMultiplication(const double * const M);
|
---|
54 | virtual bool InverseMatrixMultiplication(const double * const M);
|
---|
55 | virtual void KeepPeriodic(const double * const matrix);
|
---|
56 | virtual bool GetOneNormalVector(const Vector &x1);
|
---|
57 | virtual bool MakeNormalTo(const Vector &y1);
|
---|
58 | virtual bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const;
|
---|
59 | virtual void WrapPeriodically(const double * const M, const double * const Minv);
|
---|
60 |
|
---|
61 | // Accessors ussually come in pairs... and sometimes even more than that
|
---|
62 | virtual double& operator[](size_t i);
|
---|
63 | virtual const double& operator[](size_t i) const;
|
---|
64 |
|
---|
65 | // Access to internal structure
|
---|
66 | virtual double* get();
|
---|
67 | protected:
|
---|
68 |
|
---|
69 | private:
|
---|
70 | // method used for protection, i.e. to avoid infinite recursion
|
---|
71 | // when our internal rep becomes messed up
|
---|
72 | virtual bool isBaseClass() const;
|
---|
73 | virtual SingleVector *clone() const;
|
---|
74 | void CopyVector(SingleVector &rhs);
|
---|
75 | double x[NDIM];
|
---|
76 |
|
---|
77 | };
|
---|
78 |
|
---|
79 | #endif /*SINGLEVECTOR_HPP_*/
|
---|