Subversion Repositories gelsvn

Rev

Rev 595 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 595 Rev 630
1
/* ----------------------------------------------------------------------- *
1
/* ----------------------------------------------------------------------- *
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
2
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
3
 * Copyright (C) the authors and DTU Informatics
3
 * Copyright (C) the authors and DTU Informatics
4
 * For license and list of authors, see ../../doc/intro.pdf
4
 * For license and list of authors, see ../../doc/intro.pdf
5
 * ----------------------------------------------------------------------- */
5
 * ----------------------------------------------------------------------- */
6
 
6
 
7
#include "ConnectivityKernel.h"
7
#include "ConnectivityKernel.h"
8
 
8
 
9
namespace HMesh
9
namespace HMesh
10
{
10
{
11
    using namespace std;
11
    using namespace std;
12
 
12
 
13
    void ConnectivityKernel::cleanup(IDRemap& map)
13
    void ConnectivityKernel::cleanup(IDRemap& map)
14
    {
14
    {
15
        VertexID::IndexType vid = 0;
15
        VertexID::IndexType vid = 0;
16
        for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v), ++vid)
16
        for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v), ++vid)
17
            map.vmap[v] = VertexID(vid);
17
            map.vmap[v] = VertexID(vid);
18
 
18
 
19
        FaceID::IndexType fid = 0;
19
        FaceID::IndexType fid = 0;
20
        for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f), ++fid)
20
        for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f), ++fid)
21
            map.fmap[f] = FaceID(fid);
21
            map.fmap[f] = FaceID(fid);
22
 
22
 
23
        HalfEdgeID::IndexType hid = 0;
23
        HalfEdgeID::IndexType hid = 0;
24
        for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h), ++hid){
24
        for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h), ++hid){
25
            map.hmap[h] = HalfEdgeID(hid);
25
            map.hmap[h] = HalfEdgeID(hid);
26
        }
26
        }
27
 
27
 
28
        //2. update the connectivity kernel connectivity with the new locations
28
        //2. update the connectivity kernel connectivity with the new locations
29
        for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v))
29
        for(VertexID v = vertices.index_begin(); v != vertices.index_end(); v = vertices.index_next(v))
30
            set_out(v, map.hmap[out(v)]);
30
            set_out(v, map.hmap[out(v)]);
31
 
31
 
32
        for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f))
32
        for(FaceID f = faces.index_begin(); f != faces.index_end(); f = faces.index_next(f))
33
            set_last(f, map.hmap[last(f)]);
33
            set_last(f, map.hmap[last(f)]);
34
 
34
 
35
        for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h)){ 
35
        for(HalfEdgeID h = halfedges.index_begin(); h != halfedges.index_end(); h = halfedges.index_next(h)){ 
36
            // do not update holes
36
            // do not update holes
37
            if(face(h) != InvalidFaceID)
37
            if(face(h) != InvalidFaceID)
38
                set_face(h, map.fmap[face(h)]);
38
                set_face(h, map.fmap[face(h)]);
39
            set_next(h, map.hmap[next(h)]);
39
            set_next(h, map.hmap[next(h)]);
40
            set_prev(h, map.hmap[prev(h)]);
40
            set_prev(h, map.hmap[prev(h)]);
41
            set_opp(h, map.hmap[opp(h)]);
41
            set_opp(h, map.hmap[opp(h)]);
42
            set_vert(h, map.vmap[vert(h)]);
42
            set_vert(h, map.vmap[vert(h)]);
43
        }
43
        }
44
 
44
 
45
        vertices.cleanup();
45
        vertices.cleanup();
46
        faces.cleanup();
46
        faces.cleanup();
47
        halfedges.cleanup();
47
        halfedges.cleanup();
48
    }
48
    }
49
}
49
}
50
 
50
 
51

Generated by GNU Enscript 1.6.6.
51

Generated by GNU Enscript 1.6.6.
52
 
52
 
53
 
53
 
54
 
54