pmm  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
pmm_interval.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008-2010 Robert Higgins
3  Author: Robert Higgins <robert.higgins@ucd.ie>
4 
5  This file is part of PMM.
6 
7  PMM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  PMM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with PMM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 /*!
21  * @file pmm_interval.h
22  * @brief data structures for construction intervals
23  *
24  * Construction intervals describe constructed and unconstructed regions of
25  * the model. They are essential in the model building algorithms.
26  *
27  */
28 #ifndef PMM_INTERVAL_H_
29 #define PMM_INTERVAL_H_
30 
31 #if HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34 /*! enumeration of possible model construction interval types */
35 typedef enum pmm_interval_type {
36  IT_NULL, /*!< null empty interval */
37  IT_BOUNDARY_COMPLETE, /*!< for models in terms of more than one
38  parameter, specifies that a boundary axis of the
39  model is complete */
40  IT_GBBP_EMPTY, /*!< initial empty GPPB interval type */
41  IT_GBBP_CLIMB, /*!< construction interval where model is still
42  climbing (for GBBP) */
43  IT_GBBP_BISECT, /*!< construction interval where model has taken
44  descending form (for GBBP)*/
45  IT_GBBP_INFLECT, /*!< construction interval where model is being
46  tested for accuracy and may almost be complete */
47  IT_POINT, /*!< construction interval that defines a single
48  point where a benchmark is required */
49  IT_COMPLETE /*!< construction interval which is complete and
50  does not need further testing */
52 
53 /*
54 static char *pmm_interval_type_str[] = { "NULL",
55  "BOUNDARY_COMPLETE",
56  "GBBP_EMPTY",
57  "GBBP_CLIMB",
58  "GBBP_BISECT",
59  "GBBP_INFLECT",
60  "POINT",
61  "COMPLETE" };
62 */
63 
64 
65 /*!
66  * structure describing the construction status of an interval of a model
67  */
68 typedef struct pmm_interval {
69  enum pmm_interval_type type; /*!< type of interval */
70 
71  int plane; /*!< index of the plane that this interval pertains to */
72  int n_p; /*!< number of parameters the interval has */
73  int *start; /*!< end point of the interval */
74  int *end; /*!< start point of the interval */
75 
76  int climb_step; /*!< index of the step along the interval that we are
77  currently constructing for, when the interval type is
78  IT_GBBP_CLIMB */
79 
80  struct pmm_interval *next; /*!< pointer to the next interval in stack */
81  struct pmm_interval *previous; /*!< pointer to previous interval in stack */
82 } PMM_Interval;
83 
84 /*!
85  * structure holding the interval list/stack
86  */
87 typedef struct pmm_interval_list {
88  struct pmm_interval *top; /*!< pointer to top of stack */
89  struct pmm_interval *bottom; /*!< pointer to bottom of stack */
90  int size; /*!< number of intervals in stack */
91 
93 
94 struct pmm_interval*
95 new_interval();
96 struct pmm_interval_list*
98 int
100 void
101 print_interval_list(const char *output, struct pmm_interval_list *l);
102 
103 struct pmm_interval*
105 
106 int
107 add_top_interval(struct pmm_interval_list *l, struct pmm_interval *i);
108 
109 int
111 
112 int
114 
115 int
116 remove_interval(struct pmm_interval_list *l, struct pmm_interval *i);
117 
118 void
119 print_interval(const char *output, struct pmm_interval *i);
120 
121 /*
122 int interval_contains_bench(struct pmm_routine *r, struct pmm_interval *i,
123  struct pmm_benchmark *b);
124 */
125 
126 struct pmm_interval*
127 init_interval(int plane,
128  int n_p,
129  enum pmm_interval_type type,
130  int *start,
131  int *end);
132 
133 void
135 void
136 free_interval(struct pmm_interval **i);
137 
138 #endif /*PMM_INTERVAL_H_*/
139