Skip to content

Commit 83cc59c

Browse files
committed
Merge branch 'master' into tagScript
2 parents 48dede8 + f17b986 commit 83cc59c

27 files changed

+2618
-115
lines changed

src/Core/Algorithms/Legacy/Fields/Mapping/BuildMappingMatrixAlgo.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ bool BuildMappingMatrixAlgo::runImpl(FieldHandle source, FieldHandle destination
633633
algo.algo_ = this;
634634

635635
auto task_i = [&algo,this](int i) { algo.parallel(i); };
636-
Parallel::RunTasks(task_i, Parallel::NumCores());
636+
Parallel::RunTasks(task_i, np);
637637
}
638638
else if(method == "singledestination")
639639
{
@@ -649,7 +649,7 @@ bool BuildMappingMatrixAlgo::runImpl(FieldHandle source, FieldHandle destination
649649
algo.algo_ = this;
650650

651651
auto task_i = [&algo,this](int i) { algo.parallel(i); };
652-
Parallel::RunTasks(task_i, Parallel::NumCores());
652+
Parallel::RunTasks(task_i, np);
653653
}
654654
else if (method == "interpolateddata")
655655
{
@@ -666,7 +666,7 @@ bool BuildMappingMatrixAlgo::runImpl(FieldHandle source, FieldHandle destination
666666
algo.algo_ = this;
667667

668668
auto task_i = [&algo,this](int i) { algo.parallel(i); };
669-
Parallel::RunTasks(task_i, Parallel::NumCores());
669+
Parallel::RunTasks(task_i, np);
670670
}
671671

672672
output.reset(new SparseRowMatrix(m,n,rr,cc,vv,nnz));

src/Core/ConsoleApplication/ConsoleCommandFactory.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ CommandHandle ConsoleGlobalCommandFactory::create(GlobalCommands type) const
5454
return boost::make_shared<PrintVersionCommand>();
5555
case GlobalCommands::LoadNetworkFile:
5656
return boost::make_shared<LoadFileCommandConsole>();
57+
case GlobalCommands::PrintModules:
58+
return boost::make_shared<PrintModulesCommand>();
5759
case GlobalCommands::SaveNetworkFile:
5860
return boost::make_shared<SaveFileCommandConsole>();
5961
case GlobalCommands::RunPythonScript:

src/Core/ConsoleApplication/ConsoleCommands.cc

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ DEALINGS IN THE SOFTWARE.
2727
*/
2828

2929
#include <Core/ConsoleApplication/ConsoleCommands.h>
30+
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
3031
#include <Dataflow/Engine/Controller/NetworkEditorController.h>
3132
#include <Core/Application/Application.h>
3233
#include <Dataflow/Serialization/Network/XMLSerializer.h>
3334
#include <Dataflow/Serialization/Network/NetworkDescriptionSerialization.h>
35+
#include <Dataflow/Network/Module.h>
36+
#include <Core/Logging/ConsoleLogger.h>
3437
#include <Core/Python/PythonInterpreter.h>
3538

3639
using namespace SCIRun::Core;
@@ -42,18 +45,40 @@ using namespace Algorithms;
4245
LoadFileCommandConsole::LoadFileCommandConsole()
4346
{
4447
addParameter(Name("FileNum"), 0);
48+
addParameter(Variables::Filename, std::string());
49+
}
50+
51+
//TODO: find a better place for this function
52+
namespace
53+
{
54+
void quietModulesIfNotVerbose()
55+
{
56+
if (!Application::Instance().parameters()->verboseMode())
57+
SCIRun::Dataflow::Networks::Module::defaultLogger_.reset(new SCIRun::Core::Logging::NullLogger);
58+
}
4559
}
4660

4761
bool LoadFileCommandConsole::execute()
4862
{
63+
quietModulesIfNotVerbose();
64+
4965
auto inputFiles = Application::Instance().parameters()->inputFiles();
66+
std::string filename;
5067
if (!inputFiles.empty())
68+
filename = inputFiles[0];
69+
else
5170
{
52-
auto filename = inputFiles[index_];
71+
filename = get(Variables::Filename).toFilename().string();
72+
}
5373

74+
{
5475
/// @todo: real logger
5576
std::cout << "Attempting load of " << filename << std::endl;
56-
77+
if (!boost::filesystem::exists(filename))
78+
{
79+
std::cout << "File does not exist: " << filename << std::endl;
80+
return false;
81+
}
5782
try
5883
{
5984
auto openedFile = XMLSerializer::load_xml<NetworkFile>(filename);
@@ -136,21 +161,27 @@ bool PrintModulesCommand::execute()
136161

137162
bool InteractiveModeCommandConsole::execute()
138163
{
164+
quietModulesIfNotVerbose();
165+
139166
PythonInterpreter::Instance().run_string("import SCIRunPythonAPI; from SCIRunPythonAPI import *");
140-
std::string x;
141-
while (x.find("quit") == std::string::npos)
167+
std::string line;
168+
while (true)
142169
{
143-
std::cout << "scirun5> ";
144-
std::getline(std::cin, x);
145-
//std::cout << "x is: " << x << std::endl;
146-
PythonInterpreter::Instance().run_string(x);
170+
std::cout << "scirun5> " << std::flush;
171+
std::getline(std::cin, line);
172+
if (line.find("quit") != std::string::npos) // TODO: need fix for ^D entry || (!x.empty() && x[0] == '\004'))
173+
break;
174+
175+
PythonInterpreter::Instance().run_string(line);
147176
}
148177
exit(0);
149178
return true;
150179
}
151180

152181
bool RunPythonScriptCommandConsole::execute()
153182
{
183+
quietModulesIfNotVerbose();
184+
154185
auto script = Application::Instance().parameters()->pythonScriptFile();
155186
if (script)
156187
{

src/Core/Datatypes/SparseRowMatrix.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,13 @@ namespace Datatypes {
9696
index_type column = columnCounter[j];
9797
if (column >= ncols)
9898
THROW_INVALID_ARGUMENT("Invalid sparse row matrix array: column index out of bounds.");
99-
triplets.push_back(Triplet(i, columnCounter[j], 0));
99+
triplets.push_back(Triplet(i, columnCounter[j], data[j]));
100100
j++;
101101
}
102102
i++;
103103
}
104104
this->setFromTriplets(triplets.begin(), triplets.end());
105105
this->reserve(nnz);
106-
std::copy(data, data + nnz, this->valuePtr());
107106
this->makeCompressed();
108107
}
109108

src/Core/Datatypes/Tests/SparseRowMatrixTests.cc

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <Core/Datatypes/MatrixIO.h>
3535
#include <Core/Datatypes/MatrixComparison.h>
3636
#include <Testing/Utils/MatrixTestUtilities.h>
37+
#include <Core/Datatypes/MatrixTypeConversions.h>
3738

3839
using namespace SCIRun;
3940
using namespace SCIRun::Core::Datatypes;
@@ -562,7 +563,7 @@ TEST(SparseRowMatrixTest, TestLegacyConstructor)
562563
EXPECT_EQ(nnz, m.nonZeros());
563564
}
564565

565-
TEST(SparseRowMatrixTest, TestLegacyConstructorWithValues)
566+
TEST(SparseRowMatrixTest, TestLegacyConstructorWithValuesCrappySetOfAssertions)
566567
{
567568
int nnz = 35;
568569
int nrows = 7, ncols = 7;
@@ -578,6 +579,77 @@ TEST(SparseRowMatrixTest, TestLegacyConstructorWithValues)
578579
EXPECT_EQ(-1, *std::min_element(m.valuePtr(), m.valuePtr() + m.nonZeros()));
579580
}
580581

582+
TEST(SparseRowMatrixTest, TestLegacyConstructorWithValuesFixesBugWithBuildMappingMatrix)
583+
{
584+
int nnz = 162;
585+
int nrows = 54, ncols = 6;
586+
index_type rows[] = { 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 147, 150, 153, 156, 159, 162 };
587+
index_type cols[] = { 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 0, 3, 1, 0, 3, 1, 0, 3, 1, 0, 3, 0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 0, 3, 1, 0, 3, 0, 2, 4, 0, 2, 4, 0, 2, 4, 3, 0, 4, 3, 0, 4, 0, 2, 4, 0, 2, 4, 3, 0, 4, 0, 1, 2, 0, 1, 2, 0, 1, 2, 1, 0, 3, 1, 0, 3, 0, 1, 2, 1, 0, 3, 0, 2, 4, 3, 0, 4, 0, 2, 4, 0, 2, 4, 3, 0, 4, 1, 5, 2, 1, 5, 2, 1, 5, 2, 1, 3, 5, 1, 3, 5, 2, 5, 4, 1, 3, 5, 2, 5, 4, 3, 4, 5, 2, 5, 4, 2, 5, 4, 3, 4, 5, 1, 5, 2, 1, 5, 2, 1, 3, 5, 1, 5, 2, 1, 5, 2, 1, 3, 5, 2, 5, 4, 2, 5, 4, 3, 4, 5 };
588+
double vals[] = { 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.666666666666667, 0.333333333333333, 0, 0.666666666666667, 0.333333333333333, 0, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.666666666666667, 0, 0.333333333333333, 0.333333333333333, 0, 0.666666666666667, 1, 3.70074341541719e-017, 3.70074341541719e-017, -1.11022302462516e-016, 0.666666666666667, 0.333333333333333, 0, 0.333333333333333, 0.666666666666667, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.666666666666667, 0, 0.333333333333333, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.333333333333333, 5.55111512312578e-017, 0.666666666666667, 0.277777777777778, 0.277777777777778, 0.444444444444444, -5.55111512312578e-017, 0.666666666666667, 0.333333333333333, 0, 0.333333333333333, 0.666666666666667, 0, 1, 0, 0.666666666666667, 0, 0.333333333333333, 0.333333333333333, 5.55111512312578e-017, 0.666666666666667, 0, 0, 1, 0, 5.55111512312578e-017, 1, -1.11022302462516e-016, 0.666666666666667, 0.333333333333333, 0.666666666666667, 1.11022302462516e-016, 0.333333333333333, 0, 0.333333333333333, 0.666666666666667, 0, 5.55111512312578e-017, 1, 0.333333333333333, 5.55111512312578e-017, 0.666666666666667, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.666666666666667, 0.333333333333333, 0, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.666666666666667, 0.333333333333333, 0, 0, 0.666666666666667, 0.333333333333333, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.444444444444445, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.277777777777778, 0.444444444444444, -2.22044604925031e-016, 0.333333333333333, 0.666666666666667, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0.333333333333333, 0.666666666666667, 0, 0.277777777777778, 0.277777777777778, 0.444444444444444, 0, 0.666666666666667, 0.333333333333333, 0, 1, 0, -2.22044604925031e-016, 0.333333333333333, 0.666666666666667, 0.277777777777778, 0.444444444444444, 0.277777777777778, 0, 0.666666666666667, 0.333333333333333, 0.277777777777778, 0.277777777777778, 0.444444444444444};
589+
590+
auto m = boost::make_shared<SparseRowMatrix>(nrows, ncols, rows, cols, vals, nnz);
591+
592+
DenseMatrix expected(nrows, ncols);
593+
expected << 0.444444444444445, 0.277777777777778, 0.277777777777778, 0, 0, 0,
594+
0.277777777777778, 0.444444444444444, 0.277777777777778, 0, 0, 0,
595+
0.277777777777778, 0.277777777777778, 0.444444444444444, 0, 0, 0,
596+
0.666666666666667, 0.333333333333333, 0, 0, 0, 0,
597+
0.333333333333333, 0.666666666666667, 0, 0, 0, 0,
598+
0.444444444444444, 0.277777777777778, 0, 0.277777777777778, 0, 0,
599+
0.277777777777778, 0.444444444444445, 0, 0.277777777777778, 0, 0,
600+
0.277777777777778, 0.277777777777778, 0, 0.444444444444444, 0, 0,
601+
0.666666666666667, 0, 0.333333333333333, 0, 0, 0,
602+
0.333333333333333, 0, 0.666666666666667, 0, 0, 0,
603+
1, 3.70074341541719e-017, 3.70074341541719e-017, 0, 0, 0,
604+
0.666666666666667, -1.11022302462516e-016, 0, 0.333333333333333, 0, 0,
605+
0.333333333333333, 0, 0, 0.666666666666667, 0, 0,
606+
0.444444444444445, 0, 0.277777777777778, 0, 0.277777777777778, 0,
607+
0.277777777777778, 0, 0.444444444444444, 0, 0.277777777777778, 0,
608+
0.666666666666667, 0, 0, 0, 0.333333333333333, 0,
609+
0.444444444444444, 0, 0, 0.277777777777778, 0.277777777777778, 0,
610+
0.277777777777778, 0, 0, 0.444444444444445, 0.277777777777778, 0,
611+
0.277777777777778, 0, 0.277777777777778, 0, 0.444444444444444, 0,
612+
0.333333333333333, 0, 5.55111512312578e-017, 0, 0.666666666666667, 0,
613+
0.277777777777778, 0, 0, 0.277777777777778, 0.444444444444444, 0,
614+
-5.55111512312578e-017, 0.666666666666667, 0.333333333333333, 0, 0, 0,
615+
0, 0.333333333333333, 0.666666666666667, 0, 0, 0,
616+
0, 1, 0, 0, 0, 0,
617+
0, 0.666666666666667, 0, 0.333333333333333, 0, 0,
618+
5.55111512312578e-017, 0.333333333333333, 0, 0.666666666666667, 0, 0,
619+
0, 0, 1, 0, 0, 0,
620+
5.55111512312578e-017, 0, 0, 1, 0, 0,
621+
-1.11022302462516e-016, 0, 0.666666666666667, 0, 0.333333333333333, 0,
622+
1.11022302462516e-016, 0, 0, 0.666666666666667, 0.333333333333333, 0,
623+
0, 0, 0.333333333333333, 0, 0.666666666666667, 0,
624+
0, 0, 5.55111512312578e-017, 0, 1, 0,
625+
5.55111512312578e-017, 0, 0, 0.333333333333333, 0.666666666666667, 0,
626+
0, 0.444444444444445, 0.277777777777778, 0, 0, 0.277777777777778,
627+
0, 0.277777777777778, 0.444444444444444, 0, 0, 0.277777777777778,
628+
0, 0.666666666666667, 0, 0, 0, 0.333333333333333,
629+
0, 0.444444444444445, 0, 0.277777777777778, 0, 0.277777777777778,
630+
0, 0.277777777777778, 0, 0.444444444444444, 0, 0.277777777777778,
631+
0, 0, 0.666666666666667, 0, 0, 0.333333333333333,
632+
0, 0, 0, 0.666666666666667, 0, 0.333333333333333,
633+
0, 0, 0.444444444444445, 0, 0.277777777777778, 0.277777777777778,
634+
0, 0, 0, 0.444444444444445, 0.277777777777778, 0.277777777777778,
635+
0, 0, 0.277777777777778, 0, 0.444444444444444, 0.277777777777778,
636+
0, 0, -2.22044604925031e-016, 0, 0.666666666666667, 0.333333333333333,
637+
0, 0, 0, 0.277777777777778, 0.444444444444444, 0.277777777777778,
638+
0, 0.277777777777778, 0.277777777777778, 0, 0, 0.444444444444444,
639+
0, 0.333333333333333, 0, 0, 0, 0.666666666666667,
640+
0, 0.277777777777778, 0, 0.277777777777778, 0, 0.444444444444444,
641+
0, 0, 0.333333333333333, 0, 0, 0.666666666666667,
642+
0, 0, 0, 0, 0, 1,
643+
0, -2.22044604925031e-016, 0, 0.333333333333333, 0, 0.666666666666667,
644+
0, 0, 0.277777777777778, 0, 0.277777777777778, 0.444444444444444,
645+
0, 0, 0, 0, 0.333333333333333, 0.666666666666667,
646+
0, 0, 0, 0.277777777777778, 0.277777777777778, 0.444444444444444;
647+
EXPECT_EQ(nrows, m->nrows());
648+
EXPECT_EQ(ncols, m->ncols());
649+
EXPECT_EQ(nnz, m->nonZeros());
650+
EXPECT_MATRIX_EQ_TOLERANCE(expected, *convertMatrix::toDense(m), 1e-15);
651+
}
652+
581653
TEST(SparseRowMatrixTest, CopyBlock)
582654
{
583655
auto m = MAKE_SPARSE_MATRIX_HANDLE(

src/Core/Logging/ConsoleLogger.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Copyright (c) 2015 Scientific Computing and Imaging Institute,
77
University of Utah.
88
9-
9+
1010
Permission is hereby granted, free of charge, to any person obtaining a
1111
copy of this software and associated documentation files (the "Software"),
1212
to deal in the Software without restriction, including without limitation
@@ -28,26 +28,34 @@
2828
/// @todo Documentation Core/Logging/ConsoleLogger.h
2929

3030
#ifndef CORE_LOGGING_CONSOLELOGGER_H
31-
#define CORE_LOGGING_CONSOLELOGGER_H
31+
#define CORE_LOGGING_CONSOLELOGGER_H
3232

3333
#include <Core/Logging/LoggerInterface.h>
3434
#include <Core/Logging/share.h>
3535

36-
namespace SCIRun
36+
namespace SCIRun
3737
{
3838
namespace Core
3939
{
4040
namespace Logging
4141
{
42-
class SCISHARE ConsoleLogger : public LegacyLoggerInterface
42+
class SCISHARE ConsoleLogger : public LegacyLoggerInterface
4343
{
4444
public:
45-
virtual void error(const std::string& msg) const;
46-
virtual void warning(const std::string& msg) const;
47-
virtual void remark(const std::string& msg) const;
48-
virtual void status(const std::string& msg) const;
45+
virtual void error(const std::string& msg) const override;
46+
virtual void warning(const std::string& msg) const override;
47+
virtual void remark(const std::string& msg) const override;
48+
virtual void status(const std::string& msg) const override;
4949
};
5050

51+
class SCISHARE NullLogger : public LegacyLoggerInterface
52+
{
53+
public:
54+
virtual void error(const std::string& msg) const override {}
55+
virtual void warning(const std::string& msg) const override {}
56+
virtual void remark(const std::string& msg) const override {}
57+
virtual void status(const std::string& msg) const override {}
58+
};
5159
}
5260
}
5361
}

src/Dataflow/Engine/Controller/PythonImpl.cc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@
4848
#include <boost/range/adaptors.hpp>
4949
#include <boost/range/algorithm/copy.hpp>
5050
#include <Core/Python/PythonDatatypeConverter.h>
51+
#include <Core/Python/PythonInterpreter.h>
5152

5253
using namespace SCIRun;
54+
using namespace SCIRun::Core;
5355
using namespace SCIRun::Core::Algorithms;
5456
using namespace SCIRun::Core::Commands;
5557
using namespace SCIRun::Core::Thread;
@@ -359,6 +361,7 @@ namespace
359361
input_ = boost::make_shared<PyPortsImpl>(module_, true, nec_);
360362
output_ = boost::make_shared<PyPortsImpl>(module_, false, nec_);
361363
}
364+
creationTime_ = boost::posix_time::second_clock::local_time();
362365
}
363366

364367
virtual std::string id() const override
@@ -501,10 +504,16 @@ namespace
501504
return input_;
502505
}
503506

507+
virtual boost::posix_time::ptime creationTime() const override
508+
{
509+
return creationTime_;
510+
}
511+
504512
private:
505513
ModuleHandle module_;
506514
NetworkEditorController& nec_;
507515
boost::shared_ptr<PyPortsImpl> input_, output_;
516+
boost::posix_time::ptime creationTime_;
508517
};
509518
}
510519

@@ -590,6 +599,7 @@ std::vector<boost::shared_ptr<PyModule>> PythonImpl::moduleList() const
590599
{
591600
std::vector<boost::shared_ptr<PyModule>> modules;
592601
boost::copy(modules_ | boost::adaptors::map_values, std::back_inserter(modules));
602+
std::sort(modules.begin(), modules.end(), [](const boost::shared_ptr<PyModule> lhs, const boost::shared_ptr<PyModule> rhs) { return lhs->creationTime() < rhs->creationTime(); });
593603
return modules;
594604
}
595605

@@ -602,7 +612,7 @@ boost::shared_ptr<PyModule> PythonImpl::findModule(const std::string& id) const
602612
std::string PythonImpl::executeAll(const ExecutableLookup* lookup)
603613
{
604614
nec_.executeAll(lookup);
605-
return "Execution started.";
615+
return "Execution started."; //TODO: attach log for execution ended event.
606616
}
607617

608618
std::string PythonImpl::connect(const std::string& moduleIdFrom, int fromIndex, const std::string& moduleIdTo, int toIndex)
@@ -660,6 +670,12 @@ std::string PythonImpl::importNetwork(const std::string& filename)
660670
//TODO: provide more informative python return value string
661671
}
662672

673+
std::string PythonImpl::runScript(const std::string& filename)
674+
{
675+
PythonInterpreter::Instance().run_script("exec(open('" + filename + "').read())");
676+
return filename + " executed.";
677+
}
678+
663679
std::string PythonImpl::quit(bool force)
664680
{
665681
auto quitCmd(cmdFactory_->create(force ? GlobalCommands::QuitCommand : GlobalCommands::SetupQuitAfterExecute));

src/Dataflow/Engine/Controller/PythonImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace Engine {
6060
virtual std::string saveNetwork(const std::string& filename) override;
6161
virtual std::string loadNetwork(const std::string& filename) override;
6262
virtual std::string importNetwork(const std::string& filename) override;
63+
virtual std::string runScript(const std::string& filename) override;
6364
virtual std::string quit(bool force) override;
6465
virtual void setUnlockFunc(boost::function<void()> unlock) override;
6566
virtual void setModuleContext(bool inModule) override { inModule_ = inModule; }

src/Dataflow/Engine/Python/NetworkEditorPythonAPI.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,21 @@ std::string NetworkEditorPythonAPI::importNetwork(const std::string& filename)
230230
}
231231
}
232232

233+
std::string NetworkEditorPythonAPI::runScript(const std::string& filename)
234+
{
235+
Guard g(pythonLock_.get());
236+
237+
if (impl_ && impl_->isModuleContext())
238+
return "In module context--function not available";
239+
240+
if (impl_)
241+
return impl_->runScript(filename);
242+
else
243+
{
244+
return "Null implementation: NetworkEditorPythonAPI::runScript()";
245+
}
246+
}
247+
233248
std::string NetworkEditorPythonAPI::quit(bool force)
234249
{
235250
Guard g(pythonLock_.get());

src/Dataflow/Engine/Python/NetworkEditorPythonAPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ namespace SCIRun {
7373
static std::string saveNetwork(const std::string& filename);
7474
static std::string loadNetwork(const std::string& filename);
7575
static std::string importNetwork(const std::string& filename);
76+
static std::string runScript(const std::string& filename);
7677

7778
static std::string quit(bool force);
7879

0 commit comments

Comments
 (0)