Subversion Repositories gelsvn

Rev

Rev 515 | Rev 572 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
515 s042372 1
 
2
/* ----------------------------------------------------------------------- *
3
 * This file is part of GEL, www.imm.dtu.dk/GEL
4
 * Copyright (C) the authors (see AUTHORS.txt) and DTU Informatics
5
 *
6
 * Principal authors:
7
 *  Christian Thode Larsen (thode2d@gmail.com)
8
 *  J. Andreas Baerentzen (jab@imm.dtu.dk)
9
 *
10
 * See LICENSE.txt for licensing information
11
 * ----------------------------------------------------------------------- */
12
 
13
#include "ConnectivityKernel.h"
14
 
15
namespace HMesh
16
{
17
    using namespace std;
18
 
19
    void ConnectivityKernel::cleanup(IDRemap& map)
20
    {
518 s042372 21
        VertexID::IndexType vid = 0;
22
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v), ++vid)
23
            map.vmap[v] = VertexID(vid);
515 s042372 24
 
518 s042372 25
        FaceID::IndexType fid = 0;
26
        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f), ++fid)
27
            map.fmap[f] = FaceID(fid);
515 s042372 28
 
518 s042372 29
        HalfEdgeID::IndexType hid = 0;
30
        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h), ++hid){
31
            map.hmap[h] = HalfEdgeID(hid);
515 s042372 32
        }
33
 
34
        //2. update the connectivity kernel connectivity with the new locations
35
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v))
36
            set_out(v, map.hmap[out(v)]);
37
 
38
        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f))
39
            set_last(f, map.hmap[last(f)]);
40
 
41
        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h)){ 
42
            // do not update holes
43
            if(face(h) != InvalidFaceID)
44
                set_face(h, map.fmap[face(h)]);
45
            set_next(h, map.hmap[next(h)]);
46
            set_prev(h, map.hmap[prev(h)]);
47
            set_opp(h, map.hmap[opp(h)]);
48
            set_vert(h, map.vmap[vert(h)]);
49
        }
50
 
51
        vertices.cleanup();
52
        faces.cleanup();
53
        halfedges.cleanup();
54
    }
55
}