From 07e45f1e67400fd488ae9295f84fb48b2388be11 Mon Sep 17 00:00:00 2001 From: Nicolas Marsic <nicolas.marsic@gmail.com> Date: Thu, 20 Jun 2013 07:58:31 +0000 Subject: [PATCH] Trying parallel stuff + remove bad memory access with pointGenerator in BasisLagrange --- FunctionSpace/BasisLagrange.cpp | 38 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/FunctionSpace/BasisLagrange.cpp b/FunctionSpace/BasisLagrange.cpp index 1b8525aaf6..12656d71dc 100644 --- a/FunctionSpace/BasisLagrange.cpp +++ b/FunctionSpace/BasisLagrange.cpp @@ -96,14 +96,28 @@ project(const MElement& element, // Init New Coefs // const unsigned int size = lPoint->size1(); + const unsigned int dim = lPoint->size2(); + vector<double> newCoef(size); // Interpolation at Lagrange Points // for(unsigned int i = 0; i < size; i++){ fullVector<double> uvw(3); - uvw(0) = (*lPoint)(i, 0); - uvw(1) = (*lPoint)(i, 1); - uvw(2) = (*lPoint)(i, 2); + + if(dim > 0) + uvw(0) = (*lPoint)(i, 0); + else + uvw(0) = 0; + + if(dim > 1) + uvw(1) = (*lPoint)(i, 1); + else + uvw(1) = 0; + + if(dim > 2) + uvw(2) = (*lPoint)(i, 2); + else + uvw(2) = 0; newCoef[i] = fSpace.interpolateInRefSpace(element, coef, @@ -126,9 +140,21 @@ project(const MElement& element, // Interpolation at Lagrange Points // for(unsigned int i = 0; i < size; i++){ fullVector<double> uvw(3); - uvw(0) = (*lPoint)(i, 0); - uvw(1) = (*lPoint)(i, 1); - uvw(2) = (*lPoint)(i, 2); + + if(dim > 0) + uvw(0) = (*lPoint)(i, 0); + else + uvw(0) = 0; + + if(dim > 1) + uvw(1) = (*lPoint)(i, 1); + else + uvw(1) = 0; + + if(dim > 2) + uvw(2) = (*lPoint)(i, 2); + else + uvw(2) = 0; newCoef[i] = fSpace.interpolateInRefSpace(element, coef, -- GitLab