本文整理汇总了C++中STK_Interface::getSideRank方法的典型用法代码示例。如果您正苦于以下问题:C++ STK_Interface::getSideRank方法的具体用法?C++ STK_Interface::getSideRank怎么用?C++ STK_Interface::getSideRank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类STK_Interface
的用法示例。
在下文中一共展示了STK_Interface::getSideRank方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerSidesets
void STK_ExodusReaderFactory::registerSidesets(STK_Interface & mesh,stk::io::MeshData & meshData) const
{
using Teuchos::RCP;
RCP<stk::mesh::fem::FEMMetaData> metaData = mesh.getMetaData();
const stk::mesh::PartVector & parts = metaData->get_parts();
stk::mesh::PartVector::const_iterator partItr;
for(partItr=parts.begin();partItr!=parts.end();++partItr) {
const stk::mesh::Part * part = *partItr;
const stk::mesh::PartVector & subsets = part->subsets();
// const CellTopologyData * ct = stk::mesh::fem::get_cell_topology(*part).getCellTopologyData();
const CellTopologyData * ct = metaData->get_cell_topology(*part).getCellTopologyData();
// if a side part ==> this is a sideset: now storage is recursive
// on part contains all sub parts with consistent topology
if(part->primary_entity_rank()==mesh.getSideRank() && ct==0 && subsets.size()>0) {
TEUCHOS_TEST_FOR_EXCEPTION(subsets.size()!=1,std::runtime_error,
"STK_ExodusReaderFactory::registerSidesets error - part \"" << part->name() <<
"\" has more than one subset");
// grab cell topology and name of subset part
const stk::mesh::Part * ss_part = subsets[0];
// const CellTopologyData * ss_ct = stk::mesh::fem::get_cell_topology(*ss_part).getCellTopologyData();
const CellTopologyData * ss_ct = metaData->get_cell_topology(*ss_part).getCellTopologyData();
// only add subset parts that have no topology
if(ss_ct!=0)
mesh.addSideset(part->name(),ss_ct);
}
}
}
示例2: 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();
}
示例3: addSideSets
void LineMeshFactory::addSideSets(STK_Interface & mesh) const
{
mesh.beginModification();
std::size_t totalXElems = nXElems_*xBlocks_;
// get all part vectors
stk::mesh::Part * left = mesh.getSideset("left");
stk::mesh::Part * right = mesh.getSideset("right");
std::vector<stk::mesh::Entity*> localElmts;
mesh.getMyElements(localElmts);
// loop over elements adding edges 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 = element->identifier();
stk::mesh::PairIterRelation relations = element->relations(mesh.getSideRank());
std::size_t nx = gid-1;
// vertical boundaries
///////////////////////////////////////////
if(nx+1==totalXElems) {
stk::mesh::Entity * edge = getRelationByID(1,relations)->entity();
// on the right
if(edge->owner_rank()==machRank_)
mesh.addEntityToSideset(*edge,right);
}
if(nx==0) {
stk::mesh::Entity * edge = getRelationByID(0,relations)->entity();
// on the left
if(edge->owner_rank()==machRank_)
mesh.addEntityToSideset(*edge,left);
}
}
mesh.endModification();
}
示例4: addSideSets
void CubeTetMeshFactory::addSideSets(STK_Interface & mesh) const
{
mesh.beginModification();
std::size_t totalXElems = nXElems_*xBlocks_;
std::size_t totalYElems = nYElems_*yBlocks_;
std::size_t totalZElems = nZElems_*zBlocks_;
// get all part vectors
stk_classic::mesh::Part * left = mesh.getSideset("left");
stk_classic::mesh::Part * right = mesh.getSideset("right");
stk_classic::mesh::Part * top = mesh.getSideset("top");
stk_classic::mesh::Part * bottom = mesh.getSideset("bottom");
stk_classic::mesh::Part * front = mesh.getSideset("front");
stk_classic::mesh::Part * back = mesh.getSideset("back");
std::vector<stk_classic::mesh::Entity*> localElmts;
mesh.getMyElements(localElmts);
// gid = totalXElems*totalYElems*nz+totalXElems*ny+nx+1
// loop over elements adding sides to sidesets
std::vector<stk_classic::mesh::Entity*>::const_iterator itr;
for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
stk_classic::mesh::Entity * element = (*itr);
stk_classic::mesh::EntityId gid = element->identifier();
stk_classic::mesh::PairIterRelation relations = element->relations(mesh.getSideRank());
// get hex global id
stk_classic::mesh::EntityId h_gid = (gid-1)/12+1;
stk_classic::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_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the back
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,back);
}
if(nz+1==totalZElems && (t_offset==10 || t_offset==11)) {
stk_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the front
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,front);
}
if(ny==0 && (t_offset==2 || t_offset==3)) {
stk_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the bottom
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,bottom);
}
if(ny+1==totalYElems && (t_offset==8 || t_offset==9)) {
stk_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the top
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,top);
}
if(nx==0 && (t_offset==4 || t_offset==5)) {
stk_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the left
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,left);
}
if(nx+1==totalXElems && (t_offset==6 || t_offset==7)) {
stk_classic::mesh::Entity * side = getRelationByID(3,relations)->entity();
// on the right
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,right);
}
}
mesh.endModification();
}
示例5: addSideSets
void SculptMeshFactory::addSideSets(STK_Interface & mesh) const
{
mesh.beginModification();
struct MeshStorageStruct *mss = get_sculpt_mesh();
int num_side_sets = mss->num_side_sets;
int *side_set_id = new int[num_side_sets];
int *num_elements_in_side_set = new int[num_side_sets];
int *num_nodes_in_side_set = new int[num_side_sets];
int *num_df_in_side_set = new int[num_side_sets];
int **side_set_elements = new int*[num_side_sets];
int **side_set_faces = new int*[num_side_sets];
//Element_Type **side_set_element_type = new Element_Type*[num_side_sets];
int **side_set_node_counter = new int*[num_side_sets];
int **side_set_nodes = new int*[num_side_sets];
double **side_set_df = new double*[num_side_sets];
for(int ict = 0;ict < num_side_sets;ict ++){
side_set_id[ict] = mss->side_set_id[ict];
}
for(int i = 0; i < num_side_sets; i++) {
std::stringstream sidesetName;
sidesetName << "Sideset-" << mss->side_set_id[i];
stk_classic::mesh::Part * sideset = mesh.getSideset(sidesetName.str());
num_elements_in_side_set[i] = mss->num_elements_in_side_set[i];
num_df_in_side_set[i] = mss->num_df_in_side_set[i];
int ne = num_elements_in_side_set[i];
side_set_elements[i] = new int[ne];
side_set_faces[i] = new int[ne];
//side_set_element_type[i] = new Element_Type[ne];
side_set_node_counter[i] = new int[ne];
side_set_df[i] = new double[num_df_in_side_set[i]];
if(ne) {
for(int nct = 0; nct < ne; nct ++){
std::vector<stk_classic::mesh::EntityId> nodes(4);
int sculpt_elem_id = mss->global_element_numbers[ mss->side_set_elements[i][nct]-1 ];
int sculpt_face_id = -1 ;
std::vector<stk_classic::mesh::Entity*> localElmts;
mesh.getMyElements(localElmts);
std::vector<stk_classic::mesh::Entity*>::const_iterator itr;
for(itr=localElmts.begin();itr!=localElmts.end();++itr) {
stk_classic::mesh::Entity * element = (*itr);
if( element->identifier() == sculpt_elem_id )
{
sculpt_face_id = mss->side_set_faces[i][nct];
stk_classic::mesh::EntityId gid = element->identifier();
stk_classic::mesh::PairIterRelation relations = element->relations(mesh.getSideRank());
stk_classic::mesh::Entity * side = getRelationByID(sculpt_face_id-1,relations)->entity();
if( side != NULL )
{
if(side->owner_rank()==machRank_)
mesh.addEntityToSideset(*side,sideset );
}
}
}
if( sculpt_face_id == -1 )
printf(" ERROR: Could not find the element id for a sideset face \n");
}
}
}
mesh.endModification();
}