本文整理汇总了C++中MetaData::put_field方法的典型用法代码示例。如果您正苦于以下问题:C++ MetaData::put_field方法的具体用法?C++ MetaData::put_field怎么用?C++ MetaData::put_field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaData
的用法示例。
在下文中一共展示了MetaData::put_field方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
//.........这里部分代码省略.........