Skip to content

Commit 3057e03

Browse files
committed
Merge branch 'master' into qwt
2 parents 053f78a + b539927 commit 3057e03

24 files changed

+935
-327
lines changed

src/Core/Algorithms/Math/GetMatrixSliceAlgo.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ boost::tuple<MatrixHandle, int> GetMatrixSliceAlgo::runImpl(MatrixHandle matrix,
8080
{
8181
auto sparse = matrix_cast::as_sparse(matrix);
8282
if (sparse)
83-
return boost::make_tuple(boost::make_shared<SparseRowMatrix>(sparse->col(index)), max);
83+
{
84+
THROW_ALGORITHM_PROCESSING_ERROR("TODO: need a fix for slicing a column from SparseRowMatrix. Direct Eigen call is buggy. Waiting on an Eigen upgrade");
85+
}
8486
return boost::make_tuple(nullptr, 0);
8587
}
8688
}
@@ -89,7 +91,6 @@ boost::tuple<MatrixHandle, int> GetMatrixSliceAlgo::runImpl(MatrixHandle matrix,
8991
checkIndex(index, matrix->nrows());
9092
auto max = matrix->nrows() - 1;
9193

92-
// dense case only now
9394
auto dense = matrix_cast::as_dense(matrix);
9495
if (dense)
9596
return boost::make_tuple(boost::make_shared<DenseMatrix>(dense->row(index)), max);

src/Core/Algorithms/Math/GetMatrixSliceAlgo.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ namespace SCIRun {
5050
GetMatrixSliceAlgo();
5151
virtual AlgorithmOutput run_generic(const AlgorithmInput& input) const override;
5252
boost::tuple<Datatypes::MatrixHandle, int> runImpl(Datatypes::MatrixHandle matrix, int index, bool getColumn) const;
53+
54+
enum PlayMode
55+
{
56+
PLAY = 1,
57+
PAUSE = 2
58+
};
59+
5360
private:
5461
void checkIndex(int index, int max) const;
5562
};

src/Core/Algorithms/Math/Tests/GetMatrixSliceAlgoTests.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ TEST(GetMatrixSliceAlgoTests, CanGetColumnOrRowSparse)
9696

9797
for (int i = 0; i < m1->ncols(); ++i)
9898
{
99-
auto col = algo.runImpl(m1, i, true);
99+
EXPECT_THROW(algo.runImpl(m1, i, true), AlgorithmProcessingException);
100+
/* TODO: fix in #822
100101
SparseRowMatrix expected(m1->col(i));
101102
ASSERT_TRUE(col.get<0>() != nullptr);
102103
EXPECT_EQ(expected, *matrix_cast::as_sparse(col.get<0>()));
103104
EXPECT_EQ(m1->ncols() - 1, col.get<1>());
105+
*/
104106
}
105107
for (int i = 0; i < m1->nrows(); ++i)
106108
{

src/Core/Thread/Legacy/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ SET(Core_Thread_Legacy_SRCS
4545
ThreadGroup.cc
4646
Thread_unix.cc
4747
ThreadPool.cc
48-
WorkQueue.cc
4948
)
5049

5150
SET(Core_Thread_Legacy_HEADERS
@@ -79,7 +78,6 @@ SET(Core_Thread_Legacy_HEADERS
7978
ThreadPool.h
8079
Time.h
8180
UsedWithLockingHandle.h
82-
WorkQueue.h
8381
)
8482

8583
IF(WIN32)

src/Core/Thread/Legacy/WorkQueue.cc

Lines changed: 0 additions & 135 deletions
This file was deleted.

src/Core/Thread/Legacy/WorkQueue.h

Lines changed: 0 additions & 119 deletions
This file was deleted.

src/Dataflow/Engine/Controller/NetworkEditorController.cc

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ void NetworkEditorController::loadNetwork(const NetworkFileHandle& xml)
296296
{
297297
ModuleHandle module = theNetwork_->module(i);
298298
moduleAdded_(module->get_module_name(), module, modulesDone);
299-
networkDoneLoading_(i);
299+
networkDoneLoading_(static_cast<int>(i));
300300
}
301301

302302
{
@@ -334,34 +334,38 @@ void NetworkEditorController::clear()
334334
}
335335

336336
// TODO:
337-
// - [ ] refactor duplication
337+
// - [X] refactor duplication
338338
// - [ ] set up execution context queue
339339
// - [ ] separate threads for looping through queue: another producer/consumer pair
340340

341341
void NetworkEditorController::executeAll(const ExecutableLookup* lookup)
342342
{
343-
if (!currentExecutor_)
344-
{
345-
currentExecutor_ = executorFactory_->createDefault();
346-
}
347-
348-
ExecuteAllModules filter;
349-
theNetwork_->setModuleExecutionState(ModuleInterface::Waiting, filter);
350-
ExecutionContext context(*theNetwork_, lookup ? *lookup : *theNetwork_, filter);
351-
currentExecutor_->execute(context);
343+
executeGeneric(lookup, ExecuteAllModules::Instance());
352344
}
353345

354346
void NetworkEditorController::executeModule(const ModuleHandle& module, const ExecutableLookup* lookup)
355347
{
356-
if (!currentExecutor_)
357-
{
358-
currentExecutor_ = executorFactory_->createDefault();
359-
}
360-
361348
ExecuteSingleModule filter(module, *theNetwork_);
349+
executeGeneric(lookup, filter);
350+
}
351+
352+
void NetworkEditorController::initExecutor()
353+
{
354+
executionManager_.initExecutor(executorFactory_);
355+
}
356+
357+
ExecutionContextHandle NetworkEditorController::createExecutionContext(const ExecutableLookup* lookup, ModuleFilter filter)
358+
{
362359
theNetwork_->setModuleExecutionState(ModuleInterface::Waiting, filter);
363-
ExecutionContext context(*theNetwork_, lookup ? *lookup : *theNetwork_, filter);
364-
currentExecutor_->execute(context);
360+
return boost::make_shared<ExecutionContext>(*theNetwork_, lookup ? *lookup : *theNetwork_, filter);
361+
}
362+
363+
void NetworkEditorController::executeGeneric(const ExecutableLookup* lookup, ModuleFilter filter)
364+
{
365+
initExecutor();
366+
auto context = createExecutionContext(lookup, filter);
367+
368+
executionManager_.enqueueContext(context);
365369
}
366370

367371
NetworkHandle NetworkEditorController::getNetwork() const
@@ -382,7 +386,7 @@ NetworkGlobalSettings& NetworkEditorController::getSettings()
382386

383387
void NetworkEditorController::setExecutorType(int type)
384388
{
385-
currentExecutor_ = executorFactory_->create((ExecutionStrategy::Type)type);
389+
executionManager_.setExecutionStrategy(executorFactory_->create((ExecutionStrategy::Type)type));
386390
}
387391

388392
const ModuleDescriptionMap& NetworkEditorController::getAllAvailableModuleDescriptions() const

0 commit comments

Comments
 (0)