Commit e6ff619f authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#820 SolidDeltaResidual: remove unused local matrices.

parent f2e37e66
......@@ -70,10 +70,12 @@ namespace HappyHeart
typename parent::local_variational_operator_type& local_operator,
std::tuple<const GlobalVector&>&& additional_arguments) const
{
auto& midpoint_pos = local_operator.GetNonCstMidpointPosition();
::HappyHeart::GlobalVariationalOperatorNS::ExtractLocalDofValues(local_felt_space,
this->GetNthUnknown(),
std::get<0>(additional_arguments),
local_operator.GetNonCstMidpointPosition()); // \todo #820 Assumes time scheme is midpoint...
midpoint_pos); // \todo #820 Assumes time scheme is midpoint...
}
......
......@@ -62,7 +62,7 @@ namespace HappyHeart
template<class HyperelasticLawT>
class SolidDeltaResidual final
: public LinearLocalVariationalOperator<LocalVector>,
public ::HappyHeart::Crtp::LocalMatrixStorage<SolidDeltaResidual<HyperelasticLawT>, 9ul>,
public ::HappyHeart::Crtp::LocalMatrixStorage<SolidDeltaResidual<HyperelasticLawT>, 2ul>,
public ::HappyHeart::Crtp::LocalVectorStorage<SolidDeltaResidual<HyperelasticLawT>, 2ul>
{
......@@ -87,7 +87,7 @@ namespace HappyHeart
using parent = LinearLocalVariationalOperator<LocalVector>;
//! Alias to the parent that provides LocalMatrixStorage.
using matrix_parent = ::HappyHeart::Crtp::LocalMatrixStorage<self, 9ul>;
using matrix_parent = ::HappyHeart::Crtp::LocalMatrixStorage<self, 2ul>;
//! Alias to the parent that provides LocalVectorStorage.
using vector_parent = ::HappyHeart::Crtp::LocalVectorStorage<self, 2ul>;
......@@ -130,7 +130,7 @@ namespace HappyHeart
const HyperelasticLawT& hyperelastic_law);
//! Destructor.
virtual ~SolidDeltaResidual();
virtual ~SolidDeltaResidual() = default;
//! Copy constructor.
SolidDeltaResidual(const SolidDeltaResidual&) = delete;
......@@ -185,7 +185,7 @@ namespace HappyHeart
*/
void PrepareInternalDataForQuadraturePoint(const InformationsAtQuadraturePoint& infos_at_quad_pt,
const GeometricElt& geom_elt,
const std::vector<double>& local_displacement,
const std::vector<double>& local_midpoint_position,
const unsigned int mesh_dimension);
//! Helper class to manage computation of Cauchy-Green tensor.
......@@ -201,7 +201,7 @@ namespace HappyHeart
template<unsigned int DimensionT>
void PrepareInternalDataForQuadraturePointForDimension(const InformationsAtQuadraturePoint& infos_at_quad_pt,
const GeometricElt& geom_elt,
const std::vector<double>& local_displacement);
const std::vector<double>& local_midpoint_position);
private:
......@@ -212,11 +212,11 @@ namespace HappyHeart
CauchyGreenTensor::unique_ptr cauchy_green_tensor_ = nullptr;
/*!
* \brief Displacement obtained at previous time iteration expressed at the local level.
* \brief Local midpoint position.
*
* \internal <b><tt>[internal]</tt></b> This is a work variable that should be used only within ComputeEltArray.
*/
std::vector<double> former_local_displacement_;
std::vector<double> local_midpoint_position_;
/// \name Useful indexes to fetch the work matrices and vectors.
......@@ -224,22 +224,25 @@ namespace HappyHeart
enum class LocalMatrixIndex : std::size_t
{
tangent_matrix = 0,
linear_part,
dPhi_mult_gradient_based_block,
block_contribution,
transposed_dphi,
linear_part_intermediate_matrix,
gradient_based_block,
gradient_displacement
transposed_dphi = 0,
gradient_displacement,
Nmatrix
};
static_assert(EnumUnderlyingType(LocalMatrixIndex::Nmatrix) == matrix_parent::N(),
"Useful test to make sure list is really up-to-date!");
enum class LocalVectorIndex : std::size_t
{
dW = 0,
rhs_part
rhs_part,
Nvector
};
static_assert(EnumUnderlyingType(LocalVectorIndex::Nvector) == vector_parent::N(),
"Useful test to make sure list is really up-to-date!");
///@}
......
......@@ -31,12 +31,7 @@ namespace HappyHeart
return name;
}
template <class HyperelasticLawT>
SolidDeltaResidual<HyperelasticLawT>
::~SolidDeltaResidual() = default;
template <class HyperelasticLawT>
SolidDeltaResidual<HyperelasticLawT>
::SolidDeltaResidual(const ExtendedUnknown::vector_const_shared_ptr& unknown_list,
......@@ -81,14 +76,7 @@ namespace HappyHeart
this->matrix_parent::InitLocalMatrixStorage
({{
{ square_Ncomponent, square_Ncomponent }, // tangent_matrix
{ square_Ncomponent, square_Ncomponent }, // linear_part
{ Nnode, Ncomponent }, // dPhi_mult_gradient_based_block
{ Nnode, Nnode }, // block_contribution
{ felt_space_dimension, Nnode }, // transposed dPhi
{ dIndC_size, dIndC_size }, // d2W,
{ square_mesh_dimension, dIndC_size }, // linear_part_intermediate_matrix
{ mesh_dimension, mesh_dimension }, // gradient-based block
{ mesh_dimension, mesh_dimension } // gradient displacement
}});
......@@ -99,7 +87,7 @@ namespace HappyHeart
square_mesh_dimension // rhs_part
}});
former_local_displacement_.resize(elementary_data.Ndof());
local_midpoint_position_.resize(elementary_data.Ndof());
switch(mesh_dimension)
{
......@@ -137,9 +125,8 @@ namespace HappyHeart
{
auto& elementary_data = parent::GetNonCstElementaryData();
const auto& local_displacement = GetMidpointPosition();
const auto& local_midpoint_position = GetMidpointPosition();
auto& tangent_matrix = this->matrix_parent::template GetLocalMatrix<EnumUnderlyingType(LocalMatrixIndex::tangent_matrix)>();
const auto& rhs_part = this->vector_parent::template GetLocalVector<EnumUnderlyingType(LocalVectorIndex::rhs_part)>();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
......@@ -149,11 +136,9 @@ namespace HappyHeart
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
tangent_matrix.Zero();
PrepareInternalDataForQuadraturePoint(infos_at_quad_pt,
geom_elt,
local_displacement,
local_midpoint_position,
mesh_dimension);
ComputeAtQuadraturePoint(infos_at_quad_pt,
......@@ -246,7 +231,7 @@ namespace HappyHeart
void SolidDeltaResidual<HyperelasticLawT>
::PrepareInternalDataForQuadraturePoint(const InformationsAtQuadraturePoint& infos_at_quad_pt,
const GeometricElt& geom_elt,
const std::vector<double>& local_displacement,
const std::vector<double>& local_midpoint_position,
const unsigned int mesh_dimension)
{
switch(mesh_dimension)
......@@ -255,14 +240,14 @@ namespace HappyHeart
{
this->PrepareInternalDataForQuadraturePointForDimension<2>(infos_at_quad_pt,
geom_elt,
local_displacement);
local_midpoint_position);
break;
}
case 3:
{
this->PrepareInternalDataForQuadraturePointForDimension<3>(infos_at_quad_pt,
geom_elt,
local_displacement);
local_midpoint_position);
break;
}
default:
......@@ -276,7 +261,7 @@ namespace HappyHeart
SolidDeltaResidual<HyperelasticLawT>
::GetMidpointPosition() const noexcept
{
return former_local_displacement_;
return local_midpoint_position_;
}
......@@ -313,7 +298,7 @@ namespace HappyHeart
void SolidDeltaResidual<HyperelasticLawT>
::PrepareInternalDataForQuadraturePointForDimension(const InformationsAtQuadraturePoint& infos_at_quad_pt,
const GeometricElt& geom_elt,
const std::vector<double>& local_displacement)
const std::vector<double>& local_midpoint_position)
{
auto& transposed_dphi = this->matrix_parent::template GetLocalMatrix<EnumUnderlyingType(LocalMatrixIndex::transposed_dphi)>();
Wrappers::Seldon::Transpose(infos_at_quad_pt.GetGradientFEltPhi(), transposed_dphi);
......@@ -321,7 +306,7 @@ namespace HappyHeart
auto& gradient_displacement = this->matrix_parent::template GetLocalMatrix<EnumUnderlyingType(LocalMatrixIndex::gradient_displacement)>();
Advanced::OperatorNS::ComputeGradientDisplacementMatrix(infos_at_quad_pt,
local_displacement,
local_midpoint_position,
gradient_displacement);
// ========================================================================================================
......
......@@ -45,6 +45,10 @@ namespace HappyHeart
template<class DerivedT, std::size_t NlocalMatricesT>
class LocalMatrixStorage
{
public:
//! Return the number of local matrices.
static constexpr std::size_t N();
public:
......
......@@ -20,6 +20,13 @@ namespace HappyHeart
{
template<class DerivedT, std::size_t NlocalMatricesT>
constexpr std::size_t LocalMatrixStorage<DerivedT, NlocalMatricesT>::N()
{
return NlocalMatricesT;
}
template<class DerivedT, std::size_t NlocalMatricesT>
void LocalMatrixStorage<DerivedT, NlocalMatricesT>
::InitLocalMatrixStorage(const std::array<std::pair<unsigned int, unsigned int>, NlocalMatricesT>& matrices_dimension)
......
......@@ -47,6 +47,12 @@ namespace HappyHeart
class LocalVectorStorage
{
public:
//! Return the number of local matrices.
static constexpr std::size_t N();
public:
/// \name Special members.
......
......@@ -20,6 +20,13 @@ namespace HappyHeart
{
template<class DerivedT, std::size_t NlocalVectorT>
constexpr std::size_t LocalVectorStorage<DerivedT, NlocalVectorT>::N()
{
return NlocalVectorT;
}
template<class DerivedT, std::size_t NlocalVectorT>
void LocalVectorStorage<DerivedT, NlocalVectorT>
::InitLocalVectorStorage(const std::array<unsigned int, NlocalVectorT>& vectors_dimension)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment