AnalysisDataFrameRef::AnalysisDataFrameRef(
const AnalysisDataFrameRef &frame, int firstColumn, int columnCount)
- : header_(frame.header()), values_(columnCount, &frame.values_[firstColumn])
+ : header_(frame.header()), values_(&frame.values_[firstColumn], columnCount)
{
GMX_ASSERT(firstColumn >= 0, "Invalid first column");
GMX_ASSERT(columnCount >= 0, "Invalid column count");
{
return ConstArrayRef<int>();
}
- return ConstArrayRef<int>(data().rawPositions_.g->isize,
- data().rawPositions_.g->index);
+ return ConstArrayRef<int>(data().rawPositions_.g->index,
+ data().rawPositions_.g->isize);
}
//! Number of positions in the selection.
int posCount() const { return data().posCount(); }
//! Returns coordinates for this selection as a continuous array.
ConstArrayRef<rvec> coordinates() const
{
- return ConstArrayRef<rvec>(posCount(), data().rawPositions_.x);
+ return ConstArrayRef<rvec>(data().rawPositions_.x, posCount());
}
//! Returns whether velocities are available for this selection.
bool hasVelocities() const { return data().rawPositions_.v != NULL; }
ConstArrayRef<rvec> velocities() const
{
GMX_ASSERT(hasVelocities(), "Velocities accessed, but unavailable");
- return ConstArrayRef<rvec>(posCount(), data().rawPositions_.v);
+ return ConstArrayRef<rvec>(data().rawPositions_.v, posCount());
}
//! Returns whether forces are available for this selection.
bool hasForces() const { return sel_->rawPositions_.f != NULL; }
ConstArrayRef<rvec> forces() const
{
GMX_ASSERT(hasForces(), "Forces accessed, but unavailable");
- return ConstArrayRef<rvec>(posCount(), data().rawPositions_.f);
+ return ConstArrayRef<rvec>(data().rawPositions_.f, posCount());
}
//! Returns masses for this selection as a continuous array.
ConstArrayRef<real> masses() const
*/
ConstArrayRef<int> refIds() const
{
- return ConstArrayRef<int>(posCount(), data().rawPositions_.m.refid);
+ return ConstArrayRef<int>(data().rawPositions_.m.refid, posCount());
}
/*! \brief
* Returns mapped IDs for this selection as a continuous array.
*/
ConstArrayRef<int> mappedIds() const
{
- return ConstArrayRef<int>(posCount(), data().rawPositions_.m.mapid);
+ return ConstArrayRef<int>(data().rawPositions_.m.mapid, posCount());
}
/*! \brief
* Sets the ID for the \p i'th position for use with
return ConstArrayRef<int>();
}
int first = sel_->rawPositions_.m.mapb.index[i_];
- return ConstArrayRef<int>(atomCount(),
- &sel_->rawPositions_.g->index[first]);
+ return ConstArrayRef<int>(&sel_->rawPositions_.g->index[first],
+ atomCount());
}
/*! \brief
* Returns whether this position is selected in the current frame.
/*! \brief
* Constructs a reference to an array.
*
- * \param[in] size Number of elements in the array.
* \param[in] begin Pointer to the beginning of the array.
* May be NULL if \p size is zero.
+ * \param[in] size Number of elements in the array.
*
* Passed pointer must remain valid for the lifetime of this object.
*/
- ConstArrayRef(size_type size, const_pointer begin)
+ ConstArrayRef(const_pointer begin, size_type size)
: begin_(begin), end_(begin + size)
{
}