本文整理汇总了C++中Output::close方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::close方法的具体用法?C++ Output::close怎么用?C++ Output::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maass
int maass()
{
/*
зависимость выходной частоты от тока в первом эксперименте
зависимость порога от характера сигнала
зависимость порога от реализации
зависимость частоты выходного сигнала от порога
использовать сигнал кости
*/
srand(time(NULL));
double timeMax = 50.0;
double dt = 0.01;
double dumpPeriod = 10.0;
Node::dt = dt;
std::vector<Node *> generators;
std::vector<Synapse *> synapses1;
std::vector<Synapse *> synapses2;
std::cout<<"Creating neurons..."<<std::endl;
Node node1 = Node("leaky iaf");
node1.I_stim = genran::uniform(14.5, 15.5);
node1.addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
node1.addPsWaveType(PsWave(6.0), "current", -1.0); // inh input
node1.initialiseSpikeBuffer(dt);
Node node2 = Node("leaky iaf");
node2.I_stim = node1.I_stim;
node2.addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
node2.addPsWaveType(PsWave(6.0), "current", -1.0); // inh input
node2.initialiseSpikeBuffer(dt);
std::cout<<"Creating generators..."<<std::endl;
for (int i=0; i < 90; i++){
generators.push_back(new Node("poisson generator"));
Synapse* synapse1 = new Synapse("stdp and tm", &node1, "hard boundaries");
synapse1->setPreset(0); // excitatory constants
synapse1->control(0); // disable stdp and shuffle tm
synapse1->reset();
topology::connectN2N(generators.back(), &node1, synapse1);
synapses1.push_back(synapse1);
Synapse* synapse2 = synapse1->duplicate(&node2); //copy everything
synapse2->control(1); // enable stdp with gamma, don't touch tm
synapse2->reset();
topology::connectN2N(generators.back(), &node2, synapse2);
synapses2.push_back(synapse2);
std::cout<<"\t\t generators created: "<< i << "%\r";
}
for (int i=0; i < 10; i++){
generators.push_back(new Node("poisson generator"));
Synapse* synapse1 = new Synapse("stdp and tm", &node1, "hard boundaries");
synapse1->setPreset(2); // inhibitory constants
synapse1->control(0); // disable stdp and shuffle tm
synapse1->reset();
synapse1->waveType = 1; // inhibitory
topology::connectN2N(generators.back(), &node1, synapse1);
// synapses1.push_back(synapse1);
Synapse* synapse2 = synapse1->duplicate(&node2); //copy everything
topology::connectN2N(generators.back(), &node2, synapse2);
// synapses2.push_back(synapse2);
std::cout<<"\t\t generators created: "<< i+90 << "%\r";
}
std::cout<<std::endl;
std::cout<<"Start output..."<<std::endl;
Output output;
output.openSpikeFile();
output.openSynapticWeightFile("data/target.txt");
output.synapses = synapses1;
output.printSynapticWeights(0.0);
output.closeSynapticWeightFile();
output.openSynapticWeightFile("data/start.txt");
output.synapses = synapses2;
output.printSynapticWeights(0.0);
output.closeSynapticWeightFile();
output.printEssentialData(timeMax);
std::string s;
std::stringbuf dumpTimesBuffer;
std::ostream dumpTimes (&dumpTimesBuffer);
std::cout<<"Starting simulation..."<<std::endl;
for (double t = 0.0; t <= timeMax+dt; t += dt){
for (unsigned i=0; i<generators.size(); i++)
if (generators.at(i)->step(t))
//.........这里部分代码省略.........
示例2: diploma
int diploma()
{
srand(time(NULL));
double timeMax = 1000.0;
double dt = 0.1;
double dumpPeriod = 100.0;
Node::dt = dt;
std::vector<Node *> nodes;
std::vector<Node *> inh_nodes;
std::vector<Synapse *> synapses;
for (int i=0; i < 800; i++){
nodes.push_back(new Node("leaky iaf"));
nodes.back()->I_stim = 14.0 + 2.0*drand(); // 14.0-16.0
nodes.back()->addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
nodes.back()->addPsWaveType(PsWave(3.0), "current", -1.0); // inh input
nodes.back()->initialiseSpikeBuffer(0.1);
}
for (int i=0; i < 200; i++){
inh_nodes.push_back(new Node("leaky iaf"));
inh_nodes.back()->I_stim = 14.0 + 2.0*drand(); // 14.0-16.0
inh_nodes.back()->addPsWaveType(PsWave(3.0), "current", 1.0); // exc input
inh_nodes.back()->addPsWaveType(PsWave(3.0), "current", -1.0); // inh input
inh_nodes.back()->initialiseSpikeBuffer(0.1);
inh_nodes.back()->setPreset(1); // inh neuron params
}
nodes.reserve(nodes.size() + inh_nodes.size());
nodes.insert(nodes.end(), inh_nodes.begin(), inh_nodes.end());
std::vector<Synapse *> synapses_ee = topology::randomTopology(\
nodes, "stdp and tm", 80, 0, "agile boundaries");
std::vector<Synapse *> synapses_ei = topology::randomTopology(\
nodes, inh_nodes, "stdp and tm", 20, 0, "agile boundaries");
for (auto synapse : synapses_ei){
synapse->setPreset(1);
synapse->reset();
}
std::vector<Synapse *> synapses_ie = topology::randomTopology(\
inh_nodes, nodes, "stdp and tm", 80, 1, "agile boundaries");
for (auto synapse : synapses_ie){
synapse->setPreset(2);
synapse->reset();
}
std::vector<Synapse *> synapses_ii = topology::randomTopology(\
inh_nodes, "stdp and tm", 20, 1, "agile boundaries");
for (auto synapse : synapses_ii){
synapse->setPreset(3);
synapse->reset();
}
synapses.reserve(synapses.size() + synapses_ee.size() + synapses_ei.size()\
+ synapses_ie.size() + synapses_ii.size());
synapses.insert(synapses.end(), synapses_ee.begin(), synapses_ee.end());
synapses.insert(synapses.end(), synapses_ei.begin(), synapses_ei.end());
synapses.insert(synapses.end(), synapses_ie.begin(), synapses_ie.end());
synapses.insert(synapses.end(), synapses_ii.begin(), synapses_ii.end());
// nodes.push_back(new Node("periodic generator"));
// nodes.push_back(new Node("neuron liaf"));
// nodes.back()->I_stim = 0.0;
// nodes.back()->addPsWaveType(PsWave(3.0), "current", 1.0);
// nodes.back()->initialiseSpikeBuffer(0.1);
// std::vector<Synapse *> synapses;
// for (int i=0; i < 100; i++){
// synapses.push_back(topology::connectN2N(nodes[0], nodes[1], "synapse tm"));
// synapses.back()->waveType = 0;
// }
Output output;
// output.open();
output.openSpikeFile();
// output.openSynapticCurrentFile();
// output.openSynapticWeightFile();
output.nodes = nodes;
output.synapses = synapses;
output.printEssentialData(timeMax);
for (double t = 0.0; t <= timeMax; t += dt){
// std::cout<<"t "<<t<< std::endl;
for (unsigned i=0; i<nodes.size(); i++)
if (nodes.at(i)->step(t))
output.push(t, i);
// for (unsigned i=0; i<inh_nodes.size(); i++)
// if (inh_nodes.at(i)->step(t))
// output.push(t, i+400);
if (isPeriodNow(t, dumpPeriod, dt))
output.print(t);
std::cout<<"Finished "<< t / timeMax <<" of the simulation.\t\t\r";
}
std::cout<<std::endl;
output.close();
//.........这里部分代码省略.........
示例3: goGetit
// download http with wget or preferred browser
void Gutenbrowser::goGetit( const QString &url, bool showMsg) {
QString cmd;
qApp->processEvents();
QString filename = local_library + "/GUTINDEX.ALL";
Config cfg("Gutenbrowser");
cfg.setGroup("FTPsite");
ftp_host=cfg.readEntry("SiteName", "sailor.gutenberg.org");
ftp_base_dir= cfg.readEntry("base", "/pub/gutenberg");
if(!showMsg) {
//if we just get the gutenindex.all
cmd="wget -O " + filename +" " + url+" 2>&1" ;
chdir(local_library);
Output *outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),
TRUE);
outDlg->showMaximized();
outDlg->show();
qApp->processEvents();
FILE *fp;
char line[130];
outDlg->OutputEdit->append( tr("Running wget") );
outDlg->OutputEdit->setCursorPosition(
outDlg->OutputEdit->numLines() + 1,
0, FALSE
);
sleep(1);
fp = popen( (const char *) cmd, "r");
if ( fp ) {
while ( fgets( line, sizeof line, fp)) {
outDlg->OutputEdit->append(line);
outDlg->OutputEdit->setCursorPosition(
outDlg->OutputEdit->numLines() + 1,
0,FALSE
);
}
pclose(fp);
outDlg->OutputEdit->append("Finished downloading\n");
outDlg->OutputEdit->setCursorPosition(
outDlg->OutputEdit->numLines() + 1,
0, FALSE
);
qApp->processEvents();
}
outDlg->close();
delete outDlg;
} else {
if( brow == "Konq")
cmd = "konqueror "+url+" &";
if( brow == "Opera")
//for desktop testing
cmd = "opera "+url+" &";
if( brow == "Mozilla")
cmd = "mozilla "+url+" &";
if( brow == "Netscape")
cmd = "netscape "+url+" &";
if(brow == "wget") {
QString tempHtml=local_library+"webster.html";
cmd="wget -O "+tempHtml+" -q "+url;
}
chdir(local_library);
system(cmd);
}
}