Sierra Toolkit Version of the Day
PartImpl.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_PartImpl_hpp
00010 #define stk_mesh_PartImpl_hpp
00011 
00012 //----------------------------------------------------------------------
00013 
00014 #include <iosfwd>
00015 #include <string>
00016 #include <vector>
00017 
00018 #include <stk_util/util/CSet.hpp>
00019 #include <stk_mesh/base/Types.hpp>
00020 
00021 //----------------------------------------------------------------------
00022 
00023 namespace stk {
00024 namespace mesh {
00025 namespace impl {
00026 
00027 class PartImpl {
00028 public:
00029 
00033   MetaData & mesh_meta_data() const { return *m_mesh_meta_data ; }
00034 
00042   unsigned primary_entity_rank() const { return m_entity_rank ; }
00043 
00045   const std::string & name() const { return m_name ; }
00046 
00050   unsigned mesh_meta_data_ordinal() const { return m_universe_ordinal ; }
00051 
00053   const PartVector & supersets() const { return m_supersets ; }
00054 
00056   const PartVector & subsets() const { return m_subsets ; }
00057 
00059   const PartVector & intersection_of() const { return m_intersect ; }
00060 
00062   const std::vector<PartRelation> & relations() const { return m_relations ; }
00063 
00065   bool operator == ( const PartImpl & rhs ) const { return this == & rhs ; }
00066 
00068   bool operator != ( const PartImpl & rhs ) const { return this != & rhs ; }
00069 
00071   template<class A>
00072   const A * attribute() const { return m_attribute.template get<A>(); }
00073 
00074   explicit PartImpl( MetaData * );
00075 
00076   void add_part_to_subset( Part & part);
00077   void add_part_to_superset( Part & part );
00078   void add_relation( PartRelation relation );
00079   void set_intersection_of( const PartVector & );
00080 
00081   template<class T>
00082   const T * declare_attribute_with_delete( const T *);
00083   template<class T>
00084   const T * declare_attribute_no_delete( const T *);
00085 
00089   PartImpl( MetaData * meta, const std::string & name,
00090             EntityRank rank, size_t ordinal);
00091 
00092   ~PartImpl();
00093 
00094   void set_primary_entity_rank( EntityRank entity_rank );
00095 
00096 
00097 private:
00098 
00099 #ifndef DOXYGEN_COMPILE
00100 
00101   PartImpl();
00102   PartImpl( const PartImpl & );
00103   PartImpl & operator = ( const PartImpl & );
00104 
00105   const std::string         m_name ;
00106   CSet                      m_attribute ;
00107   PartVector                m_subsets ;
00108   PartVector                m_supersets ;
00109   PartVector                m_intersect ;
00110   std::vector<PartRelation> m_relations ;
00111   MetaData          * const m_mesh_meta_data ;
00112   const unsigned            m_universe_ordinal ;
00113   EntityRank                m_entity_rank ;
00114 
00115 #endif /* DOXYGEN_COMPILE */
00116 
00117 };
00118 
00119 template<class T>
00120 inline
00121 const T *
00122 PartImpl::declare_attribute_with_delete( const T * a )
00123 {
00124   return m_attribute.template insert_with_delete<T>( a );
00125 }
00126 
00127 template<class T>
00128 inline
00129 const T *
00130 PartImpl::declare_attribute_no_delete( const T * a )
00131 {
00132   return m_attribute.template insert_no_delete<T>( a );
00133 }
00134 
00135 } // namespace impl
00136 } // namespace mesh
00137 } // namespace stk
00138 
00139 //----------------------------------------------------------------------
00140 //----------------------------------------------------------------------
00141 
00142 #endif
00143 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends