#include <GridObjectCache.h>
inet::physicalenvironment::GridObjectCache::GridObjectCache |
( |
| ) |
|
PhysicalEnvironment * physicalEnvironment
Definition: GridObjectCache.h:36
SpatialGrid * grid
Definition: GridObjectCache.h:41
inet::physicalenvironment::GridObjectCache::~GridObjectCache |
( |
| ) |
|
|
virtual |
SpatialGrid * grid
Definition: GridObjectCache.h:41
void inet::physicalenvironment::GridObjectCache::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
41 physicalEnvironment = getModuleFromPar<PhysicalEnvironment>(par(
"physicalEnvironmentModule"),
this);
43 double cellSizeX = par(
"cellSizeX");
44 double cellSizeY = par(
"cellSizeY");
45 double cellSizeZ = par(
"cellSizeZ");
48 const Coord spaceSize = spaceMax - spaceMin;
49 if (std::isnan(cellSizeX))
50 cellSizeX = spaceSize.
x / par(
"cellCountX").doubleValue();
51 if (std::isnan(cellSizeY))
52 cellSizeY = spaceSize.y / par(
"cellCountY").doubleValue();
53 if (std::isnan(cellSizeZ))
54 cellSizeZ = spaceSize.z / par(
"cellCountZ").doubleValue();
55 Coord voxelSizes(cellSizeX, cellSizeY, cellSizeZ);
56 grid =
new SpatialGrid(voxelSizes, spaceMin, spaceMax);
PhysicalEnvironment * physicalEnvironment
Definition: GridObjectCache.h:36
Additional physical environment initializations that depend on the previous stage.
Definition: InitStages.h:47
virtual bool insertObject(const IPhysicalObject *object)
Definition: GridObjectCache.cc:62
virtual const Coord & getSpaceMax() const override
Definition: PhysicalEnvironment.h:93
SpatialGrid * grid
Definition: GridObjectCache.h:41
virtual int getNumObjects() const override
Definition: PhysicalEnvironment.h:97
Local initializations.
Definition: InitStages.h:35
virtual const Coord & getSpaceMin() const override
Definition: PhysicalEnvironment.h:92
double x
Definition: Coord.h:49
virtual const PhysicalObject * getObject(int index) const override
Definition: PhysicalEnvironment.h:98
bool inet::physicalenvironment::GridObjectCache::insertObject |
( |
const IPhysicalObject * |
object | ) |
|
|
protectedvirtual |
Referenced by initialize().
64 Coord pos =
object->getPosition();
65 Coord boundingBoxSize =
object->getShape()->computeBoundingBoxSize();
67 grid->
insertObject(dynamic_cast<const cObject *>(
object), pos, boundingBoxSize);
SpatialGrid * grid
Definition: GridObjectCache.h:41
bool insertObject(const cObject *object, const Coord &pos, const Coord &boundingBoxSize)
Definition: SpatialGrid.cc:22
virtual int inet::physicalenvironment::GridObjectCache::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
The number of initialization stages.
Definition: InitStages.h:116
void inet::physicalenvironment::GridObjectCache::visitObjects |
( |
const IVisitor * |
visitor, |
|
|
const LineSegment & |
lineSegment |
|
) |
| const |
|
overridevirtual |
Calls the visitor with at least all physical objects that intersect with the provided line segment.
Implements inet::physicalenvironment::IObjectCache.
SpatialGrid * grid
Definition: GridObjectCache.h:41
void lineSegmentQuery(const LineSegment &lineSegment, const IVisitor *visitor) const
Definition: SpatialGrid.cc:107
SpatialGrid* inet::physicalenvironment::GridObjectCache::grid |
|
protected |
The documentation for this class was generated from the following files: