Changeset e7ea64 for molecuilder/src/vector.hpp
- Timestamp:
- Apr 15, 2010, 10:54:26 AM (16 years ago)
- Children:
- 32842d8
- Parents:
- 1f591b
- File:
-
- 1 edited
-
molecuilder/src/vector.hpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/vector.hpp
r1f591b re7ea64 15 15 #include <gsl/gsl_multimin.h> 16 16 17 #include <memory> 18 17 19 #include "defs.hpp" 18 20 … … 26 28 // this struct is used to indicate calls to the Baseconstructor from inside vectors. 27 29 struct Baseconstructor{}; 28 public:30 public: 29 31 30 32 Vector(); … … 33 35 virtual ~Vector(); 34 36 35 virtual double Distance(const Vector &y) const; 37 // Method implemented by forwarding to the Representation 38 36 39 virtual double DistanceSquared(const Vector &y) const; 37 40 virtual double DistanceToPlane(const Vector &PlaneNormal, const Vector &PlaneOffset) const; … … 39 42 virtual double PeriodicDistanceSquared(const Vector &y, const double * const cell_size) const; 40 43 virtual double ScalarProduct(const Vector &y) const; 41 virtual double Norm() const;42 virtual double NormSquared() const;43 44 virtual double Angle(const Vector &y) const; 44 45 virtual bool IsZero() const; … … 49 50 virtual void AddVector(const Vector &y); 50 51 virtual void SubtractVector(const Vector &y); 51 virtual void CopyVector(const Vector &y);52 52 virtual void VectorProduct(const Vector &y); 53 53 virtual void ProjectOntoPlane(const Vector &y); 54 54 virtual void ProjectIt(const Vector &y); 55 55 virtual Vector Projection(const Vector &y) const; 56 virtual void Zero();57 virtual void One(const double one);58 virtual void Init(const double x1, const double x2, const double x3);59 virtual void Normalize();60 virtual void Translate(const Vector &x);61 56 virtual void Mirror(const Vector &x); 62 virtual void Scale(const double ** const factor); 63 virtual void Scale(const double * const factor); 57 virtual void ScaleAll(const double *factor); 64 58 virtual void Scale(const double factor); 65 59 virtual void MatrixMultiplication(const double * const M); 66 60 virtual bool InverseMatrixMultiplication(const double * const M); 67 61 virtual void KeepPeriodic(const double * const matrix); 68 virtual void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors);69 62 virtual bool GetOneNormalVector(const Vector &x1); 70 63 virtual bool MakeNormalTo(const Vector &y1); 71 //bool SolveSystem(Vector * x1, Vector * x2, Vector * y, const double alpha, const double beta, const double c);72 64 virtual bool IsInParallelepiped(const Vector &offset, const double * const parallelepiped) const; 73 65 virtual void WrapPeriodically(const double * const M, const double * const Minv); … … 76 68 virtual double& operator[](size_t i); 77 69 virtual const double& operator[](size_t i) const; 78 virtualdouble& at(size_t i);79 virtualconst double& at(size_t i) const;70 double& at(size_t i); 71 const double& at(size_t i) const; 80 72 81 73 // Assignment operator … … 84 76 // Access to internal structure 85 77 virtual double* get(); 78 79 // Methods that are derived directly from other methods 80 double Distance(const Vector &y) const; 81 double Norm() const; 82 double NormSquared() const; 83 void Normalize(); 84 void Zero(); 85 void One(const double one); 86 void LinearCombinationOfVectors(const Vector &x1, const Vector &x2, const Vector &x3, const double * const factors); 86 87 87 88 // operators for mathematical operations … … 92 93 Vector const operator-(const Vector& b) const; 93 94 95 protected: 96 typedef std::auto_ptr<Vector> rep_ptr; 97 Vector(Baseconstructor); 98 Vector(Baseconstructor,const Vector*); 99 static Vector VecFromRep(const Vector*); 100 94 101 private: 95 double x[NDIM]; 102 // method used for protection, i.e. to avoid infinite recursion 103 // when our internal rep becomes messed up 104 virtual bool isBaseClass() const; 105 virtual Vector* clone() const; 106 // this is used to represent the vector internally 107 rep_ptr rep; 96 108 97 109 };
Note:
See TracChangeset
for help on using the changeset viewer.
