File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed
Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ LDFLAGS += $(shell $(PYTHON_CONFIG) --libs)
1010
1111# Either finds numpy or set -DWITHOUT_NUMPY
1212EXTRA_FLAGS += $(shell $(PYTHON_BIN ) $(CURDIR ) /numpy_flags.py)
13- WITHOUT_NUMPY := $(findstring $(CXXFLAGS ) , WITHOUT_NUMPY)
13+ WITHOUT_NUMPY := $(findstring $(EXTRA_FLAGS ) , WITHOUT_NUMPY)
1414
1515# Examples requiring numpy support to compile
16- EXAMPLES_NUMPY := surface
16+ EXAMPLES_NUMPY := surface colorbar
1717EXAMPLES := minimal basic modern animation nonblock xkcd quiver bar \
18- fill_inbetween fill update subplot2grid colorbar lines3d \
19- $(if WITHOUT_NUMPY,,$(EXAMPLES_NUMPY ) )
18+ fill_inbetween fill update subplot2grid lines3d \
19+ $(if $( WITHOUT_NUMPY ) ,,$(EXAMPLES_NUMPY ) )
2020
2121# Prefix every example with 'examples/build/'
2222EXAMPLE_TARGETS := $(patsubst % ,examples/build/% ,$(EXAMPLES ) )
Original file line number Diff line number Diff line change @@ -340,6 +340,20 @@ PyObject* get_2darray(const std::vector<::std::vector<Numeric>>& v)
340340 return reinterpret_cast <PyObject *>(varray);
341341}
342342
343+ #else // fallback if we don't have numpy: copy every element of the given vector
344+
345+ template <typename Numeric>
346+ PyObject* get_array (const std::vector<Numeric>& v)
347+ {
348+ PyObject* list = PyList_New (v.size ());
349+ for (size_t i = 0 ; i < v.size (); ++i) {
350+ PyList_SetItem (list, i, PyFloat_FromDouble (v.at (i)));
351+ }
352+ return list;
353+ }
354+
355+ #endif // WITHOUT_NUMPY
356+
343357// sometimes, for labels and such, we need string arrays
344358PyObject * get_array (const std::vector<std::string>& strings)
345359{
@@ -361,20 +375,6 @@ PyObject* get_listlist(const std::vector<std::vector<Numeric>>& ll)
361375 return listlist;
362376}
363377
364- #else // fallback if we don't have numpy: copy every element of the given vector
365-
366- template <typename Numeric>
367- PyObject* get_array (const std::vector<Numeric>& v)
368- {
369- PyObject* list = PyList_New (v.size ());
370- for (size_t i = 0 ; i < v.size (); ++i) {
371- PyList_SetItem (list, i, PyFloat_FromDouble (v.at (i)));
372- }
373- return list;
374- }
375-
376- #endif // WITHOUT_NUMPY
377-
378378} // namespace detail
379379
380380// / Plot a line through the given x and y data points..
You can’t perform that action at this time.
0 commit comments