本文整理汇总了C++中PartVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PartVector::size方法的具体用法?C++ PartVector::size怎么用?C++ PartVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartVector
的用法示例。
在下文中一共展示了PartVector::size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectIntersection
Selector selectIntersection( const PartVector& intersection_part_vector )
{
Selector selector;
if (intersection_part_vector.size() > 0) {
selector = *intersection_part_vector[0];
for (unsigned i = 1 ; i < intersection_part_vector.size() ; ++i) {
selector &= *intersection_part_vector[i];
}
}
return selector;
}
示例2: contain
bool contain( const PartVector & super , const PartVector & sub )
{
bool result = ( ! sub.empty() ) && ( sub.size() <= super.size() );
if ( result ) {
PartLess comp ;
const PartVector::const_iterator ev = super.end();
PartVector::const_iterator iv = super.begin();
const PartVector::const_iterator ep = sub.end();
PartVector::const_iterator ip = sub.begin();
while ( result && ip != ep ) {
Part * const q = *ip ; ++ip ;
iv = std::lower_bound( iv , ev , q , comp );
result = iv != ev && *iv == q ;
}
}
return result ;
}
示例3: copy_ids
void copy_ids( std::vector<unsigned> & v , const PartVector & p )
{
{
const size_t n = p.size();
v.resize( n );
for ( size_t k = 0 ; k < n ; ++k ) {
v[k] = p[k]->mesh_meta_data_ordinal();
}
}
{
std::vector<unsigned>::iterator i = v.begin() , j = v.end();
std::sort( i , j );
i = std::unique( i , j );
v.erase( i , j );
}
}
示例4: intersect
size_t intersect( const PartVector & v , const PartVector & p , PartVector & r )
{
// Both lists must be sorted, assume v.size() > p.size()
const PartVector::const_iterator ev = v.end();
PartVector::const_iterator iv = v.begin();
const PartVector::const_iterator ep = p.end();
PartVector::const_iterator ip = p.begin();
for ( ; ip != ep && iv != ev ; ++ip ) {
Part * const q = *ip ;
iv = std::lower_bound( iv , ev , q , PartLess() );
if ( iv != ev && *iv == q ) { r.push_back( q ); }
}
return r.size() ;
}
示例5: get_involved_parts
void get_involved_parts(
const PartVector & union_parts,
const Bucket & candidate,
PartVector & involved_parts
)
{
involved_parts.clear();
if (union_parts.size() == 0) {
return;
}
// Used to convert part ordinals to part pointers:
MetaData & meta_data = MetaData::get( * union_parts[0]);
const PartVector & all_parts = meta_data.get_parts();
const std::pair<const unsigned *,const unsigned *>
bucket_part_begin_end_iterators = candidate.superset_part_ordinals(); // sorted and unique
std::vector<unsigned> union_parts_ids;
copy_ids( union_parts_ids , union_parts ); // sorted and unique
std::vector<unsigned>::const_iterator union_part_id_it = union_parts_ids.begin();
const unsigned * bucket_part_id_it = bucket_part_begin_end_iterators.first ;
while ( union_part_id_it != union_parts_ids.end() &&
bucket_part_id_it != bucket_part_begin_end_iterators.second )
{
if ( *union_part_id_it < *bucket_part_id_it ) {
++union_part_id_it ;
}
else if ( *bucket_part_id_it < *union_part_id_it ) {
++bucket_part_id_it ;
}
else {
// Find every match:
Part * const part = all_parts[ *union_part_id_it ];
involved_parts.push_back( part );
++union_part_id_it;
++bucket_part_id_it;
}
}
}
示例6: internal_change_entity_parts
void BulkData::internal_change_entity_parts(
Entity & entity ,
const PartVector & add_parts ,
const PartVector & remove_parts )
{
TraceIfWatching("stk_classic::mesh::BulkData::internal_change_entity_parts", LOG_ENTITY, entity.key());
DiagIfWatching(LOG_ENTITY, entity.key(), "entity state: " << entity);
DiagIfWatching(LOG_ENTITY, entity.key(), "add_parts: " << add_parts);
DiagIfWatching(LOG_ENTITY, entity.key(), "remove_parts: " << remove_parts);
Bucket * const k_old = m_entity_repo.get_entity_bucket( entity );
const unsigned i_old = entity.bucket_ordinal() ;
if ( k_old && k_old->member_all( add_parts ) &&
! k_old->member_any( remove_parts ) ) {
// Is already a member of all add_parts,
// is not a member of any remove_parts,
// thus nothing to do.
return ;
}
PartVector parts_removed ;
OrdinalVector parts_total ; // The final part list
//--------------------------------
if ( k_old ) {
// Keep any of the existing bucket's parts
// that are not a remove part.
// This will include the 'intersection' parts.
//
// These parts are properly ordered and unique.
const std::pair<const unsigned *, const unsigned*>
bucket_parts = k_old->superset_part_ordinals();
const unsigned * parts_begin = bucket_parts.first;
const unsigned * parts_end = bucket_parts.second;
const unsigned num_bucket_parts = parts_end - parts_begin;
parts_total.reserve( num_bucket_parts + add_parts.size() );
parts_total.insert( parts_total.begin(), parts_begin , parts_end);
if ( !remove_parts.empty() ) {
parts_removed.reserve(remove_parts.size());
filter_out( parts_total , remove_parts , parts_removed );
}
}
else {
parts_total.reserve(add_parts.size());
}
if ( !add_parts.empty() ) {
merge_in( parts_total , add_parts );
}
if ( parts_total.empty() ) {
// Always a member of the universal part.
const unsigned univ_ord =
m_mesh_meta_data.universal_part().mesh_meta_data_ordinal();
parts_total.push_back( univ_ord );
}
//--------------------------------
// Move the entity to the new bucket.
Bucket * k_new =
m_bucket_repository.declare_bucket(
entity.entity_rank(),
parts_total.size(),
& parts_total[0] ,
m_mesh_meta_data.get_fields()
);
// If changing buckets then copy its field values from old to new bucket
if ( k_old ) {
m_bucket_repository.copy_fields( *k_new , k_new->size() , *k_old , i_old );
}
else {
m_bucket_repository.initialize_fields( *k_new , k_new->size() );
}
// Set the new bucket
m_entity_repo.change_entity_bucket( *k_new, entity, k_new->size() );
m_bucket_repository.add_entity_to_bucket( entity, *k_new );
// If changing buckets then remove the entity from the bucket,
if ( k_old && k_old->capacity() > 0) { m_bucket_repository.remove_entity( k_old , i_old ); }
// Update the change counter to the current cycle.
m_entity_repo.set_entity_sync_count( entity, m_sync_count );
// Propagate part changes through the entity's relations.
internal_propagate_part_changes( entity , parts_removed );
#ifndef NDEBUG
//.........这里部分代码省略.........