Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Jobs.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/jobdist/Jobs.cc
11 ///
12 /// @brief
13 /// @author Ian W. Davis
14 
15 
16 #include <basic/options/option.hh>
18 #include <utility/file/FileName.hh>
19 #include <utility/file/file_sys_util.hh>
20 #include <utility/string_util.hh>
21 
22 #include <iomanip>
23 #include <sstream>
24 
25 
26 // option key includes
27 
28 #include <basic/options/keys/out.OptionKeys.gen.hh>
29 #include <basic/options/keys/run.OptionKeys.gen.hh>
30 
31 #include <utility/vector1.hh>
32 
33 
34 
35 namespace protocols {
36 namespace jobdist {
37 
38 
39 /// @details Deliberately discards any path information in the input tag
40 /// as well as any file name extension (since input tags are usually file names).
41 /// There is some possibility this could lead to non-unique output tags,
42 /// which deserves further consideration at some point...
43 std::string BasicJob::output_tag(int struct_n) const
44 {
45  using basic::options::option;
46  using namespace basic::options::OptionKeys;
47 
48  // Use at least 4 digits in number to match Rosetta++
49  int nstruct_width = 0;
50  for(int i = 1; i <= nstruct_ || nstruct_width < 4; i *= 10) nstruct_width += 1;
51  // Treat tags as file names so that we put the number before the extension.
52  // Everything will still work if they're not file names, though.
54  utility::file::FileName out_name = utility::file::combine_names( temp_out_names);
55 //jobs_tracer<< out_name.base()<< std::endl;
56  if( option[ run::shuffle ].user() ) out_name = "S_shuffle";
57  std::ostringstream oss;
58 
59  std::string user_tag("");
60  if ( basic::options::option[ basic::options::OptionKeys::out::user_tag ].user() ) {
61  user_tag = "_" + basic::options::option[ basic::options::OptionKeys::out::user_tag ];
62  }
63 
65  oss << option[ out::prefix ]() << out_name.base() << option[ out::suffix ]()
66  << user_tag << '_' << std::setfill('0') << std::setw(nstruct_width) << (struct_n);
67  }else{
68  oss << option[ out::prefix ]() << out_name << option[ out::suffix ]()
69  << user_tag << '_' << std::setfill('0') << std::setw(nstruct_width) << (struct_n);
70  }
71  out_name.base( oss.str() );
72  return out_name.base();
73 }
74 
75 
76 } // namespace jobdist
77 } // namespace protocols