本文整理汇总了C++中percept::PerceptMesh::get_fem_meta_data方法的典型用法代码示例。如果您正苦于以下问题:C++ PerceptMesh::get_fem_meta_data方法的具体用法?C++ PerceptMesh::get_fem_meta_data怎么用?C++ PerceptMesh::get_fem_meta_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类percept::PerceptMesh
的用法示例。
在下文中一共展示了PerceptMesh::get_fem_meta_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: correctBlockNamesForPartPartConsistency
BlockNamesType RefinerUtil::correctBlockNamesForPartPartConsistency(percept::PerceptMesh& eMesh, BlockNamesType& blocks)
{
if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "RefinerUtil::correctBlockNamesForPartPartConsistency..." << std::endl;
if (blocks[eMesh.element_rank()].size() == 0)
return blocks;
stk_classic::mesh::EntityRank subDimRank = (eMesh.get_spatial_dim() == 3 ? eMesh.face_rank() : eMesh.edge_rank());
mesh::PartVector all_parts = eMesh.get_fem_meta_data()->get_parts();
for (mesh::PartVector::iterator i_part = all_parts.begin(); i_part != all_parts.end(); ++i_part)
{
mesh::Part * part = *i_part ;
for (mesh::PartVector::iterator i_surfacePart = all_parts.begin(); i_surfacePart != all_parts.end(); ++i_surfacePart)
{
mesh::Part * surfacePart = *i_surfacePart ;
if ( stk_classic::mesh::is_auto_declared_part(*surfacePart) )
continue;
const CellTopologyData * part_cell_topo_data = stk_classic::percept::PerceptMesh::get_cell_topology(*surfacePart);
CellTopology surf_topo(part_cell_topo_data);
//if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk surfacePart= " << surfacePart->name() << " topo= " << (part_cell_topo_data?surf_topo.getName() : "NULL") << std::endl;
if (part_cell_topo_data && part->primary_entity_rank() == eMesh.element_rank() && surfacePart->primary_entity_rank() == subDimRank)
{
std::string partNamePlus = "+" + part->name();
std::vector<std::string>::iterator partInBlocks = std::find(blocks[eMesh.element_rank()].begin(), blocks[eMesh.element_rank()].end(), partNamePlus);
// if this part is not in the blocks list, skip it
if (partInBlocks == blocks[eMesh.element_rank()].end())
{
//if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk skipping part= " << partNamePlus << std::endl;
continue;
}
std::string surfacePartNamePlus = "+" + surfacePart->name();
std::vector<std::string>::iterator surfacePartInBlocks = std::find(blocks[subDimRank].begin(), blocks[subDimRank].end(), surfacePartNamePlus);
// if this surface is already in the list, skip it
if (surfacePartInBlocks != blocks[subDimRank].end())
{
//if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk skipping surf= " << surfacePartNamePlus << std::endl;
continue;
}
bool isBoundarySurface= eMesh.isBoundarySurface(*part, *surfacePart);
if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp srk isBoundarySurface for part/surf= " << part->name() << " / " << surfacePart->name() << " = " << isBoundarySurface << std::endl;
if (isBoundarySurface)
{
if (EXTRA_PRINT_UR_GETBLOCKS) std::cout << "tmp part [" << part->name() << "] shares sideset [" << surfacePart->name() << "]" << std::endl;
blocks[subDimRank].push_back(std::string("+"+surfacePart->name()));
}
else
{
//std::cout << "tmp part [" << part->name() << "] doesn't shares sideset [" << surfacePart->name() << "]" << std::endl;
}
}
}
}
if (0) std::cout << "tmp RefinerUtil::correctBlockNamesForPartPartConsistency: blocks = " << blocks << std::endl;
return blocks;
}
示例2: selector
void Colorer::
color(percept::PerceptMesh& eMesh, unsigned * elementType, stk_classic::mesh::PartVector* fromParts, stk_classic::mesh::FieldBase *element_color_field)
{
const unsigned MAX_COLORS=1000;
vector< ColorerNodeSetType > node_colors(MAX_COLORS+1);
ColorerElementSetType all_elements;
mesh::Selector selector(eMesh.get_fem_meta_data()->universal_part());
if (fromParts)
{
if (0)
{
std::cout << "tmp Colorer::color fromParts= " << *fromParts << std::endl;
std::cout << "tmp Colorer::color elementType= " << *elementType << std::endl;
for (unsigned i_part = 0; i_part < fromParts->size(); i_part++)
{
std::cout << "tmp Colorer::color i_part = " << i_part << " fromParts= " << (*fromParts)[i_part]->name() << std::endl;
}
}
selector = mesh::selectUnion(*fromParts);
}
stk_classic::mesh::BulkData& bulkData = *eMesh.get_bulk_data();
unsigned ncolor = 0;
int nelem = 0;
unsigned num_max_colors = MAX_COLORS;
if (m_noColoring)
num_max_colors = 1;
m_element_colors = vector< ColorerSetType > (num_max_colors+1);
for (unsigned icolor = 0; icolor < num_max_colors; icolor++)
{
int num_colored_this_pass = 0;
for (unsigned irank = 0; irank < m_entityRanks.size(); irank++)
{
const vector<stk_classic::mesh::Bucket*> & buckets = bulkData.buckets( m_entityRanks[irank] );
for ( vector<stk_classic::mesh::Bucket*>::const_iterator k = buckets.begin() ; k != buckets.end() ; ++k )
{
if (selector(**k))
{
stk_classic::mesh::Bucket & bucket = **k ;
bool doThisBucket = true;
const CellTopologyData * const bucket_cell_topo_data = stk_classic::percept::PerceptMesh::get_cell_topology(bucket);
shards::CellTopology topo(bucket_cell_topo_data);
if (elementType && (topo.getKey() != *elementType))
{
doThisBucket = false;
}
if (0 && doThisBucket)
{
std::cout << "tmp color = " << icolor << " bucket topo name= " << topo.getName() << " key= " << topo.getKey()
<< " elementType= " << (elementType? *elementType : 0) << " doThisBucket= " << doThisBucket << std::endl;
}
if (doThisBucket)
{
const unsigned num_elements_in_bucket = bucket.size();
nelem += num_elements_in_bucket;
for (unsigned iElement = 0; iElement < num_elements_in_bucket; iElement++)
{
stk_classic::mesh::Entity& element = bucket[iElement];
if (0)
std::cout << "tmp color = " << icolor << " bucket topo name= " << topo.getName() << " key= " << topo.getKey()
<< " elementId = " << element.identifier() << " element = " << element << std::endl;
stk_classic::mesh::EntityId elem_id = element.identifier();
if (!m_noColoring && contains(all_elements, elem_id))
continue;
bool none_in_this_color = true;
static std::vector<stk_classic::mesh::EntityId> node_ids(100);
unsigned num_node = 0;
if (!m_noColoring)
{
const stk_classic::mesh::PairIterRelation elem_nodes = element.relations( stk_classic::mesh::fem::FEMMetaData::NODE_RANK );
num_node = elem_nodes.size();
node_ids.reserve(num_node);
for (unsigned inode=0; inode < num_node; inode++)
{
stk_classic::mesh::Entity & node = *elem_nodes[ inode ].entity();
stk_classic::mesh::EntityId nid = node.identifier();
node_ids[inode] = nid;
if (contains(node_colors[icolor], nid))
{
none_in_this_color = false;
break;
}
}
}
if (none_in_this_color)
{
++num_colored_this_pass;
//.........这里部分代码省略.........