Skip to content

Commit

Permalink
Serialization_Mask_Disable (#63)
Browse files Browse the repository at this point in the history
turning off serialization masking - currently does not work
  • Loading branch information
stitova-idm authored Dec 12, 2024
1 parent 4d7f041 commit 066bcfd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Eradication/LarvalHabitatMultiplier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ namespace Kernel

float LarvalHabitatMultiplier::GetMultiplier( VectorHabitatType::Enum vht, const std::string& species ) const
{
release_assert( m_Multiplier.count( vht ) > 0 );
release_assert( m_Multiplier.at( vht ).count( species ) > 0 );
return m_Multiplier.at( vht ).at( species );
}

Expand Down
23 changes: 17 additions & 6 deletions Eradication/SerializationParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,26 @@ std::deque<int32_t> SerializationParameters::ProcessConfig( std::vector<int32_t>

void SerializationParameters::CheckSupportedFlags( SerializationBitMask_t serialization_mask, std::string& parameter ) const
{
// Commenting it out for now so can be used later when we re-implement the bitmasking
// https://github.com/EMOD-Hub/EMOD/issues/65
//
// If a bit is set in serialization_mask and not in m_supportedFlags then this flag is not supported
const SerializationBitMask_t unsupported_flags = serialization_mask & ~m_supportedFlags;

if( unsupported_flags != 0 )
//const SerializationBitMask_t unsupported_flags = serialization_mask & ~m_supportedFlags;

//if( unsupported_flags != 0 )
//{
// std::stringstream ss;
// ss << "The flag " << unsupported_flags << " set with parameter '" << parameter << "' with value " << ( uint32_t )serialization_mask.to_ulong()
// << "( " << serialization_mask << " ) is not supported. Currently only flags "
// << m_supportedFlags << " ( " << m_supportedFlags.to_ulong() << " ) are supported.";
// throw InvalidInputDataException( __FILE__, __LINE__, __FUNCTION__, ss.str().c_str() );
//}

if( serialization_mask != 0 )
{
std::stringstream ss;
ss << "The flag " << unsupported_flags << " set with parameter '" << parameter << "' with value " << ( uint32_t )serialization_mask.to_ulong()
<< "( " << serialization_mask << " ) is not supported. Currently only flags "
<< m_supportedFlags << " ( " << m_supportedFlags.to_ulong() << " ) are supported.";
ss << "Currently, no flags are supported for 'Serialization_Mask_Node_Read' or 'Serialization_Mask_Node_Write' parameters."
<< " Please leave these parameters set to 0.";
throw InvalidInputDataException( __FILE__, __LINE__, __FUNCTION__, ss.str().c_str() );
}
}
Expand Down
4 changes: 2 additions & 2 deletions componentTests/SerializationParametersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ SUITE(SerializationParametersTest)
TEST_FIXTURE( SerializationParametersFixture, TestErrorUnsupportedWriteMask )
{
TestHelper_ConfigureException( __LINE__, "testdata/SerializationParametersTest/TestErrorUnsupportedWriteMask.json",
"InvalidInputDataException", "'Serialization_Mask_Node_Write' with value" );
"InvalidInputDataException", "Currently, no flags are supported for 'Serialization_Mask_Node_Read' or 'Serialization_Mask_Node_Write' parameters. Please leave these parameters set to 0." );
}

TEST_FIXTURE( SerializationParametersFixture, TestErrorMsgMPINumTasks )
Expand All @@ -304,6 +304,6 @@ SUITE(SerializationParametersTest)
TEST_FIXTURE( SerializationParametersFixture, TestErrorUnsupportedReadMask )
{
TestHelper_ConfigureException( __LINE__, "testdata/SerializationParametersTest/TestErrorUnsupportedReadMask.json",
"InvalidInputDataException", "'Serialization_Mask_Node_Read' with value" );
"InvalidInputDataException", "Currently, no flags are supported for 'Serialization_Mask_Node_Read' or 'Serialization_Mask_Node_Write' parameters. Please leave these parameters set to 0." );
}
}
4 changes: 2 additions & 2 deletions utils/config_params.rc
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@
#define Vector_Species_Params_DESC_TEXT "A list of JSON object where each object contains the parameters for a specific species of vectors."

// mask reading/writing from/to serialized population file
#define SerializationMask_Node_Read_DESC_TEXT "A control that determines what data is read from the serialized file. If the control is set, the configuration file is used. For example, a value of 0 implies that the Larval Habitat data is read from the serialized file while a value of 16 implies that the habitats are configured using the data from the configuration file (i.e. config.json)."
#define SerializationMask_Node_Write_DESC_TEXT "A control that determines what data is written to the serialized file letting the user reduce the file size. If the mask is set, the data of the masked module is not written to the file. For example, a value of 0 implies that the Larval Habitat data is written to the serialized file while a value of 16 implies that the habitats are not saved."
#define SerializationMask_Node_Read_DESC_TEXT "Currently not implemented. Please leave at 0."
#define SerializationMask_Node_Write_DESC_TEXT "Currently not implemented. Please leave at 0."
#define Serialized_Population_Reading_Type_DESC_TEXT "Set to READ to enable reading from a serialized population file, set to NONE otherwise."
#define Serialized_Population_Writing_Type_DESC_TEXT "The type of serialization to perform. NONE for no serialization, TIME to use definition from Serialization_Times, and TIMESTEP to use definition from Serialization_Time_Steps."

Expand Down

0 comments on commit 066bcfd

Please sign in to comment.