Commit 44e4efd1 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* hope, it works, no more bugs at all

parent 44677772
...@@ -107,8 +107,7 @@ namespace AMDiS { ...@@ -107,8 +107,7 @@ namespace AMDiS {
do { do {
doMore = false; doMore = false;
el_info = stack->traverseFirst(mesh, -1, flag); el_info = stack->traverseFirst(mesh, -1, flag);
while (el_info) while (el_info) {
{
coarsenFunction(el_info); coarsenFunction(el_info);
el_info = stack->traverseNext(el_info); el_info = stack->traverseNext(el_info);
} }
......
...@@ -70,7 +70,11 @@ namespace AMDiS { ...@@ -70,7 +70,11 @@ namespace AMDiS {
} }
const FiniteElemSpace *getAuxFESpace(int i) { const FiniteElemSpace *getAuxFESpace(int i) {
return ((i <= static_cast<int>(auxFESpaces.size())) ? auxFESpaces[i] : NULL); return ((i < static_cast<int>(auxFESpaces.size())) ? auxFESpaces[i] : NULL);
}
void setAuxFESpace(const FiniteElemSpace* fe, int pos) {
auxFESpaces[pos] = fe;
} }
int getStatus() { int getStatus() {
...@@ -164,6 +168,22 @@ namespace AMDiS { ...@@ -164,6 +168,22 @@ namespace AMDiS {
return vectorComponents[row].getAuxFESpace(0); return vectorComponents[row].getAuxFESpace(0);
} }
void fakeFESpace(const FiniteElemSpace *feOld,
const FiniteElemSpace *feNew)
{
for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) {
if (matrixComponents[i][j].getAuxFESpace(0) == feOld) {
matrixComponents[i][j].setAuxFESpace(feNew, 0);
}
}
if (vectorComponents[i].getAuxFESpace(0) == feOld) {
vectorComponents[i].setAuxFESpace(feNew, 0);
}
}
}
protected: protected:
int nComponents; int nComponents;
......
...@@ -16,6 +16,12 @@ namespace AMDiS { ...@@ -16,6 +16,12 @@ namespace AMDiS {
(const_cast<BasisFunction*>(feSpace->getBasisFcts()))->coarseRestr(this, &list, n); (const_cast<BasisFunction*>(feSpace->getBasisFcts()))->coarseRestr(this, &list, n);
break; break;
case COARSE_INTERPOL: case COARSE_INTERPOL:
if (feSpace == NULL || !feSpace) {
ERROR_EXIT("ERR1\n");
}
if (feSpace->getBasisFcts() == NULL || !(feSpace->getBasisFcts())) {
ERROR_EXIT("ERR2\n");
}
(const_cast<BasisFunction*>(feSpace->getBasisFcts()))->coarseInter(this, &list, n); (const_cast<BasisFunction*>(feSpace->getBasisFcts()))->coarseInter(this, &list, n);
break; break;
default: default:
......
...@@ -498,7 +498,7 @@ namespace AMDiS { ...@@ -498,7 +498,7 @@ namespace AMDiS {
*/ */
inline double H1Norm(Quadrature* q = NULL) const { inline double H1Norm(Quadrature* q = NULL) const {
return sqrt(H1NormSquare()); return sqrt(H1NormSquare());
}; }
/** \brief /** \brief
* Calculates square of H1 norm of this DOFVector * Calculates square of H1 norm of this DOFVector
......
...@@ -744,6 +744,7 @@ namespace AMDiS { ...@@ -744,6 +744,7 @@ namespace AMDiS {
DOFVector<T>& DOFVector<T>::operator=(const DOFVector<T>& rhs ) DOFVector<T>& DOFVector<T>::operator=(const DOFVector<T>& rhs )
{ {
feSpace = rhs.feSpace; feSpace = rhs.feSpace;
DOFVectorBase<T>::feSpace = rhs.feSpace;
this->nBasFcts = rhs.nBasFcts; this->nBasFcts = rhs.nBasFcts;
vec = rhs.vec; vec = rhs.vec;
this->elementVector = new ElementVector(this->nBasFcts); this->elementVector = new ElementVector(this->nBasFcts);
......
...@@ -1575,20 +1575,14 @@ namespace AMDiS { ...@@ -1575,20 +1575,14 @@ namespace AMDiS {
AbstractFunction<double, double> *af, AbstractFunction<double, double> *af,
WorldVector<double> *wv); WorldVector<double> *wv);
/** \brief /// Implementation of \ref OperatorTerm::initElement().
* Implementation of \ref OperatorTerm::initElement().
*/
void initElement(const ElInfo* elInfo, SubAssembler* subAssembler, void initElement(const ElInfo* elInfo, SubAssembler* subAssembler,
Quadrature *quad = NULL); Quadrature *quad = NULL);
/** \brief /// Implements FirstOrderTerm::getLb().
* Implements FirstOrderTerm::getLb().
*/
void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const; void getLb(const ElInfo *elInfo, int nPoints, VectorOfFixVecs<DimVec<double> >& Lb) const;
/** \brief /// Implements FirstOrderTerm::eval().
* Implements FirstOrderTerm::eval().
*/
void eval(int nPoints, void eval(int nPoints,
const double *uhAtQP, const double *uhAtQP,
const WorldVector<double> *grdUhAtQP, const WorldVector<double> *grdUhAtQP,
...@@ -1597,23 +1591,16 @@ namespace AMDiS { ...@@ -1597,23 +1591,16 @@ namespace AMDiS {
double factor) const; double factor) const;
protected: protected:
/** \brief /// DOFVector to be evaluated at quadrature points.
* DOFVector to be evaluated at quadrature points.
*/
DOFVectorBase<double>* vec; DOFVectorBase<double>* vec;
/** \brief /// v at quadrature points.
* v at quadrature points.
*/
double *vecAtQPs; double *vecAtQPs;
/** \brief /// Function f.
* Function f.
*/
AbstractFunction<double, double> *f; AbstractFunction<double, double> *f;
/** ///
*/
WorldVector<double> *b; WorldVector<double> *b;
}; };
......
...@@ -729,7 +729,6 @@ namespace AMDiS { ...@@ -729,7 +729,6 @@ namespace AMDiS {
for (int i = 0; i < nComponents; i++) { for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++) { for (int j = 0; j < nComponents; j++) {
// Only if this variable is true, the current matrix will be assembled. // Only if this variable is true, the current matrix will be assembled.
bool assembleMatrix = true; bool assembleMatrix = true;
// The DOFMatrix which should be assembled (or not, if assembleMatrix // The DOFMatrix which should be assembled (or not, if assembleMatrix
...@@ -780,18 +779,18 @@ namespace AMDiS { ...@@ -780,18 +779,18 @@ namespace AMDiS {
} else if (traverseInfo.getStatus(i) == SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX) { } else if (traverseInfo.getStatus(i) == SingleComponentInfo::EQ_SPACES_WITH_DIF_AUX) {
// Row fe space and col fe space are both equal, but right hand side has at // Row fe space and col fe space are both equal, but right hand side has at
// least one another aux fe space. In this case, do not assemble the rhs, // least one another aux fe space.
// this will be done afterwards.
assembleOnOneMesh(componentSpaces[i], assembleOnOneMesh(componentSpaces[i],
assembleFlag, assembleFlag,
assembleMatrix ? matrix : NULL, assembleMatrix ? matrix : NULL,
((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL); ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL);
assembleOnDifMeshes2(componentSpaces[1], componentSpaces[0], assembleOnDifMeshes2(componentSpaces[i],
traverseInfo.getAuxFESpace(i, j),
assembleFlag, assembleFlag,
NULL, NULL,
rhs->getDOFVector(1)); ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL);
} else { } else {
ERROR_EXIT("Possible? If yes, not yet implemented!\n"); ERROR_EXIT("Possible? If yes, not yet implemented!\n");
...@@ -808,7 +807,7 @@ namespace AMDiS { ...@@ -808,7 +807,7 @@ namespace AMDiS {
traverseInfo.getAuxFESpace(i, j), traverseInfo.getAuxFESpace(i, j),
assembleFlag, assembleFlag,
assembleMatrix ? matrix : NULL, assembleMatrix ? matrix : NULL,
NULL); ((i == j) && asmVector) ? rhs->getDOFVector(i) : NULL);
} else if (traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_NO_AUX || } else if (traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_NO_AUX ||
traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_WITH_AUX) { traverseInfo.getStatus(i, j) == SingleComponentInfo::DIF_SPACES_WITH_AUX) {
...@@ -888,7 +887,8 @@ namespace AMDiS { ...@@ -888,7 +887,8 @@ namespace AMDiS {
void ProblemVec::addMatrixOperator(Operator *op, void ProblemVec::addMatrixOperator(Operator *op,
int i, int j, int i, int j,
double *factor, double *factor,
double *estFactor) double *estFactor,
bool fake)
{ {
FUNCNAME("ProblemVec::addMatrixOperator()"); FUNCNAME("ProblemVec::addMatrixOperator()");
...@@ -900,35 +900,42 @@ namespace AMDiS { ...@@ -900,35 +900,42 @@ namespace AMDiS {
setBoundaryConditionMap((*systemMatrix)[i][i]->getBoundaryManager()-> setBoundaryConditionMap((*systemMatrix)[i][i]->getBoundaryManager()->
getBoundaryConditionMap()); getBoundaryConditionMap());
} }
(*systemMatrix)[i][j]->addOperator(op, factor, estFactor); (*systemMatrix)[i][j]->addOperator(op, factor, estFactor);
if (!fake) {
traverseInfo.getMatrix(i, j).setAuxFESpaces(op->getAuxFESpaces()); traverseInfo.getMatrix(i, j).setAuxFESpaces(op->getAuxFESpaces());
for (int k = 0; k < static_cast<int>(op->getAuxFESpaces().size()); k++) { for (int k = 0; k < static_cast<int>(op->getAuxFESpaces().size()); k++) {
if ((op->getAuxFESpaces())[k] != componentSpaces[i] || if ((op->getAuxFESpaces())[k]->getMesh() != componentSpaces[i]->getMesh() ||
(op->getAuxFESpaces())[k] != componentSpaces[j]) { (op->getAuxFESpaces())[k]->getMesh() != componentSpaces[j]->getMesh()) {
op->setNeedDualTraverse(true); op->setNeedDualTraverse(true);
break; break;
} }
} }
} }
}
void ProblemVec::addVectorOperator(Operator *op, int i, void ProblemVec::addVectorOperator(Operator *op, int i,
double *factor, double *factor,
double *estFactor) double *estFactor,
bool fake)
{ {
FUNCNAME("ProblemVec::addVectorOperator()"); FUNCNAME("ProblemVec::addVectorOperator()");
rhs->getDOFVector(i)->addOperator(op, factor, estFactor); rhs->getDOFVector(i)->addOperator(op, factor, estFactor);
if (!fake) {
traverseInfo.getVector(i).setAuxFESpaces(op->getAuxFESpaces()); traverseInfo.getVector(i).setAuxFESpaces(op->getAuxFESpaces());
for (int j = 0; j < static_cast<int>(op->getAuxFESpaces().size()); j++) { for (int j = 0; j < static_cast<int>(op->getAuxFESpaces().size()); j++) {
if ((op->getAuxFESpaces())[j] != componentSpaces[i]) { if ((op->getAuxFESpaces())[j]->getMesh() != componentSpaces[i]->getMesh()) {
op->setNeedDualTraverse(true); op->setNeedDualTraverse(true);
break; break;
} }
} }
} }
}
void ProblemVec::addDirichletBC(BoundaryType type, int system, void ProblemVec::addDirichletBC(BoundaryType type, int system,
AbstractFunction<double, WorldVector<double> >* b) AbstractFunction<double, WorldVector<double> >* b)
......
...@@ -216,12 +216,14 @@ namespace AMDiS { ...@@ -216,12 +216,14 @@ namespace AMDiS {
/// Adds an Operator to \ref A. /// Adds an Operator to \ref A.
void addMatrixOperator(Operator *op, int i, int j, void addMatrixOperator(Operator *op, int i, int j,
double *factor = NULL, double *factor = NULL,
double *estFactor = NULL); double *estFactor = NULL,
bool fake = false);
/// Adds an Operator to \ref rhs. /// Adds an Operator to \ref rhs.
void addVectorOperator(Operator *op, int i, void addVectorOperator(Operator *op, int i,
double *factor = NULL, double *factor = NULL,
double *estFactor = NULL); double *estFactor = NULL,
bool fake = false);
/// Adds dirichlet boundary conditions. /// Adds dirichlet boundary conditions.
virtual void addDirichletBC(BoundaryType type, int system, virtual void addDirichletBC(BoundaryType type, int system,
......
...@@ -84,19 +84,13 @@ namespace AMDiS { ...@@ -84,19 +84,13 @@ namespace AMDiS {
{} {}
public: public:
/** \brief /// Copy constructor
* Copy constructor
*/
Quadrature(const Quadrature&); Quadrature(const Quadrature&);
/** \brief /// Destructor
* Destructor
*/
~Quadrature(); ~Quadrature();
/** \brief /// Returns a Quadrature for dimension dim exact for degree degree.
* Returns a Quadrature for dimension dim exact for degree degree.
*/
static Quadrature *provideQuadrature(int dim, int degree); static Quadrature *provideQuadrature(int dim, int degree);
/** \brief /** \brief
...@@ -116,42 +110,40 @@ namespace AMDiS { ...@@ -116,42 +110,40 @@ namespace AMDiS {
*/ */
inline const std::string& getName() { inline const std::string& getName() {
return name; return name;
}; }
/** \brief /// Returns \ref n_points
* Returns \ref n_points
*/
inline int getNumPoints() const { inline int getNumPoints() const {
return n_points; return n_points;
}; }
/** \brief /** \brief
* Returns \ref w[p] * Returns \ref w[p]
*/ */
inline double getWeight(int p) const { inline double getWeight(int p) const {
return w[p]; return w[p];
}; }
/** \brief /** \brief
* Returns \ref w. * Returns \ref w.
*/ */
inline double* getWeight() const { inline double* getWeight() const {
return w; return w;
}; }
/** \brief /** \brief
* Returns \ref dim * Returns \ref dim
*/ */
inline int getDim() const { inline int getDim() const {
return dim; return dim;
}; }
/** \brief /** \brief
* Returns \ref degree * Returns \ref degree
*/ */
inline int getDegree() const { inline int getDegree() const {
return degree; return degree;
}; }
/** \brief /** \brief
* Returns a pointer to a vector storing the values of a doubled valued * Returns a pointer to a vector storing the values of a doubled valued
...@@ -184,7 +176,7 @@ namespace AMDiS { ...@@ -184,7 +176,7 @@ namespace AMDiS {
*/ */
inline double getLambda(int a, int b) const { inline double getLambda(int a, int b) const {
return (lambda ? (*lambda)[a][b] : 0.0); return (lambda ? (*lambda)[a][b] : 0.0);
}; }
/** \brief /** \brief
* Returns \ref lambda[a] which is a DimVec<double> containing the * Returns \ref lambda[a] which is a DimVec<double> containing the
...@@ -192,14 +184,14 @@ namespace AMDiS { ...@@ -192,14 +184,14 @@ namespace AMDiS {
*/ */
inline const DimVec<double>& getLambda(int a) const { inline const DimVec<double>& getLambda(int a) const {
return (*lambda)[a]; return (*lambda)[a];
}; }
/** \brief /** \brief
* Returns \ref lambda which is a VectorOfFixvecs<DimVec<double> >. * Returns \ref lambda which is a VectorOfFixvecs<DimVec<double> >.
*/ */
VectorOfFixVecs<DimVec<double> > *getLambda() const { VectorOfFixVecs<DimVec<double> > *getLambda() const {
return lambda; return lambda;
}; }
public: public:
...@@ -224,9 +216,7 @@ namespace AMDiS { ...@@ -224,9 +216,7 @@ namespace AMDiS {
*/ */
int dim; int dim;
/** \brief /// Number of quadrature points
* Number of quadrature points
*/
int n_points; int n_points;
/** \brief /** \brief
...@@ -378,7 +368,7 @@ namespace AMDiS { ...@@ -378,7 +368,7 @@ namespace AMDiS {
D2Phi(NULL), D2Phi(NULL),
quadrature(quad), quadrature(quad),
basisFunctions(basFcts) basisFunctions(basFcts)
{}; {}
/** \brief /** \brief
* Copy constructor * Copy constructor
...@@ -424,21 +414,21 @@ namespace AMDiS { ...@@ -424,21 +414,21 @@ namespace AMDiS {
ERROR_EXIT("invalid flag\n"); ERROR_EXIT("invalid flag\n");
return false; return false;
}; }
/** \brief /** \brief
* Returns \ref quadrature * Returns \ref quadrature
*/ */
inline const Quadrature* getQuadrature() const { inline const Quadrature* getQuadrature() const {
return quadrature; return quadrature;
}; }
/** \brief /** \brief
* Returns \ref max_points * Returns \ref max_points
*/ */
inline int getMaxQuadPoints() { inline int getMaxQuadPoints() {
return max_points; return max_points;
}; }
/** \brief /** \brief
* Returns (*\ref D2Phi)[q][i][j][m] * Returns (*\ref D2Phi)[q][i][j][m]
...@@ -455,63 +445,63 @@ namespace AMDiS { ...@@ -455,63 +445,63 @@ namespace AMDiS {
*/ */
inline const double getGradient(int q, int i ,int j) const { inline const double getGradient(int q, int i ,int j) const {
return (grdPhi) ? (*grdPhi)[q][i][j] : 0.0; return (grdPhi) ? (*grdPhi)[q][i][j] : 0.0;
}; }
/** \brief /** \brief
* Returns (*\ref grdPhi)[q] * Returns (*\ref grdPhi)[q]
*/ */
inline VectorOfFixVecs<DimVec<double> >* getGradient(int q) const { inline VectorOfFixVecs<DimVec<double> >* getGradient(int q) const {
return (grdPhi) ? &((*grdPhi)[q]) : NULL; return (grdPhi) ? &((*grdPhi)[q]) : NULL;
}; }
/** \brief /** \brief
* Returns \ref phi[q][i] * Returns \ref phi[q][i]
*/ */
inline const double getPhi(int q, int i) const { inline const double getPhi(int q, int i) const {
return (phi) ? phi[q][i] : 0.0; return (phi) ? phi[q][i] : 0.0;
}; }
/** \brief /** \brief
* Returns \ref phi[q] * Returns \ref phi[q]
*/ */
inline const double *getPhi(int q) const { inline const double *getPhi(int q) const {
return (phi) ? phi[q] : NULL; return (phi) ? phi[q] : NULL;
}; }
/** \brief /** \brief
* Returns \ref quadrature ->integrateStdSimplex(f) * Returns \ref quadrature ->integrateStdSimplex(f)
*/ */
inline double integrateStdSimplex(AbstractFunction<double, DimVec<double> > *f) { inline double integrateStdSimplex(AbstractFunction<double, DimVec<double> > *f) {