summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Dahl2016-12-26 19:11:18 -0600
committerAlex Dahl2016-12-26 19:11:18 -0600
commit3d5b272c308755b5407838eb7fff07aea62800ae (patch)
tree02f73a443870d7363264f3bbbc40fbc758b4246b
parent84c31d461ccb35601df291b54c032bfc9de884d1 (diff)
downloadaur-3d5b272c308755b5407838eb7fff07aea62800ae.tar.gz
Updated to compile. Not sure if properly installed. Hacked together fix for SeExpr v3 port.
-rw-r--r--CMakeLists.txt.patch17
-rw-r--r--PKGBUILD10
-rw-r--r--SeExprv3.patch243
3 files changed, 257 insertions, 13 deletions
diff --git a/CMakeLists.txt.patch b/CMakeLists.txt.patch
index b62e159903c..f506c4632e6 100644
--- a/CMakeLists.txt.patch
+++ b/CMakeLists.txt.patch
@@ -1,6 +1,8 @@
---- /partio/CMakeLists.txt 2016-06-12 01:38:48.822497008 -0400
-+++ /partio/CMakeLists.txt 2016-06-12 01:36:36.842253172 -0400
-@@ -103,7 +103,7 @@
+diff --git /partio/CMakeLists.txt /partio/CMakeLists.txt
+index fdab418..c6a5a4b 100644
+--- /partio/CMakeLists.txt
++++ /partio/CMakeLists.txt
+@@ -103,11 +103,11 @@ SET( PARTIO_LIBRARIES partio ${ZLIB_LIBRARY} )
# make it so partio can be found
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/lib )
@@ -9,11 +11,8 @@
SET(SEEXPR_INCLUDE_PATH ${SEEXPR_BASE}/include)
SET(SEEXPR_LIBDIR ${CMAKE_INSTALL_LIBDIR})
SET(SEEXPR_LINK_PATH ${SEEXPR_BASE}/${SEEXPR_LIBDIR})
-@@ -114,7 +114,5 @@
- ADD_SUBDIRECTORY (src/lib)
- ADD_SUBDIRECTORY (src/tools)
- ADD_SUBDIRECTORY (src/py)
--ADD_SUBDIRECTORY (src/tests)
--ADD_SUBDIRECTORY (src/doc)
+-SET(SEEXPR_LIBS "SeExpr")
++SET(SEEXPR_LIBS "SeExpr2")
+ ## Traverse subdirectories
diff --git a/PKGBUILD b/PKGBUILD
index 8c5f2e7b794..c118171383a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,4 @@
-# Maintainer: meepzh <meep.aur@meepzh.com>
+# Maintainer: Alex Dahl <adahl1@umbc.edu>
pkgname=partio-git
pkgver=1.1.0.r73.g7f3e0d1
pkgrel=4
@@ -13,8 +13,8 @@ optdepends=('python2: Python interface support'
makedepends=('cmake>=2.4.6' 'git')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
-source=('git+https://github.com/wdas/partio.git' 'CMakeLists.txt.patch' 'py_CMakeLists.txt.patch')
-md5sums=('SKIP' '795fd5b88af781f3d94d51bea44518f3' '306cacec7af0af3adb7876c288881062')
+source=('git+https://github.com/wdas/partio.git' 'CMakeLists.txt.patch' 'py_CMakeLists.txt.patch' 'SeExprv3.patch')
+md5sums=('SKIP' '2f7a6ddc41a5b7d9134820f877b0d2b3' '306cacec7af0af3adb7876c288881062' '92029f98bc024ed5034a299590906f1d')
pkgver() {
cd "$srcdir/${pkgname%-git}"
@@ -24,6 +24,8 @@ pkgver() {
prepare() {
cd "$srcdir"
+ # Path PartioSe for SeExpr v3 until source fixed
+ patch -p1 -i "$srcdir/SeExprv3.patch"
# Fix SeExpr dependency and remove tests
patch -p1 -i "$srcdir/CMakeLists.txt.patch"
# Change Python version to 2 to work with SeExpr
@@ -32,7 +34,7 @@ prepare() {
build() {
cd "$srcdir/${pkgname%-git}"
- mkdir build
+ mkdir -p build
cd ./build
cmake -DCMAKE_INSTALL_PREFIX=/usr -Wno-dev ..
make
diff --git a/SeExprv3.patch b/SeExprv3.patch
new file mode 100644
index 00000000000..56f185977a4
--- /dev/null
+++ b/SeExprv3.patch
@@ -0,0 +1,243 @@
+diff --git /partio/src/lib/PartioSe.h /partio/src/lib/PartioSe.h
+index 44a434d..02e92ac 100644
+--- /partio/src/lib/PartioSe.h
++++ /partio/src/lib/PartioSe.h
+@@ -33,13 +33,17 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+ #include <Partio.h>
+-#include <SeExpression.h>
++#include <SeExpr2/Expression.h>
+ #include <map>
+
+ namespace Partio{
+
++using Vec3d = SeExpr2::Vec<double,3>;
++
++using Vec3dRef= SeExpr2::Vec<double,3,true>;
++
+ template<class T>
+-class AttribVar:public SeExprVarRef
++class AttribVar:public SeExpr2::ExprVarRef
+ {
+ Partio::ParticlesDataMutable* parts;
+ Partio::ParticleAttribute attr;
+@@ -48,11 +52,11 @@ class AttribVar:public SeExprVarRef
+ public:
+ AttribVar(Partio::ParticlesDataMutable* parts,
+ Partio::ParticleAttribute attr,int& currentIndex)
+- :parts(parts),attr(attr),currentIndex(currentIndex),clampedCount(std::min(attr.count,3))
++ :SeExpr2::ExprVarRef(SeExpr2::TypeVec(1).Varying()),parts(parts),attr(attr),currentIndex(currentIndex),clampedCount(std::min(attr.count,3))
+ {}
+
+ bool isVec(){return attr.count!=1;}
+- void eval(const SeExprVarNode* node,SeVec3d& result){
++ void eval(double* result) {
+ const T* ptr=parts->data<T>(attr,currentIndex);
+ //std::cerr<<"in eval for "<<attr.name<<" count is "<<clampedCount<<" cur "<<currentIndex<<std::endl;
+ for(int k=0;k<clampedCount;k++){
+@@ -63,22 +67,36 @@ public:
+ result[k]=0;
+ }
+ }
++ void eval(const char** resultStr) {}
++ /// void eval(const SeExpr2::ExprVarNode* node,Vec3d& result){
++ /// const T* ptr=parts->data<T>(attr,currentIndex);
++ /// //std::cerr<<"in eval for "<<attr.name<<" count is "<<clampedCount<<" cur "<<currentIndex<<std::endl;
++ /// for(int k=0;k<clampedCount;k++){
++ /// result[k]=ptr[k];
++ /// }
++ /// // set any remaining fields (i.e. if clampedCount is 2)
++ /// for(int k=clampedCount;k<3;k++){
++ /// result[k]=0;
++ /// }
++ /// }
+ };
+
+-struct SimpleVar:public SeExprVarRef{
++struct SimpleVar:public SeExpr2::ExprVarRef{
+ double val;
+- SimpleVar():val(0){}
++ SimpleVar():SeExpr2::ExprVarRef(SeExpr2::TypeVec(1).Varying()), val(0){}
+ bool isVec(){return false;}
+- void eval(const SeExprVarNode* node,SeVec3d& result){
+- result[0]=result[1]=result[2]=val;
+- }
++ void eval(double* result) {result[0] = val;}
++ void eval(const char** resultStr) {}
++ /// void eval(const SeExprVarNode* node,Vec3d& result){
++ /// result[0]=result[1]=result[2]=val;
++ /// }
+ };
+
+ /// Class that maps back to the partio data
+ template<class T> class VarToPartio;
+
+ /// NOTE: This class is experimental and may be deleted/modified in future versions
+-class PartioSe:public SeExpression{
++class PartioSe:public SeExpr2::Expression{
+ bool isPaired;
+ int currentIndex;
+ Partio::ParticleAttribute pairH1,pairH2;
+@@ -98,7 +116,8 @@ class PartioSe:public SeExpression{
+ mutable SimpleVar indexVar,countVar,timeVar;
+
+ public:
+- typedef SeExpression::LocalVarTable::const_iterator LocalVarTableIterator;
++ typedef std::map<std::string, SeExpr2::ExprVarRef*> LocalVarTable;
++ typedef LocalVarTable::const_iterator LocalVarTableIterator;
+
+ PartioSe(Partio::ParticlesDataMutable* parts,const char* expr);
+ PartioSe(Partio::ParticlesDataMutable* partsPairing,Partio::ParticlesDataMutable* parts,const char* expr);
+@@ -110,7 +129,7 @@ public:
+ void run(int i);
+ bool runRange(int istart,int iend);
+ void setTime(float val);
+- SeExprVarRef* resolveVar(const std::string& s) const;
++ SeExpr2::ExprVarRef* resolveVar(const std::string& s) const;
+ private:
+ PartioSe(const PartioSe&);
+ PartioSe& operator=(const PartioSe&);
+diff --git /partio/src/lib/PartioSe.cpp /partio/src/lib/PartioSe.cpp
+index cd99686..ebefb43 100644
+--- /partio/src/lib/PartioSe.cpp
++++ /partio/src/lib/PartioSe.cpp
+@@ -40,13 +40,13 @@ namespace Partio{
+ template<class T> class VarToPartio
+ {
+ Partio::ParticlesDataMutable* parts;
+- const SeExprLocalVarRef* local;
++ SeExpr2::ExprVarRef* local;
+ Partio::ParticleAttribute attr;
+ int& currentIndex;
+ int clampedCount;
+
+ public:
+- VarToPartio(Partio::ParticlesDataMutable* parts,const SeExprLocalVarRef* local,
++ VarToPartio(Partio::ParticlesDataMutable* parts, SeExpr2::ExprVarRef* local,
+ Partio::ParticleAttribute attr,int& currentIndex)
+ :parts(parts),local(local),attr(attr),currentIndex(currentIndex),
+ clampedCount(std::min(3,attr.count))
+@@ -55,8 +55,11 @@ public:
+
+ void mapBack(){
+ T* ptr=parts->dataWrite<T>(attr,currentIndex);
++ double* tmp=new double[clampedCount];
++ local->eval(tmp);
+ for(int k=0;k<clampedCount;k++){
+- ptr[k]=local->val[k];
++ /// ptr[k]=local->val[k];
++ ptr[k]=tmp[k];
+ }
+ if(clampedCount == 1) for(int k=clampedCount;k<attr.count;k++)
+ ptr[k]=ptr[clampedCount-1];
+@@ -84,7 +87,7 @@ void PartioSe::addSet(const char* suffix,Partio::ParticlesDataMutable* parts,int
+ }
+
+ PartioSe::PartioSe(Partio::ParticlesDataMutable* parts,Partio::ParticlesDataMutable* partsPairing,const char* expression)
+-:SeExpression(expression),parts(parts),partsPairing(partsPairing),isPaired(true)
++:SeExpr2::Expression(expression),parts(parts),partsPairing(partsPairing),isPaired(true)
+ {
+ parts->attributeInfo("p1",pairH1);
+ parts->attributeInfo("p2",pairH2);
+@@ -95,41 +98,41 @@ PartioSe::PartioSe(Partio::ParticlesDataMutable* parts,Partio::ParticlesDataMuta
+ // checkout what we build
+ isValid();
+ // go through local variables and look for exports
+- const SeExpression::LocalVarTable& vars=getLocalVars();
+- typedef SeExpression::LocalVarTable::const_iterator LocalVarTableIterator;
+- for(LocalVarTableIterator it=vars.begin(),itend=vars.end();it != itend;++it){
+- //std::cerr<<"assignment of "<<it->first<<std::endl;
+- size_t idx=it->first.rfind("_");
+- std::string realName=it->first;
+- int whichNum;
+- if(idx != std::string::npos){
+- realName=it->first.substr(0,idx);
+- whichNum=atoi(it->first.substr(idx+1).c_str());
+- //std::cerr<<"adding as stripped pairing "<<realName<<" which "<<whichNum<<std::endl;
+- if(whichNum != 1 && whichNum != 2){
+- std::cerr<<"Expect _1 and _2 on the end of particle variables got "<<whichNum<<std::endl;;
+- }else{
+- int *idxPtr=whichNum == 1 ? &pairIndex1 : &pairIndex2;
+- addExport(realName,it,partsPairing,*idxPtr);
+- }
+- }else{
+- //std::cerr<<"adding as normal pairing "<<realName<<std::endl;
+- addExport(realName,it,parts,currentIndex);
+- }
+- }
++ /// const LocalVarTable& vars=getLocalVars();
++ /// typedef LocalVarTable::const_iterator LocalVarTableIterator;
++ /// for(LocalVarTableIterator it=vars.begin(),itend=vars.end();it != itend;++it){
++ /// //std::cerr<<"assignment of "<<it->first<<std::endl;
++ /// size_t idx=it->first.rfind("_");
++ /// std::string realName=it->first;
++ /// int whichNum;
++ /// if(idx != std::string::npos){
++ /// realName=it->first.substr(0,idx);
++ /// whichNum=atoi(it->first.substr(idx+1).c_str());
++ /// //std::cerr<<"adding as stripped pairing "<<realName<<" which "<<whichNum<<std::endl;
++ /// if(whichNum != 1 && whichNum != 2){
++ /// std::cerr<<"Expect _1 and _2 on the end of particle variables got "<<whichNum<<std::endl;;
++ /// }else{
++ /// int *idxPtr=whichNum == 1 ? &pairIndex1 : &pairIndex2;
++ /// addExport(realName,it,partsPairing,*idxPtr);
++ /// }
++ /// }else{
++ /// //std::cerr<<"adding as normal pairing "<<realName<<std::endl;
++ /// addExport(realName,it,parts,currentIndex);
++ /// }
++ /// }
+ }
+
+ PartioSe::PartioSe(Partio::ParticlesDataMutable* parts,const char* expression)
+-:SeExpression(expression),parts(parts),partsPairing(0),isPaired(false)
++:SeExpr2::Expression(expression),parts(parts),partsPairing(0),isPaired(false)
+ {
+ addSet("",parts,currentIndex);
+ isValid();
+- const SeExpression::LocalVarTable& vars=getLocalVars();
+- typedef SeExpression::LocalVarTable::const_iterator LocalVarTableIterator;
+- for(LocalVarTableIterator it=vars.begin(),itend=vars.end();it != itend;++it){
+- //std::cerr<<"assignment of "<<it->first<<std::endl;
+- addExport(it->first,it,parts,currentIndex);
+- }
++ /// const SeExpression::LocalVarTable& vars=getLocalVars();
++ /// typedef SeExpression::LocalVarTable::const_iterator LocalVarTableIterator;
++ /// for(LocalVarTableIterator it=vars.begin(),itend=vars.end();it != itend;++it){
++ /// //std::cerr<<"assignment of "<<it->first<<std::endl;
++ /// addExport(it->first,it,parts,currentIndex);
++ /// }
+
+ }
+
+@@ -138,9 +141,9 @@ void PartioSe::addExport(const std::string& name,LocalVarTableIterator it,Partio
+ bool isParticleAttr=parts->attributeInfo(name.c_str(),attr);
+ if(isParticleAttr){
+ if(attr.type==Partio::FLOAT || attr.type==Partio::VECTOR){
+- floatVarToPartio.push_back(new VarToPartio<float>(parts,&it->second,attr,setIndex));
++ floatVarToPartio.push_back(new VarToPartio<float>(parts,it->second,attr,setIndex));
+ }else if(attr.type==Partio::INT || attr.type==Partio::INDEXEDSTR){
+- intVarToPartio.push_back(new VarToPartio<int>(parts,&it->second,attr,setIndex));
++ intVarToPartio.push_back(new VarToPartio<int>(parts,it->second,attr,setIndex));
+ }else{
+ std::cerr<<"unknown particle attribute type "<<attr.name<<std::endl;
+ }
+@@ -175,7 +178,7 @@ void PartioSe::run(int i){
+ std::cerr<<"Index "<<currentIndex<<" Referenced particle index "<<pairIndex1<<" is out of bounds"<<std::endl;
+ }
+ }
+- SeVec3d value=evaluate();
++ /// SeExpr2::Vec3d value=evaluate();
+ // map data into the particles again
+ for(IntVarToPartio::iterator it=intVarToPartio.begin(),itend=intVarToPartio.end();
+ it!=itend;++it)
+@@ -223,7 +226,7 @@ bool PartioSe::runRandom(){
+ return true;
+ }
+
+-SeExprVarRef* PartioSe::resolveVar(const std::string& s) const{
++SeExpr2::ExprVarRef* PartioSe::resolveVar(const std::string& s) const{
+ {
+ IntVarMap::iterator it=intVars.find(s);
+ if(it != intVars.end()) return it->second;