Sierra Toolkit  Version of the Day
PartImpl.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_PartImpl_hpp
10 #define stk_mesh_PartImpl_hpp
11 
12 //----------------------------------------------------------------------
13 
14 #include <iosfwd>
15 #include <string>
16 #include <vector>
17 
18 #include <stk_util/util/CSet.hpp>
19 #include <stk_mesh/base/Types.hpp>
20 
21 //----------------------------------------------------------------------
22 
23 namespace stk_classic {
24 namespace mesh {
25 namespace impl {
26 
27 class PartImpl {
28 public:
29 
33  MetaData & mesh_meta_data() const { return *m_mesh_meta_data ; }
34 
42  unsigned primary_entity_rank() const { return m_entity_rank ; }
43 
45  const std::string & name() const { return m_name ; }
46 
50  unsigned mesh_meta_data_ordinal() const { return m_universe_ordinal ; }
51 
53  const PartVector & supersets() const { return m_supersets ; }
54 
56  const PartVector & subsets() const { return m_subsets ; }
57 
59  const PartVector & intersection_of() const { return m_intersect ; }
60 
62  const std::vector<PartRelation> & relations() const { return m_relations ; }
63 
65  bool operator == ( const PartImpl & rhs ) const { return this == & rhs ; }
66 
68  bool operator != ( const PartImpl & rhs ) const { return this != & rhs ; }
69 
71  template<class A>
72  const A * attribute() const { return m_attribute.template get<A>(); }
73 
74  explicit PartImpl( MetaData * );
75 
76  void add_part_to_subset( Part & part);
77  void add_part_to_superset( Part & part );
78  void add_relation( PartRelation relation );
79  void set_intersection_of( const PartVector & );
80 
81  template<class T>
82  const T * declare_attribute_with_delete( const T *);
83  template<class T>
84  const T * declare_attribute_no_delete( const T *);
85  template<class T>
86  bool remove_attribute( const T *);
87 
91  PartImpl( MetaData * meta, const std::string & name,
92  EntityRank rank, size_t ordinal);
93 
94  void set_primary_entity_rank( EntityRank entity_rank );
95 
96 private:
97 
98 #ifndef DOXYGEN_COMPILE
99 
100  PartImpl();
101  PartImpl( const PartImpl & );
102  PartImpl & operator = ( const PartImpl & );
103 
104  const std::string m_name ;
105  CSet m_attribute ;
106  PartVector m_subsets ;
107  PartVector m_supersets ;
108  PartVector m_intersect ;
109  std::vector<PartRelation> m_relations ;
110  MetaData * const m_mesh_meta_data ;
111  const unsigned m_universe_ordinal ;
112  EntityRank m_entity_rank ;
113 
114 #endif /* DOXYGEN_COMPILE */
115 
116 };
117 
118 template<class T>
119 inline
120 const T *
121 PartImpl::declare_attribute_with_delete( const T * a )
122 {
123  return m_attribute.template insert_with_delete<T>( a );
124 }
125 
126 template<class T>
127 inline
128 const T *
129 PartImpl::declare_attribute_no_delete( const T * a )
130 {
131  return m_attribute.template insert_no_delete<T>( a );
132 }
133 
134 template<class T>
135 inline
136 bool
137 PartImpl::remove_attribute( const T * a )
138 {
139  return m_attribute.template remove<T>( a );
140 }
141 
142 } // namespace impl
143 } // namespace mesh
144 } // namespace stk_classic
145 
146 //----------------------------------------------------------------------
147 //----------------------------------------------------------------------
148 
149 #endif
150 
Sierra Toolkit.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
Definition: Types.hpp:31
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).