SMILE  v2.5
Schwarzschild Modelling Interactive expLoratory Environment
Signals | Public Member Functions | Public Attributes | Private Slots | Private Member Functions | Private Attributes | List of all members
smile::CSmileCore Class Reference

Class that provides all core computational functionality. More...

#include <core.h>

Inheritance diagram for smile::CSmileCore:
Inheritance graph
[legend]
Collaboration diagram for smile::CSmileCore:
Collaboration graph
[legend]

Signals

void signalTimer ()
 emitted regularly during orbit library integration, to update progress info
 
void signalOrbitFinished ()
 emitted when orbit integration finished
 
void signalOrbitLibraryFinished ()
 emitted when the orbit library integration is finished (for the frequency map or Schwarzschild orbit library)
 
void signalSchwOptimizationFinished (const QString &result)
 emitted when Schwarzschild optimization finished
 
void signalNbodyReintegrationFinished ()
 emitted upon finish of reintegrating orbits for nbody export (if it was necessary to get more sampling points)
 
void signalNbodyExportFinished (const QString &result)
 emitted when export to nbody model is finished
 
void signalStopOrbitLibrary ()
 emitted when the user cancels orbit library integration; transmitted to the worker thread objects
 
void signalStopExportNbody ()
 emitted when the user stops export to Nbody model
 

Public Member Functions

 CSmileCore ()
 construct the object and set default values for internal state variables
 
 ~CSmileCore ()
 destroy the object
 
bool loadSettings (const std::string &fileName="")
 load configuration data (at start - from predefined file smile.ini, later - when loading orbit library)
 
void saveSettings (const std::string &fileName="")
 store configuration data (when storing orbit library, or at exit, if demanded in GUI)
 
void initPotential ()
 create a new instance of potential specified by configPotential
 
void initDensity ()
 initialize the density model (it may be the same as potential, or just a subset of it)
 
void initIC ()
 set up initial conditions for a single orbit integration (calc E from X,Y,Z or vice-versa, calc timeUnit, etc)
 
void startOrbit ()
 start thread that runs single orbit integration
 
void buildFreqMapIC (double energy, bool useExistingIC)
 create initial conditions for orbit library for frequency map at given energy
 
void buildSchwIC (bool useExistingIC)
 create initial conditions for orbit library for Schwarzschild model
 
void startOrbitLibrary (const char *finishSignal)
 start several threads to integrate orbits in the orbit library
 
void schwStartOptimization (CBasicSchwModel::MODELTYPE modeltype)
 start thread that solves Schwarzschild optimization problem
 
void schwExportNbody (int numPoints, const QString &fileName, const QString &fileFormat, int numBinsRefine)
 export Schw model to Nbody model
 
bool importOrbit (const QString &fileName)
 read trajectory from a text file and assign it to the current orbit
 
bool exportOrbit (const QString &fileName)
 export current orbit into a text file
 
bool exportPotential (const QString &fileName, size_t indComp=0)
 export potential file (values of potential and forces in certain points of space, for statistics)
 
bool importOrbitLib (const QString &fileName, bool withModelData)
 load orbit library from a text file, possibly with Schwarzschild data from an accompanying binary file
 
bool exportOrbitLib (const QString &fileName, bool withModelData)
 save orbit library to a text file, possibly with Schwarzschild data
 
bool exportSchwModelStats (const QString &fileName)
 export statistical information about the model
 
bool isOrbitIntRunning () const
 inform whether a single orbit integration is running (in a separate thread)
 
bool isOrbitLibRunning () const
 inform whether the orbit library integration is in progress
 
bool isSchwOptRunning () const
 inform whether the optimization is in progress (in a helper thread)
 
bool isExportNbodyRunning () const
 inform whether export to Nbody model is in progress (at any stage)
 

Public Attributes

CConfigCore configCore
 global parameters of the program
 
std::vector< CConfigPotentialconfigPotential
 parameters related to the potential
 
CConfigOrbit configOrbit
 parameters related to orbit integration
 
CPosVelPoint< double > initCond
 initial conditions for a single orbit
 
double initCondE
 energy corresponding to initial conditions
 
double timeUnit
 orbital period for the given energy
 
bool useICe
 whether to use energy as an initial condition instead of position/velocity (applies to freq.map)
 
QString WorkDir
 current working directory (for GUI file dialogs)
 
QString TempDir
 directory for exchanging data with external programs (qdelaunay, bpmpd)
 
QString AppDir
 directory where the application executable is located and external programs are searched for
 
const CPotentialpotential
 instance of potential used in all calculations, created by initPotential()
 
const CDensitydensity
 density for the Schwarzschild model; may be different from the potential
 
COrbitorbit
 current orbit
 
COrbitLibraryorbitlib
 library of orbits (for frequency map and Schwarzschild model)
 
vectorSchwData schwData
 Schwarzschild data objects (density and kinematic constraints)
 

Private Slots

void coreOrbitFinished ()
 called when single orbit integration is done; emits signalOrbitFinished()
 
void coreOrbitLibraryFinished ()
 called upon finish of last thread in building orbit library for frequency map or Schw model; stops timers, clears unused orbits and emits signalOrbitLibraryFinished()
 
void coreSchwOptimizationFinished (const QString &result)
 called upon finish of Schwarzschild optimization; destroys the model object and emits signalSchwOptimizationFinished()
 
void coreNbodyExportFinished (const QString &result)
 called when export to nbody model is finished; clears the filename and emits signalNbodyExportFinished()
 
void coreNbodyExport ()
 perform actual work on export to nbody file. More...
 

Private Member Functions

void initSchwData ()
 create a set of schwData objects specified by config->modeltype
 
bool exportPotentialAtPoints (const CPotential *poten, const QString &fileName, const vectord points[N_DIM], int blockSize=0)
 actually do export potential, forces and density at given set of points
 
virtual void timerEvent (QTimerEvent *)
 to display progress indicator in orbit library integration
 

Private Attributes

int maxNumThread
 number of concurrent threads in orbit integration (set in ini file or automatically)
 
int orbitLibTimer
 timer ID for displaying progress in orbit library integration; set to 0 when no integration is in progress
 
bool orbitIntRunning
 set to true for the duration of single orbit integration
 
CBasicSchwModelschwModel
 instance of Schw model object internally created for the duration of optimization
 
COrbitLauncherlauncherOrbit
 instance of orbit launcher for a single orbit integration
 
COrbitLauncherlauncherLib
 instance of orbit launcher for the orbit library
 
COrbitRuntimeTrajSampleCreatortrajSampleCreator
 pointer to the runtime function creator that collects trajectory samples (used in reintegration during export to Nbody)
 
int numPointsNbodyExport
 number of points in Nbody model
 
QString fileNameNbodyExport
 Nbody snapshot filename. If assigned, it means that the export is in progress.
 
QString fileFormatNbodyExport
 format selector for Nbody snapshot
 
int numBinsRefineNbodyExport
 if mass refinement in Nbody model is used, this is the number of mass bins
 
bool firstCallNbodyExport
 flag signalling if the coreNbodyExport() was called for the first time or after reintegration
 

Detailed Description

Class that provides all core computational functionality.

It contains configuration parameters and routines to load/save them in an ini file; routines for managing orbit library integration, Schwarzschild modelling and export of a model to an Nbody snapshot; manages import/export of data to text/binary files. This class is used in the console version - by CSmileConsole, and in the GUI - by CSmileGUI. Most computational tasks are performed in separate threads by worker objects; there are four of them:

Member Function Documentation

void smile::CSmileCore::coreNbodyExport ( )
privateslot

perform actual work on export to nbody file.

The export consists of three stages:


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