FieldDeclarations.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 #ifndef stk_mesh_FieldDeclarations_hpp
00010 #define stk_mesh_FieldDeclarations_hpp
00011 
00012 #include <stk_mesh/base/MetaData.hpp>
00013 #include <stk_mesh/fem/EntityTypes.hpp>
00014 #include <stk_mesh/fem/FieldTraits.hpp>
00015 
00016 namespace stk {
00017 namespace mesh {
00018 
00019 typedef Field<double>                  ScalarField ;
00020 typedef Field<int>                     ScalarIntField ;
00021 typedef Field<double, Cartesian>       VectorField ;
00022 typedef Field<double, FullTensor>      FullTensorField ;
00023 typedef Field<double, SymmetricTensor> SymmetricTensorField ;
00024 
00025 //----------------------------------------------------------------------
00026 // Declaring fields of these fundemental types:
00027 
00028 ScalarField &
00029 declare_scalar_field_on_all_nodes( MetaData & , const std::string & );
00030 
00031 ScalarIntField &
00032 declare_scalar_int_field_on_all_nodes( MetaData & , const std::string & );
00033 
00034 ScalarField &
00035 declare_scalar_field_on_all_elements( MetaData & , const std::string & );
00036 
00037 VectorField &
00038 declare_vector_field_on_all_nodes( MetaData & , const std::string & , unsigned );
00039 
00040 VectorField &
00041 declare_vector_field_on_all_elements( MetaData & , const std::string & , unsigned );
00042 
00043 FullTensorField &
00044 declare_full_tensor_field_on_all_nodes( MetaData & , const std::string & , unsigned );
00045 
00046 FullTensorField &
00047 declare_full_tensor_field_on_all_elements( MetaData & , const std::string & , unsigned );
00048 
00049 SymmetricTensorField &
00050 declare_symmetric_tensor_field_on_all_nodes( MetaData & , const std::string & , unsigned );
00051 
00052 SymmetricTensorField &
00053 declare_symmetric_tensor_field_on_all_elements( MetaData & , const std::string & , unsigned );
00054 
00055 //----------------------------------------------------------------------
00056 
00057 template< typename Type, class T1, class T2, class T3,
00058                          class T4, class T5, class T6, class T7 >
00059 inline
00060 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00061 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p )
00062 { put_field( f , Node , p );  return f ; }
00063 
00064 template< typename Type, class T1, class T2, class T3,
00065                          class T4, class T5, class T6, class T7 >
00066 inline
00067 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00068 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00069                     unsigned n1 )
00070 { put_field( f , Node , p , n1 );  return f ; }
00071 
00072 template< typename Type, class T1, class T2, class T3,
00073                          class T4, class T5, class T6, class T7 >
00074 inline
00075 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00076 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00077                     unsigned n1 , unsigned n2 )
00078 { put_field( f , Node , p , n1 , n2 );  return f ; }
00079 
00080 template< typename Type, class T1, class T2, class T3,
00081                          class T4, class T5, class T6, class T7 >
00082 inline
00083 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00084 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00085                     unsigned n1 , unsigned n2 , unsigned n3 )
00086 { put_field( f , Node , p , n1 , n2 , n3 );  return f ; }
00087 
00088 template< typename Type, class T1, class T2, class T3,
00089                          class T4, class T5, class T6, class T7 >
00090 inline
00091 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00092 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00093                     unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 )
00094 {
00095   put_field( f , Node , p , n1 , n2 , n3 , n4 );
00096   return f ;
00097 }
00098 
00099 template< typename Type, class T1, class T2, class T3,
00100                          class T4, class T5, class T6, class T7 >
00101 inline
00102 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00103 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00104                     unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00105                     unsigned n5 )
00106 {
00107   put_field( f, Node, p, n1, n2, n3, n4, n5 );
00108   return f ;
00109 }
00110 
00111 template< typename Type, class T1, class T2, class T3,
00112                          class T4, class T5, class T6, class T7 >
00113 inline
00114 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00115 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00116                     unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00117                     unsigned n5 , unsigned n6 )
00118 {
00119   put_field( f, Node, p, n1, n2, n3, n4, n5, n6 );
00120   return f ;
00121 }
00122 
00123 template< typename Type, class T1, class T2, class T3,
00124                          class T4, class T5, class T6, class T7 >
00125 inline
00126 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00127 put_field_on_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f , Part & p ,
00128                     unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00129                     unsigned n5 , unsigned n6 , unsigned n7 )
00130 {
00131   put_field( f, Node, p, n1, n2, n3, n4, n5, n6, n7 );
00132   return f ;
00133 }
00134 
00135 //----------------------------------------------------------------------
00136 
00137 template< typename Type, class T1, class T2, class T3,
00138                          class T4, class T5, class T6, class T7 >
00139 inline
00140 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00141 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f )
00142 {
00143   MetaData & md = f.mesh_meta_data();
00144   put_field( f, Node, md.universal_part() );
00145   return f ;
00146 }
00147 
00148 template< typename Type, class T1, class T2, class T3,
00149                          class T4, class T5, class T6, class T7 >
00150 inline
00151 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00152 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00153                         unsigned n1 )
00154 {
00155   MetaData & md = f.mesh_meta_data();
00156   put_field( f, Node, md.universal_part(), n1 );
00157   return f ;
00158 }
00159 
00160 template< typename Type, class T1, class T2, class T3,
00161                          class T4, class T5, class T6, class T7 >
00162 inline
00163 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00164 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00165                         unsigned n1 , unsigned n2 )
00166 {
00167   MetaData & md = f.mesh_meta_data();
00168   put_field( f, Node, md.universal_part(), n1, n2 );
00169   return f ;
00170 }
00171 
00172 template< typename Type, class T1, class T2, class T3,
00173                          class T4, class T5, class T6, class T7 >
00174 inline
00175 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00176 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00177                         unsigned n1 , unsigned n2 , unsigned n3 )
00178 {
00179   MetaData & md = f.mesh_meta_data();
00180   put_field( f, Node, md.universal_part(), n1, n2, n3 );
00181   return f ;
00182 }
00183 
00184 template< typename Type, class T1, class T2, class T3,
00185                          class T4, class T5, class T6, class T7 >
00186 inline
00187 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00188 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00189                         unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 )
00190 {
00191   MetaData & md = f.mesh_meta_data();
00192   put_field( f, Node, md.universal_part(), n1, n2, n3, n4 );
00193   return f ;
00194 }
00195 
00196 template< typename Type, class T1, class T2, class T3,
00197                          class T4, class T5, class T6, class T7 >
00198 inline
00199 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00200 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00201                         unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00202                         unsigned n5 )
00203 {
00204   MetaData & md = f.mesh_meta_data();
00205   put_field( f, Node, md.universal_part(), n1, n2, n3, n4, n5 );
00206   return f ;
00207 }
00208 
00209 template< typename Type, class T1, class T2, class T3,
00210                          class T4, class T5, class T6, class T7 >
00211 inline
00212 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00213 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00214                         unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00215                         unsigned n5 , unsigned n6 )
00216 {
00217   MetaData & md = f.mesh_meta_data();
00218   put_field( f, Node, md.universal_part(), n1, n2, n3, n4, n5, n6 );
00219   return f ;
00220 }
00221 
00222 template< typename Type, class T1, class T2, class T3,
00223                          class T4, class T5, class T6, class T7 >
00224 inline
00225 Field<Type,T1,T2,T3,T4,T5,T6,T7> &
00226 put_field_on_all_nodes( Field<Type,T1,T2,T3,T4,T5,T6,T7> & f ,
00227                         unsigned n1 , unsigned n2 , unsigned n3 , unsigned n4 ,
00228                         unsigned n5 , unsigned n6 , unsigned n7 )
00229 {
00230   MetaData & md = f.mesh_meta_data();
00231   put_field( f, Node, md.universal_part(), n1, n2, n3, n4, n5, n6, n7 );
00232   return f ;
00233 }
00234 
00235 //----------------------------------------------------------------------
00236 
00237 template< typename Type >
00238 Field<Type> & put_field_on_all_elements( Field<Type> & );
00239 
00240 template< typename Type >
00241 Field<Type> & put_field_on_elements( Field<Type> &, Part & );
00242 
00243 //----------------------------------------------------------------------
00244 
00245 template< typename Type , class T1 >
00246 Field<Type,T1> & put_field_on_all_elements( Field<Type,T1> & , unsigned n1 );
00247 
00248 template< typename Type , class T1 >
00249 Field<Type,T1> & put_field_on_elements( Field<Type,T1> &, Part &, unsigned n1 );
00250 
00251 //----------------------------------------------------------------------
00252 
00253 template< typename Type , class T1 , class T2 >
00254 Field<Type,T1,T2> &
00255 put_field_on_all_elements( Field<Type,T1,T2> &, unsigned n1, unsigned n2);
00256 
00257 template< typename Type , class T1 , class T2 >
00258 Field<Type,T1,T2> &
00259 put_field_on_elements( Field<Type,T1,T2> &, Part &, unsigned n1, unsigned n2 );
00260 
00261 } // namespace mesh
00262 }
00263 
00264 //----------------------------------------------------------------------
00265 //----------------------------------------------------------------------
00266 // Template implementations follow:
00267 //----------------------------------------------------------------------
00268 
00269 namespace stk {
00270 namespace mesh {
00271 
00272 //----------------------------------------------------------------------
00273 
00274 template< typename Type >
00275 inline
00276 Field<Type> & put_field_on_elements( Field<Type> & f , Part & p )
00277 { put_field( f , Element , p );  return f ; }
00278 
00279 template< typename Type , class T1 >
00280 inline
00281 Field<Type,T1> &
00282 put_field_on_elements( Field<Type,T1> & f , Part & p , unsigned n1 )
00283 { put_field( f , Element , p , n1 );  return f ; }
00284 
00285 template< typename Type , class T1 , class T2 >
00286 inline
00287 Field<Type,T1,T2> &
00288 put_field_on_elements( Field<Type,T1,T2> & f , Part & p ,
00289                                 unsigned n1 , unsigned n2 )
00290 { put_field( f , Element , p , n1 , n2 );  return f ; }
00291 
00292 //----------------------------------------------------------------------
00293 
00294 template< typename Type >
00295 inline
00296 Field<Type> & put_field_on_all_elements( Field<Type> & f )
00297 { put_field_on_elements( f , f.mesh_meta_data().universal_part() );  return f ; }
00298 
00299 template< typename Type , class T1 >
00300 inline
00301 Field<Type,T1> & put_field_on_all_elements( Field<Type,T1> & f , unsigned n1 )
00302 { put_field_on_elements( f , f.mesh_meta_data().universal_part() , n1 );  return f ; }
00303 
00304 template< typename Type , class T1 , class T2 >
00305 inline
00306 Field<Type,T1,T2> & put_field_on_all_elements( Field<Type,T1,T2> & f ,
00307                                 unsigned n1 , unsigned n2 )
00308 { put_field_on_elements( f , f.mesh_meta_data().universal_part() , n1 , n2 );  return f ; }
00309 
00310 //----------------------------------------------------------------------
00311 
00312 inline
00313 ScalarField &
00314 declare_scalar_field_on_all_nodes( MetaData & md , const std::string & n )
00315 {
00316   return put_field( md.declare_field<ScalarField>(n) ,
00317                        Node , md.universal_part() );
00318 }
00319 
00320 inline
00321 ScalarIntField &
00322 declare_scalar_int_field_on_all_nodes( MetaData & md , const std::string & n )
00323 {
00324   return put_field( md.declare_field<ScalarIntField>(n) ,
00325                        Node , md.universal_part() );
00326 }
00327 
00328 inline
00329 ScalarField &
00330 declare_scalar_field_on_all_elements( MetaData & md ,
00331                                       const std::string & n )
00332 {
00333   return put_field( md.declare_field<ScalarField>(n) ,
00334                        Element , md.universal_part() );
00335 }
00336 
00337 inline
00338 VectorField &
00339 declare_vector_field_on_all_nodes(
00340   MetaData & md , const std::string & s , unsigned n1 )
00341 {
00342   return put_field( md.declare_field<VectorField>(s),
00343                        Node , md.universal_part() , n1 );
00344 }
00345 
00346 inline
00347 VectorField &
00348 declare_vector_field_on_all_elements(
00349   MetaData & md , const std::string & s , unsigned n1 )
00350 {
00351   return put_field( md.declare_field<VectorField>(s),
00352                        Element , md.universal_part() , n1 );
00353 }
00354 
00355 inline
00356 FullTensorField &
00357 declare_full_tensor_field_on_all_nodes(
00358   MetaData & md , const std::string & s , unsigned n1 )
00359 {
00360   return put_field( md.declare_field<FullTensorField>(s),
00361                        Node , md.universal_part() , n1 );
00362 }
00363 
00364 inline
00365 FullTensorField &
00366 declare_full_tensor_field_on_all_elements(
00367   MetaData & md , const std::string & s , unsigned n1 )
00368 {
00369   return put_field( md.declare_field<FullTensorField>(s),
00370                        Element , md.universal_part() , n1 );
00371 }
00372 
00373 inline
00374 SymmetricTensorField &
00375 declare_symmetric_tensor_field_on_all_nodes(
00376   MetaData & md , const std::string & s , unsigned n1 )
00377 {
00378   return put_field( md.declare_field<SymmetricTensorField>(s),
00379                        Node , md.universal_part() , n1 );
00380 }
00381 
00382 inline
00383 SymmetricTensorField &
00384 declare_symmetric_tensor_field_on_all_elements(
00385   MetaData & md , const std::string & s , unsigned n1 )
00386 {
00387   return put_field( md.declare_field<SymmetricTensorField>(s) ,
00388                        Element , md.universal_part() , n1 );
00389 }
00390 
00391 } // namespace mesh
00392 }
00393 
00394 #endif
00395 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7