Skip to content

Commit 9f18eba

Browse files
author
allywarner
committed
Merge remote-tracking branch 'SCIInstitute/master'
2 parents 8459baa + 91444d4 commit 9f18eba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1786
-681
lines changed

src/Core/Algorithms/Field/ReportFieldInfoAlgorithm.cc

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,17 @@ using namespace SCIRun;
4343

4444
ReportFieldInfoAlgorithm::Outputs ReportFieldInfoAlgorithm::update_input_attributes(FieldHandle f) const
4545
{
46-
VField* vfield = f->vfield();
47-
VMesh* vmesh = f->vmesh();
46+
auto vfield = f->vfield();
47+
auto vmesh = f->vmesh();
4848

49-
ReportFieldInfoAlgorithm::Outputs output;
49+
Outputs output;
5050

5151
if (vfield && vmesh)
5252
{
53-
// Get name of field
54-
//std::string fldname;
55-
//if (f->get_property("name",fldname))
56-
//{
57-
// gui_fldname_.set(fldname);
58-
//}
59-
//else
60-
//{
61-
// gui_fldname_.set("--- Name Not Assigned ---");
62-
//}
63-
64-
// Generation
65-
//gui_generation_.set(to_string(f->generation));
66-
67-
// Typename
6853
auto td = f->get_type_description();
6954
if (td)
7055
{
71-
const std::string &tname = td->get_name();
56+
const auto& tname = td->get_name();
7257
output.type = tname;
7358
}
7459
else
@@ -99,7 +84,7 @@ ReportFieldInfoAlgorithm::Outputs ReportFieldInfoAlgorithm::update_input_attribu
9984
Point center;
10085
Vector size;
10186

102-
const BBox bbox = vmesh->get_bounding_box();
87+
const auto bbox = vmesh->get_bounding_box();
10388
if (bbox.valid())
10489
{
10590
size = bbox.diagonal();
@@ -111,7 +96,7 @@ ReportFieldInfoAlgorithm::Outputs ReportFieldInfoAlgorithm::update_input_attribu
11196
{
11297
warning("Input Field is empty.");
11398

114-
const double nan = std::numeric_limits<double>::quiet_NaN();
99+
const auto nan = std::numeric_limits<double>::quiet_NaN();
115100
output.center = Point(nan,nan,nan);
116101
output.size = Vector(nan, nan, nan);
117102

@@ -133,7 +118,7 @@ ReportFieldInfoAlgorithm::Outputs ReportFieldInfoAlgorithm::update_input_attribu
133118
output.dims[p] = static_cast<double>(dim[p]);
134119

135120
output.geometricSize = 0.0;
136-
for (VMesh::Elem::index_type idx=0; idx< output.numelements_; idx++)
121+
for (VMesh::Elem::index_type idx=0; idx< output.numelements_; ++idx)
137122
{
138123
output.geometricSize += vmesh->get_size(idx);
139124
}

src/Core/Algorithms/Field/ReportFieldInfoAlgorithm.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define ALGORITHMS_MATH_REPORTFIELDINFO_H
3131

3232
#include <Core/Algorithms/Base/AlgorithmBase.h>
33-
#include <Core/Algorithms/Base/AlgorithmMacros.h>
3433
#include <Core/GeometryPrimitives/Vector.h>
3534
#include <Core/GeometryPrimitives/Point.h>
3635
#include <Core/Algorithms/Field/share.h>
@@ -43,7 +42,7 @@ namespace Fields {
4342
class SCISHARE ReportFieldInfoAlgorithm : public AlgorithmBase
4443
{
4544
public:
46-
typedef SCIRun::FieldHandle Inputs;
45+
typedef FieldHandle Inputs;
4746

4847
struct SCISHARE Outputs
4948
{
@@ -61,10 +60,10 @@ namespace Fields {
6160

6261
static std::string summarize(const Outputs& info);
6362

64-
AlgorithmOutput run(const AlgorithmInput& input) const;
63+
AlgorithmOutput run(const AlgorithmInput& input) const override;
6564

6665
private:
67-
Outputs update_input_attributes(SCIRun::FieldHandle f) const;
66+
Outputs update_input_attributes(FieldHandle f) const;
6867
};
6968

7069
}}}}

src/Core/Algorithms/FiniteElements/Tests/BuildFEMatrixTests.cc

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <Core/Datatypes/Legacy/Field/FieldInformation.h>
3232
#include <Core/Datatypes/MatrixTypeConversions.h>
3333
#include <Core/Algorithms/Base/AlgorithmPreconditions.h>
34+
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
3435
#include <Core/Algorithms/Legacy/FiniteElements/BuildMatrix/BuildFEMatrix.h>
3536
#include <Core/Algorithms/DataIO/ReadMatrix.h>
3637
#include <Testing/Utils/SCIRunUnitTests.h>
@@ -70,18 +71,16 @@ namespace FEInputData
7071

7172
DenseMatrixHandle nullConductivityMatrix()
7273
{
73-
return DenseMatrixHandle();
74+
return nullptr;
7475
}
7576
}
7677

7778
TEST(BuildFEMatrixAlgorithmTests, ThrowsForNullMesh)
7879
{
7980
using namespace FEInputData;
8081
BuildFEMatrixAlgo algo;
81-
SparseRowMatrixHandle output;
8282

83-
EXPECT_FALSE(algo.run(FieldHandle(), nullConductivityMatrix(), output));
84-
/// @todo: consider throwing an exception instead of returning false
83+
EXPECT_THROW(algo.run(withInputData((Variables::InputField, nullptr))), AlgorithmProcessingException);
8584
}
8685

8786
TEST(BuildFEMatrixAlgorithmTests, TestMeshSize1e1)
@@ -94,7 +93,10 @@ TEST(BuildFEMatrixAlgorithmTests, TestMeshSize1e1)
9493

9594
BuildFEMatrixAlgo algo;
9695
SparseRowMatrixHandle output;
97-
ASSERT_TRUE(algo.run(mesh, nullConductivityMatrix(), output));
96+
ASSERT_NO_THROW(
97+
auto out = algo.run(withInputData((Variables::InputField, mesh)));
98+
output = out.get<SparseRowMatrix>(BuildFEMatrixAlgo::Stiffness_Matrix);
99+
);
98100

99101
ASSERT_THAT(output, NotNull());
100102

@@ -117,7 +119,10 @@ TEST(BuildFEMatrixAlgorithmTests, TestMeshSize1e3)
117119

118120
BuildFEMatrixAlgo algo;
119121
SparseRowMatrixHandle output;
120-
ASSERT_TRUE(algo.run(mesh, nullConductivityMatrix(), output));
122+
ASSERT_NO_THROW(
123+
auto out = algo.run(withInputData((Variables::InputField, mesh)));
124+
output = out.get<SparseRowMatrix>(BuildFEMatrixAlgo::Stiffness_Matrix);
125+
);
121126

122127
ASSERT_THAT(output, NotNull());
123128

@@ -140,7 +145,10 @@ TEST(BuildFEMatrixAlgorithmTests, TestMeshSize1e4)
140145

141146
BuildFEMatrixAlgo algo;
142147
SparseRowMatrixHandle output;
143-
ASSERT_TRUE(algo.run(mesh, nullConductivityMatrix(), output));
148+
ASSERT_NO_THROW(
149+
auto out = algo.run(withInputData((Variables::InputField, mesh)));
150+
output = out.get<SparseRowMatrix>(BuildFEMatrixAlgo::Stiffness_Matrix);
151+
);
144152

145153
ASSERT_THAT(output, NotNull());
146154

@@ -164,7 +172,10 @@ TEST(BuildFEMatrixAlgorithmTests, DISABLED_TestMeshSize1e5)
164172

165173
BuildFEMatrixAlgo algo;
166174
SparseRowMatrixHandle output;
167-
ASSERT_TRUE(algo.run(mesh, nullConductivityMatrix(), output));
175+
ASSERT_NO_THROW(
176+
auto out = algo.run(withInputData((Variables::InputField, mesh)));
177+
output = out.get<SparseRowMatrix>(BuildFEMatrixAlgo::Stiffness_Matrix);
178+
);
168179

169180
ASSERT_THAT(output, NotNull());
170181

@@ -188,7 +199,10 @@ TEST(BuildFEMatrixAlgorithmTests, DISABLED_TestMeshSize1e6)
188199

189200
BuildFEMatrixAlgo algo;
190201
SparseRowMatrixHandle output;
191-
ASSERT_TRUE(algo.run(mesh, nullConductivityMatrix(), output));
202+
ASSERT_NO_THROW(
203+
auto out = algo.run(withInputData((Variables::InputField, mesh)));
204+
output = out.get<SparseRowMatrix>(BuildFEMatrixAlgo::Stiffness_Matrix);
205+
);
192206

193207
ASSERT_THAT(output, NotNull());
194208

0 commit comments

Comments
 (0)