📄 xmdsoutput.cc
字号:
void xmdsOutput::writePlanCreationCalls( FILE *const outfile, const bool& useFFTWMeasure, const bool& useWisdom) const { if(debugFlag) { printf("xmdsOutput::writePlanCreationCalls\n"); } for(list<xmdsMomentGroup*>::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->writePlanCreationCalls(outfile,useFFTWMeasure,useWisdom); }};// ******************************************************************************void xmdsOutput::writePlanDeletionCalls( FILE *const outfile) const { if(debugFlag) { printf("xmdsOutput::writePlanDeletionCalls\n"); } for(list<xmdsMomentGroup*>::const_iterator pxmdsMomentGroup = myMomentGroupsList.begin(); pxmdsMomentGroup != myMomentGroupsList.end(); pxmdsMomentGroup++) { (*pxmdsMomentGroup)->writePlanDeletionCalls(outfile); }};// ******************************************************************************// ******************************************************************************// xmdsOutput private// ******************************************************************************// ******************************************************************************// ******************************************************************************void xmdsOutput::writePrototypes( FILE *const outfile) const { if(debugFlag) { printf("xmdsOutput::writePrototypes\n"); } if(verbose()) { printf("Writing output prototypes ...\n"); } fprintf(outfile, "// ********************************************************\n" "// output prototypes\n" "\n" "void _write_output();\n" "\n"); xmdsElement::writePrototypes(outfile); fprintf(outfile,"\n");};// ******************************************************************************void xmdsOutput::writeRoutines( FILE *const outfile) const { if(debugFlag) { printf("xmdsOutput::writeRoutines\n"); } if(verbose()) { printf("Writing output routines ...\n"); } // write out code to handle original simulation script fprintf(outfile, "// ********************************************************\n" "// output routines\n" "// ********************************************************\n" "\n" "// *************************\n" "void _write_output() {\n" "\n" " printf(\"Generating output for %s\\n\");\n" " //system(\"rm -f %s\");\n\n" " //if(system(\"split -b %li %s\")) {\n" "\n" " //printf(\"Cannot open my original simulation script '%s'\\n\");\n" " //printf(\"Writing xsil data to separate xml document\\n\");\n" "\n" " //FILE* _outfile=fopen(\"%s\",\"w\");\n" "\n" " //if(_outfile==0) {\n" " //printf(\"Unable to create output file '%s'\\n\");\n" " //printf(\"Exiting.\\n\");\n" " //return;\n" " //}\n" "\n" " //fprintf(_outfile,\"<?xml version=\\\"1.0\\\"?>\\n\");\n" " //fprintf(_outfile,\"\\n\");\n" "\n", simulation()->parameters()->simulationName.c_str(), myOutputFileName.c_str(), myInFileSplitPoint,simulation()->parameters()->rawFileName.c_str(), simulation()->parameters()->rawFileName.c_str(), myOutputFileName.c_str(), myOutputFileName.c_str()); // biff out some informative text about xmds - this is the header fprintf(outfile," //fprintf(_outfile,\"<info>\\n\");\n"); fprintf(outfile," //fprintf(_outfile,\"Output generated with xmds version %s, release %s.\\n\");\n", simulation()->parameters()->version.c_str(), simulation()->parameters()->release.c_str()); fprintf(outfile," //fprintf(_outfile,\"See http://www.xmds.org for more information.\\n\");\n"); fprintf(outfile," //fprintf(_outfile,\"</info>\\n\");\n"); // end of informative text // it's more logical to put the simulation tag here fprintf(outfile," //fprintf(_outfile,\"<simulation>\\n\");\n"); // now write out all of the moment groups for(unsigned long i=0;i<myMomentGroupsList.size();i++) { fprintf(outfile," //_mg%li_write_out(_outfile);\n",i); } fprintf(outfile, "\n" " //fprintf(_outfile,\"\\n\");\n" " //fprintf(_outfile,\"</simulation>\\n\");\n"); // biff out some informative text about xmds - this is the footer fprintf(outfile," //fprintf(_outfile,\"<info>\\n\");\n"); fprintf(outfile," //fprintf(_outfile,\"Output generated with xmds version %s, release %s.\\n\");\n", simulation()->parameters()->version.c_str(), simulation()->parameters()->release.c_str()); fprintf(outfile," //fprintf(_outfile,\"See http://www.xmds.org for more information.\\n\");\n"); fprintf(outfile," //fprintf(_outfile,\"</info>\\n\");\n"); // end of informative text fprintf(outfile, "\n" " //fclose(_outfile);\n" " //}\n" " //else {\n" "\n" " //system(\"mv -f xaa %s\");\n" "\n" " FILE* _outfile=fopen(\"%s\",\"w\");\n" "\n" " if(_outfile==0) {\n" " printf(\"Unable to open output file %s\\n\");\n" " printf(\"Exiting.\\n\");\n" " return;\n" " }\n" "\n", myOutputFileName.c_str(), myOutputFileName.c_str(), myOutputFileName.c_str()); // put the header text into the output from the xmds script fprintf(outfile,"\n"); for (unsigned int i=0; i<simHeaderText.size(); i++) { fprintf(outfile," fprintf(_outfile,\"%s\\n\");\n",simHeaderText[i].c_str()); } // put the body text into the output from the xmds script fprintf(outfile,"\n"); for (unsigned int i=0; i<simBodyText.size(); i++) { fprintf(outfile," fprintf(_outfile,\"%s\\n\");\n",simBodyText[i].c_str()); } // biff out some informative text about xmds - this is the footer fprintf(outfile," fprintf(_outfile,\"\\n<info>\\n\");\n"); fprintf(outfile," fprintf(_outfile,\"Output generated with xmds version %s, release %s.\\n\");\n", simulation()->parameters()->version.c_str(), simulation()->parameters()->release.c_str()); fprintf(outfile," fprintf(_outfile,\"See http://www.xmds.org for more information.\\n\");\n"); if (simulation()->argStruct()->nameList.size() != 0) { fprintf(outfile," fprintf(_outfile,\" Variables that can be specified on the command line: \\n\");\n"); list<string>::const_iterator inameList = simulation()->argStruct()->nameList.begin(); list<string>::const_iterator itypeList = simulation()->argStruct()->typeList.begin(); for (long unsigned int i=0; i<simulation()->argStruct()->nameList.size(); i++) { string theType=itypeList->c_str(); if( theType=="double "){ fprintf(outfile," fprintf(_outfile,\" Command line argument '%s' = %%e \\n\",%s);\n",inameList->c_str(),inameList->c_str());} else if(theType=="long "){ fprintf(outfile," fprintf(_outfile,\" Command line argument '%s' = %%li \\n\",%s);\n",inameList->c_str(),inameList->c_str());} else if(theType=="float "){ fprintf(outfile," fprintf(_outfile,\" Command line argument '%s' = %%e \\n\",%s);\n",inameList->c_str(),inameList->c_str());} else if(theType=="int "){ fprintf(outfile," fprintf(_outfile,\" Command line argument '%s' = %%i \\n\",%s);\n",inameList->c_str(),inameList->c_str());} else { fprintf(outfile," fprintf(_outfile,\" Command line argument '%s' is an unimplemented output type '%s'\\n\");\n",inameList->c_str(),itypeList->c_str());} itypeList++; inameList++; } fprintf(outfile,"\n"); } fprintf(outfile," fprintf(_outfile,\"</info>\\n\");\n"); // end of informative text // now put the data into the file for(unsigned long i=0;i<myMomentGroupsList.size();i++) { fprintf(outfile," _mg%li_write_out(_outfile);\n",i); } // put the footer text into the xmds simulation output fprintf(outfile,"\n"); for (unsigned int i=0; i<simFooterText.size(); i++) { fprintf(outfile," fprintf(_outfile,\"%s\\n\");\n",simFooterText[i].c_str()); } // close things down and tidy up a bit fprintf(outfile, "\n" " fclose(_outfile);\n" "\n" " //system(\"cat xab >> %s\");\n" "\n" " //system(\"rm -f xab\");\n" " //}\n" "}\n" "\n", myOutputFileName.c_str()); xmdsElement::writeRoutines(outfile); fprintf(outfile,"\n");};// ******************************************************************************xmdsMomentGroup* xmdsOutput::createxmdsMomentGroup() { if(debugFlag) { printf("xmdsOutput::createxmdsMomentGroup\n"); } xmdsMomentGroup* newxmdsMomentGroup = new xmdsMomentGroup(simulation(),verbose(),myMomentGroupsList.size()); addChild((xmdsElement*) newxmdsMomentGroup); myMomentGroupsList.push_back(newxmdsMomentGroup); return newxmdsMomentGroup;};// ******************************************************************************xmdsBreakPoint* xmdsOutput::createxmdsBreakPoint() { if(debugFlag) { printf("xmdsOutput::createxmdsBreakPoint\n"); } xmdsBreakPoint* newxmdsBreakPoint = new xmdsBreakPoint(simulation(),verbose()); addChild((xmdsElement*) newxmdsBreakPoint); return newxmdsBreakPoint;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -