diff --git a/kratos/sources/table_accessor.cpp b/kratos/sources/table_accessor.cpp index 2234e96f2f51..19c3c863bc62 100644 --- a/kratos/sources/table_accessor.cpp +++ b/kratos/sources/table_accessor.cpp @@ -79,15 +79,20 @@ double TableAccessor::GetValueFromTable( void TableAccessor::save(Serializer& rSerializer) const { - rSerializer.save("InputVariable", mpInputVariable->Key()); + rSerializer.save("InputVariable", mpInputVariable->Name()); // // we must do the int cast to be able to compile rSerializer.save("InputVariableType", static_cast(mInputVariableType)); } void TableAccessor::load(Serializer& rSerializer) { - rSerializer.load("InputVariable", mpInputVariable->Key()); + std::string variable_name; + rSerializer.load("InputVariable", variable_name); + mpInputVariable = static_cast *>(KratosComponents::pGet(variable_name)); + // // we must do the int cast to be able to compile - rSerializer.load("InputVariableType", static_cast(mInputVariableType)); + int enum_value; + rSerializer.load("InputVariableType", enum_value); + mInputVariableType = static_cast(enum_value); } /***********************************************************************************/ diff --git a/kratos/tests/cpp_tests/includes/test_property_accessor.cpp b/kratos/tests/cpp_tests/includes/test_property_accessor.cpp index b69bf679ca54..44272f3952a4 100644 --- a/kratos/tests/cpp_tests/includes/test_property_accessor.cpp +++ b/kratos/tests/cpp_tests/includes/test_property_accessor.cpp @@ -183,10 +183,7 @@ KRATOS_TEST_CASE_IN_SUITE(TableTableAccessorSerialization, KratosCoreFastSuite) auto& d = table_accessor_loaded.GetInputVariable(); - KRATOS_WATCH(d.Key()) - KRATOS_WATCH(TEMPERATURE.Key()) - - // KRATOS_CHECK_EQUAL(TEMPERATURE.Key(), table_accessor_loaded.GetInputVariable().Key()); + KRATOS_CHECK_EQUAL(TEMPERATURE.Key(), table_accessor_loaded.GetInputVariable().Key()); } } // namespace Kratos::Testing.