|
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 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_classic { 00017 namespace mesh { 00018 00019 std::ostream & operator << ( std::ostream & s , const FieldBase & field ) 00020 { 00021 s << "FieldBase<" ; 00022 s << field.data_traits().name ; 00023 for ( unsigned i = 0 ; i < field.rank() ; ++i ) { 00024 s << "," << field.dimension_tags()[i]->name(); 00025 } 00026 s << ">" ; 00027 00028 s << "[ name = \"" ; 00029 s << field.name() ; 00030 s << "\" , #states = " ; 00031 s << field.number_of_states(); 00032 s << " ]" ; 00033 return s ; 00034 } 00035 00036 std::ostream & print( std::ostream & s , 00037 const char * const b , 00038 const FieldBase & field ) 00039 { 00040 const PartVector & all_parts = MetaData::get(field).get_parts(); 00041 const std::vector<FieldBase::Restriction> & rMap = field.restrictions(); 00042 s << field ; 00043 s << " {" ; 00044 for ( std::vector<FieldBase::Restriction>::const_iterator 00045 i = rMap.begin() ; i != rMap.end() ; ++i ) { 00046 s << std::endl << b << " " ; 00047 i->print( s, i->entity_rank(), * all_parts[ i->part_ordinal() ], field.rank() ); 00048 } 00049 s << std::endl << b << "}" ; 00050 return s ; 00051 } 00052 00053 //---------------------------------------------------------------------- 00054 00055 } // namespace mesh 00056 } // namespace stk_classic 00057