parQHV
Compute HyperVolumes using threads
 All Data Structures Files Functions Variables Macros
division.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) Year(s), 2013, Luis M. S. Russo and Alexandre
4  * P. Francisco / KDBIO / INESC-ID, <qhv@kdbio.inesc-id.pt>
5  *
6  * Any published media that is related with to use of the distributed
7  * software, or derived software, must contain a reference to "Extending
8  * quick hypervolume. Luís M. S. Russo, Alexandre P. Francisco:
9  * J. Heuristics 22(3): 245-271 (2016)".
10  *
11  * Permission to use, copy, modify, and/or distribute this software for
12  * any purpose with or without fee is hereby granted, provided that the
13  * above copyright notice and this permission notice appear in all
14  * copies.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
17  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
19  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
20  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
21  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23  * PERFORMANCE OF THIS SOFTWARE.
24  *
25  */
26 
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include "division.h"
39 
40 /*** typedefs(not structures) and defined constants *******/
41 
42 /*** enums ************************************************/
43 
44 /*** structures declarations (and typedefs of )************/
45 #include "divisionStruct.c"
46 
47 /*** global variables defined in .c file ******************/
48 
49 /*** declarations of public functions *********************/
50 
51 /*** inline functions *************************************/
52 
54 {
55  free((*d)->hypocts);
56  free((*d)->pPositions);
57  free((*d)->points);
58  free(*d);
59 
60  *d = NULL;
61 }
62 
64 {
65  return d->n > 0;
66 }
67 
68 int* next(division d, int* hypoct, int* n)
69 {
70  d->n--;
71  *hypoct = d->hypocts[d->n];
72  *n = d->pPositions[d->n+1] - d->pPositions[d->n];
73 
74  /* printf("%d ->(%d ...) %d\n", d->pPositions[d->n], d->points[d->pPositions[d->n]], d->pPositions[d->n+1]); */
75 
76  return &(d->points[d->pPositions[d->n]]);
77 }
78 
void freeDivision(division *d)
New divisions are created in the splitter object.
Definition: division.c:53
int * next(division d, int *hypoct, int *n)
Definition: division.c:68
This struct is public because of splitter. Do not use direct access.
int * hypocts
int * pPositions
int * points
int hasNext(division d)
Definition: division.c:63