Sierra Toolkit  Version of the Day
PartRepository.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef stk_mesh_PartRepository_hpp
10 #define stk_mesh_PartRepository_hpp
11 
12 #include <stk_mesh/base/Types.hpp>
13 #include <stk_mesh/base/Part.hpp>
14 #include <stk_mesh/baseImpl/PartImpl.hpp>
15 
16 
17 namespace stk_classic {
18 namespace mesh {
19 
20 class MetaData;
21 
22 namespace impl {
23 
24 
25 class PartRepository {
26 public:
27  explicit PartRepository(MetaData * meta);
28  ~PartRepository();
29 
30  Part * universal_part() const;
31 
32  const PartVector & get_all_parts() const;
33 
34  Part * declare_part( const std::string & arg_name , EntityRank arg_rank );
35  Part * declare_part( const PartVector & part_intersect );
36  void declare_subset( Part & superset, Part & subset );
37  void declare_part_relation( Part & root_part, PartRelation relation, Part & target_part );
38 
39  template<class T>
40  const T * declare_attribute_with_delete( Part & , const T *);
41  template<class T>
42  const T * declare_attribute_no_delete( Part & , const T *);
43  template<class T>
44  bool remove_attribute( Part & , const T *);
45 
46 private:
47  PartRepository();
48  PartRepository(const PartRepository & );
49  PartRepository & operator = ( const PartRepository & );
50 
51  Part * declare_part_impl( const std::string & name, EntityRank rank);
52  void declare_subset_impl( Part & superset, Part & subset );
53 
54  MetaData * m_meta_data;
55  Part * m_universal_part;
56  PartVector m_all_parts;
57 };
58 
59 template<class T>
60 inline
61 const T *
62 PartRepository::declare_attribute_with_delete( Part & p, const T * a )
63 {
64  return p.m_partImpl.declare_attribute_with_delete<T>( a );
65 }
66 
67 template<class T>
68 inline
69 const T *
70 PartRepository::declare_attribute_no_delete( Part & p, const T * a )
71 {
72  return p.m_partImpl.declare_attribute_no_delete<T>( a );
73 }
74 
75 template<class T>
76 inline
77 bool
78 PartRepository::remove_attribute( Part & p, const T * a )
79 {
80  return p.m_partImpl.remove_attribute<T>( a );
81 }
82 
83 
84 } // namespace impl
85 } // namespace mesh
86 } // namespace stk_classic
87 
88 
89 #endif // stk_mesh_PartRepository_hpp
Part & declare_part(FEMMetaData &meta_data, const std::string &name)
Declare a part with a given cell topology. This is just a convenient function that wraps FEMMetaData&#39;...
Definition: FEMHelpers.hpp:93
Sierra Toolkit.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
Definition: Types.hpp:31