From 11213d96826c3be24ec274cb201206d631ac8838 Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 14 Aug 2007 15:01:03 +0000 Subject: [PATCH] write statistics to a file; accept a resultPath parameter; accept parameter set file name as command line argument [[Imported from SVN: r1511]] --- rod3d.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rod3d.cc b/rod3d.cc index 9b3681db..d9ecdbbc 100644 --- a/rod3d.cc +++ b/rod3d.cc @@ -41,7 +41,10 @@ int main (int argc, char *argv[]) try // parse data file ConfigParser parameterSet; - parameterSet.parseFile("rod3d.parset"); + if (argc==2) + parameterSet.parseFile(argv[1]); + else + parameterSet.parseFile("rod3d.parset"); // read solver settings const int numLevels = parameterSet.get("numLevels", int(1)); @@ -57,7 +60,8 @@ int main (int argc, char *argv[]) try const double initialTrustRegionRadius = parameterSet.get("initialTrustRegionRadius", double(1)); const int numRodBaseElements = parameterSet.get("numRodBaseElements", int(0)); const bool instrumented = parameterSet.get("instrumented", int(0)); - + std::string resultPath = parameterSet.get("resultPath", ""); + // /////////////////////////////////////// // Create the grid // /////////////////////////////////////// @@ -152,7 +156,7 @@ int main (int argc, char *argv[]) try // ////////////////////////////// // Output result // ////////////////////////////// - writeRod(x, "rod3d.result"); + writeRod(x, resultPath + "rod3d.result"); BlockVector<FieldVector<double, 6> > strain(x.size()-1); rodAssembler.getStrain(x,strain); //std::cout << strain << std::endl; @@ -183,6 +187,9 @@ int main (int argc, char *argv[]) try SolutionType intermediateSolution(x.size()); + // Create statistics file + std::ofstream statisticsFile((resultPath + "trStatistics").c_str()); + // Compute error of the initial 3d solution // This should really be exactSol-initialSol, but we're starting @@ -230,6 +237,7 @@ int main (int argc, char *argv[]) try // Output std::cout << "Trust-region iteration: " << i << " error : " << error << ", " << "convrate " << convRate << std::endl; + statisticsFile << i << " " << error << " " << convRate << std::endl; if (error < 1e-12) break; -- GitLab