Ignore:
Timestamp:
May 21, 2008, 9:24:54 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
33c05d
Parents:
e9c14d
Message:

new header file for the vector class, new operators +=,*=,*,+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.hpp

    re9c14d r725869  
    2222#include "helpers.hpp"
    2323#include "stackclass.hpp"
     24#include "vector.hpp"
    2425
    2526class atom;
     
    119120#define RDET2(a0,a1,a2,a3) ((a0)*(a3)-(a1)*(a2))                      //!< hard-coded determinant of a 2x2 matrix
    120121
    121 /** Single vector.
    122  * basically, just a x[3] but with helpful functions
    123  */
    124 class vector {   
    125   public:
    126     double x[NDIM];
    127 
    128   vector();
    129   ~vector();
    130 
    131   double Distance(const vector *y) const;
    132   double PeriodicDistance(const vector *y, const double *cell_size) const;
    133   double ScalarProduct(const vector *y) const;
    134   double Projection(const vector *y) const;
    135   double Norm() const ;
    136   double Angle(vector *y) const;
    137 
    138   void AddVector(const vector *y);
    139   void SubtractVector(const vector *y);
    140   void CopyVector(const vector *y);
    141   void RotateVector(const vector *y, const double alpha);
    142   void Zero();
    143   void Normalize();
    144   void Translate(const vector *x);
    145   void Mirror(const vector *x);
    146   void Scale(double **factor);
    147   void Scale(double *factor);
    148   void Scale(double factor);
    149   void MatrixMultiplication(double *M);
    150   void InverseMatrixMultiplication(double *M);
    151   void KeepPeriodic(ofstream *out, double *matrix);
    152   void LinearCombinationOfVectors(const vector *x1, const vector *x2, const vector *x3, double *factors);
    153  
    154   bool GetOneNormalVector(const vector *x1);
    155   bool MakeNormalVector(const vector *y1);
    156   bool MakeNormalVector(const vector *y1, const vector *y2);
    157   bool MakeNormalVector(const vector *x1, const vector *x2, const vector *x3);
    158   bool SolveSystem(vector *x1, vector *x2, vector *y, double alpha, double beta, double c);
    159         bool LSQdistance(vector **vectors, int dim);
    160 
    161   void AskPosition(double *cell_size, bool check);
    162   bool Output(ofstream *out) const;
    163 };
    164 
    165 ofstream& operator<<(ofstream& ost, vector& m);
    166122
    167123/** Parameter structure for least square minimsation.
     
    300256  /// Find atoms.
    301257  atom * FindAtom(int Nr) const;
    302   atom * AskAtom(char *text);
     258  atom * AskAtom(string text);
    303259
    304260  /// Count and change present atoms' coordination.
     
    306262  void CountElements();
    307263  void CalculateOrbitals(class config &configuration);
     264  bool CenterInBox(ofstream *out, vector *BoxLengths);
    308265  void CenterEdge(ofstream *out, vector *max);
    309266  void CenterOrigin(ofstream *out, vector *max);
     
    335292  void ResetAllAtomNumbers();
    336293  int CountCyclicBonds(ofstream *out);
    337   char * GetColor(enum Shading color);
     294  string GetColor(enum Shading color);
    338295
    339296  molecule *CopyMolecule();
     
    500457  void Load(char *filename, periodentafel *periode, molecule *mol);
    501458  void LoadOld(char *filename, periodentafel *periode, molecule *mol);
    502   void RetrieveConfigPathAndName(char *filename);
     459  void RetrieveConfigPathAndName(char * filename);
    503460  bool Save(ofstream *file, periodentafel *periode, molecule *mol) const;
    504461  void Edit(molecule *mol);
    505462  bool GetIsAngstroem() const;
    506463  char *GetDefaultPath() const;
    507   void config::SetDefaultPath(const char *path);
     464  void SetDefaultPath(const char *path);
    508465};
    509466
Note: See TracChangeset for help on using the changeset viewer.