TopologyDimensions.hpp

00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00014 #ifndef stk_mesh_TopologyDimensions_hpp
00015 #define stk_mesh_TopologyDimensions_hpp
00016 
00017 // #include <stk_util/mdarray/Array.hpp>
00018 #include <Shards_Array.hpp>
00019 
00020 #include <stk_mesh/base/Field.hpp>
00021 #include <stk_mesh/base/MetaData.hpp>
00022 #include <stk_mesh/fem/Stencils.hpp>
00023 
00024 namespace stk {
00025 namespace mesh {
00026 
00027 
00028 //----------------------------------------------------------------------
00032 class ElementNode : public shards::ArrayDimTag {
00033 public:
00034   const char * name() const ;
00035   static const ElementNode & tag(); 
00036 private:
00037   ElementNode() {}
00038   ElementNode( const ElementNode & );
00039   ElementNode & operator = ( const ElementNode & );
00040 };
00041 
00046 typedef Field<double,ElementNode> ElementNodeField ;
00047 
00052 typedef Field<double*,ElementNode> ElementNodePointerField ;
00053 typedef Field<int *,ElementNode> ElementNodeLockField ;
00054 
00058 inline
00059 ElementNodeField &
00060 declare_element_node_field( MetaData & md , const std::string & s )
00061 {
00062 
00063   ElementNodeField & f =
00064     md.declare_field< ElementNodeField >( s, 1 /* 1 state */ );
00065 
00066   return f ;
00067 }
00068 
00072 template< class NodeField >
00073 inline
00074 ElementNodePointerField &
00075 declare_element_node_pointer_field(
00076   MetaData & md , const std::string & s ,
00077   NodeField & node_field )
00078 {
00079   const unsigned num_states = node_field.number_of_states();
00080 
00081   ElementNodePointerField & f =
00082     md.template declare_field< ElementNodePointerField >( s, num_states );
00083 
00084   for ( unsigned i = 0 ; i < num_states ; ++i ) {
00085     FieldState state = (FieldState) i;
00086     md.declare_field_relation(
00087       f.field_of_state( state ) , & element_node_stencil<void> , node_field.field_of_state( state ) );
00088   }
00089   
00090   return f ;
00091 }
00092 
00096 template< class NodeField >
00097 inline
00098 ElementNodeLockField &
00099 declare_element_node_lock_field(
00100   MetaData & md , const std::string & s ,
00101   NodeField & node_field )
00102 {
00103   const unsigned num_states = node_field.number_of_states();
00104 
00105   ElementNodeLockField & f =
00106     md.template declare_field< ElementNodeLockField >( s, num_states );
00107 
00108   for ( unsigned i = 0 ; i < num_states ; ++i ) {
00109     FieldState state = (FieldState) i;
00110     md.declare_field_relation(
00111       f.field_of_state( state ) , & element_node_stencil<void> , node_field.field_of_state( state ) );
00112   }
00113   
00114   return f ;
00115 }
00116 //----------------------------------------------------------------------
00121 struct QuadratureTag : public shards::ArrayDimTag {
00122   const char * name() const ;
00123   static const QuadratureTag & tag(); 
00124 private:
00125   QuadratureTag() {}
00126   QuadratureTag( const QuadratureTag & );
00127   QuadratureTag & operator = ( const QuadratureTag & );
00128 };
00129 
00130 struct BasisTag : public shards::ArrayDimTag {
00131   const char * name() const ;
00132   static const BasisTag & tag(); 
00133 private:
00134   BasisTag() {}
00135   BasisTag( const BasisTag & );
00136   BasisTag & operator = ( const BasisTag & );
00137 };
00138 
00139 
00141 //----------------------------------------------------------------------
00142 
00143 }//namespace mesh
00144 }//namespace stk
00145 
00146 #endif
00147 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7