 |
AGXDynamics
2.35.0.2
|
Go to the documentation of this file.
17 #ifndef AGX_GLOBALRESULT_H
18 #define AGX_GLOBALRESULT_H
21 # pragma warning(push)
22 # pragma warning( disable : 4290 ) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
43 class EntityDataParameter;
87 bool commit(
Index sortIndex);
98 BufferSet *getBufferSet();
137 template <
typename T>
142 template <
typename T>
179 virtual void handleOverflow(
size_t overflowSize) = 0;
181 template <
typename T>
182 size_t calculateInitialCapacity(
const T *target);
184 size_t calculateIncreasedCapacity(
size_t currentCapacity,
size_t overflowSize);
186 void finalizeTransactions();
191 BufferSet *createNewSet(
size_t capacity);
192 BufferSet *reportFailedTransaction(
Transaction *transaction);
193 void reportFailedTransaction(
const IndexRange& transactionRange, BufferSet *startSet);
194 void reportCompletedTransaction(
Transaction *transaction);
224 BufferSet(
size_t index,
size_t capacity);
227 void init(
size_t index,
size_t capacity);
230 size_t getIndex()
const;
233 size_t getCapacity()
const;
236 void addOverflow(
const OverflowBuffer& buffer);
239 void addFailedTransaction(
const IndexRange& transactionRange);
269 void prepare(
Task *task);
277 virtual void handleOverflow(
size_t overflowSize)
override;
281 void locateTargets(
Task *task);
286 template <
typename ParameterVectorT>
287 void locateTargets(
const ParameterVectorT& parameters);
293 bool m_targetInstanceBuffer;
304 void prepare(
Task *task);
307 bool isActive()
const;
310 virtual void handleOverflow(
size_t overflowSize)
override;
327 , m_bufferSet(bufferSet)
341 m_target->getMutex().lock();
342 auto currentActiveSet = m_target->getActiveSet();
343 m_target->getMutex().unlock();
345 if (m_bufferSet == currentActiveSet)
348 m_target->reportCompletedTransaction(
this);
352 m_target->m_sortedRanges[sortIndex] = m_range;
357 m_bufferSet = m_target->reportFailedTransaction(
this);
363 agxAssertN(!(m_target->m_settings & (
SORT|
ORDER)) || m_target->m_sortedRanges.empty(),
"%s: Must use extended commit method if SORT or ORDER is specified", m_target->getPath().c_str());
365 m_target->getMutex().lock();
366 BufferSet *currentActiveSet = m_target->getActiveSet();
367 m_target->getMutex().unlock();
369 if (m_bufferSet == currentActiveSet)
372 m_target->reportCompletedTransaction(
this);
378 m_bufferSet = m_target->reportFailedTransaction(
this);
396 template <
typename T>
399 return this->
commit(target, vector.
size(), vector.ptr(), sortIndex);
402 template <
typename T>
405 return this->
commit(target, vector.
size(), vector.ptr());
415 # pragma warning(pop)
bool commit()
Same as above but without deterministic sorting.
@ SORT
Build a permutation table for deterministic ordering of result data.
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
Representation of a path, a list of name components.
BufferSet * getActiveSet()
size_t commit(const agxData::AbstractArray &target, size_t numElements, const void *localResult, Index sortIndex)
Convenience wrapper to perform a complete transaction, this consists of:
std::atomic< agx::Int32 > m_numTransactions
std::atomic< agx::Int32 > m_numCompletedTransactions
BufferSet(size_t index, size_t capacity)
Data storage for a collection of entity instances of a specified EntityModel.
Vector< BufferSetRef > m_bufferSets
Vector containing 'raw' data.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Contains classes for low level data storage for AGX.
std::atomic< agx::Int32 > m_head
A representation of a generic task.
VectorPOD< Transaction > m_transactions
const IndexRange & range() const
agx::UInt getNumOverflows() const
Abstract representation of a data buffer.
VectorPOD< IndexRange > m_sortedRanges
agx::Object is a refcounted object with a name.
@ ORDER
Append to the existing data.
GlobalResult(UInt settings, const Path &bindPath)
Transactions are used to reserve exclusive memory areas in which the threads can write their data.
Base class providing referencing counted objects.
#define AGX_DECLARE_POINTER_TYPES(type)
void prepareResultSorting(size_t numJobs)
GlobalResult * getTarget()
agxData::Buffer * m_resultOrderBuffer
#define agxAssertN(expr, format,...)
void AGXPHYSICS_EXPORT init()
Initialize agx.
Transaction allocateResult(size_t numElements)
Allocate a transaction.
std::atomic< size_t > m_capacity
GlobalResult is used by kernels to generate result data from different threads.
BufferSet * getBufferSet()