Dear all,

I am writing a code in which particles moves in 2D (with periodic boundary

conditions) and (will, later) interact with their neighbors in a Delaunay

triangulation. I thus need to move all my particles at every time step and

to update the corresponding Delaunay graph efficiently. Each particle thus

corresponds to one vertex of the triangulation.

At every time step, I need to loop through the particles. I thus tried to

use a loop over the vertices, move the corresponding particle, and then

update the triangulation. A simple loop would look like that:

for(Vertex_iterator it = T1.vertices_begin(); it != T1.vertices_end();

++it){

// New position

double New_x = it->point().x()+2.3;

double New_y = it->point().y()+2.3;

Point New_point = Point(New_x, New_y);

T1.move_point(it, New_point);

}

(T1 is the already defined triangulation). However, because moving the point

changes the order of the triangulation, I am not looping through all

vertices, and sometimes ends up going twice through the same vertex (which

has moved) and not through other particles/vertices.

My question is thus: Is there a way to access directly the vertices so that

I would loop through all vertices/particles exactly once ? I have added

labels to my vertices using info() :

for(int i=0;i<N;i++){

vh = T1.insert(Point((i%Nx)*d, (i/Nx)*d));

vh->info()=i;

}

But then I do not know how to loop (efficiently!) over the values "i" and

the corresponding vertices.

Thanks for your help !

Best,

Julien

--

Sent from:

http://cgal-discuss.949826.n4.nabble.com/--

You are currently subscribed to cgal-discuss.

To unsubscribe or access the archives, go to

https://sympa.inria.fr/sympa/info/cgal-discuss