Skip to content

Commit a384e5d

Browse files
intermediate commit - module structure done
1 parent 10a4378 commit a384e5d

File tree

11 files changed

+200
-31
lines changed

11 files changed

+200
-31
lines changed

src/Core/Algorithms/Factory/HardCodedAlgorithmFactory.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include <Core/Algorithms/DataIO/ReadMatrix.h>
6666
#include <Core/Algorithms/DataIO/WriteMatrix.h>
6767
#include <Core/Algorithms/Legacy/FiniteElements/BuildMatrix/BuildFEMatrix.h>
68+
#include <Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h>
6869
#include <Core/Algorithms/BrainStimulator/ElectrodeCoilSetupAlgorithm.h>
6970
#include <Core/Algorithms/BrainStimulator/SetConductivitiesToTetMeshAlgorithm.h>
7071
#include <Core/Algorithms/BrainStimulator/GenerateROIStatisticsAlgorithm.h>
@@ -145,6 +146,7 @@ void HardCodedAlgorithmFactory::addToMakerMap()
145146
ADD_MODULE_ALGORITHM(MapFieldDataOntoElems, MapFieldDataOntoElemsAlgo)
146147
ADD_MODULE_ALGORITHM(ClipFieldByFunction, ClipMeshBySelectionAlgo)
147148
ADD_MODULE_ALGORITHM(MapFieldDataFromSourceToDestination, MapFieldDataFromSourceToDestinationAlgo)
149+
ADD_MODULE_ALGORITHM(BuildFEVolRHS, BuildFEVolRHSAlgo)
148150
;
149151
}
150152
}

src/Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.cc

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
#include <Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h>
3131
#include <Core/Datatypes/DenseMatrix.h>
32+
#include <Core/Datatypes/Legacy/Field/Mesh.h>
33+
#include <Core/Datatypes/Legacy/Field/VMesh.h>
34+
#include <Core/Datatypes/Legacy/Field/Field.h>
35+
#include <Core/Datatypes/Legacy/Field/VField.h>
3236
#include <Core/Datatypes/SparseRowMatrix.h>
3337
#include <Core/Thread/Barrier.h>
3438
#include <Core/Thread/Parallel.h>
@@ -48,24 +52,32 @@ AlgorithmInputName BuildFEVolRHSAlgo::Mesh("Mesh");
4852
AlgorithmInputName BuildFEVolRHSAlgo::Vector_Table("Vector_Table");
4953
AlgorithmOutputName BuildFEVolRHSAlgo::RHS("RHS");
5054

55+
BuildFEVolRHSAlgo::BuildFEVolRHSAlgo()
56+
{
57+
58+
}
5159

52-
FieldHandle BuildFEVolRHSAlgo::run(FieldHandle input, DenseMatrixHandle ctable) const
60+
61+
DenseMatrixHandle BuildFEVolRHSAlgo::run(FieldHandle input, DenseMatrixHandle ctable) const
5362
{
54-
FieldHandle a;
63+
DenseMatrixHandle a;
64+
65+
66+
67+
68+
5569
return a;
5670
}
5771

5872
AlgorithmOutput BuildFEVolRHSAlgo::run_generic(const AlgorithmInput& input) const
5973
{
60-
/* auto field = input.get<Field>(Variables::InputField);
61-
auto ctable = input.get<DenseMatrix>(Conductivity_Table);
62-
63-
SparseRowMatrixHandle stiffness;
64-
if (!run(field, ctable, stiffness))
65-
THROW_ALGORITHM_PROCESSING_ERROR("False returned on legacy run call.");*/
74+
auto mesh = input.get<Field>(Mesh);
75+
auto ctable = input.get<DenseMatrix>(Vector_Table);
6676

77+
DenseMatrixHandle volrhs = run(mesh, ctable);
78+
6779
AlgorithmOutput output;
68-
// output[Stiffness_Matrix] = stiffness;
80+
output[RHS] = volrhs;
6981
return output;
7082
}
7183

src/Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ namespace SCIRun {
4242
class SCISHARE BuildFEVolRHSAlgo : public AlgorithmBase
4343
{
4444
public:
45-
45+
BuildFEVolRHSAlgo();
4646
static AlgorithmInputName Mesh;
4747
static AlgorithmInputName Vector_Table;
4848
static AlgorithmOutputName RHS;
4949

50-
FieldHandle run(FieldHandle input, Datatypes::DenseMatrixHandle ctable) const;
50+
Datatypes::DenseMatrixHandle run(FieldHandle input, Datatypes::DenseMatrixHandle ctable) const;
5151
virtual AlgorithmOutput run_generic(const AlgorithmInput &) const;
5252
private:
5353

src/Interface/Modules/Factory/ModuleDialogFactoryAdditional.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828

2929
#include <Interface/Modules/Factory/ModuleDialogFactory.h>
3030
#include <Interface/Modules/FiniteElements/TDCSSimulatorDialog.h>
31+
#include <Interface/Modules/FiniteElements/BuildFEVolRHSDialog.h>
3132
#include <Interface/Modules/BrainStimulator/SetConductivitiesToTetMeshDialog.h>
3233
#include <Interface/Modules/BrainStimulator/ElectrodeCoilSetupDialog.h>
3334
#include <Interface/Modules/BrainStimulator/GenerateROIStatisticsDialog.h>
3435
#include <Interface/Modules/BrainStimulator/SetupRHSforTDCSandTMSDialog.h>
35-
3636
#include <boost/assign.hpp>
3737
#include <boost/functional/factory.hpp>
3838

@@ -47,6 +47,7 @@ void ModuleDialogFactory::addDialogsToMakerMap2()
4747
ADD_MODULE_DIALOG(ElectrodeCoilSetup, ElectrodeCoilSetupDialog)
4848
ADD_MODULE_DIALOG(SetConductivitiesToTetMesh, SetConductivitiesToTetMeshDialog)
4949
ADD_MODULE_DIALOG(GenerateROIStatistics, GenerateROIStatisticsDialog)
50-
ADD_MODULE_DIALOG(SetupRHSforTDCSandTMS, SetupRHSforTDCSandTMSDialog)
50+
ADD_MODULE_DIALOG(SetupRHSforTDCSandTMS, SetupRHSforTDCSandTMSDialog)
51+
ADD_MODULE_DIALOG(BuildFEVolRHS, BuildFEVolRHSDialog)
5152
;
5253
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>BuildFEVolRHS</class>
4+
<widget class="QWidget" name="BuildFEVolRHS">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>233</width>
10+
<height>37</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout">
17+
<item row="0" column="0">
18+
<widget class="QCheckBox" name="vectorTableBasisMatrices">
19+
<property name="text">
20+
<string>Use Vector TableBasis Matrices</string>
21+
</property>
22+
</widget>
23+
</item>
24+
</layout>
25+
</widget>
26+
<resources/>
27+
<connections/>
28+
</ui>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2012 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#include <Interface/Modules/FiniteElements/BuildFEVolRHSDialog.h>
30+
#include <Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h>
31+
#include <Dataflow/Network/ModuleStateInterface.h>
32+
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
33+
34+
using namespace SCIRun::Gui;
35+
using namespace SCIRun::Dataflow::Networks;
36+
using namespace SCIRun::Core::Algorithms;
37+
using namespace SCIRun::Core::Algorithms::FiniteElements;
38+
39+
40+
BuildFEVolRHSDialog::BuildFEVolRHSDialog(const std::string& name, ModuleStateHandle state,
41+
QWidget* parent /* = 0 */)
42+
: ModuleDialogGeneric(state, parent)
43+
{
44+
setupUi(this);
45+
setWindowTitle(QString::fromStdString(name));
46+
fixSize();
47+
}
48+
49+
void BuildFEVolRHSDialog::pull()
50+
{
51+
//TODO
52+
}
53+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2012 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef INTERFACE_MODULES_BuildFEVolRHSDialog_H
30+
#define INTERFACE_MODULES_BuildFEVolRHSDialog_H
31+
32+
#include "Interface/Modules/FiniteElements/ui_BuildFEVolRHS.h"
33+
#include <Interface/Modules/Base/ModuleDialogGeneric.h>
34+
#include <Interface/Modules/FiniteElements/share.h>
35+
36+
namespace SCIRun {
37+
namespace Gui {
38+
39+
class SCISHARE BuildFEVolRHSDialog : public ModuleDialogGeneric,
40+
public Ui::BuildFEVolRHS
41+
{
42+
Q_OBJECT
43+
44+
public:
45+
BuildFEVolRHSDialog(const std::string& name,
46+
SCIRun::Dataflow::Networks::ModuleStateHandle state,
47+
QWidget* parent = 0);
48+
virtual void pull();
49+
};
50+
51+
}
52+
}
53+
54+
#endif

src/Interface/Modules/FiniteElements/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@
2929

3030
SET(Interface_Modules_FiniteElements_FORMS
3131
TDCSSimulatorDialog.ui
32+
BuildFEVolRHS.ui
3233
)
3334

3435
SET(Interface_Modules_FiniteElements_HEADERS
3536
TDCSSimulatorDialog.h
36-
share.h
37+
BuildFEVolRHSDialog.h
38+
share.h
3739
)
3840

3941
SET(Interface_Modules_FiniteElements_SOURCES
4042
TDCSSimulatorDialog.cc
43+
BuildFEVolRHSDialog.cc
4144
)
4245

4346
QT4_WRAP_UI(Interface_Modules_FiniteElements_FORMS_HEADERS ${Interface_Modules_FiniteElements_FORMS})

src/Modules/Factory/ModuleFactoryImpl2.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ DEALINGS IN THE SOFTWARE.
4545
#include <Modules/BrainStimulator/GenerateROIStatistics.h>
4646
#include <Modules/Legacy/Math/AddKnownsToLinearSystem.h>
4747
#include <Modules/Legacy/FiniteElements/BuildTDCSMatrix.h>
48+
#include <Modules/Legacy/FiniteElements/BuildFEVolRHS.h>
4849

4950
using namespace SCIRun::Dataflow::Networks;
5051
using namespace SCIRun::Modules;
@@ -77,4 +78,5 @@ void ModuleDescriptionLookup::addMoreModules()
7778
addModuleDesc<ConvertMatrixTypeModule>("ConvertMatrixType", "Math", "SCIRun", "Real ported module", "...");
7879
addModuleDesc<MapFieldDataFromNodeToElemModule>("MapFieldDataFromNodeToElem", "ChangeFieldData", "SCIRun", "Real ported module", "...");
7980
addModuleDesc<SplitFieldByConnectedRegion>("SplitFieldByConnectedRegion", "NewField", "SCIRun", "Real ported module", "...");
81+
addModuleDesc<BuildFEVolRHS>("BuildFEVolRHS", "FiniteElements", "SCIRun", "Real ported module", "...");
8082
}

src/Modules/Legacy/FiniteElements/BuildFEVolRHS.cc

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828
/// @todo Documentation Modules/Legacy/FiniteElements/BuildFEVolRHS.cc
29-
29+
/*
3030
#ifdef SCIRUN4_ESSENTIAL_CODE_TO_BE_PORTED
3131
#include <Core/Datatypes/SparseRowMatrix.h>
3232
#include <Core/Datatypes/DenseMatrix.h>
@@ -39,28 +39,42 @@
3939
#include <Dataflow/GuiInterface/GuiVar.h>
4040
#include <Dataflow/Network/Module.h>
4141
#endif
42-
43-
//#include <Core/Algorithms/FiniteElements/BuildRHS/BuildFEVolRHS.h>
44-
#include <Core/Datatypes/Legacy/Field/Field.h>
42+
*/
4543
#include <Modules/Legacy/FiniteElements/BuildFEVolRHS.h>
46-
44+
#include <Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h>
45+
#include <Core/Datatypes/Matrix.h>
46+
#include <Core/Datatypes/DenseMatrix.h>
47+
#include <Core/Datatypes/Legacy/Field/Field.h>
4748

4849
using namespace SCIRun::Modules::FiniteElements;
4950
using namespace SCIRun::Dataflow::Networks;
50-
//using namespace SCIRun::Core::Datatypes;
51-
//using namespace SCIRun::Core::Algorithms;
51+
using namespace SCIRun::Core::Datatypes;
5252
using namespace SCIRun;
5353

54-
BuildFEVolRHSModule::BuildFEVolRHSModule()
55-
: Module(ModuleLookupInfo("BuildFEVolRHSModule", "FiniteElements", "SCIRun"), false)
54+
BuildFEVolRHS::BuildFEVolRHS()
55+
: Module(ModuleLookupInfo("BuildFEVolRHS", "FiniteElements", "SCIRun"))
5656
{
5757
INITIALIZE_PORT(Mesh);
5858
INITIALIZE_PORT(Vector_Table);
5959
INITIALIZE_PORT(RHS);
6060
}
6161

62-
void BuildFEVolRHSModule::execute()
62+
void BuildFEVolRHS::setStateDefaults()
6363
{
64+
// setStateBoolFromAlgo(SetFieldDataAlgo::keepTypeCheckBox);
65+
}
66+
67+
void BuildFEVolRHS::execute()
68+
{
69+
auto mesh = getRequiredInput(Mesh);
70+
auto vtable = getRequiredInput(Vector_Table);
71+
72+
if (needToExecute())
73+
{
74+
auto output = algo().run_generic(make_input((Mesh, mesh)(Vector_Table, vtable)));
75+
sendOutputFromAlgorithm(RHS, output);
76+
}
77+
6478
/*
6579
#ifdef SCIRUN4_ESSENTIAL_CODE_TO_BE_PORTED
6680
FieldHandle Field;

0 commit comments

Comments
 (0)