Sierra Toolkit Version of the Day
TopologicalMetaData.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 #ifndef stk_mesh_TopologicalMetaData_hpp
00010 #define stk_mesh_TopologicalMetaData_hpp
00011 
00012 #include <Shards_CellTopologyData.h>
00013 #include <Shards_BasicTopologies.hpp>
00014 #include <stk_mesh/base/MetaData.hpp>
00015 #include <stk_mesh/fem/FEMTypes.hpp>
00016 
00017 namespace stk {
00018 namespace mesh {
00019 
00020 
00021 //----------------------------------------------------------------------------
00022 //----------------------------------------------------------------------------
00027 class TopologicalMetaData {
00028 public:
00029   //--------------------------------------------------------------------------
00030 
00031   static void verify_spatial_dimension( unsigned spatial_dimension ,
00032                                         const char * method );
00033 
00035   static std::vector<std::string> entity_rank_names( unsigned spatial_dimension );
00036 
00041   TopologicalMetaData( MetaData & , unsigned spatial_dimension );
00042 
00043   ~TopologicalMetaData();
00044 
00045   //--------------------------------------------------------------------------
00046 
00047   const unsigned spatial_dimension ; 
00048 
00049   const EntityRank node_rank ;    
00050   const EntityRank edge_rank ;    
00051   const EntityRank side_rank ;    
00052   const EntityRank element_rank ; 
00053   const EntityRank patch_rank ;   
00054 
00055   //--------------------------------------------------------------------------
00059   static const CellTopologyData * get_cell_topology( const Part & part , const char * required_by = 0 );
00060 
00075   static const CellTopologyData * get_cell_topology( const Bucket & bucket , const char * required_by = 0 );
00076   static const CellTopologyData * get_cell_topology( const Entity & entity , const char * required_by = 0 );
00077 
00078   //--------------------------------------------------------------------------
00085   Part & declare_part( const std::string & name ,
00086                        const CellTopologyData * top );
00087 
00089   template< class Top >
00090   Part & declare_part( const std::string & name )
00091     { return declare_part( name , shards::getCellTopologyData<Top>() ); }
00092 
00093   //--------------------------------------------------------------------------
00097   void declare_cell_topology( const CellTopologyData * , EntityRank entity_rank );
00098 
00099   //throws if not found
00100   EntityRank get_entity_rank( const CellTopologyData * ) const ;
00101 
00102 private:
00103  
00104   // Base meta data to which this topological meta data is attached.
00105   MetaData & m_meta_data ;
00106 
00107   // Defined cell topologies and associated mesh entity rank.
00108   std::vector< std::pair< const CellTopologyData * , EntityRank > > m_top_rank ;
00109 
00110   // Map part meta data ordinals to cell topologies.
00111   std::vector< std::pair< unsigned , const CellTopologyData * > > m_part_top_map ;
00112 
00113   static const TopologicalMetaData * internal_get( const MetaData & );
00114 
00115   const CellTopologyData * internal_get_cell_topology( unsigned part_ordinal) const ;
00116 
00117   void internal_set_entity_rank( const CellTopologyData * , EntityRank );
00118   
00119   // Set sell topology internally, to be used only from declare_part
00120   void internal_set_cell_topology( 
00121       Part & part, 
00122       unsigned entity_rank, 
00123       const CellTopologyData * top
00124       );
00125 
00126 
00127   void throw_ambiguous( const Part & ) const ;
00128   void throw_ambiguous( const Bucket & ) const ;
00129   static void throw_required( const Part & , const char * );
00130   static void throw_required( const Bucket & , const char * );
00131 
00132 
00133   TopologicalMetaData();
00134   TopologicalMetaData( const TopologicalMetaData & );
00135   TopologicalMetaData & operator = ( const TopologicalMetaData & );
00136 };
00137 
00138 }
00139 }
00140 
00141 //----------------------------------------------------------------------------
00142 //----------------------------------------------------------------------------
00143 
00144 #endif
00145 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends