From e0afa1ce5557ac63c62dea12626326778ee0f93f Mon Sep 17 00:00:00 2001 From: Theodore Chang Date: Sun, 27 Oct 2024 04:30:32 +0100 Subject: [PATCH] Default to unit time --- Material/Material1D/Viscosity/Nonviscous01.cpp | 2 +- Material/Material1D/Viscosity/Nonviscous01.h | 2 ++ Material/Material1D/vonMises/VAFCRP1D.cpp | 2 -- Material/Material1D/vonMises/VAFCRP1D.h | 2 +- Material/Material3D/vonMises/VAFCRP.cpp | 2 +- Material/Material3D/vonMises/VAFCRP.h | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Material/Material1D/Viscosity/Nonviscous01.cpp b/Material/Material1D/Viscosity/Nonviscous01.cpp index d76a39abe..a15f59ae4 100644 --- a/Material/Material1D/Viscosity/Nonviscous01.cpp +++ b/Material/Material1D/Viscosity/Nonviscous01.cpp @@ -26,7 +26,7 @@ Nonviscous01::Nonviscous01(const unsigned T, cx_vec&& M, cx_vec&& S) , Material1D(T, 0.) {} int Nonviscous01::initialize(const shared_ptr& D) { - if(nullptr != D) incre_time = &D->get_factory()->modify_incre_time(); + incre_time = nullptr == D ? &unit_time : &D->get_factory()->modify_incre_time(); complex_damping.zeros(m.n_elem); s_para.zeros(m.n_elem); diff --git a/Material/Material1D/Viscosity/Nonviscous01.h b/Material/Material1D/Viscosity/Nonviscous01.h index c4c1a12e0..e69ca04cf 100644 --- a/Material/Material1D/Viscosity/Nonviscous01.h +++ b/Material/Material1D/Viscosity/Nonviscous01.h @@ -38,6 +38,8 @@ struct DataNonviscous01 { }; class Nonviscous01 final : protected DataNonviscous01, public Material1D { + static constexpr double unit_time = 1.; + const double* incre_time = nullptr; cx_vec complex_damping; diff --git a/Material/Material1D/vonMises/VAFCRP1D.cpp b/Material/Material1D/vonMises/VAFCRP1D.cpp index dca600d85..2034c4d0c 100644 --- a/Material/Material1D/vonMises/VAFCRP1D.cpp +++ b/Material/Material1D/vonMises/VAFCRP1D.cpp @@ -19,8 +19,6 @@ #include #include -constexpr double VAFCRP1D::unit_time = 1.; - VAFCRP1D::VAFCRP1D(const unsigned T, DataVAFCRP1D&& D, const double R) : DataVAFCRP1D(std::move(D)) , Material1D(T, R) { access::rw(tolerance) = 1E-15; } diff --git a/Material/Material1D/vonMises/VAFCRP1D.h b/Material/Material1D/vonMises/VAFCRP1D.h index ab8146528..ffe972e01 100644 --- a/Material/Material1D/vonMises/VAFCRP1D.h +++ b/Material/Material1D/vonMises/VAFCRP1D.h @@ -50,7 +50,7 @@ struct DataVAFCRP1D { class VAFCRP1D final : protected DataVAFCRP1D, public Material1D { static constexpr unsigned max_iteration = 20u; - static const double unit_time; + static constexpr double unit_time = 1.; const double* incre_time = nullptr; diff --git a/Material/Material3D/vonMises/VAFCRP.cpp b/Material/Material3D/vonMises/VAFCRP.cpp index 635924c81..0987cbf27 100644 --- a/Material/Material3D/vonMises/VAFCRP.cpp +++ b/Material/Material3D/vonMises/VAFCRP.cpp @@ -28,7 +28,7 @@ VAFCRP::VAFCRP(const unsigned T, DataVAFCRP&& D, const double R) , Material3D(T, R) {} int VAFCRP::initialize(const shared_ptr& D) { - incre_time = &D->get_factory()->modify_incre_time(); + incre_time = nullptr == D ? &unit_time : &D->get_factory()->modify_incre_time(); trial_stiffness = current_stiffness = initial_stiffness = tensor::isotropic_stiffness(elastic_modulus, poissons_ratio); diff --git a/Material/Material3D/vonMises/VAFCRP.h b/Material/Material3D/vonMises/VAFCRP.h index c59dcf4e4..74ded1c61 100644 --- a/Material/Material3D/vonMises/VAFCRP.h +++ b/Material/Material3D/vonMises/VAFCRP.h @@ -54,6 +54,7 @@ struct DataVAFCRP { class VAFCRP final : protected DataVAFCRP, public Material3D { static constexpr unsigned max_iteration = 20u; + static constexpr double unit_time = 1.; static const double root_three_two; static const mat unit_dev_tensor;