本文整理汇总了C++中std::tr1::shared_ptr::end方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::end方法的具体用法?C++ shared_ptr::end怎么用?C++ shared_ptr::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::tr1::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Vector
OPRGyration::molGyrationDat
OPRGyration::getGyrationEigenSystem(const std::tr1::shared_ptr<CRange>& range, const dynamo::SimData* Sim)
{
//Determine the centre of mass. Watch for periodic images
Vector tmpVec;
molGyrationDat retVal;
retVal.MassCentre = Vector (0,0,0);
double totmass = Sim->dynamics.getSpecies(Sim->particleList[*(range->begin())]).getMass(*(range->begin()));
std::vector<Vector> relVecs;
relVecs.reserve(range->size());
relVecs.push_back(Vector(0,0,0));
//Walk along the chain
for (CRange::iterator iPtr = range->begin()+1; iPtr != range->end(); iPtr++)
{
Vector currRelPos = Sim->particleList[*iPtr].getPosition()
- Sim->particleList[*(iPtr - 1)].getPosition();
Sim->dynamics.BCs().applyBC(currRelPos);
relVecs.push_back(currRelPos + relVecs.back());
double mass = Sim->dynamics.getSpecies(Sim->particleList[*iPtr]).getMass(*iPtr);
retVal.MassCentre += relVecs.back() * mass;
totmass += mass;
}
retVal.MassCentre /= totmass;
//Now determine the inertia tensor
double data[NDIM * NDIM];
for (size_t i = 0; i < NDIM; i++)
for (size_t j = i; j < NDIM; j++)
data[i + j * NDIM] = 0.0;
BOOST_FOREACH(Vector & vec, relVecs)
{
vec -= retVal.MassCentre;
for (size_t i = 0; i < NDIM; i++)
for (size_t j = i; j < NDIM; j++)
data[i+j*NDIM] += vec[i] * vec[j];
}