Exemplo n.º 1
0
GearFields::GearFields( stk::mesh::MetaData & S )
  : gear_coord(          S.declare_field<CylindricalField>(stk::topology::NODE_RANK, std::string("gear_coordinates") ) ),
    model_coord(         S.declare_field<CartesianField>(stk::topology::NODE_RANK, std::string("coordinates") ) )
{
  const stk::mesh::Part & universe = S.universal_part();

  stk::mesh::put_field( gear_coord    , universe , SpatialDimension );
  stk::mesh::put_field( model_coord   , universe , SpatialDimension );
}
Exemplo n.º 2
0
// ========================================================================
void process_nodeblocks(Ioss::Region &region, stk::mesh::MetaData &meta)
{
    const Ioss::NodeBlockContainer& node_blocks = region.get_node_blocks();
    assert(node_blocks.size() == 1);

    Ioss::NodeBlock *nb = node_blocks[0];

    assert(nb->field_exists("mesh_model_coordinates"));
    Ioss::Field coordinates = nb->get_field("mesh_model_coordinates");
    int spatial_dim = coordinates.transformed_storage()->component_count();

    stk::mesh::Field<double,stk::mesh::Cartesian> & coord_field =
        meta.declare_field<stk::mesh::Field<double,stk::mesh::Cartesian> >(stk::topology::NODE_RANK, "coordinates");

    stk::mesh::put_field( coord_field, meta.universal_part(),
                          spatial_dim);

    /** \todo IMPLEMENT truly handle fields... For this case we are
     * just defining a field for each transient field that is present
     * in the mesh...
     */
    stk::io::define_io_fields(nb, Ioss::Field::TRANSIENT, meta.universal_part(),stk::topology::NODE_RANK);
}
Exemplo n.º 3
0
void heterogeneous_mesh_meta_data(
  stk::mesh::MetaData & meta_data ,
  const VectorFieldType & node_coord )
{
  stk::mesh::Part & universal        = meta_data.universal_part();
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("hexes", stk::topology::HEX_8));
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("wedges", stk::topology::WEDGE_6));
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("tets", stk::topology::TET_4));
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("pyramids", stk::topology::PYRAMID_5));
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("quad_shells", stk::topology::SHELL_QUAD_4));
  stk::io::put_io_part_attribute(meta_data.declare_part_with_topology("tri_shells", stk::topology::SHELL_TRI_3));
  
  const stk::mesh::FieldBase::Restriction & res =
    stk::mesh::find_restriction(node_coord, stk::topology::NODE_RANK , universal );

  if ( res.num_scalars_per_entity() != 3 ) {
    std::ostringstream msg ;
    msg << "stk_mesh/unit_tests/heterogenous_mesh_meta_data FAILED, coordinate dimension must be 3 != " << res.num_scalars_per_entity() ;
    throw std::runtime_error( msg.str() );
  }
}