diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index b023c20e8687f7d3c5c300199372e922e8e4aef9..75e3a408134305e665cd27eee6d4300948310798 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -1263,7 +1263,7 @@ void onelabGroup::_addSolverMenu(int num) int hh = n->labelsize() + 4; _tree->begin(); Fl_Group *grp = new Fl_Group(1, 1, ww, hh); - solverButton *but = new solverButton(1, 1, ww, hh, num, _tree->color()); + new solverButton(1, 1, ww, hh, num, _tree->color()); grp->end(); //grp->resizable(0); _treeWidgets.push_back(grp); @@ -1280,7 +1280,7 @@ void onelabGroup::_addViewMenu(int num) int hh = n->labelsize() + 4; _tree->begin(); Fl_Group *grp = new Fl_Group(1, 1, ww, hh); - viewButton *but = new viewButton(1, 1, ww, hh, num, _tree->color()); + new viewButton(1, 1, ww, hh, num, _tree->color()); grp->end(); //grp->resizable(0); _treeWidgets.push_back(grp); diff --git a/Geo/Curvature.h b/Geo/Curvature.h index ff83f0e979f355666c098df694c495cce8c33a2b..27c9229d128af13daf9935de54943d998cf789f4 100644 --- a/Geo/Curvature.h +++ b/Geo/Curvature.h @@ -3,7 +3,7 @@ // See the LICENSE.txt file for license information. Please report all // bugs and problems to the public mailing list <gmsh@geuz.org>. -#ifndef _CURVATUREL_H_ +#ifndef _CURVATURE_H_ #define _CURVATURE_H_ #include "GModel.h" @@ -58,7 +58,7 @@ private: bool _isMapInitialized; //Model and list of selected entities with give physical tag: - GModel* _model; + GModel* _model; GFaceList _EntityArray; //Averaged vertex normals @@ -181,7 +181,7 @@ public: typedef enum {RUSIN=1,RBF=2, SIMPLE=3} typeOfCurvature; static Curvature& getInstance(); static bool valueAlreadyComputed(); - + inline void setGModel(GModel* model) { _model = model; @@ -193,7 +193,7 @@ public: //void retrievePhysicalSurfaces(const std::string & face_tag); void computeCurvature(GModel* model, typeOfCurvature typ); - + /// The following function implements algorithm from: /// Implementation of an Algorithm for Approximating the Curvature Tensor /// on a Triangular Surface Mesh in the Vish Environment @@ -229,5 +229,4 @@ public: }; - #endif diff --git a/Mesh/QuadTriExtruded2D.cpp b/Mesh/QuadTriExtruded2D.cpp index 1924aa6ab590947d47b6c712fcf75a0dff12aeed..0af475873ddf6860bea7d2429210fa2a19aa1cd3 100644 --- a/Mesh/QuadTriExtruded2D.cpp +++ b/Mesh/QuadTriExtruded2D.cpp @@ -61,7 +61,7 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT ExtrudeParams *ep = face->meshAttributes.extrude; - if( !ep || !ep->mesh.ExtrudeMesh || !ep->geo.Mode == EXTRUDED_ENTITY ){ + if( !ep || !ep->mesh.ExtrudeMesh || !(ep->geo.Mode == EXTRUDED_ENTITY) ){ Msg::Error("In IsValidQuadToTriLateral(), face %d is not a structured extrusion.", face->tag() ); return 0; @@ -213,7 +213,7 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT // there are QuadToTri conflicts, return 0. // if the surface turns out to be the source of a toroidal loop extrusion (which will then // NOT have geo.Mode == COPIED_ENTITY), return 2 (this will require special meshing considerations). -// Note that RemoveDuplicateSurfaces() makes this DIFFICULT. +// Note that RemoveDuplicateSurfaces() makes this DIFFICULT. // Also, the type of QuadToTri interface is placed into the // pointer argument quadToTri. . // Added 2010-12-09. @@ -223,12 +223,12 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop) (*detectQuadToTriTop) = false; int is_toroidal_quadtri = 0; - + GModel *model = face->model(); // First thing is first: determine if this is a toroidal quadtri extrusion. if so, can skip the rest - - + + // It seems the member pointers to neighboring regions for extruded top faces are not set. // For now, have to loop through // ALL the regions to see if the presently considered face belongs to the region. @@ -236,12 +236,12 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop) // whether the face is a top face of the region (including whether the region is even extruded). // After that information is determined, function can test for QuadToTri neighbor conflicts. - - + + // first determine if this is toroidal quadtotri is_toroidal_quadtri = IsInToroidalQuadToTri(face); - + if( is_toroidal_quadtri ) (*detectQuadToTriTop) = true; else{ @@ -289,9 +289,9 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop) if( region->meshAttributes.extrude->mesh.QuadToTri ) (*detectQuadToTriTop) = true; } - + } - + // MAIN test of whether this is even a quadToTri extrusion lateral // the only return 0 path that is NOT an error if( !(*detectQuadToTriTop) ) @@ -346,7 +346,7 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop) } // end of else that executes if NOT toroidal extrusion - + // this is technically redundant...but if changes are made, it's good to keep this here at the end for safety if( !(*detectQuadToTriTop) ) return 0; @@ -357,7 +357,7 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop) { return 2;} // for toroidal extrusion else return 3; - + } @@ -474,13 +474,13 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*, "extrude information for top face %d.", to->tag() ); return 0; } - + // is this a quadtri extrusion with added vertices? bool is_addverts = false; if( ep && (ep->mesh.QuadToTri == QUADTRI_ADDVERTS_1 || ep->mesh.QuadToTri == QUADTRI_ADDVERTS_1_RECOMB) ) is_addverts = true; - // execute this section if + // execute this section if // IF this is a 'no new vertices' quadToTri, mesh the surfaces according to this modified // least point value method: if a 3 boundary point quad, draw diagonals from middle corner toward // interior. If a a 2- or 1- point boundary quad, draw toward lowest pointer number NOT on boundary. diff --git a/Numeric/BergotBasis.h b/Numeric/BergotBasis.h index 2de1375a82d38756a92b492f0a369f723f3a6a68..e774038c87e850a810d3b852f739e50f04bf8e70 100644 --- a/Numeric/BergotBasis.h +++ b/Numeric/BergotBasis.h @@ -12,9 +12,10 @@ #include "legendrePolynomials.h" -// Basis functios for pyramidal elements -// cf. M. Bergot, G. Cohen, M. Durufle, HIGHER-ORDER FINITE ELEMENTS FOR HYBRID MESHES USING NEW -// NODAL PYRAMIDAL ELEMENTS, J. Sci. Comput. 42, 3 (2010) 345-381", DOI: 10.1007/s10915-009-9334-9 +// Basis functios for pyramidal elements: cf. M. Bergot, G. Cohen, M. Durufle, +// HIGHER-ORDER FINITE ELEMENTS FOR HYBRID MESHES USING NEW NODAL PYRAMIDAL +// ELEMENTS, J. Sci. Comput. 42, 3 (2010) 345-381", DOI: +// 10.1007/s10915-009-9334-9 class BergotBasis { public: diff --git a/Numeric/HilbertCurve.cpp b/Numeric/HilbertCurve.cpp index a8f11067d6060d1c459065fa5e2f0e1f4ba7d7ae..4987c5ce3386970eb78bc4ac819c35d15b0abcd9 100644 --- a/Numeric/HilbertCurve.cpp +++ b/Numeric/HilbertCurve.cpp @@ -1,11 +1,15 @@ +// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to the public mailing list <gmsh@geuz.org>. + #include "SBoundingBox3d.h" #include "MVertex.h" - struct HilbertSort { // The code for generating table transgc -// from: http://graphics.stanford.edu/~seander/bithacks.html. +// from: http://graphics.stanford.edu/~seander/bithacks.html. int transgc[8][3][8]; int tsb1mod3[8]; int maxDepth; @@ -14,21 +18,22 @@ struct HilbertSort void ComputeGrayCode(int n); int Split(MVertex** vertices, int arraysize,int GrayCode0,int GrayCode1, - double BoundingBoxXmin, double BoundingBoxXmax, - double BoundingBoxYmin, double BoundingBoxYmax, + double BoundingBoxXmin, double BoundingBoxXmax, + double BoundingBoxYmin, double BoundingBoxYmax, double BoundingBoxZmin, double BoundingBoxZmax); - void Sort(MVertex** vertices, int arraysize, int e, int d, - double BoundingBoxXmin, double BoundingBoxXmax, double BoundingBoxYmin, double BoundingBoxYmax, + void Sort(MVertex** vertices, int arraysize, int e, int d, + double BoundingBoxXmin, double BoundingBoxXmax, + double BoundingBoxYmin, double BoundingBoxYmax, double BoundingBoxZmin, double BoundingBoxZmax, int depth); HilbertSort (int m = 0, int l=1) : maxDepth(m),Limit(l) { ComputeGrayCode(3); } - void MultiscaleSortHilbert(MVertex** vertices, int arraysize, + void MultiscaleSortHilbert(MVertex** vertices, int arraysize, int threshold, double ratio, int *depth) { int middle; - + middle = 0; if (arraysize >= threshold) { (*depth)++; @@ -40,12 +45,11 @@ struct HilbertSort bbox.min().y(),bbox.max().y(), bbox.min().z(),bbox.max().z(),0); } - void Apply (std::vector<MVertex*> &v) { for (size_t i=0;i<v.size();i++){ MVertex *pv = v[i]; - bbox += SPoint3(pv->x(),pv->y(),pv->z()); + bbox += SPoint3(pv->x(),pv->y(),pv->z()); } bbox *= 1.01; MVertex**pv = &v[0]; @@ -54,7 +58,6 @@ struct HilbertSort } }; - void HilbertSort::ComputeGrayCode(int n) { int gc[8], N, mask, travel_bit; @@ -74,7 +77,7 @@ void HilbertSort::ComputeGrayCode(int n) for (d = 0; d < n; d++) { // Calculate the end point (f). f = e ^ (1 << d); // Toggle the d-th bit of 'e'. - // travel_bit = 2**p, the bit we want to travel. + // travel_bit = 2**p, the bit we want to travel. travel_bit = e ^ f; for (i = 0; i < N; i++) { // // Rotate gc[i] left by (p + 1) % n bits. @@ -103,7 +106,8 @@ void HilbertSort::ComputeGrayCode(int n) int HilbertSort::Split(MVertex** vertices, int arraysize,int GrayCode0,int GrayCode1, - double BoundingBoxXmin, double BoundingBoxXmax, double BoundingBoxYmin, double BoundingBoxYmax, + double BoundingBoxXmin, double BoundingBoxXmax, + double BoundingBoxYmin, double BoundingBoxYmax, double BoundingBoxZmin, double BoundingBoxZmax) { MVertex* swapvert; @@ -111,10 +115,9 @@ int HilbertSort::Split(MVertex** vertices, double split; int i, j; - - // Find the current splitting axis. 'axis' is a value 0, or 1, or 2, which + // Find the current splitting axis. 'axis' is a value 0, or 1, or 2, which // correspoding to x-, or y- or z-axis. - axis = (GrayCode0 ^ GrayCode1) >> 1; + axis = (GrayCode0 ^ GrayCode1) >> 1; // Calulate the split position along the axis. if (axis == 0) { @@ -138,7 +141,7 @@ int HilbertSort::Split(MVertex** vertices, // Partition the vertices into left- and right-arrays. if (d > 0) { do { - for (; i < arraysize; i++) { + for (; i < arraysize; i++) { if (vertices[i]->point()[axis] >= split) break; } for (; j >= 0; j--) { @@ -154,7 +157,7 @@ int HilbertSort::Split(MVertex** vertices, } while (true); } else { do { - for (; i < arraysize; i++) { + for (; i < arraysize; i++) { if (vertices[i]->point()[axis] <= split) break; } for (; j >= 0; j--) { @@ -175,8 +178,9 @@ int HilbertSort::Split(MVertex** vertices, // The sorting code is inspired by Tetgen 1.5 -void HilbertSort::Sort(MVertex** vertices, int arraysize, int e, int d, - double BoundingBoxXmin, double BoundingBoxXmax, double BoundingBoxYmin, double BoundingBoxYmax, +void HilbertSort::Sort(MVertex** vertices, int arraysize, int e, int d, + double BoundingBoxXmin, double BoundingBoxXmax, + double BoundingBoxYmin, double BoundingBoxYmax, double BoundingBoxZmin, double BoundingBoxZmax, int depth) { double x1, x2, y1, y2, z1, z2; @@ -186,24 +190,31 @@ void HilbertSort::Sort(MVertex** vertices, int arraysize, int e, int d, p[0] = 0; p[8] = arraysize; - p[4] = Split(vertices, p[8], transgc[e][d][3], transgc[e][d][4], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); - p[2] = Split(vertices, p[4], transgc[e][d][1], transgc[e][d][2], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); - p[1] = Split(vertices, p[2], transgc[e][d][0], transgc[e][d][1], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); - p[3] = Split(&(vertices[p[2]]), p[4] - p[2], - transgc[e][d][2], transgc[e][d][3], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[2]; - p[6] = Split(&(vertices[p[4]]), p[8] - p[4], - transgc[e][d][5], transgc[e][d][6], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[4]; - p[5] = Split(&(vertices[p[4]]), p[6] - p[4], - transgc[e][d][4], transgc[e][d][5], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[4]; - p[7] = Split(&(vertices[p[6]]), p[8] - p[6], - transgc[e][d][6], transgc[e][d][7], - BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[6]; + p[4] = Split(vertices, p[8], transgc[e][d][3], transgc[e][d][4], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); + p[2] = Split(vertices, p[4], transgc[e][d][1], transgc[e][d][2], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); + p[1] = Split(vertices, p[2], transgc[e][d][0], transgc[e][d][1], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax); + p[3] = Split(&(vertices[p[2]]), p[4] - p[2], + transgc[e][d][2], transgc[e][d][3], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[2]; + p[6] = Split(&(vertices[p[4]]), p[8] - p[4], + transgc[e][d][5], transgc[e][d][6], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[4]; + p[5] = Split(&(vertices[p[4]]), p[6] - p[4], + transgc[e][d][4], transgc[e][d][5], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[4]; + p[7] = Split(&(vertices[p[6]]), p[8] - p[6], + transgc[e][d][6], transgc[e][d][7], + BoundingBoxXmin, BoundingBoxXmax, BoundingBoxYmin, + BoundingBoxYmax, BoundingBoxZmin, BoundingBoxZmax) + p[6]; if (maxDepth > 0) { if ((depth + 1) == maxDepth) { @@ -217,8 +228,8 @@ void HilbertSort::Sort(MVertex** vertices, int arraysize, int e, int d, if (w == 0) { e_w = 0; } else { - k = 2 * ((w - 1) / 2); - e_w = k ^ (k >> 1); + k = 2 * ((w - 1) / 2); + e_w = k ^ (k >> 1); } k = e_w; e_w = ((k << (d+1)) & mask) | ((k >> (n-d-1)) & mask); @@ -250,15 +261,14 @@ void HilbertSort::Sort(MVertex** vertices, int arraysize, int e, int d, z1 = BoundingBoxZmin; z2 = 0.5 * (BoundingBoxZmin + BoundingBoxZmax); } - Sort(&(vertices[p[w]]), p[w+1] - p[w], ei, di, + Sort(&(vertices[p[w]]), p[w+1] - p[w], ei, di, x1, x2, y1, y2, z1, z2, depth+1); - } - } + } + } } - - -void SortHilbert (std::vector<MVertex*>& v){ +void SortHilbert (std::vector<MVertex*>& v) +{ HilbertSort h; h.Apply(v); } diff --git a/Numeric/HilbertCurve.h b/Numeric/HilbertCurve.h index b413f587abcebb7b6a3995bf295b2b1245f8123d..292fc577e147b24bd53b116469e8eb196ed197e4 100644 --- a/Numeric/HilbertCurve.h +++ b/Numeric/HilbertCurve.h @@ -1,4 +1,11 @@ +// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to the public mailing list <gmsh@geuz.org>. + #ifndef _HILBERT_CURVE_ #define _HILBERT_CURVE_ -void SortHilbert (std::vector<MVertex*>&); + +void SortHilbert(std::vector<MVertex*>&); + #endif diff --git a/Numeric/decasteljau.cpp b/Numeric/decasteljau.cpp index d56c866445198dbbc50131390d61bd268963da56..edcf0aaf4d7aae07ac0eaa2d2f17b3d2d66b9401 100644 --- a/Numeric/decasteljau.cpp +++ b/Numeric/decasteljau.cpp @@ -1,3 +1,10 @@ +// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to the public mailing list <gmsh@geuz.org>. +// +// Contributed by J. Lambrechts + #include "decasteljau.h" #include "SPoint3.h" #include "SVector3.h" @@ -8,7 +15,8 @@ typedef struct { int next; } sortedPoint; -static int sortedPointInsert(const SPoint3 &p, const double t, std::vector<sortedPoint> &pts, int pos) +static int sortedPointInsert(const SPoint3 &p, const double t, + std::vector<sortedPoint> &pts, int pos) { sortedPoint pnt = {p, t, pts[pos].next}; pts.push_back(pnt); @@ -17,7 +25,8 @@ static int sortedPointInsert(const SPoint3 &p, const double t, std::vector<sorte return newp; } -static void sortedPointToVector(const std::vector<sortedPoint> &spts, std::vector<SPoint3> &pts, std::vector<double> &ts) +static void sortedPointToVector(const std::vector<sortedPoint> &spts, + std::vector<SPoint3> &pts, std::vector<double> &ts) { pts.clear(); pts.reserve(spts.size()); @@ -40,7 +49,9 @@ double sqDistPointSegment(const SPoint3 &p, const SPoint3 &s0, const SPoint3 &s1 return (dt2 + dn2) / d.normSq(); } -static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, double t0, double t2) +static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, + const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, + double t0, double t2) { if(sqDistPointSegment(p1, p0, p2) < tol * tol) return; @@ -53,7 +64,8 @@ static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, decasteljau(tol, discrete, newpos, p012, p12, p2, t012, t2); } -void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, std::vector<SPoint3> &pts, std::vector<double> &ts) +void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, + std::vector<SPoint3> &pts, std::vector<double> &ts) { std::vector<sortedPoint> discrete; sortedPoint pnt1 = {p0, 0., 1}; @@ -64,7 +76,9 @@ void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 sortedPointToVector(discrete, pts, ts); } -static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, double t0, double t3) +static void decasteljau(double tol, std::vector<sortedPoint> &discrete, + int pos, const SPoint3 &p0, const SPoint3 &p1, + const SPoint3 &p2, const SPoint3 &p3, double t0, double t3) { if (std::max(sqDistPointSegment(p1, p0, p3), sqDistPointSegment(p2, p0, p3)) < tol * tol) return; @@ -80,7 +94,8 @@ static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, decasteljau(tol, discrete, newpos, p0123, p123, p23, p3, t0123, t3); } -void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, std::vector<SPoint3> &pts, std::vector<double> &ts) +void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, + const SPoint3 &p3, std::vector<SPoint3> &pts, std::vector<double> &ts) { std::vector<sortedPoint> discrete; sortedPoint pnt1 = {p0, 0., 1}; @@ -91,7 +106,8 @@ void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 sortedPointToVector(discrete, pts, ts); } -static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, const std::vector<SPoint3> &pts, double t0, double te) +static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, + const std::vector<SPoint3> &pts, double t0, double te) { int order = pts.size() - 1; double dmax2 = 0; @@ -112,7 +128,8 @@ static void decasteljau(double tol, std::vector<sortedPoint> &discrete, int pos, decasteljau(tol, discrete, newpos, sub1, tmid, te); } -void decasteljau(double tol, const std::vector<SPoint3> &controlPoints, std::vector<SPoint3> &pts, std::vector<double> &ts) +void decasteljau(double tol, const std::vector<SPoint3> &controlPoints, + std::vector<SPoint3> &pts, std::vector<double> &ts) { std::vector<sortedPoint> discrete; sortedPoint pnt1 = {controlPoints[0], 0., 1}; diff --git a/Numeric/decasteljau.h b/Numeric/decasteljau.h index 29afad4932a89450145a8fa34d2bb556a9784443..b01359248d6f1e6d3eebf2c3ed99599c39e40574 100644 --- a/Numeric/decasteljau.h +++ b/Numeric/decasteljau.h @@ -1,8 +1,22 @@ +// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to the public mailing list <gmsh@geuz.org>. +// +// Contributed by J. Lambrechts + #ifndef _DECASTELJAU_H_ #define _DECASTELJAU_H_ + #include <vector> class SPoint3; -void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, std::vector<SPoint3> &pts, std::vector<double> &ts); -void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, std::vector<SPoint3> &pts, std::vector<double> &ts); -void decasteljau(double tol, const std::vector<SPoint3> &controlPoints, std::vector<SPoint3> &pts, std::vector<double> &ts); +void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, + const SPoint3 &p2, std::vector<SPoint3> &pts, + std::vector<double> &ts); +void decasteljau(double tol, const SPoint3 &p0, const SPoint3 &p1, + const SPoint3 &p2, const SPoint3 &p3, std::vector<SPoint3> &pts, + std::vector<double> &ts); +void decasteljau(double tol, const std::vector<SPoint3> &controlPoints, + std::vector<SPoint3> &pts, std::vector<double> &ts); + #endif diff --git a/Numeric/discreteFrechetDistance.cpp b/Numeric/discreteFrechetDistance.cpp index 10281d41bfa691c9fb3e49eeb9b00e0d953fd1da..94f4cadf05eb3789a398552d49a582cec76eef21 100644 --- a/Numeric/discreteFrechetDistance.cpp +++ b/Numeric/discreteFrechetDistance.cpp @@ -1,18 +1,23 @@ +// Gmsh - Copyright (C) 1997-2014 C. Geuzaine, J.-F. Remacle +// +// See the LICENSE.txt file for license information. Please report all +// bugs and problems to the public mailing list <gmsh@geuz.org>. + #include "discreteFrechetDistance.h" #include "fullMatrix.h" static double distance (const SPoint3 &p1, const SPoint3 &p2){ return p1.distance(p2); -} +} static double c(int i, int j, fullMatrix<double> &CA, - const std::vector<SPoint3> &P, - const std::vector<SPoint3> &Q) + const std::vector<SPoint3> &P, + const std::vector<SPoint3> &Q) { double CAij; if (CA(i,j)>-1){ - CAij = CA(i,j); + CAij = CA(i,j); } else if (i==0 && j==0){ CA(i,j) = distance(P[0],Q[0]); // update the CA permanent @@ -33,11 +38,12 @@ static double c(int i, int j, } else{ CA(i,j) = 1.e22; + CAij = CA(i,j); } return CAij; } -double discreteFrechetDistance (const std::vector<SPoint3> &P, +double discreteFrechetDistance (const std::vector<SPoint3> &P, const std::vector<SPoint3> &Q){ const int sP = P.size(); const int sQ = Q.size(); diff --git a/Plugin/Lambda2.h b/Plugin/Lambda2.h index 30dbc459843c175f7bbd72e282fece88fbf00595..a910455a6be140ed6bce9c7615fe6422baa2d653 100644 --- a/Plugin/Lambda2.h +++ b/Plugin/Lambda2.h @@ -4,7 +4,7 @@ // bugs and problems to the public mailing list <gmsh@geuz.org>. #ifndef _LAMBDA2_H_ -#define _LAMBDA2_H +#define _LAMBDA2_H_ #include "Plugin.h" @@ -25,7 +25,7 @@ class GMSH_Lambda2Plugin : public GMSH_PostPlugin std::string getHelp() const; std::string getAuthor() const { return "E. Marchandise"; } int getNbOptions() const; - StringXNumber* getOption(int iopt); + StringXNumber* getOption(int iopt); PView *execute(PView *); }; diff --git a/Plugin/Particles.h b/Plugin/Particles.h index 4f79d08f32853c9de4dfef8aa94e1249b39b0a63..9b38532ced22c8bc1133d6743c84d21fbe58ff6a 100644 --- a/Plugin/Particles.h +++ b/Plugin/Particles.h @@ -4,7 +4,7 @@ // bugs and problems to the public mailing list <gmsh@geuz.org>. #ifndef _PARTICLES_H_ -#define _PARTICLES_H +#define _PARTICLES_H_ #include "Plugin.h" @@ -26,7 +26,7 @@ class GMSH_ParticlesPlugin : public GMSH_PostPlugin } std::string getHelp() const; int getNbOptions() const; - StringXNumber *getOption(int iopt); + StringXNumber *getOption(int iopt); PView *execute(PView *); static int getNbU(); diff --git a/Plugin/StreamLines.h b/Plugin/StreamLines.h index 078ae575e53387d9200b804ff970181956846735..d0c00124d5bbb1fc251306ea1b893db006f057a7 100644 --- a/Plugin/StreamLines.h +++ b/Plugin/StreamLines.h @@ -4,7 +4,7 @@ // bugs and problems to the public mailing list <gmsh@geuz.org>. #ifndef _STREAM_LINES_H_ -#define _STREAM_LINES_H +#define _STREAM_LINES_H_ #include "Plugin.h" @@ -26,7 +26,7 @@ class GMSH_StreamLinesPlugin : public GMSH_PostPlugin } std::string getHelp() const; int getNbOptions() const; - StringXNumber *getOption(int iopt); + StringXNumber *getOption(int iopt); PView *execute(PView *); static int getNbU();