Changeset 3746440
- Timestamp:
- Oct 5, 2009, 10:09:51 PM (16 years ago)
- Children:
- f92d00
- Parents:
- dcbdf2
- Location:
- molecuilder/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/vector.cpp
rdcbdf2 r3746440 661 661 }; 662 662 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 */ 667 void 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 663 681 /** Do a matrix multiplication. 664 682 * \param *matrix NDIM_NDIM array 665 683 */ 666 void Vector::MatrixMultiplication( double *M)684 void Vector::MatrixMultiplication(const double *M) 667 685 { 668 686 Vector C; … … 706 724 * \param *matrix NDIM_NDIM array 707 725 */ 708 void Vector::InverseMatrixMultiplication( double *A)726 void Vector::InverseMatrixMultiplication(const double *A) 709 727 { 710 728 Vector C; -
molecuilder/src/vector.hpp
rdcbdf2 r3746440 52 52 void Scale(double *factor); 53 53 void Scale(double factor); 54 void MatrixMultiplication( double *M);54 void MatrixMultiplication(const double *M); 55 55 double * InverseMatrix(double *A); 56 void InverseMatrixMultiplication( double *M);56 void InverseMatrixMultiplication(const double *M); 57 57 void KeepPeriodic(ofstream *out, double *matrix); 58 58 void LinearCombinationOfVectors(const Vector *x1, const Vector *x2, const Vector *x3, double *factors); … … 69 69 bool Output(ofstream *out) const; 70 70 bool IsInParallelepiped(Vector offset, double *parallelepiped); 71 void WrapPeriodically(const double *M, const double *Minv); 71 72 }; 72 73
Note:
See TracChangeset
for help on using the changeset viewer.