Sierra Toolkit  Version of the Day
TopologyDimensions.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010, 2011 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 
14 #ifndef stk_mesh_TopologyDimensions_hpp
15 #define stk_mesh_TopologyDimensions_hpp
16 
17 #include <Shards_Array.hpp>
18 
19 #include <stk_mesh/base/Field.hpp>
20 #include <stk_mesh/base/MetaData.hpp>
21 
22 #include <stk_mesh/fem/Stencils.hpp>
23 
24 namespace stk_classic {
25 namespace mesh {
26 
32 //----------------------------------------------------------------------
36 class ElementNode : public shards::ArrayDimTag {
37 public:
38  const char * name() const ;
39  static const ElementNode & tag();
40 private:
41  ElementNode() {}
42  ElementNode( const ElementNode & );
43  ElementNode & operator = ( const ElementNode & );
44 };
45 
51 
58 
62 inline
64 declare_element_node_field( MetaData & md , const std::string & s )
65 {
66 
67  ElementNodeField & f =
68  md.declare_field< ElementNodeField >( s, 1 /* 1 state */ );
69 
70  return f ;
71 }
72 
76 template< class NodeField >
77 inline
78 ElementNodePointerField &
80  MetaData & md , const std::string & s ,
81  NodeField & node_field )
82 {
83  const unsigned num_states = node_field.number_of_states();
84 
85  ElementNodePointerField & f =
86  md.template declare_field< ElementNodePointerField >( s, num_states );
87 
88  for ( unsigned i = 0 ; i < num_states ; ++i ) {
89  FieldState state = (FieldState) i;
90  md.declare_field_relation(
91  f.field_of_state( state ) ,
92  fem::get_element_node_stencil(fem::FEMMetaData::get(md).spatial_dimension()) ,
93  node_field.field_of_state( state ) );
94  }
95 
96  return f ;
97 }
98 
102 template< class NodeField >
103 inline
104 ElementNodeLockField &
105 declare_element_node_lock_field(
106  MetaData & md , const std::string & s ,
107  NodeField & node_field )
108 {
109  const unsigned num_states = node_field.number_of_states();
110 
111  ElementNodeLockField & f =
112  md.template declare_field< ElementNodeLockField >( s, num_states );
113 
114  for ( unsigned i = 0 ; i < num_states ; ++i ) {
115  FieldState state = (FieldState) i;
116  md.declare_field_relation(
117  f.field_of_state( state ) ,
118  fem::get_element_node_stencil(fem::FEMMetaData::get(md).spatial_dimension()) ,
119  node_field.field_of_state( state ) );
120  }
121 
122  return f ;
123 }
124 //----------------------------------------------------------------------
129 struct QuadratureTag : public shards::ArrayDimTag {
130  const char * name() const ;
131  static const QuadratureTag & tag();
132 private:
133  QuadratureTag() {}
134  QuadratureTag( const QuadratureTag & );
135  QuadratureTag & operator = ( const QuadratureTag & );
136 };
137 
138 struct BasisTag : public shards::ArrayDimTag {
139  const char * name() const ;
140  static const BasisTag & tag();
141 private:
142  BasisTag() {}
143  BasisTag( const BasisTag & );
144  BasisTag & operator = ( const BasisTag & );
145 };
146 
147 
149 //----------------------------------------------------------------------
150 
151 }//namespace mesh
152 }//namespace stk_classic
153 
154 #endif
155 
unsigned number_of_states() const
Number of states of this field.
Definition: FieldBase.hpp:78
static const ElementNode & tag()
Singleton.
The manager of an integrated collection of parts and fields.
Definition: MetaData.hpp:56
Field with defined data type and multi-dimensions (if any)
Definition: Field.hpp:118
Define an array dimension of the number of nodes per element.
Sierra Toolkit.
ElementNodePointerField & declare_element_node_pointer_field(FEMMetaData &fmd, const std::string &s, NodeField &node_field)
Declare an element-to-node-data pointer field.
Definition: FEMHelpers.hpp:136
field_type & declare_field(const std::string &name, unsigned number_of_states=1)
Declare a field of the given field_type, test name, and number of states.
static FEMMetaData & get(const MetaData &meta)
Getter for FEMMetaData off of a MetaData object.
FieldState
Enumeration of states for multi-state fields.
Definition: FieldState.hpp:34