Skip to content

Commit 10a4378

Browse files
first commit
1 parent 7ab1226 commit 10a4378

File tree

6 files changed

+211
-34
lines changed

6 files changed

+211
-34
lines changed

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,62 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29+
30+
#include <Core/Algorithms/Legacy/FiniteElements/BuildRHS/BuildFEVolRHS.h>
31+
#include <Core/Datatypes/DenseMatrix.h>
32+
#include <Core/Datatypes/SparseRowMatrix.h>
33+
#include <Core/Thread/Barrier.h>
34+
#include <Core/Thread/Parallel.h>
35+
//#include <Core/Geometry/Point.h>
36+
//#include <Core/Geometry/Tensor.h>
37+
//#include <Core/Logging/Log.h>
38+
39+
using namespace SCIRun;
40+
using namespace SCIRun::Core::Geometry;
41+
using namespace SCIRun::Core::Datatypes;
42+
using namespace SCIRun::Core::Thread;
43+
using namespace SCIRun::Core::Algorithms;
44+
using namespace SCIRun::Core::Algorithms::FiniteElements;
45+
//using namespace SCIRun::Core::Logging;
46+
47+
AlgorithmInputName BuildFEVolRHSAlgo::Mesh("Mesh");
48+
AlgorithmInputName BuildFEVolRHSAlgo::Vector_Table("Vector_Table");
49+
AlgorithmOutputName BuildFEVolRHSAlgo::RHS("RHS");
50+
51+
52+
FieldHandle BuildFEVolRHSAlgo::run(FieldHandle input, DenseMatrixHandle ctable) const
53+
{
54+
FieldHandle a;
55+
return a;
56+
}
57+
58+
AlgorithmOutput BuildFEVolRHSAlgo::run_generic(const AlgorithmInput& input) const
59+
{
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.");*/
66+
67+
AlgorithmOutput output;
68+
// output[Stiffness_Matrix] = stiffness;
69+
return output;
70+
}
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
#ifdef SCIRUN4_CODE_TO_BE_ENABLED_LATER
82+
83+
84+
2985
#include <Core/Algorithms/FiniteElements/BuildRHS/BuildFEVolRHS.h>
3086

3187
#include <Core/Datatypes/DenseMatrix.h>
@@ -905,3 +961,6 @@ run(FieldHandle input, MatrixHandle vtable, MatrixHandle& output)
905961
}
906962

907963
} // end namespace SCIRun
964+
965+
966+
#endif

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

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,45 +26,33 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29-
3029
#ifndef CORE_ALGORITHMS_FINITEELEMENTS_BUILDFEVOLRHS_H
3130
#define CORE_ALGORITHMS_FINITEELEMENTS_BUILDFEVOLRHS_H 1
3231

33-
// Datatypes that the algorithm uses
34-
#include <Core/Datatypes/Field.h>
35-
#include <Core/Datatypes/Mesh.h>
36-
#include <Core/Datatypes/Matrix.h>
37-
38-
// Base class for algorithm
39-
#include <Core/Algorithms/Util/AlgoBase.h>
40-
41-
// for Windows support
42-
#include <Core/Algorithms/FiniteElements/share.h>
32+
#include <Core/Datatypes/MatrixFwd.h>
33+
#include <Core/Algorithms/Base/AlgorithmBase.h>
34+
#include <vector>
35+
#include <Core/Algorithms/Legacy/FiniteElements/share.h>
4336

44-
namespace SCIRunAlgo {
37+
namespace SCIRun {
38+
namespace Core {
39+
namespace Algorithms {
40+
namespace FiniteElements {
4541

46-
using namespace SCIRun;
47-
48-
class SCISHARE BuildFEVolRHSAlgo : public AlgoBase
42+
class SCISHARE BuildFEVolRHSAlgo : public AlgorithmBase
4943
{
5044
public:
51-
BuildFEVolRHSAlgo()
52-
{
53-
// Number of processors to use
54-
add_int("num_processors",-1);
55-
56-
// Store intermediate results to speed up computation for
57-
// for instance vector search
58-
// This option only works for an indexed vector table
59-
add_bool("generate_basis",false);
60-
}
61-
62-
bool run(FieldHandle input,
63-
MatrixHandle vtable,
64-
MatrixHandle& output);
45+
46+
static AlgorithmInputName Mesh;
47+
static AlgorithmInputName Vector_Table;
48+
static AlgorithmOutputName RHS;
49+
50+
FieldHandle run(FieldHandle input, Datatypes::DenseMatrixHandle ctable) const;
51+
virtual AlgorithmOutput run_generic(const AlgorithmInput &) const;
52+
private:
6553

6654
};
6755

68-
} // end namespace SCIRun
56+
}}}}
6957

70-
#endif
58+
#endif

src/Core/Algorithms/Legacy/FiniteElements/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
SET(Core_Algorithms_Legacy_FiniteElements_HEADERS
3131
BuildMatrix/BuildTDCSMatrix.h
3232
BuildMatrix/BuildFEMatrix.h
33+
BuildRHS/BuildFEVolRHS.h
3334
)
3435

3536
# Sources of Core/Algorithms/Legacy/FiniteElements classes
@@ -39,7 +40,7 @@ SET(Core_Algorithms_Legacy_FiniteElements_SRCS
3940
#Mapping/BuildNodeLink.cc
4041
BuildMatrix/BuildFEMatrix.cc
4142
BuildMatrix/BuildTDCSMatrix.cc
42-
#BuildRHS/BuildFEVolRHS.cc
43+
BuildRHS/BuildFEVolRHS.cc
4344
#BuildRHS/BuildFESurfRHS.cc
4445
)
4546

src/Modules/Legacy/FiniteElements/BuildFEVolRHS.cc

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,74 @@
2727
*/
2828
/// @todo Documentation Modules/Legacy/FiniteElements/BuildFEVolRHS.cc
2929

30+
#ifdef SCIRUN4_ESSENTIAL_CODE_TO_BE_PORTED
31+
#include <Core/Datatypes/SparseRowMatrix.h>
32+
#include <Core/Datatypes/DenseMatrix.h>
33+
#include <Core/Datatypes/Matrix.h>
34+
#include <Core/Datatypes/Field.h>
35+
#include <Core/Datatypes/MatrixTypeConverter.h>
36+
37+
#include <Dataflow/Network/Ports/MatrixPort.h>
38+
#include <Dataflow/Network/Ports/FieldPort.h>
39+
#include <Dataflow/GuiInterface/GuiVar.h>
40+
#include <Dataflow/Network/Module.h>
41+
#endif
42+
43+
//#include <Core/Algorithms/FiniteElements/BuildRHS/BuildFEVolRHS.h>
44+
#include <Core/Datatypes/Legacy/Field/Field.h>
45+
#include <Modules/Legacy/FiniteElements/BuildFEVolRHS.h>
46+
47+
48+
using namespace SCIRun::Modules::FiniteElements;
49+
using namespace SCIRun::Dataflow::Networks;
50+
//using namespace SCIRun::Core::Datatypes;
51+
//using namespace SCIRun::Core::Algorithms;
52+
using namespace SCIRun;
53+
54+
BuildFEVolRHSModule::BuildFEVolRHSModule()
55+
: Module(ModuleLookupInfo("BuildFEVolRHSModule", "FiniteElements", "SCIRun"), false)
56+
{
57+
INITIALIZE_PORT(Mesh);
58+
INITIALIZE_PORT(Vector_Table);
59+
INITIALIZE_PORT(RHS);
60+
}
61+
62+
void BuildFEVolRHSModule::execute()
63+
{
64+
/*
65+
#ifdef SCIRUN4_ESSENTIAL_CODE_TO_BE_PORTED
66+
FieldHandle Field;
67+
MatrixHandle VectorTable;
68+
MatrixHandle RHSMatrix;
69+
70+
if (!(get_input_handle("Mesh",Field,true))) return;
71+
get_input_handle("Vector Table", VectorTable, false);
72+
73+
if (inputs_changed_ || gui_use_basis_.changed() || !oport_cached("RHS") )
74+
{
75+
algo_.set_bool("generate_basis",gui_use_basis_.get());
76+
if(!(algo_.run(Field,VectorTable,RHSMatrix))) return;
77+
78+
send_output_handle("RHS", RHSMatrix);
79+
}
80+
#endif
81+
82+
auto mesh = getRequiredInput(Mesh);
83+
auto vectorTable = getRequiredInput(Vector_Table);
84+
85+
if (needToExecute())
86+
{
87+
Core::Algorithms::AlgorithmOutput output; //= algo().run_generic(withInputData((Mesh, mesh)(Vector_Table, vectorTable)));
88+
sendOutputFromAlgorithm(RHS, output);
89+
}
90+
*/
91+
}
92+
93+
94+
95+
#ifdef SCIRUN4_CODE_TO_BE_ENABLED_LATER
96+
97+
3098
#include <Core/Datatypes/SparseRowMatrix.h>
3199
#include <Core/Datatypes/DenseMatrix.h>
32100
#include <Core/Datatypes/Matrix.h>
@@ -88,5 +156,5 @@ void BuildFEVolRHS::execute()
88156

89157
} // End namespace SCIRun
90158

91-
159+
#endif
92160

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
/*
3+
For more information, please see: http://software.sci.utah.edu
4+
5+
The MIT License
6+
7+
Copyright (c) 2009 Scientific Computing and Imaging Institute,
8+
University of Utah.
9+
10+
11+
Permission is hereby granted, free of charge, to any person obtaining a
12+
copy of this software and associated documentation files (the "Software"),
13+
to deal in the Software without restriction, including without limitation
14+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
15+
and/or sell copies of the Software, and to permit persons to whom the
16+
Software is furnished to do so, subject to the following conditions:
17+
18+
The above copyright notice and this permission notice shall be included
19+
in all copies or substantial portions of the Software.
20+
21+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27+
DEALINGS IN THE SOFTWARE.
28+
*/
29+
/// @todo Documentation Modules/Legacy/FiniteElements/BuildFEVolRHSModule.h
30+
31+
#ifndef MODULES_LEGACY_FINITEELEMENTS_BuildFEVolRHSModule_H__
32+
#define MODULES_LEGACY_FINITEELEMENTS_BuildFEVolRHSModule_H__
33+
34+
#include <Dataflow/Network/Module.h>
35+
#include <Modules/Legacy/FiniteElements/share.h>
36+
37+
namespace SCIRun {
38+
namespace Modules {
39+
namespace FiniteElements {
40+
41+
class SCISHARE BuildFEVolRHSModule : public Dataflow::Networks::Module,
42+
public Has2InputPorts<FieldPortTag, MatrixPortTag>,
43+
public Has1OutputPort<FieldPortTag>
44+
{
45+
public:
46+
BuildFEVolRHSModule();
47+
virtual void setStateDefaults() {}
48+
virtual void execute();
49+
50+
INPUT_PORT(0, Mesh, LegacyField);
51+
INPUT_PORT(1, Vector_Table, Matrix);
52+
OUTPUT_PORT(0, RHS, LegacyField);
53+
54+
};
55+
56+
}
57+
}
58+
}
59+
60+
#endif

src/Modules/Legacy/FiniteElements/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
SET(Modules_Legacy_FiniteElements_HEADERS
3232
BuildFEMatrix.h
3333
BuildTDCSMatrix.h
34+
BuildFEVolRHS.h
3435
)
3536

3637
SET(Modules_Legacy_FiniteElements_SRCS
@@ -40,7 +41,7 @@ SET(Modules_Legacy_FiniteElements_SRCS
4041
BuildFEMatrix.cc
4142
BuildTDCSMatrix.cc
4243
#BuildFESurfRHS.cc
43-
#BuildFEVolRHS.cc
44+
BuildFEVolRHS.cc
4445
)
4546

4647
SCIRUN_ADD_LIBRARY(Modules_Legacy_FiniteElements

0 commit comments

Comments
 (0)