summaryrefslogtreecommitdiffstats
path: root/matlab
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2016-04-15 17:00:31 +0200
committerWillem Jan Palenstijn <wjp@usecode.org>2016-04-15 17:00:31 +0200
commit80bfa4774a408f109dd49a985a22ff64b08ce1df (patch)
tree330cce11dfeb228b9df788720b4fdf2c79eb003c /matlab
parent7633a0f48ce030413642627f16e50d27da4cf709 (diff)
parent7b8a508f0bc7a8a02766b15fa094dfd18c1b0525 (diff)
downloadastra-80bfa4774a408f109dd49a985a22ff64b08ce1df.tar.gz
astra-80bfa4774a408f109dd49a985a22ff64b08ce1df.tar.bz2
astra-80bfa4774a408f109dd49a985a22ff64b08ce1df.tar.xz
astra-80bfa4774a408f109dd49a985a22ff64b08ce1df.zip
Merge pull request #29 from wjp/indexmanager
Add an AstraIndexManager
Diffstat (limited to 'matlab')
-rw-r--r--matlab/mex/astra_mex_c.cpp51
1 files changed, 50 insertions, 1 deletions
diff --git a/matlab/mex/astra_mex_c.cpp b/matlab/mex/astra_mex_c.cpp
index fdf4f33..f499528 100644
--- a/matlab/mex/astra_mex_c.cpp
+++ b/matlab/mex/astra_mex_c.cpp
@@ -36,10 +36,14 @@ $Id$
#include "mexInitFunctions.h"
#include "astra/Globals.h"
+#include "astra/AstraObjectManager.h"
+
#ifdef ASTRA_CUDA
#include "../cuda/2d/darthelper.h"
#include "astra/CompositeGeometryManager.h"
#endif
+
+
using namespace std;
using namespace astra;
@@ -144,10 +148,51 @@ void astra_mex_version(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[
//-----------------------------------------------------------------------------------------
+void astra_mex_info(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ if (nrhs < 2) {
+ mexErrMsgTxt("Usage: astra_mex('info', index/indices);\n");
+ return;
+ }
+
+ for (int i = 1; i < nrhs; i++) {
+ int iDataID = (int)(mxGetScalar(prhs[i]));
+ CAstraObjectManagerBase *ptr;
+ ptr = CAstraIndexManager::getSingleton().get(iDataID);
+ if (ptr) {
+ mexPrintf("%s\t%s\n", ptr->getType().c_str(), ptr->getInfo(iDataID).c_str());
+ }
+ }
+
+}
+
+//-----------------------------------------------------------------------------------------
+
+void astra_mex_delete(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ if (nrhs < 2) {
+ mexErrMsgTxt("Usage: astra_mex('delete', index/indices);\n");
+ return;
+ }
+
+ for (int i = 1; i < nrhs; i++) {
+ int iDataID = (int)(mxGetScalar(prhs[i]));
+ CAstraObjectManagerBase *ptr;
+ ptr = CAstraIndexManager::getSingleton().get(iDataID);
+ if (ptr)
+ ptr->remove(iDataID);
+ }
+
+}
+
+
+
+//-----------------------------------------------------------------------------------------
+
static void printHelp()
{
mexPrintf("Please specify a mode of operation.\n");
- mexPrintf(" Valid modes: version, use_cuda, credits\n");
+ mexPrintf(" Valid modes: version, use_cuda, credits, set_gpu_index, info, delete\n");
}
//-----------------------------------------------------------------------------------------
@@ -178,6 +223,10 @@ void mexFunction(int nlhs, mxArray* plhs[],
astra_mex_credits(nlhs, plhs, nrhs, prhs);
} else if (sMode == std::string("set_gpu_index")) {
astra_mex_set_gpu_index(nlhs, plhs, nrhs, prhs);
+ } else if (sMode == std::string("info")) {
+ astra_mex_info(nlhs, plhs, nrhs, prhs);
+ } else if (sMode == std::string("delete")) {
+ astra_mex_delete(nlhs, plhs, nrhs, prhs);
} else {
printHelp();
}