WSF
SOSM_ScalarTable2D.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef SOSM_SCALARTABLE2D_HPP
13#define SOSM_SCALARTABLE2D_HPP
14
15#include <map>
16#include <memory>
17#include <string>
18#include <vector>
19
20class SOSM_Manager;
21#include "SOSM_TableVar.hpp"
22#include "TblLookup.hpp"
23
25{
26public:
27 using TablePtr = std::shared_ptr<SOSM_ScalarTable2D>;
28
29 SOSM_ScalarTable2D(SOSM_Manager* aManagerPtr);
30
31 // Using default copy constructor.
32 // SOSM_ScalarTable2D(const SOSM_SpectralTable2D& aSrc);
33
34 static TablePtr LoadSharedPolarTable(SOSM_Manager* aManagerPtr,
35 const std::string& aFileName,
36 const std::string& aCachePrefix,
37 const SOSM_TableVar& aDV_Info);
38
40 double GetModificationTime() const { return mModificationTime; }
41
43 const std::vector<float>& DV() const { return mDV; }
44
46 std::vector<float>& DV() { return mDV; }
47
49 const TblIndVarU<float>& IV1() const { return mIV1; }
50
52 TblIndVarU<float>& IV1() { return mIV1; }
53
55 const TblIndVarU<float>& IV2() const { return mIV2; }
56
58 TblIndVarU<float>& IV2() { return mIV2; }
59
61 void SetDV_Info(const SOSM_TableVar& aDV_Info) { mDV_Info = aDV_Info; }
62
64 void SetIV1_Info(const SOSM_TableVar& aIV1_Info) { mIV1_Info = aIV1_Info; }
65
67 void SetIV2_Info(const SOSM_TableVar& aIV2_Info) { mIV2_Info = aIV2_Info; }
68
69 float Interpolate(const TblLookupL<float>& aIV1_Lookup, const TblLookupL<float>& aIV2_Lookup) const;
70
76 void PolarLookup(TblLookupLU<float>& aAzLookup, TblLookupLU<float>& aElLookup, float aAzimuth, float aElevation) const
77 {
78 // Check if table has implied azimuth symmetry (i.e. - first value is non-negative).
79 float tempAzimuth = aAzimuth;
80 if ((aAzimuth < 0.0F) && (mIV1.Get(0) >= 0.0F))
81 {
82 tempAzimuth = -aAzimuth;
83 }
84 aAzLookup.Lookup(mIV1, tempAzimuth);
85 aElLookup.Lookup(mIV2, aElevation);
86 }
87
88 void Load(const std::string& aFileName, const std::string& aCachePrefix);
89
90 void LoadTextFile(const std::string& aFileName);
91
92 void LoadBinaryFile(const std::string& aFileName);
93
94 void SaveBinaryFile(const std::string& aFileName);
95
96private:
97 void ValidateAndScale_IV(TblIndVarU<float>& aIV, const SOSM_TableVar& aIV_Info);
98
99 SOSM_Manager* mManagerPtr;
100
102 std::string mFileName;
103
105 double mModificationTime;
106
108 std::string mUserIdent[3];
109
111 SOSM_TableVar mDV_Info;
112 std::vector<float> mDV;
113
115 SOSM_TableVar mIV1_Info;
116 TblIndVarU<float> mIV1;
117
119 SOSM_TableVar mIV2_Info;
120 TblIndVarU<float> mIV2;
121
131
132 typedef std::map<std::string, TablePtr> TableMap;
133
135 static TableMap sSharedPolarTables;
137};
138
139#endif
A singleton class that manages SOSM data.
Definition SOSM_Manager.hpp:32
void PolarLookup(TblLookupLU< float > &aAzLookup, TblLookupLU< float > &aElLookup, float aAzimuth, float aElevation) const
Definition SOSM_ScalarTable2D.hpp:76
std::vector< float > & DV()
Return the dependent variable (non-const form).
Definition SOSM_ScalarTable2D.hpp:46
float Interpolate(const TblLookupL< float > &aIV1_Lookup, const TblLookupL< float > &aIV2_Lookup) const
Definition SOSM_ScalarTable2D.cpp:234
TblIndVarU< float > & IV1()
Return the independent variable 1 values (non-const form).
Definition SOSM_ScalarTable2D.hpp:52
void LoadBinaryFile(const std::string &aFileName)
Definition SOSM_ScalarTable2D.cpp:190
TblIndVarU< float > & IV2()
Return the independent variable 2 values (non-const form).
Definition SOSM_ScalarTable2D.hpp:58
double GetModificationTime() const
Return when the source file from which the object was recreated was last modified.
Definition SOSM_ScalarTable2D.hpp:40
const TblIndVarU< float > & IV1() const
Return the independent variable 1 values (const form).
Definition SOSM_ScalarTable2D.hpp:49
SOSM_ScalarTable2D(SOSM_Manager *aManagerPtr)
Definition SOSM_ScalarTable2D.cpp:29
const std::vector< float > & DV() const
Return the dependent variable (const form).
Definition SOSM_ScalarTable2D.hpp:43
void SetIV1_Info(const SOSM_TableVar &aIV1_Info)
Set the name, limits and scale for independent variable 1.
Definition SOSM_ScalarTable2D.hpp:64
void LoadTextFile(const std::string &aFileName)
Definition SOSM_ScalarTable2D.cpp:98
void SetDV_Info(const SOSM_TableVar &aDV_Info)
Set the name, limits and scale for the dependent variable.
Definition SOSM_ScalarTable2D.hpp:61
static TablePtr LoadSharedPolarTable(SOSM_Manager *aManagerPtr, const std::string &aFileName, const std::string &aCachePrefix, const SOSM_TableVar &aDV_Info)
Definition SOSM_ScalarTable2D.cpp:36
const TblIndVarU< float > & IV2() const
Return the independent variable 2 values (const form).
Definition SOSM_ScalarTable2D.hpp:55
void SaveBinaryFile(const std::string &aFileName)
Definition SOSM_ScalarTable2D.cpp:214
void SetIV2_Info(const SOSM_TableVar &aIV2_Info)
Set the name, limits and scale for independent variable 2.
Definition SOSM_ScalarTable2D.hpp:67
void Load(const std::string &aFileName, const std::string &aCachePrefix)
Definition SOSM_ScalarTable2D.cpp:61
std::shared_ptr< SOSM_ScalarTable2D > TablePtr
Definition SOSM_ScalarTable2D.hpp:27
A helper class for specifying data to the table loaders.
Definition SOSM_TableVar.hpp:17
Copyrights Multiple, All Rights Reserved