Commit d2863216 authored by Christophe Geuzaine's avatar Christophe Geuzaine

Merge branch 'perf' into 'master'

Performance improvements on many_holes See merge request !168
parents 6f693e19 0e9d2cd1
Pipeline #2116 passed with stage
in 62 minutes 57 seconds
......@@ -63,7 +63,6 @@ public:
v1 = f;
}
// specify mesh master with transformation, deduce edgeCounterparts
void setMeshMaster(GEdge *master, const std::vector<double> &);
......
......@@ -219,7 +219,11 @@ public:
virtual std::vector<GFace *> faces() const { return std::vector<GFace *>(); }
// edges that bound this entity or that this entity bounds.
virtual std::vector<GEdge *> edges() const { return std::vector<GEdge *>(); }
virtual std::vector<GEdge *> const &edges() const
{
static std::vector<GEdge *> i;
return i;
}
// vertices that bound this entity.
virtual std::vector<GVertex *> vertices() const
......
......@@ -106,7 +106,7 @@ public:
// edges that bound the face
int delEdge(GEdge *edge);
virtual std::vector<GEdge *> edges() const { return l_edges; }
virtual std::vector<GEdge *> const &edges() const { return l_edges; }
void set(const std::vector<GEdge *> &f) { l_edges = f; }
void setOrientations(const std::vector<int> &f) { l_dirs = f; }
void setEdge(GEdge *const f, int const orientation)
......
......@@ -385,16 +385,17 @@ void GRegion::writeGEO(FILE *fp)
}
}
std::vector<GEdge*> GRegion::edges() const
std::vector<GEdge*> const &GRegion::edges() const
{
// TODO C++11 clean this up
std::vector<GEdge*> e;
static std::vector<GEdge*> e;
e.clear();
std::vector<GFace*>::const_iterator it = l_faces.begin();
while(it != l_faces.end()){
std::vector<GEdge*> e2 = (*it)->edges();
std::vector<GEdge*> const &e2 = (*it)->edges();
std::vector<GEdge*>::const_iterator it2 = e2.begin();
while (it2 != e2.end()){
GEdge *edge = *it2;
GEdge *const edge = *it2;
if(std::find(e.begin(), e.end(), edge) == e.end())
e.push_back(edge);
++it2;
......
......@@ -83,7 +83,7 @@ public:
virtual std::vector<GFace *> embeddedFaces() const { return embedded_faces; }
// edges that bound the region
virtual std::vector<GEdge *> edges() const;
virtual std::vector<GEdge *> const &edges() const;
// vertices that bound the region
virtual std::vector<GVertex *> vertices() const;
......
......@@ -50,7 +50,7 @@ public:
virtual std::list<GRegion *> regions() const;
// get the edges that this vertex bounds
virtual std::vector<GEdge *> edges() const { return l_edges; }
virtual std::vector<GEdge *> const &edges() const { return l_edges; }
// faces that bound this entity or that this entity bounds.
virtual std::vector<GFace *> faces() const;
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ struct Coord {
};
class Vertex {
public :
public:
int Num;
int Typ;
double lc, u, w;
......@@ -37,10 +37,16 @@ class Vertex {
// of a surface: pntOnGeometry stores the local coodinates of the
// vertex in the gmshSurface it belongs to.
gmshSurface *geometry;
SPoint2 pntOnGeometry;
SPoint2 pntOnGeometry;
int boundaryLayerIndex;
Vertex(double X=0., double Y=0., double Z=0., double l=1., double W=1.)
: Num(0), lc(l), u(0.), w(W), geometry(0), boundaryLayerIndex(0)
Vertex(double X = 0., double Y = 0., double Z = 0., double l = 1.,
double W = 1.)
: Num(0)
, lc(l)
, u(0.)
, w(W)
, geometry(0)
, boundaryLayerIndex(0)
{
Typ = MSH_POINT;
Pos.X = X;
......@@ -55,7 +61,7 @@ class Vertex {
Pos.Y /= d;
Pos.Z /= d;
}
Vertex operator % (Vertex & autre) // cross product
Vertex operator%(Vertex &autre) // cross product
{
return Vertex(Pos.Y * autre.Pos.Z - Pos.Z * autre.Pos.Y,
-(Pos.X * autre.Pos.Z - Pos.Z * autre.Pos.X),
......@@ -64,14 +70,14 @@ class Vertex {
};
class CircParam {
public:
public:
double t1, t2, f1, f2, incl;
double invmat[3][3];
double n[3];
};
class Curve {
public:
public:
int Num;
int Typ;
bool degenerated;
......@@ -94,19 +100,19 @@ class Curve {
std::list<double> affineTransformation;
bool degenerate() const
{
if (beg == end && Typ == MSH_SEGM_LINE) return true;
if(beg == end && Typ == MSH_SEGM_LINE) return true;
return false;
}
};
class EdgeLoop {
public:
public:
int Num;
List_T *Curves;
};
class Surface {
public:
public:
int Num;
int Typ;
int Method;
......@@ -129,13 +135,13 @@ class Surface {
};
class SurfaceLoop {
public:
public:
int Num;
List_T *Surfaces;
};
class Volume {
public:
public:
int Num;
int Typ;
int Method;
......@@ -149,7 +155,7 @@ class Volume {
};
class PhysicalGroup {
public:
public:
int Num;
int Typ;
List_T *Entities;
......@@ -171,12 +177,21 @@ void FreeCurve(void *a, void *b);
void FreeSurface(void *a, void *b);
void FreeVolume(void *a, void *b);
void Projette(Vertex *v, double mat[3][3]);
inline void Projette(Vertex *v, double mat[3][3])
{
double X = v->Pos.X * mat[0][0] + v->Pos.Y * mat[0][1] + v->Pos.Z * mat[0][2];
double Y = v->Pos.X * mat[1][0] + v->Pos.Y * mat[1][1] + v->Pos.Z * mat[1][2];
double Z = v->Pos.X * mat[2][0] + v->Pos.Y * mat[2][1] + v->Pos.Z * mat[2][2];
v->Pos.X = X;
v->Pos.Y = Y;
v->Pos.Z = Z;
}
Vertex *CreateVertex(int Num, double X, double Y, double Z, double lc, double u);
Vertex *CreateVertex(int Num, double X, double Y, double Z, double lc,
double u);
Vertex *CreateVertex(int Num, double u, double v, gmshSurface *s, double lc);
Curve *CreateCurve(int Num, int Typ, int Order, List_T *Liste,
List_T *Knots, int p1, int p2, double u1, double u2);
Curve *CreateCurve(int Num, int Typ, int Order, List_T *Liste, List_T *Knots,
int p1, int p2, double u1, double u2);
Curve *CreateReversedCurve(Curve *c);
Surface *CreateSurface(int Num, int Typ);
Volume *CreateVolume(int Num, int Typ);
......@@ -195,46 +210,45 @@ SurfaceLoop *FindSurfaceLoop(int inum);
Volume *FindVolume(int inum);
PhysicalGroup *FindPhysicalGroup(int inum, int type);
void TranslateShapes(double X,double Y,double Z, List_T *shapes);
void DilatShapes(double X,double Y,double Z, double A, double B, double C,
void TranslateShapes(double X, double Y, double Z, List_T *shapes);
void DilatShapes(double X, double Y, double Z, double A, double B, double C,
List_T *shapes);
void RotateShapes(double Ax,double Ay,double Az,
double Px,double Py, double Pz, double alpha, List_T *shapes);
void SymmetryShapes(double A,double B,double C, double D, List_T *shapes);
void RotateShapes(double Ax, double Ay, double Az, double Px, double Py,
double Pz, double alpha, List_T *shapes);
void SymmetryShapes(double A, double B, double C, double D, List_T *shapes);
Vertex *DuplicateVertex(Vertex *v);
Curve *DuplicateCurve(Curve *c);
Surface *DuplicateSurface(Surface *s);
Volume *DuplicateVolume(Volume *s);
void DeletePoint(int Num, bool recursive=false);
void DeleteCurve(int Num, bool recursive=false);
void DeleteSurface(int Num, bool recursive=false);
void DeleteVolume(int Num, bool recursive=false);
void DeletePoint(int Num, bool recursive = false);
void DeleteCurve(int Num, bool recursive = false);
void DeleteSurface(int Num, bool recursive = false);
void DeleteVolume(int Num, bool recursive = false);
void DeletePhysicalPoint(int Num);
void DeletePhysicalLine(int Num);
void DeletePhysicalSurface(int Num);
void DeletePhysicalVolume(int Num);
void ExtrudeShapes(int extrude_type, List_T *in,
double T0, double T1, double T2,
double A0, double A1, double A2,
double X0, double X1, double X2, double alpha,
ExtrudeParams *e,
void ExtrudeShapes(int extrude_type, List_T *in, double T0, double T1,
double T2, double A0, double A1, double A2, double X0,
double X1, double X2, double alpha, ExtrudeParams *e,
List_T *out);
void ProtudeXYZ(double &x, double &y, double &z, ExtrudeParams *e);
void ReplaceAllDuplicates();
void ReplaceAllDuplicatesNew(double tol=-1.);
void ReplaceAllDuplicatesNew(double tol = -1.);
bool ProjectPointOnSurface(Surface *s, Vertex &p, double uv[2]);
bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id, List_T *shapes);
bool IntersectCurvesWithSurface(List_T *curve_ids, int surface_id,
List_T *shapes);
bool SplitCurve(int line_id, List_T *vertices_id, List_T *curves);
int RecognizeLineLoop(List_T *liste, int *loop);
int RecognizeSurfaceLoop(List_T *liste, int *loop);
void SortEdgesInLoop(int num, List_T *edges, bool orient=false);
void SortEdgesInLoop(int num, List_T *edges, bool orient = false);
void SetSurfaceGeneratrices(Surface *s, List_T *loops);
void SetVolumeSurfaces(Volume *v, List_T *loops);
......
......@@ -20,7 +20,7 @@ double angle3Vertices(const MVertex *p1, const MVertex *p2, const MVertex *p3)
SVector3 c = crossprod(a, b);
double sinA = c.norm();
double cosA = dot(a, b);
return atan2(sinA, cosA);
return std::atan2(sinA, cosA);
}
MVertex::MVertex(double x, double y, double z, GEntity *ge, int num)
......
......@@ -6,7 +6,7 @@
#ifndef _SPOINT2_H_
#define _SPOINT2_H_
#include <math.h>
#include <cmath>
// A point in 2-space
class SPoint2 {
......@@ -85,7 +85,7 @@ inline SPoint2 SPoint2::operator*(double mult)const
inline double SPoint2::distance(const SPoint2 &p)const
{
double x = P[0] - p.P[0], y = P[1] - p.P[1];
return sqrt(x * x + y * y);
return std::sqrt(x * x + y * y);
}
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -17,8 +17,7 @@ class GFace;
class GVertex;
class MVertex;
class edge_angle {
public:
struct edge_angle {
MVertex *v1, *v2;
double angle;
edge_angle(MVertex *_v1, MVertex *_v2, MElement *t1, MElement *t2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment