RSTT 3.2.1 Regional Seismic Travel Time

Loading...
Searching...
No Matches
slbm::CrustalProfileStore Class Reference

CrustalProfileStore supports pool allocation for CrustalProfile objects. More...

`#include <CrustalProfileStore.h>`

## Public Member Functions
| CrustalProfileStore (Grid &grid, const int &maxSize)
| Constructor.
| ~CrustalProfileStore ()
| Destructor.
void | clear ()
CrustalProfile * | getCrustalProfile (const int &phase, const double &lat, const double &lon, const double &depth)
int | getNCrustalProfiles ()
size_t | memSize ()

## Detailed Description

CrustalProfileStore supports pool allocation for CrustalProfile objects.

CrustalProfileStore supports pool allocation for CrustalProfile objects. Grid owns two CrustalProfileStore objects, one for seismic sources and a separate one for seismic receivers. When a GreatCircle object is created, it needs two CrustalProfile objects, one for the source and one for the receiver. It requests these CrustalProfile objects from the Grid object and Grid requests them from the two CrustalProfileStore objects. A Grid object requests a CrustalProfile object from a CrustalProfileStore by calling CrustalProfileStore::getCrustalProfile(phase, lat, lon, depth). When it receives such a request CrustalProfileStore searches its internal containers to see if it already has a CrustalProfile object for that phase/location. If it does, it returns a handle to the existing CrustalProfile object and promotes the priority of that CrustalProfile object to the highest level. If it does not already have a CrustalProfile object for the specified phase/location, it pops a reference to a previously used CrustalProfile object that it keeps in a pool of previously instantiated but currently unused objects and resets the data in the CrustalProfile object for the new phase/location. If the pool is empty, it constructs a new CrustalProfile object. It then pushes the Crustal Profile object onto the head of the priority list. If the priority list reaches its maximum size, then CrustalProfileStore pops the CrustalProfile object with the lowest priority off the back of the priority list and returns it to the pool of unused CrustalProfile objects.

There is an important assumption being made here and that is that when CrustalProfileStore::getCrustalProfile(phase, lat, lon, depth) is called, there are no valid references to any CrustalProfile objects out in the application. This is necessary so that CrustalProfileStore can reset the information contained in CrustalProfile that it pops off the pool of unused objects. As currently implemented this condition is satisfied in SLBM. CrustalProfile objects are owned only by GreatCircle objects. SlbmInterface objects maintain a reference to a single GreatCircle object at a time. When an application requests a new GreatCircle object, SlbmInterface deletes the current GreatCircle object (if it currently has one) and then instantiates a new GreatCircle object. Since only one GreatCircle exists at a time, there can be no valid references to any CrustalProfile at the time that CrustalProfileStore::getCrustalProfile(phase, lat, lon, depth) is called.

Definition at line 107 of file CrustalProfileStore.h.

## Constructor & Destructor Documentation

## ◆ CrustalProfileStore()

slbm::CrustalProfileStore::CrustalProfileStore | ( | Grid & | grid,
|  | const int & | maxSize )

Constructor.

## ◆ ~CrustalProfileStore()

slbm::CrustalProfileStore::~CrustalProfileStore | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ clear()

void slbm::CrustalProfileStore::clear | ( |  | ) |

## ◆ getCrustalProfile()

CrustalProfile * slbm::CrustalProfileStore::getCrustalProfile | ( | const int & | phase,
|  | const double & | lat,
|  | const double & | lon,
|  | const double & | depth )

## ◆ getNCrustalProfiles()

int slbm::CrustalProfileStore::getNCrustalProfiles | ( |  | ) |
| inline

Definition at line 124 of file CrustalProfileStore.h.

## ◆ memSize()

size_t slbm::CrustalProfileStore::memSize | ( |  | ) |
| inline

Definition at line 150 of file CrustalProfileStore.h.

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

- rstt_v3.2.1/SLBM/include/CrustalProfileStore.h