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

#820 Cleaning-up about numbering of iterations.

parent afc91187
......@@ -184,8 +184,7 @@ namespace HappyHeart
*
* \todo #9 - #820 To complete!
*/
double PerformDifferential(unsigned int iteration,
const GlobalMatrix& monolithic_with_dirichlet,
double PerformDifferential(const GlobalMatrix& monolithic_with_dirichlet,
const GlobalMatrix& monolithic_without_dirichlet);
......@@ -482,8 +481,7 @@ namespace HappyHeart
//! Non constant accessor to the t21 on the non monolithic FEltSpace.
GlobalMatrix& GetNonCstT21OnFluidMesh() noexcept;
//! Index of the current inner loop (for outputs).
template<differential is_differential>
//! Index of the current inner loop (for outputs).
unsigned int GetIndexInnerLoop() const noexcept;
//! Constant accessor to the parameter that encapsulates velocity part of the current solution.
......@@ -606,7 +604,6 @@ namespace HappyHeart
*
* \warning Only Perform() should call this one!
*/
template<differential is_differential>
void SetIndexInnerLoop(unsigned int index) noexcept;
//! Returns the string that gives current time and current inner loop index.
......@@ -1020,8 +1017,8 @@ namespace HappyHeart
//! Internal friction (Dporo in Freefem script).
double internal_friction_ = std::numeric_limits<double>::lowest();
//! Index of the current inner loop (for outputs). First is for non differential case, second for differential.
std::array<unsigned int, 2u> index_inner_loop_ {{ NumericNS::UninitializedIndex<unsigned int>(), NumericNS::UninitializedIndex<unsigned int>() }};
//! Index of the current inner loop (for outputs). Differential indexes do not use this one directly.
unsigned int index_inner_loop_ = NumericNS::UninitializedIndex<unsigned int>();
//! Parameter that encapsulates velocity part of the current solution.
ParameterAtDof<ParameterNS::Type::vector>::type::const_unique_ptr velocity_solution_param_ = nullptr;
......
......@@ -32,7 +32,7 @@ namespace HappyHeart
double VariationalFormulation<HyperelasticLawT>
::Perform(unsigned int iteration)
{
SetIndexInnerLoop<differential::no>(iteration);
SetIndexInnerLoop(iteration);
decltype(auto) time_manager = parent::GetTimeManager();
decltype(auto) god_of_dof = parent::GetGodOfDof();
decltype(auto) numbering_subset =
......@@ -144,11 +144,9 @@ namespace HappyHeart
template<class HyperelasticLawT>
double VariationalFormulation<HyperelasticLawT>
::PerformDifferential(unsigned int iteration,
const GlobalMatrix& monolithic_with_dirichlet,
::PerformDifferential(const GlobalMatrix& monolithic_with_dirichlet,
const GlobalMatrix& monolithic_without_dirichlet)
{
SetIndexInnerLoop<differential::yes>(iteration);
//decltype(auto) time_manager = parent::GetTimeManager();
decltype(auto) god_of_dof = parent::GetGodOfDof();
decltype(auto) numbering_subset =
......@@ -585,10 +583,9 @@ namespace HappyHeart
template<class HyperelasticLawT>
template<differential is_differential>
void VariationalFormulation<HyperelasticLawT>::SetIndexInnerLoop(unsigned int index) noexcept
{
index_inner_loop_[EnumUnderlyingType(is_differential)] = index;
index_inner_loop_ = index;
}
......@@ -596,10 +593,20 @@ namespace HappyHeart
template<differential is_differential>
std::string VariationalFormulation<HyperelasticLawT>::GetIterationTag() const noexcept
{
return "time_" + std::to_string(parent::GetTimeManager().NtimeModified()) + "_"
std::string ret = "time_" + std::to_string(parent::GetTimeManager().NtimeModified()) + "_"
+ DifferentialPreffix(is_differential)
+ "it_"
+ std::to_string(GetIndexInnerLoop<is_differential>());
+ "it_";
switch(is_differential)
{
case differential::no:
ret += std::to_string(GetIndexInnerLoop());
break;
case differential::yes:
ret += std::to_string(variable_holder_parent::GetVariableHolder().gmres_iteration_index);
}
return ret;
}
......
......@@ -480,10 +480,9 @@ namespace HappyHeart
template<class HyperelasticLawT>
template<differential is_differential>
unsigned int VariationalFormulation<HyperelasticLawT>::GetIndexInnerLoop() const noexcept
{
return index_inner_loop_[EnumUnderlyingType(is_differential)];
return index_inner_loop_;
}
......@@ -496,7 +495,6 @@ namespace HappyHeart
}
template<class HyperelasticLawT>
inline const ParameterAtDof<ParameterNS::Type::vector>::type& VariationalFormulation<HyperelasticLawT>
::GetDeltaVelocitySolutionParam() const noexcept
......
......@@ -137,10 +137,7 @@ namespace HappyHeart
auto& inner_varf = GetNonCstInnerLoopVarf();
auto counter = 0u;
current_norm = inner_varf.PerformDifferential(counter++,
GetMonolithicMatrixAfterInnerLoop(),
current_norm = inner_varf.PerformDifferential(GetMonolithicMatrixAfterInnerLoop(),
GetMonolithicMatrixAfterInnerLoopWithoutDirichlet());
std::cout << "Norm after inner loop = " << current_norm << std::endl;
}
......
......@@ -487,11 +487,6 @@ namespace HappyHeart
std::array<GlobalVector::unique_ptr, EnumUnderlyingType(SolidIndex::Nvector)> solid_vector_list_
= Utilities::NullptrArray<GlobalVector::unique_ptr, EnumUnderlyingType(SolidIndex::Nvector)>();
//! Index of gmres iteration. \todo #820 For dev purpose!
unsigned int gmres_iteration_index_ = 0u;
};
......
......@@ -92,7 +92,7 @@ namespace HappyHeart
delta_displacement.ZeroEntries(__FILE__, __LINE__);
gmres_iteration_index_ = static_cast<unsigned int>(-1);
GetNonCstVariableHolder().gmres_iteration_index = static_cast<unsigned int>(-1);
dH_solver_->SolveLinear(gmres_shell_matrix, gmres_shell_matrix,
GetVector<SolidIndex::H0>(),
delta_displacement,
......@@ -242,7 +242,7 @@ namespace HappyHeart
void Model<SolidVariationalFormulationPolicyT>
::ShellMatrixOperation(Vec petsc_input_vector, Vec& petsc_output_vector)
{
++gmres_iteration_index_;
++GetNonCstVariableHolder().gmres_iteration_index;
auto& implicit_step_varf = GetNonCstImplicitStepFluidVarf();
......
......@@ -124,6 +124,10 @@ namespace HappyHeart
//! Constant accessor to the material parameters related to the solid.
const Solid& GetSolid() const noexcept;
//! Index of gmres iteration. \todo #820 For dev purpose!
unsigned int gmres_iteration_index = 0u;
private:
......@@ -151,8 +155,7 @@ namespace HappyHeart
//! Midpoint position. // \todo #820 TMP: midpoint time scheme should not be the sole choice!
const GlobalVector* midpoint_position_ = nullptr;
};
......
Markdown is supported
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