ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/devel_omp/src/math/Vector3.hpp
(Generate patch)

Comparing branches/devel_omp/src/math/Vector3.hpp (file contents):
Revision 1594 by chuckv, Tue Jul 19 16:45:30 2011 UTC vs.
Revision 1595 by chuckv, Tue Jul 19 18:50:04 2011 UTC

# Line 155 | Line 155 | namespace OpenMD {
155      return (p.z() * s.y() + p.y()) * s.x() + p.x();
156    }
157  
158 +  /**
159 +   * Returns integer vector for the linear index.
160 +   *
161 +   * @param p first vector
162 +   * @param s second vector
163 +   */
164 +  template<typename Real>
165 +  inline Vector3<Real> idxToV( const Real i, const Vector3<Real>& s ) {
166 +          Vector3<Real> v;
167 +
168 +          v.z() = i / (s.y() * s.x());
169 +          v.y() = (i % (s.y() * s.x())) / s.x();
170 +          v.x() = (i % (s.y() * s.x())) % s.x();
171 +          return v;
172 +  }
173 +
174    typedef Vector3<int> Vector3i;
175    
176    typedef Vector3<RealType> Vector3d;    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines