Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
ReplicateRunner.h
Go to the documentation of this file.
1/*
2 * University of Illinois Open Source License
3 * Copyright 2011-2018 Luthey-Schulten Group,
4 * All rights reserved.
5 *
6 * Developed by: Luthey-Schulten Group
7 * University of Illinois at Urbana-Champaign
8 * http://www.scs.uiuc.edu/~schulten
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a copy of
11 * this software and associated documentation files (the Software), to deal with
12 * the Software without restriction, including without limitation the rights to
13 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
14 * of the Software, and to permit persons to whom the Software is furnished to
15 * do so, subject to the following conditions:
16 *
17 * - Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimers.
19 *
20 * - Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimers in the documentation
22 * and/or other materials provided with the distribution.
23 *
24 * - Neither the names of the Luthey-Schulten Group, University of Illinois at
25 * Urbana-Champaign, nor the names of its contributors may be used to endorse or
26 * promote products derived from this Software without specific prior written
27 * permission.
28 *
29 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
32 * THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
33 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35 * OTHER DEALINGS WITH THE SOFTWARE.
36 *
37 * Author(s): Elijah Roberts
38 */
39
40#ifndef LM_MAIN_REPLICATERUNNER_H_
41#define LM_MAIN_REPLICATERUNNER_H_
42
43#include <map>
44#include <string>
46#include "me/MESolverFactory.h"
47#include "ReactionModel.pb.h"
48#include "DiffusionModel.pb.h"
49#include "thread/Thread.h"
50#include "thread/Worker.h"
51
52using std::map;
53using std::string;
57
58namespace lm {
59namespace main {
60
63class ReplicateRunner : public Worker
64{
65public:
76 ReplicateRunner(int replicate, MESolverFactory solverFactory, map<string,string> * parameters, lm::io::ReactionModel * reactionModel, lm::io::DiffusionModel * diffusionModel, uint8_t * lattice, size_t latticeSize, uint8_t * latticeSites, size_t latticeSitesSize, ResourceAllocator::ComputeResources resources);
77 virtual ~ReplicateRunner();
78
80 virtual void wake();
83 virtual int run();
84
86 virtual int getReplicate() {return replicate;}
88 virtual bool hasReplicateFinished();
90 virtual int getReplicateExitCode();
91
92protected:
95 map<string,string> * parameters;
96 lm::io::ReactionModel * reactionModel;
97 lm::io::DiffusionModel * diffusionModel;
98 uint8_t * lattice;
100 uint8_t * latticeSites;
103 volatile bool replicateFinished;
104 volatile int replicateExitCode;
105};
106
107}
108}
109
110#endif
size_t latticeSitesSize
Definition ReplicateRunner.h:101
size_t latticeSize
Definition ReplicateRunner.h:99
volatile int replicateExitCode
Definition ReplicateRunner.h:104
virtual int getReplicate()
Get the current replicate number.
Definition ReplicateRunner.h:86
virtual void wake()
Wake the thread from sleep.
Definition ReplicateRunner.cpp:80
MESolverFactory solverFactory
Definition ReplicateRunner.h:94
map< string, string > * parameters
Definition ReplicateRunner.h:95
uint8_t * latticeSites
Definition ReplicateRunner.h:100
virtual int run()
Run the thread.
Definition ReplicateRunner.cpp:84
virtual bool hasReplicateFinished()
Tell whether the previously running replicate has finished running.
Definition ReplicateRunner.cpp:168
lm::io::DiffusionModel * diffusionModel
Definition ReplicateRunner.h:97
virtual int getReplicateExitCode()
Get the exit code for the last replicate to finish.
Definition ReplicateRunner.cpp:183
uint8_t * lattice
Definition ReplicateRunner.h:98
int replicate
Definition ReplicateRunner.h:93
volatile bool replicateFinished
Definition ReplicateRunner.h:103
virtual ~ReplicateRunner()
Definition ReplicateRunner.cpp:76
ResourceAllocator::ComputeResources resources
Definition ReplicateRunner.h:102
lm::io::ReactionModel * reactionModel
Definition ReplicateRunner.h:96
ReplicateRunner(int replicate, MESolverFactory solverFactory, map< string, string > *parameters, lm::io::ReactionModel *reactionModel, lm::io::DiffusionModel *diffusionModel, uint8_t *lattice, size_t latticeSize, uint8_t *latticeSites, size_t latticeSitesSize, ResourceAllocator::ComputeResources resources)
Create a new replicate runner.
Definition ReplicateRunner.cpp:71
A representation for the resources for a given node.
Definition ResourceAllocator.h:62
A factory object used to create Master Equation simulation instances.
Definition MESolverFactory.h:55
An Exception class for handling pthread exceptions.
Definition Thread.h:53
An actual worker Thread that runs a simulation replicate.
Definition Worker.h:51
Worker()
Creates thread and attaches it to the manager.
Definition Worker.cpp:48
Definition CheckpointSignaler.cpp:57
Definition Capsule.cpp:46