Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::PhaseSearchService Class Reference

Manages background order parameter calculations, multi-frame caching, and visual updates. More...

#include <PhaseSearchService.hpp>

Collaboration diagram for correlation::app::PhaseSearchService:

Public Types

using CellProvider
using ActiveFrameProvider = std::function<std::size_t()>
using TotalFramesProvider = std::function<std::size_t()>
using UpdateCallback = std::function<void()>
using GpuDescriptorEvaluator

Public Member Functions

 PhaseSearchService (CellProvider cell_provider, ActiveFrameProvider active_frame_provider, TotalFramesProvider total_frames_provider, UpdateCallback on_phase_updated, std::shared_ptr< std::atomic< bool > > alive)
 Constructs PhaseSearchService and spawns the background worker.
 ~PhaseSearchService ()
 Destructor stopping the background worker thread.
 PhaseSearchService (const PhaseSearchService &)=delete
PhaseSearchService & operator= (const PhaseSearchService &)=delete
 PhaseSearchService (PhaseSearchService &&)=delete
PhaseSearchService & operator= (PhaseSearchService &&)=delete
void setEnabled (bool enabled)
bool isEnabled () const noexcept
void setDescriptor (PhaseDescriptor descriptor)
PhaseDescriptor descriptor () const noexcept
void setCrystalPreset (CrystalPreset preset)
CrystalPreset crystalPreset () const noexcept
void setThresholds (float min_threshold, float max_threshold)
float minThreshold () const noexcept
float maxThreshold () const noexcept
void setColormap (plotters::ColormapType colormap)
plotters::ColormapType colormap () const noexcept
void setHaloIntensity (float intensity)
float haloIntensity () const noexcept
void setHaloRadiusRatio (float ratio)
float haloRadiusRatio () const noexcept
void setAtomScale (float scale)
float atomScale () const noexcept
void setDimNonMatching (bool dim)
bool isDimNonMatching () const noexcept
void setHideNonMatching (bool hide)
bool isHideNonMatching () const noexcept
void set2DMode (bool is_2d)
bool is2DMode () const noexcept
void setDescriptorY (PhaseDescriptor desc_y)
PhaseDescriptor descriptorY () const noexcept
void setThresholds2D (float min_x, float max_x, float min_y, float max_y)
float minThresholdY () const noexcept
float maxThresholdY () const noexcept
PhaseSearchSettings settings () const noexcept
PhaseHistogram latestHistogram () const
PhaseHeatmap2D latestHeatmap () const
const PhaseDescriptorsLRUCache & lruCache () const noexcept
PhaseDescriptorsLRUCache & lruCache () noexcept
void requestCalculation (std::size_t frame_index)
void startPrebake ()
void cancelPrebake ()
bool isFrameReady (std::size_t frame_index) const
PhasePrebakeStatus prebakeStatus () const
void applyVisualsToScene (render3d::Scene3D &scene, std::size_t active_frame)
void setGpuDescriptorEvaluator (GpuDescriptorEvaluator evaluator)
void clearCache ()
std::shared_ptr< const FramePhaseDescriptors > getOrComputeDescriptors (std::size_t frame_index)
std::shared_ptr< const calculators::SteinhardtCalculator::SteinhardtParams > getOrComputeSteinhardt (std::size_t frame_index)
PhaseHistogram computePhaseHistogram (const FramePhaseDescriptors *descriptors) const
PhaseHeatmap2D computePhaseHeatmap (const FramePhaseDescriptors *descriptors) const
std::shared_ptr< const FramePhaseDescriptors > computeDescriptorsSync (std::size_t frame_index)

Private Member Functions

void phaseWorkerLoop ()
int64_t waitForNextPhaseFrame ()
void processTargetPhaseFrame (int64_t target_frame)
int64_t findNextUncachedPrebakeFrame (const PhaseSearchSettings &settings) const
void startPrebakeLocked ()
void cancelPrebakeLocked ()
std::shared_ptr< const analysis::StructureAnalyzer > getOrBuildFrame0Analyzer ()
void populateDeformationDescriptors (FramePhaseDescriptors &descriptors, std::size_t frame_index, const core::Cell &target_cell, const PhaseSearchSettings &settings)
void applyPhaseVisualsToSceneInternal (render3d::Scene3D &scene, const FramePhaseDescriptors *descriptors)

Private Attributes

CellProvider cell_provider_
ActiveFrameProvider active_frame_provider_
TotalFramesProvider total_frames_provider_
UpdateCallback on_phase_updated_
GpuDescriptorEvaluator gpu_evaluator_
std::shared_ptr< std::atomic< bool > > alive_
PhaseSearchSettings phase_settings_
PhaseHistogram latest_histogram_
PhaseHeatmap2D latest_heatmap_
PhaseDescriptorsLRUCache lru_cache_
std::shared_ptr< const analysis::StructureAnalyzer > ref_frame0_analyzer_
std::mutex phase_mutex_
std::condition_variable phase_cv_
std::atomic< bool > stop_phase_worker_ {false}
std::atomic< bool > prebake_active_ {false}
std::atomic< bool > is_computing_ {false}
std::atomic< int64_t > requested_phase_frame_ {-1}
std::jthread phase_worker_

Detailed Description

Manages background order parameter calculations, multi-frame caching, and visual updates.

Member Typedef Documentation

◆ ActiveFrameProvider

using correlation::app::PhaseSearchService::ActiveFrameProvider = std::function<std::size_t()>

◆ CellProvider

Initial value:
std::function<std::optional<std::pair<core::Cell, analysis::BondCutoffMatrix>>(std::size_t)>

◆ GpuDescriptorEvaluator

Initial value:
std::function<bool(const core::Cell &, PhaseDescriptor, real_t, std::vector<real_t> &)>
Represents the simulation cell (periodic box).
Definition Cell.hpp:30
PhaseDescriptor
Bond-orientational order parameter descriptors available for phase filtering.
Definition PhaseSearchTypes.hpp:23
double real_t
Definition Precision.hpp:18

◆ TotalFramesProvider

using correlation::app::PhaseSearchService::TotalFramesProvider = std::function<std::size_t()>

◆ UpdateCallback

Constructor & Destructor Documentation

◆ PhaseSearchService() [1/3]

correlation::app::PhaseSearchService::PhaseSearchService ( CellProvider cell_provider,
ActiveFrameProvider active_frame_provider,
TotalFramesProvider total_frames_provider,
UpdateCallback on_phase_updated,
std::shared_ptr< std::atomic< bool > > alive )

Constructs PhaseSearchService and spawns the background worker.

Parameters
cell_providerCallback returning a cell and its bond cutoffs for a frame.
active_frame_providerCallback returning the active frame index.
total_frames_providerCallback returning the total number of frames.
on_phase_updatedCallback invoked when asynchronous calculation updates active scene.
aliveShared cancellation token indicating controller lifecycle.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~PhaseSearchService()

correlation::app::PhaseSearchService::~PhaseSearchService ( )

Destructor stopping the background worker thread.

◆ PhaseSearchService() [2/3]

correlation::app::PhaseSearchService::PhaseSearchService ( const PhaseSearchService & )
delete
Here is the call graph for this function:

◆ PhaseSearchService() [3/3]

correlation::app::PhaseSearchService::PhaseSearchService ( PhaseSearchService && )
delete
Here is the call graph for this function:

Member Function Documentation

◆ applyPhaseVisualsToSceneInternal()

void correlation::app::PhaseSearchService::applyPhaseVisualsToSceneInternal ( render3d::Scene3D & scene,
const FramePhaseDescriptors * descriptors )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyVisualsToScene()

void correlation::app::PhaseSearchService::applyVisualsToScene ( render3d::Scene3D & scene,
std::size_t active_frame )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atomScale()

float correlation::app::PhaseSearchService::atomScale ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ cancelPrebake()

void correlation::app::PhaseSearchService::cancelPrebake ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelPrebakeLocked()

void correlation::app::PhaseSearchService::cancelPrebakeLocked ( )
private
Here is the caller graph for this function:

◆ clearCache()

void correlation::app::PhaseSearchService::clearCache ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ colormap()

plotters::ColormapType correlation::app::PhaseSearchService::colormap ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ computeDescriptorsSync()

std::shared_ptr< const FramePhaseDescriptors > correlation::app::PhaseSearchService::computeDescriptorsSync ( std::size_t frame_index)
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ computePhaseHeatmap()

PhaseHeatmap2D correlation::app::PhaseSearchService::computePhaseHeatmap ( const FramePhaseDescriptors * descriptors) const
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ computePhaseHistogram()

PhaseHistogram correlation::app::PhaseSearchService::computePhaseHistogram ( const FramePhaseDescriptors * descriptors) const
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crystalPreset()

CrystalPreset correlation::app::PhaseSearchService::crystalPreset ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ descriptor()

PhaseDescriptor correlation::app::PhaseSearchService::descriptor ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ descriptorY()

PhaseDescriptor correlation::app::PhaseSearchService::descriptorY ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ findNextUncachedPrebakeFrame()

int64_t correlation::app::PhaseSearchService::findNextUncachedPrebakeFrame ( const PhaseSearchSettings & settings) const
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrBuildFrame0Analyzer()

std::shared_ptr< const analysis::StructureAnalyzer > correlation::app::PhaseSearchService::getOrBuildFrame0Analyzer ( )
nodiscardprivate
Here is the caller graph for this function:

◆ getOrComputeDescriptors()

std::shared_ptr< const FramePhaseDescriptors > correlation::app::PhaseSearchService::getOrComputeDescriptors ( std::size_t frame_index)
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOrComputeSteinhardt()

std::shared_ptr< const calculators::SteinhardtCalculator::SteinhardtParams > correlation::app::PhaseSearchService::getOrComputeSteinhardt ( std::size_t frame_index)
nodiscard
Here is the call graph for this function:
Here is the caller graph for this function:

◆ haloIntensity()

float correlation::app::PhaseSearchService::haloIntensity ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ haloRadiusRatio()

float correlation::app::PhaseSearchService::haloRadiusRatio ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ is2DMode()

bool correlation::app::PhaseSearchService::is2DMode ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ isDimNonMatching()

bool correlation::app::PhaseSearchService::isDimNonMatching ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ isEnabled()

bool correlation::app::PhaseSearchService::isEnabled ( ) const
nodiscardnoexcept

◆ isFrameReady()

bool correlation::app::PhaseSearchService::isFrameReady ( std::size_t frame_index) const
nodiscard
Here is the caller graph for this function:

◆ isHideNonMatching()

bool correlation::app::PhaseSearchService::isHideNonMatching ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ latestHeatmap()

PhaseHeatmap2D correlation::app::PhaseSearchService::latestHeatmap ( ) const
nodiscard
Here is the caller graph for this function:

◆ latestHistogram()

PhaseHistogram correlation::app::PhaseSearchService::latestHistogram ( ) const
nodiscard
Here is the caller graph for this function:

◆ lruCache() [1/2]

const PhaseDescriptorsLRUCache & correlation::app::PhaseSearchService::lruCache ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ lruCache() [2/2]

PhaseDescriptorsLRUCache & correlation::app::PhaseSearchService::lruCache ( )
nodiscardnoexcept

◆ maxThreshold()

float correlation::app::PhaseSearchService::maxThreshold ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ maxThresholdY()

float correlation::app::PhaseSearchService::maxThresholdY ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ minThreshold()

float correlation::app::PhaseSearchService::minThreshold ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ minThresholdY()

float correlation::app::PhaseSearchService::minThresholdY ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ operator=() [1/2]

PhaseSearchService & correlation::app::PhaseSearchService::operator= ( const PhaseSearchService & )
delete
Here is the call graph for this function:

◆ operator=() [2/2]

PhaseSearchService & correlation::app::PhaseSearchService::operator= ( PhaseSearchService && )
delete

◆ phaseWorkerLoop()

void correlation::app::PhaseSearchService::phaseWorkerLoop ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ populateDeformationDescriptors()

void correlation::app::PhaseSearchService::populateDeformationDescriptors ( FramePhaseDescriptors & descriptors,
std::size_t frame_index,
const core::Cell & target_cell,
const PhaseSearchSettings & settings )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prebakeStatus()

PhasePrebakeStatus correlation::app::PhaseSearchService::prebakeStatus ( ) const
nodiscard
Here is the caller graph for this function:

◆ processTargetPhaseFrame()

void correlation::app::PhaseSearchService::processTargetPhaseFrame ( int64_t target_frame)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestCalculation()

void correlation::app::PhaseSearchService::requestCalculation ( std::size_t frame_index)
Here is the caller graph for this function:

◆ set2DMode()

void correlation::app::PhaseSearchService::set2DMode ( bool is_2d)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAtomScale()

void correlation::app::PhaseSearchService::setAtomScale ( float scale)
Here is the caller graph for this function:

◆ setColormap()

void correlation::app::PhaseSearchService::setColormap ( plotters::ColormapType colormap)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCrystalPreset()

void correlation::app::PhaseSearchService::setCrystalPreset ( CrystalPreset preset)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDescriptor()

void correlation::app::PhaseSearchService::setDescriptor ( PhaseDescriptor descriptor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDescriptorY()

void correlation::app::PhaseSearchService::setDescriptorY ( PhaseDescriptor desc_y)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDimNonMatching()

void correlation::app::PhaseSearchService::setDimNonMatching ( bool dim)
Here is the caller graph for this function:

◆ setEnabled()

void correlation::app::PhaseSearchService::setEnabled ( bool enabled)
Here is the call graph for this function:

◆ setGpuDescriptorEvaluator()

void correlation::app::PhaseSearchService::setGpuDescriptorEvaluator ( GpuDescriptorEvaluator evaluator)
Here is the caller graph for this function:

◆ setHaloIntensity()

void correlation::app::PhaseSearchService::setHaloIntensity ( float intensity)
Here is the caller graph for this function:

◆ setHaloRadiusRatio()

void correlation::app::PhaseSearchService::setHaloRadiusRatio ( float ratio)
Here is the caller graph for this function:

◆ setHideNonMatching()

void correlation::app::PhaseSearchService::setHideNonMatching ( bool hide)
Here is the caller graph for this function:

◆ setThresholds()

void correlation::app::PhaseSearchService::setThresholds ( float min_threshold,
float max_threshold )
Here is the caller graph for this function:

◆ setThresholds2D()

void correlation::app::PhaseSearchService::setThresholds2D ( float min_x,
float max_x,
float min_y,
float max_y )
Here is the caller graph for this function:

◆ settings()

PhaseSearchSettings correlation::app::PhaseSearchService::settings ( ) const
nodiscardnoexcept
Here is the caller graph for this function:

◆ startPrebake()

void correlation::app::PhaseSearchService::startPrebake ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startPrebakeLocked()

void correlation::app::PhaseSearchService::startPrebakeLocked ( )
private
Here is the caller graph for this function:

◆ waitForNextPhaseFrame()

int64_t correlation::app::PhaseSearchService::waitForNextPhaseFrame ( )
nodiscardprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ active_frame_provider_

ActiveFrameProvider correlation::app::PhaseSearchService::active_frame_provider_
private

◆ alive_

std::shared_ptr<std::atomic<bool> > correlation::app::PhaseSearchService::alive_
private

◆ cell_provider_

CellProvider correlation::app::PhaseSearchService::cell_provider_
private

◆ gpu_evaluator_

GpuDescriptorEvaluator correlation::app::PhaseSearchService::gpu_evaluator_
private

◆ is_computing_

std::atomic<bool> correlation::app::PhaseSearchService::is_computing_ {false}
private

◆ latest_heatmap_

PhaseHeatmap2D correlation::app::PhaseSearchService::latest_heatmap_
private

◆ latest_histogram_

PhaseHistogram correlation::app::PhaseSearchService::latest_histogram_
private

◆ lru_cache_

PhaseDescriptorsLRUCache correlation::app::PhaseSearchService::lru_cache_
private

◆ on_phase_updated_

UpdateCallback correlation::app::PhaseSearchService::on_phase_updated_
private

◆ phase_cv_

std::condition_variable correlation::app::PhaseSearchService::phase_cv_
private

◆ phase_mutex_

std::mutex correlation::app::PhaseSearchService::phase_mutex_
mutableprivate

◆ phase_settings_

PhaseSearchSettings correlation::app::PhaseSearchService::phase_settings_
private

◆ phase_worker_

std::jthread correlation::app::PhaseSearchService::phase_worker_
private

◆ prebake_active_

std::atomic<bool> correlation::app::PhaseSearchService::prebake_active_ {false}
private

◆ ref_frame0_analyzer_

std::shared_ptr<const analysis::StructureAnalyzer> correlation::app::PhaseSearchService::ref_frame0_analyzer_
private

◆ requested_phase_frame_

std::atomic<int64_t> correlation::app::PhaseSearchService::requested_phase_frame_ {-1}
private

◆ stop_phase_worker_

std::atomic<bool> correlation::app::PhaseSearchService::stop_phase_worker_ {false}
private

◆ total_frames_provider_

TotalFramesProvider correlation::app::PhaseSearchService::total_frames_provider_
private

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