Commit e7e195f6 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Some changes in SubAssembler for Debug-Mode

parent b26dd34c
......@@ -63,6 +63,7 @@
#include "FirstOrderTerm.h"
#include "FixVec.h"
#include "Flag.h"
#include "Functors.h"
#include "Global.h"
#include "Initfile.h"
#include "ITL_Preconditioner.h"
......
......@@ -106,9 +106,10 @@ namespace AMDiS {
const FastQuadrature *quadFast)
{
// check fast quadrature
if (quadFast)
if (quadFast) {
TEST_EXIT_DBG(quadrature_ == quadFast->getQuadrature())
("quadrature_ != quadFast->quadrature\n");
("quadrature_ != quadFast->quadrature\n");
}
// create new info if necessary
if (vecQPInfos_[vec] == NULL)
......
......@@ -202,14 +202,15 @@ namespace AMDiS {
/// Used for \ref getVectorAtQPs() and \ref getGradientsAtQPs().
struct ValuesAtQPs {
ValuesAtQPs()
: valid(false)
: valid(false), quad(NULL)
{}
ValuesAtQPs(boost::any values_, bool valid_)
: values(values_), valid(valid_)
ValuesAtQPs(boost::any values_, bool valid_, Quadrature* quad_=NULL)
: values(values_), valid(valid_), quad(quad_)
{}
boost::any values; // used for mtl::dense_vector<T>
bool valid;
Quadrature* quad;
};
std::map<const void*, ValuesAtQPs* > cachedValuesAtQPs;
......
......@@ -28,21 +28,20 @@ namespace AMDiS {
TEST_EXIT_DBG(elInfo->getMesh() == vec->getFeSpace()->getMesh())
("Vector and FE space do not fit together!\n");
Quadrature *localQuad = quad ? quad : quadrature;
vecAtQPs.change_dim(localQuad->getNumPoints());
if (cachedValuesAtQPs[vec] && cachedValuesAtQPs[vec]->valid) {
vecAtQPs = boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values);
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
boost::any swap;
if (!cachedValuesAtQPs[vec]) {
swap = mtl::dense_vector<T>();
cachedValuesAtQPs[vec] = new ValuesAtQPs(swap, false);
}
boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values).change_dim(localQuad->getNumPoints());
vecAtQPs.change_dim(localQuad->getNumPoints());
mtl::dense_vector<T>& values = boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values);
bool sameFeSpaces =
......@@ -73,6 +72,7 @@ namespace AMDiS {
}
cachedValuesAtQPs[vec]->valid = true;
cachedValuesAtQPs[vec]->quad = localQuad;
vecAtQPs = values;
}
......@@ -88,13 +88,13 @@ namespace AMDiS {
FUNCNAME("SubAssembler::getVectorAtQPs()");
TEST_EXIT_DBG(vec)("No DOF vector!\n");
Quadrature *localQuad = quad ? quad : quadrature;
vecAtQPs.change_dim(localQuad->getNumPoints());
if (cachedValuesAtQPs[vec] && cachedValuesAtQPs[vec]->valid) {
vecAtQPs = boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values);
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
}
boost::any swap;
if (!cachedValuesAtQPs[vec]) {
......@@ -102,7 +102,6 @@ namespace AMDiS {
cachedValuesAtQPs[vec] = new ValuesAtQPs(swap, false);
}
boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values).change_dim(localQuad->getNumPoints());
vecAtQPs.change_dim(localQuad->getNumPoints());
mtl::dense_vector<T>& values = boost::any_cast<mtl::dense_vector<T>& >(cachedValuesAtQPs[vec]->values);
......@@ -122,14 +121,14 @@ namespace AMDiS {
FUNCNAME("SubAssembler::getGradientsAtQPs()");
TEST_EXIT_DBG(vec)("No DOF vector!\n");
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
if (cachedGradientsAtQPs[vec] && cachedGradientsAtQPs[vec]->valid) {
grdAtQPs = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
boost::any swap;
if (!cachedGradientsAtQPs[vec]) {
swap = mtl::dense_vector<typename GradientType<T>::type>();
......@@ -137,7 +136,6 @@ namespace AMDiS {
}
boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values).change_dim(localQuad->getNumPoints());
grdAtQPs.change_dim(localQuad->getNumPoints());
mtl::dense_vector<typename GradientType<T>::type>& values = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
......@@ -184,13 +182,14 @@ namespace AMDiS {
TEST_EXIT_DBG(vec)("No DOF vector!\n");
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
if (cachedGradientsAtQPs[vec] && cachedGradientsAtQPs[vec]->valid) {
grdAtQPs = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
boost::any swap;
if (!cachedGradientsAtQPs[vec]) {
swap = mtl::dense_vector<typename GradientType<T>::type>();
......@@ -198,7 +197,6 @@ namespace AMDiS {
}
boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values).change_dim(localQuad->getNumPoints());
grdAtQPs.change_dim(localQuad->getNumPoints());
mtl::dense_vector<typename GradientType<T>::type>& values = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
......@@ -218,6 +216,9 @@ namespace AMDiS {
TEST_EXIT_DBG(vec)("No DOF vector!\n");
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
if (cachedGradientsAtQPs[vec] && cachedGradientsAtQPs[vec]->valid) {
mtl::dense_vector<typename GradientType<T>::type> tmp = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
for (size_t iq = 0; iq < num_rows(tmp); iq++)
......@@ -225,10 +226,6 @@ namespace AMDiS {
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
const BasisFunction *psi = rowFeSpace->getBasisFcts();
const BasisFunction *phi = colFeSpace->getBasisFcts();
......@@ -270,6 +267,9 @@ namespace AMDiS {
TEST_EXIT_DBG(vec)("No DOF vector!\n");
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
if (cachedGradientsAtQPs[vec] && cachedGradientsAtQPs[vec]->valid) {
mtl::dense_vector<typename GradientType<T>::type> tmp = boost::any_cast<mtl::dense_vector<typename GradientType<T>::type>& >(cachedGradientsAtQPs[vec]->values);
for (size_t iq = 0; iq < num_rows(tmp); iq++)
......@@ -277,10 +277,6 @@ namespace AMDiS {
return;
}
Quadrature *localQuad = quad ? quad : quadrature;
grdAtQPs.change_dim(localQuad->getNumPoints());
vec->getDerivativeAtQPs(smallElInfo, largeElInfo, localQuad, NULL, comp, grdAtQPs);
}
......
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