You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of a call to VectorField::operator() is a Vector object. However this object is created from copies of the elements of the vectors. This happens because the memory returned from VectorField is non-contiguous. One solution would be to use std::tuple in Tensor and allow the ElementType to be a reference. This was tried in #109 however std::tuple methods are not supported on GPU. For now we have to live with this restriction. This prevents us from doing things like:
However currently this code does not raise an error. It simply modifies the temporary Vector that was created, leaving my_vec_field unchanged. Instead VectorField::operator() should return a const object to ensure that an error is raised to avoid accidental bugs when writing code like this.
The text was updated successfully, but these errors were encountered:
The result of a call to
VectorField::operator()
is aVector
object. However this object is created from copies of the elements of the vectors. This happens because the memory returned fromVectorField
is non-contiguous. One solution would be to usestd::tuple
inTensor
and allow theElementType
to be a reference. This was tried in #109 howeverstd::tuple
methods are not supported on GPU. For now we have to live with this restriction. This prevents us from doing things like:However currently this code does not raise an error. It simply modifies the temporary
Vector
that was created, leavingmy_vec_field
unchanged. InsteadVectorField::operator()
should return a const object to ensure that an error is raised to avoid accidental bugs when writing code like this.The text was updated successfully, but these errors were encountered: