diff --git a/Geo/closestPoint.cpp b/Geo/closestPoint.cpp index 2b3816d7f320cbfc00ca683c204121f8a77561a5..373e205b053320bfb0a20e59b256f617e46a3653 100644 --- a/Geo/closestPoint.cpp +++ b/Geo/closestPoint.cpp @@ -1,3 +1,8 @@ +// Gmsh - Copyright (C) 1997-2015 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 "closestPoint.h" #include "GEntity.h" #include "GEdge.h" diff --git a/Geo/closestPoint.h b/Geo/closestPoint.h index b80b6f985065f07337b086e90f6587a88e0e086c..fce9fb612cd1f0b76b13b2ea38814ee5710699f0 100644 --- a/Geo/closestPoint.h +++ b/Geo/closestPoint.h @@ -1,10 +1,19 @@ +// Gmsh - Copyright (C) 1997-2015 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 _CLOSEST_POINT_H_ #define _CLOSEST_POINT_H_ + #include "GmshConfig.h" + #if defined(HAVE_ANN) #include "ANN/ANN.h" #endif + #include "SPoint3.h" + class GEntity; class closestPointFinder { diff --git a/Geo/gmshEdgeDiscretize.cpp b/Geo/gmshEdgeDiscretize.cpp index b85e429a10471064cb35d5435efca497d2fd674b..f6d1b10398d586304ec43759cf5ed9da112a0c6f 100644 --- a/Geo/gmshEdgeDiscretize.cpp +++ b/Geo/gmshEdgeDiscretize.cpp @@ -1,3 +1,8 @@ +// Gmsh - Copyright (C) 1997-2015 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 <cstdio> #include <cmath> #include <vector> @@ -7,18 +12,19 @@ #include "gmshEdge.h" #include "Geo.h" - class discreteList { std::vector<std::pair<SPoint3, double> > _pts; std::vector<int> _next; - public: - int insertPoint(int pos, const SPoint3 &pt, double t) { +public: + int insertPoint(int pos, const SPoint3 &pt, double t) + { _pts.push_back(std::make_pair(pt, t)); _next.push_back(_next[pos + 1]); _next[pos + 1] = _pts.size() - 1; return _pts.size() - 1; } - void sort(std::vector<SPoint3> &spts, std::vector<double> &ts) { + void sort(std::vector<SPoint3> &spts, std::vector<double> &ts) + { spts.clear(); spts.reserve(_pts.size()); ts.clear(); @@ -28,12 +34,15 @@ class discreteList { ts.push_back(_pts[p].second); } } - discreteList() { + discreteList() + { _next.push_back(-1); } }; -static void decasteljau(double tol, discreteList &discrete, int pos, const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, double t0, double t3) +static void decasteljau(double tol, discreteList &discrete, int pos, + const SPoint3 &p0, const SPoint3 &p1, const SPoint3 &p2, + const SPoint3 &p3, double t0, double t3) { SVector3 d30 = p3 - p0; SVector3 d13 = p1 - p3; @@ -60,7 +69,9 @@ static void decasteljau(double tol, discreteList &discrete, int pos, const SPoin decasteljau(tol, discrete, newpos, p0123, p123, p23, p3, t0123, t3); } -static int discretizeBezier(double tol, discreteList &discrete, int pos, const SPoint3 pt[4], double t0, double t3, bool insertFirstPoint) +static int discretizeBezier(double tol, discreteList &discrete, int pos, + const SPoint3 pt[4], double t0, double t3, + bool insertFirstPoint) { if (insertFirstPoint) pos = discrete.insertPoint(pos, pt[0], t0); @@ -69,7 +80,9 @@ static int discretizeBezier(double tol, discreteList &discrete, int pos, const S return newp; } -static int discretizeBSpline(double tol, discreteList &discrete, int pos, const SPoint3 pt[4], double t0, double t3, bool insertFirstPoint) +static int discretizeBSpline(double tol, discreteList &discrete, int pos, + const SPoint3 pt[4], double t0, double t3, + bool insertFirstPoint) { SPoint3 bpt[4] = { SPoint3((pt[0] + 4 * pt[1] + pt[2]) * (1./6.)), @@ -80,7 +93,9 @@ static int discretizeBSpline(double tol, discreteList &discrete, int pos, const return discretizeBezier(tol, discrete, pos, bpt, t0, t3, insertFirstPoint); } -static int discretizeCatmullRom(double tol, discreteList &discrete, int pos, const SPoint3 pt[4], double t0, double t3, bool insertFirstPoint) +static int discretizeCatmullRom(double tol, discreteList &discrete, int pos, + const SPoint3 pt[4], double t0, double t3, + bool insertFirstPoint) { SPoint3 bpt[4] = { pt[1], @@ -98,99 +113,101 @@ static inline SPoint3 curveGetPoint(Curve *c, int i) return SPoint3(v->Pos.X, v->Pos.Y, v->Pos.Z); } -static void discretizeCurve(Curve *c, double tol, std::vector<SPoint3> &pts, std::vector<double> &ts) +static void discretizeCurve(Curve *c, double tol, std::vector<SPoint3> &pts, + std::vector<double> &ts) { discreteList discrete; switch(c->Typ) { - case MSH_SEGM_LINE : - { - int NPt = List_Nbr(c->Control_Points); - pts.resize(NPt); - ts.resize(NPt); - for (int i = 0; i < NPt; ++i) { - pts[i]= curveGetPoint(c, i); - ts[i] = i / (double) (NPt - 1); - } - return; + case MSH_SEGM_LINE : + { + int NPt = List_Nbr(c->Control_Points); + pts.resize(NPt); + ts.resize(NPt); + for (int i = 0; i < NPt; ++i) { + pts[i]= curveGetPoint(c, i); + ts[i] = i / (double) (NPt - 1); } - case MSH_SEGM_BEZIER : - { - int back = -1; - int NbCurves = (List_Nbr(c->Control_Points) - 1) / 3; - for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { - double t1 = (iCurve) / (double)(NbCurves); - double t2 = (iCurve+1) / (double)(NbCurves); - SPoint3 pt[4]; - for(int i = 0; i < 4; i++) { - pt[i] = curveGetPoint(c, iCurve * 3 + i); - } - back = discretizeBezier(tol, discrete, back, pt, t1, t2, iCurve == 0); + return; + } + case MSH_SEGM_BEZIER : + { + int back = -1; + int NbCurves = (List_Nbr(c->Control_Points) - 1) / 3; + for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { + double t1 = (iCurve) / (double)(NbCurves); + double t2 = (iCurve+1) / (double)(NbCurves); + SPoint3 pt[4]; + for(int i = 0; i < 4; i++) { + pt[i] = curveGetPoint(c, iCurve * 3 + i); } - break; + back = discretizeBezier(tol, discrete, back, pt, t1, t2, iCurve == 0); } - case MSH_SEGM_BSPLN: - { - int back = -1; - bool periodic = (c->end == c->beg); - int NbControlPoints = List_Nbr(c->Control_Points); - int NbCurves = NbControlPoints + (periodic ? -1 : 1); - SPoint3 pt[4]; - for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { - double t1 = (iCurve) / (double)(NbCurves); - double t2 = (iCurve+1) / (double)(NbCurves); - for(int i = 0; i < 4; i++) { - int k; - if (periodic) { - k = (iCurve - 1 + i) % (NbControlPoints - 1); - if (k < 0) - k += NbControlPoints - 1; - } - else { - k = std::max(0, std::min(iCurve - 2 + i, NbControlPoints -1)); - } - pt[i] = curveGetPoint(c, k); + break; + } + case MSH_SEGM_BSPLN: + { + int back = -1; + bool periodic = (c->end == c->beg); + int NbControlPoints = List_Nbr(c->Control_Points); + int NbCurves = NbControlPoints + (periodic ? -1 : 1); + SPoint3 pt[4]; + for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { + double t1 = (iCurve) / (double)(NbCurves); + double t2 = (iCurve+1) / (double)(NbCurves); + for(int i = 0; i < 4; i++) { + int k; + if (periodic) { + k = (iCurve - 1 + i) % (NbControlPoints - 1); + if (k < 0) + k += NbControlPoints - 1; } - back = discretizeBSpline(tol, discrete, back, pt, t1, t2, iCurve == 0); + else { + k = std::max(0, std::min(iCurve - 2 + i, NbControlPoints -1)); + } + pt[i] = curveGetPoint(c, k); } - break; + back = discretizeBSpline(tol, discrete, back, pt, t1, t2, iCurve == 0); } - case MSH_SEGM_SPLN: - { - int NbCurves = List_Nbr(c->Control_Points) - 1; - SPoint3 pt[4]; - int back = -1; - for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { - double t1 = (iCurve) / (double)(NbCurves); - double t2 = (iCurve+1) / (double)(NbCurves); - pt[1] = curveGetPoint(c, iCurve); - pt[2] = curveGetPoint(c, iCurve + 1); - if(iCurve == 0) { - if(c->beg == c->end) - pt[0] = curveGetPoint(c, NbCurves - 1); - else - pt[0] = SPoint3(pt[1] * 2 - pt[2]); - } + break; + } + case MSH_SEGM_SPLN: + { + int NbCurves = List_Nbr(c->Control_Points) - 1; + SPoint3 pt[4]; + int back = -1; + for (int iCurve = 0; iCurve < NbCurves; ++iCurve) { + double t1 = (iCurve) / (double)(NbCurves); + double t2 = (iCurve+1) / (double)(NbCurves); + pt[1] = curveGetPoint(c, iCurve); + pt[2] = curveGetPoint(c, iCurve + 1); + if(iCurve == 0) { + if(c->beg == c->end) + pt[0] = curveGetPoint(c, NbCurves - 1); else - pt[0] = curveGetPoint(c, iCurve - 1); - if(iCurve == NbCurves - 1) { - if(c->beg == c->end) - pt[3] = curveGetPoint(c, 1); - else - pt[3] = SPoint3(2 * pt[2] - pt[1]); - } + pt[0] = SPoint3(pt[1] * 2 - pt[2]); + } + else + pt[0] = curveGetPoint(c, iCurve - 1); + if(iCurve == NbCurves - 1) { + if(c->beg == c->end) + pt[3] = curveGetPoint(c, 1); else - pt[3] = curveGetPoint(c, iCurve + 2); - back = discretizeCatmullRom(tol, discrete, back, pt, t1, t2, iCurve == 0); + pt[3] = SPoint3(2 * pt[2] - pt[1]); } - break; + else + pt[3] = curveGetPoint(c, iCurve + 2); + back = discretizeCatmullRom(tol, discrete, back, pt, t1, t2, iCurve == 0); } - default : - Msg::Fatal("not implemented"); + break; + } + default : + Msg::Fatal("not implemented"); } discrete.sort(pts, ts); } -void gmshEdge::discretize(double tol, std::vector<SPoint3> &dpts, std::vector<double> &ts) +void gmshEdge::discretize(double tol, std::vector<SPoint3> + &dpts, std::vector<double> &ts) { discretizeCurve(c, tol, dpts, ts); } diff --git a/Mesh/BGMBase.cpp b/Mesh/BGMBase.cpp index c4bc70d0e07c6b30d7613776e35bf3b547c334ac..0f0f6fe95d0f559bc7c96ef83f906b394e782eb1 100644 --- a/Mesh/BGMBase.cpp +++ b/Mesh/BGMBase.cpp @@ -1,14 +1,19 @@ +// Gmsh - Copyright (C) 1997-2015 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 "BGMBase.h" #include <iostream> - #include "OS.h" #include "GPoint.h" #include "GFace.h" #include "GmshDefines.h" #include "MElementOctree.h" -void BGMBase::export_scalar(const std::string &filename, const DoubleStorageType &_whatToPrint) const +void BGMBase::export_scalar(const std::string &filename, + const DoubleStorageType &_whatToPrint) const { FILE *f = Fopen (filename.c_str(),"w"); fprintf(f,"View \"Background Mesh\"{\n"); @@ -56,7 +61,8 @@ void BGMBase::export_scalar(const std::string &filename, const DoubleStorageType fclose(f); } -void BGMBase::export_vector(const std::string &filename, const VectorStorageType &_whatToPrint) const +void BGMBase::export_vector(const std::string &filename, + const VectorStorageType &_whatToPrint) const { FILE *f = Fopen (filename.c_str(),"w"); fprintf(f,"View \"Background Mesh\"{\n"); @@ -108,7 +114,8 @@ void BGMBase::export_vector(const std::string &filename, const VectorStorageType } -void BGMBase::export_tensor_as_vectors(const std::string &filename, const TensorStorageType &_whatToPrint)const +void BGMBase::export_tensor_as_vectors(const std::string &filename, + const TensorStorageType &_whatToPrint) const { FILE *f = Fopen (filename.c_str(),"w"); fprintf(f,"View \"Background Mesh\"{\n"); @@ -120,20 +127,22 @@ void BGMBase::export_tensor_as_vectors(const std::string &filename, const Tensor v = it->first; GPoint p = get_GPoint_from_MVertex(v); for (int i=0;i<3;i++){ - fprintf(f,"%s(%g,%g,%g){%g,%g,%g};\n",s,p.x(),p.y(),p.z(),(it->second)(0,i),(it->second)(1,i),(it->second)(2,i)); - fprintf(f,"%s(%g,%g,%g){%g,%g,%g};\n",s,p.x(),p.y(),p.z(),-(it->second)(0,i),-(it->second)(1,i),-(it->second)(2,i)); + fprintf(f,"%s(%g,%g,%g){%g,%g,%g};\n",s,p.x(),p.y(),p.z(), + (it->second)(0,i),(it->second)(1,i),(it->second)(2,i)); + fprintf(f,"%s(%g,%g,%g){%g,%g,%g};\n",s,p.x(),p.y(),p.z(), + -(it->second)(0,i),-(it->second)(1,i),-(it->second)(2,i)); } } fprintf(f,"};\n"); fclose(f); } - BGMBase::BGMBase(int dim,GEntity *_gf):octree(NULL),gf(_gf), DIM(dim), order(1) { } -BGMBase::~BGMBase(){ +BGMBase::~BGMBase() +{ } bool BGMBase::inDomain (double u, double v, double w) @@ -146,7 +155,8 @@ const MElement* BGMBase::findElement(double u, double v, double w, bool strict) return (getOctree()->find(u, v, w, DIM, strict)); } -std::vector<double> BGMBase::get_field_value(double u, double v, double w, const VectorStorageType &data) +std::vector<double> BGMBase::get_field_value(double u, double v, double w, + const VectorStorageType &data) { MElement *e = const_cast<MElement*>(findElement(u, v, w )); if (!e) return std::vector<double>(3,-1000.); @@ -157,12 +167,14 @@ std::vector<double> BGMBase::get_field_value(double u, double v, double w, const for (int j=0;j<3;j++){ std::vector<double> values(e->getNumVertices()); for (int i=0;i<e->getNumVertices();i++) values[i]=val[i][j]; - res[j] = e->interpolate(&values[0], element_uvw[0], element_uvw[1], element_uvw[2], 1, order); + res[j] = e->interpolate(&values[0], element_uvw[0], element_uvw[1], + element_uvw[2], 1, order); } return res; } -double BGMBase::get_field_value(double u, double v, double w, const DoubleStorageType &data) +double BGMBase::get_field_value(double u, double v, double w, + const DoubleStorageType &data) { MElement *e = const_cast<MElement*>(findElement(u, v, w)); if (!e) return -1000.; @@ -171,8 +183,9 @@ double BGMBase::get_field_value(double u, double v, double w, const DoubleStorag std::vector<double> values(e->getNumVertices()); for (int i=0;i<e->getNumVertices();i++) values[i]=val[i]; - - return e->interpolate(&values[0], element_uvw[0], element_uvw[1], element_uvw[2], 1, order); + + return e->interpolate(&values[0], element_uvw[0], element_uvw[1], + element_uvw[2], 1, order); } double BGMBase::size(double u, double v, double w) @@ -185,7 +198,8 @@ double BGMBase::size(const MVertex *v) return get_nodal_value(v,sizeField); } -std::vector<double> BGMBase::get_nodal_value(const MVertex *v,const VectorStorageType &data)const +std::vector<double> BGMBase::get_nodal_value(const MVertex *v, + const VectorStorageType &data) const { VectorStorageType::const_iterator itfind = data.find(const_cast<MVertex*>(v)); if (itfind==data.end()){ @@ -195,7 +209,7 @@ std::vector<double> BGMBase::get_nodal_value(const MVertex *v,const VectorStorag return itfind->second; } -double BGMBase::get_nodal_value(const MVertex *v,const DoubleStorageType &data)const +double BGMBase::get_nodal_value(const MVertex *v,const DoubleStorageType &data) const { DoubleStorageType::const_iterator itfind = data.find(const_cast<MVertex*>(v)); if (itfind==data.end()){ @@ -205,7 +219,8 @@ double BGMBase::get_nodal_value(const MVertex *v,const DoubleStorageType &data)c return itfind->second; } -std::vector<std::vector<double> > BGMBase::get_nodal_values(const MElement *e,const VectorStorageType &data)const +std::vector<std::vector<double> > +BGMBase::get_nodal_values(const MElement *e,const VectorStorageType &data) const { std::vector<std::vector<double> > res(e->getNumVertices()); @@ -217,7 +232,8 @@ std::vector<std::vector<double> > BGMBase::get_nodal_values(const MElement *e,co return res; } -std::vector<double> BGMBase::get_nodal_values(const MElement *e,const DoubleStorageType &data)const +std::vector<double> BGMBase::get_nodal_values(const MElement *e, + const DoubleStorageType &data) const { std::vector<double> res(e->getNumVertices(),0.); @@ -226,7 +242,8 @@ std::vector<double> BGMBase::get_nodal_values(const MElement *e,const DoubleStor return res; } -std::vector<double> BGMBase::get_element_uvw_from_xyz (const MElement *e, double x, double y,double z) const +std::vector<double> BGMBase::get_element_uvw_from_xyz (const MElement *e, double x, + double y, double z) const { double element_uvw[3]; double xyz[3] = {x, y, z}; @@ -255,7 +272,3 @@ GEntity* BGMBase::getBackgroundGEntity() { return gf; } - - - - diff --git a/Mesh/BackgroundMeshTools.h b/Mesh/BackgroundMeshTools.h index 74a80753db1285b7bb9ec670bece9c7fc486e97c..f36d58add4806bcab28d65aa5c95c4bd53b89845 100644 --- a/Mesh/BackgroundMeshTools.h +++ b/Mesh/BackgroundMeshTools.h @@ -1,4 +1,7 @@ - +// Gmsh - Copyright (C) 1997-2015 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 _BACKGROUND_MESH_TOOLS_H_ #define _BACKGROUND_MESH_TOOLS_H_ @@ -10,24 +13,18 @@ class GVertex; class GEdge; class GEntity; - -SMetric3 buildMetricTangentToCurve (SVector3 &t, double l_t, double l_n); -SMetric3 buildMetricTangentToSurface (SVector3 &t1, SVector3 &t2, double l_t1, double l_t2, double l_n); +SMetric3 buildMetricTangentToCurve(SVector3 &t, double l_t, double l_n); +SMetric3 buildMetricTangentToSurface(SVector3 &t1, SVector3 &t2, double l_t1, + double l_t2, double l_n); double BGM_MeshSize(GEntity *ge, double U, double V, double X, double Y, double Z); SMetric3 BGM_MeshMetric(GEntity *ge, double U, double V, double X, double Y, double Z); bool Extend1dMeshIn2dSurfaces(); bool Extend2dMeshIn3dVolumes(); SMetric3 max_edge_curvature_metric(const GVertex *gv); SMetric3 max_edge_curvature_metric(const GEdge *ge, double u, double &l); -SMetric3 metric_based_on_surface_curvature(const GFace *gf, double u, double v, bool surface_isotropic = false,double d_normal = 1.e12,double d_tangent_max = 1.e12); - -// -//static double LC_MVertex_CURV(GEntity *ge, double U, double V); -//SMetric3 LC_MVertex_CURV_ANISO(GEntity *ge, double U, double V); -//static double LC_MVertex_PNTS(GEntity *ge, double U, double V); -//static double max_edge_curvature(const GVertex *gv); -//static double max_surf_curvature(const GEdge *ge, double u); -//static SMetric3 metric_based_on_surface_curvature(const GEdge *ge, double u, bool iso_surf); -//static SMetric3 metric_based_on_surface_curvature(const GVertex *gv, bool iso_surf); +SMetric3 metric_based_on_surface_curvature(const GFace *gf, double u, double v, + bool surface_isotropic = false, + double d_normal = 1.e12, + double d_tangent_max = 1.e12); #endif diff --git a/Mesh/FieldPython.h b/Mesh/FieldPython.h index f6ca53c1b47ed1fb3df6a0e7cd97ca37d17d6a80..67772ec77c73cd870872de15cee39e424ed081b2 100644 --- a/Mesh/FieldPython.h +++ b/Mesh/FieldPython.h @@ -1,8 +1,14 @@ +// Gmsh - Copyright (C) 1997-2015 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 _FIELD_PYTHON_H_ #define _FIELD_PYTHON_H_ #include "Field.h" #include "Python.h" + class FieldPython : public Field { PyObject *_callback; @@ -56,4 +62,5 @@ class FieldPython : public Field } } }; + #endif diff --git a/Mesh/filterElements.h b/Mesh/filterElements.h index f046b37d63c2a2e85b491b22e1d6fa28048bd2f5..8186196b82fd4fb4941c2677862f0ddc90258038 100644 --- a/Mesh/filterElements.h +++ b/Mesh/filterElements.h @@ -1,23 +1,32 @@ +// Gmsh - Copyright (C) 1997-2015 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 _FILTER_OVERLAPPING_ELEMENTS_ #define _FILTER_OVERLAPPING_ELEMENTS_ + #include <map> #include <vector> + class MElement; class MPrism; class MHexahedron; class MTriangle; class MQuadrangle; -void filterOverlappingElements (std::vector<MElement*> &, - std::map<MElement*,std::vector<MElement*> > &_elemColumns, - std::map<MElement*,MElement*> &_toFirst); -void filterOverlappingElements (std::vector<MPrism*> &blPrisms, - std::vector<MHexahedron*>&blHexes, - std::map<MElement*,std::vector<MElement*> > &_elemColumns, - std::map<MElement*,MElement*> &_toFirst); -void filterOverlappingElements (std::vector<MTriangle*> &blTris, - std::vector<MQuadrangle*>&blQuads, - std::map<MElement*,std::vector<MElement*> > &_elemColumns, - std::map<MElement*,MElement*> &_toFirst); + +void filterOverlappingElements(std::vector<MElement*> &, + std::map<MElement*,std::vector<MElement*> > &_elemColumns, + std::map<MElement*,MElement*> &_toFirst); +void filterOverlappingElements(std::vector<MPrism*> &blPrisms, + std::vector<MHexahedron*>&blHexes, + std::map<MElement*,std::vector<MElement*> > &_elemColumns, + std::map<MElement*,MElement*> &_toFirst); +void filterOverlappingElements(std::vector<MTriangle*> &blTris, + std::vector<MQuadrangle*>&blQuads, + std::map<MElement*,std::vector<MElement*> > &_elemColumns, + std::map<MElement*,MElement*> &_toFirst); void filterColumns(std::vector<MElement*> &elem, std::map<MElement*,std::vector<MElement*> > &_elemColumns); + #endif diff --git a/Numeric/approximationError.cpp b/Numeric/approximationError.cpp index a116b1b90d9d0f217ef6028b1a355bdfe678c88a..92a1d29be6a2427265e29ee1a7e2d52dbcd41757 100644 --- a/Numeric/approximationError.cpp +++ b/Numeric/approximationError.cpp @@ -1,5 +1,11 @@ +// Gmsh - Copyright (C) 1997-2015 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 "approximationError.h" #include "MElement.h" + double approximationError (simpleFunction<double> &f, MElement *e) { std::vector<double> VALS(e->getNumVertices()); diff --git a/Numeric/approximationError.h b/Numeric/approximationError.h index 53caed44370384122721bb843bb7e9863319e222..d08db5cd437ac6f8ce8931b1a09cd0375747404d 100644 --- a/Numeric/approximationError.h +++ b/Numeric/approximationError.h @@ -1,10 +1,19 @@ +// Gmsh - Copyright (C) 1997-2015 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 _APPROXIMATION_ERROR_ #define _APPROXIMATION_ERROR_ + #include <map> #include "simpleFunction.h" + class MElement; + // computes E such as // E^2 = \int_e [C_e(f) - f]^2 de // where C_e(f) is clement's interpolation operator of f on e -double approximationError (simpleFunction<double> &f, MElement *e) ; +double approximationError(simpleFunction<double> &f, MElement *e); + #endif diff --git a/Numeric/discreteFrechetDistance.h b/Numeric/discreteFrechetDistance.h index 439b0c9b0ed34daa2377161c4574b46a49689ab6..a4fadcd4c7801f4c40cca99800fd2a2877528d8f 100644 --- a/Numeric/discreteFrechetDistance.h +++ b/Numeric/discreteFrechetDistance.h @@ -1,7 +1,15 @@ +// Gmsh - Copyright (C) 1997-2015 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 _DISCRETE_FRECHET_DISTANCE_ #define _DISCRETE_FRECHET_DISTANCE_ + #include <vector> #include "SPoint3.h" -double discreteFrechetDistance (const std::vector<SPoint3> &P, + +double discreteFrechetDistance (const std::vector<SPoint3> &P, const std::vector<SPoint3> &Q); + #endif diff --git a/Numeric/hausdorffDistance.cpp b/Numeric/hausdorffDistance.cpp index 0c7ba1af3072bf40590bd42fe8d44095edd4c1aa..0797b0d9eb2bb161e5cded3b97eb1e94068d1c43 100644 --- a/Numeric/hausdorffDistance.cpp +++ b/Numeric/hausdorffDistance.cpp @@ -1,8 +1,14 @@ +// Gmsh - Copyright (C) 1997-2015 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>. + /* -compute the hausdorff distance between two polygonal curves -in n*m time where n and m are the nb of points of the -polygonal curves + compute the hausdorff distance between two polygonal curves + in n*m time where n and m are the nb of points of the + polygonal curves */ + #include "SVector3.h" #include "hausdorffDistance.h" @@ -20,7 +26,8 @@ static double intersect (SPoint3 &q, SVector3 &n, // a plane return t; } -static double projection (SPoint3 &p1, SPoint3 &p2, SPoint3 &q, SPoint3 &result){ +static double projection (SPoint3 &p1, SPoint3 &p2, SPoint3 &q, SPoint3 &result) +{ // x = p1 + t (p2 - p1) // (x - q) * (p2 - p1) = 0 // (p1 + t (p2 - p1) - q) (p2 - p1) = 0 @@ -29,18 +36,19 @@ static double projection (SPoint3 &p1, SPoint3 &p2, SPoint3 &q, SPoint3 &result) const double t = dot(q-p1,p21)/dot(p21,p21); result = p1 *(1.-t)+ p2*t; return t; -} +} -static SPoint3 closestPoint (SPoint3 &p1, SPoint3 &p2, SPoint3 &q){ +static SPoint3 closestPoint (SPoint3 &p1, SPoint3 &p2, SPoint3 &q) +{ double result; const double t = projection (p1,p2,q,result); if (t >= 0.0 && t <= 1.0)return result; if (t < 0)return p1; return p2; -} - +} -double closestPoint (const std::vector<SPoint3> &P, const SPoint3 &p, SPoint3 & result){ +double closestPoint (const std::vector<SPoint3> &P, const SPoint3 &p, SPoint3 & result) +{ double closestDistance = 1.e22; for (unsigned int i=1;i<P.size();i++){ SPoint3 q = closestPoint (P[i-1],P[i],p); @@ -48,18 +56,19 @@ double closestPoint (const std::vector<SPoint3> &P, const SPoint3 &p, SPoint3 & if (pq < closestDistance){ closestDistance = pq; result = q; - } + } } return closestDistance; -} +} // we test all points of P plus all points that are the intersections // of angle bissectors of Q with P -double oneSidedHausdorffDistance (const std::vector<SPoint3> &P, - const std::vector<SPoint3> &Q, - SPoint3 &p1, SPoint3 &p2){ +double oneSidedHausdorffDistance (const std::vector<SPoint3> &P, + const std::vector<SPoint3> &Q, + SPoint3 &p1, SPoint3 &p2) +{ const double hausdorffDistance = 0.0; - + // first test the points for (unsigned int i=0;i<P.size();i++){ SPoint3 result; @@ -92,7 +101,7 @@ double oneSidedHausdorffDistance (const std::vector<SPoint3> &P, for (unsigned int i=1;i<P.size();i++){ SPoint3 result; const double t = intersect (b, n, P[i-1],P[i],result); - if (t >=0 && t <=1)intersections.push_back(result); + if (t >=0 && t <=1)intersections.push_back(result); } } @@ -108,8 +117,9 @@ double oneSidedHausdorffDistance (const std::vector<SPoint3> &P, return hausdorffDistance; } -double hausdorffDistance (const std::vector<SPoint3> &P, - const std::vector<SPoint3> &Q){ +double hausdorffDistance (const std::vector<SPoint3> &P, + const std::vector<SPoint3> &Q) +{ return std::max(oneSidedHausdorffDistance (P,Q), - oneSidedHausdorffDistance (Q,P)); + oneSidedHausdorffDistance (Q,P)); } diff --git a/Numeric/miniBasis.cpp b/Numeric/miniBasis.cpp index b82b1081ceec8071f2fd9110f1e9214a58277cca..ff7dd44b23a954d6f0a923845db9a902fe865840 100644 --- a/Numeric/miniBasis.cpp +++ b/Numeric/miniBasis.cpp @@ -1,5 +1,11 @@ +// Gmsh - Copyright (C) 1997-2015 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 "miniBasis.h" #include "BasisFactory.h" + miniBasisTri::miniBasisTri() { type = MSH_TRI_MINI; @@ -47,7 +53,7 @@ miniBasisTri::miniBasisTri() coefficients(0, 0) = 1.; coefficients(0, 1) = -1.; coefficients(0, 2) = -1.; coefficients(1, 1) = 1.; coefficients(2, 2) = 1.; - coefficients(3, 3) = 1.; coefficients(3, 4) = -1.; coefficients(3, 5) = -1.; + coefficients(3, 3) = 1.; coefficients(3, 4) = -1.; coefficients(3, 5) = -1.; } miniBasisTet::miniBasisTet() diff --git a/Numeric/miniBasis.h b/Numeric/miniBasis.h index df2b8df0c30c395978af4ae259304189d5ca19f3..79d8b9373a7623b423a4fdef450b4f71546a1d61 100644 --- a/Numeric/miniBasis.h +++ b/Numeric/miniBasis.h @@ -1,7 +1,15 @@ +// Gmsh - Copyright (C) 1997-2015 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 _MINI_BASIS_H_ #define _MINI_BASIS_H_ + #include "polynomialBasis.h" - // mini is NOT a real nodal basis but in GMSH, only the nodal basis have closure and mini have closure so... +// mini is NOT a real nodal basis but in GMSH, only the nodal basis have closure +// and mini have closure so... + class miniBasisTri : public polynomialBasis { public: miniBasisTri(); @@ -10,4 +18,5 @@ class miniBasisTet : public polynomialBasis { public: miniBasisTet(); }; + #endif diff --git a/Numeric/simpleFunctionPython.h b/Numeric/simpleFunctionPython.h index f3f0549e6c1e09a9dce40a21993d2c66e41d6234..513196f7a253288bf6a3c91f94835e5be10aa983 100644 --- a/Numeric/simpleFunctionPython.h +++ b/Numeric/simpleFunctionPython.h @@ -1,5 +1,11 @@ +// Gmsh - Copyright (C) 1997-2015 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 _SIMPLE_FUNCTION_PYTHON_H_ #define _SIMPLE_FUNCTION_PYTHON_H_ + #include "Python.h" #include "simpleFunction.h" @@ -34,4 +40,5 @@ class simpleFunctionPython : public simpleFunction<double> { return r; } }; + #endif diff --git a/doc/gmsh.html b/doc/gmsh.html index 10233f4dc6af0f644773a7ad10cf1bf6bf853203..f9ea7076423f6afe87a096b80d5cee130bcbaac5 100644 --- a/doc/gmsh.html +++ b/doc/gmsh.html @@ -186,7 +186,8 @@ information. <h2><a name="Screenshots"></a>Screenshots</h2> <a href="gallery/screenshot.png"><img src="gallery/thumbnail.png" -alt="Screenshot thumbnail"></a> +alt="Screenshot thumbnail"></a> <a href="gallery/screenshot2.png"><img +src="gallery/thumbnail2.png" alt="Screenshot thumbnail"></a> <ul> <li>Sample STEP/BREP models: