Sierra Toolkit  Version of the Day
FieldBase.cpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #include <cstring>
10 #include <iostream>
11 #include <sstream>
12 
13 #include <stk_mesh/base/FieldBase.hpp>
14 #include <stk_mesh/base/MetaData.hpp>
15 
16 namespace stk_classic {
17 namespace mesh {
18 
19 std::ostream & operator << ( std::ostream & s , const FieldBase & field )
20 {
21  s << "FieldBase<" ;
22  s << field.data_traits().name ;
23  for ( unsigned i = 0 ; i < field.rank() ; ++i ) {
24  s << "," << field.dimension_tags()[i]->name();
25  }
26  s << ">" ;
27 
28  s << "[ name = \"" ;
29  s << field.name() ;
30  s << "\" , #states = " ;
31  s << field.number_of_states();
32  s << " ]" ;
33  return s ;
34 }
35 
36 std::ostream & print( std::ostream & s ,
37  const char * const b ,
38  const FieldBase & field )
39 {
40  const PartVector & all_parts = MetaData::get(field).get_parts();
41  const std::vector<FieldBase::Restriction> & rMap = field.restrictions();
42  s << field ;
43  s << " {" ;
44  for ( std::vector<FieldBase::Restriction>::const_iterator
45  i = rMap.begin() ; i != rMap.end() ; ++i ) {
46  s << std::endl << b << " " ;
47  i->print( s, i->entity_rank(), * all_parts[ i->part_ordinal() ], field.rank() );
48  }
49  s << std::endl << b << "}" ;
50  return s ;
51 }
52 
53 //----------------------------------------------------------------------
54 
55 } // namespace mesh
56 } // namespace stk_classic
57 
std::ostream & print(std::ostream &os, const std::string &indent, const Bucket &bucket)
Print the parts and entities of this bucket.
Definition: Bucket.cpp:259
Sierra Toolkit.
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
Definition: Types.hpp:31