Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictByCalculatorsOperation.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 protocols/toolbox/task_operations/RestrictByCalculatorsOperation.cc
11 /// @brief A class that applies arbitrary calculators (whose calculations return std::set< core::Size >) to restrict a PackerTask
12 /// @author Steven Lewis smlewi@unc.edu
13 
14 // Unit Headers
17 
18 // Project Headers
19 #include <core/pose/Pose.hh>
20 
22 
23 // AUTO-REMOVED #include <core/pose/metrics/CalculatorFactory.hh>
24 // AUTO-REMOVED #include <basic/MetricValue.hh>
25 
26 // Utility Headers
27 #include <core/types.hh>
28 #include <utility/vector1_bool.hh>
29 #include <basic/Tracer.hh>
30 
31 #include <utility/vector1.hh>
32 
33 
34 // C++ Headers
35 
36 using basic::Error;
37 using basic::Warning;
38 static basic::Tracer TR( "protocols.toolbox.TaskOperations.RestrictByCalculatorsOperation" );
39 
40 namespace protocols {
41 namespace toolbox {
42 namespace task_operations {
43 
45 
47  : parent(), calcs_and_calcns_(calcs_and_calcns)
48 {
49  //I suppose you could reasonably create this object BEFORE the calculator was generated/registered
50 // for( core::Size i(1); i <= calcs_and_calcns_.size(); ++i){
51 // if( !core::pose::metrics::CalculatorFactory::Instance().check_calculator_exists( calcs_and_calcns_[i].first ) ){
52 // utility_exit_with_message("In RestrictByCalculatorsOperation, calculator " + calcs_and_calcns_[i].first + " does not exist.");
53 // }
54 // }
55 }
56 
58 
61 {
63 }
64 
65 ///@details be warned if you use clone that you'll not get new calculators
67 {
68  return new RestrictByCalculatorsOperation( *this );
69 }
70 
71 void
73 {
74  //vector for filling packertask
75  utility::vector1_bool repack(pose.total_residue(), false);
76 
77  for( core::Size i(1); i <= calcs_and_calcns_.size(); ++i)
78  run_calculator(pose, calcs_and_calcns_[i].first, calcs_and_calcns_[i].second, repack);
79 
80  task.restrict_to_residues(repack);
81  return;
82 }
83 
84 } //namespace protocols
85 } //namespace toolbox
86 } //namespace task_operations