Sierra Toolkit  Version of the Day
Gear.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_GEAR_HPP
10 #define STK_MESH_FIXTURES_GEAR_HPP
11 
12 #include <vector>
13 #include <stk_mesh/base/Types.hpp>
14 #include <stk_mesh/base/MetaData.hpp>
15 #include <stk_mesh/base/BulkData.hpp>
16 #include <stk_mesh/base/Field.hpp>
17 
18 #include <stk_mesh/fem/FEMMetaData.hpp>
19 #include <stk_mesh/fem/CoordinateSystems.hpp>
20 #include <stk_mesh/fem/TopologyDimensions.hpp>
21 
22 namespace {
23 
24 const double PI = 3.14159265358979;
25 const double TWO_PI = 2 * PI;
26 
27 } // namespace
28 
29 
30 namespace stk_classic {
31 namespace mesh {
32 namespace fixtures {
33 
39 {
40  double rotation;
41  double x;
42  double y;
43  double z;
44 
46  double arg_rotation = 0.0,
47  double arg_x = 0.0,
48  double arg_y = 0.0,
49  double arg_z = 0.0
50  ) :
51  rotation(arg_rotation)
52  , x(arg_x)
53  , y(arg_y)
54  , z(arg_z)
55  {}
56 };
57 
58 class Gear {
59 
60  typedef Field< double ,Cartesian> CartesianField ;
61  typedef Field< double ,Cylindrical> CylindricalField ;
62 
63  enum { SpatialDimension = 3 };
64 
65  public:
66  Gear(
67  fem::FEMMetaData & meta,
68  BulkData & bulk,
69  Part & gear,
70  Part & cylindrical_coord,
71  Part & hex,
72  Part & wedge,
73  CartesianField & arg_cartesian_coord_field,
74  CartesianField & arg_displacement_field,
75  CartesianField & arg_translation_field,
76  CylindricalField & arg_cylindrical_coord_field,
77  double arg_element_size = 0.10,
78  double arg_radius_min = 0.6,
79  double arg_radius_max = 1.0 + 0.05,
80  double arg_height_min = -0.4,
81  double arg_height_max = 0.4
82  );
83 
84  const double element_size;
85  const double rad_min, rad_max;
86  const double height_min, height_max;
87 
88  const size_t angle_num;
89  const size_t rad_num;
90  const size_t height_num;
91 
92  const double angle_increment;
93  const double rad_increment;
94  const double height_increment;
95 
96  const size_t num_elements;
97  const size_t num_nodes;
98 
99  fem::FEMMetaData & meta_data;
100  BulkData & bulk_data;
101 
102  Part & gear_part;
103 
104  //must be called between modification_begin / modification_end
105  void generate_gear();
106 
107  void move( const GearMovement & data );
108 
109  private:
110 
111  Entity & get_node (
112  size_t iz , // Thickness index
113  size_t ir , // Radial index
114  size_t ia ) const // Angle index
115  {
116  return * gear_entities[ node_index(iz,ir,ia)];
117  }
118 
119  Entity & get_element(
120  size_t iz , // Thickness index
121  size_t ir , // Radial index
122  size_t ia ) const // Angle index
123  {
124  return * gear_entities[ elem_index(iz,ir,ia)];
125  }
126 
127  EntityId node_index(
128  size_t iz , // Thickness index
129  size_t ir , // Radial index
130  size_t ia ) const // Angle index
131  {
132  return static_cast<stk_classic::mesh::EntityId>(iz + height_num * ( ir + rad_num * ia ));
133  }
134 
135  EntityId elem_index(
136  size_t iz , // Thickness index
137  size_t ir , // Radial index
138  size_t ia ) const // Angle index
139  {
140  return static_cast<stk_classic::mesh::EntityId>(num_nodes + iz + (height_num-1) * ( ir + (rad_num-1) * ia ));
141  }
142 
143  void populate_fields(stk_classic::mesh::FieldState state);
144 
145  Part & cylindrical_coord_part;
146  Part & hex_part;
147  Part & wedge_part;
148 
149  CartesianField & cartesian_coord_field ;
150  CartesianField & displacement_field ;
151  CartesianField & translation_field ;
152  CylindricalField & cylindrical_coord_field ;
153 
154  EntityVector gear_entities;
155 
156  Gear(const Gear &);
157  void operator = (const Gear &);
158 };
159 
160 } // fixtures
161 } // mesh
162 } // stk
163 
164 #endif // STK_MESH_FIXTURES_GEAR_HPP
FEMMetaData is a class that implements a Finite Element Method skin on top of the Sierra Tool Kit Met...
Definition: FEMMetaData.hpp:54
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
Manager for an integrated collection of entities, entity relations, and buckets of field data...
Definition: BulkData.hpp:49
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
Definition: Entity.hpp:120
Sierra Toolkit.
FieldState
Enumeration of states for multi-state fields.
Definition: FieldState.hpp:34