From e44a5a0805e8b9d9a9fd3c42c8437a9a472c366c Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Tue, 27 Jan 2015 12:57:33 +0000 Subject: [PATCH] Remove code to measure the trust-region convergence speed I don't think I will need that again in the foreseeable future. If ever it should be needed again the code can be taken from the subversion archive. [[Imported from SVN: r10020]] --- ...monicmaps-stereographic-measurement.parset | 3 - src/harmonicmaps.cc | 82 ------------------- 2 files changed, 85 deletions(-) diff --git a/src/harmonicmaps-stereographic-measurement.parset b/src/harmonicmaps-stereographic-measurement.parset index c5f9e277..b0790e49 100644 --- a/src/harmonicmaps-stereographic-measurement.parset +++ b/src/harmonicmaps-stereographic-measurement.parset @@ -44,9 +44,6 @@ mgTolerance = 1e-10 # Tolerance of the base grid solver baseTolerance = 1e-8 -# Measure convergence -instrumented = false - ############################ # Problem specifications ############################ diff --git a/src/harmonicmaps.cc b/src/harmonicmaps.cc index e8493f8a..2fea3331 100644 --- a/src/harmonicmaps.cc +++ b/src/harmonicmaps.cc @@ -279,88 +279,6 @@ int main (int argc, char *argv[]) try vtkWriter.write(resultPath + "_" + energy + "_result"); - // ////////////////////////////////////////////////////////// - // Recompute and compare against exact solution - // ////////////////////////////////////////////////////////// - - SolutionType exactSolution = x; - - // ////////////////////////////////////////////////////////////////////// - // Compute mass matrix and laplace matrix to emulate L2 and H1 norms - // ////////////////////////////////////////////////////////////////////// - - typedef P1NodalBasis<GridType::LeafGridView,double> FEBasis; - FEBasis basis(grid->leafGridView()); - OperatorAssembler<FEBasis,FEBasis> operatorAssembler(basis, basis); - - LaplaceAssembler<GridType, FEBasis::LocalFiniteElement, FEBasis::LocalFiniteElement> laplaceLocalAssembler; - MassAssembler<GridType, FEBasis::LocalFiniteElement, FEBasis::LocalFiniteElement> massMatrixLocalAssembler; - - typedef Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1> > ScalarMatrixType; - ScalarMatrixType laplaceMatrix, massMatrix; - - operatorAssembler.assemble(laplaceLocalAssembler, laplaceMatrix); - operatorAssembler.assemble(massMatrixLocalAssembler, massMatrix); - - - double error = std::numeric_limits<double>::max(); - - SolutionType intermediateSolution(x.size()); - - // Create statistics file - std::ofstream statisticsFile((resultPath + "trStatistics").c_str()); - - // Compute error of the initial iterate - typedef BlockVector<TargetSpace::CoordinateType> DifferenceType; - DifferenceType difference = computeEmbeddedDifference(exactSolution, initialIterate); - - H1SemiNorm< BlockVector<TargetSpace::CoordinateType> > h1Norm(laplaceMatrix); - H1SemiNorm< BlockVector<TargetSpace::CoordinateType> > l2Norm(massMatrix); - - //double oldError = std::sqrt(EnergyNorm<BCRSMatrix<FieldMatrix<double, blocksize, blocksize> >, BlockVector<FieldVector<double,blocksize> > >::normSquared(geodesicDifference, hessian)); - double oldError = h1Norm(difference); - int i; - for (i=0; i<maxTrustRegionSteps; i++) { - - // ///////////////////////////////////////////////////// - // Read iteration from file - // ///////////////////////////////////////////////////// - char iSolFilename[100]; - sprintf(iSolFilename, "tmp/intermediateSolution_%04d", i); - - FILE* fp = fopen(iSolFilename, "rb"); - if (!fp) - DUNE_THROW(IOError, "Couldn't open intermediate solution '" << iSolFilename << "'"); - for (size_t j=0; j<intermediateSolution.size(); j++) { - fread(&intermediateSolution[j], sizeof(TargetSpace), 1, fp); - } - - fclose(fp); - - // ///////////////////////////////////////////////////// - // Compute error - // ///////////////////////////////////////////////////// - - difference = computeEmbeddedDifference(exactSolution, intermediateSolution); - - //error = std::sqrt(EnergyNorm<BCRSMatrix<FieldMatrix<double, blocksize, blocksize> >, BlockVector<FieldVector<double,blocksize> > >::normSquared(geodesicDifference, hessian)); - error = h1Norm(difference); - - double convRate = error / oldError; - - // Output - std::cout << "Trust-region iteration: " << i << " error : " << error << ", " - << "convrate " << convRate << std::endl; - statisticsFile << i << " " << error << " " << convRate << std::endl; - - if (error < 1e-12) - break; - - oldError = error; - - } - - // ////////////////////////////// } catch (Exception e) { std::cout << e << std::endl; -- GitLab