votca 2025.1-dev
Loading...
Searching...
No Matches
votca::csg::CsgApplication Class Reference

#include <csgapplication.h>

Inheritance diagram for votca::csg::CsgApplication:
Collaboration diagram for votca::csg::CsgApplication:

Classes

class  Worker
 Worker, derived from Thread, does the work. More...

Public Member Functions

 CsgApplication ()=default
 ~CsgApplication () override=default
void Initialize () override
 Initialize application data.
bool EvaluateOptions () override
 Process command line options.
void Run (void) override
 Main body of application.
void ShowHelpText (std::ostream &out) override
virtual bool DoMapping (void)
 overload and return true to enable mapping command line options
virtual bool DoMappingDefault (void)
 if DoMapping is true, will by default require mapping or not
virtual bool DoTrajectory (void)
 overload and return true to enable trajectory command line options
virtual bool DoThreaded (void)
virtual bool SynchronizeThreads (void)
virtual bool NeedsTopology (void)
 if topology is always needed
virtual bool EvaluateTopology (Topology *, Topology *=nullptr)
 called after topology was loaded
void AddObserver (CGObserver *observer)
virtual void BeginEvaluate (Topology *top, Topology *top_ref=nullptr)
 called before the first frame
virtual void EndEvaluate ()
 called after the last frame
virtual void EvalConfiguration (Topology *top, Topology *top_ref=nullptr)
bool ProcessData (Worker *worker)
 Gets frames from TrajectoryReader in an ordered way and, if successful, calls Worker::EvalConfiguration for that frame.
virtual std::unique_ptr< WorkerForkWorker (void)
virtual void MergeWorker (Worker *worker)
Public Member Functions inherited from votca::tools::Application
 Application ()
virtual ~Application ()
int Exec (int argc, char **argv)
 executes the program
virtual std::string ProgramName ()=0
 program name
virtual std::string VersionString ()
 version string of application
virtual void HelpText (std::ostream &out)=0
 help text of application without version information
void CheckRequired (const std::string &option_name, const std::string &error_msg="")
 Check weather required option is set.
boost::program_options::options_description_easy_init AddProgramOptions (const std::string &group="")
 add option for command line
boost::program_options::variables_map & OptionsMap ()
 get available program options & descriptions
boost::program_options::options_description & OptionsDesc ()
boost::program_options::options_description & VisibleOptions ()
 filters out the Hidden group from the options descriptions
void StopExecution ()
 call StopExecution after EvaluateOptions

Protected Attributes

std::list< CGObserver * > observers_
bool do_mapping_
std::vector< std::unique_ptr< Worker > > myWorkers_
Index nframes_
bool is_first_frame_
Index nthreads_
tools::Mutex nframesMutex_
tools::Mutex traj_readerMutex_
std::vector< std::unique_ptr< tools::Mutex > > threadsMutexesIn_
 stores Mutexes used to impose order for input
std::vector< std::unique_ptr< tools::Mutex > > threadsMutexesOut_
 stores Mutexes used to impose order for output
std::unique_ptr< TrajectoryReadertraj_reader_
Protected Attributes inherited from votca::tools::Application
std::map< std::string, boost::program_options::options_description > op_groups_
bool continue_execution_ = true

Detailed Description

Definition at line 36 of file csgapplication.h.

Constructor & Destructor Documentation

◆ CsgApplication()

votca::csg::CsgApplication::CsgApplication ( )
default

◆ ~CsgApplication()

votca::csg::CsgApplication::~CsgApplication ( )
overridedefault

Member Function Documentation

◆ AddObserver()

void votca::csg::CsgApplication::AddObserver ( CGObserver * observer)
inline

Definition at line 170 of file csgapplication.h.

◆ BeginEvaluate()

void votca::csg::CsgApplication::BeginEvaluate ( Topology * top,
Topology * top_ref = nullptr )
virtual

◆ DoMapping()

virtual bool votca::csg::CsgApplication::DoMapping ( void )
inlinevirtual

overload and return true to enable mapping command line options

Reimplemented in CGForceMatching, CGOrderParam, CsgDensityApp, CsgDumpApp, CsgFluctuations, CsgMapApp, CsgPartialRdfApp, CsgREupdate, CsgStatApp, DLPTopolApp, GmxTopolApp, and TrajForce.

Definition at line 50 of file csgapplication.h.

◆ DoMappingDefault()

virtual bool votca::csg::CsgApplication::DoMappingDefault ( void )
inlinevirtual

if DoMapping is true, will by default require mapping or not

Reimplemented in CsgDensityApp, CsgDumpApp, CsgPartialRdfApp, and CsgStatApp.

Definition at line 53 of file csgapplication.h.

◆ DoThreaded()

virtual bool votca::csg::CsgApplication::DoThreaded ( void )
inlinevirtual

Reimplemented in CsgParallelTestApp, CsgPartialRdfApp, CsgREupdate, CsgStatApp, and OrientCorrApp.

Definition at line 59 of file csgapplication.h.

◆ DoTrajectory()

virtual bool votca::csg::CsgApplication::DoTrajectory ( void )
inlinevirtual

overload and return true to enable trajectory command line options

Reimplemented in CGForceMatching, CGOrderParam, CsgDensityApp, CsgFluctuations, CsgMapApp, CsgParallelTestApp, CsgPartialRdfApp, CsgRadiiApp, CsgREupdate, CsgStatApp, CsgTestApp, OrientCorrApp, and TrajForce.

Definition at line 56 of file csgapplication.h.

◆ EndEvaluate()

void votca::csg::CsgApplication::EndEvaluate ( )
virtual

◆ EvalConfiguration()

void votca::csg::CsgApplication::EvalConfiguration ( Topology * top,
Topology * top_ref = nullptr )
virtual

◆ EvaluateOptions()

bool votca::csg::CsgApplication::EvaluateOptions ( )
overridevirtual

Process command line options.

Returns
true to continue, false to stop

EvaluateOptions is called by Run after parsing the command line. return true if everything is ok, false to stop and show help text.

Implements votca::tools::Application.

Reimplemented in CsgDensityApp, CsgFluctuations, CsgMapApp, CsgPartialRdfApp, CsgREupdate, CsgStatApp, DLPTopolApp, GmxTopolApp, and TrajForce.

Definition at line 87 of file csgapplication.cc.

◆ EvaluateTopology()

virtual bool votca::csg::CsgApplication::EvaluateTopology ( Topology * ,
Topology * = nullptr )
inlinevirtual

called after topology was loaded

Reimplemented in CsgDumpApp, DLPTopolApp, and GmxTopolApp.

Definition at line 76 of file csgapplication.h.

◆ ForkWorker()

std::unique_ptr< CsgApplication::Worker > votca::csg::CsgApplication::ForkWorker ( void )
virtual

User is required to overload ForkWorker and initialize workers.

Returns
worker

Reimplemented in CsgParallelTestApp, CsgPartialRdfApp, CsgREupdate, CsgStatApp, and OrientCorrApp.

Definition at line 431 of file csgapplication.cc.

◆ Initialize()

void votca::csg::CsgApplication::Initialize ( )
overridevirtual

Initialize application data.

Initialize is called by run before parsing the command line. All necessary command line arguments can be added here

Implements votca::tools::Application.

Reimplemented in CsgDensityApp, CsgDumpApp, CsgFluctuations, CsgMapApp, CsgParallelTestApp, CsgPartialRdfApp, CsgRadiiApp, CsgREupdate, CsgStatApp, CsgTestApp, DLPTopolApp, GmxTopolApp, OrientCorrApp, and TrajForce.

Definition at line 34 of file csgapplication.cc.

◆ MergeWorker()

void votca::csg::CsgApplication::MergeWorker ( CsgApplication::Worker * worker)
virtual

User is required to overload MergeWorker and merge data from each worker.

Parameters
worker

Reimplemented in CsgParallelTestApp, CsgPartialRdfApp, CsgREupdate, CsgStatApp, and OrientCorrApp.

Definition at line 436 of file csgapplication.cc.

◆ NeedsTopology()

virtual bool votca::csg::CsgApplication::NeedsTopology ( void )
inlinevirtual

if topology is always needed

Reimplemented in CsgREupdate.

Definition at line 72 of file csgapplication.h.

◆ ProcessData()

bool votca::csg::CsgApplication::ProcessData ( Worker * worker)

Gets frames from TrajectoryReader in an ordered way and, if successful, calls Worker::EvalConfiguration for that frame.

Parameters
worker
Returns
True if frames left for calculation, else False

Definition at line 148 of file csgapplication.cc.

◆ Run()

void votca::csg::CsgApplication::Run ( void )
overridevirtual

Main body of application.

Run is called after command line was parsed + evaluated. All the work should be done in here.

Implements votca::tools::Application.

Reimplemented in CsgREupdate.

Definition at line 200 of file csgapplication.cc.

◆ ShowHelpText()

void votca::csg::CsgApplication::ShowHelpText ( std::ostream & out)
overridevirtual

Reimplemented from votca::tools::Application.

Definition at line 125 of file csgapplication.cc.

◆ SynchronizeThreads()

virtual bool votca::csg::CsgApplication::SynchronizeThreads ( void )
inlinevirtual

Reimplemented in CsgPartialRdfApp, CsgREupdate, CsgStatApp, and OrientCorrApp.

Definition at line 63 of file csgapplication.h.

Member Data Documentation

◆ do_mapping_

bool votca::csg::CsgApplication::do_mapping_
protected

Definition at line 155 of file csgapplication.h.

◆ is_first_frame_

bool votca::csg::CsgApplication::is_first_frame_
protected

Definition at line 158 of file csgapplication.h.

◆ myWorkers_

std::vector<std::unique_ptr<Worker> > votca::csg::CsgApplication::myWorkers_
protected

Definition at line 156 of file csgapplication.h.

◆ nframes_

Index votca::csg::CsgApplication::nframes_
protected

Definition at line 157 of file csgapplication.h.

◆ nframesMutex_

tools::Mutex votca::csg::CsgApplication::nframesMutex_
protected

Definition at line 160 of file csgapplication.h.

◆ nthreads_

Index votca::csg::CsgApplication::nthreads_
protected

Definition at line 159 of file csgapplication.h.

◆ observers_

std::list<CGObserver *> votca::csg::CsgApplication::observers_
protected

Definition at line 154 of file csgapplication.h.

◆ threadsMutexesIn_

std::vector<std::unique_ptr<tools::Mutex> > votca::csg::CsgApplication::threadsMutexesIn_
protected

stores Mutexes used to impose order for input

Definition at line 164 of file csgapplication.h.

◆ threadsMutexesOut_

std::vector<std::unique_ptr<tools::Mutex> > votca::csg::CsgApplication::threadsMutexesOut_
protected

stores Mutexes used to impose order for output

Definition at line 166 of file csgapplication.h.

◆ traj_reader_

std::unique_ptr<TrajectoryReader> votca::csg::CsgApplication::traj_reader_
protected

Definition at line 167 of file csgapplication.h.

◆ traj_readerMutex_

tools::Mutex votca::csg::CsgApplication::traj_readerMutex_
protected

Definition at line 161 of file csgapplication.h.


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