Recast  1
Game with custom magic
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AverageShareTemperatureWorldUpdater Class Reference

#include <AverageShareTemperatureWorldUpdater.hpp>

Inheritance diagram for AverageShareTemperatureWorldUpdater:
Inheritance graph
Collaboration diagram for AverageShareTemperatureWorldUpdater:
Collaboration graph

Public Member Functions

 AverageShareTemperatureWorldUpdater (double temperatureExchangeCoefficient, std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> world, std::shared_ptr< ITimerBlockable< ITimer >> timer)
 
void update () override
 
bool canAddNearChunk (Edge edge, const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &chunk) const noexceptoverride
 
void addNearChunk (Edge edge, std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> chunk) override
 
- Public Member Functions inherited from IUpdater
virtual ~IUpdater () noexcept=default
 

Protected Member Functions

void _checkThenShareTemperature (double dt, const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &firstWorld, Coord x, Coord y, Coord z, const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &secondWorld, Coord nextX, Coord nextY, Coord nextZ)
 
void _shareTemperature (double dt, const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &firstWorld, Coord x, Coord y, Coord z, const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &secondWorld, Coord nextX, Coord nextY, Coord nextZ)
 

Protected Attributes

double _temperatureExchangeCoefficient
 
std::shared_ptr
< ITemperatureWorldBoundable
< ITemperatureWorld > > 
_world
 
std::shared_ptr
< ITimerBlockable< ITimer > > 
_timer
 
std::shared_ptr
< ITemperatureWorldBoundable
< ITemperatureWorld > > 
_nearRightChunk
 
std::shared_ptr
< ITemperatureWorldBoundable
< ITemperatureWorld > > 
_nearUpChunk
 
std::shared_ptr
< ITemperatureWorldBoundable
< ITemperatureWorld > > 
_nearFarChunk
 

Detailed Description

Implementation of temperature world updater.

How it works for every two cells:

  1. Computes average of temperatures of two cells.
  2. Brings temperature of each cell to this average world. Speed is determined by temperature exchange coefficient.

Constructor & Destructor Documentation

AverageShareTemperatureWorldUpdater::AverageShareTemperatureWorldUpdater ( double  temperatureExchangeCoefficient,
std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >>  world,
std::shared_ptr< ITimerBlockable< ITimer >>  timer 
)

Member Function Documentation

void AverageShareTemperatureWorldUpdater::_checkThenShareTemperature ( double  dt,
const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &  firstWorld,
Coord  x,
Coord  y,
Coord  z,
const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &  secondWorld,
Coord  nextX,
Coord  nextY,
Coord  nextZ 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void AverageShareTemperatureWorldUpdater::_shareTemperature ( double  dt,
const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &  firstWorld,
Coord  x,
Coord  y,
Coord  z,
const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &  secondWorld,
Coord  nextX,
Coord  nextY,
Coord  nextZ 
)
protected

Here is the call graph for this function:

Here is the caller graph for this function:

void AverageShareTemperatureWorldUpdater::addNearChunk ( Edge  edge,
std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >>  otherChunk 
)
overridevirtual

Adds chunk to near chunks collection on specified edge.

Parameters
otherChunkNear chunk.

Implements IUpdaterTemperatureWorldSemiChunkUpdatableMixin.

Here is the call graph for this function:

bool AverageShareTemperatureWorldUpdater::canAddNearChunk ( Edge  edge,
const std::shared_ptr< ITemperatureWorldBoundable< ITemperatureWorld >> &  otherChunk 
) const
overridevirtualnoexcept

Tells whether it's possible to add this chunk to near chunks collection on specified edge. This method is thread-safe.

Parameters
otherChunkNear chunk.
Returns
True if this chunk can be added to near chunks collection.

Implements IUpdaterTemperatureWorldSemiChunkUpdatableMixin.

Here is the caller graph for this function:

void AverageShareTemperatureWorldUpdater::update ( )
overridevirtual

Updates.

Implements IUpdater.

Here is the call graph for this function:

Member Data Documentation

std::shared_ptr<ITemperatureWorldBoundable<ITemperatureWorld> > AverageShareTemperatureWorldUpdater::_nearFarChunk
protected
std::shared_ptr<ITemperatureWorldBoundable<ITemperatureWorld> > AverageShareTemperatureWorldUpdater::_nearRightChunk
protected
std::shared_ptr<ITemperatureWorldBoundable<ITemperatureWorld> > AverageShareTemperatureWorldUpdater::_nearUpChunk
protected
double AverageShareTemperatureWorldUpdater::_temperatureExchangeCoefficient
protected
std::shared_ptr<ITimerBlockable<ITimer> > AverageShareTemperatureWorldUpdater::_timer
protected
std::shared_ptr<ITemperatureWorldBoundable<ITemperatureWorld> > AverageShareTemperatureWorldUpdater::_world
protected

The documentation for this class was generated from the following files: