WSF
WsfGraduatedLethality.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
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 WSFGRADUATEDLETHALITY_HPP
13#define WSFGRADUATEDLETHALITY_HPP
14
15#include "wsf_mil_export.h"
16
17#include <vector>
18
20
34
36{
37public:
39 ~WsfGraduatedLethality() override = default;
40 WsfWeaponEffects* Clone() const override;
41 bool PreInitialize() override;
42 bool ProcessInput(UtInput& aInput) override;
43
46 class Point
47 {
48 public:
50 : mRSqrd(0.0)
51 , mPk(0.0)
52 {
53 }
54 Point(double aRadius, double aPk)
55 : mRSqrd(aRadius * aRadius)
56 , mPk(aPk)
57 {
58 }
59 double RadSqrd() const { return mRSqrd; }
60 double Pk() const { return mPk; }
61 void Set(double aRadius, double aPk)
62 {
63 mRSqrd = aRadius * aRadius;
64 mPk = aPk;
65 }
66 // operator< is required for sort() algorithm.
67 bool operator<(const Point& rhs) const { return mRSqrd < rhs.mRSqrd; }
68
69 private:
70 double mRSqrd;
71 double mPk;
72 };
73
74 using Points = std::vector<Point>;
75 using PointsIter = std::vector<Point>::iterator;
76 using PointsConstIter = std::vector<Point>::const_iterator;
77
80 class Table
81 {
82 public:
83 Table();
84 Table(WsfStringId aTypeId);
85 Table(const Table& aSrc) = default;
86 Table& operator=(const Table&) = delete;
87 WsfStringId TypeId() const { return mTypeId; }
88 unsigned int Size() const { return static_cast<unsigned int>(mValues.size()); }
89 double GetPk(double aMissDistSquared, bool aInterpolate) const;
90 const Point& Pt(unsigned int aIndex) const { return mValues[aIndex]; }
91 const Points& Pts() const { return mValues; }
92 void AddPoint(const Point& aPoint) { mValues.push_back(aPoint); }
93 void SetPoint(unsigned int aIndex, double aRadius, double aPk) { mValues[aIndex].Set(aRadius, aPk); }
94 bool Sort(double& aMaxRSquared);
95
96 private:
97 WsfStringId mTypeId;
98 bool mCanInterpolate; // Interpolation is possible (if requested)
99 Points mValues;
100 };
101
102 using Tables = std::vector<Table>;
103
104protected:
106
109
110 void CalcInterceptPk(double aSimTime, WsfPlatform* aTargetPtr) override;
111
112private:
113 void AddPoint(double aRadius, double aPk);
114 void FindTable(WsfPlatform* aTargetPtr);
115 double GetPk(double aMissDistSquared) const;
116 void ProcessBlock(UtInput& aInput);
117 bool ReadPkAndRadius(UtInput& aInput);
118 bool TableExistsForType(WsfStringId aTypeId) const;
119
120 // Flag indicates that the miss radii are 2-D rather than 3-D (default = false).
121 bool m2DOffsets;
122
123 // Flag indicates that the Pk's are continuously interpolated,
124 // versus discrete (the default).
125 bool mPkInterp;
126 bool mDefIsNull;
127
128 Tables mTables;
129 unsigned int mTableIndex;
130};
131
132#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
void CalcInterceptPk(double aSimTime, WsfPlatform *aTargetPtr) override
Definition WsfExplicitWeaponEffects.cpp:90
bool ProcessInput(UtInput &aInput) override
Definition WsfExplicitWeaponEffects.cpp:65
WsfExplicitWeaponEffects(WsfScenario &aScenario)
Definition WsfExplicitWeaponEffects.cpp:29
WsfWeaponEffects * Clone() const override
Definition WsfExplicitWeaponEffects.cpp:39
Definition WsfGraduatedLethality.hpp:47
double Pk() const
Definition WsfGraduatedLethality.hpp:60
double RadSqrd() const
Definition WsfGraduatedLethality.hpp:59
bool operator<(const Point &rhs) const
Definition WsfGraduatedLethality.hpp:67
Point(double aRadius, double aPk)
Definition WsfGraduatedLethality.hpp:54
Point()
Definition WsfGraduatedLethality.hpp:49
void Set(double aRadius, double aPk)
Definition WsfGraduatedLethality.hpp:61
Table & operator=(const Table &)=delete
void SetPoint(unsigned int aIndex, double aRadius, double aPk)
Definition WsfGraduatedLethality.hpp:93
Table()
Definition WsfGraduatedLethality.cpp:359
Table(const Table &aSrc)=default
const Point & Pt(unsigned int aIndex) const
Definition WsfGraduatedLethality.hpp:90
const Points & Pts() const
Definition WsfGraduatedLethality.hpp:91
WsfStringId TypeId() const
Definition WsfGraduatedLethality.hpp:87
unsigned int Size() const
Definition WsfGraduatedLethality.hpp:88
void AddPoint(const Point &aPoint)
Definition WsfGraduatedLethality.hpp:92
WsfGraduatedLethality(WsfScenario &aScenario)
Default constructor.
Definition WsfGraduatedLethality.cpp:25
std::vector< Point >::iterator PointsIter
Definition WsfGraduatedLethality.hpp:75
std::vector< Point >::const_iterator PointsConstIter
Definition WsfGraduatedLethality.hpp:76
WsfGraduatedLethality & operator=(const WsfGraduatedLethality &aRhs)=delete
Prevent use of operator= by declaring, but not defining.
std::vector< Table > Tables
Definition WsfGraduatedLethality.hpp:102
std::vector< Point > Points
Definition WsfGraduatedLethality.hpp:74
~WsfGraduatedLethality() override=default
WsfGraduatedLethality(const WsfGraduatedLethality &aSrc)=default
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
virtual bool PreInitialize()
Definition WsfWeaponEffects.cpp:125
WsfWeaponEffects(WsfScenario &aScenario)
Definition WsfWeaponEffects.cpp:51
Copyrights Multiple, All Rights Reserved