本文整理汇总了C++中Linked::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Linked::end方法的具体用法?C++ Linked::end怎么用?C++ Linked::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linked
的用法示例。
在下文中一共展示了Linked::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: voronoi
void Interstitial::voronoi(const ISO& iso, const Symmetry& symmetry, double tol)
{
// Clear space
clear();
// Output
Output::newline();
Output::print("Searching for interstitial sites using Voronoi method");
Output::increase();
// Set up image iterator
ImageIterator images;
images.setCell(iso.basis(), 12);
// Loop over unique atoms in the structure
int i, j, k;
List<double> weights;
OList<Vector3D> points;
OList<Vector3D> vertices;
Linked<Vector3D> intPoints;
for (i = 0; i < symmetry.orbits().length(); ++i)
{
// Reset variables
weights.length(0);
points.length(0);
vertices.length(0);
// Loop over atoms in the structure
for (j = 0; j < iso.atoms().length(); ++j)
{
for (k = 0; k < iso.atoms()[j].length(); ++k)
{
// Loop over images
images.reset(symmetry.orbits()[i].atoms()[0]->fractional(), iso.atoms()[j][k].fractional());
while (!images.finished())
{
// Skip if atoms are the same
if (++images < 1e-8)
continue;
// Save current point
points += symmetry.orbits()[i].atoms()[0]->cartesian() + images.cartVector();
weights += 0.5;
}
}
}
// Calculate Voronoi volume
symmetry.orbits()[i].atoms()[0]->cartesian().voronoi(points, weights, tol, &vertices);
// Save points
for (j = 0; j < vertices.length(); ++j)
{
intPoints += iso.basis().getFractional(vertices[j]);
ISO::moveIntoCell(*intPoints.last());
}
}
// Reduce points to unique ones
bool found;
double curDistance;
Vector3D rotPoint;
Vector3D equivPoint;
Vector3D origin(0.0);
Linked<double> distances;
Linked<double>::iterator itDist;
Linked<Vector3D>::iterator it;
Linked<Vector3D> uniquePoints;
Linked<Vector3D>::iterator itUnique;
for (it = intPoints.begin(); it != intPoints.end(); ++it)
{
// Get current distance to origin
curDistance = iso.basis().distance(*it, FRACTIONAL, origin, FRACTIONAL);
// Loop over points that were already saved
found = false;
itDist = distances.begin();
itUnique = uniquePoints.begin();
for (; itDist != distances.end(); ++itDist, ++itUnique)
{
// Current points are not the same
if (Num<double>::abs(curDistance - *itDist) <= tol)
{
if (iso.basis().distance(*it, FRACTIONAL, *itUnique, FRACTIONAL) <= tol)
{
found = true;
break;
}
}
// Loop over symmetry operations
for (i = 0; i < symmetry.operations().length(); ++i)
{
//.........这里部分代码省略.........
示例2: evaluate
//.........这里部分代码省略.........
Linked<double> distances;
Linked<double>::iterator itDist;
Linked<Vector3D> uniquePoints;
Linked<Vector3D>::iterator it;
Linked<Vector3D>::iterator itUnique;
for (i = 0; i < Multi::worldSize(); ++i)
{
// Send number of points in list on current processor
numLoops = points.length();
Multi::broadcast(numLoops, i);
// Loop over points
if (i == Multi::rank())
it = points.begin();
for (j = 0; j < numLoops; ++j)
{
// Send out current point
if (i == Multi::rank())
{
curPoint = *it;
++it;
}
Multi::broadcast(curPoint, i);
// Get current distance to origin
curDistance = iso.basis().distance(curPoint, FRACTIONAL, origin, FRACTIONAL);
// Loop over points that were already saved
found = false;
itDist = distances.begin();
itUnique = uniquePoints.begin();
for (; itDist != distances.end(); ++itDist, ++itUnique)
{
// Current points are not the same
if (Num<double>::abs(curDistance - *itDist) <= tol)
{
if (iso.basis().distance(curPoint, FRACTIONAL, *itUnique, FRACTIONAL) <= tol)
{
found = true;
break;
}
}
// Loop over symmetry operations
for (k = 0; k < symmetry.operations().length(); ++k)
{
// Loop over translations
rotPoint = symmetry.operations()[k].rotation() * curPoint;
for (m = 0; m < symmetry.operations()[k].translations().length(); ++m)
{
// Check if points are the same
equivPoint = rotPoint;
equivPoint += symmetry.operations()[k].translations()[m];
if (iso.basis().distance(equivPoint, FRACTIONAL, *itUnique, FRACTIONAL) <= tol)
{
found = true;
break;
}
}
if (found)
break;