Changeset 3746440


Ignore:
Timestamp:
Oct 5, 2009, 10:09:51 PM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
f92d00
Parents:
dcbdf2
Message:

new function Vector::WrapPeriodically() and Vector::(Inverse)MatrixMultiplication has const parameters now.

Location:
molecuilder/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/vector.cpp

    rdcbdf2 r3746440  
    661661};
    662662
     663/** Given a box by its matrix \a *M and its inverse *Minv the vector is made to point within that box.
     664 * \param *M matrix of box
     665 * \param *Minv inverse matrix
     666 */
     667void Vector::WrapPeriodically(const double *M, const double *Minv)
     668{
     669  MatrixMultiplication(Minv);
     670  // truncate to [0,1] for each axis
     671  for (int i=0;i<NDIM;i++) {
     672    x[i] += 0.5;  // set to center of box
     673    while (x[i] >= 1.)
     674      x[i] -= 1.;
     675    while (x[i] < 0.)
     676      x[i] += 1.;
     677  }
     678  MatrixMultiplication(M);
     679};
     680
    663681/** Do a matrix multiplication.
    664682 * \param *matrix NDIM_NDIM array
    665683 */
    666 void Vector::MatrixMultiplication(double *M)
     684void Vector::MatrixMultiplication(const double *M)
    667685{
    668686  Vector C;
     
    706724 * \param *matrix NDIM_NDIM array
    707725 */
    708 void Vector::InverseMatrixMultiplication(double *A)
     726void Vector::InverseMatrixMultiplication(const double *A)
    709727{
    710728  Vector C;
  • molecuilder/src/vector.hpp

    rdcbdf2 r3746440  
    5252  void Scale(double *factor);
    5353  void Scale(double factor);
    54   void MatrixMultiplication(double *M);
     54  void MatrixMultiplication(const double *M);
    5555  double * InverseMatrix(double *A);
    56   void InverseMatrixMultiplication(double *M);
     56  void InverseMatrixMultiplication(const double *M);
    5757  void KeepPeriodic(ofstream *out, double *matrix);
    5858  void LinearCombinationOfVectors(const Vector *x1, const Vector *x2, const Vector *x3, double *factors);
     
    6969  bool Output(ofstream *out) const;
    7070  bool IsInParallelepiped(Vector offset, double *parallelepiped);
     71  void WrapPeriodically(const double *M, const double *Minv);
    7172};
    7273
Note: See TracChangeset for help on using the changeset viewer.