mdpmem.c File Reference

#include "../headers/mdpmem.h"

Go to the source code of this file.

Functions

s_mdconcatinit_md_concat (void)
void alloc_first_md_concat (s_mdconcat *m, size_t n)
void realloc_md_concat (s_mdconcat *m, size_t n)
void free_mdconcat (s_mdconcat *m)


Function Documentation

void alloc_first_md_concat ( s_mdconcat m,
size_t  n 
)

## FUNCTION: alloc_first_md_concat

## SPECIFICATION: Allocate memory for the md concat structure (first snapshot)

## PARAMETRES: @ s_mdconcat *m: Pointer to the structure to free, @ size_t n: Number of vertices in the snapshot to add to m

## RETURN: void

Definition at line 115 of file mdpmem.c.

References my_malloc(), s_mdconcat::n_vertpos, and s_mdconcat::vertpos.

00115                                                   {
00116     size_t z;
00117     m->vertpos=(float **) my_malloc(sizeof(float *)*n);
00118     for(z=0;z<n;z++){
00119         m->vertpos[z]=(float *)my_malloc(sizeof(float)*4);
00120         m->vertpos[z][0]=0.0;
00121         m->vertpos[z][1]=0.0;
00122         m->vertpos[z][2]=0.0;
00123         m->vertpos[z][3]=0.0;
00124     }
00125     m->n_vertpos=n;
00126 }

void free_mdconcat ( s_mdconcat m  ) 

## FUNCTION: free_mdconcat

## SPECIFICATION: Free the mdconcat structure

## PARAMETRES: @ s_mdconcat *m: Pointer to the structure to free

## RETURN: void

Definition at line 170 of file mdpmem.c.

References my_free(), s_mdconcat::n_vertpos, and s_mdconcat::vertpos.

00170                                  {
00171     size_t i;
00172     for(i=0;i<m->n_vertpos;i++){
00173         my_free(m->vertpos[i]);
00174     }
00175     my_free(m->vertpos);
00176     my_free(m);
00177 }

s_mdconcat* init_md_concat ( void   ) 

## FUNCTION: init_md_concat

## SPECIFICATION: Allocate memory for the concatenated voronoi vertice structure Currently NOT USED

## PARAMETRES: void

## RETURN: s_mdconcat * : Structure containing allocated memory

Definition at line 90 of file mdpmem.c.

References my_malloc(), s_mdconcat::n_snapshots, s_mdconcat::n_vertpos, and s_mdconcat::vertpos.

00090                                 {
00091     s_mdconcat *m=(s_mdconcat *) my_malloc(sizeof(s_mdconcat));
00092     m->n_vertpos=0;
00093     m->vertpos=NULL;
00094     m->n_snapshots=0;
00095     return m;
00096 }

void realloc_md_concat ( s_mdconcat m,
size_t  n 
)

## FUNCTION: realloc_md_concat

## SPECIFICATION: Reallocate memory for the md concat structure (to add a new snapshot)

## PARAMETRES: @ s_mdconcat *m: Pointer to the structure to free, @ size_t n: Number of vertices in the snapshot to add to m

## RETURN: void

Definition at line 143 of file mdpmem.c.

References my_malloc(), my_realloc(), s_mdconcat::n_vertpos, and s_mdconcat::vertpos.

00143                                               {
00144     size_t z;
00145     m->vertpos=(float **) my_realloc(m->vertpos,sizeof(float *)*(m->n_vertpos+n));
00146     for(z=0;z<n;z++){
00147         m->vertpos[m->n_vertpos+z]=(float *)my_malloc(sizeof(float)*4);
00148         m->vertpos[m->n_vertpos+z][0]=0.0;
00149         m->vertpos[m->n_vertpos+z][1]=0.0;
00150         m->vertpos[m->n_vertpos+z][2]=0.0;
00151         m->vertpos[m->n_vertpos+z][3]=0.0;
00152     }
00153     m->n_vertpos+=n;
00154 }


Generated on Mon Jun 7 16:44:23 2010 for fpocket by  doxygen 1.5.6