115 const int indexCount,
const ParticleIndex* particleIndices,
const bool sorted,T* values)
117 assert(typeCheck<T>(attribute.
type));
125 return static_cast<T*>(
dataInternal(attribute,particleIndex));
149 const ParticleIndex* particleIndices,
const bool sorted,
float* values)
const=0;
154 virtual void findPoints(
const float bboxMin[3],
const float bboxMax[3],
155 std::vector<ParticleIndex>& points)
const=0;
162 virtual float findNPoints(
const float center[3],
int nPoints,
const float maxRadius,
163 std::vector<ParticleIndex>& points,std::vector<float>& pointDistancesSquared)
const=0;
168 virtual int findNPoints(
const float center[3],
int nPoints,
const float maxRadius,
169 ParticleIndex *points,
float *pointDistancesSquared,
float *finalRadius2)
const=0;
186 const ParticleIndex* particleIndices,
const bool sorted,
char* values)
const=0;
210 return static_cast<T*>(
dataInternal(attribute,particleIndex));
224 T* ptr = static_cast<T*>(
dataInternal(attribute, particleIndex));
245 virtual void sort()=0;
279 ParticlesDataMutable*
create();
285 ParticlesDataMutable*
cloneSchema(
const ParticlesData&);
290 ParticlesDataMutable*
clone(
const ParticlesData&,
bool particles=
true);
294 ParticlesDataMutable*
read(
const char* filename,
const bool verbose=
true,std::ostream& errorStream=std::cerr);
298 ParticlesInfo*
readHeaders(
const char* filename,
const bool verbose=
true,std::ostream& errorStream=std::cerr);
302 void write(
const char* filename,
const ParticlesData&,
const bool forceCompressed=
false,
bool verbose=
true,std::ostream& errorStream=std::cerr);
311 ParticlesData*
readCached(
const char* filename,
const bool sort,
const bool verbose=
true,std::ostream& errorStream=std::cerr);
331 void print(
const ParticlesData* particles);
333 ParticlesDataMutable*
computeClustering(ParticlesDataMutable* particles,
const int numNeighbors,
const double radiusSearch,
const double radiusInside,
const int connections,
const double density);
345 void merge(ParticlesDataMutable& base,
const ParticlesData& delta,
const std::string& identifier=std::string());
Fixed Attribute Interface.
Definition: PartioAttribute.h:123
ParticleAttributeType type
Type of attribute.
Definition: PartioAttribute.h:127
virtual int numAttributes() const =0
Number of per-particle attributes.
virtual void setFixedIndexedStr(const FixedAttribute &attribute, int indexedStringToken, const char *str)=0
Returns a token for the given string. This allows efficient storage of string data.
void merge(ParticlesDataMutable &base, const ParticlesData &delta, const std::string &identifier=std::string())
Merges one particle set into another.
ParticleIterator< true > const_iterator
Definition: Partio.h:109
virtual int registerIndexedStr(const ParticleAttribute &attribute, const char *str)=0
Returns a token for the given string. This allows efficient storage of string data.
iterator begin()
Produce a beginning iterator for the particles.
Definition: Partio.h:263
virtual int lookupFixedIndexedStr(const FixedAttribute &attribute, const char *str) const =0
Looks up the index for a given string for a given attribute, returns -1 if not found.
ParticlesDataMutable * create()
Provides an empty particle instance, freed with p->release()
virtual void dataInternalMultiple(const ParticleAttribute &attribute, const int indexCount, const ParticleIndex *particleIndices, const bool sorted, char *values) const =0
Particle Collection Interface.
Definition: Partio.h:66
ParticleIterator< false > iterator
Definition: Partio.h:202
virtual iterator setupIterator(const int index=0)=0
Produce a const iterator.
void data(const ParticleAttribute &attribute, const int indexCount, const ParticleIndex *particleIndices, const bool sorted, T *values)
Definition: Partio.h:114
const T * data(const ParticleAttribute &attribute, const ParticleIndex particleIndex) const
Definition: Partio.h:121
virtual iterator addParticles(const int count)=0
virtual void dataAsFloat(const ParticleAttribute &attribute, const int indexCount, const ParticleIndex *particleIndices, const bool sorted, float *values) const =0
virtual FixedAttribute addFixedAttribute(const char *attribute, ParticleAttributeType type, const int count)=0
Adds a fixed attribute with the provided name, type and count.
T * fixedDataWrite(const FixedAttribute &attribute) const
Definition: Partio.h:215
Particle Data Interface.
Definition: Partio.h:102
const_iterator begin() const
Produce a beginning iterator for the particles.
Definition: Partio.h:175
const T * fixedData(const FixedAttribute &attribute) const
Definition: Partio.h:128
iterator end()
Produce a ending iterator for the particles.
Definition: Partio.h:267
void setFixed(const FixedAttribute &attribute, const T *data)
Definition: Partio.h:228
virtual bool attributeInfo(const char *attributeName, ParticleAttribute &attribute) const =0
Lookup an attribute by name and store a handle to the attribute.
Definition: PartioIterator.h:66
const_iterator end() const
Produce a ending iterator for the particles.
Definition: Partio.h:179
int count
Number of entries, should be 3 if type is VECTOR.
Definition: PartioAttribute.h:130
uint64_t ParticleIndex
Opaque random access method to a single particle. No number is implied or guaranteed.
Definition: Partio.h:55
int TypeSize(ParticleAttributeType attrType)
Definition: PartioAttribute.h:75
virtual void * dataInternal(const ParticleAttribute &attribute, const ParticleIndex particleIndex) const =0
virtual int lookupIndexedStr(const ParticleAttribute &attribute, const char *str) const =0
Looks up the index for a given string for a given attribute, returns -1 if not found.
void endCachedAccess(ParticlesData *particles)
End accessing data in a cached file.
virtual ~ParticlesDataMutable()
Definition: Partio.h:198
ParticlesDataMutable * clone(const ParticlesData &, bool particles=true)
virtual bool fixedAttributeInfo(const char *attributeName, FixedAttribute &attribute) const =0
Lookup an attribute by name and store a handle to the attribute.
virtual const_iterator setupConstIterator(const int index=0) const =0
Produce a const iterator.
T * dataWrite(const ParticleAttribute &attribute, const ParticleIndex particleIndex) const
Definition: Partio.h:206
Particle Mutable Data Interface.
Definition: Partio.h:195
ParticlesDataMutable * computeClustering(ParticlesDataMutable *particles, const int numNeighbors, const double radiusSearch, const double radiusInside, const int connections, const double density)
ParticlesDataMutable * cloneSchema(const ParticlesData &)
virtual int registerFixedIndexedStr(const FixedAttribute &attribute, const char *str)=0
Returns a token for the given string. This allows efficient storage of string data.
void write(const char *filename, const ParticlesData &, const bool forceCompressed=false, bool verbose=true, std::ostream &errorStream=std::cerr)
ParticlesDataMutable * createInterleave()
ParticlesDataMutable * read(const char *filename, const bool verbose=true, std::ostream &errorStream=std::cerr)
ParticlesInfo * readHeaders(const char *filename, const bool verbose=true, std::ostream &errorStream=std::cerr)
void beginCachedAccess(ParticlesData *particles)
Begin accessing data in a cached file.
virtual ~ParticlesData()
Definition: Partio.h:105
virtual int numFixedAttributes() const =0
Number of fixed attributes.
Particle Collection Interface.
Definition: PartioAttribute.h:96
virtual ParticleIndex addParticle()=0
Add a particle to the particle set. Returns the offset to the particle.
virtual int numParticles() const =0
Number of particles in the structure.
virtual ~ParticlesInfo()
Definition: Partio.h:69
virtual const std::vector< std::string > & fixedIndexedStrs(const FixedAttribute &attr) const =0
All indexed strings for an attribute.
virtual void * dataInternal(const ParticleAttribute &attribute, const ParticleIndex particleIndex) const =0
virtual const std::vector< std::string > & indexedStrs(const ParticleAttribute &attr) const =0
All indexed strings for an attribute.
ParticleAttributeType
Definition: PartioAttribute.h:47
ParticlesData * readCached(const char *filename, const bool sort, const bool verbose=true, std::ostream &errorStream=std::cerr)
Cached (only one copy) read only way to read a particle file.
virtual void setIndexedStr(const ParticleAttribute &attribute, int indexedStringToken, const char *str)=0
Returns a token for the given string. This allows efficient storage of string data.
virtual void * fixedDataInternal(const FixedAttribute &attribute) const =0
virtual float findNPoints(const float center[3], int nPoints, const float maxRadius, std::vector< ParticleIndex > &points, std::vector< float > &pointDistancesSquared) const =0
virtual void * fixedDataInternal(const FixedAttribute &attribute) const =0
void print(const ParticlesData *particles)
Prints a subset of particle data in a textual form.
int count
Number of entries, should be 3 if type is VECTOR.
Definition: PartioAttribute.h:103
void set(const ParticleAttribute &attribute, const ParticleIndex particleIndex, const T *data)
Set particle value for attribute.
Definition: Partio.h:222
virtual void findPoints(const float bboxMin[3], const float bboxMax[3], std::vector< ParticleIndex > &points) const =0
virtual ParticleAttribute addAttribute(const char *attribute, ParticleAttributeType type, const int count)=0
Adds an attribute to the particle with the provided name, type and count.
friend void freeCached(ParticlesData *particles)
ParticleAttributeType type
Type of attribute.
Definition: PartioAttribute.h:100