WSF
WsfCoverageCompositeGrid.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 2020 Infoscitex, a DCS 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 WSFCOVERAGECOMPOSITEGRID_HPP
13#define WSFCOVERAGECOMPOSITEGRID_HPP
14
15#include "wsf_coverage_export.h"
16
17#include <map>
18#include <utility>
19#include <vector>
20
21#include "UtCloneablePtr.hpp"
22#include "WsfCoverageGrid.hpp"
23
24namespace wsf
25{
26namespace coverage
27{
28
34class WSF_COVERAGE_EXPORT CompositeGrid : public Grid
35{
36public:
37 explicit CompositeGrid(const WsfScenario& aScenario)
38 : Grid(aScenario)
39 {
40 }
41 CompositeGrid(const CompositeGrid& aOther) = default;
42 ~CompositeGrid() override = default;
43
44 CompositeGrid* Clone() const override { return new CompositeGrid{*this}; }
45
46 bool ProcessInput(UtInput& aInput) override;
47 void PreparePlatforms(WsfSimulation& aSimulation) override;
48 const Point* GetPoint(PointId aPointId) const override;
49 std::size_t GetSize() const override { return mPoints.size(); }
50 void Invoke(GridAction& aAction) const override;
51 GridAsset GetAsset(PointId aPointId) const override;
52 GridAsset GetAsset(const std::string& aPlatformName) const override;
53 void HasNullDevice(bool& aAnyNull, bool& aAllNull) const override;
54 bool CreatesNewPlatforms() const override { return true; }
55 bool IsStructured() const override;
56 std::size_t GetNumComponents() const override;
57 std::string GetComponentName(std::size_t aComponentIndex) const override;
58 std::pair<std::size_t, std::size_t> GetComponentSizes(std::size_t aComponentIndex) const override;
59 std::pair<std::size_t, std::size_t> GetPointIndices(PointId aPointId) const override;
60
71 void InvokeOnComponent(GridAction& aAction, std::size_t aComponentIndex) const override;
72
73 constexpr static const char* cTYPE{"WSF_COMPOSITE_GRID"};
74
75protected:
76 bool InitializeP() override;
77
78private:
80 std::vector<ut::CloneablePtr<Grid>> mSubGrids{};
81
83 std::map<PointId, GridAsset> mAssets{};
84
86 std::map<PointId, Point> mPoints{};
87
89 std::map<std::string, PointId> mNameToId{};
90
92 std::map<PointId, std::size_t> mIdToComponent{};
93
95 std::map<PointId, PointId> mParentToChild{};
96
97 // Needs to be a vector since there is no guarantee that the child IDs are unique
99 std::vector<std::map<PointId, PointId>> mChildToParent{};
100};
101
102} // namespace coverage
103} // namespace wsf
104
105#endif // WSFCOVERAGECOMPOSITEGRID_HPP
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
The main controller for a simulation.
Definition WsfSimulation.hpp:109
CompositeGrid * Clone() const override
Definition WsfCoverageCompositeGrid.hpp:44
~CompositeGrid() override=default
std::size_t GetSize() const override
Definition WsfCoverageCompositeGrid.hpp:49
CompositeGrid(const WsfScenario &aScenario)
Definition WsfCoverageCompositeGrid.hpp:37
static constexpr const char * cTYPE
Definition WsfCoverageCompositeGrid.hpp:73
CompositeGrid(const CompositeGrid &aOther)=default
bool CreatesNewPlatforms() const override
Definition WsfCoverageCompositeGrid.hpp:54
An object that can be invoked for each point in a grid.
Definition WsfCoverageGridAction.hpp:30
Definition WsfCoverageAsset.hpp:37
Grid(const WsfScenario &aScenario)
Definition WsfCoverageGrid.cpp:31
A point in a coverage grid.
Definition WsfCoverageGridPoint.hpp:40
Definition WsfCoverage.cpp:35
std::uint64_t PointId
Definition WsfCoverageGridPoint.hpp:33
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved