10 #ifndef stk_mesh_base_PropertyBase_hpp 11 #define stk_mesh_base_PropertyBase_hpp 18 #include <stk_util/environment/ReportHandler.hpp> 20 #include <stk_mesh/base/Types.hpp> 33 MetaData & mesh_meta_data()
const {
return m_meta_data ; }
41 const std::string &
name()
const {
return m_name ; }
44 template<
class DataType>
bool type_is()
const 45 {
return m_type ==
typeid(DataType); }
48 unsigned size()
const {
return m_size ; }
51 template<
typename DataType >
55 if ( m_type ==
typeid(DataType) ) {
62 template<
typename DataType >
66 if ( m_type ==
typeid(DataType) ) {
74 #ifndef DOXYGEN_COMPILE 79 unsigned meta_data_ordinal ,
80 const std::string & input_name ,
81 const std::type_info & type ,
83 : m_name( input_name ),
84 m_meta_data( my_meta_data ),
85 m_meta_data_ordinal( meta_data_ordinal ),
86 m_type( type ), m_size( n ) {}
88 virtual void add_property(
unsigned ) = 0 ;
97 MetaData & meta_data()
const {
return m_meta_data ; }
99 const std::string m_name ;
100 MetaData & m_meta_data ;
101 const unsigned m_meta_data_ordinal ;
102 const std::type_info & m_type ;
103 const unsigned m_size ;
106 Property(
const Property & );
107 Property & operator = (
const Property & );
109 friend class MetaData ;
120 template<
typename DataType >
122 #ifndef DOXYGEN_COMPILE 126 typedef std::map< unsigned , DataType > map_scalar ;
128 map_scalar m_data_scalar ;
133 const std::string & input_name,
unsigned input_size = 1 )
135 input_name,
typeid(DataType), input_size ) {}
137 virtual void add_property(
unsigned key ) { m_data_scalar[ key ]; }
150 const typename map_scalar::iterator i = m_data_scalar.find( key );
151 return i != m_data_scalar.end() ? & (*i).second : (
data_type*) NULL ;
157 const typename map_scalar::const_iterator i = m_data_scalar.find( key );
158 return i != m_data_scalar.end() ? & (*i).second : (
data_type*) NULL ;
163 #ifndef DOXYGEN_COMPILE 165 template<
typename DataType >
166 class Property<
std::vector< DataType > > :
public Property<DataType> {
168 friend class MetaData ;
170 typedef std::map< unsigned , std::vector< DataType > > map_array ;
172 map_array m_data_array ;
174 void add_property(
unsigned key )
179 Property(
const Property & );
180 Property & operator = (
const Property & );
184 Property( MetaData & my_meta_data ,
185 unsigned meta_data_ordinal ,
186 const std::string &
name ,
188 : Property<DataType>( my_meta_data, meta_data_ordinal,
name,
size ) {}
194 const typename map_array::iterator i = m_data_array.find( key );
195 return i != m_data_array.end() ? & (*i).second[0] : (
data_type*) NULL ;
200 const typename map_array::const_iterator i = m_data_array.find( key );
201 return i != m_data_array.end() ? & (*i).second[0] : (
data_type*) NULL ;
211 #endif // stk_mesh_base_PropertyBase_hpp const Property< DataType > * property() const
Type-checked cast to property with members of the given type.
Property with defined data type and multi-dimensions (if any)
virtual data_type * data(unsigned key)
Access the properties' members.
const std::string & name() const
Application-defined text name of this property.
Property< DataType > * property()
Type-checked cast to property with members of the given type.
DataType data_type
Type of the properties' members.
unsigned size() const
Query number of members, if an array.
bool type_is() const
Query if the scalar type is DataType.
virtual const data_type * data(unsigned key) const
Access the properties' members.
unsigned mesh_meta_data_ordinal() const
Internally generated ordinal of this property that is unique within the owning meta data manager...
Property base class with an anonymous data type and anonymous multi-dimension.