[mathicgb] 270/393: Added command line option -outputResult to mgb

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.

commit 7a71ecb5e391cdb030e1e9920f2362afc9c5a9ca
Author: Mike Stillman <mikestillman1 at gmail.com>
Date:   Wed Apr 17 14:54:51 2013 -0400

    Added command line option -outputResult to mgb
---
 src/cli/GBAction.cpp       | 22 +++++++++++++---------
 src/cli/GBCommonParams.cpp |  7 +++++++
 src/cli/GBCommonParams.hpp |  1 +
 src/cli/SigGBAction.cpp    | 31 +++++++++++++++++--------------
 4 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/src/cli/GBAction.cpp b/src/cli/GBAction.cpp
index e2d428a..8e00ef5 100755
--- a/src/cli/GBAction.cpp
+++ b/src/cli/GBAction.cpp
@@ -102,15 +102,19 @@ void GBAction::performAction() {
   alg.computeGrobnerBasis();
   alg.printStats(std::cerr);
 
-  /*
-  std::ofstream statsOut((mProjectName.value() + ".stats").c_str());
-  alg.printStats(statsOut);
-  {
-    std::string basisFileName = mProjectName.value() + ".gb";
-    FILE* basisOut = std::fopen(basisFileName.c_str(), "w");
-    output(basisOut, alg.basis());
-  }
-  */
+  if (mGBParams.mOutputResult.value())
+    {
+      // output Groebner basis into .gb file.
+
+      // The stats information is displayed to cout (above),
+      // so we disable it here.
+      // std::ofstream statsOut((projectName + ".stats").c_str());
+      // alg.printStats(statsOut);
+
+      std::string basisFileName = projectName + ".gb";
+      FILE* basisOut = std::fopen(basisFileName.c_str(), "w");
+      output(basisOut, alg.basis());
+    }
 }
 
 const char* GBAction::staticName() {
diff --git a/src/cli/GBCommonParams.cpp b/src/cli/GBCommonParams.cpp
index 54117f2..b2b4079 100755
--- a/src/cli/GBCommonParams.cpp
+++ b/src/cli/GBCommonParams.cpp
@@ -13,6 +13,12 @@ GBCommonParams::GBCommonParams():
     "If this option is false, the oldest reducer is always used.",
     true),
 
+  mOutputResult("outputResult",
+    "If true, output the resulting Groebner or signature basis "
+    "to the file <projectName>.gb and in the signature basis "
+    "case, the signatures of the syzygies are placed in <projectName>.syz",
+    false),
+
   mSPairQueue("spairQueue",
     "The priority queue used to order S-pairs.\n"
     "  0   tournament tree in front of triangle\n"
@@ -69,6 +75,7 @@ void GBCommonParams::pushBackParameters(
   std::vector<mathic::CliParameter*>& parameters
 ) {
   parameters.push_back(&mPreferSparseReducers);
+  parameters.push_back(&mOutputResult);
   parameters.push_back(&mSPairQueue);
   parameters.push_back(&mBreakAfter);
   parameters.push_back(&mPrintInterval);
diff --git a/src/cli/GBCommonParams.hpp b/src/cli/GBCommonParams.hpp
index c7f353c..04a4cfd 100755
--- a/src/cli/GBCommonParams.hpp
+++ b/src/cli/GBCommonParams.hpp
@@ -11,6 +11,7 @@ public:
   void perform();
 
   mathic::BoolParameter mPreferSparseReducers;
+  mathic::BoolParameter mOutputResult;
   mathic::IntegerParameter mSPairQueue;
   mathic::IntegerParameter mBreakAfter;
   mathic::IntegerParameter mPrintInterval;
diff --git a/src/cli/SigGBAction.cpp b/src/cli/SigGBAction.cpp
index b62c4eb..8dad9df 100644
--- a/src/cli/SigGBAction.cpp
+++ b/src/cli/SigGBAction.cpp
@@ -82,20 +82,23 @@ void SigGBAction::performAction() {
     alg.displayPaperStats(statsOut);
   }
 
-  // print basis
-  {
-    std::ofstream ogb((mParams.inputFileNameStem(0) + ".gb").c_str());
-    ogb << "-- gb: ----\n";
-    alg.getGB()->display(ogb);
-  }
-
-  // print syzygy basis
-  {
-    std::ofstream syzygyOut((mParams.inputFileNameStem(0) + ".syz").c_str());
-    syzygyOut << "-- syz: ----\n";
-    alg.getSyzTable()->display(syzygyOut, 1);
-    syzygyOut << std::endl;
-  }
+  if (mGBParams.mOutputResult.value())
+    {
+      // print basis
+      {
+        std::ofstream ogb((mParams.inputFileNameStem(0) + ".gb").c_str());
+        ogb << "-- gb: ----\n";
+        alg.getGB()->display(ogb);
+      }
+      
+      // print syzygy basis
+      {
+        std::ofstream syzygyOut((mParams.inputFileNameStem(0) + ".syz").c_str());
+        syzygyOut << "-- syz: ----\n";
+        alg.getSyzTable()->display(syzygyOut, 1);
+        syzygyOut << std::endl;
+      }
+    }
 }
 
 const char* SigGBAction::staticName() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git



More information about the debian-science-commits mailing list