本文整理汇总了C++中stk::mesh::BulkData::get_buckets方法的典型用法代码示例。如果您正苦于以下问题:C++ BulkData::get_buckets方法的具体用法?C++ BulkData::get_buckets怎么用?C++ BulkData::get_buckets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stk::mesh::BulkData
的用法示例。
在下文中一共展示了BulkData::get_buckets方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_mesh_indices
void setup_mesh_indices(const stk::mesh::BulkData& bulk, const stk::mesh::Selector& selector)
{
const stk::mesh::BucketVector& nodeBuckets = bulk.buckets(stk::topology::NODE_RANK);
meshIndices = DeviceViewMeshIndicesType("DMeshIndices", bulk.get_size_of_entity_index_space());
constMeshIndices = meshIndices;
hostMeshIndices = Kokkos::create_mirror_view(meshIndices);
for(unsigned bktIndex = 0; bktIndex < nodeBuckets.size(); ++bktIndex)
{
const stk::mesh::Bucket& bucket = *nodeBuckets[bktIndex];
for(unsigned nodeIndex = 0; nodeIndex < bucket.size(); ++nodeIndex)
{
stk::mesh::Entity node = bucket[nodeIndex];
stk::mesh::FastMeshIndex meshIndex(bucket.bucket_id(), nodeIndex);
hostMeshIndices(node.local_offset()) = meshIndex;
}
}
const stk::mesh::BucketVector& elemBuckets = bulk.get_buckets(stk::topology::ELEM_RANK, selector);
for(unsigned bktIndex = 0; bktIndex < elemBuckets.size(); ++bktIndex)
{
const stk::mesh::Bucket& bucket = *elemBuckets[bktIndex];
for(unsigned elemIndex = 0; elemIndex < bucket.size(); ++elemIndex)
{
stk::mesh::Entity elem = bucket[elemIndex];
stk::mesh::FastMeshIndex meshIndex(bucket.bucket_id(), elemIndex);
hostMeshIndices(elem.local_offset()) = meshIndex;
}
}
Kokkos::deep_copy(meshIndices, hostMeshIndices);
}
示例2: do_stk_node_rel_test
//This very simple test will visit all local elements and traverse the
//element's node relations. It will return the number of nodes visited.
//The purpose of this test is to stress the relation-traversal for a
//performance test.
size_t do_stk_node_rel_test(stk::mesh::BulkData& bulk)
{
using namespace stk::mesh;
MetaData& meta = MetaData::get(bulk);
Selector local = meta.locally_owned_part();
BucketVector const& buckets = bulk.get_buckets(stk::topology::ELEMENT_RANK, local);
size_t nodes_visited = 0;
unsigned owner_rank = 0;
size_t num_elems = 0;
for(size_t ib=0; ib<buckets.size(); ++ib) {
const Bucket& b = *buckets[ib];
num_elems += b.size();
for(size_t i=0; i<b.size(); ++i) {
Entity const *node_itr = b.begin_nodes(i);
Entity const *nodes_end = b.end_nodes(i);
for (; node_itr != nodes_end; ++node_itr)
{
Entity node = *node_itr;
owner_rank += bulk.parallel_owner_rank(node);
++nodes_visited;
}
}
}
return nodes_visited;
}
示例3: setup_element_centroids
void setup_element_centroids(const stk::mesh::BulkData& bulk, const stk::mesh::Selector& selector)
{
const stk::mesh::BucketVector& elemBuckets = bulk.get_buckets(stk::topology::ELEM_RANK, selector);
bucketCapacity = elemBuckets[0]->capacity();
unsigned elemAllocSize = elemBuckets.size()*bucketCapacity;
elementCentroids = DeviceViewAtomicMatrixType("DElemCentroids", elemAllocSize, bulk.mesh_meta_data().spatial_dimension());
hostElementCentroids = Kokkos::create_mirror_view(elementCentroids);
}
示例4: put_mesh_into_part
void put_mesh_into_part(stk::mesh::BulkData& bulkData, stk::mesh::Part& part)
{
stk::mesh::EntityVector entitiesToMakeActive;
std::vector<stk::mesh::PartVector> add_parts;
std::vector<stk::mesh::PartVector> rm_parts;
for(stk::topology::rank_t rank=stk::topology::BEGIN_RANK; rank < bulkData.mesh_meta_data().entity_rank_count(); rank++)
{
const stk::mesh::BucketVector &buckets = bulkData.get_buckets(rank, bulkData.mesh_meta_data().locally_owned_part());
for(const stk::mesh::Bucket *bucket : buckets)
{
for(stk::mesh::Entity entity : *bucket)
{
entitiesToMakeActive.push_back(entity);
add_parts.push_back(stk::mesh::PartVector(1, &part));
rm_parts.push_back(stk::mesh::PartVector());
}
}
}
bulkData.batch_change_entity_parts(entitiesToMakeActive, add_parts, rm_parts);
}
示例5: setup_elem_entities_and_connectivity_tables
void setup_elem_entities_and_connectivity_tables(const stk::mesh::BulkData& bulk, const stk::mesh::Selector& selector)
{
const stk::mesh::BucketVector& elementBuckets = bulk.get_buckets(stk::topology::ELEM_RANK, selector);
unsigned numElementBuckets = elementBuckets.size();
connBucketOffsets = DeviceViewIntType("D_connBucketOffsets", numElementBuckets);
hostConnBucketOffsets = Kokkos::create_mirror_view(connBucketOffsets);
elemBucketOffsets = DeviceViewIntType("D_elemBucketOffsets", numElementBuckets);
hostElemBucketOffsets = Kokkos::create_mirror_view(elemBucketOffsets);
elemsPerBucket = DeviceViewIntType("D_elemsPerBucket", numElementBuckets);
hostElemsPerBucket = Kokkos::create_mirror_view(elemsPerBucket);
nodesPerElement = DeviceViewIntType("D_nodesPerElement", numElementBuckets);
hostNodesPerElement = Kokkos::create_mirror_view(nodesPerElement);
unsigned numConnectivities = 0;
unsigned numElements = 0;
for (unsigned elemBucketIndex = 0; elemBucketIndex < numElementBuckets; ++elemBucketIndex)
{
const stk::mesh::Bucket& bucket = *elementBuckets[elemBucketIndex];
unsigned numNodesPerElem = bucket.topology().num_nodes();
unsigned numElemsInBucket = bucket.size();
hostConnBucketOffsets(elemBucketIndex) = numConnectivities;
hostElemBucketOffsets(elemBucketIndex) = numElements;
hostNodesPerElement(elemBucketIndex) = numNodesPerElem;
hostElemsPerBucket(elemBucketIndex) = numElemsInBucket;
numConnectivities += numNodesPerElem*numElemsInBucket;
numElements += numElemsInBucket;
}
Kokkos::deep_copy(elemsPerBucket, hostElemsPerBucket);
Kokkos::deep_copy(nodesPerElement, hostNodesPerElement);
Kokkos::deep_copy(connBucketOffsets, hostConnBucketOffsets);
Kokkos::deep_copy(elemBucketOffsets, hostElemBucketOffsets);
elementNodeConnectivity = DeviceViewFlatConnectivityType("DElementNodeConnectivity", numConnectivities);
hostElementNodeConnectivity = Kokkos::create_mirror_view(elementNodeConnectivity);
elemEntities = DeviceViewEntitiesType("DElemEntities", numElements);
hostElemEntities = Kokkos::create_mirror_view(elemEntities);
for (unsigned elemBucketIndex = 0; elemBucketIndex < numElementBuckets; ++elemBucketIndex)
{
unsigned connBucketOffset = hostConnBucketOffsets(elemBucketIndex);
unsigned elemBucketOffset = hostElemBucketOffsets(elemBucketIndex);
const stk::mesh::Bucket& bucket = *elementBuckets[elemBucketIndex];
unsigned nodesPerElem = bucket.topology().num_nodes();
for(unsigned elemIndex = 0; elemIndex < bucket.size(); ++elemIndex)
{
unsigned connElemOffset = elemIndex*nodesPerElem + connBucketOffset;
stk::mesh::Entity element = bucket[elemIndex];
hostElemEntities(elemBucketOffset + elemIndex) = element;
const stk::mesh::Entity * elemNodes = bulk.begin_nodes(element);
for(unsigned iNode = 0; iNode < nodesPerElem; ++iNode)
{
unsigned nodeOffset = connElemOffset + iNode;
hostElementNodeConnectivity(nodeOffset) = elemNodes[iNode];
}
}
}
Kokkos::deep_copy(elementNodeConnectivity, hostElementNodeConnectivity);
Kokkos::deep_copy(elemEntities, hostElemEntities);
}