本文整理汇总了C++中STK_Interface::containingBlockId方法的典型用法代码示例。如果您正苦于以下问题:C++ STK_Interface::containingBlockId方法的具体用法?C++ STK_Interface::containingBlockId怎么用?C++ STK_Interface::containingBlockId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STK_Interface
的用法示例。
在下文中一共展示了STK_Interface::containingBlockId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
CustomMeshFactory::addSideSets(STK_Interface &mesh) const
{
mesh.beginModification();
// get all part vectors
stk_classic::mesh::Part *box[6];
box[0] = mesh.getSideset("front");
box[1] = mesh.getSideset("right");
box[2] = mesh.getSideset("back");
box[3] = mesh.getSideset("left");
box[4] = mesh.getSideset("bottom");
box[5] = mesh.getSideset("top");
stk_classic::mesh::Part *wall = mesh.getSideset("wall");
std::vector<stk_classic::mesh::Entity*> elements;
mesh.getMyElements(elements);
// loop over elements adding sides to sidesets
for (std::vector<stk_classic::mesh::Entity*>::const_iterator
itr=elements.begin();itr!=elements.end();++itr) {
stk_classic::mesh::Entity *element = (*itr);
stk_classic::mesh::PairIterRelation relations = element->relations(mesh.getSideRank());
// loop over side id checking element neighbors
for (std::size_t i=0;i<relations.size();++i) {
stk_classic::mesh::Entity *side = relations[i].entity();
stk_classic::mesh::PairIterRelation neighbors = side->relations(mesh.getElementRank());
const std::size_t numNeighbors = neighbors.size();
if (numNeighbors == 1) {
if (side->owner_rank() == machRank_)
mesh.addEntityToSideset(*side, box[i]);
}
else if (numNeighbors == 2) {
std::string neig_block_id_0 = mesh.containingBlockId(neighbors[0].entity());
std::string neig_block_id_1 = mesh.containingBlockId(neighbors[1].entity());
if ((neig_block_id_0 != neig_block_id_1) && (side->owner_rank() == machRank_))
mesh.addEntityToSideset(*side, wall);
}
else {
// runtime exception
}
}
}
mesh.endModification();
}