Skip to content
Snippets Groups Projects
Commit ab8f0c59 authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Do not have mpiHelper_ as a member of RiemannianTrustRegionSolver after all

Christian Engwer told me a trick how to get the mpiHelper instance without
known argc and argv.

[[Imported from SVN: r9720]]
parent 950d4d77
No related branches found
No related tags found
No related merge requests found
......@@ -314,7 +314,7 @@ int main (int argc, char *argv[]) try
// Create a Riemannian trust-region solver
// /////////////////////////////////////////////////
RiemannianTrustRegionSolver<GridType,TargetSpace> solver(mpiHelper);
RiemannianTrustRegionSolver<GridType,TargetSpace> solver;
solver.setup(*grid,
&assembler,
x,
......
......@@ -2,6 +2,7 @@
#include <dune/common/bitsetvector.hh>
#include <dune/common/timer.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/istl/io.hh>
......@@ -184,7 +185,10 @@ setup(const GridType& grid,
template <class GridType, class TargetSpace>
void RiemannianTrustRegionSolver<GridType,TargetSpace>::solve()
{
int rank = mpiHelper_.rank();
int argc = 0;
char** argv;
Dune::MPIHelper& mpiHelper = Dune::MPIHelper::instance(argc,argv);
int rank = mpiHelper.rank();
MonotoneMGStep<MatrixType,CorrectionType>* mgStep = NULL;
......@@ -217,7 +221,7 @@ void RiemannianTrustRegionSolver<GridType,TargetSpace>::solve()
// /////////////////////////////////////////////////////
double oldEnergy = assembler_->computeEnergy(x_);
oldEnergy = mpiHelper_.getCollectiveCommunication().sum(oldEnergy);
oldEnergy = mpiHelper.getCollectiveCommunication().sum(oldEnergy);
bool recomputeGradientHessian = true;
CorrectionType rhs;
......
......@@ -47,9 +47,8 @@ class RiemannianTrustRegionSolver
public:
RiemannianTrustRegionSolver(Dune::MPIHelper& mpiHelper)
RiemannianTrustRegionSolver()
: IterativeSolver<std::vector<TargetSpace>, Dune::BitSetVector<blocksize> >(0,100,NumProc::FULL),
mpiHelper_(mpiHelper),
hessianMatrix_(std::auto_ptr<MatrixType>(NULL)), h1SemiNorm_(NULL)
{}
......@@ -92,8 +91,6 @@ public:
protected:
/** \brief Gateway to MPI, for the case that we are working in parallel */
Dune::MPIHelper& mpiHelper_;
/** \brief The grid */
const GridType* grid_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment