Skip to content

Commit 82d34ad

Browse files
committed
Merge remote-tracking branch 'upstream/issues_AE'
2 parents b66adfa + e443485 commit 82d34ad

34 files changed

+2516
-557
lines changed

src/Core/Algorithms/Base/AlgorithmBase.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,11 @@ std::vector<std::string> Core::Algorithms::toStringVector(const Variable::List&
458458
return toTypedVector<std::string>(list, [](const Variable& v) { return v.toString(); });
459459
}
460460

461+
std::vector<std::string> Core::Algorithms::toNameVector(const Variable::List& list)
462+
{
463+
return toTypedVector<std::string>(list, [](const Variable& v) { return v.name().name(); });
464+
}
465+
461466
std::vector<double> Core::Algorithms::toDoubleVector(const Variable::List& list)
462467
{
463468
return toTypedVector<double>(list, [](const Variable& v) { return v.toDouble(); });

src/Core/Algorithms/Base/Variable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ namespace Algorithms {
134134
}
135135

136136
SCISHARE std::vector<std::string> toStringVector(const Variable::List& list);
137+
SCISHARE std::vector<std::string> toNameVector(const Variable::List& list);
137138
SCISHARE std::vector<double> toDoubleVector(const Variable::List& list);
138139

139140
typedef Variable AlgorithmParameter;

src/Core/Algorithms/Legacy/Fields/MeshDerivatives/SplitByConnectedRegion.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,16 @@ std::vector<FieldHandle> SplitFieldByConnectedRegionAlgo::run(FieldHandle input)
294294
temp[j] = output[j];
295295
}
296296

297-
if (sortAscending)
297+
if (!sizes.empty())
298298
{
299-
std::sort(order.begin(),order.end(),AscSortSizes(&(sizes[0])));
300-
}
301-
else
302-
{
303-
std::sort(order.begin(),order.end(),SortSizes(&(sizes[0])));
299+
if (sortAscending)
300+
{
301+
std::sort(order.begin(), order.end(), AscSortSizes(&(sizes[0])));
302+
}
303+
else
304+
{
305+
std::sort(order.begin(), order.end(), SortSizes(&(sizes[0])));
306+
}
304307
}
305308

306309
for (size_t j=0; j<output.size(); j++)

src/Core/CommandLine/Tests/ScirunCommandLineSpecTests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ TEST(ScirunCommandLineSpecTest, CanReadBasicOptions)
4646
" -r [ --regression ] arg regression test a network\n"
4747
" -l [ --logfile ] arg add output messages to a logfile--TODO\n"
4848
" -1 [ --most-recent ] load the most recently used file\n"
49-
" -i [ --interactive ] interactive mode--TODO\n"
49+
" -i [ --interactive ] interactive mode\n"
5050
" -x [ --headless ] disable GUI (Qt still needed, for now)\n"
5151
" --input-file arg SCIRun Network Input File\n"
5252
" -s [ --script ] arg SCIRun Python Script\n"

src/Core/Python/PythonDatatypeConverter.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,27 @@ Variable SCIRun::Core::Python::convertPythonObjectToVariable(const boost::python
413413
return Variable();
414414
}
415415

416+
boost::python::object SCIRun::Core::Python::convertVariableToPythonObject(const Variable& var)
417+
{
418+
if (var.name().name() == "string")
419+
{
420+
return boost::python::object { var.toString() };
421+
}
422+
if (var.name().name() == "int")
423+
{
424+
return boost::python::object { var.toInt() };
425+
}
426+
if (var.name().name() == "double")
427+
{
428+
return boost::python::object { var.toDouble() };
429+
}
430+
if (var.name().name() == "bool")
431+
{
432+
return boost::python::object { var.toBool() };
433+
}
434+
return {};
435+
}
436+
416437
template <class Extractor>
417438
std::string getLabel()
418439
{

src/Core/Python/PythonDatatypeConverter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ namespace SCIRun
9393
SCISHARE boost::python::object convertStringToPython(Datatypes::StringHandle str);
9494

9595
SCISHARE Algorithms::Variable convertPythonObjectToVariable(const boost::python::object& object);
96+
SCISHARE boost::python::object convertVariableToPythonObject(const Algorithms::Variable& object);
9697

9798
class SCISHARE DatatypePythonExtractor
9899
{

src/Dataflow/Engine/Controller/PythonImpl.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,8 @@ namespace
434434
return boost::python::object(transient_value_cast<double>(v));
435435
if (transient_value_check<bool>(v))
436436
return boost::python::object(transient_value_cast<bool>(v));
437+
if (transient_value_check<Variable>(v))
438+
return boost::python::object(convertVariableToPythonObject(transient_value_cast<Variable>(v)));
437439

438440
return boost::python::object();
439441
}

src/Dataflow/Network/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ namespace Networks {
108108
private:
109109
virtual Core::Datatypes::DatatypeHandleOption get_input_handle(const PortId& id) override final;
110110
virtual std::vector<Core::Datatypes::DatatypeHandleOption> get_dynamic_input_handles(const PortId& id) override final;
111+
protected:
111112
virtual void send_output_handle(const PortId& id, Core::Datatypes::DatatypeHandle data) override final;
112-
113113
public:
114114
virtual void setLogger(Core::Logging::LoggerHandle log) override final;
115115
virtual Core::Logging::LoggerHandle getLogger() const override final;
File renamed without changes.

src/ExampleNets/regression/bnarySparseLargeDoesntWork.srn5 renamed to src/ExampleNets/needToFix/bnarySparseLargeDoesntWork.srn5

File renamed without changes.

0 commit comments

Comments
 (0)