Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FragmentScoreMap.hh
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 protocols/frag_picker/scores/FragmentScoreMap.hh
11 /// @brief
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
14 #ifndef INCLUDED_protocols_frag_picker_scores_FragmentScoreMap_hh
15 #define INCLUDED_protocols_frag_picker_scores_FragmentScoreMap_hh
16 
17 // package headers
19 // AUTO-REMOVED #include <protocols/frag_picker/scores/FragmentScoreManager.fwd.hh>
20 
21 // utility headers
22 #include <utility/pointer/ReferenceCount.hh>
23 #include <core/types.hh>
24 #include <utility/vector1_bool.hh>
25 
26 
27 namespace protocols {
28 namespace frag_picker {
29 namespace scores {
30 
31 using namespace core;
32 
33 /// @brief holds all small scores (score components) for a given fragment
34 /// @detailed each scoring method puts its own result into the map. The total score
35 /// is a dot product of the vector from this map and a vector of weights
37 
38 public:
39 
40  /// @brief creates a new map for a given number of components
41  /// @detailed usually the new map should be created by FragmentScoreManager::create_empty_map()
42  inline FragmentScoreMap(Size n_componens) {
43  small_scores_.resize(n_componens);
44  was_modified_ = false;
45  recent_total_ = 0.0;
46  recent_quota_score_ = 999.999;
47  }
48 
49  /// @brief creates a new deep copy of this map
51  FragmentScoreMapOP f = new FragmentScoreMap(small_scores_.size());
52  for (Size i = 1; i <= small_scores_.size(); i++)
53  f->small_scores_[i] = small_scores_[i];
54  f->was_modified_ = was_modified_;
55  f->recent_total_ = recent_total_;
56 
57  return f;
58  }
59 
60  inline Size size() const { return small_scores_.size(); }
61 
62  inline Real at(Size score_index) const { return small_scores_[score_index]; };
63 
64  /// @brief returns the vector of score components
66  return const_cast<utility::vector1<Real> &> (small_scores_);
67  }
68 
69  /// @brief sets a new score value for a given component
70  inline void set_score_component(Real score_value, Size component_id) {
71  small_scores_[component_id] = score_value;
72  was_modified_ = true;
73  }
74 
75  /// @brief returns the total score that has been evaluated recently
76  /// @detailed the method does not compute anything. You must check if the map has been
77  /// modified after the last total score calculation. If so, you must recompute the total again
79  return recent_total_;
80  }
81 
82  /// @brief If the map has been modified, the total score it holds is not up-to-date and must be recalculated
83  inline bool was_modified() {
84  return was_modified_;
85  }
86 
87  inline Real get_quota_score() { return recent_quota_score_; }
88 
89  inline void set_quota_score(Real quota_score) { recent_quota_score_ = quota_score; }
90 
91 private:
96  friend class FragmentScoreManager;
97 };
98 
99 } // scores
100 } // frag_picker
101 } // protocols
102 
103 #endif /* INCLUDED_protocols_frag_picker_scores_FragmentScoreMap_HH */