diff --git a/unittests/gsMaterialMatrixTFT_test.cpp b/unittests/gsMaterialMatrixTFT_test.cpp index 1917430..7ef6397 100644 --- a/unittests/gsMaterialMatrixTFT_test.cpp +++ b/unittests/gsMaterialMatrixTFT_test.cpp @@ -45,7 +45,7 @@ class STFTfun : public gsFunction gsMatrix C = m_mm->eval3D_matrix_C(Cmat,m_patch,m_u.col(0),m_z(0,0),MaterialOutput::Generic); gsMatrix S = m_mm->eval3D_vector_C(Cmat,m_patch,m_u.col(0),m_z(0,0),MaterialOutput::Generic); - + gsMatrix THETA = m_mmTFT->eval_theta(C,S,E); T n1 = math::cos(THETA(0,0)); @@ -71,7 +71,7 @@ class STFTfun : public gsFunction const index_t m_patch; const gsMatrix m_u; const gsMatrix m_z; -}; +}; template @@ -111,7 +111,7 @@ class Sfun : public gsFunction const index_t m_patch; const gsMatrix m_u; const gsMatrix m_z; -}; +}; template class Cfun : public gsFunction @@ -153,7 +153,7 @@ class Cfun : public gsFunction const index_t m_patch; const gsMatrix m_u; const gsMatrix m_z; -}; +}; SUITE(gsMaterialMatrixTFT_test) // The suite should have the same name as the file { @@ -359,15 +359,15 @@ SUITE(gsMaterialMatrixTFT_test) // The suite should have the sam parameters[7] = &alpha3fun; } - gsMaterialMatrixBase * materialMatrix; - gsMaterialMatrixBase * materialMatrixTFT; + gsMaterialMatrixBase::uPtr materialMatrix; + gsMaterialMatrixBase::uPtr materialMatrixTFT; gsOptionList options; if (material==0) { options.addInt("Material","Material model: (0): SvK | (1): NH | (2): NH_ext | (3): MR | (4): Ogden",0); options.addInt("Implementation","Implementation: (0): Composites | (1): Analytical | (2): Generalized | (3): Spectral",1); materialMatrix = getMaterialMatrix<2,real_t>(mp,t,parameters,options); - materialMatrixTFT = new gsMaterialMatrixTFT<2,real_t,true>(materialMatrix); + materialMatrixTFT = memory::make_unique(new gsMaterialMatrixTFT<2,real_t,true>(*materialMatrix)); } else { @@ -375,7 +375,7 @@ SUITE(gsMaterialMatrixTFT_test) // The suite should have the sam options.addSwitch("Compressibility","Compressibility: (false): Imcompressible | (true): Compressible",Compressibility); options.addInt("Implementation","Implementation: (0): Composites | (1): Analytical | (2): Generalized | (3): Spectral",impl); materialMatrix = getMaterialMatrix<2,real_t>(mp,t,parameters,options); - materialMatrixTFT = new gsMaterialMatrixTFT<2,real_t,false>(materialMatrix); + materialMatrixTFT = memory::make_unique(new gsMaterialMatrixTFT<2,real_t,false>(*materialMatrix)); } gsVector<> testpt(2); @@ -436,14 +436,14 @@ SUITE(gsMaterialMatrixTFT_test) // The suite should have the sam CHECK_MATRIX_CLOSE(e,strain_MM,1e-3); /// MATRIX - Sfun Sfun(gori,materialMatrix,0,pt,z); + Sfun Sfun(gori,materialMatrix.get(),0,pt,z); Sfun.deriv_into(e,resss); gsMatrix<> C_FD = resss.reshape(3,3); // Finite Differences gsMatrix<> C_MM = materialMatrix->eval3D_matrix(0,pt,z,MaterialOutput::Generic).reshape(3,3); // implemented CHECK_MATRIX_CLOSE(C_FD,C_MM,1e-3); /// dMATRIX - Cfun Cfun(gori,materialMatrix,0,pt,z); + Cfun Cfun(gori,materialMatrix.get(),0,pt,z); Cfun.deriv_into(e,resss); gsMatrix<> dC_FD = resss.reshape(9,3); gsMatrix<> dC_MM = materialMatrix->eval3D_dmatrix(0,pt,z,MaterialOutput::Generic).reshape(9,3); @@ -451,7 +451,7 @@ SUITE(gsMaterialMatrixTFT_test) // The suite should have the sam CHECK_MATRIX_CLOSE(dC_FD,dC_MM,1e-3); /// STRESS TFT - STFTfun STFT(gori,materialMatrix,0,pt,z); + STFTfun STFT(gori,materialMatrix.get(),0,pt,z); STFT.eval_into(e,resss); gsMatrix<> STFT_test = resss; gsMatrix<> STFT_MM = vecTFT.piece(0).eval(pt).reshape(3,1); @@ -462,9 +462,6 @@ SUITE(gsMaterialMatrixTFT_test) // The suite should have the sam gsMatrix<> CTFT_FD = resss.reshape(3,3); gsMatrix<> CTFT_MM = matTFT.piece(0).eval(pt).reshape(3,3); CHECK_MATRIX_CLOSE(CTFT_FD,CTFT_MM,1e-3); - - delete materialMatrix; - delete materialMatrixTFT; } diff --git a/unittests/gsThinShellAssembler_test.cpp b/unittests/gsThinShellAssembler_test.cpp index dd827eb..913f4ca 100644 --- a/unittests/gsThinShellAssembler_test.cpp +++ b/unittests/gsThinShellAssembler_test.cpp @@ -2,7 +2,7 @@ @brief Provides unittests for the gsThinShellAssembler class - * Balloon: unit-test based on a hyperelastic balloon inflated by a follower pressure. + * Balloon: unit-test based on a hyperelastic balloon inflated by a follower pressure. This test allows to test the follower pressure as well as the hyperelastic material models (incompressible) * UAT: unit-test based on a uni-axial tension test @@ -288,7 +288,7 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa parameters[0] = &E; parameters[1] = ν parameters[2] = ∶ - gsMaterialMatrixBase* materialMatrix; + gsMaterialMatrixBase::uPtr materialMatrix; if (material==4) { @@ -396,7 +396,6 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa result.first = P; result.second = r; - delete materialMatrix; delete assembler; return result; @@ -404,6 +403,8 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa real_t balloon_analytical(const index_t material, const index_t impl, const real_t r) { + GISMO_UNUSED(impl); + real_t Pan; real_t R = 10.; @@ -550,7 +551,7 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa parameters[0] = &E; parameters[1] = ν parameters[2] = ∶ - gsMaterialMatrixBase* materialMatrix; + gsMaterialMatrixBase::uPtr materialMatrix; if (material==4) { @@ -661,7 +662,6 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa result.first = L; result.second = S; - delete materialMatrix; delete assembler; return result; @@ -669,6 +669,8 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa std::pair UAT_analytical(const index_t material, const index_t impl, const bool Compressibility) { + GISMO_UNUSED(impl); + real_t PoissonRatio; real_t Ratio = 7.0; @@ -846,13 +848,13 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa Ts[0] = Ts[1] = Ts[2] = Ts[3] = Ts[4] = &thicks; std::vector*> parameters; - gsMaterialMatrixBase* materialMatrix; + gsMaterialMatrixBase::uPtr materialMatrix; gsOptionList options; if (composite) { - materialMatrix = new gsMaterialMatrixComposite<3,real_t>(mp,Ts,Gs,Phis,Rs); + materialMatrix = memory::make_unique(new gsMaterialMatrixComposite<3,real_t>(mp,Ts,Gs,Phis,Rs)); } else { @@ -884,7 +886,6 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa values = values.cwiseSqrt(); values = values.col(0).head(10); - delete materialMatrix; delete assembler; return values; @@ -914,7 +915,7 @@ SUITE(gsThinShellAssembler_test) // The suite should have the sa void Modal_CHECK(const bool composite) { gsVector num = Modal_numerical(composite); - + gsVector ana = Modal_analytical(); gsVector relError = (num - ana).array()/ana.array();