|
Sierra Toolkit Version of the Day
|
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 #ifndef stk_mesh_Stencils_hpp 00010 #define stk_mesh_Stencils_hpp 00011 00012 #include <stk_util/util/StaticAssert.hpp> 00013 #include <stk_mesh/base/Types.hpp> 00014 #include <stk_mesh/fem/TopologicalMetaData.hpp> 00015 // TO BE REMOVED AFTER FEM TopologicalMetaData refactor is finished: 00016 #include <stk_mesh/fem/EntityRanks.hpp> 00017 00018 namespace stk { 00019 namespace mesh { 00020 namespace { // To prevent multiple copies for the linker 00021 00022 enum EntityRankEnum3D { 00023 Node3D = 0 , 00024 Edge3D = 1 , 00025 Face3D = 2 , 00026 Element3D = 3 00027 }; 00028 00029 //---------------------------------------------------------------------- 00030 00031 template< class TopologyTraits > 00032 int element_node_stencil( EntityRank , EntityRank , unsigned ); 00033 00034 template<> 00035 int element_node_stencil<void>( EntityRank from_type , 00036 EntityRank to_type , 00037 unsigned identifier ) 00038 { 00039 int ordinal = -1 ; 00040 00041 if ( Element3D == from_type && Node3D == to_type ) { 00042 ordinal = static_cast<int>(identifier); 00043 } 00044 00045 return ordinal ; 00046 } 00047 00048 template< class TopologyTraits > 00049 int element_node_stencil( EntityRank from_type , 00050 EntityRank to_type , 00051 unsigned identifier ) 00052 { 00053 enum { number_node = TopologyTraits::node_count }; 00054 00055 int ordinal = -1 ; 00056 00057 if ( Element3D == from_type && 00058 Node3D == to_type && 00059 identifier < number_node ) { 00060 ordinal = static_cast<int>(identifier); 00061 } 00062 00063 return ordinal ; 00064 } 00065 00066 template< class TopologyTraits > 00067 int entity_node_stencil( EntityRank , EntityRank , unsigned ); 00068 00069 template<> 00070 int entity_node_stencil<void>( EntityRank from_entity_rank , 00071 EntityRank to_entity_rank , 00072 unsigned identifier ) 00073 { 00074 int ordinal = -1 ; 00075 00076 if ( Node3D == to_entity_rank ) { 00077 ordinal = static_cast<int>(identifier); 00078 } 00079 00080 return ordinal ; 00081 } 00082 00083 template< class TopologyTraits > 00084 int entity_node_stencil( EntityRank from_entity_rank , 00085 EntityRank to_entity_rank , 00086 unsigned identifier ) 00087 { 00088 enum { number_node = TopologyTraits::node_count }; 00089 00090 int ordinal = -1 ; 00091 00092 if ( Node3D == to_entity_rank && 00093 identifier < number_node ) { 00094 ordinal = static_cast<int>(identifier); 00095 } 00096 00097 return ordinal ; 00098 } 00099 00100 //---------------------------------------------------------------------- 00101 00102 } // namespace <empty> 00103 } // namespace mesh 00104 } // namespace stk 00105 00106 #endif // stk_mesh_Stencils_hpp