Commit d3302565 authored by TOUZE Francois's avatar TOUZE Francois
Browse files

docker container creation: step 3

parent 53db3b12
...@@ -86,7 +86,7 @@ bool dataManager::executeAll() ...@@ -86,7 +86,7 @@ bool dataManager::executeAll()
particleBeam *computedBeam= NULL; particleBeam *computedBeam= NULL;
for(unsigned int k = 0; k < blks.size(); ++k) for(unsigned int k = 0; k < blks.size(); ++k)
{ {
computingBlock *ptr= blks.at(k); //computingBlock *ptr= blks.at(k);
abstractSoftware *softw= blks.at(k)->getSoftware(); abstractSoftware *softw= blks.at(k)->getSoftware();
if( softw == NULL ) { if( softw == NULL ) {
success= false; success= false;
...@@ -607,7 +607,7 @@ bool dataManager::parseJSONFile( string fileName ) ...@@ -607,7 +607,7 @@ bool dataManager::parseJSONFile( string fileName )
cout << "1- ############ Liste du/des secteur(s): ############\n"; cout << "1- ############ Liste du/des secteur(s): ############\n";
sectors_.clear(); sectors_.clear();
for(int i = 0; i < cmap.size(); ++i) for(unsigned i = 0; i < cmap.size(); ++i)
{ {
string key= "KEY" + mixedTools::intToString( i ); string key= "KEY" + mixedTools::intToString( i );
map<string, vector<json> >::iterator it= cmap.find( key ); map<string, vector<json> >::iterator it= cmap.find( key );
......
...@@ -110,13 +110,13 @@ class mixedTools ...@@ -110,13 +110,13 @@ class mixedTools
static void print(const std::vector<smap>& v) static void print(const std::vector<smap>& v)
{ {
for(int i = 0; i < v.size(); i++) { for(unsigned i = 0; i < v.size(); i++) {
std::cout << "v[" << i << "].size() is " << v[i].size() << '\n'; std::cout << "v[" << i << "].size() is " << v[i].size() << '\n';
smap::const_iterator it; smap::const_iterator it;
for (it = v[i].begin(); it != v[i].end(); ++it) { for (it = v[i].begin(); it != v[i].end(); ++it) {
std::cout << "*** m[" << it->first << "] : "; std::cout << "*** m[" << it->first << "] : ";
int nsz= it->second.size(); unsigned nsz= it->second.size();
for(int k = 0; k < nsz; k++) { for(unsigned k = 0; k < nsz; k++) {
if( k < nsz-1 ) std::cout << it->second.at(k) << ", "; if( k < nsz-1 ) std::cout << it->second.at(k) << ", ";
else std::cout << it->second.at(k) << ";"; else std::cout << it->second.at(k) << ";";
} }
...@@ -127,10 +127,10 @@ class mixedTools ...@@ -127,10 +127,10 @@ class mixedTools
static void print(const std::vector<psvs>& v) static void print(const std::vector<psvs>& v)
{ {
for(int i = 0; i < v.size(); i++) { for(unsigned i = 0; i < v.size(); i++) {
std::cout << "v[" << v.at(i).first << "] : "; std::cout << "v[" << v.at(i).first << "] : ";
int nsz= v.at(i).second.size(); unsigned nsz= v.at(i).second.size();
for(int k = 0; k < nsz; k++) { for(unsigned k = 0; k < nsz; k++) {
std::cout << v.at(i).second.at(k) << "; "; std::cout << v.at(i).second.at(k) << "; ";
} }
std::cout << std::endl; std::cout << std::endl;
......
...@@ -3,4 +3,5 @@ how to wrap C++ with Cython. ...@@ -3,4 +3,5 @@ how to wrap C++ with Cython.
Assuming you have Python, Cython, Git and a C++ compiler installed Assuming you have Python, Cython, Git and a C++ compiler installed
$ python pspaclass.py build_ext --inplace $ python pspaclass.py build_ext --inplace
$ python pspaplots.py build_ext --inplace
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize("pypspaplot.pyx")
)
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <iomanip> // std::setw
#include "pspaplot.h" #include "pspaplots.h"
// Default constructor // Default constructor
pspaplot::pspaplot() {} pspaplot::pspaplot() {}
...@@ -225,7 +226,7 @@ json pspaplot::plotSelection(json j) ...@@ -225,7 +226,7 @@ json pspaplot::plotSelection(json j)
if (ymap.empty()) continue; if (ymap.empty()) continue;
for (auto& y: ymap) { for (auto& y: ymap) {
for(int k = 0; k < y.second.size(); ++k) { for(unsigned k = 0; k < y.second.size(); ++k) {
Ymaps[ y.first ].push_back( y.second.at(k) ); Ymaps[ y.first ].push_back( y.second.at(k) );
} }
} }
......
from libcpp.string cimport string from libcpp.string cimport string
cdef extern from "pspaplot.cpp": cdef extern from "pspaplots.cpp":
pass pass
cdef extern from "pspaplot.h": cdef extern from "pspaplots.h":
cdef cppclass pspaplot: cdef cppclass pspaplot:
pspaplot() except + pspaplot() except +
pspaplot( string ) except + pspaplot( string ) except +
......
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
xtension = Extension(
name="pypspaplots",
sources=["pypspaplots.pyx"],
include_dirs=["/usr/local/json/include"]
)
setup(
name="pypspaplots",
ext_modules=cythonize([xtension])
)
# distutils: language = c++
from pspaplots cimport pspaplot
from libcpp.string cimport string
cdef class PyPspaPlot:
cdef pspaplot *ptr
def __cinit__(self):
self.ptr = new pspaplot()
def __cinit__(self, string s):
self.ptr = new pspaplot( s )
def __dealloc__(self):
del self.ptr
def settings(self, string s):
return self.ptr.settings( s )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment