Loading Unstructured_mesh/main.cpp +24 −24 Original line number Original line Diff line number Diff line Loading @@ -298,7 +298,7 @@ void testMesh2D() { mesh.getCells().at(1).setBoundaryElementIndex(2); mesh.getCells().at(1).setBoundaryElementIndex(2); mesh.getCells().at(1).setIndex(1); mesh.getCells().at(1).setIndex(1); mesh.InitializeCenters(); mesh.initializeCenters(); Loading Loading @@ -339,26 +339,26 @@ void testMesh2D() { auto centers = ComputeCenters(mesh); auto centers = ComputeCenters(mesh); auto& faceCent = centers.GetDataDim<1>(); auto& faceCent = centers.getDataByDim<1>(); for(auto& center : faceCent) { for(auto& center : faceCent) { DBGVAR(center) DBGVAR(center) } } DBGMSG("cellCenter"); DBGMSG("cellCenter"); for(sit::Cell& cell : mesh.getCells()){ for(sit::Cell& cell : mesh.getCells()){ DBGVAR(centers.GetDataDim<2>().at(cell.getIndex())) DBGVAR(centers.getDataByDim<2>().at(cell.getIndex())) } } DBGMSG("computing measures"); DBGMSG("computing measures"); auto measures = mesh.ComputeElementMeasures(); auto measures = mesh.computeElementMeasures(); for(double edgeM :measures.GetDataDim<1>()) { for(double edgeM :measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double cellM :measures.GetDataDim<2>()) { for(double cellM :measures.getDataByDim<2>()) { DBGVAR(cellM) DBGVAR(cellM) } } Loading Loading @@ -418,12 +418,12 @@ void testMesh3D() { MakeMeshDataContainer_t<double, make_custom_integer_sequence_t<unsigned int, 0,3>> cont1(mesh3); MakeMeshDataContainer_t<double, make_custom_integer_sequence_t<unsigned int, 0,3>> cont1(mesh3); //cont.GetDataDim<3>().resize(20); //cont.getDataByDim<3>().resize(20); DBGVAR(cont.GetDataPos<1>().size()) DBGVAR(cont.getDataByPos<1>().size()) DBGVAR(cont.GetDataPos<0>().size()) DBGVAR(cont.getDataByPos<0>().size()) DBGVAR(cont.GetDataDim<3>().size()) DBGVAR(cont.getDataByDim<3>().size()) DBGMSG("faceCenters"); DBGMSG("faceCenters"); Loading @@ -434,33 +434,33 @@ void testMesh3D() { auto centers = ComputeCenters(mesh3); auto centers = ComputeCenters(mesh3); for(auto& face : mesh3.getFaces()) { for(auto& face : mesh3.getFaces()) { face.setCenter(centers.template GetDataDim<2>().at(face.getIndex())); face.setCenter(centers.template getDataByDim<2>().at(face.getIndex())); DBGVAR(face.getCenter()) DBGVAR(face.getCenter()) } } DBGMSG("cellCenter"); DBGMSG("cellCenter"); for(auto& cell : mesh3.getCells()) { for(auto& cell : mesh3.getCells()) { cell.setCenter(centers.template GetDataDim<3>().at(cell.getIndex())); cell.setCenter(centers.template getDataByDim<3>().at(cell.getIndex())); DBGVAR(cell.getCenter()) DBGVAR(cell.getCenter()) } } DBGMSG("measure computation"); DBGMSG("measure computation"); auto measures = ComputeMeasures(mesh3); auto measures = ComputeMeasures(mesh3); for(double edgeM : measures.GetDataDim<1>()) { for(double edgeM : measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double faceM : measures.GetDataDim<2>()) { for(double faceM : measures.getDataByDim<2>()) { DBGVAR(faceM) DBGVAR(faceM) } } for(double cellM : measures.GetDataDim<3>()) { for(double cellM : measures.getDataByDim<3>()) { DBGVAR(cellM) DBGVAR(cellM) } } DBGMSG("2D normals test"); DBGMSG("2D normals test"); auto normals = mesh3.ComputeFaceNormals(); auto normals = mesh3.computeFaceNormals(); for(auto& face : mesh3.getFaces()){ for(auto& face : mesh3.getFaces()){ DBGVAR(face.getIndex(),normals.at(face)) DBGVAR(face.getIndex(),normals.at(face)) } } Loading Loading @@ -529,14 +529,14 @@ void test3DMeshDeformedPrisms() { DBGMSG("measure computation"); DBGMSG("measure computation"); auto measures = ComputeMeasures(mesh3); auto measures = ComputeMeasures(mesh3); for(double edgeM : measures.GetDataDim<1>()) { for(double edgeM : measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double faceM : measures.GetDataDim<2>()) { for(double faceM : measures.getDataByDim<2>()) { DBGVAR(faceM) DBGVAR(faceM) } } for(double cellM : measures.GetDataDim<3>()) { for(double cellM : measures.getDataByDim<3>()) { DBGVAR(cellM) DBGVAR(cellM) } } } } Loading @@ -557,7 +557,7 @@ void testMeshDataContainer() { for(auto& c : container.GetDataDim<0>()) { for(auto& c : container.getDataByDim<0>()) { c=42; c=42; } } Loading @@ -567,19 +567,19 @@ void testMeshDataContainer() { MeshDataContainer<std::tuple<int, double, char, int>, 3, 2, 0, 2> containerIni(mesh3,3, 42.15, 'a', 15); MeshDataContainer<std::tuple<int, double, char, int>, 3, 2, 0, 2> containerIni(mesh3,3, 42.15, 'a', 15); for (auto& val : containerIni.GetDataPos<0>()){ for (auto& val : containerIni.getDataByPos<0>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<1>()){ for (auto& val : containerIni.getDataByPos<1>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<2>()){ for (auto& val : containerIni.getDataByPos<2>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<3>()){ for (auto& val : containerIni.getDataByPos<3>()){ DBGVAR(val) DBGVAR(val) } } } } Loading Unstructured_mesh/mesh_functions.h +18 −18 Original line number Original line Diff line number Diff line Loading @@ -34,8 +34,8 @@ struct _ComputeCenters{ MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& elemCenters = centers.template GetDataDim<dim>(); auto& elemCenters = centers.template getDataByDim<dim>(); auto& subElemCenters = centers.template GetDataDim<dim - 1>(); auto& subElemCenters = centers.template getDataByDim<dim - 1>(); for (IndexType i = 0; i < mesh.template getElements<dim>().size(); i++) { for (IndexType i = 0; i < mesh.template getElements<dim>().size(); i++) { Loading @@ -60,8 +60,8 @@ struct _ComputeCenters<Dimension, Dimension>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& elemCenters = centers.template GetDataDim<Dimension>(); auto& elemCenters = centers.template getDataByDim<Dimension>(); auto& subElemCenters = centers.template GetDataDim<Dimension - 1>(); auto& subElemCenters = centers.template getDataByDim<Dimension - 1>(); for (IndexType i = 0; i < mesh.template getElements<Dimension>().size(); i++) { for (IndexType i = 0; i < mesh.template getElements<Dimension>().size(); i++) { Loading Loading @@ -89,7 +89,7 @@ struct _ComputeCenters<1, Dimension>{ MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ std::vector<Vertex<Dimension, Real>>& edgeCenters = centers.template GetDataDim<1>(); std::vector<Vertex<Dimension, Real>>& edgeCenters = centers.template getDataByDim<1>(); for (auto& edge : mesh.template getElements<1>()) { for (auto& edge : mesh.template getElements<1>()) { Loading Loading @@ -152,7 +152,7 @@ struct _ComputeMeasures<3, 3>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ auto& cellMeasures = measures.template GetDataDim<3>(); auto& cellMeasures = measures.template getDataByDim<3>(); for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<3>& cell : mesh.getCells()) { for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<3>& cell : mesh.getCells()) { IndexType tmpFace = cell.getBoundaryElementIndex(); IndexType tmpFace = cell.getBoundaryElementIndex(); Loading Loading @@ -188,7 +188,7 @@ struct _ComputeMeasures<3, 3>{ Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).normEukleid(); Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).normEukleid(); Real tmp = distance * measures.template GetDataDim<2>().at(tmpFace); Real tmp = distance * measures.template getDataByDim<2>().at(tmpFace); measure += tmp / 3.0; measure += tmp / 3.0; tmpFace = mesh.getFaces().at(tmpFace).getNextBElem(cell.getIndex()); tmpFace = mesh.getFaces().at(tmpFace).getNextBElem(cell.getIndex()); Loading @@ -204,7 +204,7 @@ struct _ComputeMeasures<2, 2>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 2>>& measures,MeshElements<2, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 2>>& measures,MeshElements<2, IndexType, Real, Reserve...>& mesh){ auto& surfaceMeasures = measures.template GetDataDim<2>(); auto& surfaceMeasures = measures.template getDataByDim<2>(); for (typename MeshElements<2, IndexType, Real, Reserve...>::template ElementType<2>& cell : mesh.getCells()) { for (typename MeshElements<2, IndexType, Real, Reserve...>::template ElementType<2>& cell : mesh.getCells()) { IndexType tmpEdge = cell.getBoundaryElementIndex(); IndexType tmpEdge = cell.getBoundaryElementIndex(); Loading Loading @@ -232,7 +232,7 @@ struct _ComputeMeasures<2, 3>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ auto& surfaceMeasures = measures.template GetDataDim<2>(); auto& surfaceMeasures = measures.template getDataByDim<2>(); for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<2>& face : mesh.template getElements<2>()) { for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<2>& face : mesh.template getElements<2>()) { Loading @@ -249,7 +249,7 @@ struct _ComputeMeasures<2, 3>{ distance = (a-faceCenter+(b-a)*param).normEukleid(); distance = (a-faceCenter+(b-a)*param).normEukleid(); Real tmp = distance * measures.template GetDataDim<1>().at(sube.index); Real tmp = distance * measures.template getDataByDim<1>().at(sube.index); measure += tmp * 0.5; measure += tmp * 0.5; } } surfaceMeasures.at(face.getIndex()) = measure; surfaceMeasures.at(face.getIndex()) = measure; Loading @@ -269,7 +269,7 @@ struct _ComputeMeasures<1, Dimension>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& measures,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& measures,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& edgeLengths = measures.template GetDataDim<1>(); auto& edgeLengths = measures.template getDataByDim<1>(); for (auto& edge : mesh.getEdges()) { for (auto& edge : mesh.getEdges()) { edgeLengths.at(edge.getIndex()) = (mesh.getVertices().at(edge.getVertexAIndex()) - edgeLengths.at(edge.getIndex()) = (mesh.getVertices().at(edge.getVertexAIndex()) - Loading Loading @@ -550,7 +550,7 @@ struct MeshConnections { ) { ) { MeshDataContainer<std::set<IndexType>, StartDim> result(mesh); MeshDataContainer<std::set<IndexType>, StartDim> result(mesh); MeshApply<StartDim, TargetDim, MeshDimension>::apply(mesh, [&result](unsigned int, unsigned int, IndexType ori, IndexType element){ MeshApply<StartDim, TargetDim, MeshDimension>::apply(mesh, [&result](unsigned int, unsigned int, IndexType ori, IndexType element){ result.template GetDataPos<0>().at(ori).insert(element); result.template getDataByPos<0>().at(ori).insert(element); }); }); return result; return result; Loading Loading @@ -579,7 +579,7 @@ struct MeshColouring { startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), [&possibleColours, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ [&possibleColours, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ DBGTRY(possibleColours &= !attachedColours.template GetDataPos<0>().at(element);) DBGTRY(possibleColours &= !attachedColours.template getDataByPos<0>().at(element);) } } ); ); Loading @@ -588,13 +588,13 @@ struct MeshColouring { while (!possibleColours[selectedColour]) { while (!possibleColours[selectedColour]) { selectedColour++; selectedColour++; } } result.template GetDataPos<0>().at(startElement.getIndex()) = selectedColour; result.template getDataByPos<0>().at(startElement.getIndex()) = selectedColour; MeshRun<FromDim, FromDim, ToDim, MeshDimension, false, true>:: MeshRun<FromDim, FromDim, ToDim, MeshDimension, false, true>:: run(mesh, run(mesh, startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), [selectedColour, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ [selectedColour, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ DBGTRY(attachedColours.template GetDataPos<0>().at(element)[selectedColour] = true;) DBGTRY(attachedColours.template getDataByPos<0>().at(element)[selectedColour] = true;) } } ); ); } } Loading @@ -621,7 +621,7 @@ struct MeshColouring <FromDim, ToDim, false> { std::valarray<bool> possibleColours(true,reserve); std::valarray<bool> possibleColours(true,reserve); for (IndexType element : connections.at(startElement)){ for (IndexType element : connections.at(startElement)){ DBGTRY(possibleColours &= !attachedColours.template GetDataPos<0>().at(element);) DBGTRY(possibleColours &= !attachedColours.template getDataByPos<0>().at(element);) } } Loading @@ -630,10 +630,10 @@ struct MeshColouring <FromDim, ToDim, false> { selectedColour++; selectedColour++; } } result.template GetDataPos<0>().at(startElement.getIndex()) = selectedColour; result.template getDataByPos<0>().at(startElement.getIndex()) = selectedColour; for (IndexType element : connections.at(startElement)){ for (IndexType element : connections.at(startElement)){ DBGTRY(attachedColours.template GetDataPos<0>().at(element)[selectedColour] = true;) DBGTRY(attachedColours.template getDataByPos<0>().at(element)[selectedColour] = true;) } } } } return result; return result; Loading Unstructured_mesh/meshdatacontainer.h +48 −56 File changed.Preview size limit exceeded, changes collapsed. Show changes Unstructured_mesh/unstructuredmesh.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ template <unsigned int Dimension, typename IndexType, typename Real, unsigned in class UnstructuredMesh : public MeshElements<Dimension, IndexType, Real, Reserve...>{ class UnstructuredMesh : public MeshElements<Dimension, IndexType, Real, Reserve...>{ public: public: void InitializeCenters(){ void initializeCenters(){ auto centers = ComputeCenters(*this); auto centers = ComputeCenters(*this); for (auto& face : this->getFaces()){ for (auto& face : this->getFaces()){ Loading @@ -21,11 +21,11 @@ public: } } } } MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>> ComputeElementMeasures() { MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>> computeElementMeasures() { return ComputeMeasures(*this); return ComputeMeasures(*this); } } MeshDataContainer<Vector<Dimension, Real>, Dimension-1> ComputeFaceNormals() { MeshDataContainer<Vector<Dimension, Real>, Dimension-1> computeFaceNormals() { return ::ComputeFaceNormals(*this); return ::ComputeFaceNormals(*this); } } Loading @@ -38,7 +38,7 @@ public: } } */ */ public: public: Real ComputeCellDist(IndexType cellIndex1, IndexType cellIndex2){ Real computeCellDist(IndexType cellIndex1, IndexType cellIndex2){ return (this->getCells().at(cellIndex1).GetCenter() - this->getCells().at(cellIndex2).GetCenter()).NormEukleid(); return (this->getCells().at(cellIndex1).GetCenter() - this->getCells().at(cellIndex2).GetCenter()).NormEukleid(); } } }; }; Loading Unstructured_mesh/vector.h +15 −15 Original line number Original line Diff line number Diff line Loading @@ -11,9 +11,9 @@ template <unsigned int Dim, typename Real = double> template <unsigned int Dim, typename Real = double> class Vector { class Vector { /** /** * @brief Coordinates * @brief coordinates */ */ Real Coordinates[Dim] = {}; Real coordinates[Dim] = {}; public: public: Vector(){} Vector(){} Loading @@ -24,21 +24,21 @@ public: Vector<Dim, Real>& operator =(std::initializer_list<Real> l); Vector<Dim, Real>& operator =(std::initializer_list<Real> l); void setCoordinate(Real coord, unsigned int pos){ void setCoordinate(Real coord, unsigned int pos){ Coordinates[pos] = coord; coordinates[pos] = coord; } } Real& operator[](unsigned int pos){ Real& operator[](unsigned int pos){ return Coordinates[pos]; return coordinates[pos]; } } const Real& operator[](unsigned int pos) const { const Real& operator[](unsigned int pos) const { return Coordinates[pos]; return coordinates[pos]; } } Real normEukleid(); Real normEukleid(); inline Real sumOfSquares() { inline Real sumOfSquares() { return inlineScalarProduct<Dim, Real>::computation(Coordinates, Coordinates); return inlineScalarProduct<Dim, Real>::computation(coordinates, coordinates); } } Vector<Dim, Real> operator-(const Vector<Dim, Real>&) const; Vector<Dim, Real> operator-(const Vector<Dim, Real>&) const; Loading Loading @@ -75,7 +75,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator =(std::initializer_list<Real> l){ for(Real x : l){ for(Real x : l){ if (i < Dim){ if (i < Dim){ Coordinates[i] = x; coordinates[i] = x; }else{ }else{ break; break; } } Loading @@ -83,7 +83,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator =(std::initializer_list<Real> l){ } } if (i < Dim){ if (i < Dim){ for (; i < Dim; i++) { for (; i < Dim; i++) { Coordinates[i] = Real(); coordinates[i] = Real(); } } } } return *this; return *this; Loading Loading @@ -119,7 +119,7 @@ Real Vector<Dim, Real>::normEukleid(){ template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) const { Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineSubtraction<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); inlineSubtraction<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; return res; } } Loading @@ -127,7 +127,7 @@ Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) cons template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) const { Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineAddition<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); inlineAddition<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; return res; } } Loading @@ -135,7 +135,7 @@ Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) cons template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator *(const Real& x) const { Vector<Dim, Real> Vector<Dim, Real>::operator *(const Real& x) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineMultiplication<Dim, Real>::computation(res.Coordinates, this->Coordinates, x); inlineMultiplication<Dim, Real>::computation(res.coordinates, this->coordinates, x); return res; return res; } } Loading @@ -152,20 +152,20 @@ Vector<Dim, Real> Vector<Dim, Real>::operator /(const Real& x) const { template<unsigned int Dim, typename Real> template<unsigned int Dim, typename Real> Real Vector<Dim, Real>::operator*(const Vector &v) Real Vector<Dim, Real>::operator*(const Vector &v) { { return inlineScalarProduct<Dim, Real>::computation(Coordinates, v.Coordinates); return inlineScalarProduct<Dim, Real>::computation(coordinates, v.coordinates); } } // Adds value of coordinates of another Point // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator +=(const Vector<Dim, Real>& v){ Vector<Dim, Real>& Vector<Dim, Real>::operator +=(const Vector<Dim, Real>& v){ inlineAddition<Dim, Real>::computation(Coordinates, v.Coordinates); inlineAddition<Dim, Real>::computation(coordinates, v.coordinates); return *this; return *this; } } // Subtracts value of coordinates of another Point // Subtracts value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ inlineSubtraction<Dim, Real>::computation(Coordinates, v.Coordinates); inlineSubtraction<Dim, Real>::computation(coordinates, v.coordinates); return *this; return *this; } } Loading @@ -173,7 +173,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ // Adds value of coordinates of another Point // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator *=(const Real& x){ Vector<Dim, Real>& Vector<Dim, Real>::operator *=(const Real& x){ inlineMultiplication<Dim, Real>::computation(Coordinates, x); inlineMultiplication<Dim, Real>::computation(coordinates, x); return *this; return *this; } } Loading Loading
Unstructured_mesh/main.cpp +24 −24 Original line number Original line Diff line number Diff line Loading @@ -298,7 +298,7 @@ void testMesh2D() { mesh.getCells().at(1).setBoundaryElementIndex(2); mesh.getCells().at(1).setBoundaryElementIndex(2); mesh.getCells().at(1).setIndex(1); mesh.getCells().at(1).setIndex(1); mesh.InitializeCenters(); mesh.initializeCenters(); Loading Loading @@ -339,26 +339,26 @@ void testMesh2D() { auto centers = ComputeCenters(mesh); auto centers = ComputeCenters(mesh); auto& faceCent = centers.GetDataDim<1>(); auto& faceCent = centers.getDataByDim<1>(); for(auto& center : faceCent) { for(auto& center : faceCent) { DBGVAR(center) DBGVAR(center) } } DBGMSG("cellCenter"); DBGMSG("cellCenter"); for(sit::Cell& cell : mesh.getCells()){ for(sit::Cell& cell : mesh.getCells()){ DBGVAR(centers.GetDataDim<2>().at(cell.getIndex())) DBGVAR(centers.getDataByDim<2>().at(cell.getIndex())) } } DBGMSG("computing measures"); DBGMSG("computing measures"); auto measures = mesh.ComputeElementMeasures(); auto measures = mesh.computeElementMeasures(); for(double edgeM :measures.GetDataDim<1>()) { for(double edgeM :measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double cellM :measures.GetDataDim<2>()) { for(double cellM :measures.getDataByDim<2>()) { DBGVAR(cellM) DBGVAR(cellM) } } Loading Loading @@ -418,12 +418,12 @@ void testMesh3D() { MakeMeshDataContainer_t<double, make_custom_integer_sequence_t<unsigned int, 0,3>> cont1(mesh3); MakeMeshDataContainer_t<double, make_custom_integer_sequence_t<unsigned int, 0,3>> cont1(mesh3); //cont.GetDataDim<3>().resize(20); //cont.getDataByDim<3>().resize(20); DBGVAR(cont.GetDataPos<1>().size()) DBGVAR(cont.getDataByPos<1>().size()) DBGVAR(cont.GetDataPos<0>().size()) DBGVAR(cont.getDataByPos<0>().size()) DBGVAR(cont.GetDataDim<3>().size()) DBGVAR(cont.getDataByDim<3>().size()) DBGMSG("faceCenters"); DBGMSG("faceCenters"); Loading @@ -434,33 +434,33 @@ void testMesh3D() { auto centers = ComputeCenters(mesh3); auto centers = ComputeCenters(mesh3); for(auto& face : mesh3.getFaces()) { for(auto& face : mesh3.getFaces()) { face.setCenter(centers.template GetDataDim<2>().at(face.getIndex())); face.setCenter(centers.template getDataByDim<2>().at(face.getIndex())); DBGVAR(face.getCenter()) DBGVAR(face.getCenter()) } } DBGMSG("cellCenter"); DBGMSG("cellCenter"); for(auto& cell : mesh3.getCells()) { for(auto& cell : mesh3.getCells()) { cell.setCenter(centers.template GetDataDim<3>().at(cell.getIndex())); cell.setCenter(centers.template getDataByDim<3>().at(cell.getIndex())); DBGVAR(cell.getCenter()) DBGVAR(cell.getCenter()) } } DBGMSG("measure computation"); DBGMSG("measure computation"); auto measures = ComputeMeasures(mesh3); auto measures = ComputeMeasures(mesh3); for(double edgeM : measures.GetDataDim<1>()) { for(double edgeM : measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double faceM : measures.GetDataDim<2>()) { for(double faceM : measures.getDataByDim<2>()) { DBGVAR(faceM) DBGVAR(faceM) } } for(double cellM : measures.GetDataDim<3>()) { for(double cellM : measures.getDataByDim<3>()) { DBGVAR(cellM) DBGVAR(cellM) } } DBGMSG("2D normals test"); DBGMSG("2D normals test"); auto normals = mesh3.ComputeFaceNormals(); auto normals = mesh3.computeFaceNormals(); for(auto& face : mesh3.getFaces()){ for(auto& face : mesh3.getFaces()){ DBGVAR(face.getIndex(),normals.at(face)) DBGVAR(face.getIndex(),normals.at(face)) } } Loading Loading @@ -529,14 +529,14 @@ void test3DMeshDeformedPrisms() { DBGMSG("measure computation"); DBGMSG("measure computation"); auto measures = ComputeMeasures(mesh3); auto measures = ComputeMeasures(mesh3); for(double edgeM : measures.GetDataDim<1>()) { for(double edgeM : measures.getDataByDim<1>()) { DBGVAR(edgeM) DBGVAR(edgeM) } } for(double faceM : measures.GetDataDim<2>()) { for(double faceM : measures.getDataByDim<2>()) { DBGVAR(faceM) DBGVAR(faceM) } } for(double cellM : measures.GetDataDim<3>()) { for(double cellM : measures.getDataByDim<3>()) { DBGVAR(cellM) DBGVAR(cellM) } } } } Loading @@ -557,7 +557,7 @@ void testMeshDataContainer() { for(auto& c : container.GetDataDim<0>()) { for(auto& c : container.getDataByDim<0>()) { c=42; c=42; } } Loading @@ -567,19 +567,19 @@ void testMeshDataContainer() { MeshDataContainer<std::tuple<int, double, char, int>, 3, 2, 0, 2> containerIni(mesh3,3, 42.15, 'a', 15); MeshDataContainer<std::tuple<int, double, char, int>, 3, 2, 0, 2> containerIni(mesh3,3, 42.15, 'a', 15); for (auto& val : containerIni.GetDataPos<0>()){ for (auto& val : containerIni.getDataByPos<0>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<1>()){ for (auto& val : containerIni.getDataByPos<1>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<2>()){ for (auto& val : containerIni.getDataByPos<2>()){ DBGVAR(val) DBGVAR(val) } } for (auto& val : containerIni.GetDataPos<3>()){ for (auto& val : containerIni.getDataByPos<3>()){ DBGVAR(val) DBGVAR(val) } } } } Loading
Unstructured_mesh/mesh_functions.h +18 −18 Original line number Original line Diff line number Diff line Loading @@ -34,8 +34,8 @@ struct _ComputeCenters{ MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& elemCenters = centers.template GetDataDim<dim>(); auto& elemCenters = centers.template getDataByDim<dim>(); auto& subElemCenters = centers.template GetDataDim<dim - 1>(); auto& subElemCenters = centers.template getDataByDim<dim - 1>(); for (IndexType i = 0; i < mesh.template getElements<dim>().size(); i++) { for (IndexType i = 0; i < mesh.template getElements<dim>().size(); i++) { Loading @@ -60,8 +60,8 @@ struct _ComputeCenters<Dimension, Dimension>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& elemCenters = centers.template GetDataDim<Dimension>(); auto& elemCenters = centers.template getDataByDim<Dimension>(); auto& subElemCenters = centers.template GetDataDim<Dimension - 1>(); auto& subElemCenters = centers.template getDataByDim<Dimension - 1>(); for (IndexType i = 0; i < mesh.template getElements<Dimension>().size(); i++) { for (IndexType i = 0; i < mesh.template getElements<Dimension>().size(); i++) { Loading Loading @@ -89,7 +89,7 @@ struct _ComputeCenters<1, Dimension>{ MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MakeMeshDataContainer_t<Vertex<Dimension, Real>, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& centers, MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ std::vector<Vertex<Dimension, Real>>& edgeCenters = centers.template GetDataDim<1>(); std::vector<Vertex<Dimension, Real>>& edgeCenters = centers.template getDataByDim<1>(); for (auto& edge : mesh.template getElements<1>()) { for (auto& edge : mesh.template getElements<1>()) { Loading Loading @@ -152,7 +152,7 @@ struct _ComputeMeasures<3, 3>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ auto& cellMeasures = measures.template GetDataDim<3>(); auto& cellMeasures = measures.template getDataByDim<3>(); for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<3>& cell : mesh.getCells()) { for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<3>& cell : mesh.getCells()) { IndexType tmpFace = cell.getBoundaryElementIndex(); IndexType tmpFace = cell.getBoundaryElementIndex(); Loading Loading @@ -188,7 +188,7 @@ struct _ComputeMeasures<3, 3>{ Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).normEukleid(); Real distance = (vAmcC + (vBmA * param_t) + (vCmA * param_s)).normEukleid(); Real tmp = distance * measures.template GetDataDim<2>().at(tmpFace); Real tmp = distance * measures.template getDataByDim<2>().at(tmpFace); measure += tmp / 3.0; measure += tmp / 3.0; tmpFace = mesh.getFaces().at(tmpFace).getNextBElem(cell.getIndex()); tmpFace = mesh.getFaces().at(tmpFace).getNextBElem(cell.getIndex()); Loading @@ -204,7 +204,7 @@ struct _ComputeMeasures<2, 2>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 2>>& measures,MeshElements<2, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 2>>& measures,MeshElements<2, IndexType, Real, Reserve...>& mesh){ auto& surfaceMeasures = measures.template GetDataDim<2>(); auto& surfaceMeasures = measures.template getDataByDim<2>(); for (typename MeshElements<2, IndexType, Real, Reserve...>::template ElementType<2>& cell : mesh.getCells()) { for (typename MeshElements<2, IndexType, Real, Reserve...>::template ElementType<2>& cell : mesh.getCells()) { IndexType tmpEdge = cell.getBoundaryElementIndex(); IndexType tmpEdge = cell.getBoundaryElementIndex(); Loading Loading @@ -232,7 +232,7 @@ struct _ComputeMeasures<2, 3>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, 3>>& measures,MeshElements<3, IndexType, Real, Reserve...>& mesh){ auto& surfaceMeasures = measures.template GetDataDim<2>(); auto& surfaceMeasures = measures.template getDataByDim<2>(); for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<2>& face : mesh.template getElements<2>()) { for (typename MeshElements<3, IndexType, Real, Reserve...>::template ElementType<2>& face : mesh.template getElements<2>()) { Loading @@ -249,7 +249,7 @@ struct _ComputeMeasures<2, 3>{ distance = (a-faceCenter+(b-a)*param).normEukleid(); distance = (a-faceCenter+(b-a)*param).normEukleid(); Real tmp = distance * measures.template GetDataDim<1>().at(sube.index); Real tmp = distance * measures.template getDataByDim<1>().at(sube.index); measure += tmp * 0.5; measure += tmp * 0.5; } } surfaceMeasures.at(face.getIndex()) = measure; surfaceMeasures.at(face.getIndex()) = measure; Loading @@ -269,7 +269,7 @@ struct _ComputeMeasures<1, Dimension>{ template <typename IndexType, typename Real, unsigned int ...Reserve> template <typename IndexType, typename Real, unsigned int ...Reserve> static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& measures,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ static void compute(MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>>& measures,MeshElements<Dimension, IndexType, Real, Reserve...>& mesh){ auto& edgeLengths = measures.template GetDataDim<1>(); auto& edgeLengths = measures.template getDataByDim<1>(); for (auto& edge : mesh.getEdges()) { for (auto& edge : mesh.getEdges()) { edgeLengths.at(edge.getIndex()) = (mesh.getVertices().at(edge.getVertexAIndex()) - edgeLengths.at(edge.getIndex()) = (mesh.getVertices().at(edge.getVertexAIndex()) - Loading Loading @@ -550,7 +550,7 @@ struct MeshConnections { ) { ) { MeshDataContainer<std::set<IndexType>, StartDim> result(mesh); MeshDataContainer<std::set<IndexType>, StartDim> result(mesh); MeshApply<StartDim, TargetDim, MeshDimension>::apply(mesh, [&result](unsigned int, unsigned int, IndexType ori, IndexType element){ MeshApply<StartDim, TargetDim, MeshDimension>::apply(mesh, [&result](unsigned int, unsigned int, IndexType ori, IndexType element){ result.template GetDataPos<0>().at(ori).insert(element); result.template getDataByPos<0>().at(ori).insert(element); }); }); return result; return result; Loading Loading @@ -579,7 +579,7 @@ struct MeshColouring { startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), [&possibleColours, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ [&possibleColours, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ DBGTRY(possibleColours &= !attachedColours.template GetDataPos<0>().at(element);) DBGTRY(possibleColours &= !attachedColours.template getDataByPos<0>().at(element);) } } ); ); Loading @@ -588,13 +588,13 @@ struct MeshColouring { while (!possibleColours[selectedColour]) { while (!possibleColours[selectedColour]) { selectedColour++; selectedColour++; } } result.template GetDataPos<0>().at(startElement.getIndex()) = selectedColour; result.template getDataByPos<0>().at(startElement.getIndex()) = selectedColour; MeshRun<FromDim, FromDim, ToDim, MeshDimension, false, true>:: MeshRun<FromDim, FromDim, ToDim, MeshDimension, false, true>:: run(mesh, run(mesh, startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), startElement.getIndex(), [selectedColour, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ [selectedColour, &attachedColours](unsigned int, unsigned int, IndexType, IndexType element){ DBGTRY(attachedColours.template GetDataPos<0>().at(element)[selectedColour] = true;) DBGTRY(attachedColours.template getDataByPos<0>().at(element)[selectedColour] = true;) } } ); ); } } Loading @@ -621,7 +621,7 @@ struct MeshColouring <FromDim, ToDim, false> { std::valarray<bool> possibleColours(true,reserve); std::valarray<bool> possibleColours(true,reserve); for (IndexType element : connections.at(startElement)){ for (IndexType element : connections.at(startElement)){ DBGTRY(possibleColours &= !attachedColours.template GetDataPos<0>().at(element);) DBGTRY(possibleColours &= !attachedColours.template getDataByPos<0>().at(element);) } } Loading @@ -630,10 +630,10 @@ struct MeshColouring <FromDim, ToDim, false> { selectedColour++; selectedColour++; } } result.template GetDataPos<0>().at(startElement.getIndex()) = selectedColour; result.template getDataByPos<0>().at(startElement.getIndex()) = selectedColour; for (IndexType element : connections.at(startElement)){ for (IndexType element : connections.at(startElement)){ DBGTRY(attachedColours.template GetDataPos<0>().at(element)[selectedColour] = true;) DBGTRY(attachedColours.template getDataByPos<0>().at(element)[selectedColour] = true;) } } } } return result; return result; Loading
Unstructured_mesh/meshdatacontainer.h +48 −56 File changed.Preview size limit exceeded, changes collapsed. Show changes
Unstructured_mesh/unstructuredmesh.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ template <unsigned int Dimension, typename IndexType, typename Real, unsigned in class UnstructuredMesh : public MeshElements<Dimension, IndexType, Real, Reserve...>{ class UnstructuredMesh : public MeshElements<Dimension, IndexType, Real, Reserve...>{ public: public: void InitializeCenters(){ void initializeCenters(){ auto centers = ComputeCenters(*this); auto centers = ComputeCenters(*this); for (auto& face : this->getFaces()){ for (auto& face : this->getFaces()){ Loading @@ -21,11 +21,11 @@ public: } } } } MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>> ComputeElementMeasures() { MakeMeshDataContainer_t<Real, make_custom_integer_sequence_t<unsigned int, 1, Dimension>> computeElementMeasures() { return ComputeMeasures(*this); return ComputeMeasures(*this); } } MeshDataContainer<Vector<Dimension, Real>, Dimension-1> ComputeFaceNormals() { MeshDataContainer<Vector<Dimension, Real>, Dimension-1> computeFaceNormals() { return ::ComputeFaceNormals(*this); return ::ComputeFaceNormals(*this); } } Loading @@ -38,7 +38,7 @@ public: } } */ */ public: public: Real ComputeCellDist(IndexType cellIndex1, IndexType cellIndex2){ Real computeCellDist(IndexType cellIndex1, IndexType cellIndex2){ return (this->getCells().at(cellIndex1).GetCenter() - this->getCells().at(cellIndex2).GetCenter()).NormEukleid(); return (this->getCells().at(cellIndex1).GetCenter() - this->getCells().at(cellIndex2).GetCenter()).NormEukleid(); } } }; }; Loading
Unstructured_mesh/vector.h +15 −15 Original line number Original line Diff line number Diff line Loading @@ -11,9 +11,9 @@ template <unsigned int Dim, typename Real = double> template <unsigned int Dim, typename Real = double> class Vector { class Vector { /** /** * @brief Coordinates * @brief coordinates */ */ Real Coordinates[Dim] = {}; Real coordinates[Dim] = {}; public: public: Vector(){} Vector(){} Loading @@ -24,21 +24,21 @@ public: Vector<Dim, Real>& operator =(std::initializer_list<Real> l); Vector<Dim, Real>& operator =(std::initializer_list<Real> l); void setCoordinate(Real coord, unsigned int pos){ void setCoordinate(Real coord, unsigned int pos){ Coordinates[pos] = coord; coordinates[pos] = coord; } } Real& operator[](unsigned int pos){ Real& operator[](unsigned int pos){ return Coordinates[pos]; return coordinates[pos]; } } const Real& operator[](unsigned int pos) const { const Real& operator[](unsigned int pos) const { return Coordinates[pos]; return coordinates[pos]; } } Real normEukleid(); Real normEukleid(); inline Real sumOfSquares() { inline Real sumOfSquares() { return inlineScalarProduct<Dim, Real>::computation(Coordinates, Coordinates); return inlineScalarProduct<Dim, Real>::computation(coordinates, coordinates); } } Vector<Dim, Real> operator-(const Vector<Dim, Real>&) const; Vector<Dim, Real> operator-(const Vector<Dim, Real>&) const; Loading Loading @@ -75,7 +75,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator =(std::initializer_list<Real> l){ for(Real x : l){ for(Real x : l){ if (i < Dim){ if (i < Dim){ Coordinates[i] = x; coordinates[i] = x; }else{ }else{ break; break; } } Loading @@ -83,7 +83,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator =(std::initializer_list<Real> l){ } } if (i < Dim){ if (i < Dim){ for (; i < Dim; i++) { for (; i < Dim; i++) { Coordinates[i] = Real(); coordinates[i] = Real(); } } } } return *this; return *this; Loading Loading @@ -119,7 +119,7 @@ Real Vector<Dim, Real>::normEukleid(){ template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) const { Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineSubtraction<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); inlineSubtraction<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; return res; } } Loading @@ -127,7 +127,7 @@ Vector<Dim, Real> Vector<Dim, Real>::operator -(const Vector<Dim, Real>& v) cons template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) const { Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineAddition<Dim, Real>::computation(res.Coordinates, this->Coordinates, v.Coordinates); inlineAddition<Dim, Real>::computation(res.coordinates, this->coordinates, v.coordinates); return res; return res; } } Loading @@ -135,7 +135,7 @@ Vector<Dim, Real> Vector<Dim, Real>::operator +(const Vector<Dim, Real>& v) cons template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real> Vector<Dim, Real>::operator *(const Real& x) const { Vector<Dim, Real> Vector<Dim, Real>::operator *(const Real& x) const { Vector<Dim, Real> res; Vector<Dim, Real> res; inlineMultiplication<Dim, Real>::computation(res.Coordinates, this->Coordinates, x); inlineMultiplication<Dim, Real>::computation(res.coordinates, this->coordinates, x); return res; return res; } } Loading @@ -152,20 +152,20 @@ Vector<Dim, Real> Vector<Dim, Real>::operator /(const Real& x) const { template<unsigned int Dim, typename Real> template<unsigned int Dim, typename Real> Real Vector<Dim, Real>::operator*(const Vector &v) Real Vector<Dim, Real>::operator*(const Vector &v) { { return inlineScalarProduct<Dim, Real>::computation(Coordinates, v.Coordinates); return inlineScalarProduct<Dim, Real>::computation(coordinates, v.coordinates); } } // Adds value of coordinates of another Point // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator +=(const Vector<Dim, Real>& v){ Vector<Dim, Real>& Vector<Dim, Real>::operator +=(const Vector<Dim, Real>& v){ inlineAddition<Dim, Real>::computation(Coordinates, v.Coordinates); inlineAddition<Dim, Real>::computation(coordinates, v.coordinates); return *this; return *this; } } // Subtracts value of coordinates of another Point // Subtracts value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ inlineSubtraction<Dim, Real>::computation(Coordinates, v.Coordinates); inlineSubtraction<Dim, Real>::computation(coordinates, v.coordinates); return *this; return *this; } } Loading @@ -173,7 +173,7 @@ Vector<Dim, Real>& Vector<Dim, Real>::operator -=(const Vector<Dim, Real>& v){ // Adds value of coordinates of another Point // Adds value of coordinates of another Point template <unsigned int Dim, typename Real> template <unsigned int Dim, typename Real> Vector<Dim, Real>& Vector<Dim, Real>::operator *=(const Real& x){ Vector<Dim, Real>& Vector<Dim, Real>::operator *=(const Real& x){ inlineMultiplication<Dim, Real>::computation(Coordinates, x); inlineMultiplication<Dim, Real>::computation(coordinates, x); return *this; return *this; } } Loading