Sierra Toolkit Version of the Day
FieldRestriction.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 
00009 
00010 #ifndef stk_mesh_baseImpl_FieldRestriction_hpp
00011 #define stk_mesh_baseImpl_FieldRestriction_hpp
00012 
00013 #include <vector>
00014 #include <Shards_Array.hpp>
00015 #include <stk_mesh/base/EntityKey.hpp>
00016 #include <stk_mesh/base/Types.hpp>
00017 
00018 #include <stk_util/util/SimpleArrayOps.hpp>
00019 
00020 namespace stk {
00021 namespace mesh {
00022 
00023 struct FieldRestriction {
00024   typedef shards::array_traits::int_t size_type ;
00025 
00026   EntityKey key ;
00027   size_type stride[ MaximumFieldDimension ];
00028 
00029   FieldRestriction() : key() {
00030     Copy<MaximumFieldDimension>( stride , size_type(0) );
00031   }
00032 
00033   FieldRestriction( const FieldRestriction & rhs ): key( rhs.key ) {
00034     Copy< MaximumFieldDimension >( stride , rhs.stride );
00035   }
00036 
00037   FieldRestriction & operator = ( const FieldRestriction & rhs ) {
00038     key = rhs.key ;
00039     Copy< MaximumFieldDimension >( stride , rhs.stride );
00040     return *this ;
00041   }
00042 
00043   FieldRestriction( unsigned rank , unsigned ordinal)
00044     : key( EntityKey(rank, ordinal))
00045   {
00046     Copy< MaximumFieldDimension >( stride , size_type(0) );
00047   }
00048 
00049   unsigned type()    const { return entity_rank( key ); }
00050   unsigned ordinal() const { return entity_id( key ); }
00051 };
00052 
00053 typedef std::vector<FieldRestriction> FieldRestrictionVector;
00054 
00055 } // namespace mesh
00056 } // namespace stk
00057 
00058 
00059 
00060 #endif // stk_mesh_baseImpl_FieldRestriction_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends