本文整理汇总了C++中VertexElement::getIDX方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexElement::getIDX方法的具体用法?C++ VertexElement::getIDX怎么用?C++ VertexElement::getIDX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexElement
的用法示例。
在下文中一共展示了VertexElement::getIDX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ArgErr
void sefield::TetMesh::axisOrderElements(uint opt_method, std::string const & opt_file_name)
{
// Now this method provides a choice between Stefan and Robert's method
// and the new method by Iain. The original method is fast and suffices for
// simple geometries, Iain's method is superior and important for complex
// geometries, but slow.
if (opt_file_name != "")
{
std::fstream opt_file;
opt_file.open(opt_file_name.c_str(),
std::fstream::in | std::fstream::binary);
opt_file.seekg(0);
uint nelems = 0;
opt_file.read((char*)&nelems, sizeof(uint));
if (pElements.size() != nelems) {
std::ostringstream os;
os << "optimal data mismatch with simulator parameters: sefield::Tetmesh::nelems, ";
os << nelems << ":" << pElements.size();
throw steps::ArgErr(os.str());
}
opt_file.read((char*)pVertexPerm, sizeof(uint) * nelems);
VertexElementPVec elements_temp = pElements;
for (uint vidx = 0; vidx < nelems; ++vidx)
{
VertexElementP vep = elements_temp[vidx];
// sanity check
assert(vep->getIDX() == vidx);
uint new_idx = pVertexPerm[vidx];
pElements[new_idx] = vep;
}
reindexElements();
reordered();
opt_file.close();
return;
}
if (opt_method == 2)
{
// / / / / / / / / / / / / / / NEW / / / / / / / / / / / / / / / / / / //
// LOOPING OVER ALL VERTICES, APPLYING THE WALK METHOD AND FINDING WHICH
// STARTING VERTEX GIVES THE LOWEST MATRIX WIDTH.
uint pNVerts = pElements.size();
// the best vertex(narrowest width)
uint bestone = 0;
uint bestwidth = pNVerts;
std::vector<VertexElement*> orig_indices = pElements;
stringstream ss;
ss << "\nFinding optimal vertex indexing. This can take some time...";
cout << ss.str() << endl;
for (uint vidx = 0; vidx < pNVerts; ++vidx)
{
set<VertexElement*> verteleset = set<VertexElement*>();
vector<VertexElement*> vertelevec = vector<VertexElement*>();
queue<VertexElement*> vertelqueue = queue<VertexElement*>();
verteleset.insert(orig_indices[vidx]);
vertelevec.push_back(orig_indices[vidx]);
uint ve0ncons = orig_indices[vidx]->getNCon();
VertexElement ** ve0neighbs = orig_indices[vidx]->getNeighbours();
fill_ve_vec(verteleset, vertelevec, vertelqueue, ve0ncons, ve0neighbs);
pElements.clear();
vector<VertexElement*>::iterator vertele_end = vertelevec.end();
uint ielt = 0;
for (vector<VertexElement*>::iterator vertele = vertelevec.begin(); vertele != vertele_end; ++vertele)
{
pElements.push_back(*vertele);
pVertexPerm[(*vertele)->getIDX()]=ielt;
ielt++;
}
// Note: this will reorder the vertex indices as we go- not a problem in this loop
// but they must be reset for the final index setting to work
reindexElements();
uint maxdi = 0;
for (int iv = 0; iv < pNVerts; ++iv)
{
VertexElement* ve = getVertex(iv);
int ind = ve->getIDX();
for (int i = 0; i < ve->getNCon(); ++i)
{
int inbr = ve->nbrIdx(i);
//.........这里部分代码省略.........