void printNode(std::ostringstream& msg, Entity *node)
{
  printEntity(msg, node);
  PairIterRelation rels = node->relations();
  for (unsigned i = 0; i < rels.size(); i++)
    {
      Entity *entity = rels[i].entity();
      if (entity->entity_rank() > node->entity_rank())
        printEntity(msg, entity);
    }
}
Esempio n. 2
0
bool gather_field_data( const field_type & field ,
                        const Entity     & entity ,
                        typename FieldTraits< field_type >::data_type * dst )
{
  typedef typename FieldTraits< field_type >::data_type T ;

  PairIterRelation rel = entity.relations( EType );

  bool result = NRel == (unsigned) rel.size();

  if ( result ) {
    T * const dst_end = dst + NType * NRel ;
    for ( const T * src ;
          ( dst < dst_end ) &&
          ( src = field_data( field , * rel->entity() ) ) ;
          ++rel , dst += NType ) {
      Copy<NType>( dst , src );
    }
    result = dst == dst_end ;
  }
  return result ;
}
Esempio n. 3
0
void pack_entity_info( CommBuffer & buf , const Entity & entity )
{
  const EntityKey & key   = entity.key();
  const unsigned    owner = entity.owner_rank();
  const std::pair<const unsigned *, const unsigned *>
    part_ordinals = entity.bucket().superset_part_ordinals();
  const PairIterRelation relations = entity.relations();

  const unsigned nparts = part_ordinals.second - part_ordinals.first ;
  const unsigned nrel   = relations.size();

  buf.pack<EntityKey>( key );
  buf.pack<unsigned>( owner );
  buf.pack<unsigned>( nparts );
  buf.pack<unsigned>( part_ordinals.first , nparts );
  buf.pack<unsigned>( nrel );

  for ( unsigned i = 0 ; i < nrel ; ++i ) {
    buf.pack<EntityKey>( relations[i].entity()->key() );
    buf.pack<unsigned>( relations[i].identifier() );
    buf.pack<unsigned>( relations[i].attribute() );
  }
}