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