~ubuntu-branches/ubuntu/intrepid/gmsh/intrepid

« back to all changes in this revision

Viewing changes to Mesh/meshGEdge.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andrea Veri
  • Date: 2007-07-14 23:29:56 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070714232956-ikw2f28278kxkquw
Tags: 2.0.8-1ubuntu1
* Merge from debian unstable, remaining changes:
  debian/rules:
    - added dh_desktop for registering gmsh.desktop file.
  debian/gmsh.install:
    - Installing both gmsh.desktop and respective icon.
  debian/menu:
    - added gmsh icon path
  debian/control:
    - Modify Maintainer value to match Debian-Maintainer-Field Spec.

* removing 02_gcc4.3-FTBFS.dpatch previously added in ubuntu, it has been reported 
  and fixed upstream with the new usptream release (2.0.8).
  Check debian bug #417211 for confirmation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: meshGEdge.cpp,v 1.30 2007/03/09 14:57:06 remacle Exp $
 
1
// $Id: meshGEdge.cpp,v 1.39 2007-05-12 22:45:14 anand Exp $
2
2
//
3
3
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
4
4
//
224
224
    N = ge->meshAttributes.nbPointsTransfinite;
225
225
  }
226
226
  else{
227
 
    a = Integration(ge, t_begin, t_end, F_Lc, Points, 1.e-7);
 
227
    a = Integration(ge, t_begin, t_end, F_Lc, Points, 1.e-8);
228
228
    N = std::max(ge->minimumMeshSegments() + 1, (int)(a + 1.));
229
229
  }
 
230
 
230
231
  const double b = a / (double)(N - 1);
231
232
 
232
 
  int count = 1, NUMP = 1;
 
233
  // if the curve is periodic and if the begin vertex is identical to the end vertex
 
234
  // and if this vertex has only one model curve adjacent to it, then the vertex is
 
235
  // not connecting any other curve. So, the mesh vertex and its associated  geom vertex
 
236
  // are not necessary at the same location
 
237
  GPoint beg_p, end_p;
 
238
  if(ge->getBeginVertex() == ge->getEndVertex() && 
 
239
     ge->getBeginVertex()->edges().size() == 1){
 
240
    end_p = beg_p = ge->point(t_begin);
 
241
  }
 
242
  else{
 
243
    MVertex *v0 = ge->getBeginVertex()->mesh_vertices[0];
 
244
    MVertex *v1 = ge->getEndVertex()->mesh_vertices[0];
 
245
    beg_p = GPoint(v0->x(), v0->y(), v0->z());
 
246
    end_p = GPoint(v1->x(), v1->y(), v1->z());
 
247
  }
 
248
 
 
249
  int count = 1, NUMP = 1, NUMP2 = 1;
233
250
  IntPoint P1, P2;
234
251
 
235
252
  // do not consider the first and the last vertex (those are not
236
253
  // classified on this mesh edge)
237
 
  if(N > 2){
 
254
  if(N > 1){
238
255
    ge->mesh_vertices.resize(N - 2);
 
256
    GPoint last_p = beg_p;
239
257
    while(NUMP < N - 1) {
240
258
      List_Read(Points, count - 1, &P1);
241
259
      List_Read(Points, count, &P2);
242
260
      const double d = (double)NUMP *b;
243
261
      if((fabs(P2.p) >= fabs(d)) && (fabs(P1.p) < fabs(d))) {
244
 
        double dt = P2.t - P1.t;
245
 
        double dp = P2.p - P1.p;
246
 
        double t = P1.t + dt / dp * (d - P1.p);
247
 
        GPoint V = ge->point(t);
248
 
        ge->mesh_vertices[NUMP - 1] = new MEdgeVertex(V.x(), V.y(), V.z(), ge, t);
249
 
        NUMP++;
 
262
        double dt = P2.t - P1.t;
 
263
        double dp = P2.p - P1.p;
 
264
        double t = P1.t + dt / dp * (d - P1.p);
 
265
        GPoint V = ge->point(t);
 
266
        if(ge->meshAttributes.Method == TRANSFINI){
 
267
          ge->mesh_vertices[NUMP2 - 1] = new MEdgeVertex(V.x(), V.y(), V.z(), ge, t);
 
268
          NUMP2++;
 
269
        }
 
270
        else{
 
271
          double lc = BGM_MeshSize(ge, t, 0, V.x(), V.y(), V.z());
 
272
          if(V.distance(last_p) > 0.7 * lc && 
 
273
             !(NUMP == N - 2 && V.distance(end_p) < 0.7 * lc)){
 
274
            last_p = V;
 
275
            ge->mesh_vertices[NUMP2 - 1] = new MEdgeVertex(V.x(), V.y(), V.z(), ge, t);
 
276
            NUMP2++;
 
277
          }
 
278
        }
 
279
        NUMP++;
250
280
      }
251
281
      else {
252
 
        count++;
 
282
        count++;
253
283
      }
254
284
    }
 
285
    ge->mesh_vertices.resize(NUMP2 - 1);
255
286
  }
256
287
  List_Delete(Points);
257
288
 
263
294
    ge->lines.push_back(new MLine(v0, v1));
264
295
  }
265
296
 
266
 
  // if the curve is periodic and if the begin vertex is identical to the end vertex
267
 
  // and if this vertex has only one model curve adjacent to it, then the vertex is
268
 
  // not connecting any other curve. So, the mesh vertex and its associated  geom vertex
269
 
  // are not necessary at the same location
270
 
 
271
 
 
272
 
  //  printf("%p %p %d\n",ge->getBeginVertex(),ge->getEndVertex(),ge->getBeginVertex()->edges().size());    
273
 
 
274
 
  if (ge->getBeginVertex() == ge->getEndVertex() && ge->getBeginVertex()->edges().size() == 1)
275
 
    {
276
 
      MVertex *v0 =  ge->getBeginVertex()->mesh_vertices[0];
277
 
      GPoint gp = ge->point (t_begin);
278
 
      v0->x() = gp.x();
279
 
      v0->y() = gp.y();
280
 
      v0->z() = gp.z();
281
 
    }
282
 
 
 
297
  if(ge->getBeginVertex() == ge->getEndVertex() && 
 
298
     ge->getBeginVertex()->edges().size() == 1){
 
299
    MVertex *v0 = ge->getBeginVertex()->mesh_vertices[0];
 
300
    v0->x() = beg_p.x();
 
301
    v0->y() = beg_p.y();
 
302
    v0->z() = beg_p.z();
 
303
  }
283
304
}