Sierra Toolkit  Version of the Day
FieldRestriction.cpp
1 
2 #include <stk_mesh/base/FieldRestriction.hpp>
3 #include <stk_mesh/base/Part.hpp>
4 #include <sstream>
5 
6 namespace stk_classic {
7 namespace mesh {
8 
9  void FieldRestriction::print(
10  std::ostream & os,
11  const EntityRank & entity_rank,
12  const Part & part,
13  FieldArrayRank field_rank
14  ) const
15  {
16  os << "{ entity_rank(" << entity_rank << ") part(" << part.name() << ") : " ;
17  os << m_stride[0] ;
18  for ( FieldArrayRank i = 1 ; i < field_rank ; ++i ) {
19  if ( ! m_stride[i] ) {
20  os << " , 0 " ;
21  }
22  else if ( m_stride[i] % m_stride[i-1] ) {
23  os << " , " << m_stride[i] << " / " << m_stride[i-1] ;
24  }
25  else {
26  os << " , " << m_stride[i] / m_stride[i-1] ;
27  }
28  }
29  os << " }" ;
30  }
31 
32  std::string print_restriction(
33  const FieldRestriction & restr,
34  const EntityRank & entity_rank,
35  const Part & part,
36  FieldArrayRank field_rank
37  )
38  {
39  std::ostringstream oss;
40  restr.print(oss, entity_rank, part, field_rank);
41  return oss.str();
42  }
43 
44 } // namespace mesh
45 } // namespace stk_classic
Sierra Toolkit.
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).