FieldBase.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 
00010 #ifndef stk_mesh_base_FieldBase_hpp
00011 #define stk_mesh_base_FieldBase_hpp
00012 
00013 #include <iosfwd>
00014 #include <string>
00015 #include <vector>
00016 
00017 #include <Shards_Array.hpp>
00018 
00019 #include <stk_util/util/SimpleArrayOps.hpp>
00020 #include <stk_util/util/CSet.hpp>
00021 
00022 #include <stk_mesh/base/Types.hpp>
00023 #include <stk_mesh/base/DataTraits.hpp>
00024 
00025 #include <stk_mesh/base/FieldState.hpp>
00026 
00027 #include <stk_mesh/base/FieldRestriction.hpp>
00028 #include <stk_mesh/baseImpl/FieldBaseImpl.hpp>
00029 
00030 
00031 namespace stk {
00032 namespace mesh {
00033 
00034 namespace impl {
00035   class FieldRepository;
00036 }
00037 
00038   //----------------------------------------------------------------------
00043 class FieldBase {
00044 public:
00048   MetaData & mesh_meta_data() const { return m_impl.meta_data(); }
00049 
00053   unsigned mesh_meta_data_ordinal() const { return m_impl.ordinal(); }
00054 
00056   const std::string & name() const { return m_impl.name() ; }
00057 
00059   template<class Type> bool type_is() const
00060   { return m_impl.type_is<Type>(); }
00061 
00065   const DataTraits & data_traits() const { return m_impl.data_traits() ; }
00066 
00068   unsigned number_of_states() const { return m_impl.number_of_states() ; }
00069 
00071   FieldState state() const { return m_impl.state() ; }
00072 
00076   unsigned rank() const { return m_impl.rank(); }
00077 
00082   const shards::ArrayDimTag * const * dimension_tags() const
00083   { return m_impl.dimension_tags() ; }
00084 
00088   unsigned max_size( unsigned entity_rank) const {
00089     return m_impl.max_size( entity_rank );
00090   }
00091 
00092   //----------------------------------------
00093 
00095   template<class A>
00096   const A * attribute() const { return m_impl.attribute<A>(); }
00097 
00098   typedef FieldRestriction Restriction;
00099 
00101   typedef FieldRestrictionVector RestrictionVector;
00102 
00106   const RestrictionVector &restrictions() const {
00107     return m_impl.restrictions();
00108   }
00109 
00113   const Restriction & restriction( unsigned entity_rank , const Part & part ) const {
00114     return m_impl.restriction( entity_rank, part);
00115   }
00116 
00117   //----------------------------------------
00118 
00119   FieldBase * field_state( unsigned i) const {
00120     return m_impl.field_state(i);
00121   }
00122 
00123 private:
00124 
00125   friend class ::stk::mesh::impl::FieldRepository ;
00126   friend class ::stk::mesh::impl::FieldBaseImpl ;
00127 
00129   friend class ::stk::mesh::UnitTestMetaData ;
00130 
00131 
00132   FieldBase(
00133       MetaData                   * arg_mesh_meta_data ,
00134       unsigned                     arg_ordinal ,
00135       const std::string          & arg_name ,
00136       const DataTraits           & arg_traits ,
00137       unsigned                     arg_rank,
00138       const shards::ArrayDimTag  * const * arg_dim_tags,
00139       unsigned                     arg_number_of_states ,
00140       FieldState                   arg_this_state
00141       )
00142     : m_impl(
00143         arg_mesh_meta_data,
00144         arg_ordinal,
00145         arg_name,
00146         arg_traits,
00147         arg_rank,
00148         arg_dim_tags,
00149         arg_number_of_states,
00150         arg_this_state
00151         )
00152   {}
00153 
00154   // WORKAROUND 5/19/2010 [DGB]: intel 10.? and pgi do not link if this is made virtual
00155   //  virtual ~FieldBase();
00156   ~FieldBase();
00157 
00158   impl::FieldBaseImpl  m_impl;
00159 
00160   //the following functions are declared but not defined
00161   FieldBase();
00162   FieldBase( const FieldBase & );
00163   FieldBase & operator = ( const FieldBase & );
00164 
00165 };
00166 
00168 std::ostream & operator << ( std::ostream & , const FieldBase & );
00169 
00171 std::ostream & print( std::ostream & ,
00172                       const char * const , const FieldBase & );
00173 
00174 
00175 } //namespace mesh
00176 } //namespace stk
00177 
00178 #endif //stk_mesh_base_FieldBase_hpp
Generated on Wed Apr 13 10:05:48 2011 for Sierra Toolkit by  doxygen 1.6.3