Commit 2c3f1f47 authored by GILLES Sebastien's avatar GILLES Sebastien

#1531 FromVertexMatching: add a method to print what is required to rebuild an object.

parent 45be8c9b
...@@ -219,6 +219,33 @@ namespace MoReFEM ...@@ -219,6 +219,33 @@ namespace MoReFEM
interpolation_matrix.Assembly(__FILE__, __LINE__); interpolation_matrix.Assembly(__FILE__, __LINE__);
} }
void FromVertexMatching::Print(const Wrappers::Mpi& mpi,
const FilesystemNS::Directory& directory) const
{
const auto matrix_file = directory.AddFile("matrix.m");
GetInterpolationMatrix().View(mpi,
matrix_file,
__FILE__, __LINE__,
PETSC_VIEWER_ASCII_MATLAB);
if (matrix_pattern_ != nullptr)
{
const auto matrix_pattern_file = directory.AddFile("matrix_pattern.lua");
std::ofstream out;
FilesystemNS::File::Create(out, matrix_pattern_file, __FILE__, __LINE__);
out << "iCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetICsr(), out, ", ", "{", "}");
out << "\njCSR = ";
Utilities::PrintContainer<>::Do(matrix_pattern_->GetJCsr(), out, ", ", "{", "}");
}
}
} // namespace NonConformInterpolatorNS } // namespace NonConformInterpolatorNS
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# include <memory> # include <memory>
# include <vector> # include <vector>
# include "Utilities/Filesystem/Directory.hpp"
# include "Core/LinearAlgebra/GlobalMatrix.hpp" # include "Core/LinearAlgebra/GlobalMatrix.hpp"
# include "Geometry/Interpolator/VertexMatching.hpp" # include "Geometry/Interpolator/VertexMatching.hpp"
...@@ -128,7 +130,7 @@ namespace MoReFEM ...@@ -128,7 +130,7 @@ namespace MoReFEM
* *
* \copydoc doxygen_hide_input_data_arg * \copydoc doxygen_hide_input_data_arg
* \copydetails doxygen_hide_from_vertex_matching_constructor_arg * \copydetails doxygen_hide_from_vertex_matching_constructor_arg
*/ */
template<class InputDataT> template<class InputDataT>
explicit FromVertexMatching(const InputDataT& input_data, explicit FromVertexMatching(const InputDataT& input_data,
unsigned int source_index, unsigned int source_index,
...@@ -165,6 +167,19 @@ namespace MoReFEM ...@@ -165,6 +167,19 @@ namespace MoReFEM
*/ */
const Wrappers::Petsc::MatrixPattern& GetMatrixPattern() const noexcept; const Wrappers::Petsc::MatrixPattern& GetMatrixPattern() const noexcept;
/*!
* \brief Write in the chosen directory the interpolation matrix and if relevant the matrix pattern.
*
* By convention:
* - The interpolation matrix is named "matrix.m"
* - The mattrix pattern is named "matrix_pattern.lua" (it is a Lua file which give the fields iCSR and jCSR.
*
* \param[in] directory Directory in which the file(s) will be created. It must exist and allows the creation of the files inside.
* \copydoc doxygen_hide_mpi_param
*/
void Print(const Wrappers::Mpi& mpi,
const FilesystemNS::Directory& directory) const;
private: private:
/*! /*!
......
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