@@ -86,29 +86,24 @@ cdef extern from "pdal/PointView.hpp" namespace "pdal":
8686 ctypedef cpp_set[PointViewPtr] PointViewSet
8787
8888
89- cdef extern from " pdal/PipelineManager.hpp" namespace " pdal" :
90- cdef cppclass PipelineManager:
91- const PointViewSet& views() const
92- bool pipelineStreamable() const
93-
89+ cdef extern from " PyPipeline.hpp" namespace " pdal::python" :
90+ np.PyArrayObject* viewToNumpyArray(PointViewPtr) except +
91+ np.PyArrayObject* meshToNumpyArray(const TriangularMesh* ) except +
9492
95- cdef extern from " pdal/PipelineExecutor.hpp" namespace " pdal" :
9693 cdef cppclass PipelineExecutor:
97- PipelineExecutor(string) except +
98- const PipelineManager& getManagerConst() except +
99- bool executed() except +
100- void read() except +
94+ PipelineExecutor(string, vector[shared_ptr[Array]], int ) except +
10195 int execute() except +
96+ bool executed() except +
10297 string getPipeline() except +
10398 string getMetadata() except +
10499 string getSchema() except +
105100 string getLog() except +
106- void setLogLevel( int ) except +
101+ const PointViewSet & views( ) except +
107102
108103
109104cdef extern from " StreamableExecutor.hpp" namespace " pdal::python" :
110105 cdef cppclass StreamableExecutor(PipelineExecutor):
111- StreamableExecutor(string, int , int ) except +
106+ StreamableExecutor(string, vector[shared_ptr[Array]], int , int , int ) except +
112107 np.PyArrayObject* executeNext() except +
113108 void stop() except +
114109
@@ -118,12 +113,6 @@ cdef extern from "PyArray.hpp" namespace "pdal::python":
118113 Array(np.PyArrayObject* ) except +
119114
120115
121- cdef extern from " PyPipeline.hpp" namespace " pdal::python" :
122- void addArrayReaders(PipelineExecutor* , vector[shared_ptr[Array]]) except +
123- np.PyArrayObject* viewToNumpyArray(PointViewPtr) except +
124- np.PyArrayObject* meshToNumpyArray(const TriangularMesh* ) except +
125-
126-
127116@cython.internal
128117cdef class PipelineResultsMixin:
129118 @property
@@ -179,21 +168,17 @@ cdef class Pipeline(PipelineResultsMixin):
179168 @property
180169 def arrays (self ):
181170 cdef PipelineExecutor* executor = self ._get_executor()
182- if not executor.executed():
183- raise RuntimeError (" Pipeline has not been executed!" )
184171 output = []
185- for view in executor.getManagerConst(). views():
172+ for view in executor.views():
186173 output.append(< object > viewToNumpyArray(view))
187174 Py_DECREF(output[- 1 ])
188175 return output
189176
190177 @property
191178 def meshes (self ):
192179 cdef PipelineExecutor* executor = self ._get_executor()
193- if not executor.executed():
194- raise RuntimeError (" Pipeline has not been executed!" )
195180 output = []
196- for view in executor.getManagerConst(). views():
181+ for view in executor.views():
197182 output.append(< object > meshToNumpyArray(deref(view).mesh()))
198183 Py_DECREF(output[- 1 ])
199184 return output
@@ -204,15 +189,10 @@ cdef class Pipeline(PipelineResultsMixin):
204189 return self ._get_executor().execute()
205190
206191 def iterator (self , int chunk_size = 10000 , int prefetch = 0 ):
207- cdef StreamableExecutor* executor = new StreamableExecutor(
208- self ._get_json(), chunk_size, prefetch
209- )
210- self ._configure_executor(executor)
211- if not executor.getManagerConst().pipelineStreamable():
212- raise RuntimeError (" Pipeline is not streamable" )
213-
214192 it = PipelineIterator()
215- it.set_executor(executor)
193+ it.set_executor(new StreamableExecutor(
194+ self ._get_json(), self ._inputs, self ._loglevel, chunk_size, prefetch
195+ ))
216196 return it
217197
218198 # ========= non-public properties & methods ===========================================
@@ -232,16 +212,11 @@ cdef class Pipeline(PipelineResultsMixin):
232212
233213 cdef PipelineExecutor* _get_executor(self ) except NULL :
234214 if not self ._executor:
235- executor = new PipelineExecutor(self ._get_json())
236- self ._configure_executor(executor )
237- self ._executor.reset(executor )
215+ self ._executor.reset( new PipelineExecutor(
216+ self ._get_json(), self ._inputs, self ._loglevel )
217+ )
238218 return self ._executor.get()
239219
240- cdef _configure_executor(self , PipelineExecutor* executor):
241- executor.setLogLevel(self ._loglevel)
242- executor.read()
243- addArrayReaders(executor, self ._inputs)
244-
245220
246221@cython.internal
247222cdef class PipelineIterator(PipelineResultsMixin):
@@ -250,10 +225,6 @@ cdef class PipelineIterator(PipelineResultsMixin):
250225 cdef set_executor(self , StreamableExecutor* executor):
251226 self ._executor.reset(executor)
252227
253- @property
254- def schema (self ):
255- return json.loads(self ._executor.get().getSchema())
256-
257228 def __iter__ (self ):
258229 return self
259230
0 commit comments