29 #include <boost/foreach.hpp>
30 #define foreach BOOST_FOREACH
33 #include <utility/file/FileName.hh>
34 #include <basic/options/option.hh>
35 #include <basic/Tracer.hh>
36 #include <basic/prof.hh>
38 #include <utility/vector1.hh>
39 #include <utility/file/file_sys_util.hh>
42 #include <basic/options/keys/out.OptionKeys.gen.hh>
43 #include <basic/options/keys/run.OptionKeys.gen.hh>
44 #include <basic/options/keys/jd2.OptionKeys.gen.hh>
46 #include <numeric/random/random.hh>
51 static numeric::random::RandomGenerator
RG(10321155);
52 static basic::Tracer
tr(
"protocols.jd2.SilentFileJobOutputter");
76 typedef std::map< std::string, core::io::silent::SilentFileData > SFD_MAP;
89 sfds[ it->second ].add_structure( (*it->first) );
91 for ( SFD_MAP::iterator it = sfds.begin(); it!=sfds.end(); ++it ) {
92 it->second.write_all( it->first );
104 using namespace basic::options;
105 using namespace basic::options::OptionKeys;
109 utility_exit_with_message(
"Please supply a file name with the -out:file:silent flag. If you specify a path the -out:path:all flag, the -out:file:silent file name will be relative to it.");
116 tr.Debug <<
"SilentFileJobOutputter setup for file " <<
silent_file_ << std::endl;
120 MPI_Comm_rank (MPI_COMM_WORLD, &
mpi_rank);
123 size_t lastslash = name.find_last_of(
"/\\");
124 size_t lastdot = name.find_last_of(
'.');
134 if ( option[ basic::options::OptionKeys::jd2::dd_parser ]() ) {
135 if ( option[ out::file::silent_struct_type ]() !=
"score")
136 option[ out::file::silent_struct_type ].value(
"binary" );
140 n_to_buffer_ = option[ basic::options::OptionKeys::jd2::buffer_silent_output ]();
144 option[ run::intermediate_scorefiles ]() ||
145 option[ run::intermediate_structures ]()
152 if ( option[ OptionKeys::out::file::scorefile ].user() ){
165 if( tag.substr( 0, 8 ) ==
"FAILURE_" )
166 tag = tag.substr( 8, 1000 );
180 using namespace basic::options;
227 bool bWriteScoreOnly,
230 PROF_START( basic::JD2_SILENT_OUTPUTTER );
235 if ( bWriteScoreOnly ) {
241 std::ostringstream tag;
243 if ( copy_count>=0 ) {
246 tag <<
"_" << std::setfill(
'0') << std::setw(3) << replica;
248 tag <<
'_' << std::setfill(
'0') << std::setw(8) << copy_count;
250 ss->fill_struct( pose_in, tag.str() );
258 tr.Debug <<
"adding struct " << ss->decoy_tag() << std::endl;
268 PROF_STOP( basic::JD2_SILENT_OUTPUTTER );
281 using namespace basic::options;
282 using namespace basic::options::OptionKeys;
285 if ( job->completed() ) {
291 if ( option[ run::multiple_processes_writing_to_one_directory ].value() ) {
296 bool const already_written(
309 tags.push_back( it->first->decoy_tag() );
312 bool const already_buffered(
313 find_if( tags.begin(), tags.end(), predicate ) != tags.end()
316 return ( already_written || already_buffered );
342 return "SilentFileJobOutputter";