Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LoopRefineInnerCycleFactory.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/loops/loop_mover/refine/LoopRefineInnerCycleFactory.cc
11 /// @brief Factory for creating LoopRefineInnerCycle objects
12 /// @author Brian D. Weitzner ( brian.weitzner@gmail.com )
13 
14 // Unit Headers
16 
17 // Package headers
21 
22 // Project Headers
26 
27 // Basic headers
28 #include <basic/Tracer.hh>
29 
30 // Utility headers
31 #include <utility/excn/Exceptions.hh>
32 #include <utility/tools/make_vector1.hh>
33 #include <utility/vector1.hh>
34 
35 // C++ Headers
36 #include <sstream>
37 
38 namespace protocols {
39 namespace loops {
40 namespace loop_mover {
41 namespace refine {
42 
43 using std::string;
44 using utility::tools::make_vector1;
45 using utility::vector1;
46 
47 static basic::Tracer TR("protocols.loops.loop_mover.refine.LoopRefineInnerCycleFactory");
49 
51 {
52  // It's ok to skip checking if the vector has been set up already because this class is a singleton.
54 
55  // Individual LoopRefineInnerCycles
56  loop_refine_inner_cycle_name_to_string_[ IC_SmallMinCCDTrial ] = make_vector1< string >( "SmallMinCCDTrial" );
57  loop_refine_inner_cycle_name_to_string_[ IC_ShearMinCCDTrial ] = make_vector1< string >( "ShearMinCCDTrial" );
58  loop_refine_inner_cycle_name_to_string_[ IC_RepackTrial ] = make_vector1< string >( "RepackTrial" );
59 
60  // Pre-made algorithms
61  loop_refine_inner_cycle_name_to_string_[ IC_RefineCCDStandard ] = make_vector1< string >(
62  "SmallMinCCDTrial", "ShearMinCCDTrial", "RepackTrial" );
63 }
64 
65 ///////////////////////////////////////////////////////////////////////////////////////////////////////
66 ////////////////////////////////////////////// BOILER PLATE CODE //////////////////////////////////////
67 ///////////////////////////////////////////////////////////////////////////////////////////////////////
68 
70 
71 /// @details Private constructor insures correctness of singleton.
73 {
75 }
76 
78 
80 
82 {
83  if ( instance_ == 0 ) {
85  }
86  return instance_;
87 }
88 
89 ///////////////////////////////////////////////////////////////////////////////////////////////////////
90 /////////////////////////////////////// END OF BOILER PLATE CODE //////////////////////////////////////
91 ///////////////////////////////////////////////////////////////////////////////////////////////////////
92 
94  LoopRefineInnerCycleName type_name,
95  LoopMover_Refine_CCDAP loop_mover,
99 ) const {
100 
101  vector1< string > movers_to_make = loop_refine_inner_cycle_name_to_string_[ type_name ];
102 
103  LoopRefineInnerCycleOP inner_cycle;
104  if ( movers_to_make.size() == 1 )
105  {
106  inner_cycle = make_inner_cycle_from_string_name( movers_to_make[ 1 ] );
107  }
108  else
109  {
111 
112  for( vector1< string >::const_iterator it = movers_to_make.begin(); it != movers_to_make.end(); ++it )
113  {
114  tmp_inner_cycle->add_inner_cycle_step( make_inner_cycle_from_string_name( *it ) );
115  }
116  inner_cycle = tmp_inner_cycle;
117  }
118 
119  inner_cycle->set_loop_mover( loop_mover );
120  inner_cycle->set_mc( mc );
121  inner_cycle->set_scorefxn( scorefxn );
122  inner_cycle->set_task_factory( tf );
123 
124  return inner_cycle;
125 }
126 
127 
129 {
130  TR.Trace << "generate LoopRefineInnerCycle of type " << name << std::endl;
131  LoopRefineInnerCycleOP inner_cycle = dynamic_cast< LoopRefineInnerCycle * >(
132  ( moves::MoverFactory::get_instance()->newMover( name ) ).get() );
133 
134  if( ! inner_cycle ){
135  using utility::excn::EXCN_Msg_Exception;
136  throw EXCN_Msg_Exception( "Attempting to create Mover '" + name + \
137  "' that cannot be casted to a LoopRefineInnerCycle. Check your spelling and/or confirm this mover has been " +\
138  "registered to the MoverFactory." );
139  }
140  return inner_cycle;
141 }
142 
143 } // namespace refine
144 } // namespace loop_mover
145 } // namespace loops
146 } // namespace protocols