Skip to content

Commit e4d57c9

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents a2d5cae + 1f9ca46 commit e4d57c9

22 files changed

+95
-58
lines changed

src/Core/Matlab/matlabtofield.cc

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
615615
mlfield = mlfieldtensor; mlfieldtype.createstringarray("tensor");
616616
}
617617

618-
mlfieldedge = findfield(mlarray,"fieldedge;edge;line;");
618+
//mlfieldedge = findfield(mlarray,"fieldedge;edge;line;");
619619

620620
mlfieldderivatives = findfield(mlarray,"fieldderivatives;derivatives;");
621621
mlfieldscalefactors = findfield(mlarray,"fieldscalefactors;scalefactors;");
@@ -1681,8 +1681,8 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
16811681
}
16821682
}
16831683

1684-
if ((mlmeshderivatives.isdense())||(mlfieldderivatives.isdense())||
1685-
(mlfieldedge.isdense()))
1684+
if ((mlmeshderivatives.isdense())||(mlfieldderivatives.isdense())/*||
1685+
(mlfieldedge.isdense())*/)
16861686
{
16871687
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (element is a point, hence no linear/higher order interpolation is supported)", postremark);
16881688
}
@@ -1719,7 +1719,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
17191719
}
17201720

17211721
// Connectivity should be 2D
1722-
if ((mledge.getnumdims() > 2)||(mlfieldedge.getnumdims() > 2))
1722+
if ((mledge.getnumdims() > 2)/*||(mlfieldedge.getnumdims() > 2)*/)
17231723
{
17241724
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (edge connectivity matrix should be 2D)", postremark);
17251725
}
@@ -1809,7 +1809,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
18091809
}
18101810
else
18111811
{
1812-
if ((meshbasistype == "quadratic")&&(mlfieldedge.isdense()))
1812+
if ((meshbasistype == "quadratic")/*&&(mlfieldedge.isdense())*/)
18131813
{
18141814
fieldbasistype = "linear";
18151815
}
@@ -1841,11 +1841,11 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
18411841

18421842
if ((fieldbasistype == "linear")||(fieldbasistype == "cubic"))
18431843
{
1844-
if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
1844+
/*if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
18451845
{
18461846
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
18471847
}
1848-
1848+
*/
18491849
if (fieldbasistype == "linear")
18501850
{
18511851
fieldbasis = "CrvLinearLgn";
@@ -1862,35 +1862,35 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
18621862

18631863
if (fieldbasis == "quadratic")
18641864
{
1865-
if (((meshbasistype == "linear")||(meshbasistype == "cubic"))&&(mlfieldedge.isempty()))
1866-
{
1867-
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
1868-
}
1865+
//if (((meshbasistype == "linear")||(meshbasistype == "cubic"))&&(mlfieldedge.isempty()))
1866+
//{
1867+
// remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
1868+
//}
18691869
fieldbasis = "CrvQuadraticLgn";
18701870
}
18711871

18721872
// established fieldbasis //
18731873

1874-
if (mlfieldedge.isdense())
1875-
{
1876-
m = mlfieldedge.getm(); n = mlfieldedge.getn();
1877-
if (fieldbasistype == "quadratic")
1878-
{
1879-
if (!(((m==3)&&(n==numelements))||((m==numelements)&&(n==3))))
1880-
{
1881-
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (one of the dimensions of fieldedge needs to be of size 2 or 3)", postremark);
1882-
}
1883-
if (m!=3) mlfieldedge.transpose();
1884-
}
1885-
else
1886-
{
1887-
if (!(((m==2)&&(n==numelements))||((m==numelements)&&(n==2))))
1888-
{
1889-
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (one of the dimensions of fieldedge needs to be of size 2 or 3)", postremark);
1890-
}
1891-
if (m!=2) mlfieldedge.transpose();
1892-
}
1893-
}
1874+
//if (mlfieldedge.isdense())
1875+
//{
1876+
// m = mlfieldedge.getm(); n = mlfieldedge.getn();
1877+
// if (fieldbasistype == "quadratic")
1878+
// {
1879+
// if (!(((m==3)&&(n==numelements))||((m==numelements)&&(n==3))))
1880+
// {
1881+
// remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (one of the dimensions of fieldedge needs to be of size 2 or 3)", postremark);
1882+
// }
1883+
// if (m!=3) mlfieldedge.transpose();
1884+
// }
1885+
// else
1886+
// {
1887+
// if (!(((m==2)&&(n==numelements))||((m==numelements)&&(n==2))))
1888+
// {
1889+
// remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (one of the dimensions of fieldedge needs to be of size 2 or 3)", postremark);
1890+
// }
1891+
// if (m!=2) mlfieldedge.transpose();
1892+
// }
1893+
//}
18941894

18951895
if (mlfieldderivatives.isdense())
18961896
{
@@ -1937,8 +1937,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
19371937

19381938
// established meshtype //
19391939

1940-
if ((mledge.isdense())||(mlcell.isdense())||
1941-
(mlfieldedge.isdense()))
1940+
if ((mledge.isdense())||(mlcell.isdense())/*||(mlfieldedge.isdense())*/)
19421941
{ // a matrix with multiple connectivities is not yet allowed
19431942
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (multiple connectivity matrices defined)", postremark);
19441943
}
@@ -2106,10 +2105,10 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
21062105

21072106
if ((fieldbasistype == "linear")||(fieldbasistype == "cubic"))
21082107
{
2109-
if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
2110-
{
2111-
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
2112-
}
2108+
//if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
2109+
//{
2110+
// remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
2111+
//}
21132112

21142113
if (fieldbasistype == "linear")
21152114
{
@@ -2127,7 +2126,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
21272126

21282127
if (fieldbasis == "quadratic")
21292128
{
2130-
if (((meshbasistype == "linear")||(meshbasistype == "cubic"))&&(true))
2129+
if (((meshbasistype == "linear")||(meshbasistype == "cubic")))
21312130
{
21322131
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
21332132
}
@@ -2191,8 +2190,7 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
21912190

21922191
// established meshtype //
21932192

2194-
if ((mledge.isdense())||(mlface.isdense())||
2195-
(mlfieldedge.isdense()))
2193+
if ((mledge.isdense())||(mlface.isdense())/*||(mlfieldedge.isdense())*/)
21962194
{ // a matrix with multiple connectivities is not yet allowed
21972195
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (multiple connectivity matrices defined)", postremark);
21982196
}
@@ -2405,10 +2403,10 @@ int MatlabToFieldAlgo::mlanalyze(matlabarray mlarray, bool postremark)
24052403

24062404
if ((fieldbasistype == "linear")||(fieldbasistype == "cubic"))
24072405
{
2408-
if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
2409-
{
2410-
remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
2411-
}
2406+
//if ((meshbasistype == "quadratic")&&(mlfieldedge.isempty()))
2407+
//{
2408+
// remarkAndThrow("Matrix '" + mlarray.getname() + "' cannot be translated into a SCIRun Field (no fieldedge connectivity matrix)", postremark);
2409+
//}
24122410

24132411
if (fieldbasistype == "linear")
24142412
{

src/Core/Matlab/matlabtofield.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class SCISHARE MatlabToFieldAlgo : public matfilebase
109109

110110
// Field description classes
111111
matlabarray mlfield;
112-
matlabarray mlfieldedge;
112+
//matlabarray mlfieldedge;
113113

114114
matlabarray mlfieldderivatives;
115115
matlabarray mlfieldscalefactors;

src/Core/Python/Tests/PythonInterpreterTests.cc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,15 @@ class FieldConversionTests : public testing::Test
117117
return loadFieldFromFile(TestResources::rootDir() / "Fields/point_cloud/scalar/pts_scalar.fld");
118118
}
119119

120-
//static FieldHandle CreateCurveMesh()
121-
//{
122-
// return loadFieldFromFile(TestResources::rootDir() / "Fields/test_curve_elem.mat");
123-
//}
120+
static FieldHandle CreateCurveMeshElem()
121+
{
122+
return loadFieldFromFile(TestResources::rootDir() / "Fields/test_curve_elem.fld");
123+
}
124+
125+
static FieldHandle CreateImageNode()
126+
{
127+
return loadFieldFromFile(TestResources::rootDir() / "Fields/test_image_node.fld");
128+
}
124129

125130
//static FieldHandle CreatePointCloudScalar()
126131
//{
@@ -129,7 +134,10 @@ class FieldConversionTests : public testing::Test
129134

130135
static std::vector<FieldHandle> fileExamples()
131136
{
132-
return{ TetMesh1(), TetMesh2(), CreateTriSurfScalarOnNode(), CreateTriSurfVectorOnNode(), CreateTetMeshVectorOnNode(), CreateTetMeshScalarOnElem(), CreateTetMeshScalarOnNode(), CreateTetMeshTensorOnNode(), CreatePointCloudScalar() };
137+
return{ TetMesh1(), TetMesh2(), CreateTriSurfScalarOnNode(), CreateTriSurfVectorOnNode(), CreateTetMeshVectorOnNode(),
138+
CreateTetMeshScalarOnElem(), CreateTetMeshScalarOnNode(), CreateTetMeshTensorOnNode(), CreatePointCloudScalar(),
139+
CreateCurveMeshElem(), CreateImageNode()
140+
};
133141
}
134142
};
135143

src/Dataflow/Network/Module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,6 @@ void Module::sendFeedbackUpstreamAlongIncomingConnections(const ModuleFeedback&
968968
std::string Module::helpPageUrl() const
969969
{
970970
auto url = "http://scirundocwiki.sci.utah.edu/SCIRunDocs/index.php/CIBC:Documentation:SCIRun:Reference:"
971-
+ legacyPackageName() + ":" + get_module_name();
971+
+ legacyPackageName() + ":" + legacyModuleName();
972972
return url;
973973
}

src/Dataflow/Network/Module.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ namespace Networks {
8282
virtual size_t num_input_ports() const override final;
8383
virtual size_t num_output_ports() const override final;
8484

85+
// override this for modules that changed packages, to point to correct wiki page
86+
virtual std::string legacyPackageName() const { return get_packagename(); }
87+
// override this for modules that changed names, to point to correct wiki page
88+
virtual std::string legacyModuleName() const { return get_module_name(); }
89+
8590
virtual bool hasInputPort(const PortId& id) const override final;
8691
virtual bool hasOutputPort(const PortId& id) const override final;
8792
virtual InputPortHandle getInputPort(const PortId& id) override final;
@@ -113,9 +118,6 @@ namespace Networks {
113118
protected:
114119
virtual void send_output_handle(const PortId& id, Core::Datatypes::DatatypeHandle data) override final;
115120

116-
// override this for modules that changed packages, to point to correct wiki page
117-
virtual std::string legacyPackageName() const { return get_packagename(); }
118-
119121
public:
120122
virtual void setLogger(Core::Logging::LoggerHandle log) override final;
121123
virtual Core::Logging::LoggerHandle getLogger() const override final;
@@ -1017,7 +1019,10 @@ namespace Modules
10171019
}
10181020
};
10191021

1020-
#define LEGACY_BIOPSE_MODULE protected: virtual std::string legacyPackageName() const override { return "BioPSE"; }
1022+
#define LEGACY_BIOPSE_MODULE public: virtual std::string legacyPackageName() const override { return "BioPSE"; }
1023+
#define LEGACY_MATLAB_MODULE public: virtual std::string legacyPackageName() const override { return "MatlabInterface"; }
1024+
#define CONVERTED_VERSION_OF_MODULE(modName) public: virtual std::string legacyModuleName() const override { return #modName; }
1025+
10211026
}
10221027
}
10231028

src/Dataflow/Network/ModuleInterface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ namespace Networks {
8080
virtual bool hasDynamicPorts() const = 0;
8181

8282
virtual std::string helpPageUrl() const = 0;
83+
virtual std::string legacyPackageName() const = 0;
84+
virtual std::string legacyModuleName() const = 0;
8385
};
8486

8587
class SCISHARE ModuleDisplayInterface

src/Dataflow/Network/Tests/MockModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ namespace SCIRun {
9191
MOCK_METHOD1(connectExecuteSelfRequest, boost::signals2::connection(const ExecutionSelfRequestSignalType::slot_type&));
9292
MOCK_METHOD1(setExecutionDisabled, void(bool));
9393
MOCK_CONST_METHOD0(executionDisabled, bool(void));
94+
MOCK_CONST_METHOD0(legacyPackageName, std::string());
95+
MOCK_CONST_METHOD0(legacyModuleName, std::string());
9496
};
9597

9698
typedef boost::shared_ptr<MockModule> MockModulePtr;

src/Interface/Application/ModuleWidget.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, ModuleHandle
329329
connect(this, SIGNAL(executeEnds()), this, SLOT(changeExecuteButtonToPlay()));
330330
connect(this, SIGNAL(signalExecuteButtonIconChangeToStop()), this, SLOT(changeExecuteButtonToStop()));
331331
//qDebug() << width() << height() << currentWidget()->size();
332+
333+
auto oldName = theModule->legacyModuleName();
334+
if (theModule->get_module_name() != oldName)
335+
setToolTip("Converted version of module " + QString::fromStdString(oldName));
332336
}
333337

334338
int ModuleWidget::buildDisplay(ModuleWidgetDisplayBase* display, const QString& name)

src/Modules/Basic/ChooseInput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ namespace SCIRun {
5252
public Has1InputPort<DynamicPortTag<DatatypePortTag>>,
5353
public Has1OutputPort<DatatypePortTag>
5454
{
55+
CONVERTED_VERSION_OF_MODULE(ChooseMatrix)
5556
public:
5657
ChooseInput();
5758
virtual void execute() override;

src/Modules/Legacy/Converters/ConvertMatrixToString.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <Core/Algorithms/Legacy/Converter/ConvertMatrixToString.h>
3131

3232
#include <Core/Datatypes/Matrix.h>
33-
#include <Core/Datatypes/MatrixFwd.h>
3433
#include <Core/Datatypes/DenseMatrix.h>
34+
// ReSharper disable once CppUnusedIncludeDirective
3535
#include <Core/Datatypes/String.h>
3636
#include <Core/Datatypes/DatatypeFwd.h>
3737
#include <Core/Datatypes/MatrixTypeConversions.h>
@@ -45,7 +45,7 @@ using namespace SCIRun::Core::Datatypes;
4545
using namespace SCIRun::Modules::Converters;
4646

4747

48-
ConvertMatrixToString::ConvertMatrixToString() : Module(ModuleLookupInfo("ConvertMatrixToString","Converters","BioPSE"),false)
48+
ConvertMatrixToString::ConvertMatrixToString() : Module(ModuleLookupInfo("ConvertMatrixToString","Converters","SCIRun"),false)
4949
{
5050
INITIALIZE_PORT(InputMatrix);
5151
INITIALIZE_PORT(ResultString);

0 commit comments

Comments
 (0)