Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SkipViolFunc.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 src/core/scoring/constraints/SkipViolFunc.cc
11 /// @brief Weighted constraint function that reweights other constraints
12 /// by a constant scalar value.
13 /// @author James Thompson, Greg Taylor
14 
15 
18 
19 #include <core/types.hh>
20 
21 #include <utility/pointer/ReferenceCount.hh>
22 
23 // AUTO-REMOVED #include <numeric/angle.functions.hh>
24 #include <ObjexxFCL/format.hh>
25 // AUTO-REMOVED #include <basic/Tracer.hh>
26 
27 // C++ Headers
28 #include <string>
29 
30 namespace core {
31 namespace scoring {
32 namespace constraints {
33 
34  Real
35  SkipViolFunc::func( Real const x ) const
36  {
37  return func_to_weight_->func( x ) * weight_;
38  }
39 
40  Real
41  SkipViolFunc::dfunc( Real const x ) const
42  {
43  return func_to_weight_->dfunc( x ) * weight_;
44  }
45 
46  void
47  SkipViolFunc::read_data( std::istream& in )
48  {
49  in >> count_viols_;
50  weight_ = 1.0;
51  FuncFactory func_factory;
52  std::string func_type;
53  in >> func_type;
54  func_to_weight_ = func_factory.func_types_[ func_type ]->clone();
55  func_to_weight_->read_data( in );
56  }
57 
58  /// @brief show some sort of stringified representation of the violations for this constraint.
60  std::ostream& out,
61  Real r,
62  Size verbose_level,
63  Real threshold
64 ) const {
65  Size ct ( func_to_weight_->show_violations( out, r, verbose_level, threshold ) );
66  return ct;
67 }
68 
69 void
70 SkipViolFunc::show_definition( std::ostream &out ) const {
71  using namespace ObjexxFCL::fmt;
72  out << "SKIPVIOLFUNC" << RJ( 7, count_viols_ ) << " ";
73  func_to_weight_->show_definition( out );
74 }
75 
76 } // namespace constraints
77 } // namespace scoring
78 } // namespace core
79