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

* This and that

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