diff --git a/dune/elasticity/assemblers/localadolcstiffness.hh b/dune/elasticity/assemblers/localadolcstiffness.hh index 582381f1772bc9701088413d2c554830066a318c..a22bb83dcd930a288b5ef390f2879cbe4751c985 100644 --- a/dune/elasticity/assemblers/localadolcstiffness.hh +++ b/dune/elasticity/assemblers/localadolcstiffness.hh @@ -68,11 +68,12 @@ energy(const Entity& element, const LocalFiniteElement& localFiniteElement, const VectorType& localSolution) const { + int rank = Dune::MPIHelper::getCollectiveCommunication().rank(); double pureEnergy; std::vector<Dune::FieldVector<adouble,blocksize> > localASolution(localSolution.size()); - trace_on(1); + trace_on(rank); adouble energy = 0; @@ -84,7 +85,7 @@ energy(const Entity& element, energy >>= pureEnergy; - trace_off(); + trace_off(rank); return pureEnergy; } @@ -103,6 +104,7 @@ assembleGradientAndHessian(const Entity& element, const VectorType& localSolution, VectorType& localGradient) { + int rank = Dune::MPIHelper::getCollectiveCommunication().rank(); // Tape energy computation. We may not have to do this every time, but it's comparatively cheap. energy(element, localFiniteElement, localSolution); @@ -121,7 +123,7 @@ assembleGradientAndHessian(const Entity& element, // Compute gradient std::vector<double> g(nDoubles); - gradient(1,nDoubles,xp.data(),g.data()); // gradient evaluation + gradient(rank,nDoubles,xp.data(),g.data()); // gradient evaluation // Copy into Dune type localGradient.resize(localSolution.size()); @@ -151,7 +153,7 @@ assembleGradientAndHessian(const Entity& element, v[i*blocksize + k] = (k==ii); int rc= 3; - MINDEC(rc, hess_vec(1, nDoubles, xp.data(), v.data(), w.data())); + MINDEC(rc, hess_vec(rank, nDoubles, xp.data(), v.data(), w.data())); if (rc < 0) DUNE_THROW(Dune::Exception, "ADOL-C has returned with error code " << rc << "!"); @@ -181,7 +183,7 @@ assembleGradientAndHessian(const Entity& element, tangent[(j/blocksize)*embeddedBlocksize+i][j] = orthonormalFrame[j/blocksize][j%blocksize][i]; } - hess_mat(1,nDoubles,nDirections,xp.data(),tangent,rawHessian); + hess_mat(rank,nDoubles,nDirections,xp.data(),tangent,rawHessian); // Copy Hessian into Dune data type for(size_t i=0; i<nDoubles; i++)