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

#1053 Rewrite a bit more cleverly the anonymous function.

parent ad65860d
......@@ -36,13 +36,18 @@ namespace HappyHeart
result_type& result);
result_type PerformComputationForNumberingSubset(const GodOfDof& god_of_dof,
const PostProcessingNS::PostProcessing& post_processing,
NumberingSubsetIndex numbering_subset);
} // namespace anonymous
void CheckInterpolator(const Model& model)
{
decltype(auto) mpi = model.MpiHappyHeart();
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance();
decltype(auto) solid_god_of_dof = god_of_dof_manager.GetGodOfDof(EnumUnderlyingType(MeshIndex::solid));
......@@ -61,83 +66,70 @@ namespace HappyHeart
EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid) },
solid_god_of_dof.GetGeometricMeshRegion());
const auto Nprocessor = mpi.template Nprocessor<unsigned int>();
result_type velocity_on_fluid_content =
PerformComputationForNumberingSubset(fluid_god_of_dof,
fluid_post_processing,
NumberingSubsetIndex::velocity_on_fluid);
result_type velocity_on_fluid_content;
result_type velocity_on_solid_content;
result_type pressure_on_fluid_content;
result_type pressure_on_solid_content;
result_type pressure_on_fluid_content =
PerformComputationForNumberingSubset(fluid_god_of_dof,
fluid_post_processing,
NumberingSubsetIndex::pressure_on_fluid);
velocity_on_fluid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
velocity_on_solid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
pressure_on_fluid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
pressure_on_solid_content.max_load_factor(Utilities::DefaultMaxLoadFactor());
result_type velocity_on_solid_content =
PerformComputationForNumberingSubset(solid_god_of_dof,
solid_post_processing,
NumberingSubsetIndex::velocity_on_solid);
velocity_on_fluid_content.reserve(fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid))));
velocity_on_solid_content.reserve(solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid))));
pressure_on_fluid_content.reserve(fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid))));
pressure_on_solid_content.reserve(solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid))));
for (auto rank = 0u; rank < Nprocessor; ++rank)
{
PerformComputationForRankAndNumberingSubset(fluid_post_processing,
rank,
NumberingSubsetIndex::velocity_on_fluid,
velocity_on_fluid_content);
PerformComputationForRankAndNumberingSubset(fluid_post_processing,
rank,
NumberingSubsetIndex::pressure_on_fluid,
pressure_on_fluid_content);
PerformComputationForRankAndNumberingSubset(solid_post_processing,
rank,
NumberingSubsetIndex::velocity_on_solid,
velocity_on_solid_content);
PerformComputationForRankAndNumberingSubset(solid_post_processing,
rank,
NumberingSubsetIndex::pressure_on_solid,
pressure_on_solid_content);
}
assert(velocity_on_fluid_content.size() == fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_fluid))));
assert(velocity_on_solid_content.size() == solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::velocity_on_solid))));
assert(pressure_on_fluid_content.size() == fluid_god_of_dof.NprogramWiseDof(fluid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_fluid))));
assert(pressure_on_solid_content.size() == solid_god_of_dof.NprogramWiseDof(solid_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::pressure_on_solid))));
result_type pressure_on_solid_content =
PerformComputationForNumberingSubset(solid_god_of_dof,
solid_post_processing,
NumberingSubsetIndex::pressure_on_solid);
}
namespace // anonymous
{
void PerformComputationForRankAndNumberingSubset(const PostProcessingNS::PostProcessing& post_processing,
unsigned int rank,
NumberingSubsetIndex numbering_subset,
result_type& result)
result_type PerformComputationForNumberingSubset(const GodOfDof& god_of_dof,
const PostProcessingNS::PostProcessing& post_processing,
NumberingSubsetIndex numbering_subset_index)
{
decltype(auto) dof_list = post_processing.GetDofInformationList(EnumUnderlyingType(numbering_subset),
rank);
result_type ret;
ret.max_load_factor(Utilities::DefaultMaxLoadFactor());
decltype(auto) numbering_subset = god_of_dof.GetNumberingSubset(EnumUnderlyingType(numbering_subset_index));
ret.reserve(god_of_dof.NprogramWiseDof(numbering_subset));
for (const auto& dof_ptr : dof_list)
decltype(auto) mpi = god_of_dof.MpiHappyHeart();
const auto Nprocessor = mpi.template Nprocessor<unsigned int>();
for (auto rank = 0u; rank < Nprocessor; ++rank)
{
assert(!(!dof_ptr));
const auto& dof = *dof_ptr;
const auto dof_index = dof.GetProgramWiseIndex();
const auto& interface = dof.GetInterface();
decltype(auto) dof_list = post_processing.GetDofInformationList(EnumUnderlyingType(numbering_subset_index),
rank);
auto check = result.insert(std::make_pair(dof_index, interface.GetVertexCoordsIndexList()));
assert(check.second);
static_cast<void>(check);
for (const auto& dof_ptr : dof_list)
{
assert(!(!dof_ptr));
const auto& dof = *dof_ptr;
const auto dof_index = dof.GetProgramWiseIndex();
const auto& interface = dof.GetInterface();
auto check = ret.insert(std::make_pair(dof_index, interface.GetVertexCoordsIndexList()));
assert(check.second);
static_cast<void>(check);
}
}
assert(ret.size() == god_of_dof.NprogramWiseDof(numbering_subset));
return ret;
}
......
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