sample.h
Go to the documentation of this file.
1 #ifndef SAMPLEH
2 #define SAMPLEH
3 
4 #include "vector.h"
5 #include "box.h"
6 
7 
17 /************************************************************************************/
22 #define NO_SAMPLE_ID NO_UINT
23 /************************************************************************************/
24 
25 
38 typedef struct {
39  unsigned int sID;
40  unsigned int boxID;
44 } Tsample;
45 
58 void InitSample(unsigned int sID,unsigned int n,double *v,unsigned int boxID,Tsample *s);
59 
74 void InitSampleFromBox(unsigned int sID,boolean *systemVar,Tbox *b,unsigned int boxID,Tsample *s);
75 
87 
98 double GetSampleValue(unsigned int n,Tsample *s);
99 
110 unsigned int GetSampleBoxID(Tsample *s);
111 
121 unsigned int GetSampleID(Tsample *s);
122 
131 void SetSampleBoxID(unsigned int boxID,Tsample *s);
132 
141 void CopySample(void *s_dst,void *s_src);
142 
153 unsigned int GetSampleDim(Tsample *s);
154 
155 
166 double GetSampleDistance(Tsample *s1,Tsample *s2);
167 
180 void PrintSample(FILE *f,Tsample *s);
181 
190 void SaveSample(FILE *f,Tsample *s);
191 
192 
201 void LoadSample(FILE *f,Tsample *s);
202 
210 void DeleteSample(void *s);
211 
212 #endif
A sample.
Definition: sample.h:38
unsigned int sID
Definition: sample.h:39
Tvector v
Definition: sample.h:42
void DeleteSample(void *s)
Destructor.
Definition: sample.c:164
unsigned int boxID
Definition: sample.h:40
unsigned int GetSampleDim(Tsample *s)
Returns the dimensionality of the space where the sample is defined.
Definition: sample.c:69
double GetSampleDistance(Tsample *s1, Tsample *s2)
Computes the Euclidean distance between two samples.
Definition: sample.c:106
double GetSampleValue(unsigned int n, Tsample *s)
Gets the value for a given dimension of the sample.
Definition: sample.c:79
unsigned int GetSampleBoxID(Tsample *s)
Gets the identifier of the box that includes the sample.
Definition: sample.c:91
void InitSampleFromBox(unsigned int sID, boolean *systemVar, Tbox *b, unsigned int boxID, Tsample *s)
Constructor.
Definition: sample.c:29
Tvector * GetSampleValues(Tsample *s)
Gets the values of the sample.
Definition: sample.c:74
void PrintSample(FILE *f, Tsample *s)
Prints a sample.
Definition: sample.c:126
void SaveSample(FILE *f, Tsample *s)
Saves the information of the sample in a file.
Definition: sample.c:142
void SetSampleBoxID(unsigned int boxID, Tsample *s)
Changes the identifier of the box to which the sample is linked.
Definition: sample.c:101
Definition of the Tbox type and the associated functions.
A generic vector.
Definition: vector.h:227
A box.
Definition: box.h:83
void InitSample(unsigned int sID, unsigned int n, double *v, unsigned int boxID, Tsample *s)
Constructor.
Definition: sample.c:16
Definition of the Tvector type and the associated functions.
void LoadSample(FILE *f, Tsample *s)
Constructor.
Definition: sample.c:148
void CopySample(void *s_dst, void *s_src)
Constructor.
Definition: sample.c:62
unsigned int GetSampleID(Tsample *s)
Gets the identifier of the sample.
Definition: sample.c:96