Commit b551b00f authored by Gautier Bureau's avatar Gautier Bureau Committed by GILLES Sebastien
Browse files

#410 Corrections made after the review.

parent 0de4db66
......@@ -18,6 +18,7 @@
# include "Core/InputParameter/Crtp/Section.hpp"
# include "Core/InputParameter/Parameter/SpatialFunction.hpp"
# include "Core/InputParameter/Parameter/Impl/ParameterUsualDescription.hpp"
namespace HappyHeart
......
......@@ -205,6 +205,8 @@ namespace HappyHeart
*
* \copydetails doxygen_hide_varf_solve_numbering_subset_arg
* \copydoc doxygen_hide_invoking_file_and_line
* \param[in] do_print_solver_infos Whether the Petsc solver should print informations about the solve in
* progress on standard output.
*/
template<IsFactorized IsFactorizedT>
void SolveLinear(const NumberingSubset& row_numbering_subset,
......@@ -224,6 +226,8 @@ namespace HappyHeart
* \param[out] out Solution part of the equation to solve (e.g. X in 'A X = R'). It must have been properly
* allocated; only the content is filled.
* \copydoc doxygen_hide_invoking_file_and_line
* \param[in] do_print_solver_infos Whether the Petsc solver should print informations about the solve in
* progress on standard output.
*
*/
template<IsFactorized IsFactorizedT>
......@@ -504,7 +508,7 @@ namespace HappyHeart
public:
//! Get god of dof. #410 put in public.
//! Get god of dof.
const GodOfDof& GetGodOfDof() const noexcept;
protected:
......
......@@ -85,11 +85,7 @@ namespace HappyHeart
::SolveLinear(const NumberingSubset& row_numbering_subset,
const NumberingSubset& col_numbering_subset,
const char* invoking_file, int invoking_line,
<<<<<<< HEAD
Wrappers::Petsc::print_solver_infos do_print_message)
=======
Wrappers::Petsc::print_solver_infos do_print_solver_infos)
>>>>>>> 5a176c3... #410 Corrected somes mistakes that I made in previous commit with the update of the code.
{
return SolveLinear<IsFactorizedT>(GetSystemMatrix(row_numbering_subset, col_numbering_subset),
GetSystemRhs(col_numbering_subset),
......@@ -110,11 +106,7 @@ namespace HappyHeart
const GlobalVector& rhs,
GlobalVector& out,
const char* invoking_file, int invoking_line,
<<<<<<< HEAD
Wrappers::Petsc::print_solver_infos do_print_solver_infos)
=======
Wrappers::Petsc::print_solver_infos do_print_solver_infos_arg)
>>>>>>> 5a176c3... #410 Corrected somes mistakes that I made in previous commit with the update of the code.
{
assert(out.GetNumberingSubset() == rhs.GetNumberingSubset());
......@@ -122,14 +114,6 @@ namespace HappyHeart
Wrappers::Petsc::CheckNumericValues(this->MpiHappyHeart(), "rhs", rhs, invoking_file, invoking_line);
#endif // HAPPY_HEART_CHECK_NAN_AND_INF
<<<<<<< HEAD
if (do_print_solver_infos == Wrappers::Petsc::print_solver_infos::yes)
{
do_print_solver_infos =
(this->GetTimeManager().NtimeModified() % GetDisplayValue()) == 0
? Wrappers::Petsc::print_solver_infos::yes
: Wrappers::Petsc::print_solver_infos::no;
=======
auto do_print_solver_info =
(this->GetTimeManager().NtimeModified() % GetDisplayValue()) == 0
? Wrappers::Petsc::print_solver_infos::yes
......@@ -138,7 +122,6 @@ namespace HappyHeart
if (do_print_solver_infos_arg == Wrappers::Petsc::print_solver_infos::no)
{
do_print_solver_info = Wrappers::Petsc::print_solver_infos::no;
>>>>>>> 5a176c3... #410 Corrected somes mistakes that I made in previous commit with the update of the code.
}
switch(IsFactorizedT)
......
......@@ -216,16 +216,13 @@ namespace HappyHeart
//! Setter on do_print_new_time_iteration_banner_.
void SetDoPrintNewTimeIterationBanner(bool do_print) noexcept;
//! Set do_clear_god_of_dof_temporary_data_after_initialize_ to false.
void SetClearGodOfDofTemporaryDataToFalse();
protected:
//! Non constant access to the object in charge of transient data.
// \todo #410 Put back in protected: it's really ok to make public a const version, but it's really too risky to do the same with internals. We may rediscuss it if you need a work around.
TimeManager& GetNonCstTimeManager();
// \todo #410 Same
//! Set do_clear_god_of_dof_temporary_data_after_initialize_ to false.
void SetClearGodOfDofTemporaryDataToFalse();
//! Access to the \a index -th GeometricMeshRegion object.
const GeometricMeshRegion& GetGeometricMeshRegion(unsigned int index) const;
......
......@@ -137,7 +137,6 @@ namespace HappyHeart
decltype(auto) domain = DomainManager::GetInstance().GetDomain(EnumUnderlyingType(DomainIndex::full_mesh));
capacity_operator_ = std::make_unique<GVO::Mass>(felt_space_highest_dimension,
transcellular_potential);
......
//
// CopyScalarParameterIntoSeldonVector.cpp
// HappyHeart
//
// Created by Gautier Bureau 1/03/16.
// Copyright (c) 2016 Inria. All rights reserved.
//
# include "OperatorInstances/ParameterOperator/CopyScalarParameterIntoSeldonVector.hpp"
namespace HappyHeart
{
namespace GlobalParameterOperatorNS
{
CopyScalarParameterIntoSeldonVector
::CopyScalarParameterIntoSeldonVector(const FEltSpace& felt_space,
const Unknown& unknown,
ParameterAtQuadraturePoint<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None>& parameter,
const QuadratureRulePerTopology* const quadrature_rule_per_topology)
: parent(felt_space,
unknown,
quadrature_rule_per_topology,
AllocateGradientFEltPhi::no,
parameter)
{ }
const std::string& CopyScalarParameterIntoSeldonVector::ClassName()
{
static std::string name("CopyScalarParameterIntoSeldonVector");
return name;
}
void CopyScalarParameterIntoSeldonVector::SeldonVectorIntoScalarParameter(const Seldon::Vector<double>& seldon_vector)
{
const auto& felt_storage = this->GetFEltSpace().GetLocalFEltSpacePerRefLocalFEltSpace();
int index = 0;
// \todo #410 This method name is the exact opposite of the class name; shouldn't it be a separate operator?
// \todo #410 Lot of code is a duplicate of UpdateImpl()... and Update() does nothing! It should really be used here, rather than duplicating most of UpdateImpl() here.
for (const auto& pair : felt_storage)
{
auto& ref_felt_space_ptr = pair.first;
assert(!(!ref_felt_space_ptr));
const auto& ref_felt_space = *ref_felt_space_ptr;
const auto& ref_geom_elt = ref_felt_space.GetRefGeomElt();
const auto ref_geom_elt_identifier = ref_geom_elt.GetIdentifier();
if (!DoConsider(ref_geom_elt_identifier))
continue;
auto& local_operator = GetNonCstLocalOperator(ref_geom_elt_identifier);
const auto& local_felt_space_list = pair.second;
for (const auto& local_felt_space_pair : local_felt_space_list)
{
const auto& local_felt_space_ptr = local_felt_space_pair.second;
assert(!(!local_felt_space_ptr));
auto& local_felt_space = *local_felt_space_ptr;
local_operator.SetLocalFEltSpace(local_felt_space);
auto& elementary_data = local_operator.GetNonCstElementaryData();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
const auto& geom_elt = elementary_data.GetCurrentGeomElt();
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
const double seldon_value = seldon_vector(index);
auto functor = [seldon_value](double& parameter_value)
{
parameter_value = seldon_value;
};
local_operator.GetNonCstParameter().UpdateValue(quad_pt,
geom_elt,
functor);
++index;
}
}
}
}
// \todo #410 Lot of code is a duplicate of UpdateImpl()... and Update() does nothing! It should really be used here, rather than duplicating most of UpdateImpl() here.
void CopyScalarParameterIntoSeldonVector
::ScalarParameterIntoSeldonVector(Seldon::Vector<double>& seldon_vector) const
{
const auto& felt_storage = this->GetFEltSpace().GetLocalFEltSpacePerRefLocalFEltSpace();
int index = 0;
for (const auto& pair : felt_storage)
{
auto& ref_felt_space_ptr = pair.first;
assert(!(!ref_felt_space_ptr));
const auto& ref_felt_space = *ref_felt_space_ptr;
const auto& ref_geom_elt = ref_felt_space.GetRefGeomElt();
const auto ref_geom_elt_identifier = ref_geom_elt.GetIdentifier();
if (!DoConsider(ref_geom_elt_identifier))
continue;
auto& local_operator = GetNonCstLocalOperator(ref_geom_elt_identifier);
const auto& local_felt_space_list = pair.second;
for (const auto& local_felt_space_pair : local_felt_space_list)
{
const auto& local_felt_space_ptr = local_felt_space_pair.second;
assert(!(!local_felt_space_ptr));
auto& local_felt_space = *local_felt_space_ptr;
local_operator.SetLocalFEltSpace(local_felt_space);
auto& elementary_data = local_operator.GetNonCstElementaryData();
const auto& infos_at_quad_pt_list = elementary_data.GetInformationsAtQuadraturePointList();
const auto& geom_elt = elementary_data.GetCurrentGeomElt();
for (const auto& infos_at_quad_pt : infos_at_quad_pt_list)
{
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
const double parameter_value = local_operator.GetParameter().GetValue(quad_pt, geom_elt);
seldon_vector(index) = parameter_value;
++index;
}
}
}
}
} // namespace GlobalParameterOperatorNS
} // namespace HappyHeart
//
// CopyScalarParameterIntoSeldonVector.hpp
// HappyHeart
//
// Created by Gautier Bureau on 18/03/16.
// Copyright (c) 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HPP_
# define HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HPP_
# include "Parameters/Parameter.hpp"
# include "Parameters/InitParameterFromInputData/InitParameterFromInputData.hpp"
# include "Operators/GlobalVariationalOperator/ExtractLocalDofValues.hpp"
# include "Operators/ParameterOperator/GlobalParameterOperator/GlobalParameterOperator.hpp"
# include "OperatorInstances/ParameterOperator/Local/CopyScalarParameterIntoSeldonVector.hpp"
namespace HappyHeart
{
namespace GlobalParameterOperatorNS
{
/*!
* \brief Implementation of global CopyScalarParameterIntoSeldonVector operator.
*
*/
class CopyScalarParameterIntoSeldonVector final
: public GlobalParameterOperator
<
CopyScalarParameterIntoSeldonVector,
LocalParameterOperatorNS::CopyScalarParameterIntoSeldonVector,
ParameterNS::Type::scalar
>
{
public:
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<CopyScalarParameterIntoSeldonVector>;
//! Returns the name of the operator.
static const std::string& ClassName();
//! Convenient alias to pinpoint the GlobalParameterOperator parent.
using parent = GlobalParameterOperator
<
CopyScalarParameterIntoSeldonVector,
LocalParameterOperatorNS::CopyScalarParameterIntoSeldonVector,
ParameterNS::Type::scalar
>;
//! Friendship to the parent class so that the CRTP can reach private methods defined below.
friend parent;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
* \param[in] felt_space Finite element space upon which the operator is defined.
* \param[in] unknown Unknown considered for this operator (might be scalar or vectorial).
* \param[in] geom_mesh_region_dimension Dimension of the geometric mesh region considered.
* \copydoc doxygen_hide_quadrature_rule_per_topology_nullptr_arg
*/
explicit CopyScalarParameterIntoSeldonVector(const FEltSpace& felt_space,
const Unknown& unknown,
ParameterAtQuadraturePoint<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None>& parameter,
const QuadratureRulePerTopology* const quadrature_rule_per_topology = nullptr);
//! Destructor.
~CopyScalarParameterIntoSeldonVector() = default;
//! Copy constructor.
CopyScalarParameterIntoSeldonVector(const CopyScalarParameterIntoSeldonVector&) = default;
//! Move constructor.
CopyScalarParameterIntoSeldonVector(CopyScalarParameterIntoSeldonVector&&) = default;
//! Copy affectation.
CopyScalarParameterIntoSeldonVector& operator=(const CopyScalarParameterIntoSeldonVector&) = default;
//! Move affectation.
CopyScalarParameterIntoSeldonVector& operator=(CopyScalarParameterIntoSeldonVector&&) = default;
///@}
/*!
* \brief Assemble into one or several vectors.
*
* \param[in] displacement_increment Vector that includes data from the previous iteration.
*/
void Update() const;
void ScalarParameterIntoSeldonVector(Seldon::Vector<double>& seldon_vector) const;
void SeldonVectorIntoScalarParameter(const Seldon::Vector<double>& seldon_vector);
};
} // namespace GlobalParameterOperatorNS
} // namespace HappyHeart
# include "OperatorInstances/ParameterOperator/CopyScalarParameterIntoSeldonVector.hxx"
#endif // HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HPP_
//
// CopyScalarParameterIntoSeldonVector.hxx
// HappyHeart
//
// Created by Gautier Bureau on 18/03/16.
// Copyright (c) 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HXX_
# define HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HXX_
namespace HappyHeart
{
namespace GlobalParameterOperatorNS
{
// \todo #410 See remark in cpp.
inline void CopyScalarParameterIntoSeldonVector::Update() const
{
}
} // namespace GlobalParameterOperatorNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HXX_
//
// CopyScalarParameterIntoSeldonVector.cpp
// HappyHeart
//
// Created by Gautier Bureau on 18/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#include "OperatorInstances/ParameterOperator/Local/CopyScalarParameterIntoSeldonVector.hpp"
namespace HappyHeart
{
namespace LocalParameterOperatorNS
{
CopyScalarParameterIntoSeldonVector
::CopyScalarParameterIntoSeldonVector(const ExtendedUnknown::vector_const_shared_ptr& a_unknown_storage,
elementary_data_type&& a_elementary_data,
ParameterAtQuadraturePoint<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None>& parameter)
: parent(a_unknown_storage, std::move(a_elementary_data), parameter)
{
}
CopyScalarParameterIntoSeldonVector::~CopyScalarParameterIntoSeldonVector() = default;
const std::string& CopyScalarParameterIntoSeldonVector::ClassName()
{
static std::string name("CopyScalarParameterIntoSeldonVector");
return name;
}
void CopyScalarParameterIntoSeldonVector::ComputeEltArray()
{
}
} // namespace LocalParameterOperatorNS
} // namespace HappyHeart
//
// CopyScalarParameterIntoSeldonVector.hpp
// HappyHeart
//
// Created by Gautier Bureau on 18/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HPP_
# define HAPPY_HEART_x_OPERATOR_INSTANCES_x_PARAMETER_OPERATOR_x_LOCAL_x_COPY_SCALAR_PARAMETER_INTO_SELDON_VECTOR_HPP_
# include "Utilities/LinearAlgebra/Storage/Local/LocalMatrixStorage.hpp"
# include "Utilities/LinearAlgebra/Storage/Local/LocalVectorStorage.hpp"
# include "Parameters/Parameter.hpp"
# include "Operators/ParameterOperator/LocalParameterOperator/LocalParameterOperator.hpp"
namespace HappyHeart
{
namespace LocalParameterOperatorNS
{
class CopyScalarParameterIntoSeldonVector final
: public Advanced::LocalParameterOperator<ParameterNS::Type::scalar>
{
public:
//! \copydoc doxygen_hide_alias_self
using self = CopyScalarParameterIntoSeldonVector;
//! Alias to unique pointer.
using unique_ptr = std::unique_ptr<self>;
//! Returns the name of the operator.
static const std::string& ClassName();
//! Alias to parent.
using parent = Advanced::LocalParameterOperator<ParameterNS::Type::scalar>;
public:
/// \name Special members.
///@{
/*!
* \brief Constructor.
*
* \param[in] unknown_list List of unknowns considered by the operators. Its type (vector_shared_ptr)
* is due to constraints from genericity; for current operator it is expected to hold exactly
* two unknowns (the first one vectorial and the second one scalar).
* \param[in] elementary_data Elementary matrices and vectors that will perform the calculations.
* \param[in] fiber_deformation Parameter to update.
* \param[in] contraction_rheology_residual Parameter used to update th deformation fiber.
* \param[in] schur_complement Parameter used to update th deformation fiber.
*
* \internal This constructor must not be called manually: it is involved only in
* GlobalParameterOperator<DerivedT, LocalParameterOperatorT>::CreateLocalOperatorList() method.
*/
explicit CopyScalarParameterIntoSeldonVector(const ExtendedUnknown::vector_const_shared_ptr& unknown_list,
elementary_data_type&& elementary_data,
ParameterAtQuadraturePoint<ParameterNS::Type::scalar, ParameterNS::TimeDependencyNS::None>& parameter);
//! Destructor.
~CopyScalarParameterIntoSeldonVector();
//! Copy constructor.
CopyScalarParameterIntoSeldonVector(const CopyScalarParameterIntoSeldonVector&) = delete;
//! Move constructor.
CopyScalarParameterIntoSeldonVector(CopyScalarParameterIntoSeldonVector&&) = delete;
//! Copy affectation.
CopyScalarParameterIntoSeldonVector& operator=(const CopyScalarParameterIntoSeldonVector&) = delete;
//! Move affectation.
CopyScalarParameterIntoSeldonVector& operator=(CopyScalarParameterIntoSeldonVector&&) = delete;
///@}
//! Compute the elementary vector.
void ComputeEltArray();
};
} // namespace LocalParameterOperatorNS
} // namespace HappyHeart