votca 2024.2-dev
Loading...
Searching...
No Matches
votca::csg::CsgApplication::Worker Class Referenceabstract

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

#include <csgapplication.h>

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

Public Member Functions

 Worker ()=default
 
virtual void EvalConfiguration (Topology *top, Topology *top_ref=nullptr)=0
 overload with the actual computation
 
Index getId ()
 returns worker id
 
- Public Member Functions inherited from votca::tools::Thread
 Thread ()
 
virtual ~Thread ()
 
void Start ()
 Starts and runs a thread.
 
void WaitDone ()
 WaitDone() will not exit until thread ends computation.
 
bool IsFinished () const
 Checks to see if the thread is done.
 

Protected Member Functions

void Run (void) override
 Run() executes the actual code.
 
void setApplication (CsgApplication *app)
 
void setId (Index id)
 
- Protected Member Functions inherited from votca::tools::Thread

Protected Attributes

CsgApplicationapp_ = nullptr
 
Topology top_
 
Topology top_cg_
 
std::unique_ptr< TopologyMapmap_
 
Index id_ = -1
 

Friends

class CsgApplication
 

Detailed Description

Worker, derived from Thread, does the work.

Worker holds the information about the current frame, either in its own copy (e.g. Topology), or, by reference, from the parent CsgApplication. The computation is shifted from Run() into EvalConfiguration. The user is required to overload ForkWorker and Mergeworker and thereby define the initialization and merging of workers. By default, workers will be executed in correct order according to the frames. Also, output will follow the same order. Mutexes handle the locking of input/output and are also used to impose the correct order of frames for in/output.

Definition at line 105 of file csgapplication.h.

Constructor & Destructor Documentation

◆ Worker()

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

Member Function Documentation

◆ EvalConfiguration()

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

overload with the actual computation

Implemented in CsgREupdateWorker, MyWorker, RDFWorker, votca::csg::Imc::Worker, and votca::csg::RDFCalculator::Worker.

◆ getId()

Index votca::csg::CsgApplication::Worker::getId ( )
inline

returns worker id

Definition at line 114 of file csgapplication.h.

◆ Run()

void votca::csg::CsgApplication::Worker::Run ( void )
overrideprotectedvirtual

Run() executes the actual code.

It is left blank here and must be overloaded, for the thread to do any work. This method should never be called by the user, it is called internally by the Start method.

Implements votca::tools::Thread.

Definition at line 137 of file csgapplication.cc.

◆ setApplication()

void votca::csg::CsgApplication::Worker::setApplication ( CsgApplication * app)
inlineprotected

Definition at line 124 of file csgapplication.h.

◆ setId()

void votca::csg::CsgApplication::Worker::setId ( Index id)
inlineprotected

Definition at line 126 of file csgapplication.h.

Friends And Related Symbol Documentation

◆ CsgApplication

friend class CsgApplication
friend

Definition at line 128 of file csgapplication.h.

Member Data Documentation

◆ app_

CsgApplication* votca::csg::CsgApplication::Worker::app_ = nullptr
protected

Definition at line 117 of file csgapplication.h.

◆ id_

Index votca::csg::CsgApplication::Worker::id_ = -1
protected

Definition at line 120 of file csgapplication.h.

◆ map_

std::unique_ptr<TopologyMap> votca::csg::CsgApplication::Worker::map_
protected

Definition at line 119 of file csgapplication.h.

◆ top_

Topology votca::csg::CsgApplication::Worker::top_
protected

Definition at line 118 of file csgapplication.h.

◆ top_cg_

Topology votca::csg::CsgApplication::Worker::top_cg_
protected

Definition at line 118 of file csgapplication.h.


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