Sierra Toolkit Version of the Day
PartRepository.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_PartRepository_hpp
00010 #define stk_mesh_PartRepository_hpp
00011 
00012 #include <stk_mesh/base/Types.hpp>
00013 #include <stk_mesh/base/Part.hpp>
00014 #include <stk_mesh/baseImpl/PartImpl.hpp>
00015 
00016 
00017 namespace stk {
00018 namespace mesh {
00019 
00020 class MetaData;
00021 
00022 namespace impl {
00023 
00024 
00025 class PartRepository {
00026 public:
00027   explicit PartRepository(MetaData * meta);
00028   ~PartRepository();
00029 
00030   Part * universal_part() const;
00031 
00032   const PartVector & get_all_parts() const;
00033 
00034   Part * declare_part( const std::string & arg_name , EntityRank arg_rank );
00035   Part * declare_part( const PartVector & part_intersect );
00036   void declare_subset( Part & superset, Part & subset );
00037   void declare_part_relation( Part & root_part, PartRelation relation, Part & target_part );
00038 
00039   template<class T>
00040   const T * declare_attribute_with_delete( Part & , const T *);
00041   template<class T>
00042   const T * declare_attribute_no_delete( Part & , const T *);
00043   template<class T>
00044   bool remove_attribute( Part & , const T *);
00045 
00046 private:
00047   PartRepository();
00048   PartRepository(const PartRepository & );
00049   PartRepository & operator = ( const PartRepository & );
00050   
00051   Part * declare_part_impl( const std::string & name, EntityRank rank);
00052   void declare_subset_impl( Part & superset, Part & subset );
00053 
00054   MetaData * m_meta_data;
00055   Part * m_universal_part;
00056   PartVector m_all_parts;
00057 };
00058 
00059 template<class T>
00060 inline
00061 const T *
00062 PartRepository::declare_attribute_with_delete( Part & p, const T * a )
00063 {
00064   return p.m_partImpl.declare_attribute_with_delete<T>( a );
00065 }
00066 
00067 template<class T>
00068 inline
00069 const T *
00070 PartRepository::declare_attribute_no_delete( Part & p, const T * a )
00071 {
00072   return p.m_partImpl.declare_attribute_no_delete<T>( a );
00073 }
00074 
00075 template<class T>
00076 inline
00077 bool
00078 PartRepository::remove_attribute( Part & p, const T * a )
00079 {
00080   return p.m_partImpl.remove_attribute<T>( a );
00081 }
00082 
00083 
00084 } // namespace impl 
00085 } // namespace mesh
00086 } // namespace stk
00087 
00088 
00089 #endif // stk_mesh_PartRepository_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends