From dec7dac64c01bd5f3daffaa0b368e234cac6c46e Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 9 Sep 2008 16:05:44 +0000 Subject: [PATCH] * On the way to indep meshes --- AMDiS/src/Assembler.cc | 8 ++++---- AMDiS/src/ElInfo.cc | 6 +++--- AMDiS/src/ElInfo.h | 2 +- AMDiS/src/Quadrature.cc | 3 ++- AMDiS/src/Quadrature.h | 10 +++++----- AMDiS/src/ZeroOrderAssembler.cc | 28 ++++++++++++++++++++-------- AMDiS/src/ZeroOrderAssembler.h | 4 ++-- 7 files changed, 37 insertions(+), 24 deletions(-) diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index db81e6fd..a9e695f7 100644 --- a/AMDiS/src/Assembler.cc +++ b/AMDiS/src/Assembler.cc @@ -123,13 +123,13 @@ namespace AMDiS { ElementMatrix *mat = rememberElMat ? elementMatrix : userMat; if (secondOrderAssembler) - secondOrderAssembler->calculateElementMatrix(rowElInfo, mat); + secondOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, mat); if (firstOrderAssemblerGrdPsi) - firstOrderAssemblerGrdPsi->calculateElementMatrix(rowElInfo, mat); + firstOrderAssemblerGrdPsi->calculateElementMatrix(rowElInfo, colElInfo, mat); if (firstOrderAssemblerGrdPhi) - firstOrderAssemblerGrdPhi->calculateElementMatrix(rowElInfo, mat); + firstOrderAssemblerGrdPhi->calculateElementMatrix(rowElInfo, colElInfo, mat); if (zeroOrderAssembler) { - zeroOrderAssembler->calculateElementMatrix(rowElInfo, mat); + zeroOrderAssembler->calculateElementMatrix(rowElInfo, colElInfo, mat); } if (rememberElMat && userMat) { diff --git a/AMDiS/src/ElInfo.cc b/AMDiS/src/ElInfo.cc index 8b46c346..3d194ced 100644 --- a/AMDiS/src/ElInfo.cc +++ b/AMDiS/src/ElInfo.cc @@ -22,7 +22,8 @@ namespace AMDiS { element_(NULL), parent_(NULL), macroElement_(NULL), - subElemCoords(NULL), + level_(0), + iChild(0), coord_(mesh_->getDim(), NO_INIT), boundary_(mesh_->getDim(), DEFAULT_VALUE, INTERIOR), projection_(mesh_->getDim(), NO_INIT), @@ -31,8 +32,7 @@ namespace AMDiS { neighbourCoord_(mesh_->getDim(), NO_INIT), oppVertex_(mesh_->getDim(), NO_INIT), grdLambda_(mesh_->getDim(), NO_INIT), - level_(0), - iChild(0) + subElemCoords(NULL) { projection_.set(NULL); diff --git a/AMDiS/src/ElInfo.h b/AMDiS/src/ElInfo.h index 40e1e283..aeaea4af 100644 --- a/AMDiS/src/ElInfo.h +++ b/AMDiS/src/ElInfo.h @@ -260,7 +260,7 @@ namespace AMDiS { return parametric_; } - inline VectorOfFixVecs<DimVec<double> > *getSubElemCoords() { + inline VectorOfFixVecs<DimVec<double> > *getSubElemCoords() const { return subElemCoords; } diff --git a/AMDiS/src/Quadrature.cc b/AMDiS/src/Quadrature.cc index de3e250a..25288401 100644 --- a/AMDiS/src/Quadrature.cc +++ b/AMDiS/src/Quadrature.cc @@ -1409,7 +1409,8 @@ namespace AMDiS { Quadrature* Quadrature::provideQuadrature(int dim_, int degree_) { FUNCNAME("Quadrature::provideQuadrature()"); - switch(dim_) { + + switch (dim_) { case 0: degree_ = 0; break; diff --git a/AMDiS/src/Quadrature.h b/AMDiS/src/Quadrature.h index b2403a53..b44f5eaf 100644 --- a/AMDiS/src/Quadrature.h +++ b/AMDiS/src/Quadrature.h @@ -83,17 +83,17 @@ namespace AMDiS { w(w_) {}; - /** \brief - * Destructor - */ - ~Quadrature(); - public: /** \brief * Copy constructor */ Quadrature(const Quadrature&); + /** \brief + * Destructor + */ + ~Quadrature(); + /** \brief * Returns a Quadrature for dimension dim exact for degree degree. */ diff --git a/AMDiS/src/ZeroOrderAssembler.cc b/AMDiS/src/ZeroOrderAssembler.cc index e1b98f30..7ffe128b 100644 --- a/AMDiS/src/ZeroOrderAssembler.cc +++ b/AMDiS/src/ZeroOrderAssembler.cc @@ -156,6 +156,7 @@ namespace AMDiS { const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); + double *phival = GET_MEMORY(double, nCol); int nPoints = quadrature->getNumPoints(); double *c = GET_MEMORY(double, nPoints); @@ -165,21 +166,32 @@ namespace AMDiS { (static_cast<ZeroOrderTerm*>((*termIt)))->getC(rowElInfo, nPoints, c); } - ScalableQuadrature *scalQuadrature = NEW ScalableQuadrature(quadrature); - // SubElInfo *subElInfo = NEW ScalElInfo(rowElInfo); + SubElInfo *subElInfo = NEW SubElInfo(colElInfo->getSubElemCoords(), rowElInfo); + Quadrature psiQuadrature(*quadrature); + ScalableQuadrature *scaledQuadrature = NEW ScalableQuadrature(&psiQuadrature); + scaledQuadrature->scaleQuadrature(*subElInfo); for (int iq = 0; iq < nPoints; iq++) { c[iq] *= rowElInfo->getDet(); - // calculate phi at QPs only once! - for (int i = 0; i < nCol; i++) { - // phival[i] = (*(phi->getPhi(i)))(quadrature->getLambda(iq)); - } + // calculate phi at QPs only once! + for (int i = 0; i < nCol; i++) { + phival[i] = (*(phi->getPhi(i)))(quadrature->getLambda(iq)); + } + for (int i = 0; i < nRow; i++) { + double psival = (*(psi->getPhi(i)))(psiQuadrature.getLambda(iq)); + for (int j = 0; j < nCol; j++) { + (*mat)[i][j] += quadrature->getWeight(iq) * c[iq] * psival * phival[j]; + } + } } - DELETE scalQuadrature; - // DELETE subElInfo; + DELETE scaledQuadrature; + DELETE subElInfo; + + FREE_MEMORY(phival, double, nCol); + FREE_MEMORY(c, double, nPoints); ERROR_EXIT("SO, HIER GEHTS WEITER\n"); } diff --git a/AMDiS/src/ZeroOrderAssembler.h b/AMDiS/src/ZeroOrderAssembler.h index 9e9d2930..4f9c65ef 100644 --- a/AMDiS/src/ZeroOrderAssembler.h +++ b/AMDiS/src/ZeroOrderAssembler.h @@ -24,8 +24,8 @@ namespace AMDiS { * Creates and returns the ZeroOrderAssembler for Operator op and * the given assembler. If all terms are piecewise constant precalculated * integrals can be used while assembling and the returned - * ZeroOrderAssembler is of type Pre0. Otherwise a Quad0 object will - * be returned. + * ZeroOrderAssembler is of type PrecalcZOA. Otherwise a FastQuadZOA + * object will be returned. */ static ZeroOrderAssembler* getSubAssembler(Operator *op, Assembler *assembler, -- GitLab