Evita  0.16
evPrioritySchedule.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evPrioritySchedule_h
25 #define __evPrioritySchedule_h
26 
27 
28 #include "evDataObject.h"
30 
31 
32 #define EVBITSTREAMMAP_NODATA -1
33 #define EVROI_NONESELECTED -1
34 
35 
37 {
38  public:
39  evPrioritySchedule(void);
40  virtual ~evPrioritySchedule(void);
41 
42  virtual const evString GetClassName(void) const
43  {
44  return(evString("evPrioritySchedule"));
45  }
46 
47  void Copy(const evPrioritySchedule &priority_schedule);
48 
49  void Free(void);
50 
52  const unsigned int match_mask) const;
53  void Remove(evPriorityScheduleEntry *entry);
54  void Append(evPriorityScheduleEntry &entry);
56  const unsigned int match_mask);
57  void Insert(evPriorityScheduleEntry *insertion_position,
59  int Length(void) const;
60 
61  int IsEmpty(void) const;
62 
64  void Sort(void);
65 
66  void FindFilePositions(void);
67 
68  void SetNumDimensions(const unsigned int num_dimensions);
69 
70  int ActivateComponent(const unsigned int component);
71  /*
72  int MatchAndMoveEntries(evPrioritySchedule &priority_schedule,
73  const evPriorityScheduleEntry &entry_to_match,
74  const unsigned int match_mask);
75  */
76  int MatchAndMoveEntries(evPrioritySchedule &priority_schedule,
77  const evVector &frustum,
78  const double pixel_size,
79  const bool inside,
80  evPrioritySchedule *deactivation_queue);
81  int MatchAndMoveEntries(evPrioritySchedule &priority_schedule,
82  const unsigned int component,
83  const evVector &frustum,
84  const double pixel_size,
85  const bool inside);
90 
91  void NormalizePriorities(void);
92  static void NormalizePriorities(evPrioritySchedule &inactive_queue,
93  evPrioritySchedule &transmission_queue,
94  evPrioritySchedule &already_sent_queue);
95  static void SelectROI(evPrioritySchedule &inactive_queue,
96  evPrioritySchedule &transmission_queue,
97  evPrioritySchedule &already_sent_queue,
98  const int roi);
99 
100  int Read(const evString filename);
101  int Read(evBitBuffer &input_buffer);
102  int Write(const evString filename) const;
103  int Write(evBitBuffer &output_buffer) const;
104 
105  void PrintSelf(const int tabbing) const;
106 
107  protected:
108 
109  private:
110  unsigned int NumDimensions;
111 
115 
116  evPrioritySchedule(const evPrioritySchedule &priority_schedule);
117  void Initialize(void);
118  int ReadHeader(evFile &infile, int &num_entries);
119  int ReadData(evBitBuffer &input_buffer, const int num_entries);
120  int WriteHeader(evFile &outfile) const;
121  int WriteData(evBitBuffer &output_buffer) const;
122 
123  void FindMaxMinPriority(double &max_priority, double &min_priority) const;
124  void NormalizePriorities(const double max_priority,
125  const double min_priority);
126  void SelectROI(const int roi);
127 };
128 
129 
131 {
132  this->NumDimensions = 0;
133 
134  this->Start = NULL;
135  this->End = NULL;
136  this->Current = NULL;
137 }
138 
139 
141 {
142  this->Initialize();
143 }
144 
145 
147 {
148  this->Free();
149 }
150 
151 
152 inline void evPrioritySchedule::Free(void)
153 {
154  evPriorityScheduleEntry *current;
156 
157  current = this->Start;
158  while (current != NULL)
159  {
160  next = current->GetNext();
161  delete current;
162  current = next;
163  }
164 
165  this->Start = NULL;
166  this->End = NULL;
167  this->Current = NULL;
168 }
169 
170 
171 inline void evPrioritySchedule::SetNumDimensions(const unsigned int
172  num_dimensions)
173 {
174  this->NumDimensions = num_dimensions;
175 }
176 
177 
178 inline int evPrioritySchedule::IsEmpty(void) const
179 {
180  return(this->Start == NULL);
181 }
182 
183 
185 {
186  this->Current = this->Start;
187  return(this->Current);
188 }
189 
190 
192 {
193  if (this->Current == NULL)
194  return(this->StartTraversal());
195 
196  this->Current = this->Current->GetNext();
197  return(this->Current);
198 }
199 
200 
202 {
203  return(this->Start);
204 }
205 
206 
208 {
209  return(this->End);
210 }
211 
212 
214 {
215  double min_priority;
216  double max_priority;
217 
218  this->FindMaxMinPriority(max_priority, min_priority);
219 
220  this->NormalizePriorities(max_priority, min_priority);
221 }
222 
223 
224 #endif
evPriorityScheduleEntry * Current
Definition: evPrioritySchedule.h:114
Definition: evFile.h:44
void FindMaxMinPriority(double &max_priority, double &min_priority) const
evPriorityScheduleEntry * NextEntry(void)
Definition: evPrioritySchedule.h:191
virtual ~evPrioritySchedule(void)
Definition: evPrioritySchedule.h:146
int WriteData(evBitBuffer &output_buffer) const
void Append(evPriorityScheduleEntry &entry)
Definition: evPrioritySchedule.h:36
int Read(const evString filename)
void FindFilePositions(void)
void NormalizePriorities(void)
Definition: evPrioritySchedule.h:213
void PrintSelf(const int tabbing) const
Definition: evPriorityScheduleEntry.h:39
evPriorityScheduleEntry * Start
Definition: evPrioritySchedule.h:112
Definition: evVector.h:36
virtual const evString GetClassName(void) const
Definition: evPrioritySchedule.h:42
int Write(const evString filename) const
unsigned int NumDimensions
Definition: evPrioritySchedule.h:110
Definition: evDataObject.h:31
int Length(void) const
void AppendIfUnique(evPriorityScheduleEntry &entry, const unsigned int match_mask)
Definition: evBitBuffer.h:34
int ActivateComponent(const unsigned int component)
void Remove(evPriorityScheduleEntry *entry)
evPriorityScheduleEntry * StartTraversal(void)
Definition: evPrioritySchedule.h:184
evPriorityScheduleEntry * End
Definition: evPrioritySchedule.h:113
int ReadHeader(evFile &infile, int &num_entries)
void Initialize(void)
Definition: evPrioritySchedule.h:130
evPrioritySchedule(void)
Definition: evPrioritySchedule.h:140
void SortedInsert(evPriorityScheduleEntry &entry)
evPriorityScheduleEntry * GetNext(void) const
Definition: evPriorityScheduleEntry.h:388
int WriteHeader(evFile &outfile) const
int ReadData(evBitBuffer &input_buffer, const int num_entries)
evPriorityScheduleEntry * Find(const evPriorityScheduleEntry &entry, const unsigned int match_mask) const
evPriorityScheduleEntry * LastEntry(void) const
Definition: evPrioritySchedule.h:207
void Insert(evPriorityScheduleEntry *insertion_position, evPriorityScheduleEntry &entry)
evPriorityScheduleEntry * FirstEntry(void) const
Definition: evPrioritySchedule.h:201
void Free(void)
Definition: evPrioritySchedule.h:152
void SetNumDimensions(const unsigned int num_dimensions)
Definition: evPrioritySchedule.h:171
int IsEmpty(void) const
Definition: evPrioritySchedule.h:178
static void SelectROI(evPrioritySchedule &inactive_queue, evPrioritySchedule &transmission_queue, evPrioritySchedule &already_sent_queue, const int roi)
Definition: evString.h:30
int MatchAndMoveEntries(evPrioritySchedule &priority_schedule, const evVector &frustum, const double pixel_size, const bool inside, evPrioritySchedule *deactivation_queue)
void Copy(const evPrioritySchedule &priority_schedule)