Commit 4e52a095 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#772 VertexMatchingInterpolator: remove a completely pointless operation.

parent 808d52c8
......@@ -304,8 +304,6 @@ namespace HappyHeart
auto&& node_bearer_on_bc = node_helper.ComputeNodeBearerListOnBoundary(mesh, boundary_condition);
boundary_condition.ComputeDofList(std::move(node_bearer_on_bc));
std::cout << "FOR BC -> " << boundary_condition.GetDofList().size() << std::endl;
}
}
......
......@@ -98,16 +98,6 @@ namespace HappyHeart
}
}
}
std::ofstream out("/Users/sebastien/Desktop/init_vertex_matching_" + std::to_string(unique_id) + "_" + std::to_string(felt_space.MpiHappyHeart().GetRank<int>()));
for (const auto& pair : dof_list_per_coord_list)
{
out << pair.first << " -> ";
Utilities::PrintContainer(pair.second, out);
}
std::cout << "IVM DONE " << dof_list_per_coord_list.size() << std::endl;
}
......
......@@ -165,20 +165,12 @@ namespace HappyHeart
}
{
NonConformInterpolatorNS::pairing_type pairing
{
std::make_pair(unknown_manager.GetUnknownPtr(EnumUnderlyingType(UnknownIndex::solid_velocity)),
unknown_manager.GetUnknownPtr(EnumUnderlyingType(UnknownIndex::fluid_velocity))
)
};
auto& init_vertex_matching_manager = Private::DofProgramWiseIndexListPerVertexCoordIndexManager::GetInstance();
solid_to_fluid_velocity_on_fsi_interpolator_ =
std::make_unique<NonConformInterpolatorNS::FromVertexMatching>(input_parameter_data,
init_vertex_matching_manager.GetDofProgramWiseIndexListPerVertexCoordIndex(EnumUnderlyingType(InitVertexMatchingInterpolator::solid)),
init_vertex_matching_manager.GetDofProgramWiseIndexListPerVertexCoordIndex(EnumUnderlyingType(InitVertexMatchingInterpolator::fluid)),
std::move(pairing));
init_vertex_matching_manager.GetDofProgramWiseIndexListPerVertexCoordIndex(EnumUnderlyingType(InitVertexMatchingInterpolator::fluid)));
}
......
......@@ -25,30 +25,15 @@ namespace HappyHeart
{
void FromVertexMatching::Construct(const GeometryNS::InterpolationNS::VertexMatching& vertex_matching,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& source,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target,
pairing_type&& pairing)
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target)
{
interpolation_matrix_ = std::make_unique<GlobalMatrix>(target.GetNumberingSubset(),
source.GetNumberingSubset());
source.GetNumberingSubset());
Unknown::vector_const_shared_ptr source_unknown_list;
Unknown::vector_const_shared_ptr target_unknown_list;
const auto& mpi = source.GetFEltSpace().MpiHappyHeart();
for (const auto& pair : pairing)
{
source_unknown_list.push_back(pair.first);
target_unknown_list.push_back(pair.second);
}
decltype(auto) source_dof_index_list_per_coord_index = source.GetDofProgramWiseIndexPerCoordIndex();
decltype(auto) target_dof_index_list_per_coord_index = target.GetDofProgramWiseIndexPerCoordIndex();
decltype(auto) target_dof_list_per_proc_wise_coord_index = target.ComputeProcessorWiseStorage();
const auto Nprocessor_wise_source_dof = source.ComputeNprocessorWisedof();
const auto Nprocessor_wise_target_dof = target.ComputeNprocessorWisedof();
......@@ -71,8 +56,6 @@ namespace HappyHeart
const auto end_dof_list_target = complete_dof_list_target.cend();
const auto target_dof_list_per_proc_wise_coord_index = target.ComputeProcessorWiseStorage();
for (const auto& pair : target_dof_list_per_proc_wise_coord_index)
{
// Use geometric data to make source and target vertices match.
......@@ -85,17 +68,15 @@ namespace HappyHeart
const auto it_source = source_dof_index_list_per_coord_index.find(source_vertex_index);
assert(it_source != source_dof_index_list_per_coord_index.cend());
const auto it_target = target_dof_index_list_per_coord_index.find(target_vertex_index);
assert(it_target != target_dof_index_list_per_coord_index.cend());
const auto& source_dof_list = it_source->second;
const auto& target_dof_list = it_target->second;
const auto& target_dof_list = pair.second;
const auto Ndof_for_vertex = source_dof_list.size();
assert(Ndof_for_vertex == target_dof_list.size());
for (auto j = 0ul; j < Ndof_for_vertex; ++j)
{
// \todo #775 Ordering of the unknowns shouldn't be implicitly assumed.
const auto row_internal_index = target_dof_list[j];
const auto col_index = source_dof_list[j];
......@@ -132,7 +113,7 @@ namespace HappyHeart
Wrappers::Petsc::MatrixPattern matrix_pattern(non_zero_pattern_per_line);
auto& interpolation_matrix = *interpolation_matrix_;
const auto& mpi = source.GetFEltSpace().MpiHappyHeart();
if (mpi.Nprocessor<int>() == 1)
{
......
......@@ -54,6 +54,16 @@ namespace HappyHeart
using pairing_type = ConformInterpolatorNS::pairing_type;
/*!
* \brief Class that matches the dofs on vertices from two different meshes.
*
* \attention This class is a tad unwieldy to use, and currently assumes that:
*
* . Finite element spaces/numbering subset couples from both source and target feature the same amounts
* of unknowns sort in the same way. In other words, (velocity_solid, pressure_solid) for source and
* (pressure_fluid, velocity_fluid) won't be handled for the time being.
* . Finite elements on interface must be P1.
*/
class FromVertexMatching
{
......@@ -73,24 +83,14 @@ namespace HappyHeart
/*! Constructor.
*
* \param[in] source_felt_space Finite element space of the source.
* \param[in] source_numbering_subset Numbering subset of the source. First arguments of \a pairing
* pairs must belong to it, and \a source_felt_space must encompass it.
* \param[in] target_felt_space Finite element space of the target.
* \param[in] target_numbering_subset Numbering subset of the target. Second arguments of \a pairing
* pairs must belong to it, and \a target_felt_space must encompass it.
*
* \param[in] pairing A vector of pair in which each pair is an association between an unknown of the
* source and one from the target. For instance if we consider a fluid with (vf, pf) and a solid with
* (vs, ds) and want to interpolate from the former to the latter, (vf, vs) must be specified to indicate
* ds and pf are ignored and vf is associated with vs.
* \param[in] source Useful data related to the source computed before processor-wise reduction.
* \param[in] target Useful data related to the target computed before processor-wise reduction.
*
*/
template<class InputParameterDataT>
explicit FromVertexMatching(const InputParameterDataT& input_parameter_data,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& source,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target,
pairing_type&& pairing);
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target);
//! Destructor.
~FromVertexMatching() = default;
......@@ -117,8 +117,7 @@ namespace HappyHeart
//! Construct the object. Should not be called outside of constructor.
void Construct(const GeometryNS::InterpolationNS::VertexMatching& vertex_matching,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& source,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target,
pairing_type&& pairing);
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target);
private:
......
......@@ -21,15 +21,13 @@ namespace HappyHeart
template<class InputParameterDataT>
FromVertexMatching::FromVertexMatching(const InputParameterDataT& input_parameter_data,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& source,
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target,
pairing_type&& pairing)
const Private::DofProgramWiseIndexListPerVertexCoordIndex& target)
{
GeometryNS::InterpolationNS::VertexMatching vertex_matching(input_parameter_data);
Construct(vertex_matching,
source,
target,
std::move(pairing));
target);
}
......
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