Sierra Toolkit Version of the Day
FieldRestriction.cpp
00001 
00002 #include <stk_mesh/base/FieldRestriction.hpp>
00003 #include <stk_mesh/base/Part.hpp>
00004 #include <sstream>
00005 
00006 namespace stk {
00007 namespace mesh {
00008 
00009   void FieldRestriction::print(
00010       std::ostream & os,
00011       const EntityRank & entity_rank,
00012       const Part & part,
00013       FieldArrayRank field_rank
00014       ) const
00015   {
00016     os << "{ entity_rank(" << entity_rank << ") part(" << part.name() << ") : " ;
00017     os << m_stride[0] ;
00018     for ( FieldArrayRank i = 1 ; i < field_rank ; ++i ) {
00019       if ( ! m_stride[i] ) {
00020         os << " , 0 " ;
00021       }
00022       else if ( m_stride[i] % m_stride[i-1] ) {
00023         os << " , " << m_stride[i] << " / " << m_stride[i-1] ;
00024       }
00025       else {
00026         os << " , " << m_stride[i] / m_stride[i-1] ;
00027       }
00028     }
00029     os << " }" ;
00030   }
00031 
00032   std::string print_restriction(
00033       const FieldRestriction & restr,
00034       const EntityRank & entity_rank,
00035       const Part & part,
00036       FieldArrayRank field_rank
00037       )
00038   {
00039     std::ostringstream oss;
00040     restr.print(oss, entity_rank, part, field_rank);
00041     return oss.str();
00042   }
00043 
00044 } // namespace mesh
00045 } // namespace stk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends