Skip to content

Commit 8bbb0d0

Browse files
authored
Remove NodeCount from demographics (#150)
1 parent d269b90 commit 8bbb0d0

9 files changed

+0
-76
lines changed

Eradication/NodeDemographics.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -440,18 +440,6 @@ void NodeDemographicsFactory::Initialize( const ::Configuration* config,
440440
}
441441
JsonObjectDemog metadata = json["Metadata"] ;
442442

443-
if( !metadata.Contains( "NodeCount" ) )
444-
{
445-
throw NodeDemographicsFormatErrorException( __FILE__, __LINE__, __FUNCTION__, demo_filename.c_str(), "Missing the 'Metadata.NodeCount' object." );
446-
}
447-
448-
int nodecount = metadata.GetInt("NodeCount");
449-
if( nodecount <= 0 )
450-
{
451-
std::stringstream msg ;
452-
msg << "'NodeCount' = " << nodecount << ". It must be positive." ;
453-
throw NodeDemographicsFormatErrorException( __FILE__, __LINE__, __FUNCTION__, demo_filename.c_str(), msg.str().c_str() );
454-
}
455443
SetIdReference( layer, demo_filename, metadata );
456444

457445
// ------------------------------------------------------------------
@@ -851,7 +839,6 @@ void NodeDemographicsFactory::WriteDefaultDemographicsFile( const std::string& r
851839
<< "Tool" << "Eradication.exe"
852840
<< "Author" << "DTK"
853841
<< "IdReference" << idreference.c_str()
854-
<< "NodeCount" << nodeIDs.size()
855842
<< '}'
856843
<< "Defaults" << layer_defaults[0]
857844
<< "Nodes"

componentTests/NodeDemographicsTest.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -300,18 +300,6 @@ SUITE(NodeDemographicsTest)
300300
"Failed to parse incoming text. Name of an object member must be a string" );
301301
}
302302

303-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestNoNodeCount)
304-
{
305-
TestHelper_FormatException( __LINE__, "demographics_TestNoNodeCount.json",
306-
"Format error encountered loading demographics file (testdata/NodeDemographicsTest/demographics_TestNoNodeCount.json). Missing the 'Metadata.NodeCount' object." );
307-
}
308-
309-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestZeroNodecount)
310-
{
311-
TestHelper_FormatException( __LINE__, "demographics_TestZeroNodeCount.json",
312-
"Format error encountered loading demographics file (testdata/NodeDemographicsTest/demographics_TestZeroNodeCount.json). 'NodeCount' = 0. It must be positive." );
313-
}
314-
315303
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestMissingIdReference)
316304
{
317305
TestHelper_FormatException( __LINE__, "demographics_TestMissingIdReference.json",
@@ -353,32 +341,6 @@ SUITE(NodeDemographicsTest)
353341
TestHelper_FormatException( __LINE__, "demographics_TestStringTableBadFormat.json",
354342
"Failed to parse incoming text. Expect a value here. at character=991 / line number=0" );
355343
}
356-
357-
#ifdef USE_NODEOFFSET
358-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestBadIdInNodeOffset)
359-
{
360-
TestHelper_MissingAttributes_FormatException( __LINE__, "demographics_TestBadIdInNodeOffset.json",
361-
"Format error encountered loading demographics file (UNKNOWN). NodeID for lookup (2457) does not equal the NodeID (1) found in the data. Is NodeOffset messed up?");
362-
}
363-
364-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestBadOffsetInNodeOffset)
365-
{
366-
TestHelper_MissingAttributes_FormatException( __LINE__, "demographics_TestBadOffsetInNodeOffset.json",
367-
"Format error encountered loading demographics file (testdata/NodeDemographicsTest/demographics_TestBadOffsetInNodeOffset.json). NodeID for lookup (1) does not have data at offset 4095. Is NodeOffset messed up?");
368-
}
369-
370-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestBadNodeOffsetNot16)
371-
{
372-
TestHelper_FormatException( __LINE__, "demographics_TestBadNodeOffsetNot16.json",
373-
"Format error encountered loading demographics file (testdata/NodeDemographicsTest/demographics_TestBadNodeOffsetNot16.json). Length of 'NodeOffsets' isn't consistent with 'NodeCount' attribute." );
374-
}
375-
376-
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestBadNodeOffsetNc2) //offset is for two nodes while nodecount=1
377-
{
378-
TestHelper_FormatException( __LINE__, "demographics_TestBadNodeOffsetNc2.json",
379-
"Format error encountered loading demographics file (testdata/NodeDemographicsTest/demographics_TestBadNodeOffsetNc2.json). Length of 'NodeOffsets' isn't consistent with 'NodeCount' attribute." );
380-
}
381-
#endif
382344

383345
TEST_FIXTURE(NodeDemographicsFactoryFixture, TestMisingNodeAttributes)
384346
{
@@ -1622,9 +1584,6 @@ SUITE(NodeDemographicsTest)
16221584
JsonObjectDemog default_demog_json ;
16231585
default_demog_json.ParseFile( default_fn.c_str() );
16241586

1625-
int num_nodes = default_demog_json["Metadata"]["NodeCount"].AsInt();
1626-
CHECK_EQUAL( 100, num_nodes );
1627-
16281587
for( int i = 0 ; i < nodeIDs.size() ; i++ )
16291588
{
16301589
uint32_t data_node_id = nodeIDs[i] ;

componentTests/testdata/NodeDemographicsTest/demographics_TestBadIdInNodeOffset.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

componentTests/testdata/NodeDemographicsTest/demographics_TestBadNodeOffsetNc2.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

componentTests/testdata/NodeDemographicsTest/demographics_TestBadNodeOffsetNot16.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

componentTests/testdata/NodeDemographicsTest/demographics_TestBadOffsetInNodeOffset.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

componentTests/testdata/NodeDemographicsTest/demographics_TestNoNodeCount.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

componentTests/testdata/NodeDemographicsTest/demographics_TestZeroNodeCount.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

utils/demographic_params.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#define Author_DESC_TEXT "The person who created the demographics file. EMOD does not use this value."
55
#define DateCreated_DESC_TEXT "The date the demographics file was created. EMOD does not use this value."
66
#define IdReference_DESC_TEXT "The identifier for a simulation; all input files (except configuration and campaign files) used in a simulation must have the same IdReference value."
7-
#define NodeCount_DESC_TEXT "The number of nodes to expect in the input files."
87
#define Tool_DESC_TEXT "The software tool used to create the demographics file. EMOD does not use this value."
98
#define Resolution_DESC_TEXT "The spatial resolution of the demographics file."
109

0 commit comments

Comments
 (0)