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

* Residual Estimator faster!!!

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