Loading src/UnstructuredMesh/MeshFunctions/ComputeCenter.h +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ #include "MeshApply.h" #include "../MeshDataContainer/MeshDataContainer.h" #include "GrammSchmidt.h" #include <array> Loading Loading @@ -124,9 +124,9 @@ struct _ComputeCenters<2, 3, ComputationMethod::TESSELLATED> { for(auto& sub : element.getSubelements()){ IndexType AI = mesh.getEdges().at(sub.index).getVertexAIndex(); IndexType BI = mesh.getEdges().at(sub.index).getVertexBIndex(); std::vector<Vertex<3, Real>> v = {elemCenters.at(i) - mesh.getVertices().at(AI), elemCenters.at(i) - mesh.getVertices().at(BI)}; std::array<Vertex<3, Real>, 2> v = {elemCenters.at(i) - mesh.getVertices().at(AI), elemCenters.at(i) - mesh.getVertices().at(BI)}; GrammSchmidt<3, IndexType, Real>(v); GrammSchmidt<2, 3, IndexType, Real>(v); Real surf = v.at(0).normEukleid() * 0.5 * v.at(1).normEukleid(); tempVert += subElemCenters.at(sub.index) * (surf * (2.0 / 3.0)); Loading src/UnstructuredMesh/MeshFunctions/ComputeMeasures.h +4 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,8 @@ #include "MeshFunctionsDefine.h" #include "MeshApply.h" #include "../MeshDataContainer/MeshDataContainer.h" #include "GrammSchmidt.h" #include <array> template <unsigned int dim, unsigned int Dimension, ComputationMethod Method = DEFAULT> struct _ComputeMeasures{ Loading Loading @@ -172,8 +173,8 @@ struct _ComputeMeasures<3, 3, TESSELLATED>{ Vertex<3,Real>& vertA = mesh.getVertices().at(mesh.getEdges().at(edgeIndex).getVertexAIndex()); Vertex<3,Real>& vertB = mesh.getVertices().at(mesh.getEdges().at(edgeIndex).getVertexBIndex()); std::vector<Vertex<3,Real>> pyramidVec = {vertA - faceCenter, vertB - faceCenter, cellCenter - faceCenter}; GrammSchmidt<3, IndexType, Real>(pyramidVec); std::array<Vertex<3,Real>, 3> pyramidVec = {vertA - faceCenter, vertB - faceCenter, cellCenter - faceCenter}; GrammSchmidt<3, 3, IndexType, Real>(pyramidVec); measure += pyramidVec.at(0).normEukleid() * pyramidVec.at(1).normEukleid() * pyramidVec.at(2).normEukleid() * (1.0/6.0); Loading src/UnstructuredMesh/MeshFunctions/GrammSchmidt.h +5 −5 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ #include "../../NumericStaticArray/Vertex.h" #include <vector> #include <array> /** * @brief GrammSchmidt Loading @@ -12,20 +12,20 @@ * @param vectors [in / out] vector containing the vectors and * after the process the vectors are changed. */ template <unsigned int Dimension,typename IndexType, typename Real> void GrammSchmidt(std::vector<Vertex<Dimension, Real>>& vectors){ template <unsigned int NumVec, unsigned int Dimension,typename IndexType, typename Real> void GrammSchmidt(std::array<Vertex<Dimension, Real>, NumVec>& vectors){ /* * Vector of inverse suquare of norm */ std::vector<Real> invSumOfSquares(vectors.size()); std::array<Real, NumVec> invSumOfSquares; invSumOfSquares.at(0) = 1.0 / vectors.at(0).sumOfSquares(); std::array<Real, NumVec> coef; for (IndexType i = 1; i < vectors.size(); i++) { /* * Coefitiens of scalar products. * The coefitients are computed in advance for better stability */ std::vector<Real> coef(i); for (IndexType j = 0; j < i; j++) { coef.at(j) = (vectors.at(i)*(vectors.at(j))) * invSumOfSquares.at(j); Loading Loading
src/UnstructuredMesh/MeshFunctions/ComputeCenter.h +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ #include "MeshApply.h" #include "../MeshDataContainer/MeshDataContainer.h" #include "GrammSchmidt.h" #include <array> Loading Loading @@ -124,9 +124,9 @@ struct _ComputeCenters<2, 3, ComputationMethod::TESSELLATED> { for(auto& sub : element.getSubelements()){ IndexType AI = mesh.getEdges().at(sub.index).getVertexAIndex(); IndexType BI = mesh.getEdges().at(sub.index).getVertexBIndex(); std::vector<Vertex<3, Real>> v = {elemCenters.at(i) - mesh.getVertices().at(AI), elemCenters.at(i) - mesh.getVertices().at(BI)}; std::array<Vertex<3, Real>, 2> v = {elemCenters.at(i) - mesh.getVertices().at(AI), elemCenters.at(i) - mesh.getVertices().at(BI)}; GrammSchmidt<3, IndexType, Real>(v); GrammSchmidt<2, 3, IndexType, Real>(v); Real surf = v.at(0).normEukleid() * 0.5 * v.at(1).normEukleid(); tempVert += subElemCenters.at(sub.index) * (surf * (2.0 / 3.0)); Loading
src/UnstructuredMesh/MeshFunctions/ComputeMeasures.h +4 −3 Original line number Diff line number Diff line Loading @@ -4,7 +4,8 @@ #include "MeshFunctionsDefine.h" #include "MeshApply.h" #include "../MeshDataContainer/MeshDataContainer.h" #include "GrammSchmidt.h" #include <array> template <unsigned int dim, unsigned int Dimension, ComputationMethod Method = DEFAULT> struct _ComputeMeasures{ Loading Loading @@ -172,8 +173,8 @@ struct _ComputeMeasures<3, 3, TESSELLATED>{ Vertex<3,Real>& vertA = mesh.getVertices().at(mesh.getEdges().at(edgeIndex).getVertexAIndex()); Vertex<3,Real>& vertB = mesh.getVertices().at(mesh.getEdges().at(edgeIndex).getVertexBIndex()); std::vector<Vertex<3,Real>> pyramidVec = {vertA - faceCenter, vertB - faceCenter, cellCenter - faceCenter}; GrammSchmidt<3, IndexType, Real>(pyramidVec); std::array<Vertex<3,Real>, 3> pyramidVec = {vertA - faceCenter, vertB - faceCenter, cellCenter - faceCenter}; GrammSchmidt<3, 3, IndexType, Real>(pyramidVec); measure += pyramidVec.at(0).normEukleid() * pyramidVec.at(1).normEukleid() * pyramidVec.at(2).normEukleid() * (1.0/6.0); Loading
src/UnstructuredMesh/MeshFunctions/GrammSchmidt.h +5 −5 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ #include "../../NumericStaticArray/Vertex.h" #include <vector> #include <array> /** * @brief GrammSchmidt Loading @@ -12,20 +12,20 @@ * @param vectors [in / out] vector containing the vectors and * after the process the vectors are changed. */ template <unsigned int Dimension,typename IndexType, typename Real> void GrammSchmidt(std::vector<Vertex<Dimension, Real>>& vectors){ template <unsigned int NumVec, unsigned int Dimension,typename IndexType, typename Real> void GrammSchmidt(std::array<Vertex<Dimension, Real>, NumVec>& vectors){ /* * Vector of inverse suquare of norm */ std::vector<Real> invSumOfSquares(vectors.size()); std::array<Real, NumVec> invSumOfSquares; invSumOfSquares.at(0) = 1.0 / vectors.at(0).sumOfSquares(); std::array<Real, NumVec> coef; for (IndexType i = 1; i < vectors.size(); i++) { /* * Coefitiens of scalar products. * The coefitients are computed in advance for better stability */ std::vector<Real> coef(i); for (IndexType j = 0; j < i; j++) { coef.at(j) = (vectors.at(i)*(vectors.at(j))) * invSumOfSquares.at(j); Loading