当前位置: 首页>>代码示例>>C++>>正文


C++ MetaData::commit方法代码示例

本文整理汇总了C++中MetaData::commit方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::commit方法的具体用法?C++ MetaData::commit怎么用?C++ MetaData::commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetaData的用法示例。


在下文中一共展示了MetaData::commit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bulk

TEST ( UnitTestBulkData_new , testUninitializedMetaData )
{
  stk::ParallelMachine pm = MPI_COMM_WORLD;

  MetaData meta; // Construct, but do not initialize
  BulkData bulk(meta, pm);

  meta.initialize(2);

  meta.commit();

  bulk.modification_begin();

  ASSERT_THROW( bulk.declare_entity(stk::topology::NODE_RANK,
                                            1, /*id*/
                                            PartVector() ),
                        std::logic_error);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例2: test_simple_mesh

void test_simple_mesh( ParallelMachine pm , std::istream & )
{
  typedef Hexahedron<> Hex ;

  static const char method[] = "test_simple_mesh" ;

  const unsigned p_rank = parallel_machine_rank( pm );
  const unsigned p_size = parallel_machine_size( pm );

  //--------------------------------------------------------------------
  // Define a mesh mesh_meta_data: the parts and fields.

  MetaData S ;

  // Get some of the predefined parts for later use...
  Part * const owns_part = & S.locally_owned_part();
  Part * const univ_part = & S.universal_part();

  // Declare a part for the element block and side set,
  // these are automatically a subset of the universal part.

  Part * const elem_part = & S.declare_part( std::string("element_block") );
  Part * const face_part = & S.declare_part( std::string("side_set") );

  // Nodal coordinate field dimensioned to 3 everywhere in the mesh

  CoordinateField & node_coordinates =
    S.declare_field<CoordinateField>( std::string("coordinates") );

  S.put_field( node_coordinates , Node , *univ_part , 3 );
  
  // Done defining the mesh_meta_data, commit it.

  S.commit();

  //--------------------------------------------------------------------
  // Create mesh bulk data conformal to the mesh_meta_data.

  const unsigned kernel_capacity = 100 ;

  BulkData M( S , pm , kernel_capacity );

  // Define a trivial mesh, stack of hex elements
  // with one hex element per processor ordered by
  // processor rank.
  // Attach the +X face, use ExodusII element-node ordering
  // and element-face orientation.
  // Node and element identifiers must not be zero,
  // an identifier of zero is reserved for 'undefined'.

  const entity_key_type node_key[8] = {
    // Base of this processor's hex
    entity_key( Node , p_rank * 4 + 1 ) ,
    entity_key( Node , p_rank * 4 + 2 ) ,
    entity_key( Node , p_rank * 4 + 3 ) ,
    entity_key( Node , p_rank * 4 + 4 ) ,

    // Top of this processor's hex
    entity_key( Node , p_rank * 4 + 5 ) ,
    entity_key( Node , p_rank * 4 + 6 ) ,
    entity_key( Node , p_rank * 4 + 7 ) ,
    entity_key( Node , p_rank * 4 + 8 ) };

  const entity_key_type elem_key = entity_key( Element , p_rank + 1 );
  const entity_key_type face_key = entity_key( Face ,    p_rank + 1 );

  // Part membership for the elements and nodes:
  // 'owns_part'  Assume this processor owns everything it declares,
  //              will resolve parallel sharing later.

  std::vector<Part*> add_parts ;
  add_parts.push_back( owns_part );
  add_parts.push_back( elem_part );

  // Declare node and element entities:

  Entity & elem = M.declare_entity( elem_key , add_parts );

  for ( unsigned i = 0 ; i < 8 ; ++i ) {
    Entity & node = M.declare_entity( node_key[i] , add_parts );

    // Declare element <-> node relations
    // These are required to have unique identifiers
    // by providing the 'method' argument.
    // If non-unique then an exception is thrown that includes
    // the text contained in the 'method' string.

    M.declare_relation( elem , node , i );
  }

  // Declare the face entity:

  add_parts.push_back( face_part );
  
  Entity & face = M.declare_entity( face_key , add_parts );

  // Declare element <-> face relation

  M.declare_relation( elem , face , 0 );

//.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:quinoa,代码行数:101,代码来源:test_simple_mesh.cpp


注:本文中的MetaData::commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。