本文整理汇总了C++中out_file函数的典型用法代码示例。如果您正苦于以下问题:C++ out_file函数的具体用法?C++ out_file怎么用?C++ out_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了out_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char ** argv) {
try {
using float_t = double;
using size_type = std::uint32_t;
if (4 != argc)
throw std::invalid_argument("usage: simplify <<t> | -p> <in_file> <out_file>");
// read the flow complex from file
auto fc = FC::flow_complex<float_t, size_type>(42, 42); // dummy
{
auto in_filename = argv[2];
std::ifstream in_file(in_filename);
in_file >> fc;
}
char const* action = argv[1];
if (std::string(action) == "-p") {
char const* out_filename = argv[3];
std::ofstream out_file(out_filename);
print_histogram(out_file, std::move(fc));
} else {
// simplify
float_t const t = std::atof(argv[1]);
if (t < 1)
throw std::invalid_argument("prerequisite: t >= 1");
fc = simplify(std::move(fc), t);
// write result flow complex to file
char const* out_filename = argv[3];
std::ofstream out_file(out_filename);
out_file << fc;
}
} catch (std::exception & e) {
std::cerr << e.what() << std::endl;
std::exit(EXIT_FAILURE);
}
std::exit(EXIT_SUCCESS);
}
开发者ID:lars-kuehne,项目名称:flow-complex,代码行数:35,代码来源:simplify.cpp
示例2: save_column_vector
void ExplicitSystemManager::dump_system() {
int denominator = std::max((int)options.save_frequency, 1);
std::string filename_tail = (boost::format("_%05d") % (iteration_number / denominator)).str();
std::string displacements_filename = (boost::format("%s%s.txt") % options.nodal_displacements_filename % filename_tail).str();
std::string velocities_filename = (boost::format("%s%s.txt") % options.nodal_velocities_filename % filename_tail).str();
std::string forces_filename = (boost::format("%s%s.txt") % options.nodal_forces_filename % filename_tail).str();
save_column_vector(explicit_system->getDisplacements(), displacements_filename);
config_doc["nodal_displacements"].SetString(displacements_filename.c_str(), displacements_filename.length());
save_column_vector(explicit_system->getVelocities(), velocities_filename);
config_doc["nodal_velocities"].SetString(velocities_filename.c_str(), velocities_filename.length());
save_column_vector(explicit_system->getForces(), forces_filename);
config_doc["start_time"].SetDouble(explicit_system->getTime());
config_doc["iteration_number"].SetUint(iteration_number);
std::string state_filename((boost::format("%s%s.json") % options.state_filename % filename_tail).str());
std::ofstream out_file(state_filename);
if (out_file.is_open()) {
rapidjson::OStreamWrapper o_wrapper(out_file);
rapidjson::PrettyWriter<rapidjson::OStreamWrapper> writer(o_wrapper);
config_doc.Accept(writer);
out_file.close();
}
else {
throw std::runtime_error((boost::format("Unable to open %s.") % state_filename).str());
}
}
开发者ID:latture,项目名称:explicit-beam-fea,代码行数:30,代码来源:explicit_system_manager.cpp
示例3: out_file
void EMFit::output(std::string out_file_name, std::string out_pdb_file_name) {
std::ofstream out_file(out_file_name.c_str());
out_file << "receptorPdb (str) " << rec_file_name_ << std::endl;
out_file << "ligandPdb (str) " << lig_file_name_ << std::endl;
EM3DFitResult::print_header(out_file);
out_file.setf(std::ios::fixed, std::ios::floatfield);
out_file.setf(std::ios::right, std::ios::adjustfield);
IMP::algebra::Vector3Ds lig_points;
IMP::saxs::get_coordinates(lig_particles_, lig_points);
for (unsigned int i = 0; i < fit_results_.size(); i++) {
out_file << fit_results_[i] << std::endl;
}
out_file.close();
if (fit_results_.size() == 1) { // output PDB
IMP::algebra::Transformation3D tr = fit_results_[0].get_map_trans();
IMP::Particles ps = rec_particles_;
ps.insert(ps.end(), lig_particles_.begin(), lig_particles_.end());
// transform
for (IMP::Particles::iterator it = ps.begin(); it != ps.end();
it++) {
IMP::core::XYZ d(*it);
d.set_coordinates(tr * d.get_coordinates());
}
// output
std::ofstream out_file2(out_pdb_file_name.c_str());
IMP::ParticlesTemp pst = ps;
IMP::atom::write_pdb(pst, out_file2);
out_file2.close();
}
}
开发者ID:salilab,项目名称:imp,代码行数:31,代码来源:EMFit.cpp
示例4: out_file
bool Curves::plot_print_standard_residual(const char *path , double *standard_residual) const
{
bool status = false;
register int i;
ofstream out_file(path);
if (out_file) {
status = true;
// writing of observed responses and standardized residuals
for (i = 0;i < length;i++) {
if (frequency[i] > 0) {
out_file << i << " " << point[0][i];
if (standard_residual) {
out_file << " " << standard_residual[i];
}
out_file << " " << frequency[i] << endl;
}
}
}
return status;
}
开发者ID:pradal,项目名称:StructureAnalysis,代码行数:26,代码来源:curves.cpp
示例5: file_init
static void
file_init(void)
{
int i; /* loop index */
/*
*
* Gets everything ready for the next input file.
*
*/
dwb_devname[0] = '\0';
res = 0;
hort = 1;
vert = 1;
font = 1;
size = 10;
nfonts = 0;
slant = 0;
height = 0;
for ( i = 0; i < NFONT; i++ )
fontname[i].name[0] = '\0';
pages = 0;
bytes = 0;
out_file(); /* set up the output file */
} /* End of file_init */
开发者ID:n-t-roff,项目名称:DWB3.3,代码行数:32,代码来源:dsplit.c
示例6: in_file
void ObjectWriter::CopyFile(std::string in, std::string out){
std::ifstream in_file(in.c_str(), std::fstream::binary);
std::ofstream out_file(out.c_str(), std::fstream::trunc|std::fstream::binary);
out_file << in_file.rdbuf();
in_file.close();
out_file.close();
}
开发者ID:fredwen2008,项目名称:Element-Games-Engine,代码行数:7,代码来源:ObjectWriter.cpp
示例7: main
int main()
{
// set_Progress_Bar_visibility(true);
std::ofstream out_file("data/Precision_Scan.txt", std::fstream::out);
out_file << "Tilde basis:" << std::endl;
out_file.close();
Verify::Precision_Scan(&Tilde::Palphabeta, 0, 1e-2);
Verify::Precision_Scan(&Tilde::Palphabeta, 1, 1e-2);
out_file.open("data/Precision_Scan.txt", std::fstream::app);
out_file << "Hat basis:" << std::endl;
out_file.close();
Verify::Precision_Scan(&Hat::Palphabeta, 0, 1e-2);
Verify::Precision_Scan(&Hat::Palphabeta, 0, 1e-3);
Verify::Precision_Scan(&Hat::Palphabeta, 1, 1e-2);
Verify::Precision_Scan(&Hat::Palphabeta, 1, 1e-3);
out_file.open("data/Precision_Scan.txt", std::fstream::app);
out_file << "Check basis (GF):" << std::endl;
out_file.close();
Verify::Precision_Scan(&GF::Palphabeta, 0, 1e-2);
Verify::Precision_Scan(&Check::Palphabeta, 0, 1e-2);
Verify::Precision_Scan(&GF::Palphabeta, 0, 1e-3);
Verify::Precision_Scan(&GF::Palphabeta, 1, 1e-3);
out_file.close();
return 0;
}
开发者ID:PeterDenton,项目名称:Nu-Pert,代码行数:29,代码来源:Verify.cpp
示例8: main
int main() {
// NOTE The rotation matrices below are in Yin Yang's convention (not mine!)
// Airship2IMU gives matrix such that v_Airship = Airship2IMU * v_IMU
double Airship2IMU_raw[] = { 0.280265845357, 0.0, 0.959922421827, 0.0, -1.0, 0.0, 0.959922421827, 0.0, -0.280265845357};
ReaK::rot_mat_3D<double> Airship2IMU(Airship2IMU_raw);
ReaK::quaternion<double> Airship2IMU_quat = ReaK::quaternion<double>(Airship2IMU);
ReaK::quaternion<double> IMU_orientation = Airship2IMU_quat;
ReaK::vect<double,3> IMU_location(-0.896665, 0.0, 0.25711);
// Room2Global gives matrix such that v_room = Room2Global * v_gbl
double Room2Global_raw[] = { 0.75298919442, -0.65759795928, 0.02392064034, -0.6577626482, -0.7532241836, -0.0012758604, 0.018856608, -0.0147733946, -0.9997130464};
ReaK::rot_mat_3D<double> Room2Global(Room2Global_raw);
ReaK::quaternion<double> Room2Global_quat = ReaK::quaternion<double>(Room2Global);
ReaK::quaternion<double> room_orientation = invert(Room2Global_quat);
ReaK::serialization::xml_oarchive out_file("airship3D_transforms.xml");
out_file & RK_SERIAL_SAVE_WITH_NAME(IMU_orientation)
& RK_SERIAL_SAVE_WITH_NAME(IMU_location)
& RK_SERIAL_SAVE_WITH_NAME(room_orientation);
return 0;
};
开发者ID:ahmadyan,项目名称:ReaK,代码行数:35,代码来源:build_airship3D_transforms.cpp
示例9: printTime2File
void printTime2File ( const double Time )
{
std::stringstream msg;
msg << "Total scope_life time= " << Time << " usecs" << std::endl;
File out_file( "times.log" );
out_file.write( msg.str( ).c_str( ) );
}
开发者ID:garmonbozia,项目名称:home,代码行数:7,代码来源:main.cpp
示例10: f
void LogSelectorForm::check_config(){
QString conf_path = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).append("/config.json");
QFile f(conf_path);
if (!f.exists()){
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation));
QJsonValue algorithm("KMeans");
QJsonObject param = QJsonObject();
param.insert("n_clusters",4);
QJsonArray features;
features.append(QString("count_domain_with_numbers"));
features.append(QString("average_domain_length"));
features.append(QString("std_domain_length"));
features.append(QString("count_request"));
features.append(QString("average_requisition_degree"));
features.append(QString("std_requisition_degree"));
features.append(QString("minimum_requisition_degree"));
QJsonObject target = QJsonObject();
target.insert("algorithm",algorithm);
target.insert("features",features);
target.insert("param",param);
QJsonDocument config_out(target);
QFile out_file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation).append("/config.json"));
out_file.open(QIODevice::WriteOnly | QIODevice::Text);
out_file.write(config_out.toJson());
out_file.close();
}
}
开发者ID:yguimaraes,项目名称:pfc_botnets,代码行数:29,代码来源:logselectorform.cpp
示例11: out_file
bool CompoundData::ascii_write(StatError &error , const string path ,
bool exhaustive) const
{
bool status = false;
if (compound) {
ofstream out_file(path.c_str());
error.init();
if (!out_file) {
status = false;
error.update(STAT_error[STATR_FILE_NAME]);
}
else {
status = true;
compound->ascii_write(out_file , this , exhaustive , true);
}
}
return status;
}
开发者ID:pradal,项目名称:StructureAnalysis,代码行数:25,代码来源:compound.cpp
示例12: convert_matrices
void convert_matrices(const std::string &in, const std::string &out) {
std::ifstream in_file(in);
// TODO check if in file exists
std::ofstream out_file(out, std::ofstream::trunc);
std::string line;
int line_num = 0;
while (std::getline(in_file, line)) {
std::istringstream line_stream(line);
std::stringstream output_stream;
out_file << line_num << ' ';
++line_num;
bool c;
int c_num = 0;
int matches = 0;
while (line_stream >> c) {
if (c) {
++matches;
output_stream << ' ' << c_num;
}
++c_num;
}
// construct line
out_file << matches << output_stream.str() << std::endl;
}
in_file.close();
out_file.close();
}
开发者ID:GarrettSmith,项目名称:Nearness,代码行数:33,代码来源:convert_matrices.hpp
示例13: SaveToFile
void SaveToFile(const FileEx &src_file, LONGLONG &ptr)
{
DWORD rw = 0;
BYTE buff[BLOCK_SIZE] = {0};
STATISTIC statistic;
TCHAR file_name[1024] = {0};
_stprintf_s(file_name, 1024, _T("%06I64d.txt"), ptr);
FileEx out_file(file_name);
if (const_cast<FileEx &>(src_file).SetPointer(ptr))
{
while (rw = const_cast<FileEx &>(src_file).Read(buff, BLOCK_SIZE))
{
AnalyzeBuffer(buff, rw, statistic);
if (IsPartOfTextFile(statistic) && out_file.Create())
{
if (statistic.ch_cnt < rw)
{
out_file.Write(buff, GetSequenceLength(buff, rw));
break;
}
else
out_file.Write(buff, rw);
}
else return;
}
}
}
开发者ID:ssidko,项目名称:WorkProjects,代码行数:29,代码来源:cut_txt_main.cpp
示例14: write_half_exr
void write_half_exr( const boost::filesystem::path& p, Imf::Header& header,
const image::const_image_view_t& view, bool write_alpha)
{
boost::gil::rgba16f_image_t img( view.width(), view.height());
boost::gil::copy_and_convert_pixels( view, boost::gil::view( img));
header.channels().insert( "R", Imf::HALF);
header.channels().insert( "G", Imf::HALF);
header.channels().insert( "B", Imf::HALF);
if( write_alpha)
header.channels().insert( "A", Imf::HALF);
Imf::FrameBuffer frameBuffer;
char *ptr = (char *) boost::gil::interleaved_view_get_raw_data( boost::gil::view( img));
std::size_t xstride = 4 * sizeof(half);
std::size_t ystride = xstride * img.width();
frameBuffer.insert( "R", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);
frameBuffer.insert( "G", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);
frameBuffer.insert( "B", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);
if( write_alpha)
frameBuffer.insert( "A", Imf::Slice( Imf::HALF, ptr, xstride, ystride));
Imf::OutputFile out_file( p.external_file_string().c_str(), header);
out_file.setFrameBuffer( frameBuffer);
out_file.writePixels( img.height());
}
开发者ID:apextw,项目名称:Ramen,代码行数:30,代码来源:write_exr.cpp
示例15: out_file
// Saves Solver input (.sif) file.
void
Control::saveSolverInputFile(char* out_filename)
{
ofstream out_file(out_filename, ios::out);
if ( !write_ok(out_file, out_filename, "(Writing ELMER Solver input file)") )
return;
#if defined(FRONT_DEBUG)
theModel->saveSolverInputFile(out_file, out_filename);
#else
try
{
theModel->saveSolverInputFile(out_file, out_filename);
}
catch (...)
{
theUI->showMsg("ERROR: Unable to save Solver input file (sif-file)!");
}
#endif
out_file.close();
}
开发者ID:SangitaSingh,项目名称:elmerfem,代码行数:27,代码来源:ecif_control.cpp
示例16: LB_ASSERT
void BBAzimuthalReflex::process(DataPacket& abs_in_packet)
{
LB_ASSERT(abs_in_packet._domain == DOM_TEMPORAL, "Packet must be in temporal domain.");
DPTemporal& in_packet = dynamic_cast<DPTemporal&>(abs_in_packet);
//Scan through ILD data and decide the next motor command
lbfloat ILD = in_packet[0][0];
//If we can move the head (reflex not ended yet)
if(!_lock)
{
//ILD<0 means the source is on the right
if(ILD<0)
{
//So we turn clockwise
_neck_motor->reach_position(_cw_angle_limit+1);
}
//ILD>0 means the source is on the left
else
{
//So we turn counter-clockwise
_neck_motor->reach_position(_ccw_angle_limit-1);
}
}
//Save data for later log
_ILD.push_back(ILD);
_L_energies.push_back(in_packet[0][1]);
_R_energies.push_back(in_packet[0][2]);
int current_position;
_neck_motor->get_value(MX28_PRESENT_POSITION, current_position);
_theta.push_back((lbfloat)current_position);
_time.push_back(in_packet.get_start_index()/_sample_freq);
//If the ILD's sign changes, we are facing the source
//We also verify that ILD variation is big enough
if(_old_ILD*ILD<0 && _old_ILD!=0 && fabs(_old_ILD-ILD)>=_step_threshold)
{
_neck_motor->stop();
_lock = true;
_neck_motor->get_value(MX28_PRESENT_POSITION, _final_position);
_final_ILD = ILD;
std::cout << "Initial orientation : " << Mx28::step_to_angle(_start_position) << "°" << std::endl
<< "Final orientation : " << Mx28::step_to_angle((_final_position+_theta[_theta.size()-2])/2) << "°" << std::endl
<< "Final ILD : " << (_final_ILD+_old_ILD)/2 << std::endl;
//<< "Final energies (L/R) : " << in_packet[0][1] << " " << in_packet[0][2] << std::endl;
std::ofstream out_file("tests/data/reflex_data.dat");
out_file << "# Params: " << std::endl;
out_file << "# Time(s) \t ILD \t Left Energy \t Right Energy \t Angle" << std::endl;
for(size_t ii=0; ii<_time.size(); ++ii)
{
out_file << _time[ii] << " " << _ILD[ii] << " " << _L_energies[ii] << " " << _R_energies[ii] << " " << _theta[ii] << std::endl;
}
out_file.close();
}
_old_ILD = ILD;
}
开发者ID:ndoxx,项目名称:BinnoBot,代码行数:59,代码来源:BBAzimuthalReflex.cpp
示例17: main
int main(int argc, char** argv) {
std::ifstream in_file(argv[1]);
std::string input((std::istreambuf_iterator<char_type>(in_file)), std::istreambuf_iterator<char_type>());
std::transform(input.begin(), input.end(), input.begin(), caesar_cipher(std::atoi(argv[2])));
std::ofstream out_file("caesar_cipher.txt");
std::cout << input << std::endl;
out_file << input;
}
开发者ID:ryandougherty,项目名称:CaesarCipher,代码行数:8,代码来源:main.cpp
示例18: main
int main( int argc, char **argv ) {
// args
#include <PrepArg/declarations.h>
#include <PrepArg/parse.h>
if ( beg_files < 0 )
return usage( argv[ 0 ], "Please specify an input file", 2 );
bool add_base_files = not ( disp_lexems or disp_tokens );
// particular case
if ( disp_tokens or disp_lexems ) {
// -> source data
ReadFile r( argv[ beg_files ] );
if ( not r ) {
std::cerr << "Impossible to open " << argv[ beg_files ] << std::endl;
return 2;
}
// -> lexical data
ErrorList e;
Lexer l( e );
l.parse( r.data, argv[ beg_files ] );
if ( e )
return 3;
if ( disp_lexems )
l.display();
if ( disp_tokens )
TODO;
return 0;
}
// input files
Vec<String> input_files;
if ( add_base_files and false )
input_files << String( base_met_files ) + "/base.met";
for( int i = beg_files; i < argc; ++i )
input_files << argv[ i ];
// context
Ip ip_inst; ip = &ip_inst;
ip->add_inc_path( base_met_files );
// parse
for( int i = 0; i < input_files.size(); ++i )
ip->import( input_files[ i ] );
// compile
Codegen_C cr;
cr.disp_inst_graph_wo_phi = disp_inst_g_wo_phi;
cr.disp_inst_graph = disp_inst_g;
cr << ip->sys_state.get_val();
std::ofstream out_file( "out.cpp" );
cr.write_to( out_file );
return ip->error_list;
}
开发者ID:hleclerc,项目名称:Stela,代码行数:58,代码来源:stela.cpp
示例19: main
int main(int argc, char *argv[])
{
int thisnode, totalnodes;
MPI_Status status;
MPI_Init(&argc, &argv);
int number_of_realizations = argc - 4;
Real input_rho = atof(argv[1]);
Real input_g = atof(argv[2]);
Real input_alpha = atof(argv[3]);
Real noise_list[number_of_realizations];
for (int i = 0; i < number_of_realizations; i++)
noise_list[i] = atof(argv[i + 4]);
MPI_Comm_size(MPI_COMM_WORLD, &totalnodes);
MPI_Comm_rank(MPI_COMM_WORLD, &thisnode);
long int seed = 0 + thisnode*112488;
while (!Chek_Seeds(seed, thisnode, totalnodes))
{
seed = time(NULL) + thisnode*112488;
MPI_Barrier(MPI_COMM_WORLD);
}
C2DVector::Init_Rand(seed);
Real t_eq,t_sim;
Box box;
for (int i = 0; i < number_of_realizations; i++)
{
if ((i % totalnodes) == thisnode)
{
box.Init(input_rho, input_g, input_alpha, noise_list[i]);
cout << "From processor " << thisnode << " Box information is: " << box.info.str() << endl;
stringstream address;
address.str("");
address << box.info.str() << "-r-v.bin";
ofstream out_file(address.str().c_str());
t_eq = equilibrium(&box, equilibrium_step, saving_period, out_file);
cout << i << " From node: " << thisnode << "\t" << "elapsed time of equilibrium is \t" << t_eq << endl;
t_sim = data_gathering(&box, total_step, saving_period, out_file);
cout << i << " From node: " << thisnode << "\t" << "elapsed time of simulation is \t" << t_sim << endl;
out_file.close();
}
}
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
}
开发者ID:hamidallaei,项目名称:SPP,代码行数:58,代码来源:mpi-main.cpp
示例20: out_file
Solution *Solver::solve(){
std::ofstream out_file (file_out.c_str());
if (!out_file.is_open()) {
std::cout << "Unable to open file";
}
init();
// ------ print solution -------
print_solution(current_solution);
//print_file_solution(0, current_solution, out_file);
// ------ print solution -------
clock_t start, end, total;
start = clock();
for(unsigned int i=0;i<max_iterations;i++){
iter_cost_time = 0;
std::cout << "----- iteration "<< i << " ------" << std::endl;
local_search();
// ------ print solution -------
std::cout << "local search ";
print_solution(current_solution);
print_file_solution(i, current_solution, out_file);
// ------ print solution -------
global_search();
// ------ print solution -------
std::cout << "global search ";
print_solution(current_solution);
//print_file_solution(i, current_solution, out_file);
// ------ print solution -------
tabu_list->update_tabu();
total_cost_time += iter_cost_time;
if(global_best_cost == 0)
break;
}
end = clock();
total = end - start;
printf("\nTotal OpenCL Kernel time in milliseconds = %0.3f ms\n", (total_cost_time / 1000000.0) );
printf("Total CPU time in milliseconds = %0.3f ms\n", total /1000.0);
return global_best;
}
开发者ID:dontyvir,项目名称:OpenCLTabu,代码行数:56,代码来源:Solver.cpp
注:本文中的out_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论