Skip to content
Snippets Groups Projects
Commit f4a58880 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

cleanup
parent 26238f06
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ class GModel
// loop over all vertices connected to elements and associate geo entity
void associateEntityWithVertices();
// Renumber all the mesh vertices in a continuous sequence
// Renumber all the (used) mesh vertices in a continuous sequence
int renumberMeshVertices(bool saveAll);
// Deletes all invisble mesh elements
......
// $Id: GeoInterpolation.cpp,v 1.25 2007-04-16 09:08:27 remacle Exp $
// $Id: GeoInterpolation.cpp,v 1.26 2007-04-22 08:46:04 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -130,34 +130,35 @@ SPoint2 InterpolateCubicSpline(Vertex * v[4], double t, double mat[4][4],
}
// Uniform BSplines
Vertex InterpolateUBS(Curve * Curve, double u, int derivee) {
int NbControlPoints, NbCurves, iCurve;
double t, t1, t2;
Vertex InterpolateUBS(Curve * Curve, double u, int derivee)
{
bool periodic = (Curve->end == Curve->beg);
int NbControlPoints = List_Nbr(Curve->Control_Points);
int NbCurves = NbControlPoints + (periodic ? -1 : 1);
int iCurve = (int)floor(u * (double)NbCurves);
if(iCurve == NbCurves) iCurve -= 1; // u = 1
double t1 = (double)(iCurve) / (double)(NbCurves);
double t2 = (double)(iCurve+1) / (double)(NbCurves);
double t = (u - t1) / (t2 - t1);
Vertex *v[4];
Vertex V;
bool periodic=Curve->end==Curve->beg;
NbControlPoints = List_Nbr(Curve->Control_Points);
NbCurves = NbControlPoints +(periodic ? -1:+1) ;
iCurve = (int)floor(u * (double)NbCurves);
if(iCurve==NbCurves)iCurve-=1;//u=1
t1 = (double)(iCurve) / (double)(NbCurves);
t2 = (double)(iCurve+1) / (double)(NbCurves);
t = (u - t1) / (t2 - t1);
for(int i=0;i<4;i++) {
int k=iCurve - (periodic?1:2) + i;
if (k<0) k=periodic ? k + NbControlPoints - 1 : 0;
if (k>=NbControlPoints) k=periodic ? k-NbControlPoints + 1: NbControlPoints-1;
List_Read(Curve->Control_Points, k , &v[i]);
}
if (Curve->geometry) {
SPoint2 pp = InterpolateCubicSpline(v, t, Curve->mat, 0, t1, t2,Curve->geometry);
for(int i = 0; i < 4; i++) {
int k = iCurve - (periodic ? 1 : 2) + i;
if(k < 0) k = periodic ? k + NbControlPoints - 1 : 0;
if(k >= NbControlPoints) k = periodic ? k - NbControlPoints + 1: NbControlPoints - 1;
List_Read(Curve->Control_Points, k , &v[i]);
}
if(Curve->geometry){
SPoint2 pp = InterpolateCubicSpline(v, t, Curve->mat, 0, t1, t2,Curve->geometry);
SPoint3 pt = Curve->geometry->point(pp);
Vertex V;
V.Pos.X = pt.x();
V.Pos.Y = pt.y();
V.Pos.Z = pt.z();
return V;
} else
return InterpolateCubicSpline(v, t, Curve->mat, 0, t1, t2);
}
else
return InterpolateCubicSpline(v, t, Curve->mat, 0, t1, t2);
}
// Non Uniform BSplines
......@@ -207,11 +208,11 @@ Vertex InterpolateNurbs(Curve * Curve, double u, int derivee)
{
static double Nb[1000];
int span = findSpan(u, Curve->degre, List_Nbr(Curve->Control_Points), Curve->k);
Vertex p, *v;
basisFuns(u, span, Curve->degre, Curve->k, Nb);
Vertex p;
p.Pos.X = p.Pos.Y = p.Pos.Z = p.w = p.lc = 0.0;
for(int i = Curve->degre; i >= 0; --i) {
Vertex *v;
List_Read(Curve->Control_Points, span - Curve->degre + i, &v);
p.Pos.X += Nb[i] * v->Pos.X;
p.Pos.Y += Nb[i] * v->Pos.Y;
......
// $Id: BackgroundMesh.cpp,v 1.20 2007-04-21 19:40:00 geuzaine Exp $
// $Id: BackgroundMesh.cpp,v 1.21 2007-04-22 08:46:04 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -131,7 +131,7 @@ double LC_MVertex_PNTS(GEntity *ge, double U, double V)
{
GVertex *gv = (GVertex *)ge;
double lc = gv->prescribedMeshSizeAtVertex();
if(lc >= MAX_LC) {return CTX.lc / 10.;}
if(lc >= MAX_LC) return CTX.lc / 10.;
return lc;
}
case 1:
......
// $Id: meshGEdge.cpp,v 1.34 2007-04-21 22:26:51 geuzaine Exp $
// $Id: meshGEdge.cpp,v 1.35 2007-04-22 08:46:04 geuzaine Exp $
//
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
//
......@@ -189,11 +189,12 @@ void deMeshGEdge::operator() (GEdge *ge)
if(ge->meshRep) ge->meshRep->destroy();
}
double GPointDist(GPoint &p1,GPoint &p2){
double dx=p1.x()-p2.x();
double dy=p1.y()-p2.y();
double dz=p1.z()-p2.z();
return sqrt(dx*dx+dy*dy+dz*dz);
double GPointDist(GPoint &p1, GPoint &p2)
{
double dx = p1.x() - p2.x();
double dy = p1.y() - p2.y();
double dz = p1.z() - p2.z();
return sqrt(dx * dx + dy * dy + dz * dz);
}
void meshGEdge::operator() (GEdge *ge)
......@@ -303,5 +304,4 @@ void meshGEdge::operator() (GEdge *ge)
v0->x() = beg_p.x();
v0->y() = beg_p.y();
v0->z() = beg_p.z();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment