KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
GridAxisRegular.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: GridAxisRegular
32  created: 26/10/2009
33  author: Karl Jones
34 
35  purpose: The Grid Axis Descriptor record provides detailed information about each grid axes and grid location
36  coordinates for environmental state variables for use in the Gridded Data PDU.
37  This record provides for the representation of grids with constant spacing or variable spacing.
38  This record shall contain information about the coordinate of the origin and endpoint of the axis,
39  the number of grid points along the axis, the inter leaf factor, the axis type, number of axis
40  grid points and the coordinate scale factor, the coordinate offset value, and the grid location coordinates.
41 
42  In the following descriptions, domain shall refer to the entire volume for which gridded data are to be transmitted.
43  This region shall be defined by specifying the origin and endpoint for each grid axis. Use of x, y, and
44  z to denote the three coordinates of a grid point is for convenience and does not imply the sole use of Cartesian
45  coordinates. A more general coordinate representation (x1, x2, x3) or xi is used in the tables to provide
46  generality. Since a region may be sufficiently large to require distribution via multiple Gridded Data PDUs,
47  any reference to PDU refers to data contained only within the current Gridded Data PDU. Volumetric gridded
48  data shall be transmitted over multiple Gridded Data PDUs with each PDU containing data for subsets
49  of the volume selected by horizontal, vertical, or volume sampling.
50 
51  size: 192 bits / 24 octets
52 *********************************************************************/
53 
54 #pragma once
55 
56 #include "./DataTypeBase.h"
57 
58 namespace KDIS {
59 namespace DATA_TYPE {
60 
62 {
63 protected:
64 
66 
68 
70 
72 
74 
76 
78 
79 public:
80 
81 #define GRID_AXIS_REGULAR 24
82 
83  GridAxisRegular();
84 
85  GridAxisRegular( KDataStream & stream ) throw( KException );
86 
87  // This constructor is used by the Gridded_Data_PDU. In order to know if a grid axis is regular or irregular
88  // we must first decode 4 other values before we can get to the AxisType value. So this constructor is here to aid in this process.
89  GridAxisRegular( KFLOAT64 InitialXi, KFLOAT64 FinalXi, KUINT16 PointsXi, KUINT8 InterleafFactor,
90  KUINT8 AxisType, KDataStream & stream );
91 
92  GridAxisRegular( KFLOAT64 InitialXi, KFLOAT64 FinalXi, KUINT16 PointsXi, KUINT8 InterleafFactor,
93  KUINT8 AxisType, KUINT16 NumPoints, KUINT16 InitialIndexXi );
94 
95  virtual ~GridAxisRegular();
96 
97  //************************************
98  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetDomainInitialXi
99  // KDIS::DATA_TYPE::GridAxisRegular::GetDomainInitialXi
100  //!Description: Specifies the coordinate of the origin (or initial value) for the Xi axis
101  //! for the environmental state variable data contained within the bounding domain.
102  // Parameter: KFLOAT64 Xi, void
103  //************************************
104  void SetDomainInitialXi( KFLOAT64 Xi );
105  KFLOAT64 GetDomainInitialXi() const;
106 
107  //************************************
108  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetDomainFinalXi
109  // KDIS::DATA_TYPE::GridAxisRegular::GetDomainFinalXi
110  //!Description: Specifies the coordinate of the endpoint (or Final value) for the Xi axis
111  //! for the environmental state variable data contained within the bounding domain.
112  // Parameter: KFLOAT64 Xi, void
113  //************************************
114  void SetDomainFinalXi( KFLOAT64 Xi );
115  KFLOAT64 GetDomainFinalXi() const;
116 
117  //************************************
118  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetDomainPointsXi
119  // KDIS::DATA_TYPE::GridAxisRegular::GetDomainPoints
120  //!Description: Specifies the number of grid points along the Xi domain axis for the environmental
121  //! state variable data.
122  //! This number may exceed the number of points along an axis for a single Gridded
123  //! Data PDU if there are multiple PDUs being issued to contain all the data.
124  // Parameter: KUINT16 Xi, void
125  //************************************
126  void SetDomainPointsXi( KUINT16 Xi );
127  KUINT16 GetDomainPoints() const;
128 
129  //************************************
130  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetInterleafFactor
131  // KDIS::DATA_TYPE::GridAxisRegular::GetInterleafFactor
132  //!Description: Specifies the inter leaf factor along a domain (grid) axis.
133  //! A value of one shall indicate no sub-sampling (interleaving), while values
134  //! greater than one shall indicate the sampling frequency along an axis.
135  // Parameter: KUINT8 IF, void
136  //************************************
137  void SetInterleafFactor( KUINT8 IF );
138  KUINT8 GetInterleafFactor() const;
139 
140  //************************************
141  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetAxisType
142  // KDIS::DATA_TYPE::GridAxisRegular::GetAxisType
143  //!Description: Specifies the type of grid axis represented.
144  //! A value of zero shall indicate a grid axis with constant grid
145  //! spacing (a regular axis), while a value of one shall indicate
146  //! a grid axis with variable grid spacing (an irregular axis).
147  // Parameter: KUINT8 AT, void
148  //************************************
149  void SetAxisType( KUINT8 AT );
150  KUINT8 GetAxisType() const;
151 
152  //************************************
153  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetNumberOfPointsOnXiAxis
154  // KDIS::DATA_TYPE::GridAxisRegular::GetNumberOfPointsOnXiAxis
155  //!Description: Specifies the number of grid locations along the Xi axis for the
156  //! environmental state variable data contained within the current PDU.
157  // Parameter: KUINT16 NP, void
158  //************************************
159  void SetNumberOfPointsOnXiAxis( KUINT16 NP );
160  KUINT16 GetNumberOfPointsOnXiAxis() const;
161 
162  //************************************
163  // FullName: KDIS::DATA_TYPE::GridAxisRegular::SetInitialIndexXi
164  // KDIS::DATA_TYPE::GridAxisRegular::GetInitialIndexXi
165  //!Description: Specifies the index of the initial grid point for the current PDU
166  //! along the Xi domain axis. A value of zero shall indicate that the
167  //! PDU grid and the domain grid have the same initial point.
168  // Parameter: KUINT16 I, void
169  //************************************
170  void SetInitialIndexXi( KUINT16 I );
171  KUINT16 GetInitialIndexXi() const;
172 
173  //************************************
174  // FullName: KDIS::DATA_TYPE::GridAxisRegular::GetAsString
175  //!Description: If false then this is in fact a derived GridAxisIrregular instance and can be safely
176  //! up cast for access to the additional fields.
177  //************************************
178  virtual KBOOL IsGridRegular() const;
179 
180  //************************************
181  // FullName: KDIS::DATA_TYPE::GridAxisRegular::GetAsString
182  //!Description: Returns length in octets, used for determining the PDU length.
183  //************************************
184  virtual KUINT16 GetLength();
185 
186  //************************************
187  // FullName: KDIS::DATA_TYPE::GridAxisRegular::GetAsString
188  //!Description: Returns a string representation
189  //************************************
190  virtual KString GetAsString() const;
191 
192  //************************************
193  // FullName: KDIS::DATA_TYPE::GridAxisRegular::Decode
194  //!Description: Convert From Network Data.
195  // Parameter: KDataStream & stream
196  //************************************
197  virtual void Decode( KDataStream & stream ) throw( KException );
198 
199  //************************************
200  // FullName: KDIS::DATA_TYPE::GridAxisRegular::Encode
201  //!Description: Convert To Network Data.
202  // Parameter: KDataStream & stream
203  //************************************
204  virtual KDataStream Encode() const;
205  virtual void Encode( KDataStream & stream ) const;
206 
207  KBOOL operator == ( const GridAxisRegular & Value ) const;
208  KBOOL operator != ( const GridAxisRegular & Value ) const;
209 };
210 
211 } // END namespace DATA_TYPES
212 } // END namespace KDIS
213 
KUINT16 m_ui16InitialIndex
Definition: GridAxisRegular.h:77
unsigned short int KUINT16
Definition: KDefines.h:101
KUINT8 m_ui8InterleafFactor
Definition: GridAxisRegular.h:71
Definition: GridAxisRegular.h:61
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
KUINT8 m_ui8AxisType
Definition: GridAxisRegular.h:73
KFLOAT64 m_f64DomainFinalXi
Definition: GridAxisRegular.h:67
std::string KString
Definition: KDefines.h:116
double KFLOAT64
Definition: KDefines.h:114
unsigned char KUINT8
Definition: KDefines.h:99
#define KDIS_EXPORT
Definition: KDefines.h:82
KUINT16 m_ui16DomainPointsXi
Definition: GridAxisRegular.h:69
KFLOAT64 m_f64DomainInitialXi
Definition: GridAxisRegular.h:65
KUINT16 m_ui16NumPoints
Definition: GridAxisRegular.h:75