Skip to content

Commit

Permalink
regression patch
Browse files Browse the repository at this point in the history
patched regression where the ouput switch would crash the code
  • Loading branch information
DetlevCM committed Jul 3, 2015
1 parent 7c9bf2f commit 43a8a4d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
12 changes: 9 additions & 3 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
</tool>
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.319273247" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.285252123" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.160749690" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.160749690" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.more" valueType="enumerated"/>
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1052191191" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.434808899" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/headers}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.1756808621" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.dialect.flags.1965329902" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" value="-std=c++14" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.655957808" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.995030329" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
Expand Down Expand Up @@ -89,7 +91,7 @@
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1194885499" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.347302575" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.1471167164" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.1229277554" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.1229277554" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1494902871" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.913906878" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release"/>
Expand All @@ -100,7 +102,7 @@
<option id="gnu.cpp.link.option.paths.2071182915" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/libraries}&quot;"/>
</option>
<option id="gnu.cpp.link.option.flags.1767542147" superClass="gnu.cpp.link.option.flags" value="-static" valueType="string"/>
<option id="gnu.cpp.link.option.flags.1767542147" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-static" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1358711304" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
Expand Down Expand Up @@ -145,11 +147,14 @@
<option id="gnu.cpp.compiler.option.other.verbose.258431376" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.optimization.flags.842389400" name="Other optimization flags" superClass="gnu.cpp.compiler.option.optimization.flags" useByScannerDiscovery="false" value="-m64 -march=native" valueType="string"/>
<option id="gnu.cpp.compiler.option.dialect.flags.2028087826" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" value="-std=c++14" valueType="string"/>
<option id="gnu.cpp.compiler.option.warnings.extrawarn.1480377328" name="Extra warnings (-Wextra)" superClass="gnu.cpp.compiler.option.warnings.extrawarn" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.other.pic.217907667" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" value="false" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1087350520" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1890043214" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.1499234231" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.1531068451" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.1361701275" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.923693020" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.1485766447" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release"/>
Expand All @@ -160,6 +165,7 @@
<option id="gnu.cpp.link.option.paths.2099848798" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/libraries}&quot;"/>
</option>
<option id="gnu.cpp.link.option.flags.1186658786" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1315145987" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
Expand Down
20 changes: 14 additions & 6 deletions source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ int main(int argc, char* argv[])

// Add a switch to have regular ouput to a log file or debug to command line
// http://stackoverflow.com/questions/12774207/fastest-way-to-check-if-a-file-exist-using-standard-c-c11-c
ifstream file_exists("debug");
ifstream debug_file_exists("debug");
// File does not exist, so redirect to log file
// http://stackoverflow.com/questions/10150468/how-to-redirect-cin-and-cout-to-files
std::ofstream out("log.txt");
if (!file_exists.good()){
//std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf
// http://stackoverflow.com/questions/10150468/how-to-redirect-cin-and-cout-to-files
std::ofstream out("log.txt");
std::streambuf *coutbuf = std::cout.rdbuf(); //save old buffer
if (!debug_file_exists.good()){
std::cout.rdbuf(out.rdbuf());
}//*
else
{
std::cout.rdbuf(coutbuf);
}
file_exists.close();
//*/
debug_file_exists.close();




Expand Down Expand Up @@ -245,6 +251,8 @@ int main(int argc, char* argv[])

}

out.close(); // close output stream
std::cout.rdbuf(coutbuf); // reassign buffer to avoid crash
// And it is done. Return 0 as the code has finished.
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions source/mechanism_reduction/Species_Class_Mapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ vector< int > Map_Species_Classes(
NumberOfClasses = CountUnmappedSpecies + BiggestClass; // sum of unmapped species and the number of classes

cout << "The Mapping consists of " << CountUnmappedSpecies << " unmapped Species, and "
<< BiggestClass << "dedicated class mappings, resulting in " << NumberOfClasses
<< "Species Classes. \n";
<< BiggestClass << " dedicated class mappings, resulting in " << NumberOfClasses
<< " Species Classes. \n";

// Classed species have a number, unclassed species get identified via a negative ID:
// This will only work if I coded the rest well as position 0 drops out
Expand Down

0 comments on commit 43a8a4d

Please sign in to comment.