Commit 24ee3b70 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#762 FSI/2 meshes: the vertex matching is now done properly in the sequential case.

parent 5ca4852d
......@@ -281,8 +281,9 @@ namespace HappyHeart
template<Fluid FluidT>
GlobalVector::unique_ptr& GetNonCstVectorPtr() noexcept;
const GlobalMatrix& GetSolidToFluidOnInterfaceInterpolationMatrix() const noexcept;
private:
//! Underlying variational formulation for explicit step.
......
......@@ -237,10 +237,11 @@ namespace HappyHeart
auto& interpolation_matrix_solid_2_fluid_velocity = GetNonCstInterpolationMatrixSolid2FluidVelocity();
Wrappers::Petsc::MatMatMult(fsi_2_fluid.GetInterpolationMatrix(),
solid_2_fsi.GetInterpolationMatrix(),
interpolation_matrix_solid_2_fluid_velocity,
__FILE__, __LINE__);
Wrappers::Petsc::MatMatMatMult(fsi_2_fluid.GetInterpolationMatrix(),
GetSolidToFluidOnInterfaceInterpolationMatrix(),
solid_2_fsi.GetInterpolationMatrix(),
interpolation_matrix_solid_2_fluid_velocity,
__FILE__, __LINE__);
}
{
......@@ -442,7 +443,13 @@ namespace HappyHeart
return 0;
}
template<class SolidVariationalFormulationPolicyT>
const GlobalMatrix& Model<SolidVariationalFormulationPolicyT>
::GetSolidToFluidOnInterfaceInterpolationMatrix() const noexcept
{
assert(!(!solid_to_fluid_velocity_on_fsi_interpolator_));
return solid_to_fluid_velocity_on_fsi_interpolator_->GetInterpolationMatrix();
}
} // namespace FSI_EI_2_MESHES_NS
......
......@@ -70,32 +70,68 @@ namespace HappyHeart
std::move(target_unknown_list),
target_dof_index_list_per_coord_index);
assert(Nsource_dof == Ntarget_dof);
const auto& source_index_list = vertex_matching.GetSourceIndexList();
const auto& target_index_list = vertex_matching.GetTargetIndexList();
const auto Nvertex = source_index_list.size();
assert(Nvertex == target_index_list.size());
std::vector<std::vector<PetscInt>> non_zero_pattern_per_line(Nsource_dof);
for (auto i = 0ul; i < Nvertex; ++i)
{
const auto it_source = source_dof_index_list_per_coord_index.find(source_index_list[i]);
assert(it_source != source_dof_index_list_per_coord_index.cend());
auto&& source_dof_list = it_source->second;
const auto it_target = target_dof_index_list_per_coord_index.find(target_index_list[i]);
assert(it_target != target_dof_index_list_per_coord_index.cend());
auto&& target_dof_list = it_target->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)
{
const auto row_index = target_dof_list[j];
const auto col_index = source_dof_list[j];
assert(row_index < Nsource_dof);
assert(col_index < Nsource_dof);
non_zero_pattern_per_line[static_cast<std::size_t>(row_index)] = { static_cast<PetscInt>(col_index) };
}
}
Wrappers::Petsc::MatrixPattern matrix_pattern(non_zero_pattern_per_line);
auto& interpolation_matrix = *interpolation_matrix_;
interpolation_matrix.InitSequentialMatrix(static_cast<unsigned int>(Ntarget_dof),
static_cast<unsigned int>(Nsource_dof),
matrix_pattern,
source_felt_space.MpiHappyHeart(),
__FILE__, __LINE__);
std::cout << "Nnon zero COL = " << source_dof_index_list_per_coord_index.size()
<<
'\t' << target_dof_index_list_per_coord_index.size() << std::endl;
std::vector<PetscScalar> one { 1. };
// interpolation_matrix_->InitSequentialMatrix(Nprocessor_wise_dof_in_target,
// Nprocessor_wise_dof_in_source,
// matrix_pattern,
// mpi,
// __FILE__, __LINE__);
//
for (auto i = 0ul; i < Nsource_dof; ++i)
{
const auto& row = non_zero_pattern_per_line[i];
// If a row is not empty, it includes only a '1.' that will be put in the rightful position.
if (!row.empty())
interpolation_matrix.SetValuesRow(static_cast<PetscInt>(i), one.data(), __FILE__, __LINE__);
}
interpolation_matrix.Assembly(__FILE__, __LINE__);
// interpolation_matrix.View(source_felt_space.MpiHappyHeart(), __FILE__, __LINE__);
}
......
......@@ -100,6 +100,9 @@ namespace HappyHeart
///@}
//! Access to interpolation matrix.
const GlobalMatrix& GetInterpolationMatrix() const noexcept;
private:
//! Construct the object. Should not be called outside of constructor.
......
......@@ -38,6 +38,12 @@ namespace HappyHeart
}
inline const GlobalMatrix& FromVertexMatching::GetInterpolationMatrix() const noexcept
{
assert(!(!interpolation_matrix_));
return *interpolation_matrix_;
}
} // namespace NonConformInterpolatorNS
......
......@@ -322,7 +322,7 @@ namespace HappyHeart
* \warning Assembly() must be called afterwards!
*
* \param[in] row_index Program-wise index of the row which values will be set.
* \param[in] values Non-zero values to report in the matris
* \param[in] values Non-zero values to report in the matrix.
* \param[in] invoking_file File that invoked the function or class; usually __FILE__.
* \param[in] invoking_line File that invoked the function or class; usually __LINE__.
*/
......
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