Commit fc5e6ac8 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Adapted ES marker for parallel computations.

parent a2911e8d
#include "Marker.h" #include "Marker.h"
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
#include "parallel/MpiHelper.h"
#endif
namespace AMDiS { namespace AMDiS {
Marker *Marker::createMarker(std::string name, int row) Marker *Marker::createMarker(std::string name, int row)
...@@ -113,14 +117,18 @@ namespace AMDiS { ...@@ -113,14 +117,18 @@ namespace AMDiS {
double ESThetaP = pow(ESTheta, p); double ESThetaP = pow(ESTheta, p);
double ESThetaCP = pow(ESThetaC, p); double ESThetaCP = pow(ESThetaC, p);
double epsP = pow(adaptInfo->getSpaceTolerance(row == -1 ? 0 : row), p); double epsP = pow(adaptInfo->getSpaceTolerance(row == -1 ? 0 : row), p);
int nLeaves = mesh->getNumberOfLeaves();
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
mpi::globalAdd(nLeaves);
#endif
markRLimit = ESThetaP * epsP / mesh->getNumberOfLeaves(); markRLimit = ESThetaP * epsP / nLeaves;
markCLimit = ESThetaCP * epsP / mesh->getNumberOfLeaves(); markCLimit = ESThetaCP * epsP / nLeaves;
INFO(info, 2)("start mark_limits: %.3le %.3le nt=%d\n", INFO(info, 2)("start mark_limits: %.3le %.3le nt = %d\n",
markRLimit, markCLimit, mesh->getNumberOfLeaves()); markRLimit, markCLimit, nLeaves);
} }
...@@ -137,14 +145,12 @@ namespace AMDiS { ...@@ -137,14 +145,12 @@ namespace AMDiS {
GERSSum = 0.0; GERSSum = 0.0;
double LTheta = pow(1.0 - GERSThetaStar, p); double LTheta = pow(1.0 - GERSThetaStar, p);
double improv, redfac, wanted, epsP, GERSGamma; double epsP = pow(adaptInfo->getSpaceTolerance(row == -1 ? 0 : row), p);
epsP = pow(adaptInfo->getSpaceTolerance(row == -1 ? 0 : row), p);
if (estSum < oldErrSum) { if (estSum < oldErrSum) {
improv = estSum / oldErrSum; double improv = estSum / oldErrSum;
wanted = 0.8 * epsP / estSum; double wanted = 0.8 * epsP / estSum;
redfac = std::min((1.0 - wanted) / (1.0 - improv), 1.0); double redfac = std::min((1.0 - wanted) / (1.0 - improv), 1.0);
redfac = std::max(redfac, 0.0); redfac = std::max(redfac, 0.0);
if (redfac < 1.0) { if (redfac < 1.0) {
...@@ -155,7 +161,7 @@ namespace AMDiS { ...@@ -155,7 +161,7 @@ namespace AMDiS {
} }
oldErrSum = estSum; oldErrSum = estSum;
GERSGamma = 1.0; double GERSGamma = 1.0;
if (adaptInfo->isRefinementAllowed(row == -1 ? 0 : row)) { if (adaptInfo->isRefinementAllowed(row == -1 ? 0 : row)) {
if (LTheta > 0) { if (LTheta > 0) {
...@@ -195,7 +201,7 @@ namespace AMDiS { ...@@ -195,7 +201,7 @@ namespace AMDiS {
elInfo = stack.traverseNext(elInfo); elInfo = stack.traverseNext(elInfo);
} }
INFO(info, 6)("coarse loop: gamma=%.3e, sum=%.3e, limit=%.3e\n", INFO(info, 6)("coarse loop: gamma = %.3e, sum = %.3e, limit = %.3e\n",
GERSGamma, GERSSum, LTheta); GERSGamma, GERSSum, LTheta);
} while(GERSSum > LTheta); } while(GERSSum > LTheta);
...@@ -213,6 +219,7 @@ namespace AMDiS { ...@@ -213,6 +219,7 @@ namespace AMDiS {
return(markFlag); return(markFlag);
} }
void GERSMarker::markElementForRefinement(AdaptInfo *adaptInfo, ElInfo *elInfo) void GERSMarker::markElementForRefinement(AdaptInfo *adaptInfo, ElInfo *elInfo)
{ {
Element *el = elInfo->getElement(); Element *el = elInfo->getElement();
...@@ -224,6 +231,7 @@ namespace AMDiS { ...@@ -224,6 +231,7 @@ namespace AMDiS {
} }
} }
void GERSMarker::markElementForCoarsening(AdaptInfo *adaptInfo, ElInfo *elInfo) void GERSMarker::markElementForCoarsening(AdaptInfo *adaptInfo, ElInfo *elInfo)
{ {
Element *el = elInfo->getElement(); Element *el = elInfo->getElement();
......
...@@ -385,8 +385,6 @@ namespace AMDiS { ...@@ -385,8 +385,6 @@ namespace AMDiS {
{ {
FUNCNAME("GlobalMatrixSolver::fillPetscMatrix()"); FUNCNAME("GlobalMatrixSolver::fillPetscMatrix()");
MSG("START FILL PETSC MATRIX!\n");
clock_t first = clock(); clock_t first = clock();
int nRankRows = meshDistributor->getNumberRankDofs() * nComponents; int nRankRows = meshDistributor->getNumberRankDofs() * nComponents;
int nOverallRows = meshDistributor->getNumberOverallDofs() * nComponents; int nOverallRows = meshDistributor->getNumberOverallDofs() * nComponents;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment