From 660a5876aee5c89bdd4877b82fa5c723475e430d Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Tue, 8 Jun 2010 14:08:04 +0000 Subject: [PATCH] Bugfix for usage of rhs operators with different basis function degrees. --- AMDiS/src/Assembler.cc | 8 +++----- AMDiS/src/MeshStructure.h | 6 ++++-- AMDiS/src/time/RosenbrockStationary.cc | 18 ++++++++---------- AMDiS/src/time/RosenbrockStationary.h | 4 +--- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index 0dbf68cc..37d1dbc9 100644 --- a/AMDiS/src/Assembler.cc +++ b/AMDiS/src/Assembler.cc @@ -292,9 +292,9 @@ namespace AMDiS { FUNCNAME("Assembler::matVecAssemble()"); Element *el = elInfo->getElement(); - double *uhOldLoc = new double[nRow]; + std::vector<double> uhOldLoc(operat->uhOld->getFeSpace() == rowFeSpace ? nRow : nCol); - operat->uhOld->getLocalVector(el, uhOldLoc); + operat->uhOld->getLocalVector(el, &(uhOldLoc[0])); if (el != lastMatEl) { set_to_zero(elementMatrix); @@ -303,13 +303,11 @@ namespace AMDiS { for (int i = 0; i < nRow; i++) { double val = 0.0; - for (int j = 0; j < nRow; j++) + for (int j = 0; j < nCol; j++) val += elementMatrix[i][j] * uhOldLoc[j]; vec[i] += val; } - - delete [] uhOldLoc; } diff --git a/AMDiS/src/MeshStructure.h b/AMDiS/src/MeshStructure.h index 1b10066c..3594b7a5 100644 --- a/AMDiS/src/MeshStructure.h +++ b/AMDiS/src/MeshStructure.h @@ -19,8 +19,8 @@ /** \file MeshStructure.h */ -#ifndef AMDIS_MESHSTRUCTURE_H -#define AMDIS_MESHSTRUCTURE_H +#ifndef AMDIS_MESH_STRUCTURE_H +#define AMDIS_MESH_STRUCTURE_H #include <vector> #include "AMDiS_fwd.h" @@ -166,6 +166,7 @@ namespace AMDiS { MeshStructure *result); protected: + /// Mesh structure code. std::vector<unsigned long int> code; int currentIndex; @@ -178,6 +179,7 @@ namespace AMDiS { int nElements; + /// If true, some output is printed to screen during mesh structure code generation. bool debugMode; static const int unsignedLongSize; diff --git a/AMDiS/src/time/RosenbrockStationary.cc b/AMDiS/src/time/RosenbrockStationary.cc index c0f66018..d3bc4100 100644 --- a/AMDiS/src/time/RosenbrockStationary.cc +++ b/AMDiS/src/time/RosenbrockStationary.cc @@ -15,16 +15,14 @@ namespace AMDiS { { stageSolution = new SystemVector(*solution); unVec = new SystemVector(*solution); + timeRhsVec = new SystemVector(*solution); newUn = new SystemVector(*solution); tmp = new SystemVector(*solution); - lowSol = new SystemVector(*solution); + lowSol = new SystemVector(*solution); stageSolutions.resize(rm->getStages()); for (int i = 0; i < rm->getStages(); i++) - stageSolutions[i] = new SystemVector(*solution); - - phiSum = new DOFVector<double>(feSpaces[0], "phiSum"); - tmpDof = new DOFVector<double>(feSpaces[0], "phiSum"); + stageSolutions[i] = new SystemVector(*solution); } @@ -51,11 +49,11 @@ namespace AMDiS { *stageSolution += *tmp; } - phiSum->set(0.0); + timeRhsVec->set(0.0); for (int j = 0; j < i; j++) { - *tmpDof = *(stageSolutions[j]->getDOFVector(0)); - *tmpDof *= (rm->getC(i, j) / *tauPtr); - *phiSum += *tmpDof; + *tmp = *(stageSolutions[j]); + *tmp *= (rm->getC(i, j) / *tauPtr); + *timeRhsVec += *tmp; } ProblemVec::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector); @@ -119,7 +117,7 @@ namespace AMDiS { ProblemVec::addMatrixOperator(op, row, col, tauGamma, tauGamma); Operator *opRhs = new Operator(componentSpaces[row]); - opRhs->addZeroOrderTerm(new VecAtQP_ZOT(phiSum, new IdFunc())); + opRhs->addZeroOrderTerm(new VecAtQP_ZOT(timeRhsVec->getDOFVector(col), new IdFunc())); ProblemVec::addVectorOperator(opRhs, row, &minusOne, &minusOne); } diff --git a/AMDiS/src/time/RosenbrockStationary.h b/AMDiS/src/time/RosenbrockStationary.h index 7706743f..02e45858 100644 --- a/AMDiS/src/time/RosenbrockStationary.h +++ b/AMDiS/src/time/RosenbrockStationary.h @@ -101,12 +101,10 @@ namespace AMDiS { protected: RosenbrockMethod *rm; - SystemVector *stageSolution, *unVec, *newUn, *tmp, *lowSol; + SystemVector *stageSolution, *unVec, *timeRhsVec, *newUn, *tmp, *lowSol; std::vector<SystemVector*> stageSolutions; - DOFVector<double> *phiSum, *tmpDof; - bool first; double minusOne; -- GitLab