Commit 50cb43cc authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* Residual Estimator faster!!!

parent bf3468a4
...@@ -89,8 +89,10 @@ namespace AMDiS { ...@@ -89,8 +89,10 @@ namespace AMDiS {
{ {
TEST_EXIT_DBG(val)("return value is NULL\n"); TEST_EXIT_DBG(val)("return value is NULL\n");
DimVec<double> *grdTmp1 = grdTmpVec1[omp_get_thread_num()]; int myRank = omp_get_thread_num();
DimVec<double> *grdTmp2 = grdTmpVec2[omp_get_thread_num()];
DimVec<double> *grdTmp1 = grdTmpVec1[myRank];
DimVec<double> *grdTmp2 = grdTmpVec2[myRank];
for (int j = 0; j < dim + 1; j++) for (int j = 0; j < dim + 1; j++)
(*grdTmp2)[j] = 0.0; (*grdTmp2)[j] = 0.0;
......
...@@ -298,16 +298,6 @@ namespace AMDiS { ...@@ -298,16 +298,6 @@ namespace AMDiS {
return; return;
} }
const int DOFAdmin::getNumberOfDOFs(int i) const {
return nrDOF[i];
}
const int DOFAdmin::getNumberOfPreDOFs(int i) const {
TEST_EXIT_DBG((0 <= i) && (4 > i))("");
return nr0DOF[i];
}
void DOFAdmin::setNumberOfDOFs(int i,int v) { void DOFAdmin::setNumberOfDOFs(int i,int v) {
TEST_EXIT_DBG((0 <= i) && (4 > i))(""); TEST_EXIT_DBG((0 <= i) && (4 > i))("");
......
...@@ -204,7 +204,9 @@ namespace AMDiS { ...@@ -204,7 +204,9 @@ namespace AMDiS {
/** \brief /** \brief
* Returns \ref nrDOF[i] * Returns \ref nrDOF[i]
*/ */
const int getNumberOfDOFs(int i) const; inline const int getNumberOfDOFs(int i) const {
return nrDOF[i];
}
/** \brief /** \brief
* Returns \ref nrDOF * Returns \ref nrDOF
...@@ -216,7 +218,9 @@ namespace AMDiS { ...@@ -216,7 +218,9 @@ namespace AMDiS {
/** \brief /** \brief
* Returns \ref nr0DOF[i] * Returns \ref nr0DOF[i]
*/ */
const int getNumberOfPreDOFs(int i) const; inline const int getNumberOfPreDOFs(int i) const {
return nr0DOF[i];
}
/** \brief /** \brief
* Returns \ref nr0DOF * Returns \ref nr0DOF
......
...@@ -380,7 +380,7 @@ namespace AMDiS { ...@@ -380,7 +380,7 @@ namespace AMDiS {
if (fillFlag__local.isAnySet()) { if (fillFlag__local.isAnySet()) {
cvg = Tetrahedron::childVertex[el_type_local]; cvg = Tetrahedron::childVertex[el_type_local];
cv = const_cast<int*>( cvg[ichild]); cv = const_cast<int*>(cvg[ichild]);
ochild = 1 - ichild; ochild = 1 - ichild;
} }
......
...@@ -118,6 +118,8 @@ namespace AMDiS { ...@@ -118,6 +118,8 @@ namespace AMDiS {
jump_.resize(nPointsSurface_); jump_.resize(nPointsSurface_);
localJump_.resize(nPointsSurface_); localJump_.resize(nPointsSurface_);
neighbours_ = Global::getGeo(NEIGH, dim); neighbours_ = Global::getGeo(NEIGH, dim);
lambdaNeigh_ = NEW DimVec<WorldVector<double> >(dim, NO_INIT);
lambda_ = NEW DimVec<double>(dim, NO_INIT);
} }
} }
...@@ -166,6 +168,11 @@ namespace AMDiS { ...@@ -166,6 +168,11 @@ namespace AMDiS {
FREE_MEMORY(D2uhqp, WorldMatrix<double>, numPoints); FREE_MEMORY(D2uhqp, WorldMatrix<double>, numPoints);
} }
if (C1 && (dim > 1)) {
DELETE lambdaNeigh_;
DELETE lambda_;
}
DELETE neighInfo; DELETE neighInfo;
} }
...@@ -185,7 +192,7 @@ namespace AMDiS { ...@@ -185,7 +192,7 @@ namespace AMDiS {
el = elInfo->getElement(); el = elInfo->getElement();
double det = elInfo->getDet(); double det = elInfo->getDet();
const DimVec<WorldVector<double> > &Lambda = elInfo->getGrdLambda(); const DimVec<WorldVector<double> > &grdLambda = elInfo->getGrdLambda();
est_el = el->getEstimation(row); est_el = el->getEstimation(row);
...@@ -289,14 +296,10 @@ namespace AMDiS { ...@@ -289,14 +296,10 @@ namespace AMDiS {
for (int face = 0; face < neighbours_; face++) { for (int face = 0; face < neighbours_; face++) {
neigh = const_cast<Element*>(elInfo->getNeighbour(face)); neigh = const_cast<Element*>(elInfo->getNeighbour(face));
if (neigh && neigh->getMark()) { if (neigh && neigh->getMark()) {
WorldVector<int> faceIndEl, faceIndNeigh;
int oppV = elInfo->getOppVertex(face); int oppV = elInfo->getOppVertex(face);
DimVec<WorldVector<double> > LambdaNeigh(dim, NO_INIT);
double detNeigh;
DimVec<double> lambda(dim, NO_INIT);
el->sortFaceIndices(face, &faceIndEl); el->sortFaceIndices(face, &faceIndEl_);
neigh->sortFaceIndices(oppV, &faceIndNeigh); neigh->sortFaceIndices(oppV, &faceIndNeigh_);
neighInfo->setElement(const_cast<Element*>(neigh)); neighInfo->setElement(const_cast<Element*>(neigh));
neighInfo->setFillFlag(Mesh::FILL_COORDS); neighInfo->setFillFlag(Mesh::FILL_COORDS);
...@@ -313,14 +316,14 @@ namespace AMDiS { ...@@ -313,14 +316,14 @@ namespace AMDiS {
if (ldp) { if (ldp) {
::std::list<LeafDataPeriodic::PeriodicInfo>::iterator it; ::std::list<LeafDataPeriodic::PeriodicInfo>::iterator it;
::std::list<LeafDataPeriodic::PeriodicInfo>& infoList =
dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList();
for (it = dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().begin(); for (it = infoList.begin(); it != infoList.end(); ++it) {
it != dynamic_cast<LeafDataPeriodic*>(ldp)->getInfoList().end();
++it) {
if (it->elementSide == face) { if (it->elementSide == face) {
for (int i = 0; i < dim; i++) { for (int i = 0; i < dim; i++) {
i1 = faceIndEl[i]; i1 = faceIndEl_[i];
i2 = faceIndNeigh[i]; i2 = faceIndNeigh_[i];
for (j = 0; j < dim; j++) { for (j = 0; j < dim; j++) {
if (i1 == el->getVertexOfPosition(INDEX_OF_DIM(dim - 1, if (i1 == el->getVertexOfPosition(INDEX_OF_DIM(dim - 1,
...@@ -343,8 +346,8 @@ namespace AMDiS { ...@@ -343,8 +346,8 @@ namespace AMDiS {
if (!periodicCoords) { if (!periodicCoords) {
for (int i = 0; i < dim; i++) { for (int i = 0; i < dim; i++) {
i1 = faceIndEl[i]; i1 = faceIndEl_[i];
i2 = faceIndNeigh[i]; i2 = faceIndNeigh_[i];
for (j = 0; j < dow; j++) for (j = 0; j < dow; j++)
neighInfo->getCoord(i2)[j] = elInfo->getCoord(i1)[j]; neighInfo->getCoord(i2)[j] = elInfo->getCoord(i1)[j];
} }
...@@ -355,7 +358,7 @@ namespace AMDiS { ...@@ -355,7 +358,7 @@ namespace AMDiS {
neighInfo = parametric->addParametricInfo(neighInfo); neighInfo = parametric->addParametricInfo(neighInfo);
} }
detNeigh = abs(neighInfo->calcGrdLambda(LambdaNeigh)); double detNeigh = abs(neighInfo->calcGrdLambda(*lambdaNeigh_));
for (iq = 0; iq < nPointsSurface_; iq++) { for (iq = 0; iq < nPointsSurface_; iq++) {
jump_[iq].set(0.0); jump_[iq].set(0.0);
...@@ -370,23 +373,23 @@ namespace AMDiS { ...@@ -370,23 +373,23 @@ namespace AMDiS {
uh[system]->getLocalVector(neigh, uhNeigh[system]); uh[system]->getLocalVector(neigh, uhNeigh[system]);
for (iq = 0; iq < nPointsSurface_; iq++) { for (iq = 0; iq < nPointsSurface_; iq++) {
lambda[face] = 0.0; (*lambda_)[face] = 0.0;
for (int i = 0; i < dim; i++) { for (int i = 0; i < dim; i++) {
lambda[faceIndEl[i]] = surfaceQuad_->getLambda(iq, i); (*lambda_)[faceIndEl_[i]] = surfaceQuad_->getLambda(iq, i);
} }
basFcts[system]->evalGrdUh(lambda, basFcts[system]->evalGrdUh(*lambda_,
Lambda, grdLambda,
uhEl[system], uhEl[system],
&grdUhEl_[iq]); &grdUhEl_[iq]);
lambda[oppV] = 0.0; (*lambda_)[oppV] = 0.0;
for (int i = 0; i < dim; i++) { for (int i = 0; i < dim; i++) {
lambda[faceIndNeigh[i]] = surfaceQuad_->getLambda(iq, i); (*lambda_)[faceIndNeigh_[i]] = surfaceQuad_->getLambda(iq, i);
} }
basFcts[system]->evalGrdUh(lambda, basFcts[system]->evalGrdUh(*lambda_,
LambdaNeigh, *lambdaNeigh_,
uhNeigh[system], uhNeigh[system],
&grdUhNeigh_[iq]); &grdUhNeigh_[iq]);
......
...@@ -169,6 +169,14 @@ namespace AMDiS { ...@@ -169,6 +169,14 @@ namespace AMDiS {
Vector<WorldVector<double> > localJump_; Vector<WorldVector<double> > localJump_;
WorldVector<int> faceIndEl_;
WorldVector<int> faceIndNeigh_;
DimVec<WorldVector<double> > *lambdaNeigh_;
DimVec<double> *lambda_;
int neighbours_; int neighbours_;
}; };
} }
......
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