Commit d3b88dd1 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

* This and that

parent ecbb2779
...@@ -336,7 +336,7 @@ namespace AMDiS { ...@@ -336,7 +336,7 @@ namespace AMDiS {
if (!optimized) { if (!optimized) {
newAssembler = NEW Stand0(op, assembler, quad); newAssembler = NEW Stand0(op, assembler, quad);
} else { } else {
if(pwConst) { if (pwConst) {
newAssembler = NEW Pre0(op, assembler, quad); newAssembler = NEW Pre0(op, assembler, quad);
} else { } else {
newAssembler = NEW Quad0(op, assembler, quad); newAssembler = NEW Quad0(op, assembler, quad);
...@@ -493,12 +493,9 @@ namespace AMDiS { ...@@ -493,12 +493,9 @@ namespace AMDiS {
void Stand0::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat) void Stand0::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat)
{ {
double val;
const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts(); const BasisFunction *psi = owner->getRowFESpace()->getBasisFcts();
const BasisFunction *phi = owner->getColFESpace()->getBasisFcts(); const BasisFunction *phi = owner->getColFESpace()->getBasisFcts();
double psival;
double *phival = GET_MEMORY(double, nCol); double *phival = GET_MEMORY(double, nCol);
int nPoints = quadrature->getNumPoints(); int nPoints = quadrature->getNumPoints();
double *c = GET_MEMORY(double, nPoints); double *c = GET_MEMORY(double, nPoints);
...@@ -523,10 +520,10 @@ namespace AMDiS { ...@@ -523,10 +520,10 @@ namespace AMDiS {
} }
for (int i = 0; i < nRow; i++) { for (int i = 0; i < nRow; i++) {
psival = (*(psi->getPhi(i)))(quadrature->getLambda(iq)); double psival = (*(psi->getPhi(i)))(quadrature->getLambda(iq));
(*mat)[i][i] += quadrature->getWeight(iq) * c[iq] * psival * phival[i]; (*mat)[i][i] += quadrature->getWeight(iq) * c[iq] * psival * phival[i];
for (int j = i + 1; j < nCol; j++) { for (int j = i + 1; j < nCol; j++) {
val = quadrature->getWeight(iq) * c[iq] * psival * phival[j]; double val = quadrature->getWeight(iq) * c[iq] * psival * phival[j];
(*mat)[i][j] += val; (*mat)[i][j] += val;
(*mat)[j][i] += val; (*mat)[j][i] += val;
} }
...@@ -542,7 +539,7 @@ namespace AMDiS { ...@@ -542,7 +539,7 @@ namespace AMDiS {
} }
for (int i = 0; i < nRow; i++) { for (int i = 0; i < nRow; i++) {
psival = (*(psi->getPhi(i)))(quadrature->getLambda(iq)); double psival = (*(psi->getPhi(i)))(quadrature->getLambda(iq));
for (int j = 0; j < nCol; j++) { for (int j = 0; j < nCol; j++) {
(*mat)[i][j] += quadrature->getWeight(iq) * c[iq] * psival * phival[j]; (*mat)[i][j] += quadrature->getWeight(iq) * c[iq] * psival * phival[j];
} }
...@@ -1141,7 +1138,6 @@ namespace AMDiS { ...@@ -1141,7 +1138,6 @@ namespace AMDiS {
} }
tmpMat *= elInfo->getDet(); tmpMat *= elInfo->getDet();
nEntries = q11->getNumberEntries(); nEntries = q11->getNumberEntries();
if (symmetric) { if (symmetric) {
...@@ -1274,7 +1270,6 @@ namespace AMDiS { ...@@ -1274,7 +1270,6 @@ namespace AMDiS {
void Stand2::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat) void Stand2::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix *mat)
{ {
double val;
DimVec<double> grdPsi(dim, NO_INIT); DimVec<double> grdPsi(dim, NO_INIT);
VectorOfFixVecs<DimVec<double> > grdPhi(dim, nCol, NO_INIT); VectorOfFixVecs<DimVec<double> > grdPhi(dim, nCol, NO_INIT);
...@@ -1309,7 +1304,7 @@ namespace AMDiS { ...@@ -1309,7 +1304,7 @@ namespace AMDiS {
(grdPsi * ((*LALt[iq]) * grdPhi[i])); (grdPsi * ((*LALt[iq]) * grdPhi[i]));
for (int j = i + 1; j < nCol; j++) { for (int j = i + 1; j < nCol; j++) {
val = quadrature->getWeight(iq) * (grdPsi * ((*LALt[iq]) * grdPhi[j])); double val = quadrature->getWeight(iq) * (grdPsi * ((*LALt[iq]) * grdPhi[j]));
(*mat)[i][j] += val; (*mat)[i][j] += val;
(*mat)[j][i] += val; (*mat)[j][i] += val;
} }
...@@ -1517,13 +1512,10 @@ namespace AMDiS { ...@@ -1517,13 +1512,10 @@ namespace AMDiS {
// create sub assemblers // create sub assemblers
secondOrderAssembler = secondOrderAssembler =
SecondOrderAssembler::getSubAssembler(op, this, quad2, opt); SecondOrderAssembler::getSubAssembler(op, this, quad2, opt);
firstOrderAssemblerGrdPsi = firstOrderAssemblerGrdPsi =
FirstOrderAssembler::getSubAssembler(op, this, quad1GrdPsi, GRD_PSI, opt); FirstOrderAssembler::getSubAssembler(op, this, quad1GrdPsi, GRD_PSI, opt);
firstOrderAssemblerGrdPhi = firstOrderAssemblerGrdPhi =
FirstOrderAssembler::getSubAssembler(op, this, quad1GrdPhi, GRD_PHI, opt); FirstOrderAssembler::getSubAssembler(op, this, quad1GrdPhi, GRD_PHI, opt);
zeroOrderAssembler = zeroOrderAssembler =
ZeroOrderAssembler::getSubAssembler(op, this, quad0, opt); ZeroOrderAssembler::getSubAssembler(op, this, quad0, opt);
} }
......
...@@ -53,13 +53,9 @@ namespace AMDiS { ...@@ -53,13 +53,9 @@ namespace AMDiS {
class Q0Psi; class Q0Psi;
class Q1Psi; class Q1Psi;
class Q2Psi; class Q2Psi;
// class Operator;
// class OperatorTerm;
template<typename T> class DOFVectorBase; template<typename T> class DOFVectorBase;
// enum FirstOrderType;
// ============================================================================ // ============================================================================
// ===== class SubAssembler =================================================== // ===== class SubAssembler ===================================================
// ============================================================================ // ============================================================================
...@@ -1121,17 +1117,17 @@ namespace AMDiS { ...@@ -1121,17 +1117,17 @@ namespace AMDiS {
/** \brief /** \brief
* SubAssembler for the first order terms (grdPsi) * SubAssembler for the first order terms (grdPsi)
*/ */
FirstOrderAssembler *firstOrderAssemblerGrdPsi; FirstOrderAssembler *firstOrderAssemblerGrdPsi;
/** \brief /** \brief
* SubAssembler for the first order terms (grdPhi) * SubAssembler for the first order terms (grdPhi)
*/ */
FirstOrderAssembler *firstOrderAssemblerGrdPhi; FirstOrderAssembler *firstOrderAssemblerGrdPhi;
/** \brief /** \brief
* SubAssembler for the zero order terms * SubAssembler for the zero order terms
*/ */
ZeroOrderAssembler *zeroOrderAssembler; ZeroOrderAssembler *zeroOrderAssembler;
bool remember; bool remember;
...@@ -1196,13 +1192,13 @@ namespace AMDiS { ...@@ -1196,13 +1192,13 @@ namespace AMDiS {
/** \brief /** \brief
* Constructor. * Constructor.
*/ */
StandardAssembler(Operator *op, StandardAssembler(Operator *op,
Quadrature *quad2, Quadrature *quad2,
Quadrature *quad1GrdPsi, Quadrature *quad1GrdPsi,
Quadrature *quad1GrdPhi, Quadrature *quad1GrdPhi,
Quadrature *quad0, Quadrature *quad0,
const FiniteElemSpace *rowFESpace_, const FiniteElemSpace *rowFESpace,
const FiniteElemSpace *colFESpace_=NULL); const FiniteElemSpace *colFESpace = NULL);
}; };
// ============================================================================ // ============================================================================
...@@ -1223,13 +1219,13 @@ namespace AMDiS { ...@@ -1223,13 +1219,13 @@ namespace AMDiS {
/** \brief /** \brief
* Constructor. * Constructor.
*/ */
OptimizedAssembler(Operator *op, OptimizedAssembler(Operator *op,
Quadrature *quad2, Quadrature *quad2,
Quadrature *quad1GrdPsi, Quadrature *quad1GrdPsi,
Quadrature *quad1GrdPhi, Quadrature *quad1GrdPhi,
Quadrature *quad0, Quadrature *quad0,
const FiniteElemSpace *rowFESpace_, const FiniteElemSpace *rowFESpace,
const FiniteElemSpace *colFESpace_=NULL); const FiniteElemSpace *colFESpace = NULL);
}; };
} }
......
...@@ -59,8 +59,7 @@ namespace AMDiS { ...@@ -59,8 +59,7 @@ namespace AMDiS {
MacroElement *macroNeighbour = mel->getNeighbour(i); MacroElement *macroNeighbour = mel->getNeighbour(i);
if (macroNeighbour) { if (macroNeighbour) {
neighbour_[i] = macroNeighbour->getElement(); neighbour_[i] = macroNeighbour->getElement();
Element *nb = const_cast<Element*>(neighbour_[i]); Element *nb = const_cast<Element*>(neighbour_[i]);
int edgeNo = oppVertex_[i] = mel->getOppVertex(i); int edgeNo = oppVertex_[i] = mel->getOppVertex(i);
...@@ -110,6 +109,19 @@ namespace AMDiS { ...@@ -110,6 +109,19 @@ namespace AMDiS {
break; break;
default: default:
std::cout << "------------- Error --------------" << std::endl;
std::cout << " Element index = " << element_->getIndex() << "\n\n";
for (int j = 0; j < neighbours; j++) {
if (mel->getNeighbour(j)) {
std::cout << " Neighbour " << j << ": "
<< mel->getNeighbour(j)->getElement()->getIndex()
<< std::endl;
} else {
std::cout << " Neighbour " << j << ": not existing" << std::endl;
}
std::cout << " OppVertex " << j << ": " << static_cast<int>(mel->getOppVertex(j)) << std::endl;
std::cout << std::endl;
}
ERROR_EXIT("should not happen!\n"); ERROR_EXIT("should not happen!\n");
break; break;
} }
......
This diff is collapsed.
...@@ -92,8 +92,8 @@ namespace AMDiS { ...@@ -92,8 +92,8 @@ namespace AMDiS {
* and coordinates at quadrature points can be calculated. * and coordinates at quadrature points can be calculated.
*/ */
virtual void initElement(const ElInfo*, virtual void initElement(const ElInfo*,
SubAssembler* , SubAssembler*,
Quadrature *quad= NULL) Quadrature *quad = NULL)
{}; {};
/** \brief /** \brief
...@@ -124,11 +124,11 @@ namespace AMDiS { ...@@ -124,11 +124,11 @@ namespace AMDiS {
/** \brief /** \brief
* Evaluation of the OperatorTerm at all quadrature points. * Evaluation of the OperatorTerm at all quadrature points.
*/ */
virtual void eval(int numPoints, virtual void eval(int nPoints,
const double *uhAtQP, const double *uhAtQP,
const WorldVector<double> *grdUhAtQP, const WorldVector<double> *grdUhAtQP,
const WorldMatrix<double> *D2UhAtQP, const WorldMatrix<double> *D2UhAtQP,
double *result, double *result,
double factor) const = 0; double factor) const = 0;
protected: protected:
...@@ -136,10 +136,10 @@ namespace AMDiS { ...@@ -136,10 +136,10 @@ namespace AMDiS {
* Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$. * Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$.
*/ */
static void lalt(const DimVec<WorldVector<double> >& Lambda, static void lalt(const DimVec<WorldVector<double> >& Lambda,
const WorldMatrix<double>& matrix, const WorldMatrix<double>& matrix,
DimMat<double>& LALt, DimMat<double>& LALt,
bool symm, bool symm,
double factor); double factor);
/** \brief /** \brief
* Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for \f$ A \f$ * Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for \f$ A \f$
...@@ -148,35 +148,35 @@ namespace AMDiS { ...@@ -148,35 +148,35 @@ namespace AMDiS {
*/ */
static void lalt_kl(const DimVec<WorldVector<double> >& Lambda, static void lalt_kl(const DimVec<WorldVector<double> >& Lambda,
int k, int l, int k, int l,
DimMat<double>& LALt, DimMat<double>& LALt,
double factor); double factor);
/** \brief /** \brief
* Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for A equal to the * Evaluation of \f$ \Lambda \cdot A \cdot \Lambda^t\f$ for A equal to the
* identity. * identity.
*/ */
static void l1lt(const DimVec<WorldVector<double> >& Lambda, static void l1lt(const DimVec<WorldVector<double> >& Lambda,
DimMat<double>& LALt, DimMat<double>& LALt,
double factor); double factor);
/** \brief /** \brief
* Evaluation of \f$ \Lambda \cdot b\f$. * Evaluation of \f$ \Lambda \cdot b\f$.
*/ */
static void lb(const DimVec<WorldVector<double> >& Lambda, static void lb(const DimVec<WorldVector<double> >& Lambda,
const WorldVector<double>& b, const WorldVector<double>& b,
DimVec<double>& Lb, DimVec<double>& Lb,
double factor); double factor);
/** \brief /** \brief
* Evaluation of \f$ \Lambda \cdot b\f$ if b contains the value 1.0 in * Evaluation of \f$ \Lambda \cdot b\f$ if b contains the value 1.0 in
* each component. * each component.
*/ */
static void l1(const DimVec<WorldVector<double> >& Lambda, static void l1(const DimVec<WorldVector<double> >& Lambda,
DimVec<double>& Lb, DimVec<double>& Lb,
double factor) double factor)
{ {
int dim = Lb.getSize() - 1; int dim = Lb.getSize() - 1;
static const int dimOfWorld = Global::getGeo(WORLD); static const int dimOfWorld = Global::getGeo(WORLD);
for (int i = 0; i <= dim; i++) { for (int i = 0; i <= dim; i++) {
double val = 0.0; double val = 0.0;
...@@ -250,13 +250,13 @@ namespace AMDiS { ...@@ -250,13 +250,13 @@ namespace AMDiS {
* Evaluation of \f$ \Lambda A \Lambda^t \f$ at all quadrature points. * Evaluation of \f$ \Lambda A \Lambda^t \f$ at all quadrature points.
*/ */
virtual void getLALt(const ElInfo *elInfo, virtual void getLALt(const ElInfo *elInfo,
int numPoints, int nPoints,
DimMat<double> **result) const = 0; DimMat<double> **result) const = 0;
/** \brief /** \brief
* Evaluation of \f$ A \nabla u(\vec{x}) \f$ at all quadrature points. * Evaluation of \f$ A \nabla u(\vec{x}) \f$ at all quadrature points.
*/ */
virtual void weakEval(int numPoints, virtual void weakEval(int nPoints,
const WorldVector<double> *grdUhAtQP, const WorldVector<double> *grdUhAtQP,
WorldVector<double> *result) const = 0; WorldVector<double> *result) const = 0;
...@@ -297,17 +297,17 @@ namespace AMDiS { ...@@ -297,17 +297,17 @@ namespace AMDiS {
/** \brief /** \brief
* Implementation of SecondOrderTerm::eval(). * Implementation of SecondOrderTerm::eval().
*/ */
inline void eval(int numPoints, inline void eval(int nPoints,
const double * // uhAtQP const double * , // uhAtQP
, const WorldVector<double>*// grdUhAtQP const WorldVector<double> * , // grdUhAtQP
, const WorldMatrix<double> *D2UhAtQP, const WorldMatrix<double> *D2UhAtQP,
double *result, double *result,
double factor) const double factor) const
{ {
int dow = Global::getGeo(WORLD); int dow = Global::getGeo(WORLD);
if (D2UhAtQP) { if (D2UhAtQP) {
for (int iq = 0; iq < numPoints; iq++) { for (int iq = 0; iq < nPoints; iq++) {
double resultQP = 0.0; double resultQP = 0.0;
for (int i = 0; i < dow; i++) { for (int i = 0; i < dow; i++) {
resultQP += D2UhAtQP[iq][i][i]; resultQP += D2UhAtQP[iq][i][i];
...@@ -320,12 +320,12 @@ namespace AMDiS { ...@@ -320,12 +320,12 @@ namespace AMDiS {
/** \brief /** \brief
* Implenetation of SecondOrderTerm::weakEval(). * Implenetation of SecondOrderTerm::weakEval().
*/ */
void weakEval(int numPoints, void weakEval(int nPoints,
const WorldVector<double> *grdUhAtQP, const WorldVector<double> *grdUhAtQP,
WorldVector<double> *result) const WorldVector<double> *result) const
{ {
if (grdUhAtQP) { if (grdUhAtQP) {
for (int iq = 0; iq < numPoints; iq++) { for (int iq = 0; iq < nPoints; iq++) {
result[iq] += grdUhAtQP[iq]; result[iq] += grdUhAtQP[iq];
} }
} }
...@@ -387,13 +387,12 @@ namespace AMDiS { ...@@ -387,13 +387,12 @@ namespace AMDiS {
double *result, double *result,
double f) const double f) const
{ {
int i, dow = Global::getGeo(WORLD); int dow = Global::getGeo(WORLD);
int iq;
if(D2UhAtQP) { if (D2UhAtQP) {
for(iq = 0; iq < numPoints; iq++) { for (int iq = 0; iq < numPoints; iq++) {
double resultQP = 0.0; double resultQP = 0.0;
for(i=0; i < dow; i++) { for (int i = 0; i < dow; i++) {
resultQP += D2UhAtQP[iq][i][i]; resultQP += D2UhAtQP[iq][i][i];
} }
result[iq] += resultQP * f * (*factor); result[iq] += resultQP * f * (*factor);
...@@ -408,9 +407,8 @@ namespace AMDiS { ...@@ -408,9 +407,8 @@ namespace AMDiS {
const WorldVector<double> *grdUhAtQP, const WorldVector<double> *grdUhAtQP,
WorldVector<double> *result) const WorldVector<double> *result) const
{ {
int iq; if (grdUhAtQP) {
if(grdUhAtQP) { for (int iq = 0; iq < numPoints; iq++) {
for(iq = 0; iq < numPoints; iq++) {
axpy(*factor, grdUhAtQP[iq], result[iq]); axpy(*factor, grdUhAtQP[iq], result[iq]);
} }
} }
...@@ -2150,9 +2148,9 @@ namespace AMDiS { ...@@ -2150,9 +2148,9 @@ namespace AMDiS {
/** \brief /** \brief
* Implements ZeroOrderTerm::getC(). * Implements ZeroOrderTerm::getC().
*/ */
inline void getC(const ElInfo *, int numPoints, double *C) const inline void getC(const ElInfo *, int nPoints, double *C) const
{ {
for (int iq = 0; iq < numPoints; iq++) { for (int iq = 0; iq < nPoints; iq++) {
C[iq] += factor; C[iq] += factor;
} }
}; };
...@@ -2160,15 +2158,14 @@ namespace AMDiS { ...@@ -2160,15 +2158,14 @@ namespace AMDiS {
/** \brief /** \brief
* Implements ZeroOrderTerm::eval(). * Implements ZeroOrderTerm::eval().
*/ */
inline void eval(int numPoints, inline void eval(int nPoints,
const double *uhAtQP, const double *uhAtQP,
const WorldVector<double> *, const WorldVector<double> *,
const WorldMatrix<double> *, const WorldMatrix<double> *,
double *result, double *result,
double fac) const double fac) const
{ {
int iq; for (int iq = 0; iq < nPoints; iq++) {
for(iq = 0; iq < numPoints; iq++) {
result[iq] += fac * factor * uhAtQP[iq]; result[iq] += fac * factor * uhAtQP[iq];
} }
}; };
...@@ -3471,8 +3468,8 @@ namespace AMDiS { ...@@ -3471,8 +3468,8 @@ namespace AMDiS {
* or on both sides of the system. * or on both sides of the system.
*/ */
Operator(Flag operatorType, Operator(Flag operatorType,
const FiniteElemSpace *rowFESpace_, const FiniteElemSpace *rowFESpace,
const FiniteElemSpace *colFESpace_ = NULL); const FiniteElemSpace *colFESpace = NULL);
/** \brief /** \brief
* Destructor. * Destructor.
......
...@@ -95,9 +95,9 @@ namespace AMDiS { ...@@ -95,9 +95,9 @@ namespace AMDiS {
Quadrature(const Quadrature&); Quadrature(const Quadrature&);
/** \brief /** \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
* Approximates an integral by the numerical quadrature described by quad; * Approximates an integral by the numerical quadrature described by quad;
......
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