World Ocean Simulation System (WOSS) library
ac-toolbox-arr-asc-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_ARR_ASC_READER_DEFINITIONS_H
41#define AC_TOOLBOX_ARR_ASC_READER_DEFINITIONS_H
42
43
44#include <fstream>
45#include <stdint.h>
47#include "res-reader.h"
48
49
50namespace woss {
51
52
58 class ArrData {
59
60
61 public:
62
63
64 ArrData();
65
66
70 ~ArrData() { delete[] tx_depths; delete[] rx_ranges; delete[] rx_depths; delete[] arr_values; }
71
72
76 float frequency;
77
78
82 int32_t Nsd;
83
87 float* tx_depths;
88
89
93 int32_t Nrd;
94
98 float* rx_depths;
99
100
104 int32_t Nrr;
105
109 float* rx_ranges;
110
115
116
120 void initialize() { tx_depths = NULL; rx_depths = NULL; rx_ranges = NULL; arr_values = NULL;
121 Nrr = 0; Nrd = 0; Nsd = 0; frequency = 0.0; }
122
123
131 int getTimeArrIndex( double tx_depth, double rx_depth, double rx_range ) const;
132
140 int getIndex( float value, float* array, int array_size ) const;
141
142
143 };
144
145
152 class ArrAscResReader : public ResReader {
153
154
155 public:
156
157
162
167 ArrAscResReader( const Woss* const woss );
168
169 virtual ~ArrAscResReader();
170
171
176 virtual bool initialize();
177
178
190 virtual Pressure* readAvgPressure( double frequency, double tx_depth, double start_rx_depth, double start_rx_range, double end_rx_depth, double end_rx_range );
191
201 virtual Pressure* readPressure( double frequency, double tx_depth, double rx_depth, double rx_range ) const;
202
203
212 virtual TimeArr* readTimeArr( double frequency, double tx_depth, double rx_depth, double rx_range ) const;
213
214
215 protected:
216
217
222
227
228
232 ::std::ifstream file_reader;
233
237 ::std::streampos skip_header;
238
239
244
245 double last_tx_depth;
246
247 double last_start_rx_depth;
248
249 double last_start_rx_range;
250
251 double last_end_rx_depth;
252
253 double last_end_rx_range;
254
255 ::std::complex<double> last_ret_value;
256
265 TimeArr* accessMap( double frequency, double tx_depth, double rx_depth, double rx_range ) const {
266 return( arr_file.arr_values + arr_file.getTimeArrIndex( tx_depth, rx_depth, rx_range ) );
267 }
268
269
280 ::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 );
281
282
287 bool getArrAscHeader();
288
293 bool getArrAscFile();
294
295
296 };
297
298
299}
300
301
302#endif /* AC_TOOLBOX_ARR_ASC_READER_DEFINITIONS_H */
303
304
305
306
Class for reading and manipulating results provided by any acoustic toolbox textual ARR file.
Definition ac-toolbox-arr-asc-reader.h:152
bool getArrAscFile()
Definition ac-toolbox-arr-asc-reader.cpp:276
virtual bool initialize()
Definition ac-toolbox-arr-asc-reader.cpp:147
ArrData arr_file
Definition ac-toolbox-arr-asc-reader.h:243
virtual Pressure * readPressure(double frequency, double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-arr-asc-reader.cpp:410
TimeArr * accessMap(double frequency, double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-arr-asc-reader.h:265
bool getArrAscHeader()
Definition ac-toolbox-arr-asc-reader.cpp:155
::std::ifstream file_reader
Definition ac-toolbox-arr-asc-reader.h:232
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-arr-asc-reader.cpp:415
::std::streampos skip_header
Definition ac-toolbox-arr-asc-reader.h:237
virtual TimeArr * readTimeArr(double frequency, double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-arr-asc-reader.cpp:421
bool arr_asc_header_collected
Definition ac-toolbox-arr-asc-reader.h:221
ArrAscResReader()
Definition ac-toolbox-arr-asc-reader.cpp:106
::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)
Definition ac-toolbox-arr-asc-reader.cpp:427
bool arr_asc_file_collected
Definition ac-toolbox-arr-asc-reader.h:226
class for storing data of any acoustic toolbox ARR file
Definition ac-toolbox-arr-asc-reader.h:58
float frequency
Definition ac-toolbox-arr-asc-reader.h:76
TimeArr * arr_values
Definition ac-toolbox-arr-asc-reader.h:114
int getTimeArrIndex(double tx_depth, double rx_depth, double rx_range) const
Definition ac-toolbox-arr-asc-reader.cpp:91
int32_t Nsd
Definition ac-toolbox-arr-asc-reader.h:82
float * rx_ranges
Definition ac-toolbox-arr-asc-reader.h:109
void initialize()
Definition ac-toolbox-arr-asc-reader.h:120
float * rx_depths
Definition ac-toolbox-arr-asc-reader.h:98
~ArrData()
Definition ac-toolbox-arr-asc-reader.h:70
float * tx_depths
Definition ac-toolbox-arr-asc-reader.h:87
int32_t Nrr
Definition ac-toolbox-arr-asc-reader.h:104
int getIndex(float value, float *array, int array_size) const
Definition ac-toolbox-arr-asc-reader.cpp:68
int32_t Nrd
Definition ac-toolbox-arr-asc-reader.h:93
Complex attenuated pressure class.
Definition pressure-definitions.h:59
Abstract class for channel simulator result files processing.
Definition res-reader.h:59
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:94
Provides the interface for woss::ResReader class.
Definitions and library for woss::TimeArr class.