diff --git a/FunctionSpace/BasisLagrange.cpp b/FunctionSpace/BasisLagrange.cpp index dbb21ddb423b5e04e8b85af50b3dde0fe51d80a2..199615fae979362078c48c2cc54de97763527f08 100644 --- a/FunctionSpace/BasisLagrange.cpp +++ b/FunctionSpace/BasisLagrange.cpp @@ -153,14 +153,17 @@ project(const MElement& element, return newCoef; } -vector<fullVector<double> > BasisLagrange:: +std::vector<double> BasisLagrange:: project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceVector& fSpace){ // Init New Coefs // const size_t size = lPoint->size1(); - vector<fullVector<double> > newCoef(size); + const size_t dim = lPoint->size2(); + + vector<double> newCoef(size * 3); + fullVector<double> tmp(3); // Interpolation at Lagrange Points // for(size_t i = 0; i < size; i++){ @@ -181,9 +184,12 @@ project(const MElement& element, else uvw(2) = 0; - newCoef[i] = fSpace.interpolateInRefSpace(element, - coef, - uvw); + tmp = fSpace.interpolateInRefSpace(element, + coef, + uvw); + newCoef[i * 3 + 0] = tmp(0); + newCoef[i * 3 + 1] = tmp(1); + newCoef[i * 3 + 2] = tmp(2); } // Return ; diff --git a/FunctionSpace/BasisLagrange.h b/FunctionSpace/BasisLagrange.h index 216460ab3f00a05c5b76b994c5afbeb9980b9a02..b3a3bd168bc58750734618d2b90e691e48f103c1 100644 --- a/FunctionSpace/BasisLagrange.h +++ b/FunctionSpace/BasisLagrange.h @@ -66,7 +66,7 @@ class BasisLagrange: public BasisLocal{ const std::vector<double>& coef, const FunctionSpaceScalar& fSpace); - std::vector<fullVector<double> > + std::vector<double> project(const MElement& element, const std::vector<double>& coef, const FunctionSpaceVector& fSpace); @@ -114,11 +114,20 @@ class BasisLagrange: public BasisLocal{ @fn BasisLagrange::project(const MElement&, const std::vector<double>&, const FunctionSpaceVector&) @param element A MElement - @param coef A vector of coefficient associated - to the given Element - @param fSpace The (vectorial) Function Space - of the given Coefficients + @param coef A vector of coefficient associated to the given Element + @param fSpace The (vectorial) Function Space of the given Coefficients @return Projects the given Coefficients in this BasisLagrange + + The returned vector has a size three times bigger than coef, + since we need three coefficients with a Lagrange basis, + when we project a vectorial basis on it (one per direction). + + The Lagranges coefficients corresponding to the ith entry of coef + are located, in the returned vector, at the index i * 3, + with the following padding: + @li index i * 3 + 0 is the projected coefficient for direction x + @li index i * 3 + 1 is the projected coefficient for direction y + @li index i * 3 + 2 is the projected coefficient for direction z */ ////////////////////// diff --git a/FunctionSpace/ReferenceSpace.cpp b/FunctionSpace/ReferenceSpace.cpp index 07d77b10aeee2663d0011d92150484b3d186583c..63f1912097f6d6092ad1d04c78c89de90555713f 100644 --- a/FunctionSpace/ReferenceSpace.cpp +++ b/FunctionSpace/ReferenceSpace.cpp @@ -202,7 +202,7 @@ isCyclicPermutation(const vector<size_t>& pTest, // Triplet to return triplet tri; - /* + // If no Face, we have no Cyclic Permutation if(!refFaceNodeIdx.size()){ tri.first = false; @@ -240,11 +240,12 @@ isCyclicPermutation(const vector<size_t>& pTest, // Test if we have a face cyclic permutation size_t isCyclic = isFacePermutation(refNode, testNode); - */ + // Test if we have the same connectivity bool isSameConnectivity = isSameEdge(pTest, pRef); - if(isSameConnectivity){ + if(isCyclic && isSameConnectivity){ + //if(isSameConnectivity){ tri.first = true; tri.second = getRefIndexPermutation(pRef, pTest); tri.third = getReverseIndexPermutation(pRef, pTest); @@ -258,7 +259,7 @@ isCyclicPermutation(const vector<size_t>& pTest, return tri; } -/* + size_t ReferenceSpace::findCorrespondingFace(const vector<size_t>& face, const vector<size_t>& node) const{ // Init Stuff // @@ -347,7 +348,7 @@ bool ReferenceSpace::isFacePermutation(const vector<size_t>& refNode, return match; } -*/ + bool ReferenceSpace::isSameEdge(const std::vector<size_t>& pTest, const std::vector<size_t>& pRef) const{ // Set of Reference Edges diff --git a/FunctionSpace/ReferenceSpace.h b/FunctionSpace/ReferenceSpace.h index 42856ec90d10f817f73554df6f481de6ac124ccc..2e31620d439b9f634162b6fe663ac9e5fd58fedb 100644 --- a/FunctionSpace/ReferenceSpace.h +++ b/FunctionSpace/ReferenceSpace.h @@ -148,7 +148,7 @@ class ReferenceSpace{ triplet isCyclicPermutation(const std::vector<size_t>& pTest, const std::vector<size_t>& pRef) const; - /* + size_t findCorrespondingFace(const std::vector<size_t>& face, const std::vector<size_t>& node) const; @@ -157,7 +157,7 @@ class ReferenceSpace{ static bool isFacePermutation(const std::vector<size_t>& refNode, const std::vector<size_t>& testNode); - */ + bool isSameEdge(const std::vector<size_t>& pTest, const std::vector<size_t>& pRef) const;