mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
converted event based queues and particle buffer into SharedArrays
This commit is contained in:
parent
0894b608d1
commit
6bf15297ec
5 changed files with 74 additions and 91 deletions
|
|
@ -29,7 +29,6 @@ public:
|
|||
SharedArray(int64_t capacity) : capacity_(capacity)
|
||||
{
|
||||
data_ = std::make_unique<T[]>(capacity);
|
||||
size_ = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -45,7 +44,7 @@ public:
|
|||
|
||||
//! Increases the size of the SharedArray by one and returns an index to the
|
||||
//! last element of the array.
|
||||
int64_t append()
|
||||
int64_t thread_safe_append()
|
||||
{
|
||||
// Atomically capture the index we want to write to
|
||||
int64_t idx;
|
||||
|
|
@ -70,9 +69,13 @@ public:
|
|||
}
|
||||
|
||||
int64_t size() {return size_;}
|
||||
|
||||
int64_t resize(int64_t size) {size_ = size;}
|
||||
|
||||
int64_t capacity() {return capacity_;}
|
||||
|
||||
T* data() {return data_.get();}
|
||||
|
||||
};
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue