Subversion Repositories gelsvn

Rev

Rev 518 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

    
/* ----------------------------------------------------------------------- *
 * This file is part of GEL, www.imm.dtu.dk/GEL
 * Copyright (C) the authors (see AUTHORS.txt) and DTU Informatics
 *
 * Principal authors:
 *  Christian Thode Larsen (thode2d@gmail.com)
 *  J. Andreas Baerentzen (jab@imm.dtu.dk)
 *
 * See LICENSE.txt for licensing information
 * ----------------------------------------------------------------------- */

#include "ConnectivityKernel.h"

namespace HMesh
{
    using namespace std;

    void ConnectivityKernel::cleanup(IDRemap& map)
    {
        IndexType k = 0;
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v), ++k)
            map.vmap[v] = VertexID(k);

        k = 0;
        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f), ++k)
            map.fmap[f] = FaceID(k);

        k = 0;
        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h), ++k){
            map.hmap[h] = HalfEdgeID(k);
        }

        //2. update the connectivity kernel connectivity with the new locations
        for(VertexID v = vertices_begin(); v != vertices_end(); v = vertices_next(v))
            set_out(v, map.hmap[out(v)]);

        for(FaceID f = faces_begin(); f != faces_end(); f = faces_next(f))
            set_last(f, map.hmap[last(f)]);

        for(HalfEdgeID h = halfedges_begin(); h != halfedges_end(); h = halfedges_next(h)){ 
            // do not update holes
            if(face(h) != InvalidFaceID)
                set_face(h, map.fmap[face(h)]);
            set_next(h, map.hmap[next(h)]);
            set_prev(h, map.hmap[prev(h)]);
            set_opp(h, map.hmap[opp(h)]);
            set_vert(h, map.vmap[vert(h)]);
        }

        vertices.cleanup();
        faces.cleanup();
        halfedges.cleanup();
    }
}

Generated by GNU Enscript 1.6.6.