本文整理汇总了C++中stk::mesh::BulkData::change_entity_parts方法的典型用法代码示例。如果您正苦于以下问题:C++ BulkData::change_entity_parts方法的具体用法?C++ BulkData::change_entity_parts怎么用?C++ BulkData::change_entity_parts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stk::mesh::BulkData
的用法示例。
在下文中一共展示了BulkData::change_entity_parts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process_surface_entity
// ========================================================================
void process_surface_entity(const Ioss::SideSet* sset ,
stk::mesh::BulkData & bulk)
{
assert(sset->type() == Ioss::SIDESET);
const stk::mesh::MetaData& meta = stk::mesh::MetaData::get(bulk);
const stk::mesh::EntityRank element_rank = stk::topology::ELEMENT_RANK;
int block_count = sset->block_count();
for (int i=0; i < block_count; i++) {
Ioss::SideBlock *block = sset->get_block(i);
if (stk::io::include_entity(block)) {
std::vector<int> side_ids ;
std::vector<int> elem_side ;
stk::mesh::Part * const side_block_part = meta.get_part(block->name());
stk::mesh::EntityRank side_rank = side_block_part->primary_entity_rank();
block->get_field_data("ids", side_ids);
block->get_field_data("element_side", elem_side);
assert(side_ids.size() * 2 == elem_side.size());
stk::mesh::PartVector add_parts( 1 , side_block_part );
size_t side_count = side_ids.size();
std::vector<stk::mesh::Entity> sides(side_count);
for(size_t is=0; is<side_count; ++is) {
stk::mesh::Entity const elem = bulk.get_entity(element_rank, elem_side[is*2]);
// If NULL, then the element was probably assigned to an
// element block that appears in the database, but was
// subsetted out of the analysis mesh. Only process if
// non-null.
if (bulk.is_valid(elem)) {
// Ioss uses 1-based side ordinal, stk::mesh uses 0-based.
// Hence the '-1' in the following line.
int side_ordinal = elem_side[is*2+1] - 1 ;
stk::mesh::Entity side = stk::mesh::Entity();
if (side_rank == 2) {
side = stk::mesh::declare_element_side(bulk, side_ids[is], elem, side_ordinal);
} else {
side = stk::mesh::declare_element_edge(bulk, side_ids[is], elem, side_ordinal);
}
bulk.change_entity_parts( side, add_parts );
sides[is] = side;
} else {
sides[is] = stk::mesh::Entity();
}
}
const stk::mesh::FieldBase *df_field = stk::io::get_distribution_factor_field(*side_block_part);
if (df_field != NULL) {
stk::io::field_data_from_ioss(bulk, df_field, sides, block, "distribution_factors");
}
}
}
}
示例2: deactivate_elements
inline void deactivate_elements(const stk::mesh::EntityVector &deactivated_elems, stk::mesh::BulkData &bulkData, stk::mesh::Part& active)
{
bulkData.modification_begin();
for(size_t i = 0; i < deactivated_elems.size(); ++i)
{
bulkData.change_entity_parts(deactivated_elems[i], stk::mesh::PartVector(), stk::mesh::PartVector(1, &active));
}
bulkData.modification_end();
}
示例3: addNodesToPart
void addNodesToPart(
const Teuchos::ArrayView<const stk::mesh::EntityId> &nodeIds,
stk::mesh::Part &samplePart,
stk::mesh::BulkData& bulkData)
{
const stk::mesh::PartVector samplePartVec(1, &samplePart);
const stk::mesh::Selector locallyOwned = stk::mesh::MetaData::get(bulkData).locally_owned_part();
BulkModification mod(bulkData);
typedef Teuchos::ArrayView<const stk::mesh::EntityId>::const_iterator Iter;
for (Iter it = nodeIds.begin(), it_end = nodeIds.end(); it != it_end; ++it) {
stk::mesh::Entity node = bulkData.get_entity(stk::topology::NODE_RANK, *it);
if (bulkData.is_valid(node) && locallyOwned(bulkData.bucket(node))) {
bulkData.change_entity_parts(node, samplePartVec);
}
}
}
示例4: addNodesToPart
void addNodesToPart(
const Teuchos::ArrayView<const stk::mesh::EntityId> &nodeIds,
stk::mesh::Part &samplePart,
stk::mesh::BulkData& bulkData)
{
const stk::mesh::EntityRank nodeEntityRank(0);
const stk::mesh::PartVector samplePartVec(1, &samplePart);
const stk::mesh::Selector locallyOwned = stk::mesh::MetaData::get(bulkData).locally_owned_part();
BulkModification mod(bulkData);
typedef Teuchos::ArrayView<const stk::mesh::EntityId>::const_iterator Iter;
for (Iter it = nodeIds.begin(), it_end = nodeIds.end(); it != it_end; ++it) {
const Teuchos::Ptr<stk::mesh::Entity> node(bulkData.get_entity(nodeEntityRank, *it));
if (Teuchos::nonnull(node) && locallyOwned(*node)) {
bulkData.change_entity_parts(*node, samplePartVec);
}
}
}