Evita  0.16
evFieldScaleInfo.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 __evFieldScaleInfo_h
25 #define __evFieldScaleInfo_h
26 
27 
28 #include "evDataObject.h"
29 
30 #include <vector>
31 #include <iostream>
32 #include <iterator>
33 #include <numeric>
34 #include <cstdlib>
35 #include <cmath>
36 
38 {
39  public:
40  evFieldScaleInfo(void);
41  evFieldScaleInfo(const evFieldScaleInfo &scale_info);
42  virtual ~evFieldScaleInfo(void)
43  { }
44 
45  virtual const evString GetClassName(void) const
46  {
47  return(evString("evFieldScaleInfo"));
48  }
49 
50  unsigned int GetNumEntries(void) const;
51 
52  unsigned int FindScale(const unsigned int scale) const;
53 
54  unsigned int GetScale(const unsigned int index) const;
55  void SetScale(const unsigned int index,
56  const unsigned int scale);
57  unsigned int GetStart(const unsigned int index) const;
58  void SetStart(const unsigned int index,
59  const unsigned int start);
60  unsigned int GetLength(const unsigned int index) const;
61  void SetLength(const unsigned int index,
62  const unsigned int length);
63 
64  void Append(const unsigned int scale,
65  const unsigned int start,
66  const unsigned int length);
67 
68  virtual void PrintSelf(const int tabbing) const;
69 
70  protected:
71 
72  private:
73  std::vector<unsigned int> Scale;
74  std::vector<unsigned int> Start;
75  std::vector<unsigned int> Length;
76 };
77 
78 
80 {
81 }
82 
83 
85  Scale(scale_info.Scale),
86  Start(scale_info.Start),
87  Length(scale_info.Length)
88 {
89 }
90 
91 
92 inline unsigned int evFieldScaleInfo::FindScale(const unsigned int scale) const
93 {
94  unsigned int index;
95 
96  for (index = 0; index < this->Scale.size(); index++)
97  if (this->Scale[index] == scale)
98  return(index);
99 
100  return(0);
101 }
102 
103 
104 inline unsigned int evFieldScaleInfo::GetScale(const unsigned int index) const
105 {
106  return(this->Scale[index]);
107 }
108 
109 
110 inline void evFieldScaleInfo::SetScale(const unsigned int index,
111  const unsigned int scale)
112 {
113  this->Scale[index] = scale;
114 }
115 
116 
117 inline unsigned int evFieldScaleInfo::GetStart(const unsigned int index) const
118 {
119  return(this->Start[index]);
120 }
121 
122 
123 inline void evFieldScaleInfo::SetStart(const unsigned int index,
124  const unsigned int start)
125 {
126  this->Start[index] = start;
127 }
128 
129 
130 inline unsigned int evFieldScaleInfo::GetLength(const unsigned int index) const
131 {
132  return(this->Length[index]);
133 }
134 
135 
136 inline void evFieldScaleInfo::SetLength(const unsigned int index,
137  const unsigned int length)
138 {
139  this->Length[index] = length;
140 }
141 
142 
143 inline unsigned int evFieldScaleInfo::GetNumEntries(void) const
144 {
145  return(this->Scale.size());
146 }
147 
148 
149 inline void evFieldScaleInfo::Append(const unsigned int scale,
150  const unsigned int start,
151  const unsigned int length)
152 {
153  this->Scale.push_back(scale);
154  this->Start.push_back(start);
155  this->Length.push_back(length);
156 }
157 
158 
159 inline void evFieldScaleInfo::PrintSelf(const int tabbing) const
160 {
161  if (tabbing > 0)
162  {
163  evPrintWithTab(tabbing, "Scale Info: <Scale, Start, Length>\n");
164  }
165 
166  for (unsigned int index = 0; index < this->Scale.size(); index++)
167  evPrintWithTab(tabbing + 2, "<%d, %d, %d>\n",
168  this->Scale[index],
169  this->Start[index],
170  this->Length[index]);
171 
172 }
173 
174 #endif
void evPrintWithTab(const int tabbing, const char *format,...)
unsigned int GetLength(const unsigned int index) const
Definition: evFieldScaleInfo.h:130
unsigned int GetScale(const unsigned int index) const
Definition: evFieldScaleInfo.h:104
virtual ~evFieldScaleInfo(void)
Definition: evFieldScaleInfo.h:42
Definition: evDataObject.h:31
virtual const evString GetClassName(void) const
Definition: evFieldScaleInfo.h:45
evFieldScaleInfo(void)
Definition: evFieldScaleInfo.h:79
void SetStart(const unsigned int index, const unsigned int start)
Definition: evFieldScaleInfo.h:123
Definition: evFieldScaleInfo.h:37
void SetScale(const unsigned int index, const unsigned int scale)
Definition: evFieldScaleInfo.h:110
unsigned int GetStart(const unsigned int index) const
Definition: evFieldScaleInfo.h:117
std::vector< unsigned int > Length
Definition: evFieldScaleInfo.h:75
virtual void PrintSelf(const int tabbing) const
Definition: evFieldScaleInfo.h:159
void Append(const unsigned int scale, const unsigned int start, const unsigned int length)
Definition: evFieldScaleInfo.h:149
unsigned int GetNumEntries(void) const
Definition: evFieldScaleInfo.h:143
std::vector< unsigned int > Start
Definition: evFieldScaleInfo.h:74
std::vector< unsigned int > Scale
Definition: evFieldScaleInfo.h:73
unsigned int FindScale(const unsigned int scale) const
Definition: evFieldScaleInfo.h:92
void SetLength(const unsigned int index, const unsigned int length)
Definition: evFieldScaleInfo.h:136
Definition: evString.h:30