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