FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Parallel::FMTtask Class Reference

#include <FMTtask.hpp>

Inheritance diagram for Parallel::FMTtask:
[legend]
Collaboration diagram for Parallel::FMTtask:
[legend]

Public Member Functions

 FMTtask ()
 
virtual ~FMTtask ()=default
 
 FMTtask (const FMTtask &rhs)
 
FMTtaskoperator= (const FMTtask &rhs)
 
virtual std::unique_ptr< FMTtaskclone () const
 
virtual std::vector< std::unique_ptr< FMTtask > > split (const unsigned int &numberoftasks) const
 
virtual std::unique_ptr< FMTtaskspawn ()
 
virtual void work ()
 
virtual void finalize ()
 
bool isdone () const
 
std::string getthreadid () const
 
- Public Member Functions inherited from Core::FMTobject
 FMTobject ()
 
virtual ~FMTobject ()
 
 FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler)
 
 FMTobject (const FMTobject &rhs)
 
FMTobjectoperator= (const FMTobject &rhs)
 
virtual void passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger)
 
void passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler)
 
void redirectlogtofile (const std::string &location)
 
virtual void setdefaultlogger ()
 
virtual void setquietlogger ()
 
virtual void settasklogger ()
 
virtual void setdebuglogger ()
 
void setdefaultexceptionhandler ()
 
void setquietexceptionhandler ()
 
void setdebugexceptionhandler ()
 
void setfreeexceptionhandler ()
 
void disablenestedexceptions ()
 
void enablenestedexceptions ()
 
void seterrorstowarnings (const std::vector< Exception::FMTexc > &errors)
 
void setmaxwarningsbeforesilenced (const size_t &maxwarningcount)
 

Protected Member Functions

void setstatus (bool status)
 
std::vector< size_t > splitwork (int numberoftasks, const int &totalworksize) const
 
- Protected Member Functions inherited from Core::FMTobject
template<class Archive >
void forcesave (Archive &ar, const unsigned int version) const
 
template<class Archive >
void forceload (Archive &ar, const unsigned int version)
 
void checksignals () const
 
void setCPLhandler ()
 

Protected Attributes

std::unique_ptr< Logging::FMTloggertasklogger
 

Static Protected Attributes

static boost::recursive_mutex taskmutex
 Recursive mutex for the task.
 
- Static Protected Attributes inherited from Core::FMTobject
static std::shared_ptr< Exception::FMTexceptionhandler_exhandler
 A shared pointer to the exception handler.
 
static std::shared_ptr< Logging::FMTlogger_logger
 A shared pointer to the logger.
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::FMTobject
static std::string getruntimelocation ()
 
static unsigned long long getavailablememory ()
 
- Static Protected Member Functions inherited from Core::FMTobject
static std::chrono::time_point< std::chrono::high_resolution_clock > getclock ()
 
template<class chrono >
static double getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 
static std::string getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 

Detailed Description

Task for parallel jobs needs to implement a clone / work / split functions for your task to used it in the taskhandler.

Constructor & Destructor Documentation

◆ FMTtask() [1/2]

Parallel::FMTtask::FMTtask ( )

Default constructor for FMTtask

◆ ~FMTtask()

virtual Parallel::FMTtask::~FMTtask ( )
virtualdefault

FMTtask default virutal destructor.

◆ FMTtask() [2/2]

Parallel::FMTtask::FMTtask ( const FMTtask rhs)

Default copy constructor for FMTtask

Member Function Documentation

◆ clone()

virtual std::unique_ptr< FMTtask > Parallel::FMTtask::clone ( ) const
virtual

◆ finalize()

virtual void Parallel::FMTtask::finalize ( )
virtual

If this function is overrided it will be called right after the last task is done

Reimplemented in Parallel::FMTopareaschedulertask, Parallel::FMTplanningtask, and Parallel::FMTreplanningtask.

◆ getthreadid()

std::string Parallel::FMTtask::getthreadid ( ) const

Get the thread id of the task.

◆ isdone()

bool Parallel::FMTtask::isdone ( ) const

Returns true if the job is all done.

◆ operator=()

FMTtask & Parallel::FMTtask::operator= ( const FMTtask rhs)

Default copy constructor for FMTtask

◆ setstatus()

void Parallel::FMTtask::setstatus ( bool  status)
protected

Change the status of the task

◆ spawn()

virtual std::unique_ptr< FMTtask > Parallel::FMTtask::spawn ( )
virtual

Will spawn a minimal task from the master task

Reimplemented in Parallel::FMTopareaschedulertask, Parallel::FMTplanningtask, and Parallel::FMTreplanningtask.

◆ split()

virtual std::vector< std::unique_ptr< FMTtask > > Parallel::FMTtask::split ( const unsigned int &  numberoftasks) const
virtual

Function to split the actual task in multiple tasks.

Reimplemented in Parallel::FMTopareaschedulertask, Parallel::FMTplanningtask, and Parallel::FMTreplanningtask.

◆ splitwork()

std::vector< size_t > Parallel::FMTtask::splitwork ( int  numberoftasks,
const int &  totalworksize 
) const
protected

Split the totalworksize in much possible equal buckets.

◆ work()

virtual void Parallel::FMTtask::work ( )
virtual

This function is the main job executed by the thread.

Reimplemented in Parallel::FMTopareaschedulertask, Parallel::FMTplanningtask, and Parallel::FMTreplanningtask.

Member Data Documentation

◆ tasklogger

std::unique_ptr<Logging::FMTlogger> Parallel::FMTtask::tasklogger
protected

Logger for solver in parallel...coinmessagehandler does not support concurency. This logger wont print anything so dont use it in parallel.

◆ taskmutex

boost::recursive_mutex Parallel::FMTtask::taskmutex
staticprotected

Recursive mutex for the task.


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