Пример #1
0
void process_input_request(Ioss::Region &region,
                           stk::mesh::BulkData &bulk,
                           int step)
{
    region.begin_state(step);

    // Special processing for nodeblock (all nodes in model)...
    const stk::mesh::MetaData& meta = stk::mesh::MetaData::get(bulk);

    // ??? Get field data from nodeblock...
    get_field_data(bulk, meta.universal_part(), stk::topology::NODE_RANK,
                   region.get_node_blocks()[0], Ioss::Field::TRANSIENT);

    const stk::mesh::PartVector & all_parts = meta.get_parts();
    for ( stk::mesh::PartVector::const_iterator
            ip = all_parts.begin(); ip != all_parts.end(); ++ip ) {

        stk::mesh::Part * const part = *ip;

        const stk::mesh::EntityRank part_rank = part->primary_entity_rank();

        // Check whether this part should be output to results database.
        if (stk::io::is_part_io_part(*part)) {
            // Get Ioss::GroupingEntity corresponding to this part...
            Ioss::GroupingEntity *entity = region.get_entity(part->name());
            if (entity != NULL) {
                if (entity->type() == Ioss::SIDESET) {
                    Ioss::SideSet *sset = dynamic_cast<Ioss::SideSet*>(entity);
                    assert(sset != NULL);
                    int block_count = sset->block_count();
                    for (int i=0; i < block_count; i++) {
                        Ioss::SideBlock *side_block = sset->get_block(i);
                        /// \todo REFACTOR Need filtering mechanism.
                        get_field_data(bulk, *part,
                                       part_rank,
                                       side_block, Ioss::Field::TRANSIENT);
                    }
                } else {
                    get_field_data(bulk, *part,
                                   part_rank,
                                   entity, Ioss::Field::TRANSIENT);
                }
            } else {
                /// \todo IMPLEMENT handle error... Possibly an assert since
                /// I think the corresponding entity should always exist...
            }
        }
    }

    region.end_state(step);
}