本文整理汇总了C++中mesquite::MeshImpl::vertices_get_attached_elements方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshImpl::vertices_get_attached_elements方法的具体用法?C++ MeshImpl::vertices_get_attached_elements怎么用?C++ MeshImpl::vertices_get_attached_elements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesquite::MeshImpl
的用法示例。
在下文中一共展示了MeshImpl::vertices_get_attached_elements方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_vertex_get_attached_elements
void test_vertex_get_attached_elements()
{
size_t i;
const size_t nbVert = mVertices.size();
std::vector<Mesquite::Mesh::ElementHandle> elements;
std::vector<size_t> offsets;
mMesh->vertices_get_attached_elements( &mVertices[0],
mVertices.size(),
elements,
offsets,
mErr );
CPPUNIT_ASSERT(!mErr);
CPPUNIT_ASSERT_EQUAL(offsets.size(), mVertices.size() + 1);
// checks we have 6 vertices contained in 1 element only
// and 3 vertices contained in 3 elements.
int n1=0;
int n3=0;
for (i = 1; i <= mVertices.size(); ++i)
{
const size_t nev = offsets[i] - offsets[i-1];
if (nev==1)
++n1;
else if (nev==3)
++n3;
else // failure.
CPPUNIT_ASSERT(false);
}
CPPUNIT_ASSERT(n1==6);
CPPUNIT_ASSERT(n3==3);
// gets the index of a vertex in a corner
int one_corner_vertex_index=0;
for (i = 0; i < nbVert; ++i)
{
const size_t nev = offsets[i+1] - offsets[i];
if (1 == nev)
break;
}
CPPUNIT_ASSERT( i < nbVert );
one_corner_vertex_index = i;
// retrieve the attached element.
// This is a poor test. We allow an element handle of zero,
// and just testing that the function returned something isn't
// that useful. - J.K.
//Mesquite::Mesh::ElementHandle elem=0;
//mMesh->vertex_get_attached_elements(mVertices[one_corner_vertex_index], &elem, 1, mErr);
//CPPUNIT_ASSERT(!mErr);
//CPPUNIT_ASSERT(elem!=0);
}