votca 2024-dev
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Attributes | List of all members
votca::csg::CsgApplication Class Reference

#include <csgapplication.h>

Inheritance diagram for votca::csg::CsgApplication:
Inheritance graph
[legend]
Collaboration diagram for votca::csg::CsgApplication:
Collaboration graph
[legend]

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
 
virtual void Initialize ()=0
 Initialize application data.
 
virtual bool EvaluateOptions ()=0
 Process command line options.
 
void CheckRequired (const std::string &option_name, const std::string &error_msg="")
 Check weather required option is set.
 
virtual void Run ()=0
 Main body of application.
 
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
 

Additional Inherited Members

virtual void ShowHelpText (std::ostream &out)
 

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 CsgBoltzmann, CsgFluctuations, CsgPartialRdfApp, CGOrderParam, TrajForce, CsgDensityApp, CsgDumpApp, CGForceMatching, CsgMapApp, CsgREupdate, CsgStatApp, DLPTopolApp, and GmxTopolApp.

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 CsgPartialRdfApp, CsgDensityApp, CsgDumpApp, and CsgStatApp.

Definition at line 53 of file csgapplication.h.

◆ DoThreaded()

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

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

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 CsgBoltzmann, CsgTestApp, CsgParallelTestApp, CsgFluctuations, OrientCorrApp, CsgPartialRdfApp, CsgRadiiApp, CGOrderParam, TrajForce, CsgDensityApp, CGForceMatching, CsgMapApp, CsgREupdate, and CsgStatApp.

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 CsgBoltzmann, CsgFluctuations, CsgPartialRdfApp, TrajForce, CsgDensityApp, CsgMapApp, CsgREupdate, CsgStatApp, DLPTopolApp, and GmxTopolApp.

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 CsgBoltzmann, DLPTopolApp, CsgDumpApp, 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 CsgPartialRdfApp, CsgStatApp, CsgParallelTestApp, OrientCorrApp, and CsgREupdate.

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 CsgBoltzmann, CsgTestApp, CsgParallelTestApp, CsgFluctuations, OrientCorrApp, CsgPartialRdfApp, CsgRadiiApp, CsgDensityApp, CsgDumpApp, CsgMapApp, CsgREupdate, CsgStatApp, TrajForce, DLPTopolApp, and GmxTopolApp.

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 CsgPartialRdfApp, CsgStatApp, CsgParallelTestApp, OrientCorrApp, and CsgREupdate.

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 CsgBoltzmann, and 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 OrientCorrApp, CsgPartialRdfApp, CsgREupdate, and CsgStatApp.

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: