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

Fixed problem with VecAtQP terms without function definition.

parent 204012be
......@@ -148,8 +148,8 @@ namespace AMDiS {
init();
char number[5];
for (int i = 0; i < size; i++) {
sprintf(number, "[%d]", i);
scalContents[i] = new ScalContent(name + std::string(number));
sprintf(number, "[%d]", i);
scalContents[i] = new ScalContent(name + std::string(number));
}
}
......
......@@ -179,8 +179,11 @@ namespace AMDiS {
VectorGradient_FOT::VectorGradient_FOT(DOFVectorBase<double> *dv,
AbstractFunction<WorldVector<double>, WorldVector<double> > *af)
: FirstOrderTerm(af->getDegree()), vec(dv), f(af)
: FirstOrderTerm(af ? af->getDegree() : dv->getFeSpace()->getBasisFcts()->getDegree()),
vec(dv), f(af)
{
FUNCNAME("VectorGradient_FOT::VectorGradient_FOT()");
TEST_EXIT(dv)("No vector!\n");
auxFeSpaces.insert(dv->getFeSpace());
......@@ -201,11 +204,10 @@ namespace AMDiS {
if (f)
for (int iq = 0; iq < nPoints; iq++)
lb(grdLambda, (*f)(gradAtQPs[iq]), Lb[iq], 1.0);
lb(grdLambda, (*f)(gradAtQPs[iq]), Lb[iq], 1.0);
else
for (int iq = 0; iq < nPoints; iq++)
lb(grdLambda, gradAtQPs[iq], Lb[iq], 1.0);
lb(grdLambda, gradAtQPs[iq], Lb[iq], 1.0);
}
void VectorGradient_FOT::eval(int nPoints,
......
......@@ -68,6 +68,8 @@ namespace AMDiS {
template< typename Matrix, typename Vector, typename Mapper >
int solve(const Matrix& A, Vector& x, Vector& b, Mapper& mapper)
{
FUNCNAME("MTL4Solver::solve()");
Timer t;
if(num_rows(matrix) == 0 || !getMultipleRhs() ) {
init(mapper, mtl::traits::is_distributed<MTLMatrix>());
......
......@@ -65,7 +65,7 @@ namespace AMDiS {
// check if all terms are pw_const
bool pwConst = true;
for (int i = 0; i < static_cast<int>(op->zeroOrder.size()); i++) {
for (unsigned int i = 0; i < op->zeroOrder.size(); i++) {
if (!op->zeroOrder[i]->isPWConst()) {
pwConst = false;
break;
......@@ -79,7 +79,7 @@ namespace AMDiS {
if (pwConst)
newAssembler = new PrecalcZOA(op, assembler, quad);
else
newAssembler = new FastQuadZOA(op, assembler, quad);
newAssembler = new FastQuadZOA(op, assembler, quad);
}
subAssemblers->push_back(newAssembler);
......@@ -94,7 +94,8 @@ namespace AMDiS {
}
void StandardZOA::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat)
void StandardZOA::calculateElementMatrix(const ElInfo *elInfo,
ElementMatrix& mat)
{
const BasisFunction *psi = rowFeSpace->getBasisFcts();
const BasisFunction *phi = colFeSpace->getBasisFcts();
......@@ -261,8 +262,11 @@ namespace AMDiS {
}
void PrecalcZOA::calculateElementMatrix(const ElInfo *elInfo, ElementMatrix& mat)
void PrecalcZOA::calculateElementMatrix(const ElInfo *elInfo,
ElementMatrix& mat)
{
FUNCNAME("PrecalcZOA::calculateElementMatrix()");
if (firstCall) {
q00 = Q00PsiPhi::provideQ00PsiPhi(rowFeSpace->getBasisFcts(),
colFeSpace->getBasisFcts(),
......@@ -281,25 +285,26 @@ namespace AMDiS {
if (symmetric) {
for (int i = 0; i < nRow; i++) {
mat[i][i] += c[0] * q00->getValue(i,i);
for (int j = i + 1; j < nCol; j++) {
double val = c[0] * q00->getValue(i, j);
mat[i][j] += val;
mat[j][i] += val;
}
mat[i][i] += c[0] * q00->getValue(i,i);
for (int j = i + 1; j < nCol; j++) {
double val = c[0] * q00->getValue(i, j);
mat[i][j] += val;
mat[j][i] += val;
}
}
} else {
for (int i = 0; i < nRow; i++) {
for (int j = 0; j < nCol; j++) {
for (int i = 0; i < nRow; i++)
for (int j = 0; j < nCol; j++)
mat[i][j] += c[0] * q00->getValue(i, j);
}
}
}
}
void PrecalcZOA::calculateElementVector(const ElInfo *elInfo, ElementVector& vec)
void PrecalcZOA::calculateElementVector(const ElInfo *elInfo,
ElementVector& vec)
{
FUNCNAME("PrecalcZOA::calculateElementVector()");
if (firstCall) {
q00 = Q00PsiPhi::provideQ00PsiPhi(rowFeSpace->getBasisFcts(),
colFeSpace->getBasisFcts(),
......
......@@ -19,8 +19,11 @@ namespace AMDiS {
VecAtQP_ZOT::VecAtQP_ZOT(DOFVectorBase<double> *dv,
AbstractFunction<double, double> *af)
: ZeroOrderTerm(af ? af->getDegree() : 0), vec(dv), f(af)
: ZeroOrderTerm(af ? af->getDegree() : dv->getFeSpace()->getBasisFcts()->getDegree()),
vec(dv), f(af)
{
FUNCNAME("VecAtQP_ZOT::VecAtQP_ZOT()");
TEST_EXIT(dv)("No vector!\n");
auxFeSpaces.insert(dv->getFeSpace());
......@@ -48,10 +51,10 @@ namespace AMDiS {
{
if (f) {
for (int iq = 0; iq < nPoints; iq++)
C[iq] += (*f)(vecAtQPs[iq]);
C[iq] += (*f)(vecAtQPs[iq]);
} else {
for (int iq = 0; iq < nPoints; iq++)
C[iq] += vecAtQPs[iq];
C[iq] += vecAtQPs[iq];
}
}
......@@ -65,10 +68,10 @@ namespace AMDiS {
{
if (f) {
for (int iq = 0; iq < nPoints; iq++)
result[iq] += fac * (*f)(vecAtQPs[iq]) * uhAtQP[iq];
result[iq] += fac * (*f)(vecAtQPs[iq]) * uhAtQP[iq];
} else {
for (int iq = 0; iq < nPoints; iq++)
result[iq] += fac * vecAtQPs[iq] * uhAtQP[iq];
result[iq] += fac * vecAtQPs[iq] * uhAtQP[iq];
}
}
......
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