diff --git a/AMDiS/src/Assembler.cc b/AMDiS/src/Assembler.cc index 0dbf68cc9673e76321707b6091df4bc37fdfbeef..37d1dbc90d4af1c7f90f6c122be562917daa6732 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 1b10066cd29a166f7796f098285a4b25ef7c7f79..3594b7a5d01612b15b6d18846a17a910a8d21c45 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 c0f6601823a1d4697fa275f5cc703c8ccdf4cc8f..d3bc410091c6411a05bdf840df972aa3b070c866 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 7706743f3a39fa3fde7cfbf75f5da2c9691a6171..02e4585816fade349d41538d8d620258ded23e21 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;