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 & 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 
00044 private:
00045   PartRepository();
00046   PartRepository(const PartRepository & );
00047   PartRepository & operator = ( const PartRepository & );
00048   
00049   Part * declare_part_impl( const std::string & name, EntityRank rank);
00050   void declare_subset_impl( Part & superset, Part & subset );
00051 
00052   MetaData * m_meta_data;
00053   Part * m_universal_part;
00054 };
00055 
00056 template<class T>
00057 inline
00058 const T *
00059 PartRepository::declare_attribute_with_delete( Part & p, const T * a )
00060 {
00061   return p.m_partImpl.declare_attribute_with_delete<T>( a );
00062 }
00063 
00064 template<class T>
00065 inline
00066 const T *
00067 PartRepository::declare_attribute_no_delete( Part & p, const T * a )
00068 {
00069   return p.m_partImpl.declare_attribute_no_delete<T>( a );
00070 }
00071 
00072 
00073 } // namespace impl 
00074 } // namespace mesh
00075 } // namespace stk
00076 
00077 
00078 #endif // stk_mesh_PartRepository_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends