diff --git a/.gitignore b/.gitignore index 71726ac..9342593 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ install/ configs/ renders/ .*.swp +*~ +__pycache__ diff --git a/include/Renderer.h b/include/Renderer.h index b74c332..112e5d9 100644 --- a/include/Renderer.h +++ b/include/Renderer.h @@ -19,9 +19,9 @@ namespace pbnj { void setBackgroundColor(unsigned char r, unsigned char g, unsigned char b); void setBackgroundColor(std::vector bgColor); - void setVolume(Volume *v); - void setIsosurface(Volume *v, std::vector &isoValues); - void setCamera(Camera *c); + void setVolume(pbnj::Volume *v); + void setIsosurface(pbnj::Volume *v, std::vector &isoValues); + void setCamera(pbnj::Camera *c); void setSamples(unsigned int spp); void render(); diff --git a/include/TimeSeries.h b/include/TimeSeries.h index 87d8b56..08f865d 100644 --- a/include/TimeSeries.h +++ b/include/TimeSeries.h @@ -18,7 +18,7 @@ namespace pbnj { int x, int y, int z); ~TimeSeries(); - Volume *getVolume(unsigned int index); + pbnj::Volume *getVolume(unsigned int index); int getVolumeIndex(std::string filename); unsigned int getLength(); void setMaxMemory(unsigned int gigabytes); diff --git a/pbnj.i b/pbnj.i new file mode 100644 index 0000000..1b2c770 --- /dev/null +++ b/pbnj.i @@ -0,0 +1,45 @@ +%module pbnj + +%include +%include + +%{ +#include "pbnj.h" +#include "Configuration.h" +#include "Camera.h" +#include "ConfigReader.h" +#include "DataFile.h" +#include "Renderer.h" +#include "TimeSeries.h" +#include "TransferFunction.h" +#include "Volume.h" + +namespace pbnj { +void init(void) { + int argc; + const char *argv[1]; + const std::string dummy = "dummy"; + + argc = 1; + argv[0] = dummy.c_str(); + + pbnj::pbnjInit(&argc, argv); +} +}; + +%} + +namespace pbnj { + +void init(void); + +}; + +%include "include/Configuration.h" +%include "include/Camera.h" +%include "include/ConfigReader.h" +%include "include/DataFile.h" +%include "include/Renderer.h" +%include "include/TimeSeries.h" +%include "include/TransferFunction.h" +%include "include/Volume.h" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..18e161c --- /dev/null +++ b/setup.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +""" + +""" + +from distutils.core import setup, Extension +from os import environ + + +# Needed so that the extension can always find the modules, even if they aren't +# on your normal load path. e.g. /opt/embree/lib usually isn't in your +# ldconfig, so this hard codes /opt/embree/lib into your extension, so that it +# knows where to look for the libraries. +def patch_ld_run_path(): + if 'LD_RUN_PATH' in environ is not None: + ld_run_path += environ['LD_RUN_PATH'] + ':' + else: + ld_run_path = '' + + ld_run_path += ':'.join([ + '/opt/embree/lib', + '/usr/local/lib', + '/usr/local/lib64', + ]) + + environ['LD_RUN_PATH'] = ld_run_path + + +patch_ld_run_path() + +_pbnj = Extension( + '_pbnj', + language='c++', + libraries=[ + 'pbnj', + ], + sources=[ + 'pbnj_wrap.cxx', + ], +) + + +setup( + name='pbnj', + version='0.0.1', + description='PBNJ', + author='Tanner Hobson', + author_email='thobson2@vols.utk.edu', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + ], + python_requires='>=3.5', + entry_points={ + }, + ext_modules=[ + _pbnj, + ], +) diff --git a/src/DataFile.cpp b/src/DataFile.cpp index 21d3bbe..81dde02 100644 --- a/src/DataFile.cpp +++ b/src/DataFile.cpp @@ -81,7 +81,7 @@ void DataFile::loadFromFile(std::string filename, std::string var_name, FILE *dataFile = fopen(filename.c_str(), "r"); if(dataFile == NULL) { - std::cerr << "Could not open file!" << std::endl; + std::cerr << "Could not open file! " << filename << std::endl; } else { if(memmap) {