Sierra Toolkit  Version of the Day
QuadFixture.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_QUAD_MESH_FIXTURE_HPP
10 #define STK_MESH_FIXTURES_QUAD_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/CoordinateSystems.hpp>
23 #include <stk_mesh/fem/TopologyDimensions.hpp>
24 #include <stk_mesh/fem/FEMMetaData.hpp>
25 
26 namespace stk_classic {
27 namespace mesh {
28 namespace fixtures {
29 
37 {
38  public:
39  typedef int Scalar ;
42 
47  QuadFixture( stk_classic::ParallelMachine pm, unsigned nx , unsigned ny );
48 
49  ~QuadFixture() {}
50 
51  const unsigned m_spatial_dimension;
52  fem::FEMMetaData m_fem_meta ;
53  BulkData m_bulk_data ;
54  Part & m_quad_part ;
55  CoordFieldType & m_coord_field ;
56  CoordGatherFieldType & m_coord_gather_field ;
57  const unsigned m_nx ;
58  const unsigned m_ny ;
59 
64  EntityId node_id( unsigned x , unsigned y ) const
65  { return 1 + x + ( m_nx + 1 ) * y ; }
66 
71  EntityId elem_id( unsigned x , unsigned y ) const
72  { return 1 + x + m_nx * y ; }
73 
79  Entity * node( unsigned x , unsigned y ) const
80  { return m_bulk_data.get_entity( fem::FEMMetaData::NODE_RANK , node_id(x, y) ); }
81 
87  Entity * elem( unsigned x , unsigned y ) const
88  { return m_bulk_data.get_entity( m_fem_meta.element_rank(), elem_id(x, y)); }
89 
94  void node_x_y( EntityId entity_id, unsigned &x , unsigned &y ) const;
95 
100  void elem_x_y( EntityId entity_id, unsigned &x , unsigned &y ) const;
101 
105  void generate_mesh();
106 
107  private:
108  void generate_mesh( std::vector<EntityId> & element_ids_on_this_processor );
109 
110  QuadFixture();
111  QuadFixture( const QuadFixture & );
112  QuadFixture & operator = ( const QuadFixture & );
113 };
114 
115 } // fixtures
116 } // mesh
117 } // stk
118 #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.
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
EntityId elem_id(unsigned x, unsigned y) const
Definition: QuadFixture.hpp:71
Entity * node(unsigned x, unsigned y) const
Definition: QuadFixture.hpp:79
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.
void node_x_y(EntityId entity_id, unsigned &x, unsigned &y) const
Definition: QuadFixture.cpp:68
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
void elem_x_y(EntityId entity_id, unsigned &x, unsigned &y) const
Definition: QuadFixture.cpp:78
Entity * elem(unsigned x, unsigned y) const
Definition: QuadFixture.hpp:87
EntityId node_id(unsigned x, unsigned y) const
Definition: QuadFixture.hpp:64