本文整理汇总了C++中STK_Interface::findConnectivityById方法的典型用法代码示例。如果您正苦于以下问题:C++ STK_Interface::findConnectivityById方法的具体用法?C++ STK_Interface::findConnectivityById怎么用?C++ STK_Interface::findConnectivityById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STK_Interface
的用法示例。
在下文中一共展示了STK_Interface::findConnectivityById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addSideSets
void CubeTetMeshFactory::addSideSets(STK_Interface & mesh) const
{
mesh.beginModification();
const stk::mesh::EntityRank side_rank = mesh.getSideRank();
std::size_t totalXElems = nXElems_*xBlocks_;
std::size_t totalYElems = nYElems_*yBlocks_;
std::size_t totalZElems = nZElems_*zBlocks_;
// get all part vectors
stk::mesh::Part * left = mesh.getSideset("left");
stk::mesh::Part * right = mesh.getSideset("right");
stk::mesh::Part * top = mesh.getSideset("top");
stk::mesh::Part * bottom = mesh.getSideset("bottom");
stk::mesh::Part * front = mesh.getSideset("front");
stk::mesh::Part * back = mesh.getSideset("back");
std::vector<stk::mesh::Entity> localElmts;
mesh.getMyElements(localElmts);
// gid = totalXElems*totalYElems*nz+totalXElems*ny+nx+1
// loop over elements adding sides to sidesets
std::vector<stk::mesh::Entity>::const_iterator itr;
for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
stk::mesh::Entity element = (*itr);
stk::mesh::EntityId gid = mesh.elementGlobalId(element);
// get hex global id
stk::mesh::EntityId h_gid = (gid-1)/12+1;
stk::mesh::EntityId t_offset = gid - (12*(h_gid-1)+1);
std::size_t nx,ny,nz;
nz = (h_gid-1) / (totalXElems*totalYElems);
h_gid = (h_gid-1)-nz*(totalXElems*totalYElems);
ny = h_gid / totalXElems;
nx = h_gid-ny*totalXElems;
if(nz==0 && (t_offset==0 || t_offset==1)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the back
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,back);
}
if(nz+1==totalZElems && (t_offset==10 || t_offset==11)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the front
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,front);
}
if(ny==0 && (t_offset==2 || t_offset==3)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the bottom
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,bottom);
}
if(ny+1==totalYElems && (t_offset==8 || t_offset==9)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the top
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,top);
}
if(nx==0 && (t_offset==4 || t_offset==5)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the left
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,left);
}
if(nx+1==totalXElems && (t_offset==6 || t_offset==7)) {
stk::mesh::Entity side = mesh.findConnectivityById(element, side_rank, 3);
// on the right
if(mesh.entityOwnerRank(side)==machRank_)
mesh.addEntityToSideset(side,right);
}
}
mesh.endModification();
}