~ubuntu-branches/debian/sid/lammps/sid

« back to all changes in this revision

Viewing changes to lib/atc/Vector.h

  • Committer: Package Import Robot
  • Author(s): Anton Gladky
  • Date: 2015-04-29 23:44:49 UTC
  • mfrom: (5.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20150429234449-mbhy9utku6hp6oq8
Tags: 0~20150313.gitfa668e1-1
Upload into unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
  static bool same_size(const Vector &a, const Vector &b);
53
53
 
54
54
 protected:
 
55
  void _set_equal(const Matrix<T> &r);
55
56
  //* don't allow this
56
57
  Vector& operator=(const Vector &r);
57
58
};
199
200
{
200
201
  return a.same_size(b); 
201
202
}
202
 
 
 
203
//----------------------------------------------------------------------------
 
204
// general matrix assignment (for densely packed matrices)
 
205
//----------------------------------------------------------------------------
 
206
template<typename T>
 
207
void Vector<T>::_set_equal(const Matrix<T> &r)
 
208
{
 
209
  this->resize(r.nRows(), r.nCols());
 
210
  const Matrix<T> *pr = &r;
 
211
#ifdef OBSOLETE
 
212
  if (const SparseMatrix<T> *ps = dynamic_cast<const SparseMatrix<T>*>(pr))//sparse_cast(pr)) 
 
213
    copy_sparse_to_matrix(ps, *this);
 
214
  
 
215
  else if (dynamic_cast<const DiagonalMatrix<T>*>(pr))//diag_cast(pr))  // r is Diagonal?
 
216
  {
 
217
    this->zero();
 
218
    for (INDEX i=0; i<r.size(); i++) (*this)(i,i) = r[i];
 
219
  }
 
220
  else memcpy(this->ptr(), r.ptr(), r.size()*sizeof(T));
 
221
#else
 
222
  const Vector<T>         *pv = dynamic_cast<const Vector<T>*>         (pr);
 
223
  if (pv)  this->copy(pv->ptr(),pv->nRows());
 
224
  else
 
225
  {
 
226
    std::cout <<"Error in general vector assignment\n";
 
227
    exit(1);
 
228
  }
 
229
#endif
 
230
}
203
231
} // end namespace
204
232
 
205
233