2828
2929#include < Testing/ModuleTestBase/ModuleTestBase.h>
3030#include < Modules/Visualization/ShowField.h>
31- #include < Core/Datatypes/Legacy/Field/Field.h>
32- #include < Core/Algorithms/Base/AlgorithmVariableNames.h>
33- #include < Core/Utils/Exception.h>
3431#include < Core/Logging/Log.h>
3532#include < Core/Datatypes/ColorMap.h>
3633
@@ -39,40 +36,40 @@ using namespace SCIRun::TestUtils;
3936using namespace SCIRun ::Core::Datatypes;
4037using namespace SCIRun ::Dataflow::Networks;
4138using namespace SCIRun ::Core::Algorithms;
42- using namespace SCIRun ::Core::Algorithms:: Visualization;
43- using namespace SCIRun ::Core::Algorithms::Visualization:: Parameters;
39+ using namespace Visualization ;
40+ using namespace Parameters ;
4441using namespace SCIRun ::Modules::Visualization;
4542using namespace SCIRun ::Core;
4643using namespace SCIRun ;
47- using namespace SCIRun ::Core:: Logging;
44+ using namespace Logging ;
4845using ::testing::Values;
4946using ::testing::Combine;
5047using ::testing::Range;
5148
5249class ShowFieldScalingTest : public ParameterizedModuleTest <int >
5350{
5451protected:
55- virtual void SetUp ()
52+ void SetUp () override
5653 {
5754 LogSettings::Instance ().setVerbose (false );
58- showField = makeModule (" ShowField" );
59- showField ->setStateDefaults ();
60- showField ->get_state ()->setValue (ShowEdges, false );
55+ showField_ = makeModule (" ShowField" );
56+ showField_ ->setStateDefaults ();
57+ showField_ ->get_state ()->setValue (ShowEdges, false );
6158 auto size = GetParam ();
62- latVol = CreateEmptyLatVol (size, size, size);
63- stubPortNWithThisData (showField , 0 , latVol );
59+ latVol_ = CreateEmptyLatVol (size, size, size);
60+ stubPortNWithThisData (showField_ , 0 , latVol_ );
6461 LOG_DEBUG (" Setting up ShowField with size {}^3 latvol" , size);
6562 }
6663
67- UseRealModuleStateFactory f ;
68- ModuleHandle showField ;
69- FieldHandle latVol ;
64+ UseRealModuleStateFactory f_ ;
65+ ModuleHandle showField_ ;
66+ FieldHandle latVol_ ;
7067};
7168
7269TEST_P (ShowFieldScalingTest, ConstructLatVolGeometry)
7370{
7471 LOG_DEBUG (" Start ShowField::execute" );
75- showField ->execute ();
72+ showField_ ->execute ();
7673 LOG_DEBUG (" End ShowField::execute" );
7774}
7875
@@ -86,89 +83,85 @@ INSTANTIATE_TEST_CASE_P(
8683class ShowFieldStateGeometryNameSynchronizationTest : public ModuleTest
8784{
8885protected:
89- virtual void SetUp ()
86+ void SetUp () override
9087 {
9188 LogSettings::Instance ().setVerbose (false );
92- showField = makeModule (" ShowField" );
93- showField ->setStateDefaults ();
94- auto size = 2 ;
95- latVol = CreateEmptyLatVol (size, size, size);
96- stubPortNWithThisData (showField , 0 , latVol );
89+ showField_ = makeModule (" ShowField" );
90+ showField_ ->setStateDefaults ();
91+ const auto size = 2 ;
92+ latVol_ = CreateEmptyLatVol (size, size, size);
93+ stubPortNWithThisData (showField_ , 0 , latVol_ );
9794 }
9895
99- UseRealModuleStateFactory f ;
100- ModuleHandle showField ;
101- FieldHandle latVol ;
96+ UseRealModuleStateFactory f_ ;
97+ ModuleHandle showField_ ;
98+ FieldHandle latVol_ ;
10299};
103100
104101TEST_F (ShowFieldStateGeometryNameSynchronizationTest, GeometryNameSynchronizesWithShowFieldState)
105102{
106- ModuleLevelUniqueIDGenerator generator (*showField , " EntireField" );
103+ const ModuleLevelUniqueIDGenerator generator (*showField_ , " EntireField" );
107104 auto hash1 = generator ();
108- auto hash2NoChange = generator ();
105+ const auto hash2NoChange = generator ();
109106 EXPECT_EQ (hash1, hash2NoChange);
110107
111- showField ->get_state ()->setValue (Parameters::CylinderRadius, 2 );
108+ showField_ ->get_state ()->setValue (Parameters::CylinderRadius, 2 );
112109
113110 auto stateChangeShouldBeDifferent = generator ();
114111 EXPECT_NE (hash2NoChange, stateChangeShouldBeDifferent);
115112 EXPECT_EQ (stateChangeShouldBeDifferent, generator ());
116113
117- auto size = 3 ;
118- latVol = CreateEmptyLatVol (size, size, size);
119- stubPortNWithThisData (showField , 0 , latVol );
114+ const auto size = 3 ;
115+ latVol_ = CreateEmptyLatVol (size, size, size);
116+ stubPortNWithThisData (showField_ , 0 , latVol_ );
120117
121- auto inputChangeShouldBeDifferent = generator ();
118+ const auto inputChangeShouldBeDifferent = generator ();
122119 EXPECT_NE (stateChangeShouldBeDifferent, inputChangeShouldBeDifferent);
123120
124- stubPortNWithThisData (showField , 1 , ColorMapHandle ());
125- auto addInputShouldBeDifferent = generator ();
121+ stubPortNWithThisData (showField_ , 1 , ColorMapHandle ());
122+ const auto addInputShouldBeDifferent = generator ();
126123 EXPECT_NE (inputChangeShouldBeDifferent, addInputShouldBeDifferent);
127124
128125 EXPECT_NE (hash1, addInputShouldBeDifferent);
129126 EXPECT_NE (inputChangeShouldBeDifferent, hash1);
130127}
131128
132- class ShowFieldPreformaceTest : public ModuleTest {};
133- TEST_F (ShowFieldPreformaceTest, TestFacePreformace)
129+ class ShowFieldPerformanceTest : public ModuleTest {};
130+
131+ TEST_F (ShowFieldPerformanceTest, TestFacePerformance)
134132{
135133 LogSettings::Instance ().setVerbose (false );
136134 UseRealModuleStateFactory f;
137- ModuleHandle showField = makeModule (" ShowField" );
135+ auto showField = makeModule (" ShowField" );
138136 showField->setStateDefaults ();
139137 auto state = showField->get_state ();
140138 state->setValue (ShowFaces, true );
141139 state->setValue (ShowEdges, false );
142140 state->setValue (ShowNodes, false );
143141 state->setValue (FacesColoring, 1 );
144142
145- ColorMapHandle colorMap = StandardColorMapFactory::create ();
143+ const auto colorMap = StandardColorMapFactory::create ();
146144 stubPortNWithThisData (showField, 1 , colorMap);
147145
148- std::vector<FieldHandle> vectorOfInputData =
146+ std::vector<std::pair< FieldHandle, std::string> > vectorOfInputData =
149147 {
150- CreateEmptyLatVol (64 , 64 , 64 )
148+ { CreateEmptyLatVol (64 , 64 , 64 ), " 64x64x64 LatVol " }
151149 };
152150
153- std::vector<std::string> vectorOfInputDataNames =
154- {
155- " 64x64x64 LatVol"
156- };
157-
158- const static int NUM_RUNS = 16 ;
151+ const static int NUM_RUNS = 2 ;
159152
160- for ( int i = 0 ; i < vectorOfInputData. size (); ++i )
153+ for ( const auto & fs : vectorOfInputData)
161154 {
162-
163155 auto start = std::chrono::steady_clock::now ();
164- stubPortNWithThisData (showField, 0 , vectorOfInputData[i] );
165- for (int i = 0 ; i < NUM_RUNS; ++i )
156+ stubPortNWithThisData (showField, 0 , fs. first );
157+ for (int j = 0 ; j < NUM_RUNS; ++j )
166158 {
159+ std::cout << " Starting execute #" << j << std::endl;
167160 showField->execute ();
168- }
161+ }
169162 auto end = std::chrono::steady_clock::now ();
170163 auto diff = end - start;
171- std::cout << vectorOfInputDataNames[i] << " : " << std::chrono::duration<double , std::milli>(diff).count ()/NUM_RUNS << " ms\n " ;
164+ std::cout << fs. second << " : " << std::chrono::duration<double , std::milli>(diff).count ()/NUM_RUNS << " ms\n " ;
172165 }
173166 std::cout << " \n " ;
174167}
0 commit comments