Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EnergyMap.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/scoring/EnergyMap.cc
11 /// @brief Vector of scores implementation
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 
15 // Unit Headers
17 
18 // Package Headers
20 
21 #include <ObjexxFCL/format.hh>
22 
23 #include <utility/vector1.hh>
24 
25 
26 
27 namespace core {
28 namespace scoring {
29 
30 void
32 {
33  std::cout << "( ";
34  for ( int ii = 0; ii < n_score_types; ++ii ) {
35  if ( ii != 0 ) std::cout << ", ";
36  std::cout << name_from_score_type( ScoreType( ii + 1 ) ) << "=" << map_[ ii ];
37  if ( ii % 3 == 2 && ii != n_score_types ) std::cout << std::endl;
38  }
39  std::cout << ")" << std::endl;
40 }
41 
42 
43 void
44 EMapVector::show_if_nonzero_weight( std::ostream & out, EMapVector const & weights ) const
45 {
46  for ( int ii = 1; ii <= n_score_types; ++ii ) {
47  if ( weights[ ScoreType(ii) ] != 0.0 ) {
48  Real const val( operator[]( ScoreType(ii) ) );
49  out << ' ' << ScoreType(ii) << ": " << ObjexxFCL::fmt::F(9,3,val);
50  }
51  }
52 }
53 
54 
55 void
56 EMapVector::show_weighted( std::ostream & out, EMapVector const & weights ) const
57 {
58  for ( int ii = 1; ii <= n_score_types; ++ii ) {
59  Real const weight( weights[ ScoreType(ii) ] );
60  if ( weight != 0.0 ) {
61  Real const val( operator[]( ScoreType(ii) ) );
62  out << ' ' << ScoreType(ii) << ": " << ObjexxFCL::fmt::F(9,3, weight * val );
63  }
64  }
65 }
66 
67 
70 {
71  std::ostringstream os;
72  show_weighted( os, weights );
73  return os.str();
74 }
75 
76 
77 
78 } // scoring
79 } // core