Sierra Toolkit Version of the Day
FieldBase.cpp
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 #include <cstring>
00010 #include <iostream>
00011 #include <sstream>
00012 
00013 #include <stk_mesh/base/FieldBase.hpp>
00014 #include <stk_mesh/base/MetaData.hpp>
00015 
00016 namespace stk {
00017 namespace mesh {
00018 
00019 FieldBase::~FieldBase()
00020 {}
00021 
00022 
00023 std::ostream & operator << ( std::ostream & s , const FieldBase & field )
00024 {
00025   s << "FieldBase<" ;
00026   s << field.data_traits().name ;
00027   for ( unsigned i = 0 ; i < field.rank() ; ++i ) {
00028     s << "," << field.dimension_tags()[i]->name();
00029   }
00030   s << ">" ;
00031 
00032   s << "[ name = \"" ;
00033   s << field.name() ;
00034   s << "\" , #states = " ;
00035   s << field.number_of_states();
00036   s << " ]" ;
00037   return s ;
00038 }
00039 
00040 std::ostream & print( std::ostream & s ,
00041                       const char * const b ,
00042                       const FieldBase & field )
00043 {
00044   const PartVector & all_parts = MetaData::get(field).get_parts();
00045   const std::vector<FieldBase::Restriction> & rMap = field.restrictions();
00046   s << field ;
00047   s << " {" ;
00048   for ( std::vector<FieldBase::Restriction>::const_iterator
00049         i = rMap.begin() ; i != rMap.end() ; ++i ) {
00050     s << std::endl << b << "  " ;
00051     i->print( s, i->entity_rank(), * all_parts[ i->part_ordinal() ], field.rank() );
00052   }
00053   s << std::endl << b << "}" ;
00054   return s ;
00055 }
00056 
00057 //----------------------------------------------------------------------
00058 
00059 } // namespace mesh
00060 } // namespace stk
00061 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends