Lattice Microbes 2.5
This is for whole cell modeling
Loading...
Searching...
No Matches
LocalDataOutputWorker.h
Go to the documentation of this file.
1/*
2 * University of Illinois Open Source License
3 * Copyright 2008-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_LOCALDATAOUTPUTWORKER
41#define LM_MAIN_LOCALDATAOUTPUTWORKER
42
43#include <queue>
44#include <cstring>
45#include "Types.h"
46#include "io/SimulationFile.h"
48#include "thread/Thread.h"
49#include "thread/Worker.h"
50
51using std::queue;
54
56
57namespace lm {
58namespace main {
59
63{
64public:
68 virtual ~LocalDataOutputWorker();
69
72 virtual void pushDataSet(DataSet * dataSet);
73
75 virtual void wake();
77 virtual void abort();
79 virtual void checkpoint();
80
81protected:
84 virtual int run();
85
86private:
87
88 SimulationFile * file;
89 pthread_cond_t dataAvailable;
90 bool shouldCheckpoint;
91 bool shouldAbort;
92};
93
94}
95}
96
97
98#endif
A representation of the simulation that is used to input or output from an HDF5 file.
Definition SimulationFile.h:79
A set of data in the form of bytes to be written to disk.
Definition DataOutputQueue.h:68
DataOutputQueue()
Create a DataOutputQueue.
Definition DataOutputQueue.cpp:62
virtual void abort()
Abort the thread.
Definition LocalDataOutputWorker.cpp:130
virtual void checkpoint()
Tell the thread to checkpoint at the next available times.
Definition LocalDataOutputWorker.cpp:145
virtual ~LocalDataOutputWorker()
Definition LocalDataOutputWorker.cpp:91
virtual void pushDataSet(DataSet *dataSet)
Push a DataSet for writing.
Definition LocalDataOutputWorker.cpp:96
LocalDataOutputWorker(SimulationFile *file)
Create a new LocalDataOuputWorker.
Definition LocalDataOutputWorker.cpp:85
virtual int run()
Start running the thread.
Definition LocalDataOutputWorker.cpp:165
virtual void wake()
Wake the thread from sleeping state.
Definition LocalDataOutputWorker.cpp:121
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