#include "../headers/voronoi_lst.h"
Go to the source code of this file.
Functions | |
c_lst_vertices * | c_lst_vertices_alloc (void) |
node_vertice * | node_vertice_alloc (s_vvertice *vertice) |
node_vertice * | c_lst_vertices_add_first (c_lst_vertices *lst, s_vvertice *vertice) |
node_vertice * | c_lst_vertices_add_last (c_lst_vertices *lst, s_vvertice *vertice) |
void | c_lst_vertices_free (c_lst_vertices *lst) |
s_atm ** | get_vert_contacted_atms (c_lst_vertices *v_lst, int *nneigh) |
node_vertice* c_lst_vertices_add_first | ( | c_lst_vertices * | lst, | |
s_vvertice * | vertice | |||
) |
## FONCTION: c_vertice_lst_add_first
## SPECIFICATION: Add a vertice at the first position of the list.
## PARAMETRES: @ c_lst_vertices *lst : chained list of vertices @ s_vvertice *vertice : vertice to add
## RETURN: node_vertice *: pointer toi the new node.
Definition at line 123 of file voronoi_lst.c.
References c_lst_vertices::first, c_lst_vertices::n_vertices, node_vertice::next, node_vertice_alloc(), and node_vertice::prev.
00124 { 00125 node_vertice *newn = NULL ; 00126 00127 if(lst) { 00128 newn = node_vertice_alloc(vertice) ; 00129 lst->first->prev = newn ; 00130 newn->next = lst->first ; 00131 00132 lst->first = newn ; 00133 lst->n_vertices += 1 ; 00134 } 00135 00136 return newn ; 00137 }
node_vertice* c_lst_vertices_add_last | ( | c_lst_vertices * | lst, | |
s_vvertice * | vertice | |||
) |
## FONCTION: c_vertice_lst_add_last
## SPECIFICATION: Add a vertice at the end of the chained list
## PARAMETRES: @ c_lst_pocket *lst : chained list of pockets @ s_vvertice *vertice : vertice to add
## RETURN: node_vertice *: Pointer to the new node
Definition at line 154 of file voronoi_lst.c.
References c_lst_vertices::first, c_lst_vertices::last, c_lst_vertices::n_vertices, node_vertice::next, node_vertice_alloc(), and node_vertice::prev.
Referenced by extract_wanted_vertices(), and updateIds().
00155 { 00156 struct node_vertice *newn = NULL ; 00157 00158 if(lst) { 00159 newn = node_vertice_alloc(vertice) ; 00160 if(lst->last) { 00161 newn->prev = lst->last ; 00162 lst->last->next = newn ; 00163 } 00164 else { 00165 lst->first = newn ; 00166 00167 } 00168 lst->last = newn ; 00169 lst->n_vertices += 1 ; 00170 } 00171 00172 return newn ; 00173 }
c_lst_vertices* c_lst_vertices_alloc | ( | void | ) |
## FONCTION: lst_vertices_alloc
## SPECIFICATION: Allocate a list of vertices
## PARAMETRES:
## RETURN: c_lst_vertices*
Definition at line 71 of file voronoi_lst.c.
References c_lst_vertices::current, c_lst_vertices::first, c_lst_vertices::last, my_malloc(), and c_lst_vertices::n_vertices.
Referenced by extract_wanted_vertices(), and updateIds().
00072 { 00073 c_lst_vertices *lst = (c_lst_vertices *)my_malloc(sizeof(c_lst_vertices)) ; 00074 00075 lst->first = NULL ; 00076 lst->last = NULL ; 00077 lst->current = NULL ; 00078 lst->n_vertices = 0 ; 00079 00080 return lst ; 00081 }
void c_lst_vertices_free | ( | c_lst_vertices * | lst | ) |
## FONCTION: lst_vertice_free
## SPECIFICATION: Free memory of a chained list
## PARAMETRES: @ c_lst_vertices *lst: list of voronoi vertices
## RETURN:
Definition at line 188 of file voronoi_lst.c.
References c_lst_vertices::current, c_lst_vertices::first, c_lst_vertices::last, my_free(), and node_vertice::next.
Referenced by dropPocket().
00189 { 00190 //fprintf(stdout, "Freeing list of vertices\n") ; 00191 node_vertice *next = NULL ; 00192 00193 if(lst) { 00194 lst->current = lst->first ; 00195 while(lst->current) { 00196 next = lst->current->next ; 00197 my_free(lst->current) ; 00198 lst->current = next ; 00199 } 00200 } 00201 00202 lst->first = NULL ; 00203 lst->last = NULL ; 00204 lst->current = NULL ; 00205 00206 my_free(lst) ; 00207 }
s_atm** get_vert_contacted_atms | ( | c_lst_vertices * | v_lst, | |
int * | nneigh | |||
) |
## FUNCTION: get_vert_contacted_atms
## SPECIFICATION: Get the list of atoms contacted by each vertice in the given list of vertices.
## PARAMETRES: @ c_lst_vertices *v_lst : The list of vertices of the pocket. @ int *nneigh : OUTPUT A pointer to the number of neighbour found, will be modified
## RETURN: A tab of pointers to the pocket contacting atoms.
Definition at line 225 of file voronoi_lst.c.
References c_lst_vertices::first, s_atm::id, in_tab(), my_malloc(), c_lst_vertices::n_vertices, s_vvertice::neigh, node_vertice::next, and node_vertice::vertice.
Referenced by desc_pocket().
00226 { 00227 int i ; 00228 int nb_neigh = 0 ; 00229 int atm_seen[v_lst->n_vertices * 4] ; 00230 00231 s_atm **neigh = (s_atm **)my_malloc(sizeof(s_atm*)*v_lst->n_vertices * 4) ; 00232 00233 node_vertice *cur = v_lst->first ; 00234 00235 while(cur) { 00236 s_vvertice *vcur = cur->vertice ; 00237 00238 for(i = 0 ; i < 4 ; i++) { 00239 /* For each neighbor, if this atom has not been see yet, add it. */ 00240 if(!in_tab(atm_seen, nb_neigh, vcur->neigh[i]->id)) { 00241 neigh[nb_neigh] = vcur->neigh[i] ; 00242 atm_seen[nb_neigh] = neigh[nb_neigh]->id ; 00243 nb_neigh++ ; 00244 } 00245 } 00246 00247 cur = cur->next ; 00248 } 00249 00250 *nneigh = nb_neigh ; 00251 00252 return neigh ; 00253 }
node_vertice* node_vertice_alloc | ( | s_vvertice * | vertice | ) |
## FONCTION: node_vertice_alloc
## SPECIFICATION: Allocate memory for one vertice node.
## PARAMETRES: @ s_vvertice *vertice : pointer to the vertice to store in the node
## RETURN: node_vertice*: Allocated node
Definition at line 97 of file voronoi_lst.c.
References my_malloc(), node_vertice::next, node_vertice::prev, and node_vertice::vertice.
Referenced by c_lst_vertices_add_first(), and c_lst_vertices_add_last().
00098 { 00099 node_vertice *n_vertice = (node_vertice *) my_malloc(sizeof(node_vertice)) ; 00100 00101 n_vertice->next = NULL ; 00102 n_vertice->prev = NULL ; 00103 n_vertice->vertice = vertice ; 00104 00105 return n_vertice ; 00106 }