Skip to content

Commit 6f8567c

Browse files
committed
Hook up gui
1 parent 5c858a9 commit 6f8567c

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

src/Interface/Modules/Math/SolveComplexLinearSystem.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>481</width>
10-
<height>150</height>
10+
<height>160</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -19,7 +19,7 @@
1919
<property name="minimumSize">
2020
<size>
2121
<width>480</width>
22-
<height>150</height>
22+
<height>160</height>
2323
</size>
2424
</property>
2525
<property name="windowTitle">

src/Modules/Factory/Config/SolveComplexLinearSystem.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"header": "N/A"
1313
},
1414
"UI": {
15-
"name": "N/A",
16-
"header": "N/A"
15+
"name": "SolveComplexLinearSystemDialog",
16+
"header": "Interface/Modules/Math/SolveComplexLinearSystemDialog.h"
1717
}
1818
}

src/Modules/Math/SolveComplexLinearSystem.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
using namespace SCIRun::Modules::Math;
3636
using namespace SCIRun::Core::Datatypes;
3737
using namespace SCIRun::Dataflow::Networks;
38+
using namespace SCIRun::Core::Algorithms;
3839
using namespace SCIRun::Core::Algorithms::Math;
3940

4041
MODULE_INFO_DEF(SolveComplexLinearSystem, Math, SCIRun)
4142

42-
SolveComplexLinearSystem::SolveComplexLinearSystem() : Module(staticInfo_, false)
43+
SolveComplexLinearSystem::SolveComplexLinearSystem() : Module(staticInfo_)
4344
{
4445
INITIALIZE_PORT(LHS);
4546
INITIALIZE_PORT(RHS);
@@ -49,6 +50,9 @@ SolveComplexLinearSystem::SolveComplexLinearSystem() : Module(staticInfo_, false
4950
void SolveComplexLinearSystem::setStateDefaults()
5051
{
5152
auto state = get_state();
53+
state->setValue(Variables::TargetError, 1e-5);
54+
state->setValue(Variables::MaxIterations, 500);
55+
state->setValue(Variables::Method, std::string("cg"));
5256
}
5357

5458
void SolveComplexLinearSystem::execute()
@@ -61,7 +65,9 @@ void SolveComplexLinearSystem::execute()
6165
SolveLinearSystemAlgorithm algo;
6266
auto col = convertMatrix::toColumn(rhs);
6367
auto input = std::make_tuple(lhs, col);
64-
auto x = algo.run(input, std::make_tuple(1e-100, 4000));
68+
auto tolerance = get_state()->getValue(Variables::TargetError).toDouble();
69+
auto maxIterations = get_state()->getValue(Variables::MaxIterations).toInt();
70+
auto x = algo.run(input, std::make_tuple(tolerance, maxIterations));
6571
auto solution = std::get<0>(x);
6672

6773
std::cout << "error: " << std::get<1>(x) << std::endl;

src/Modules/Math/SolveComplexLinearSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace SCIRun {
4848
INPUT_PORT(0, LHS, ComplexMatrix);
4949
INPUT_PORT(1, RHS, ComplexMatrix);
5050
OUTPUT_PORT(0, Solution, ComplexMatrix);
51-
MODULE_TRAITS_AND_INFO(NoAlgoOrUI)
51+
MODULE_TRAITS_AND_INFO(ModuleHasUI)
5252
};
5353
}
5454
}}

0 commit comments

Comments
 (0)