A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-converter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
9#ifndef SPECTRUM_CONVERTER_H
10#define SPECTRUM_CONVERTER_H
11
12#include "spectrum-value.h"
13
14namespace ns3
15{
16
17/**
18 * @ingroup spectrum
19 *
20 * Class which implements a converter between SpectrumValue which are
21 * defined over different SpectrumModel. In more formal terms, this class
22 * allows conversion between different function spaces. In practical
23 * terms, this allows you to mix different spectrum representation
24 * within the same channel, such as a device using a coarse spectrum
25 * representation (e.g., one frequency for each IEEE 802.11 channel)
26 * and devices using a finer representation (e.g., one frequency for
27 * each OFDM subcarrier).
28 *
29 */
30class SpectrumConverter : public SimpleRefCount<SpectrumConverter>
31{
32 public:
33 /**
34 * Create a SpectrumConverter class that will be able to convert ValueVsFreq
35 * instances defined over one SpectrumModel to corresponding ValueVsFreq
36 * instances defined over a different SpectrumModel
37 *
38 * @param fromSpectrumModel the SpectrumModel to convert from
39 * @param toSpectrumModel the SpectrumModel to convert to
40 */
42 Ptr<const SpectrumModel> toSpectrumModel);
43
44 /**
45 * Convert a particular ValueVsFreq instance to
46 *
47 * @param vvf the ValueVsFreq instance to be converted
48 *
49 * @return the converted version of the provided ValueVsFreq
50 */
52
53 private:
54 std::vector<double> m_conversionMatrix; //!< matrix of conversion coefficients stored in
55 //!< Compressed Row Storage format
56 std::vector<size_t> m_conversionRowPtr; //!< offset of rows in m_conversionMatrix
57 std::vector<size_t>
58 m_conversionColInd; //!< column of each non-zero element in m_conversionMatrix
59
60 Ptr<const SpectrumModel> m_fromSpectrumModel; //!< the SpectrumModel this SpectrumConverter
61 //!< instance can convert from
63 m_toSpectrumModel; //!< the SpectrumModel this SpectrumConverter instance can convert to
64};
65
66} // namespace ns3
67
68#endif /* SPECTRUM_CONVERTER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
std::vector< double > m_conversionMatrix
matrix of conversion coefficients stored in Compressed Row Storage format
Ptr< const SpectrumModel > m_fromSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert from
SpectrumConverter(Ptr< const SpectrumModel > fromSpectrumModel, Ptr< const SpectrumModel > toSpectrumModel)
Create a SpectrumConverter class that will be able to convert ValueVsFreq instances defined over one ...
Ptr< const SpectrumModel > m_toSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert to
Ptr< SpectrumValue > Convert(Ptr< const SpectrumValue > vvf) const
Convert a particular ValueVsFreq instance to.
std::vector< size_t > m_conversionRowPtr
offset of rows in m_conversionMatrix
std::vector< size_t > m_conversionColInd
column of each non-zero element in m_conversionMatrix
Every class exported by the ns3 library is enclosed in the ns3 namespace.