summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD Haley <mycae ( ) gmx com>2017-02-05 18:30:10 +0000
committerD Haley <mycae ( ) gmx com>2017-02-05 18:42:02 +0000
commiteb3bc157f485b8dc9ac20d63753e5793ab5893fa (patch)
tree82f824c45fdc07812be6647f1862b92bbe781b9c
parent87c6977fb7edf6362493904193ace1639c2787dc (diff)
download3Depict-master.zip
3Depict-master.tar.gz
3Depict-master.tar.xz
* Add upstream patch to fix failed build on ppc64HEADmasterf26
-rw-r--r--3Depict-0.0.20-tapsim-endian.patch125
-rw-r--r--3Depict.spec4
2 files changed, 129 insertions, 0 deletions
diff --git a/3Depict-0.0.20-tapsim-endian.patch b/3Depict-0.0.20-tapsim-endian.patch
new file mode 100644
index 0000000..24282c2
--- /dev/null
+++ b/3Depict-0.0.20-tapsim-endian.patch
@@ -0,0 +1,125 @@
+diff -r cf4c3eefdead -r a369c6597982 src/backend/APT/APTFileIO.cpp
+--- src/backend/APT/APTFileIO.cpp Sun Feb 05 14:33:21 2017 +0000
++++ src/backend/APT/APTFileIO.cpp Sun Feb 05 18:27:46 2017 +0000
+@@ -24,7 +24,6 @@
+ #include "../../common/translation.h"
+
+
+-
+ #include <cstring>
+ #include <new>
+
+@@ -1123,7 +1122,7 @@
+ return 0;
+ }
+
+-//Load a TAPSIM Binfile
++//Load a TAPSIM Binfile, which is the input geometry format for TAPSIM
+ unsigned int loadTapsimBinFile(const char *fileName, unsigned int &progress, ATOMIC_BOOL &wantAbort, vector<IonHit> &posIons)
+ {
+ ifstream f(fileName,std::ios::binary);
+@@ -1136,7 +1135,7 @@
+ fileSize = f.tellg();
+ f.seekg(0,std::ios::beg);
+
+- //TAPSIM's binary geometery input format is not totally clearly documented
++ //TAPSIM's binary geometry input format is not totally clearly documented
+ // but an example is provided. So best efforts are us.
+
+ std::string str;
+@@ -1202,7 +1201,7 @@
+ return TAPSIM_ERR_FILE_FORMAT_FAIL;
+ }
+
+- //Contrary to docuemntation, ids appear to be "short", not "unsigned int"
++ //Contrary to documentation, ids appear to be "short", not "unsigned int"
+ size_t recordSize=( (numbersPresent ? 1:0 )*sizeof(unsigned int) +
+ 3*sizeof(float) + (idsPresent ?1:0)*sizeof(short));
+
+@@ -1222,11 +1221,24 @@
+ //Transfer position data
+ #ifdef __LITTLE_ENDIAN__
+ h.setPos(Point3D((float*)(buffer)));
+-#elif __BIG_ENDIAN__
+- static_assert(false); //TODO: IMPLEMENT ME
+-#endif
++
+ //assign the ID as the mass to charge
+ h.setMassToCharge(*( (short*)(buffer+12) ));
++#elif __BIG_ENDIAN__
++ {
++ Point3D pt((float*)(buffer));
++ pt.switchEndian();
++ h.setPos(pt);
++
++ uint16_t s;
++ s =*( (uint16_t*)(buffer+12) );
++ shortSwapBytes(s);
++
++
++
++ }
++
++#endif
+
+ posIons[ui]=h;
+
+@@ -1291,7 +1303,7 @@
+
+ if(!flip)
+ {
+- //Fkip the endinanness
++ //Flip the endinanness
+ for(size_t ui=0;ui<4;ui++)
+ floatSwapBytes(buffer+ui);
+ }
+@@ -1300,7 +1312,7 @@
+ outF.write((char*)&intData,4);
+
+ intData=3;
+- //Write out verion num as "3"
++ //Write out version num as "3"
+ outF.write((char*)&intData,4);
+
+ for(size_t ui=0;ui<nPoints;ui++)
+@@ -1339,7 +1351,7 @@
+ TEST((ions[0].getPos().sqrDist(Point3D(1,1,0)) < sqrtf(std::numeric_limits<float>::epsilon())),"Checking read/write OK");
+ //Load using auto-detection of endinanness
+
+- //Load, forcing assuming cont4ents are little endianness as requried
++ //Load, forcing assuming contents are little endianness as required
+ TEST(!LoadATOFile(filename.c_str(),ions,dummyProgress,wantAbort,1),"ATO load test (forced endianness)");
+ TEST(ions.size() == 100,"ion size check");
+ TEST((ions[0].getPos().sqrDist(Point3D(1,1,0)) < sqrtf(std::numeric_limits<float>::epsilon())),"checking read/write OK");
+diff -r cf4c3eefdead -r a369c6597982 src/common/endianTest.h
+--- src/common/endianTest.h Sun Feb 05 14:33:21 2017 +0000
++++ src/common/endianTest.h Sun Feb 05 18:27:46 2017 +0000
+@@ -51,7 +51,7 @@
+
+ inline int is_littleendian() { return (*(char*)&ENDIAN_TEST) == 1 ;}
+
+-
++//this may fail on some compilers??
+ inline void floatSwapBytes(float *inFloat)
+ {
+ //Use a union to avoid strict-aliasing error
+@@ -69,5 +69,19 @@
+
+ *inFloat=fb.f;
+ }
++inline void shortSwapBytes(short *inShort)
++{
++ //Use a union to avoid strict-aliasing error
++ union ShortSwapUnion{
++ short s;
++ char c[2];
++ } ;
++ ShortSwapUnion sa,sb;
++ sa.s = *inShort;
+
++ sb.c[0] = sa.c[1];
++ sb.c[1] = sa.c[0];
++
++ *inShort=sb.s;
++}
+ #endif
diff --git a/3Depict.spec b/3Depict.spec
index 8f9c7cc..05a72c3 100644
--- a/3Depict.spec
+++ b/3Depict.spec
@@ -37,6 +37,9 @@ BuildRequires: qhull-devel
Patch0: %{name}-%{version}-manual-pdf-loc.patch
#Fedora specific font dir
Patch1: %{name}-%{version}-font-path.patch
+#Implementes tapsim loading for big-endian
+# this is to fix a failed scratch build on ppc64
+Patch2: %{name}-%{version}-tapsim-endian.patch
%description
This software is designed to help users visualize and analyze 3D point clouds
@@ -50,6 +53,7 @@ useful for general scalar valued point data purposes.
%patch0
%patch1
+%patch2
%if 0%{?fedora} > 24
# Installation directory has changed