Commit 2ebb42f4 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#531 TransientSource now also uses the new Assemble interface.

parent 6198cdb0
......@@ -387,9 +387,9 @@ namespace HappyHeart
std::tuple<Args...>&& additional_arguments) const
{
auto&& compute_elt_array_variadic_arguments =
static_cast<const DerivedT*>(this)->SupplArgumentsComputeEltArray(local_operator,
local_felt_space,
std::move(additional_arguments));
static_cast<const DerivedT&>(*this).SupplArgumentsComputeEltArray(local_operator,
local_felt_space,
std::move(additional_arguments));
Utilities::Tuple::CallMethodWithArgumentsFromTuple<void>(local_operator,
&LocalVariationalOperatorT::template ComputeEltArray<LocalVariationalOperatorT::GetMatrixVectorNature()>,
......@@ -410,6 +410,7 @@ namespace HappyHeart
LocalVariationalOperatorT& local_operator,
std::tuple<>&& ) const
{
static_cast<void>(local_felt_space);
local_operator.template ComputeEltArray<LocalVariationalOperatorT::GetMatrixVectorNature()>();
}
......
......@@ -143,6 +143,48 @@ namespace HappyHeart
}
template<class LinearAlgebraTupleT, std::size_t I, std::size_t TupleSizeT>
template<class LocalVariationalOperatorT>
void Recursivity<LinearAlgebraTupleT, I, TupleSizeT>
::InjectInGlobalLinearAlgebraImpl531(const LocalFEltSpace& local_felt_space,
LocalVariationalOperatorT& local_variational_operator,
const GlobalVectorWithCoefficient& global_vector_with_coefficient,
const double previous_coefficient)
{
auto& global_vector = global_vector_with_coefficient.first;
auto& elementary_data = local_variational_operator.GetNonCstElementaryData();
auto& local_vector = elementary_data.GetNonCstVectorResult();
const double coefficient = global_vector_with_coefficient.second;
assert(!Utilities::IsZero(previous_coefficient));
// Trick here: local matrix was multiplied by a coefficient in previous iteration; we here both apply
// the new one and cancel the previous one.
const auto factor = coefficient / previous_coefficient;
if (!Utilities::AreEqual(factor, 1.))
local_vector *= factor;
const auto& numbering_subset = global_vector.GetNumberingSubset();
const auto& unknown_and_numbering_subset_list =
local_variational_operator.GetUnknownAndNumberingSubsetList();
decltype(auto) local_2_global =
local_felt_space.ComputeLocal2Global<MpiScale::program_wise>(unknown_and_numbering_subset_list,
numbering_subset);
assert(static_cast<int>(local_2_global.size()) == local_vector.GetSize());
global_vector.SetValues(local_2_global,
local_vector.GetData(),
ADD_VALUES,
__FILE__, __LINE__);
}
template<class LinearAlgebraTupleT, std::size_t TupleSizeT>
void Recursivity<LinearAlgebraTupleT, TupleSizeT, TupleSizeT>
::Assembly531(const LinearAlgebraTupleT& linear_algebra_tuple)
......
......@@ -119,8 +119,8 @@ namespace HappyHeart
double time,
const Domain& domain = Domain()) const;
void Assemble(double coefficient, GlobalVector& global_vector, double time,
const Domain& domain = Domain()) const;
// void Assemble(double coefficient, GlobalVector& global_vector, double time,
// const Domain& domain = Domain()) const;
private:
......
......@@ -28,15 +28,15 @@ namespace HappyHeart
time);
}
inline void TransientSource::Assemble(double coefficient,
GlobalVector& global_vector,
double time,
const Domain& domain) const
{
return Parent::AssembleWithVariadicArguments(coefficient, global_vector, domain, time);
}
//
// inline void TransientSource::Assemble(double coefficient,
// GlobalVector& global_vector,
// double time,
// const Domain& domain) const
// {
// return Parent::AssembleWithVariadicArguments(coefficient, global_vector, domain, time);
// }
//
inline std::tuple<double>
......
......@@ -39,7 +39,7 @@ namespace HappyHeart
template<>
void TransientSource::ComputeEltArray<MatrixVectorNature::vector>(const double coefficient, const double time)
void TransientSource::ComputeEltArray<MatrixVectorNature::vector>(const double time)
{
auto& elementary_data = GetNonCstElementaryData();
......@@ -62,9 +62,8 @@ namespace HappyHeart
const auto& quad_pt = infos_at_quad_pt.GetQuadraturePoint();
const double factor_without_force = coefficient
* quad_pt.GetWeight()
* infos_at_quad_pt.GetJacobianDeterminant();
const double factor_without_force = quad_pt.GetWeight()
* infos_at_quad_pt.GetJacobianDeterminant();
auto&& coords = Local2Global(current_geom_elt, quad_pt, mesh_dimension);
......
......@@ -107,7 +107,7 @@ namespace HappyHeart
*
*/
template<MatrixVectorNature MatrixVectorNatureT>
void ComputeEltArray(double coefficient, double time);
void ComputeEltArray(double time);
private:
......@@ -133,7 +133,7 @@ namespace HappyHeart
// Template method specialization.
template<>
void TransientSource::ComputeEltArray<MatrixVectorNature::vector>(double coefficient, double time);
void TransientSource::ComputeEltArray<MatrixVectorNature::vector>(double time);
......
......@@ -202,36 +202,36 @@ namespace HappyHeart
{
if (newton_iteration == 0)
{
// const auto time = transient_parameters.GetTime();
//
// if (this->template IsOperatorActivated<ForceIndexList::volumic_force>())
// {
// auto&& force_vector = GlobalVectorWithCoefficient(vm.GetNonCstForce(), 1.);
// this->template GetNonCstForceOperator<ForceIndexList::volumic_force>().Assemble(std::make_tuple(std::move(force_vector)),
// time);
// }
//
// if (this->template IsOperatorActivated<ForceIndexList::surfacic_force>())
// {
// auto&& force_vector = GlobalVectorWithCoefficient(vm.GetNonCstForce(), 1.);
// this->template GetNonCstForceOperator<ForceIndexList::surfacic_force>().Assemble(std::make_tuple(std::move(force_vector)),
// time);
//
// }
auto& force_vector = vm.GetNonCstForce();
auto time = transient_parameters.GetTime();
const auto time = transient_parameters.GetTime();
if (this->template IsOperatorActivated<ForceIndexList::volumic_force>())
this->template GetNonCstForceOperator<ForceIndexList::volumic_force>().Assemble(1.,
force_vector,
{
auto&& force_vector = GlobalVectorWithCoefficient(vm.GetNonCstForce(), 1.);
this->template GetNonCstForceOperator<ForceIndexList::volumic_force>().Assemble(std::make_tuple(std::move(force_vector)),
time);
}
if (this->template IsOperatorActivated<ForceIndexList::surfacic_force>())
this->template GetNonCstForceOperator<ForceIndexList::surfacic_force>().Assemble(1.,
force_vector,
{
auto&& force_vector = GlobalVectorWithCoefficient(vm.GetNonCstForce(), 1.);
this->template GetNonCstForceOperator<ForceIndexList::surfacic_force>().Assemble(std::make_tuple(std::move(force_vector)),
time);
}
//
// auto& force_vector = vm.GetNonCstForce();
// auto time = transient_parameters.GetTime();
//
// if (this->template IsOperatorActivated<ForceIndexList::volumic_force>())
// this->template GetNonCstForceOperator<ForceIndexList::volumic_force>().Assemble(1.,
// force_vector,
// time);
//
// if (this->template IsOperatorActivated<ForceIndexList::surfacic_force>())
// this->template GetNonCstForceOperator<ForceIndexList::surfacic_force>().Assemble(1.,
// force_vector,
// time);
}
}
else
......
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