From acabe3d4e1b41ffd4e143de2baa67939d985b9ce Mon Sep 17 00:00:00 2001 From: Nathan Miller Date: Wed, 31 Jul 2024 14:36:09 -0600 Subject: [PATCH 1/2] MAINT: Remove additional terms which copied variables --- src/cpp/tardigrade_hydraLinearElasticity.cpp | 34 +++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/cpp/tardigrade_hydraLinearElasticity.cpp b/src/cpp/tardigrade_hydraLinearElasticity.cpp index d3b41c2..71988d4 100644 --- a/src/cpp/tardigrade_hydraLinearElasticity.cpp +++ b/src/cpp/tardigrade_hydraLinearElasticity.cpp @@ -567,7 +567,9 @@ namespace tardigradeHydra{ setCauchyStress( false ); - setStress( *get_cauchyStress( ) ); + auto stress = get_setDataStorage_stress( ); + + *stress.value = *get_cauchyStress( ); } @@ -580,7 +582,9 @@ namespace tardigradeHydra{ setCauchyStress( true ); - setPreviousStress( *get_previousCauchyStress( ) ); + auto previousStress = get_setDataStorage_previousStress( ); + + *previousStress.value = *get_previousCauchyStress( ); } @@ -663,10 +667,12 @@ namespace tardigradeHydra{ /*! * Set the residual value */ - - const secondOrderTensor *cauchyStress = getStress( ); - TARDIGRADE_ERROR_TOOLS_CATCH( setResidual( *cauchyStress - *hydra->getStress( ) ) ); + auto residual = get_setDataStorage_residual( ); + + const secondOrderTensor *stress = getStress( ); + + TARDIGRADE_ERROR_TOOLS_CATCH( *residual.value = *stress - *hydra->getStress( ) ); } @@ -686,17 +692,19 @@ namespace tardigradeHydra{ const unsigned int num_unknowns = hydra->getNumUnknowns( ); // Form the Jacobian - floatVector jacobian = floatVector( sot_dim * num_unknowns, 0 ); + auto jacobian = get_setDataStorage_jacobian( ); + + jacobian.zero( sot_dim * num_unknowns ); for ( unsigned int i = 0; i < dim; i++ ){ for ( unsigned int j = 0; j < dim; j++ ){ - jacobian[ num_unknowns * dim * i + num_unknowns * j + dim * i + j ] = -1; + ( *jacobian.value )[ num_unknowns * dim * i + num_unknowns * j + dim * i + j ] = -1; for ( unsigned int I = 0; I < num_unknown_config_vars; I++ ){ - jacobian[ num_unknowns * dim * i + num_unknowns * j + getStress( )->size( ) + I ] = ( *get_dCauchyStressdFn( ) )[ dim * num_unknown_config_vars * i + num_unknown_config_vars * j + I ]; + ( *jacobian.value )[ num_unknowns * dim * i + num_unknowns * j + getStress( )->size( ) + I ] = ( *get_dCauchyStressdFn( ) )[ dim * num_unknown_config_vars * i + num_unknown_config_vars * j + I ]; } @@ -704,8 +712,6 @@ namespace tardigradeHydra{ } - setJacobian( jacobian ); - } void residual::setdRdT( ){ @@ -713,7 +719,9 @@ namespace tardigradeHydra{ * Set the derivative of the residual w.r.t. the temperature */ - setdRdT( floatVector( *getNumEquations( ), 0 ) ); + auto dRdT = get_setDataStorage_dRdT( ); + + dRdT.zero( *getNumEquations( ) ); } @@ -722,7 +730,9 @@ namespace tardigradeHydra{ * Set the derivative of the residual w.r.t. the deformation gradient */ - setdRdF( *get_dCauchyStressdF( ) ); + auto dRdF = get_setDataStorage_dRdF( ); + + *dRdF.value = *get_dCauchyStressdF( ); } From 46c8e86a56788a5d1053a4e4b5cc7498a17187dc Mon Sep 17 00:00:00 2001 From: Nathan Miller Date: Wed, 31 Jul 2024 14:36:54 -0600 Subject: [PATCH 2/2] MAINT: Updated changelog --- docs/sphinx/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sphinx/changelog.rst b/docs/sphinx/changelog.rst index e769161..d580041 100644 --- a/docs/sphinx/changelog.rst +++ b/docs/sphinx/changelog.rst @@ -20,6 +20,7 @@ Internal Changes - Removed set_varname and replaced with setDataStorage for linear elasticity (:pull:`145`). By `Nathan Miller`_. - Removed set_varname and replaced with setDataStorage for the classical base classes (:pull:`146`). By `Nathan Miller`_. - Removed malloc causing operations in tardigrade_hydra and tardigrade_hydraLinearElasticity (:pull:`147`). By `Nathan Miller`_. +- Removed additional set_varname like functions in linear elasticity (:pull:`148`). By `Nathan Miller`_. ****************** 0.4.4 (07-12-2024)