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   template<class T>
00086   bool remove_attribute( const T *);
00087 
00091   PartImpl( MetaData * meta, const std::string & name,
00092             EntityRank rank, size_t ordinal);
00093 
00094   void set_primary_entity_rank( EntityRank entity_rank );
00095 
00096 private:
00097 
00098 #ifndef DOXYGEN_COMPILE
00099 
00100   PartImpl();
00101   PartImpl( const PartImpl & );
00102   PartImpl & operator = ( const PartImpl & );
00103 
00104   const std::string         m_name ;
00105   CSet                      m_attribute ;
00106   PartVector                m_subsets ;
00107   PartVector                m_supersets ;
00108   PartVector                m_intersect ;
00109   std::vector<PartRelation> m_relations ;
00110   MetaData          * const m_mesh_meta_data ;
00111   const unsigned            m_universe_ordinal ;
00112   EntityRank                m_entity_rank ;
00113 
00114 #endif /* DOXYGEN_COMPILE */
00115 
00116 };
00117 
00118 template<class T>
00119 inline
00120 const T *
00121 PartImpl::declare_attribute_with_delete( const T * a )
00122 {
00123   return m_attribute.template insert_with_delete<T>( a );
00124 }
00125 
00126 template<class T>
00127 inline
00128 const T *
00129 PartImpl::declare_attribute_no_delete( const T * a )
00130 {
00131   return m_attribute.template insert_no_delete<T>( a );
00132 }
00133 
00134 template<class T>
00135 inline
00136 bool 
00137 PartImpl::remove_attribute( const T * a )
00138 {
00139   return m_attribute.template remove<T>( a );
00140 }
00141 
00142 } // namespace impl
00143 } // namespace mesh
00144 } // namespace stk
00145 
00146 //----------------------------------------------------------------------
00147 //----------------------------------------------------------------------
00148 
00149 #endif
00150 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines