17 #ifndef AGX_PARAMETER_H 18 #define AGX_PARAMETER_H 21 # pragma warning( disable: 4714 )// const' marked as __forceinline not inlined 32 namespace agxData {
class FunctionValue; }
93 size_t getIndex()
const;
108 bool isRequired()
const;
113 void setRequired(
bool flag);
141 virtual bool isValid()
const = 0;
171 virtual bool hasGlobalResult()
const;
174 virtual void rebind()
override;
177 virtual void update() = 0;
178 virtual void commit() = 0;
186 virtual void _bind(
Object *binding) = 0;
193 void setTask(
Task *task,
size_t index);
195 virtual void prepareGlobalResultSorting(
size_t numJobs);
221 virtual void configure(TiXmlElement *eParameter)
override;
227 virtual bool isValid()
const override;
234 virtual void _bind(
Object *binding)
override;
235 virtual void update()
override;
236 virtual void commit()
override;
261 virtual void configure(TiXmlElement *eParameter)
override;
273 template <
typename T>
274 const T&
get()
const;
281 template <
typename T>
282 void set(
const T& value);
285 template <
typename T>
286 void write(
const T& value,
const Task* owner);
291 void setExpression(
const String& expression);
297 virtual bool isValid()
const override;
301 void setReal(
Real value );
304 virtual void update()
override;
305 virtual void commit()
override;
309 virtual void _bind(
Object *binding)
override;
335 virtual void configure(TiXmlElement *eParameter)
override;
359 template <
typename T>
362 template <
typename T>
368 void setLocalSize(
size_t numElements);
373 size_t getLocalSize()
const;
378 size_t getNumElements()
const;
384 void setGlobalResultMode(
UInt mode);
389 UInt getGlobalResultMode()
const;
397 virtual bool hasGlobalResult()
const override;
400 virtual bool isValid()
const override;
403 virtual void update()
override;
404 virtual void commit()
override;
408 virtual void _bind(
Object *binding)
override;
409 virtual void prepareGlobalResultSorting(
size_t numJobs)
override;
414 void parentBindCallback(
Parameter *parent);
415 void parentUnbindCallback(
Parameter *parent);
422 size_t m_localMemorySize;
423 UInt m_globalResultMode;
440 virtual void configure(TiXmlElement *eParameter)
override;
447 const Object*
get()
const;
449 template <
typename T>
452 template <
typename T>
453 const T*
get()
const;
455 virtual bool isValid()
const override;
458 virtual void update()
override;
459 virtual void commit()
override;
463 virtual void _bind(
Object *binding)
override;
466 virtual void destroyCallback(
agx::Object*
object)
override;
489 virtual void configure(TiXmlElement *eParameter)
override;
510 agxData::EntityData *getData();
512 template <
typename T>
518 void setGlobalResultMode(
UInt mode);
523 UInt getGlobalResultMode()
const;
532 void setData(agxData::EntityData *dataSet);
536 virtual bool isValid()
const override;
539 virtual void update()
override;
540 virtual void commit()
override;
542 virtual bool hasGlobalResult()
const override;
546 virtual void _bind(
Object *binding)
override;
547 virtual void prepareGlobalResultSorting(
size_t numJobs)
override;
550 void addChildParameter(
Parameter* parameter);
558 agxData::EntityDataRef m_dataSet;
560 UInt m_globalResultMode;
562 bool m_childrenNeedCommit;
575 virtual void configure(TiXmlElement *eParameter)
override;
594 template <
typename T>
598 virtual bool isValid()
const override;
600 virtual void update()
override;
601 virtual void commit()
override;
605 virtual void _bind(
Object *binding)
override;
614 struct AttributeAccess
616 AttributeAccess() : attribute(
nullptr), buffer(
nullptr), mode(
agx::InvalidIndex) {}
637 virtual void configure(TiXmlElement *eParameter)
override;
656 template <
typename T>
660 virtual bool isValid()
const override;
662 virtual void update()
override;
663 virtual void commit()
override;
667 virtual void _bind(
Object *binding)
override;
676 struct AttributeAccess
678 AttributeAccess() : attribute(
nullptr), buffer(
nullptr), mode(
agx::InvalidIndex) {}
716 template <
typename T>
719 agxAssertN(agxData::getFormat<T>() == m_format,
"%s: Type mismatch, parameter is type %s, dereferencing using type %s", this->getPath().c_str(), m_format->fullName().c_str(), agxData::getFormat<T>()->fullName().c_str());
720 agxAssertN(m_value && m_value->isValid(),
"%s: Can not dereference an unbound parameter", this->getPath().c_str());
721 return m_value->get<T>();
724 template <
typename T>
727 if (m_binding.get() != m_value.get())
735 template <
typename T>
743 agxAssert(m_format->is(agxData::getFormat<T>()));
744 *(T*)this->ptr() = value;
749 return const_cast<void *
>(m_value->ptr());
760 return this->get<Real>();
770 template <
typename T>
773 agxAssertN(!m_required || m_buffer,
"%s: Can not dereference an unbound array parameter", this->getPath().c_str());
774 agxAssertN(agxData::getFormat<T>() == m_format,
"%s: Type mismatch, parameter is type %s, dereferencing using type %s", this->getPath().c_str(), m_format->fullName().c_str(), agxData::getFormat<T>()->fullName().c_str());
776 return m_buffer ? m_buffer->getArray<T>() :
static_cast<agxData::Array<T>&
>(s_dummyArray);
779 template <
typename T>
787 return this->getBuffer()->size() / this->getBuffer()->getElementArraySize();
798 template <
typename T>
801 agxAssertN(!this->isRequired() || dynamic_cast<T *>(m_binding.get()),
"%s: Pointer parameter does not have a binding!", getPath().c_str());
802 return static_cast<T *
>(m_binding.get());
808 template <
typename T>
818 template <
typename T>
834 template <
typename T>
842 template <
typename T>
Representation of a path, a list of name components.
AGXCORE_EXPORT agx::UInt getAccessMode(const agx::String &modeName)
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
AGXCORE_EXPORT Type * getType(const agx::String &name)
MetaType
Specify which kind of parameter.
Data storage for a collection of entity instances of a specified EntityModel.
A model is an abstract representation of the class of an agx::Object.
Abstract representation of a value.
AGXCORE_EXPORT Format * getFormat(const agx::String &typeFormatName)
#define agxAssertN(expr, format,...)
agxData::FormatRef m_format
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
#define AGX_DECLARE_POINTER_TYPES(type)
A representation of a generic task.
Representation of a name string.
Arrays are fast accessors into the data, or a portion of it, held by a Buffer.
Type-specific Array used for fast access into the data held by a Buffer.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Templated callback with one argument.
A representation of a task/kernel parameter, which can be bound using a string path or explicitly to ...
An abstract attribute description, part of an Entity.
Abstract representation of a data buffer.
Contains classes for low level data storage for AGX.
EntityInstance parameter.
bool AGXPHYSICS_EXPORT write(const std::string &filename, const agxStream::Serializable *data)
Write a Serializable object to a file.
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
HashTable< String, UnresolvedParameterRef > ParameterTable
AGXTERRAIN_EXPORT TimingStorage & getStorage()
#define AGX_DECLARE_VECTOR_TYPES(type)
Inheritance with partial specialization due to bug with ref_ptr containers.
Event1< Parameter * > Event
An agx::Device is an abstract representation of a device on which data can be stored and processed...
agx::Object is a refcounted object with a name.