World Ocean Simulation System (WOSS) library
ac-toolbox-shd-reader.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - federico@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program 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 this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22/*
23 * This software has been developed by Federico Guerra and SIGNET lab,
24 * University of Padova, in collaboration with the NATO Centre for
25 * Maritime Research and Experimentation (http://www.cmre.nato.int ;
26 * E-mail: pao@cmre.nato.int), whose support is gratefully acknowledged.
27 */
28
29
40#ifndef AC_TOOLBOX_RES_READER_DEFINITIONS_H
41#define AC_TOOLBOX_RES_READER_DEFINITIONS_H
42
43
44#include <fstream>
46#include "res-reader.h"
47
48
49namespace woss {
50
51
57 class ShdData {
58
59
60 public:
61
62
63 ShdData();
64
68 ~ShdData() { delete[] theta; delete[] tx_depths; delete[] rx_ranges;
69 delete[] rx_depths; delete[] press_values; }
70
75
76
80 char* plot_type;
81
82
86 float frequency;
87
91 int32_t Ntheta;
92
96 float* theta;
97
98
102 int32_t Nsd;
103
107 float* tx_depths;
108
109
113 int32_t Nrd;
114
118 float* rx_depths;
119
120
124 int32_t Nrr;
125
129 float* rx_ranges;
130
135
136
140 ::std::complex<double>* press_values;
141
142
146 void initialize() { plot_type = NULL; Ntheta = 0; theta = NULL; Nrx_per_range = 0; record_length = 0; tx_depths = NULL;
147 rx_depths = NULL; rx_ranges = NULL; Nrr = 0; Nrd = 0; Nsd = 0; press_values = NULL; frequency = 0.0; }
148
149
158 int getPressureIndex( double tx_depth, double rx_depth, double rx_range, double theta = 0.0 ) const;
159
167 int getIndex( float value, float* array, int32_t array_size ) const;
168
169 };
170
177
178 public:
179
180 ShdData_v1();
181
185 ~ShdData_v1() { delete[] frequencies; delete[] theta; delete[] tx_depths; delete[] rx_ranges;
186 delete[] rx_depths; delete[] press_values; }
187
192
193
198
199
203 double frequency;
204
205 int32_t Nfreq;
206
207 double* frequencies;
208
212 int32_t Ntheta;
213
217 double* theta;
218
219
223 int32_t Nsd;
224
228 float* tx_depths;
229
230
234 int32_t Nrd;
235
239 float* rx_depths;
240
241
245 int32_t Nrr;
246
250 double* rx_ranges;
251
256
257 double stabil_atten;
258
262 ::std::complex<double>* press_values;
263
264
268 void initialize() { plot_type = NULL; frequency = 0.0; Nfreq = 0; frequencies = NULL; Ntheta = 0;
269 theta = NULL; Nrx_per_range = 0; record_length = 0; tx_depths = NULL; stabil_atten = 0.0;
270 rx_depths = NULL; rx_ranges = NULL; Nrr = 0; Nrd = 0; Nsd = 0; press_values = NULL; }
271
272
282 int getPressureIndex( double tx_freq, double tx_depth, double rx_depth, double rx_range, double theta = 0.0 ) const;
283
291 int getIndex( float value, float* array, int32_t array_size ) const;
292
300 int getIndex( double value, double* array, int32_t array_size ) const;
301 };
302
309 class ShdResReader : public ResReader {
310
311
312 public:
313
314
318 ShdResReader();
319
324 ShdResReader( const Woss* const woss );
325
326 virtual ~ShdResReader();
327
332 virtual bool initialize();
333
344 virtual Pressure* readAvgPressure( double frequency, double tx_depth, double start_rx_depth, double start_rx_range, double end_rx_depth, double end_rx_range );
345
354 virtual Pressure* readPressure( double frequency, double tx_depth, double rx_depth, double rx_range ) const;
355
356
366 virtual TimeArr* readTimeArr( double frequency, double tx_depth, double rx_depth, double rx_range ) const;
367
368
369 protected:
370
371
376
381
382
386 ::std::ifstream file_reader;
387
388
393
398
399 double last_tx_depth;
400
401 double last_start_rx_depth;
402
403 double last_start_rx_range;
404
405 double last_end_rx_depth;
406
407 double last_end_rx_range;
408
409 ::std::complex<double> last_ret_value;
410
411
423 ::std::complex<double> readMapAvgPressure(double frequency, double tx_depth, double start_rx_depth, double start_rx_range, double end_rx_depth, double end_rx_range, double theta = 0.0 );
424
425
435 ::std::complex<double> accessMap(double frequency, double tx_depth, double rx_depth, double rx_range, double theta = 0.0 ) const;
436
437
442 bool getShdFile();
443
448 bool getShdHeader();
449
450
451 };
452
453}
454
455
456#endif /* AC_TOOLBOX_RES_READER_DEFINITIONS_H */
457
458
Complex attenuated pressure class.
Definition pressure-definitions.h:59
Abstract class for channel simulator result files processing.
Definition res-reader.h:59
class for storing data of any acoustic toolbox SHD file
Definition ac-toolbox-shd-reader.h:176
char * plot_type
Definition ac-toolbox-shd-reader.h:197
double frequency
Definition ac-toolbox-shd-reader.h:203
~ShdData_v1()
Definition ac-toolbox-shd-reader.h:185
::std::complex< double > * press_values
Definition ac-toolbox-shd-reader.h:262
float * rx_depths
Definition ac-toolbox-shd-reader.h:239
int32_t Ntheta
Definition ac-toolbox-shd-reader.h:212
int32_t Nrx_per_range
Definition ac-toolbox-shd-reader.h:255
int32_t Nrr
Definition ac-toolbox-shd-reader.h:245
int32_t Nrd
Definition ac-toolbox-shd-reader.h:234
double * theta
Definition ac-toolbox-shd-reader.h:217
int getPressureIndex(double tx_freq, double tx_depth, double rx_depth, double rx_range, double theta=0.0) const
Definition ac-toolbox-shd-reader.cpp:153
int getIndex(float value, float *array, int32_t array_size) const
Definition ac-toolbox-shd-reader.cpp:123
int32_t record_length
Definition ac-toolbox-shd-reader.h:191
double * rx_ranges
Definition ac-toolbox-shd-reader.h:250
int32_t Nsd
Definition ac-toolbox-shd-reader.h:223
void initialize()
Definition ac-toolbox-shd-reader.h:268
float * tx_depths
Definition ac-toolbox-shd-reader.h:228
class for storing data of any acoustic toolbox SHD file
Definition ac-toolbox-shd-reader.h:57
int32_t Nrd
Definition ac-toolbox-shd-reader.h:113
int getPressureIndex(double tx_depth, double rx_depth, double rx_range, double theta=0.0) const
Definition ac-toolbox-shd-reader.cpp:91
float * tx_depths
Definition ac-toolbox-shd-reader.h:107
float * theta
Definition ac-toolbox-shd-reader.h:96
int32_t Nrx_per_range
Definition ac-toolbox-shd-reader.h:134
~ShdData()
Definition ac-toolbox-shd-reader.h:68
::std::complex< double > * press_values
Definition ac-toolbox-shd-reader.h:140
int32_t Nsd
Definition ac-toolbox-shd-reader.h:102
float frequency
Definition ac-toolbox-shd-reader.h:86
int32_t record_length
Definition ac-toolbox-shd-reader.h:74
float * rx_ranges
Definition ac-toolbox-shd-reader.h:129
int32_t Ntheta
Definition ac-toolbox-shd-reader.h:91
void initialize()
Definition ac-toolbox-shd-reader.h:146
int32_t Nrr
Definition ac-toolbox-shd-reader.h:124
int getIndex(float value, float *array, int32_t array_size) const
Definition ac-toolbox-shd-reader.cpp:76
float * rx_depths
Definition ac-toolbox-shd-reader.h:118
char * plot_type
Definition ac-toolbox-shd-reader.h:80
Class for reading and manipulating results provided by any acoustic toolbox SHD file.
Definition ac-toolbox-shd-reader.h:309
virtual bool initialize()
Definition ac-toolbox-shd-reader.cpp:208
ShdData shd_file
Definition ac-toolbox-shd-reader.h:392
virtual Pressure * readPressure(double frequency, double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-shd-reader.cpp:532
virtual TimeArr * readTimeArr(double frequency, double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-shd-reader.cpp:538
bool shd_header_collected
Definition ac-toolbox-shd-reader.h:375
::std::complex< double > accessMap(double frequency, double tx_depth, double rx_depth, double rx_range, double theta=0.0) const
Definition ac-toolbox-shd-reader.cpp:544
bool getShdHeader()
Definition ac-toolbox-shd-reader.cpp:216
virtual Pressure * readAvgPressure(double frequency, double tx_depth, double start_rx_depth, double start_rx_range, double end_rx_depth, double end_rx_range)
Definition ac-toolbox-shd-reader.cpp:526
::std::ifstream file_reader
Definition ac-toolbox-shd-reader.h:386
bool shd_file_collected
Definition ac-toolbox-shd-reader.h:380
bool getShdFile()
Definition ac-toolbox-shd-reader.cpp:393
ShdResReader()
Definition ac-toolbox-shd-reader.cpp:167
::std::complex< double > readMapAvgPressure(double frequency, double tx_depth, double start_rx_depth, double start_rx_range, double end_rx_depth, double end_rx_range, double theta=0.0)
Definition ac-toolbox-shd-reader.cpp:561
ShdData_v1 shd_file_v1
Definition ac-toolbox-shd-reader.h:397
Channel power delay profile class.
Definition time-arrival-definitions.h:82
Abstract class that provides the interface for initializing and running a channel simulator.
Definition woss.h:89
Provides the interface for woss::ResReader class.
Definitions and library for woss::TimeArr class.