本文整理汇总了C++中STK_Interface::getFaceRank方法的典型用法代码示例。如果您正苦于以下问题:C++ STK_Interface::getFaceRank方法的具体用法?C++ STK_Interface::getFaceRank怎么用?C++ STK_Interface::getFaceRank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STK_Interface
的用法示例。
在下文中一共展示了STK_Interface::getFaceRank方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_pair
std::pair<Teuchos::RCP<std::vector<std::size_t> >,
Teuchos::RCP<std::vector<Teuchos::Tuple<double,3> > > >
getLocalSideIdsAndCoords(const STK_Interface & mesh,
const std::string & sideName, const std::string type_)
{
unsigned physicalDim = mesh.getDimension();
Teuchos::RCP<stk::mesh::MetaData> metaData = mesh.getMetaData();
Teuchos::RCP<stk::mesh::BulkData> bulkData = mesh.getBulkData();
// grab nodes owned by requested side
/////////////////////////////////////////////
std::stringstream ss;
ss << "Can't find part=\"" << sideName << "\"" << std::endl;
stk::mesh::Part * side = metaData->get_part(sideName,ss.str().c_str());
stk::mesh::Selector mySides = (*side) & metaData->locally_owned_part();
stk::mesh::EntityRank rank;
const STK_Interface::VectorFieldType * field = 0;
unsigned int offset = 0;
if(type_ == "coord"){
rank = mesh.getNodeRank();
field = & mesh.getCoordinatesField();
} else if(type_ == "edge"){
rank = mesh.getEdgeRank();
field = & mesh.getEdgesField();
offset = mesh.getMaxEntityId(mesh.getNodeRank());
} else if(type_ == "face"){
rank = mesh.getFaceRank();
field = & mesh.getFacesField();
offset = mesh.getMaxEntityId(mesh.getNodeRank())+mesh.getMaxEntityId(mesh.getEdgeRank());
} else {
ss << "Can't do BCs of type " << type_ << std::endl;
TEUCHOS_TEST_FOR_EXCEPTION(true,std::runtime_error, ss.str())
}
std::vector<stk::mesh::Bucket*> const& nodeBuckets =
bulkData->get_buckets(rank, mySides);
// build id vector
////////////////////////////////////////////
std::size_t nodeCount = 0;
for(std::size_t b=0;b<nodeBuckets.size();b++)
nodeCount += nodeBuckets[b]->size();
Teuchos::RCP<std::vector<std::size_t> > sideIds
= Teuchos::rcp(new std::vector<std::size_t>(nodeCount));
Teuchos::RCP<std::vector<Teuchos::Tuple<double,3> > > sideCoords
= Teuchos::rcp(new std::vector<Teuchos::Tuple<double,3> >(nodeCount));
// loop over node buckets
for(std::size_t b=0,index=0;b<nodeBuckets.size();b++) {
stk::mesh::Bucket & bucket = *nodeBuckets[b];
double const* array = stk::mesh::field_data(*field, bucket);
for(std::size_t n=0;n<bucket.size();n++,index++) {
(*sideIds)[index] = bulkData->identifier(bucket[n]) + offset;
Teuchos::Tuple<double,3> & coord = (*sideCoords)[index];
// copy coordinates into multi vector
for(std::size_t d=0;d<physicalDim;d++)
coord[d] = array[physicalDim*n + d];
}
}
return std::make_pair(sideIds,sideCoords);
}