12#ifndef WSFLOSMANAGER_HPP
13#define WSFLOSMANAGER_HPP
15#include "wsf_export.h"
22#include "UtCallbackHolder.hpp"
82 bool ProcessInput(UtInput& aInput)
override;
108 void Update(
double aSimTime);
120 bool IsTargetVisible(
WsfPlatform* aPlatformPtr,
WsfPlatform* aTargetPtr,
double aMaxRange = 0.0,
double aRadiusScale = 1.0);
122 bool IsTargetVisible(
WsfEM_Antenna* aAntennaPtr,
WsfPlatform* aTargetPtr,
double aMaxRange = 0.0,
double aRadiusScale = 1.0);
126 double aMaxRange = 0.0,
127 double aRadiusScale = 1.0);
133 bool MaskedByTerrain(
WsfPlatform* aPlatformPtr,
WsfPlatform* aTargetPtr,
double aMaxRange = 0.0,
double aRadiusScale = 1.0);
135 bool MaskedByTerrain(
WsfEM_Antenna* aAntennaPtr,
WsfPlatform* aTargetPtr,
double aMaxRange = 0.0,
double aRadiusScale = 1.0);
139 double aMaxRange = 0.0,
140 double aRadiusScale = 1.0);
149 double aMaxRange = 0.0,
150 double aRadiusScale = 1.0);
154 double aMaxRange = 0.0,
155 double aRadiusScale = 1.0);
159 double aMaxRange = 0.0,
160 double aRadiusScale = 1.0);
174 UtVec3d::Set(
mLLA, 0.0);
196 LOS_Key(
unsigned int aUniqueId1,
unsigned int aUniqueId2);
199 bool operator<(
const LOS_Key& aRhs)
const;
201 bool operator==(
const unsigned int& aRhs)
const;
225 double aMaxRange = 0.0,
226 double aRadiusScale = 1.0);
230 double aMaxRange = 0.0,
231 double aRadiusScale = 1.0);
235 double aMaxRange = 0.0,
236 double aRadiusScale = 1.0);
257 bool SetLOS_Data(
unsigned int aID1,
unsigned int aID2,
bool aVisible);
294 ~LOS_Thread()
override{};
296 FunctionType DoWork()
override;
297 FunctionType Pause()
override {
return AVAILABLE; };
302 typedef std::set<unsigned int> IdSetType;
303 typedef std::set<unsigned int>::iterator IdSetTypeIterator;
306 void ProcessRequests();
309 void ProcessPriorityQueue( IdSetType& aIdSet);
312 void ProcessThreadLOSData( IdSetType& aIdSet);
316 void ProcessRequest(
unsigned int aID);
319 void CleanUpPriorityQueues(
unsigned int aID);
322 bool SetThreadLOS_Data(LOS_Key aLOS_Key,
bool aVisible);
327 WsfLOS_Manager* mManagerPtr;
329 LOS_RequestType mRequestQueue;
331 IdSetType mIdsToDelete;
333 std::vector<PriorityQueueType> mPriorityQueues;
336 LOS_MapType mThreadLOS_Data;
343 LOS_MapType mLOS_Data;
346 StateMapType mStateData;
349 UtCallbackHolder mCallbacks;
352 LOS_Thread mWorkerThread;
355 mutable std::recursive_mutex mMutex;
aObjectPtr Update(simTime)
bool operator!=(int aId, const WsfStringInt &aRhs)
Not equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:75
bool operator==(int aId, const WsfStringInt &aRhs)
Equal relational operator for the case of an integer on the LHS and a StringId on the RHS.
Definition WsfStringId.hpp:69
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfArticulatedPart.hpp:36
Definition WsfEM_Antenna.hpp:49
WsfLOS_ManagerExtension()
Definition WsfLOS_Manager.hpp:78
Line-of-sight key - a combination of the unique IDs of the two entities.
Definition WsfLOS_Manager.hpp:194
unsigned int mID1
Definition WsfLOS_Manager.hpp:204
virtual ~LOS_Key()
Definition WsfLOS_Manager.hpp:197
unsigned int mID2
Definition WsfLOS_Manager.hpp:205
LOS_Key(unsigned int aUniqueId1, unsigned int aUniqueId2)
Definition WsfLOS_Manager.cpp:1380
State data used in LOS calculations.
Definition WsfLOS_Manager.hpp:166
virtual ~State()
Definition WsfLOS_Manager.hpp:176
double mTime
Definition WsfLOS_Manager.hpp:179
State()
Definition WsfLOS_Manager.hpp:168
double mLLA[3]
Definition WsfLOS_Manager.hpp:181
double mLocationWCS[3]
Definition WsfLOS_Manager.hpp:180
bool mMoved
Definition WsfLOS_Manager.hpp:182
size_t mPlatformIndex
Definition WsfLOS_Manager.hpp:178
std::map< unsigned int, unsigned int > PriorityQueueType
Definition WsfLOS_Manager.hpp:215
bool PlatformMoveCheck(WsfPlatform *aPlatformPtr, StateMapTypeIterator &aIter)
Definition WsfLOS_Manager.cpp:1214
std::list< unsignedint >::iterator LOS_RequestTypeIterator
Definition WsfLOS_Manager.hpp:213
bool Moved(WsfEM_Antenna *aAntennaPtr)
Returns true if entity's movement is greater than the move tolerance (default is true).
Definition WsfLOS_Manager.cpp:916
void SetDebugEnabled(bool aDebugEnabled)
Definition WsfLOS_Manager.hpp:115
std::pair< unsigned int, State > StateMapTypePair
Definition WsfLOS_Manager.hpp:187
std::map< unsignedint, State >::iterator StateMapTypeIterator
Definition WsfLOS_Manager.hpp:186
StateMapType & GetStateData()
Reference to the LOS manager state data so worker thread can use it.
Definition WsfLOS_Manager.hpp:190
std::map< unsignedint, unsignedint >::iterator PriorityQueueTypeIterator
Definition WsfLOS_Manager.hpp:216
std::list< unsigned int > LOS_RequestType
Definition WsfLOS_Manager.hpp:212
std::map< unsigned int, State > StateMapType
Definition WsfLOS_Manager.hpp:185
void PlatformDeleted(double aSimTime, WsfPlatform *aPlatformPtr)
Removes LOS data when a platform is deleted.
Definition WsfLOS_Manager.cpp:198
std::map< LOS_Key, bool > LOS_MapType
Definition WsfLOS_Manager.hpp:208
bool PartMoved(WsfArticulatedPart *aPartPtr)
Definition WsfLOS_Manager.cpp:1276
std::pair< LOS_Key, bool > LOS_MapTypePair
Definition WsfLOS_Manager.hpp:210
bool LOS_DataExists(unsigned int aID1, unsigned int aID2)
Returns true if LOS data exists for the two entities.
Definition WsfLOS_Manager.cpp:939
bool PlatformMoved(WsfPlatform *aPlatformPtr)
Definition WsfLOS_Manager.cpp:1174
void UpdateStateData(LOS_RequestType &aLOS_RequestQueue)
Used in multi-threaded mode; updates the platform and part state data.
Definition WsfLOS_Manager.cpp:1097
bool StateDataExists(unsigned int aID)
Returns true is state data exists for the entity.
Definition WsfLOS_Manager.cpp:982
std::pair< unsigned int, unsigned int > PriorityQueueTypePair
Definition WsfLOS_Manager.hpp:217
void DeleteLOS_Data(unsigned int aID, LOS_MapType &aLOS_Map)
Removes all map entries from the given map with a LOS_Key containing the given ID.
Definition WsfLOS_Manager.cpp:1149
bool SetStateData(unsigned int aID, State &aNewState)
Returns true if state data was successfully updated.
Definition WsfLOS_Manager.cpp:1058
bool IsTargetVisibleNow(WsfPlatform *aPlatformPtr, WsfPlatform *aTargetPtr, double aMaxRange=0.0, double aRadiusScale=1.0)
Definition WsfLOS_Manager.cpp:701
bool PartMoveCheck(WsfArticulatedPart *aPartPtr, StateMapTypeIterator &aIter)
Definition WsfLOS_Manager.cpp:1317
static WsfLOS_Manager * Find(const WsfSimulation &aSimulation)
Definition WsfLOS_Manager.cpp:63
bool SetLOS_Data(unsigned int aID1, unsigned int aID2, bool aVisible)
Returns true if LOS data was successfully updated.
Definition WsfLOS_Manager.cpp:1010
WsfLOS_Manager(WsfLOS_ManagerData &aData)
Definition WsfLOS_Manager.cpp:680
bool DebugEnabled() const
Determine if debugging is enabled.
Definition WsfLOS_Manager.hpp:111
std::map< LOS_Key, bool >::iterator LOS_MapTypeIterator
Definition WsfLOS_Manager.hpp:209
bool Initialize() override
Initialize the LOS manager.
Definition WsfLOS_Manager.cpp:86
WsfScenarioExtension()
Definition WsfScenarioExtension.cpp:21
WsfSimulationExtension()
Definition WsfSimulationExtension.cpp:23
friend class WsfSimulation
Definition WsfSimulationExtension.hpp:43
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfThread.hpp:23
WSF_EXPORT InitializeCallback & Initialize(const WsfSimulation *aSimulationPtr)
Definition WsfLOS_Manager.hpp:42
unsigned int mNumPriorityQueues
Definition WsfLOS_Manager.hpp:45
unsigned int mProcessingRate
Definition WsfLOS_Manager.hpp:49
unsigned int mMaxCountPriorityQueue
Number of priority queues; default 3; minimum 1.
Definition WsfLOS_Manager.hpp:46
ThreadData()
Definition WsfLOS_Manager.cpp:1766
bool mDebugEnabled
Number of priority queue entries to process at a time.
Definition WsfLOS_Manager.hpp:50
Definition WsfLOS_Manager.hpp:38
bool mMultiThreaded
Thread behavior.
Definition WsfLOS_Manager.hpp:60
bool mDebugEnabled
Debug flag.
Definition WsfLOS_Manager.hpp:63
ThreadData mThreadData
Definition WsfLOS_Manager.hpp:70
double mMaxAllowableLocDelta
Maximum location change allowed to determine if move occurred.
Definition WsfLOS_Manager.hpp:57
bool ProcessInput(UtInput &aInput)
Process the line_of_sight_manager block.
Definition WsfLOS_Manager.cpp:124
WsfLOS_ManagerData()
Definition WsfLOS_Manager.cpp:1757
bool mVegLayerMaskingEnabled
Vegetation Layer Masking.
Definition WsfLOS_Manager.hpp:66
bool mUseHeightForGroundPlatforms
Definition WsfLOS_Manager.hpp:68