Commit c5bf26be authored by GILLES Sebastien's avatar GILLES Sebastien

#1422 VectorIO test: make it work in sequential as well (added in the test suite).

parent 1a11b197
add_executable(MoReFEMTestPetscVectorBinary
add_executable(MoReFEMTestPetscVectorIO
${CMAKE_CURRENT_LIST_DIR}/main.cpp
${CMAKE_CURRENT_LIST_DIR}/InputData.hpp
${CMAKE_CURRENT_LIST_DIR}/Model.cpp
......@@ -6,15 +6,22 @@ add_executable(MoReFEMTestPetscVectorBinary
${CMAKE_CURRENT_LIST_DIR}/Model.hxx
)
target_link_libraries(MoReFEMTestPetscVectorBinary
target_link_libraries(MoReFEMTestPetscVectorIO
${MOREFEM_TEST_TOOLS}
)
add_test(PetscVectorBinary
add_test(PetscVectorIO
MoReFEMTestPetscVectorIO
--
${MOREFEM_ROOT}
${MOREFEM_TEST_OUTPUT_DIR}/Seq)
add_test(PetscVectorIO-mpi
${OPEN_MPI_INCL_DIR}/../bin/mpirun
--oversubscribe
-np 4
MoReFEMTestPetscVectorBinary
MoReFEMTestPetscVectorIO
--
${MOREFEM_ROOT}
${MOREFEM_TEST_OUTPUT_DIR})
${MOREFEM_TEST_OUTPUT_DIR}/Mpi4)
......@@ -85,6 +85,35 @@ BOOST_FIXTURE_TEST_SUITE(processor_wise, fixture_type)
BOOST_CHECK(FilesystemNS::File::DoExist(binary_file) == true);
}
BOOST_AUTO_TEST_CASE(load_ascii)
{
decltype(auto) model = GetModel();
decltype(auto) mpi = model.GetMpi();
std::string binary_file = model.GetProcessorWiseAsciiFile();
BOOST_CHECK(FilesystemNS::File::DoExist(binary_file) == true); // created in previous test!
decltype(auto) vector = model.GetVector();
//
//
// std::string inequality_description;
// Wrappers::Petsc::AreEqual(from_file,
// vector,
// NumericNS::DefaultEpsilon<double>(),
// inequality_description,
// __FILE__, __LINE__);
//
// BOOST_CHECK_EQUAL(inequality_description, "");
}
BOOST_AUTO_TEST_CASE(load_binary)
{
}
BOOST_AUTO_TEST_SUITE_END()
......@@ -130,12 +159,19 @@ BOOST_FIXTURE_TEST_SUITE(program_wise, fixture_type)
std::string binary_file = model.GetProgramWiseBinaryFile();
BOOST_CHECK(FilesystemNS::File::DoExist(binary_file) == true); // created in previous test!
decltype(auto) vector = model.GetVector();
Wrappers::Petsc::Vector from_file(mpi,
static_cast<unsigned int>(vector.GetProcessorWiseSize(__FILE__, __LINE__)),
static_cast<unsigned int>(vector.GetProgramWiseSize(__FILE__, __LINE__)),
vector.GetGhostPadding(),
binary_file,
__FILE__, __LINE__);
Wrappers::Petsc::Vector from_file;
std::vector<PetscInt> ghost_padding;
if (mpi.Nprocessor<int>() > 1)
ghost_padding = vector.GetGhostPadding();
from_file.InitFromProgramWiseBinaryFile(mpi,
static_cast<unsigned int>(vector.GetProcessorWiseSize(__FILE__, __LINE__)),
static_cast<unsigned int>(vector.GetProgramWiseSize(__FILE__, __LINE__)),
ghost_padding,
binary_file,
__FILE__, __LINE__);
std::string inequality_description;
Wrappers::Petsc::AreEqual(from_file,
......@@ -147,6 +183,8 @@ BOOST_FIXTURE_TEST_SUITE(program_wise, fixture_type)
BOOST_CHECK_EQUAL(inequality_description, "");
}
// No load_ascii: not foreseen apparently in PETSc interface!
BOOST_AUTO_TEST_SUITE_END()
......
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