Skip to content

Commit

Permalink
last detail
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCornejo committed Aug 3, 2023
1 parent 7ff7d84 commit ee99ca5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kratos/includes/table_accessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class KRATOS_API(KRATOS_CORE) TableAccessor : public Accessor
{}

/// Custom constructor
TableAccessor(VariableType* pInputVariable, const std::string& rInputVariableType = "node_historical")
: mpInputVariable(pInputVariable)
TableAccessor(VariableType& rInputVariable, const std::string& rInputVariableType = "node_historical")
: mpInputVariable(&rInputVariable)
{
// We initialize the variable type only once
if (rInputVariableType == "node_historical") {
Expand Down
6 changes: 3 additions & 3 deletions kratos/tests/cpp_tests/includes/test_property_accessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ KRATOS_TEST_CASE_IN_SUITE(TableAccessorSimpleProperties, KratosCoreFastSuite)
p_elem_prop->SetTable(TEMPERATURE, YOUNG_MODULUS, T_E_table);
KRATOS_CHECK_EQUAL(true, (*p_elem_prop).HasTable(TEMPERATURE, YOUNG_MODULUS));

TableAccessor E_table_accessor = TableAccessor(&TEMPERATURE, "node_historical");
TableAccessor E_table_accessor = TableAccessor(TEMPERATURE, "node_historical");
p_elem_prop->SetAccessor(YOUNG_MODULUS, E_table_accessor.Clone());
KRATOS_CHECK_EQUAL(true, (*p_elem_prop).HasAccessor(YOUNG_MODULUS));
KRATOS_CHECK_EQUAL(1.6e6, (*p_elem_prop).GetValue(YOUNG_MODULUS, *p_geom, N, r_model_part.GetProcessInfo()));
Expand All @@ -160,7 +160,7 @@ KRATOS_TEST_CASE_IN_SUITE(TableAccessorSimpleProperties, KratosCoreFastSuite)
T_NU_table.PushBack(50.0, 0.41);
T_NU_table.PushBack(200.0, 0.43);
p_elem_prop->SetTable(TEMPERATURE, POISSON_RATIO, T_NU_table);
TableAccessor nu_table_accessor = TableAccessor(&TEMPERATURE); // using the default nodal_historical
TableAccessor nu_table_accessor = TableAccessor(TEMPERATURE); // using the default nodal_historical
p_elem_prop->SetAccessor(POISSON_RATIO, nu_table_accessor.Clone());

KRATOS_CHECK_EQUAL(true, (*p_elem_prop).HasAccessor(POISSON_RATIO));
Expand All @@ -172,7 +172,7 @@ KRATOS_TEST_CASE_IN_SUITE(TableAccessorSimpleProperties, KratosCoreFastSuite)
KRATOS_TEST_CASE_IN_SUITE(TableTableAccessorSerialization, KratosCoreFastSuite)
{
StreamSerializer serializer;
TableAccessor table_accessor = TableAccessor(&TEMPERATURE, "node_historical");
TableAccessor table_accessor = TableAccessor(TEMPERATURE, "node_historical");

serializer.save("table_accessor_info", table_accessor);

Expand Down
2 changes: 1 addition & 1 deletion kratos/utilities/read_and_set_accessors_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void ReadAndSetAccessorsUtilities::ReadAndSetAccessors(

KRATOS_ERROR_IF(rProperty.HasAccessor(r_output_var)) << "You are trying to add an TableAccessor between " << input_var_name << " and " << output_var_name << " which already exists..." << std::endl;

rProperty.SetAccessor(r_output_var, (TableAccessor(p_input_var, input_var_type)).Clone());
rProperty.SetAccessor(r_output_var, (TableAccessor(*p_input_var, input_var_type)).Clone());
} else {
// No more accessors implemented currently
KRATOS_ERROR << "This Accessor type is not available, only TableAccessor is ready for now" << std::endl;
Expand Down

0 comments on commit ee99ca5

Please sign in to comment.