|
Sierra Toolkit
Version of the Day
|
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 #ifndef stk_mesh_baseImpl_FieldRepository_hpp 00009 #define stk_mesh_baseImpl_FieldRepository_hpp 00010 00011 #include <iosfwd> 00012 #include <stk_util/util/SameType.hpp> 00013 #include <stk_util/util/StaticAssert.hpp> 00014 #include <stk_util/parallel/Parallel.hpp> 00015 #include <stk_mesh/base/Types.hpp> 00016 #include <stk_mesh/base/Part.hpp> 00017 #include <stk_mesh/base/Field.hpp> 00018 #include <stk_mesh/base/PropertyBase.hpp> 00019 #include <stk_mesh/baseImpl/PartRepository.hpp> 00020 00021 #include <stk_mesh/baseImpl/FieldBaseImpl.hpp> 00022 00023 namespace stk_classic { 00024 namespace mesh { 00025 00026 typedef std::vector<FieldBase *> FieldVector; 00027 00028 namespace impl { 00029 00030 class FieldRepository { 00031 00032 public: 00033 FieldRepository() {} 00034 ~FieldRepository(); 00035 00036 FieldBase * get_field( 00037 const char * arg_method , 00038 const std::string & arg_name , 00039 const DataTraits & arg_traits , 00040 unsigned arg_rank , 00041 const shards::ArrayDimTag * const * arg_dim_tags , 00042 unsigned arg_num_states 00043 ) const; 00044 00045 FieldBase * declare_field( 00046 const std::string & arg_name , 00047 const DataTraits & arg_traits , 00048 unsigned arg_rank , 00049 const shards::ArrayDimTag * const * arg_dim_tags , 00050 unsigned arg_num_states , 00051 MetaData * arg_meta_data 00052 ); 00053 00054 void verify_and_clean_restrictions( 00055 const char * arg_method , 00056 const Part& superset, const Part& subset, 00057 const PartVector & arg_all_parts ); 00058 00059 const FieldVector & get_fields() const { 00060 return m_fields; 00061 } 00062 00063 template<class T> 00064 const T * 00065 declare_attribute_with_delete( FieldBase & f , const T * a ) 00066 { 00067 return f.m_impl.declare_attribute_with_delete(a); 00068 } 00069 00070 template<class T> 00071 const T * 00072 declare_attribute_no_delete( FieldBase & f , const T * a ) 00073 { 00074 return f.m_impl.declare_attribute_no_delete(a); 00075 } 00076 00077 void declare_field_restriction( 00078 const char * arg_method, 00079 FieldBase & arg_field , 00080 unsigned arg_entity_rank , 00081 const Part & arg_part , 00082 const PartVector & arg_all_parts, 00083 const unsigned * arg_stride , 00084 const void * arg_init_value = NULL) 00085 { 00086 arg_field.m_impl.insert_restriction( arg_method, arg_entity_rank, arg_part, arg_stride, arg_init_value); 00087 } 00088 00089 void declare_field_restriction( 00090 const char * arg_method, 00091 FieldBase & arg_field , 00092 unsigned arg_entity_rank , 00093 const Selector & arg_selector , 00094 const PartVector & arg_all_parts, 00095 const unsigned * arg_stride , 00096 const void * arg_init_value = NULL) 00097 { 00098 arg_field.m_impl.insert_restriction( arg_method, arg_entity_rank, arg_selector, arg_stride, arg_init_value); 00099 } 00100 00101 private: 00102 FieldVector m_fields; 00103 00104 //disallow copy and assignment 00105 FieldRepository( const FieldRepository &); 00106 FieldRepository & operator = ( const FieldRepository &); 00107 }; 00108 00109 } // namespace impl 00110 } // namespace mesh 00111 } // namespace stk_classic 00112 00113 #endif //stk_mesh_baseImpl_FieldRepository_hpp