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 1598 by mciznick, Wed Jul 27 14:26:53 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 i linear position
162 +   * @param s vector
163 +   */
164 +  template<typename Real>
165 +  inline Vector3<Real> idxToV( const Real i, const Vector3<Real>& s ) {
166 +          Vector3<Real> v;
167 +
168 +          int boxXY = s.y() * s.x();
169 +          int remXY = i % boxXY;
170 +
171 +          v.z() = i / boxXY;
172 +          v.y() = remXY / s.x();
173 +          v.x() = remXY % s.x();
174 +          return v;
175 +  }
176 +
177    typedef Vector3<int> Vector3i;
178    
179    typedef Vector3<RealType> Vector3d;    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines