Skip to content
Browse files

Added Partio 1.1.0 (OSX)

  • Loading branch information...
1 parent 1e60cca commit b43b42d4090b96bb1e71a90f48a6826fadecb1b0 @betajippity committed Feb 5, 2014
View
1 README.md
@@ -13,5 +13,6 @@ Nuparu currently consists of:
* [glslUtility](https://github.com/CIS565-Fall-2012/Project0-Cuda-Checker/blob/master/HW0_MAC/src/glslUtility.cpp) 1.2 (OSX/Linux/Win)
* [Eigen](eigen.tuxfamily.org/) 3.2.0 (OSX/Linux/Win)
* [OpenVDB](http://www.openvdb.org/) 2.1.0 (OSX)
+* [Partio](http://www.disneyanimation.com/technology/partio.html) 1.1.0 (OSX)
Note: OpenVDB's dependencies are dynamically linked, so OpenVDB requires [Ilmbase/OpenEXR](http://www.openexr.com/) and [Intel TBB](https://www.threadingbuildingblocks.org/) to be installed.
View
0 bin/osx/vdb_print → bin/osx/openvdb/vdb_print
File renamed without changes.
View
0 bin/osx/vdb_render → bin/osx/openvdb/vdb_render
File renamed without changes.
View
BIN bin/osx/partio/makecircle
Binary file not shown.
View
BIN bin/osx/partio/makeline
Binary file not shown.
View
BIN bin/osx/partio/partattr
Binary file not shown.
View
BIN bin/osx/partio/partconv
Binary file not shown.
View
BIN bin/osx/partio/partinfo
Binary file not shown.
View
BIN bin/osx/partio/partview
Binary file not shown.
View
BIN bin/osx/partio/test
Binary file not shown.
View
BIN bin/osx/partio/testcache
Binary file not shown.
View
BIN bin/osx/partio/testiterator
Binary file not shown.
View
BIN bin/osx/partio/testkdtree
Binary file not shown.
View
BIN bin/osx/partio/teststr
Binary file not shown.
View
275 include/partio/Partio.h
@@ -0,0 +1,275 @@
+/*
+PARTIO SOFTWARE
+Copyright 2010 Disney Enterprises, Inc. All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+* The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
+Studios" or the names of its contributors may NOT be used to
+endorse or promote products derived from this software without
+specific prior written permission from Walt Disney Pictures.
+
+Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
+IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*/
+
+/*!
+ The interface of the particle API (Partio)
+ what type the primitive is, how many instances of the primitive there, name of
+ the attribute and an index which speeds lookups of data
+*/
+#ifndef _Partioh_
+#define _Partioh_
+
+#include <string>
+#include <vector>
+#include <map>
+#include <stdint.h>
+#include "PartioAttribute.h"
+#include "PartioIterator.h"
+
+namespace Partio{
+
+//! Opaque random access method to a single particle. No number is implied or guaranteed.
+typedef uint64_t ParticleIndex;
+
+class ParticlesData;
+// Particle Collection Interface
+//! Particle Collection Interface
+/*!
+ This class provides ways of accessing basic information about particles,
+ the number in the set, the attribute names and types, etc. No actual
+ data can be read or written.
+*/
+class ParticlesInfo
+{
+protected:
+ virtual ~ParticlesInfo() {}
+public:
+ friend void freeCached(ParticlesData* particles);
+
+ //! Frees the memory if this particle set was created with create() or release()
+ //! Reduces reference count if it was obtained with readCached()
+ //! and if the ref count hits zero, frees the memory
+ virtual void release() const=0;
+
+ //! Number of particles in the structure.
+ virtual int numAttributes() const=0;
+
+ //! Number of per-particle attributes.
+ virtual int numParticles() const=0;
+
+ //! Lookup an attribute by name and store a handle to the attribute.
+ virtual bool attributeInfo(const char* attributeName,ParticleAttribute& attribute) const=0;
+
+ //! Lookup an attribute by index and store a handle to the attribute.
+ virtual bool attributeInfo(const int attributeInfo,ParticleAttribute& attribute) const=0;
+};
+
+// Particle Data Interface
+//! Particle Data Interface
+/*!
+ This interface provides the ability to read data attributes for given particles
+ and search for nearest neighbors using KD-Trees.
+*/
+class ParticlesData:public ParticlesInfo
+{
+protected:
+ virtual ~ParticlesData() {}
+public:
+
+ typedef ParticleIterator<true> const_iterator;
+
+ //! Fill the user supplied values array with data corresponding to the given
+ //! list of particles. Specify whether or not your indices are sorted.
+ //! note if T is void, then type checking is disabled.
+ template<class T> inline void data(const ParticleAttribute& attribute,
+ const int indexCount,const ParticleIndex* particleIndices,const bool sorted,T* values)
+ {
+ assert(typeCheck<T>(attribute.type));
+ dataInternalMultiple(attribute,indexCount,particleIndices,sorted,(char*)values);
+ }
+
+ template<class T> inline const T* data(const ParticleAttribute& attribute,
+ const ParticleIndex particleIndex) const
+ {
+ // TODO: add type checking
+ return static_cast<T*>(dataInternal(attribute,particleIndex));
+ }
+
+ /// All indexed strings for an attribute
+ virtual const std::vector<std::string>& indexedStrs(const ParticleAttribute& attr) const=0;
+
+ /// Looks up the index for a given string for a given attribute, returns -1 if not found
+ virtual int lookupIndexedStr(const ParticleAttribute& attribute,const char* str) const=0;
+
+ //! Fill the user supplied values array with data corresponding to the given
+ //! list of particles. Specify whether or not your indices are sorted. Attributes
+ //! that are not floating types are automatically casted before being placed
+ //! in values.
+ virtual void dataAsFloat(const ParticleAttribute& attribute,const int indexCount,
+ const ParticleIndex* particleIndices,const bool sorted,float* values) const=0;
+
+ //! Find the points within the bounding box specified.
+ //! Must call sort() before using this function
+ //! NOTE: points array is not pre-cleared.
+ virtual void findPoints(const float bboxMin[3],const float bboxMax[3],
+ std::vector<ParticleIndex>& points) const=0;
+
+ //! Find the N nearest neighbors that are within maxRadius distance using STL types
+ //! (measured in standard 2-norm). If less than N are found within the
+ //! radius, the search radius is not increased.
+ //! NOTE: points/pointsDistancesSquared are cleared before use.
+ //! Must call sort() before using this function
+ virtual float findNPoints(const float center[3],int nPoints,const float maxRadius,
+ std::vector<ParticleIndex>& points,std::vector<float>& pointDistancesSquared) const=0;
+
+ //! Find the N nearest neighbors that are within maxRadius distance using POD types
+ //! NOTE: returns the number of found points and leaves in finalRadius2 the
+ //! square of the final search radius used
+ virtual int findNPoints(const float center[3],int nPoints,const float maxRadius,
+ ParticleIndex *points, float *pointDistancesSquared, float *finalRadius2) const=0;
+
+ //! Produce a const iterator
+ virtual const_iterator setupConstIterator() const=0;
+
+ //! Produce a beginning iterator for the particles
+ const_iterator begin() const
+ {return setupConstIterator();}
+
+ //! Produce a ending iterator for the particles
+ const_iterator end() const
+ {return const_iterator();}
+
+private:
+ virtual void* dataInternal(const ParticleAttribute& attribute,const ParticleIndex particleIndex) const=0;
+ virtual void dataInternalMultiple(const ParticleAttribute& attribute,const int indexCount,
+ const ParticleIndex* particleIndices,const bool sorted,char* values) const=0;
+};
+
+// Particle Mutable Data Interface
+//! Particle Mutable Data Interface
+/*!
+ This interface provides the ability to write data attributes, add attributes,
+ add particles, etc.
+*/
+class ParticlesDataMutable:public ParticlesData
+{
+protected:
+ virtual ~ParticlesDataMutable(){}
+
+public:
+
+ typedef ParticleIterator<false> iterator;
+
+ //! Get a pointer to the data corresponding to the given particleIndex and
+ //! attribute given by the attribute handle.
+ template<class T> inline T* dataWrite(const ParticleAttribute& attribute,
+ const ParticleIndex particleIndex) const
+ {
+ // TODO: add type checking
+ return static_cast<T*>(dataInternal(attribute,particleIndex));
+ }
+
+ /// Returns a token for the given string. This allows efficient storage of string data
+ virtual int registerIndexedStr(const ParticleAttribute& attribute,const char* str)=0;
+
+ //! Preprocess the data for finding nearest neighbors by sorting into a
+ //! KD-Tree. Note: all particle pointers are invalid after this call.
+ virtual void sort()=0;
+
+ //! Adds an attribute to the particle with the provided name, type and count
+ virtual ParticleAttribute addAttribute(const char* attribute,ParticleAttributeType type,
+ const int count)=0;
+
+ //! Add a particle to the particle set. Returns the offset to the particle
+ virtual ParticleIndex addParticle()=0;
+
+ //! Add a set of particles to the particle set. Returns the offset to the
+ //! first particle
+ virtual iterator addParticles(const int count)=0;
+
+ //! Produce a beginning iterator for the particles
+ iterator begin()
+ {return setupIterator();}
+
+ //! Produce a ending iterator for the particles
+ iterator end()
+ {return iterator();}
+
+ //! Produce a const iterator
+ virtual iterator setupIterator()=0;
+
+private:
+ virtual void* dataInternal(const ParticleAttribute& attribute,const ParticleIndex particleIndex) const=0;
+};
+
+//! Provides an empty particle instance, freed with p->release()
+ParticlesDataMutable* create();
+
+ParticlesDataMutable* createInterleave();
+
+//! Provides read/write access to a particle set stored in a file
+//! freed with p->release()
+ParticlesDataMutable* read(const char* filename);
+
+//! Provides read access to a particle headers (number of particles
+//! and attribute information, much cheapeer
+ParticlesInfo* readHeaders(const char* filename);
+
+//! Provides access to a particle set stored in a file
+//! if filename ends with .gz or forceCompressed is true, the file is compressed.
+void write(const char* filename,const ParticlesData&,const bool forceCompressed=false);
+
+
+//! Cached (only one copy) read only way to read a particle file
+/*!
+ Loads a file read-only if not already in memory, otherwise returns
+ already loaded item. Pointer is owned by Partio and must be releasedwith
+ p->release(); (will not be deleted if others are also holding).
+ If you want to do finding neighbors give true to sort
+*/
+ParticlesData* readCached(const char* filename,const bool sort);
+
+//! Begin accessing data in a cached file
+/*!
+ Indicates to Partio that data access from a cached particle set will
+ start. The sent in particles pointer must be from a readCached()
+ call, not from read() or create(). Attributes can be read before this call.
+*/
+void beginCachedAccess(ParticlesData* particles);
+
+//! End accessing data in a cached file
+/*!
+ Indicates to Partio that data from a cached particle read will
+ end. The sent in particles pointer must be from a readCached()
+ call, not from read() or create(). This allows the particle API
+ to free all data pages, if they are needed.
+*/
+void endCachedAccess(ParticlesData* particles);
+
+//! Prints a subset of particle data in a textual form
+void print(const ParticlesData* particles);
+
+}
+#endif
View
116 include/partio/PartioAttribute.h
@@ -0,0 +1,116 @@
+/*
+PARTIO SOFTWARE
+Copyright 2010 Disney Enterprises, Inc. All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+* The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
+Studios" or the names of its contributors may NOT be used to
+endorse or promote products derived from this software without
+specific prior written permission from Walt Disney Pictures.
+
+Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
+IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*/
+
+/*!
+ The interface of the particle API (Partio)
+ what type the primitive is, how many instances of the primitive there, name of
+ the attribute and an index which speeds lookups of data
+*/
+
+#ifndef _PartioParticleAttribute_h_
+#define _PartioParticleAttribute_h_
+namespace Partio{
+
+// Particle Types
+enum ParticleAttributeType {NONE=0,VECTOR=1,FLOAT=2,INT=3,INDEXEDSTR=4};
+
+template<ParticleAttributeType ENUMTYPE> struct ETYPE_TO_TYPE
+{struct UNUSABLE;typedef UNUSABLE TYPE;};
+template<> struct ETYPE_TO_TYPE<VECTOR>{typedef float TYPE;};
+template<> struct ETYPE_TO_TYPE<FLOAT>{typedef float TYPE;};
+template<> struct ETYPE_TO_TYPE<INT>{typedef int TYPE;};
+template<> struct ETYPE_TO_TYPE<INDEXEDSTR>{typedef int TYPE;};
+
+template<class T1,class T2> struct
+IS_SAME{static const bool value=false;};
+template<class T> struct IS_SAME<T,T>{static const bool value=true;};
+
+template<class T> bool
+typeCheck(const ParticleAttributeType& type)
+{
+ // if T is void, don't bother checking what we passed in
+ if (IS_SAME<T,void>::value) return true;
+ switch(type){
+ case VECTOR: return IS_SAME<typename ETYPE_TO_TYPE<VECTOR>::TYPE,T>::value;
+ case FLOAT: return IS_SAME<typename ETYPE_TO_TYPE<FLOAT>::TYPE,T>::value;
+ case INT: return IS_SAME<typename ETYPE_TO_TYPE<INT>::TYPE,T>::value;
+ case INDEXEDSTR: return IS_SAME<typename ETYPE_TO_TYPE<INDEXEDSTR>::TYPE,T>::value;
+ default: return false; // unknown type
+ }
+}
+
+inline
+int TypeSize(ParticleAttributeType attrType)
+{
+ switch(attrType){
+ case NONE: return 0;
+ case VECTOR: return sizeof(float);
+ case FLOAT: return sizeof(float);
+ case INT: return sizeof(int);
+ case INDEXEDSTR: return sizeof(int);
+ default: return 0;
+ }
+}
+
+std::string TypeName(ParticleAttributeType attrType);
+
+// Particle Attribute Specifier
+//! Particle Collection Interface
+/*!
+ This class provides a handle and description of an attribute. This includes
+ what type the primitive is, how many instances of the primitive there, name of
+ the attribute and an index which speeds lookups of data
+*/
+class ParticleAttribute
+{
+public:
+ //! Type of attribute
+ ParticleAttributeType type;
+
+ //! Number of entries, should be 3 if type is VECTOR
+ int count;
+
+ //! Name of attribute
+ std::string name;
+
+ //! Internal method of fast access, user should not use or change
+ int attributeIndex;
+
+ //! Comment used by various data/readers for extra attribute information
+ //! for example for a PTC file to read and write this could be "color" or "point"
+ // std::string comment;
+};
+}
+#endif
View
222 include/partio/PartioIterator.h
@@ -0,0 +1,222 @@
+/*
+PARTIO SOFTWARE
+Copyright 2010 Disney Enterprises, Inc. All rights reserved
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+* The names "Disney", "Walt Disney Pictures", "Walt Disney Animation
+Studios" or the names of its contributors may NOT be used to
+endorse or promote products derived from this software without
+specific prior written permission from Walt Disney Pictures.
+
+Disclaimer: THIS SOFTWARE IS PROVIDED BY WALT DISNEY PICTURES AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE ARE DISCLAIMED.
+IN NO EVENT SHALL WALT DISNEY PICTURES, THE COPYRIGHT HOLDER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND BASED ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*/
+#ifndef _PartioParticleIterator_h_
+#define _PartioParticleIterator_h_
+
+#include <cassert>
+#include <vector>
+#include <iostream>
+#include "PartioAttribute.h"
+
+namespace Partio{
+
+class ParticlesData;
+struct ParticleAccessor;
+
+//! Data
+/*!
+ This class represents a piece of data stored in a particle attribute.
+ The only allowed values are float and d
+*/
+template<class T,int d>
+struct Data
+{
+ T x[d];
+
+ const T& operator[](const int i) const {return x[i];}
+ T& operator[](const int i) {return x[i];}
+};
+typedef Data<int,1> DataI;
+typedef Data<float,1> DataF;
+typedef Data<float,3> DataV;
+
+
+template<bool constant> class ParticleIterator;
+
+struct Provider
+{
+ virtual void setupIteratorNextBlock(ParticleIterator<true>& iterator) const=0;
+ virtual void setupIteratorNextBlock(ParticleIterator<false>& iterator)=0;
+ virtual void setupAccessor(ParticleIterator<true>& iterator,ParticleAccessor& accessor) const=0;
+ virtual void setupAccessor(ParticleIterator<false>& iterator,ParticleAccessor& accessor)=0;
+ virtual ~Provider(){}
+};
+
+template<bool constant>
+struct PROVIDER
+{
+ typedef Provider TYPE;
+};
+template<>
+struct PROVIDER<true>
+{
+ typedef const Provider TYPE;
+};
+
+// TODO: non copyable
+struct ParticleAccessor
+{
+ int stride;
+ char* basePointer;
+ int attributeIndex; // index of attribute opaque, do not touch
+ int count;
+private:
+ ParticleAttributeType type;
+
+ ParticleAccessor* next;
+
+public:
+ ParticleAccessor(const ParticleAttribute& attr)
+ :stride(0),basePointer(0),attributeIndex(attr.attributeIndex),
+ count(attr.count),type(attr.type),next(0)
+ {}
+
+ template<class TDATA,class TITERATOR> TDATA* raw(const TITERATOR& it)
+ {return reinterpret_cast<TDATA*>(basePointer+it.index*stride);}
+
+ template<class TDATA,class TITERATOR> const TDATA* raw(const TITERATOR& it) const
+ {return reinterpret_cast<const TDATA*>(basePointer+it.index*stride);}
+
+ template<class TDATA,class TITERATOR> TDATA& data(const TITERATOR& it)
+ {return *reinterpret_cast<TDATA*>(basePointer+it.index*stride);}
+
+ template<class TDATA,class TITERATOR> const TDATA& data(const TITERATOR& it) const
+ {return *reinterpret_cast<const TDATA*>(basePointer+it.index*stride);}
+
+ friend class ParticleIterator<true>;
+ friend class ParticleIterator<false>;
+};
+
+
+template<bool constant=false>
+class ParticleIterator
+{
+public:
+private:
+ typedef typename PROVIDER<constant>::TYPE PROVIDER;
+
+ //! Delegate, null if the iterator is false
+ PROVIDER* particles;
+
+public:
+ //! Start of non-interleaved index of contiguous block
+ size_t index;
+private:
+
+ //! End of non-interleaved index of contiguous block
+ size_t indexEnd;
+
+ //! This is used for both non-interleaved and interleaved particle attributes
+ ParticleAccessor* accessors;
+
+public:
+ //! Construct an invalid iterator
+ ParticleIterator()
+ :particles(0),index(0),indexEnd(0),accessors(0)
+ {}
+
+ //! Copy constructor. NOTE: Invalidates any accessors that have been registered with it
+ ParticleIterator(const ParticleIterator& other)
+ :particles(other.particles),index(other.index),indexEnd(other.indexEnd),accessors(0)
+ {}
+
+ //! Construct an iterator with iteration parameters. This is typically only
+ //! called by implementations of Particle (not by users). For users, use
+ //! begin() and end() on the particle type
+ ParticleIterator(PROVIDER* particles,size_t index,size_t indexEnd)
+ :particles(particles),index(index),indexEnd(indexEnd)
+ {}
+
+ //! Whether the iterator is valid
+ bool valid() const
+ {return particles;}
+
+ //! Increment the iterator (postfix). Prefer the prefix form below to this one.
+ ParticleIterator operator++(int)
+ {
+ ParticleIterator newIt(*this);
+ index++;
+ return newIt;
+ }
+
+ //! Increment the iterator (prefix).
+ ParticleIterator& operator++()
+ {
+ index++;
+ // TODO: make particles==0 check unnecessary by using indexEnd=0 to signify invalid iterator
+ if((index>indexEnd) && particles) particles->setupIteratorNextBlock(*this);
+ return *this;
+ }
+
+ //! Iterator comparison equals
+ bool operator==(const ParticleIterator& other)
+ {
+ // TODO: this is really really expensive
+ // TODO: this needs a block or somethingt o say which segment it is
+ return particles==other.particles && index==other.index;
+ }
+
+ //! Iterator comparison not-equals
+ bool operator!=(const ParticleIterator& other)
+ {
+ if(other.particles!=particles) return true; // if not same delegate
+ else if(particles==0) return false; // if both are invalid iterators
+ else return !(*this==other);
+ }
+
+ void addAccessor(ParticleAccessor& newAccessor)
+ {
+ newAccessor.next=accessors;
+ accessors=&newAccessor;
+ if(particles) particles->setupAccessor(*this,newAccessor);
+ }
+
+
+ // TODO: add copy constructor that wipes out accessor linked list
+
+};
+
+template<class T,int d>
+std::ostream& operator<<(std::ostream& output,const Data<T,d>& v)
+{
+ output<<v[0];
+ for(int i=1;i<d;i++) output<< " " << v[i];
+ return output;
+}
+
+
+}
+
+#endif
View
BIN lib/osx/libpartio.a
Binary file not shown.

0 comments on commit b43b42d

Please sign in to comment.
Something went wrong with that request. Please try again.