本文整理汇总了C++中PartVector::end方法的典型用法代码示例。如果您正苦于以下问题:C++ PartVector::end方法的具体用法?C++ PartVector::end怎么用?C++ PartVector::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartVector
的用法示例。
在下文中一共展示了PartVector::end方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sort_and_unique
void sort_and_unique( PartVector & partVector )
{
PartVector::iterator begin = partVector.begin();
PartVector::iterator end = partVector.end();
std::sort( begin , end , PartLess() );
PartVector::iterator new_end = std::unique( begin , end );
partVector.erase( new_end , end );
}
示例2: contain
bool contain( const PartVector & v , const Part & part )
{
const PartVector::const_iterator e = v.end();
PartVector::const_iterator i = v.begin();
i = std::lower_bound( i , e , part , PartLess() );
return i != e && *i == & part ;
}
示例3: 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() ;
}
示例4: remove
void remove( PartVector & v , Part & part )
{
const PartVector::iterator e = v.end();
PartVector::iterator i = v.begin();
i = std::lower_bound( i , e , part , PartLess() );
if ( i != e && *i == & part ) { v.erase( i ); }
}
示例5: add_parts_to_partset
void Transaction::add_parts_to_partset ( Entity &e , PartSet &pl )
{
PartVector parts;
e.bucket().supersets ( parts );
for ( PartVector::iterator part_iter = parts.begin(); part_iter != parts.end() ; ++part_iter )
pl.insert ( *part_iter );
}
示例6: insert
bool insert( PartVector & v , Part & part )
{
const PartVector::iterator e = v.end();
PartVector::iterator i = v.begin();
i = std::lower_bound( i , e , part , PartLess() );
const bool new_member = i == e || *i != & part ;
if ( new_member ) { v.insert( i , &part ); }
return new_member ;
}
示例7: 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 ;
}
示例8:
std::ostream & operator << ( std::ostream & s , const Bucket & k )
{
const MetaData & mesh_meta_data = k.mesh().mesh_meta_data();
const std::string & entity_name =
mesh_meta_data.entity_rank_names()[ k.entity_rank() ];
PartVector parts ; k.supersets( parts );
s << "Bucket( " << entity_name << " : " ;
for ( PartVector::iterator i = parts.begin() ; i != parts.end() ; ++i ) {
s << (*i)->name() << " " ;
}
s << ")" ;
return s ;
}
示例9: member_any
bool Bucket::member_any( const PartVector & parts ) const
{
const unsigned * const i_beg = key() + 1 ;
const unsigned * const i_end = key() + key()[0] ;
const PartVector::const_iterator ip_end = parts.end();
PartVector::const_iterator ip = parts.begin() ;
bool result_none = true ;
for ( ; result_none && ip_end != ip ; ++ip ) {
const unsigned ord = (*ip)->mesh_meta_data_ordinal();
const unsigned * const i = std::lower_bound( i_beg , i_end , ord );
result_none = i_end == i || ord != *i ;
}
return ! result_none ;
}
示例10: internal_verify_change_parts
void BulkData::internal_verify_change_parts( const MetaData & meta ,
const Entity & entity ,
const PartVector & parts ) const
{
const std::vector<std::string> & rank_names = meta.entity_rank_names();
const EntityRank undef_rank = InvalidEntityRank;
const EntityRank entity_rank = entity.entity_rank();
bool ok = true ;
std::ostringstream msg ;
for ( PartVector::const_iterator
i = parts.begin() ; i != parts.end() ; ++i ) {
const Part * const p = *i ;
const unsigned part_rank = p->primary_entity_rank();
bool intersection_ok, rel_target_ok, rank_ok;
internal_basic_part_check(p, entity_rank, undef_rank, intersection_ok, rel_target_ok, rank_ok);
if ( !intersection_ok || !rel_target_ok || !rank_ok ) {
if ( ok ) {
ok = false ;
msg << "change parts for entity " << print_entity_key( entity );
msg << " , { " ;
}
else {
msg << " , " ;
}
msg << p->name() << "[" ;
if ( part_rank < rank_names.size() ) {
msg << rank_names[ part_rank ];
}
else {
msg << part_rank ;
}
msg << "] " ;
if ( !intersection_ok ) { msg << "is_intersection " ; }
if ( !rel_target_ok ) { msg << "is_relation_target " ; }
if ( !rank_ok ) { msg << "is_bad_rank " ; }
}
}
ThrowErrorMsgIf( !ok, msg.str() << "}" );
}
示例11: has_superset
bool has_superset( const Bucket & bucket , const PartVector & ps )
{
const std::pair<const unsigned *, const unsigned *>
part_ord = bucket.superset_part_ordinals();
bool result = ! ps.empty();
for ( PartVector::const_iterator
i = ps.begin() ; result && i != ps.end() ; ++i ) {
const unsigned ordinal = (*i)->mesh_meta_data_ordinal();
const unsigned * iter =
std::lower_bound( part_ord.first , part_ord.second , ordinal );
result = iter < part_ord.second && ordinal == *iter ;
}
return result ;
}
示例12: internal_propagate_part_changes
void BulkData::internal_propagate_part_changes(
Entity & entity ,
const PartVector & removed )
{
const unsigned etype = entity.entity_rank();
PairIterRelation rel = entity.relations();
for ( ; ! rel.empty() ; ++rel ) {
const unsigned rel_type = rel->entity_rank();
const unsigned rel_ident = rel->identifier();
if ( rel_type < etype ) { // a 'to' entity
Entity & e_to = * rel->entity();
PartVector to_del , to_add , empty ;
// Induce part membership from this relationship to
// pick up any additions.
induced_part_membership( entity, empty,
rel_type, rel_ident, to_add );
if ( ! removed.empty() ) {
// Something was removed from the 'from' entity,
// deduce what may have to be removed from the 'to' entity.
// Deduce parts for 'e_to' from all upward relations.
// Any non-parallel part that I removed that is not deduced for
// 'e_to' must be removed from 'e_to'
for ( PairIterRelation
to_rel = e_to.relations(); ! to_rel.empty() ; ++to_rel ) {
if ( e_to.entity_rank() < to_rel->entity_rank() &&
& entity != to_rel->entity() /* Already did this entity */ ) {
// Relation from to_rel->entity() to e_to
induced_part_membership( * to_rel->entity(), empty,
e_to.entity_rank(),
to_rel->identifier(),
to_add );
}
}
for ( PartVector::const_iterator
j = removed.begin() ; j != removed.end() ; ++j ) {
if ( ! contain( to_add , **j ) ) {
induced_part_membership( **j, etype, rel_type, rel_ident, to_del );
}
}
}
if ( parallel_size() < 2 || e_to.sharing().empty() ) {
// Entirely local, ok to remove memberships now
internal_change_entity_parts( e_to , to_add , to_del );
}
else {
// Shared, do not remove memberships now.
// Wait until modification_end.
internal_change_entity_parts( e_to , to_add , empty );
}
set_field_relations( entity, e_to, rel_ident );
}
else if ( etype < rel_type ) { // a 'from' entity
Entity & e_from = * rel->entity();
set_field_relations( e_from, entity, rel_ident );
}
}
}
示例13: add_node_parts
void add_node_parts(Iterator itr, size_t num)
{
ThrowRequire(!m_meta.is_commit());
m_node_parts.insert(m_node_parts.end(), itr, itr + num);
}