Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 5950e8cd authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1443 Add test for the resulting matrix pattern... which doesn't work yet.

parent de8343ae
......@@ -807,8 +807,6 @@ namespace MoReFEM
return (*it)->GetPattern();
}
const NumberingSubset::const_shared_ptr& GodOfDof::GetNumberingSubsetPtr(unsigned int unique_id) const
{
......
......@@ -240,7 +240,7 @@ namespace MoReFEM
//! Shorthand function for a matrix described only by one \a numbering_subset (square matrix).
//! \param[in] numbering_subset Same \a NumberingSubset used for the rowsand the columns.
//! \param[in] numbering_subset Same \a NumberingSubset used for the rows and the columns.
const Wrappers::Petsc::MatrixPattern& GetMatrixPattern(const NumberingSubset& numbering_subset) const;
......
......@@ -141,6 +141,18 @@ namespace MoReFEM
matrix_pattern_ =
std::make_unique<::MoReFEM::Wrappers::Petsc::MatrixPattern>(content_for_each_local_row);
}
bool operator==(const MatrixPattern& lhs, const MatrixPattern& rhs)
{
if (lhs.GetRowNumberingSubset() != rhs.GetRowNumberingSubset())
return false;
if (lhs.GetColumnNumberingSubset() != rhs.GetColumnNumberingSubset())
return false;
return (lhs.GetPattern() == rhs.GetPattern());
}
} // namespace FEltSpaceNS
......
......@@ -155,9 +155,17 @@ namespace MoReFEM
//! Objects that stores effectively the pattern.
::MoReFEM::Wrappers::Petsc::MatrixPattern::const_unique_ptr matrix_pattern_ = nullptr;
};
};
/*!
* \copydoc doxygen_hide_operator_equal
*
* To make two \a MatrixPattern equal:
* - Both \a NumberingSubset object should match.
* - The information about the pattern (iCSR format) shoud match.
*/
bool operator==(const MatrixPattern& lhs, const MatrixPattern& rhs);
} // namespace FEltSpaceNS
......
......@@ -360,7 +360,39 @@ namespace MoReFEM::TestNS::LoadPrepartitionedGodOfDofNS
BOOST_CHECK_EQUAL(original_dof->GetInternalProcessorWiseOrGhostIndex(),
reconstructed_dof->GetInternalProcessorWiseOrGhostIndex());
}
}
}
void Model::CheckMatrixPattern() const
{
decltype(auto) god_of_dof_manager = GodOfDofManager::GetInstance(__FILE__, __LINE__);
decltype(auto) original_god_of_dof = god_of_dof_manager.GetGodOfDof(original);
decltype(auto) reconstructed_god_of_dof = god_of_dof_manager.GetGodOfDof(reconstructed);
decltype(auto) scalar_numbering_subset =
original_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::scalar));
decltype(auto) vectorial_numbering_subset =
original_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::vectorial));
decltype(auto) mixed_numbering_subset =
original_god_of_dof.GetNumberingSubset(EnumUnderlyingType(NumberingSubsetIndex::mixed));
BOOST_CHECK(original_god_of_dof.GetMatrixPattern(scalar_numbering_subset, scalar_numbering_subset)
== reconstructed_god_of_dof.GetMatrixPattern(scalar_numbering_subset, scalar_numbering_subset));
// BOOST_CHECK(original_god_of_dof.GetMatrixPattern(vectorial_numbering_subset, vectorial_numbering_subset)
// == reconstructed_god_of_dof.GetMatrixPattern(vectorial_numbering_subset, vectorial_numbering_subset));
//
// BOOST_CHECK(original_god_of_dof.GetMatrixPattern(mixed_numbering_subset, mixed_numbering_subset)
// == reconstructed_god_of_dof.GetMatrixPattern(mixed_numbering_subset, mixed_numbering_subset));
//
// BOOST_CHECK(original_god_of_dof.GetMatrixPattern(scalar_numbering_subset, vectorial_numbering_subset)
// == reconstructed_god_of_dof.GetMatrixPattern(scalar_numbering_subset, vectorial_numbering_subset));
//
// BOOST_CHECK(original_god_of_dof.GetMatrixPattern(mixed_numbering_subset, scalar_numbering_subset)
// == reconstructed_god_of_dof.GetMatrixPattern(mixed_numbering_subset, scalar_numbering_subset));
}
void Model::Forward()
......
......@@ -144,6 +144,9 @@ namespace MoReFEM
//! \param[in] felt_space_index Index of the \a FEltSpace considered.
void CheckDofListInFEltSpace(FEltSpaceIndex felt_space_index) const;
//! Check the matrix pattern match.
void CheckMatrixPattern() const;
private:
......
......@@ -187,6 +187,20 @@ BOOST_FIXTURE_TEST_CASE(check_dof_list_in_mixed_felt_space, fixture_type)
}
BOOST_FIXTURE_TEST_CASE(check_matrix_pattern, fixture_type)
{
try
{
decltype(auto) model = GetModel();
model.CheckMatrixPattern();
}
catch(const ExceptionNS::GracefulExit& ) // TMP #1443
{
}
}
PRAGMA_DIAGNOSTIC(pop)
......
......@@ -187,6 +187,20 @@ BOOST_FIXTURE_TEST_CASE(check_dof_list_in_mixed_felt_space, fixture_type)
}
BOOST_FIXTURE_TEST_CASE(check_matrix_pattern, fixture_type)
{
try
{
decltype(auto) model = GetModel();
model.CheckMatrixPattern();
}
catch(const ExceptionNS::GracefulExit& ) // TMP #1443
{
}
}
PRAGMA_DIAGNOSTIC(pop)
......
......@@ -13,8 +13,10 @@
#include <cassert>
#include <iostream> // TMP #1443
#include "Utilities/Numeric/Numeric.hpp"
#include "Utilities/Containers/Print.hpp" // TMP #1443
#include "ThirdParty/Wrappers/Petsc/Matrix/MatrixPattern.hpp"
......@@ -44,6 +46,28 @@ namespace MoReFEM
std::move(row.begin(), row.end(), std::back_inserter(jCSR_));
}
}
bool operator==(const MatrixPattern& lhs, const MatrixPattern& rhs)
{
std::cout << "Internal MatrixPattern equality" << std::endl;
if (lhs.GetICsr() != rhs.GetICsr())
{
std::cout << "Lhs = ";
Utilities::PrintContainer<>::Do(lhs.GetICsr(), std::cout);
std::cout << "Rhs = ";
Utilities::PrintContainer<>::Do(rhs.GetICsr(), std::cout);
return false;
}
std::cout << "Internal MatrixPattern equality ok 1" << std::endl;
return lhs.GetJCsr() == rhs.GetJCsr();
}
} // namespace Petsc
......
......@@ -94,7 +94,6 @@ namespace MoReFEM
//! Get jCSR part of the CSR pattern (see iCSR_ for more details).
const std::vector<PetscInt>& GetJCsr() const noexcept;
private:
......@@ -124,6 +123,14 @@ namespace MoReFEM
};
/*!
* \copydoc doxygen_hide_operator_equal
*
* To make two \a MatrixPattern equal, both iCSR and jCSR should match.
*/
bool operator==(const MatrixPattern& lhs, const MatrixPattern& rhs);
} // namespace Petsc
......
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