Sierra Toolkit  Version of the Day
HexFixture.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef STK_MESH_FIXTURES_HEX_MESH_FIXTURE_HPP
10 #define STK_MESH_FIXTURES_HEX_MESH_FIXTURE_HPP
11 
12 #include <Shards_BasicTopologies.hpp>
13 
14 #include <stk_util/parallel/Parallel.hpp>
15 
16 #include <stk_mesh/base/Types.hpp>
17 #include <stk_mesh/base/MetaData.hpp>
18 #include <stk_mesh/base/BulkData.hpp>
19 #include <stk_mesh/base/Field.hpp>
20 #include <stk_mesh/base/DataTraits.hpp>
21 
22 #include <stk_mesh/fem/FEMMetaData.hpp>
23 #include <stk_mesh/fem/CoordinateSystems.hpp>
24 #include <stk_mesh/fem/TopologyDimensions.hpp>
25 
26 namespace stk_classic {
27 namespace mesh {
28 namespace fixtures {
29 
37 {
38  public:
39  typedef double Scalar ;
42 
47  HexFixture(stk_classic::ParallelMachine pm, unsigned nx, unsigned ny, unsigned nz);
48 
49  const int m_spatial_dimension;
50  const unsigned m_nx;
51  const unsigned m_ny;
52  const unsigned m_nz;
53  fem::FEMMetaData m_fem_meta;
54  BulkData m_bulk_data;
55  Part & m_hex_part;
56  Part & m_node_part;
57  CoordFieldType & m_coord_field ;
58  CoordGatherFieldType & m_coord_gather_field ;
59 
64  EntityId node_id( unsigned x , unsigned y , unsigned z ) const {
65  return 1 + x + ( m_nx + 1 ) * ( y + ( m_ny + 1 ) * z );
66  }
67 
72  EntityId elem_id( unsigned x , unsigned y , unsigned z ) const {
73  return 1 + x + m_nx * ( y + m_ny * z );
74  }
75 
80  Entity * node( unsigned x , unsigned y , unsigned z ) const {
81  return m_bulk_data.get_entity( fem::FEMMetaData::NODE_RANK , node_id(x, y, z) );
82  }
83 
89  Entity * elem( unsigned x , unsigned y , unsigned z ) const {
90  return m_bulk_data.get_entity( m_fem_meta.element_rank(), elem_id(x, y, z) );
91  }
92 
97  void node_x_y_z( EntityId entity_id, unsigned &x , unsigned &y , unsigned &z ) const;
98 
103  void elem_x_y_z( EntityId entity_id, unsigned &x , unsigned &y , unsigned &z ) const;
104 
108  void generate_mesh();
109 
110  void generate_mesh( std::vector<EntityId> & element_ids_on_this_processor );
111 
112  private:
113 
114  HexFixture();
115  HexFixture( const HexFixture &);
116  HexFixture & operator = (const HexFixture &);
117 };
118 
119 
120 } // fixtures
121 } // mesh
122 } // stk
123 #endif
FEMMetaData is a class that implements a Finite Element Method skin on top of the Sierra Tool Kit Met...
Definition: FEMMetaData.hpp:54
EntityRank element_rank() const
Returns the element rank which is always equal to spatial dimension.
EntityId elem_id(unsigned x, unsigned y, unsigned z) const
Definition: HexFixture.hpp:72
Entity * get_entity(EntityRank entity_rank, EntityId entity_id) const
Get entity with a given key.
Definition: BulkData.hpp:211
Field with defined data type and multi-dimensions (if any)
Definition: Field.hpp:118
An application-defined subset of a problem domain.
Definition: Part.hpp:49
void elem_x_y_z(EntityId entity_id, unsigned &x, unsigned &y, unsigned &z) const
Definition: HexFixture.cpp:95
Entity * elem(unsigned x, unsigned y, unsigned z) const
Definition: HexFixture.hpp:89
Manager for an integrated collection of entities, entity relations, and buckets of field data...
Definition: BulkData.hpp:49
EntityId entity_id(const EntityKey &key)
Given an entity key, return the identifier for the entity.
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
Definition: Entity.hpp:120
Sierra Toolkit.
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
EntityId node_id(unsigned x, unsigned y, unsigned z) const
Definition: HexFixture.hpp:64
void node_x_y_z(EntityId entity_id, unsigned &x, unsigned &y, unsigned &z) const
Definition: HexFixture.cpp:82
Entity * node(unsigned x, unsigned y, unsigned z) const
Definition: HexFixture.hpp:80