Commit ec002c54 authored by DIAZ Jerome's avatar DIAZ Jerome Committed by GILLES Sebastien

#1418 CI test for the microsphere operator, in the same spirit as the ones...

#1418 CI test for the microsphere operator, in the same spirit as the ones used for the ModelInstances.
parent e97f679c
Vector per node
0.000000 0.000000 1.000000 0.000000 0.000000 1.000000
0.000000 0.000000 1.000000 0.000000 0.000000 1.000000
0.000000 0.000000 1.000000 0.000000 0.000000 1.000000
0.000000 0.000000 1.000000 0.000000 0.000000 1.000000
Vector per node
1.000000 0.000000 0.000000 1.000000 0.000000 0.000000
1.000000 0.000000 0.000000 1.000000 0.000000 0.000000
1.000000 0.000000 0.000000 1.000000 0.000000 0.000000
1.000000 0.000000 0.000000 1.000000 0.000000 0.000000
......@@ -13,3 +13,57 @@ target_link_libraries(MoReFEMTestMicrosphere
${ALL_LOAD_BEGIN_FLAG}
${MOREFEM_MODEL}
${ALL_LOAD_END_FLAG})
add_executable(MoReFEMTestMicrosphereEnsightOutput ${CMAKE_CURRENT_LIST_DIR}/main_ensight_output.cpp)
target_link_libraries(MoReFEMTestMicrosphereEnsightOutput
${MOREFEM_POST_PROCESSING})
add_executable(MoReFEMTestMicrosphereCheckResults ${CMAKE_CURRENT_LIST_DIR}/test_results.cpp)
target_link_libraries(MoReFEMTestMicrosphereCheckResults
${MOREFEM_TEST_TOOLS})
add_test(Microsphere
MoReFEMTestMicrosphere
--overwrite_directory
-e MOREFEM_ROOT=${MOREFEM_ROOT}
-i ${MOREFEM_ROOT}/Sources/Test/Operators/VariationalInstances/Microsphere/demo_microsphere.lua
-e MOREFEM_RESULT_DIR=${MOREFEM_TEST_OUTPUT_DIR}/Seq)
set_tests_properties(Microsphere PROPERTIES TIMEOUT 10)
add_test(Microsphere-mpi
${OPEN_MPI_INCL_DIR}/../bin/mpirun
--oversubscribe
-np 4 MoReFEMTestMicrosphere
--overwrite_directory
-e MOREFEM_ROOT=${MOREFEM_ROOT}
-i ${MOREFEM_ROOT}/Sources/Test/Operators/VariationalInstances/Microsphere/demo_microsphere.lua
-e MOREFEM_RESULT_DIR=${MOREFEM_TEST_OUTPUT_DIR}/Mpi4)
set_tests_properties(Microsphere-mpi PROPERTIES TIMEOUT 10)
add_test(MicrosphereModelEnsightOutput
MoReFEMTestMicrosphereEnsightOutput
-e MOREFEM_ROOT=${MOREFEM_ROOT}
-i ${MOREFEM_TEST_OUTPUT_DIR}/Seq/Microsphere/Rank_0/input_data.lua
-e MOREFEM_RESULT_DIR=${MOREFEM_TEST_OUTPUT_DIR}/Seq)
set_tests_properties(MicrosphereModelEnsightOutput PROPERTIES TIMEOUT 10)
add_test(MicrosphereModelEnsightOutput-mpi
MoReFEMTestMicrosphereEnsightOutput
-e MOREFEM_ROOT=${MOREFEM_ROOT}
-i ${MOREFEM_TEST_OUTPUT_DIR}/Mpi4/Microsphere/Rank_0/input_data.lua
-e MOREFEM_RESULT_DIR=${MOREFEM_TEST_OUTPUT_DIR}/Mpi4)
set_tests_properties(MicrosphereModelEnsightOutput-mpi PROPERTIES TIMEOUT 10)
add_test(MicrosphereCheckResults
MoReFEMTestMicrosphereCheckResults
--
${MOREFEM_ROOT}
${MOREFEM_TEST_OUTPUT_DIR}
)
set_tests_properties(MicrosphereCheckResults PROPERTIES TIMEOUT 10)
First line which content must be chosen (but later)
0.00000e+00 0.00000e+00 0.00000e+00 1.00000e-01 0.00000e+00 6.34996e-08
1.50000e-01-1.00000e-01-3.28380e-08 4.99999e-02-1.00000e-01 0.00000e+00
0.00000e+00-5.38981e-09 1.01010e-02 1.00000e-01 1.21630e-07 1.01011e-02
1.50000e-01-9.99999e-02 1.01010e-02 4.99999e-02-1.00000e-01 1.01010e-02
Geometry file
Geometry file
node id assign
element id assign
coordinates
8
0.00000e+00 0.00000e+00 0.00000e+00
1.00000e+00 0.00000e+00 0.00000e+00
1.00000e+00 1.00000e+00 0.00000e+00
0.00000e+00 1.00000e+00 0.00000e+00
0.00000e+00 0.00000e+00 1.00000e+00
1.00000e+00 0.00000e+00 1.00000e+00
1.00000e+00 1.00000e+00 1.00000e+00
0.00000e+00 1.00000e+00 1.00000e+00
part 1
MeshLabel 1
quad4
1
5 1 4 8
part 2
MeshLabel 2
quad4
1
1 2 6 5
part 3
MeshLabel 3
quad4
1
1 2 3 4
part 4
MeshLabel 4
quad4
1
6 2 3 7
part 5
MeshLabel 5
quad4
1
8 7 3 4
part 6
MeshLabel 6
quad4
1
5 6 7 8
part 7
MeshLabel 30
hexa8
1
1 2 3 4 5 6 7 8
part 8
MeshLabel 201
bar2
1
1 2
part 9
MeshLabel 202
bar2
1
2 3
part 10
MeshLabel 203
bar2
1
3 4
part 11
MeshLabel 204
bar2
1
4 1
part 12
MeshLabel 211
bar2
1
5 6
part 13
MeshLabel 212
bar2
1
6 7
part 14
MeshLabel 213
bar2
1
7 8
part 15
MeshLabel 214
bar2
1
8 5
part 16
MeshLabel 231
bar2
1
8 4
part 17
MeshLabel 232
bar2
1
3 7
part 18
MeshLabel 233
bar2
1
5 1
part 19
MeshLabel 234
bar2
1
2 6
FORMAT
type: ensight
GEOMETRY
model: 1 mesh.geo
VARIABLE
vector per node: 1 displacement displacement.*****.scl
TIME
time set: 1
number of steps: 1
filename numbers: 0
time values: 0
Ndof (processor_wise) = 24
# First column: program-wise index.
# Second column: processor-wise index.
# Third column: the interface upon which the dof is located. Look at the interface file in same directory to relate it to the initial mesh.
# Fourth column: unknown and component involved.
# Fifth column: shape function label.
0;0;Vertex 0;displacement 0;Q1
1;1;Vertex 0;displacement 1;Q1
2;2;Vertex 0;displacement 2;Q1
3;3;Vertex 1;displacement 0;Q1
4;4;Vertex 1;displacement 1;Q1
5;5;Vertex 1;displacement 2;Q1
6;6;Vertex 2;displacement 0;Q1
7;7;Vertex 2;displacement 1;Q1
8;8;Vertex 2;displacement 2;Q1
9;9;Vertex 3;displacement 0;Q1
10;10;Vertex 3;displacement 1;Q1
11;11;Vertex 3;displacement 2;Q1
12;12;Vertex 4;displacement 0;Q1
13;13;Vertex 4;displacement 1;Q1
14;14;Vertex 4;displacement 2;Q1
15;15;Vertex 5;displacement 0;Q1
16;16;Vertex 5;displacement 1;Q1
17;17;Vertex 5;displacement 2;Q1
18;18;Vertex 6;displacement 0;Q1
19;19;Vertex 6;displacement 1;Q1
20;20;Vertex 6;displacement 2;Q1
21;21;Vertex 7;displacement 0;Q1
22;22;Vertex 7;displacement 1;Q1
23;23;Vertex 7;displacement 2;Q1
0.000000e+00
0.000000e+00
0.000000e+00
9.99999976365945619783e-02
0.00000000000000000000e+00
6.34996212461000439592e-08
1.49999930074123627444e-01
-9.99999846131778419300e-02
-3.28379867350209213408e-08
4.99999240277797310505e-02
-1.00000025776873349703e-01
0.00000000000000000000e+00
0.00000000000000000000e+00
-5.38980834955615299195e-09
1.01010359189037408206e-02
9.99999978807273037784e-02
1.21630434836245503511e-07
1.01010684409425441355e-02
1.49999917449689545990e-01
-9.99998837670754148199e-02
1.01009780100701010430e-02
4.99999091768327935670e-02
-1.00000004176497431230e-01
1.01010063954053413288e-02
#For each geometric interface, give the list of the Coords that delimits it. The index shown is the position of the Coords in the generated mesh (regardless of the convention used in the original mesh format).
Vertex 0;[0]
Vertex 1;[1]
Vertex 2;[2]
Vertex 3;[3]
Vertex 4;[4]
Vertex 5;[5]
Vertex 6;[6]
Vertex 7;[7]
Edge 0;[1, 2]
Edge 1;[2, 3]
Edge 2;[3, 4]
Edge 3;[1, 4]
Edge 4;[5, 6]
Edge 5;[6, 7]
Edge 6;[7, 8]
Edge 7;[5, 8]
Edge 8;[4, 8]
Edge 9;[3, 7]
Edge 10;[1, 5]
Edge 11;[2, 6]
Face 0;[1, 4, 5, 8]
Face 1;[1, 2, 5, 6]
Face 2;[1, 2, 3, 4]
Face 3;[2, 3, 6, 7]
Face 4;[3, 4, 7, 8]
Face 5;[5, 6, 7, 8]
Volume 0;[1, 2, 3, 4, 5, 6, 7, 8]
# Time iteration; time; numbering subset id; filename
0;0;1;/Volumes/Data/jerome/MoReFEM/Results/Microsphere/Rank_*/Mesh_1//NumberingSubset_1/solution_time_00000.hhdata
......@@ -191,7 +191,7 @@ namespace MoReFEM
using InputData = InputData<InputDataTuple>;
//! \copydoc doxygen_hide_morefem_data_type
using morefem_data_type = MoReFEMData<InputData, program_type::test>;
using morefem_data_type = MoReFEMData<InputData, program_type::model>;
} // namespace TestNS::Microsphere
......
......@@ -22,7 +22,7 @@ namespace MoReFEM
inline const std::string& Model::ClassName()
{
static std::string name("Validation");
static std::string name("Test Microsphere");
return name;
}
......
......@@ -1200,7 +1200,7 @@ Result = {
-- MOREFEM_RESULT_DIR, which is either provided in user's environment or automatically set to
-- '/Volumes/Data/${USER}/MoReFEM/Results' in MoReFEM initialization step.
-- Expected format: "VALUE"
output_directory = "${MOREFEM_TEST_OUTPUT_DIR}/Microsphere",
output_directory = "${MOREFEM_RESULT_DIR}/Microsphere",
-- Enables to skip some printing in the console. Can be used to WriteSolution every n time.
-- Expected format: VALUE
......
......@@ -25,7 +25,7 @@ int main(int argc, char** argv)
try
{
MoReFEMData<InputData, program_type::test> morefem_data(argc, argv);
MoReFEMData<InputData, program_type::model> morefem_data(argc, argv);
decltype(auto) input_data = morefem_data.GetInputData();
decltype(auto) mpi = morefem_data.GetMpi();
......
//! \file
//
//
// main_ensight_output.cpp
// MoReFEM
//
// Created by Jerôme Diaz on 23/01/2019.
//Copyright © 2019 Jerôme Diaz. All rights reserved.
//
#include "Utilities/Exceptions/PrintAndAbort.hpp"
#include "Core/MoReFEMData/MoReFEMData.hpp"
#include "Core/NumberingSubset/Internal/NumberingSubsetManager.hpp"
#include "Geometry/Mesh/Internal/MeshManager.hpp"
#include "PostProcessing/OutputFormat/Ensight6.hpp"
#include "PostProcessing/PostProcessing.hpp"
#include "Model.hpp"
#include "InputData.hpp"
using namespace MoReFEM;
using namespace MoReFEM::TestNS::Microsphere;
int main(int argc, char** argv)
{
try
{
//! \copydoc doxygen_hide_model_specific_input_data
using InputData = TestNS::Microsphere::InputData;
MoReFEMData<InputData, program_type::post_processing, Utilities::InputDataNS::DoTrackUnusedFields::no> morefem_data(argc, argv);
const auto& input_data = morefem_data.GetInputData();
const auto& mpi = morefem_data.GetMpi();
try
{
namespace ipl = Utilities::InputDataNS;
using Result = InputDataNS::Result;
decltype(auto) result_directory_path = ipl::Extract<Result::OutputDirectory>::Path(input_data);
FilesystemNS::Directory result_directory(mpi,
result_directory_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
decltype(auto) mesh_manager = Internal::MeshNS::MeshManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, mesh_manager);
const Mesh& mesh = mesh_manager.GetMesh(EnumUnderlyingType(MeshIndex::mesh));
{
decltype(auto) manager = Internal::NumberingSubsetNS::NumberingSubsetManager::CreateOrGetInstance(__FILE__, __LINE__);
MoReFEM::Advanced::SetFromInputData<>(input_data, manager);
}
{
std::vector<unsigned int> numbering_subset_id_list
{
EnumUnderlyingType(NumberingSubsetIndex::displacement)
};
std::vector<std::string> unknown_list
{
"displacement"
};
PostProcessingNS::OutputFormat::Ensight6 ensight_output(result_directory,
unknown_list,
numbering_subset_id_list,
mesh);
}
std::cout << "End of Post-Processing." << std::endl;
std::cout << TimeKeep::GetInstance(__FILE__, __LINE__).TimeElapsedSinceBeginning() << std::endl;
}
catch(const std::exception& e)
{
ExceptionNS::PrintAndAbort(mpi, e.what());
}
catch(Seldon::Error& e)
{
ExceptionNS::PrintAndAbort(mpi, e.What());
}
}
catch(const std::exception& e)
{
std::ostringstream oconv;
oconv << "Exception caught from MoReFEMData<InputData>: " << e.what() << std::endl;
std::cout << oconv.str();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//
// test_results.cpp
// MoReFEM
//
// Created by Jérôme Diaz on 31/10/2019.
// Copyright © 2019 Inria. All rights reserved.
//
#define BOOST_TEST_MODULE microsphere
#include "ThirdParty/IncludeWithoutWarning/Boost/Test.hpp"
#include "Utilities/Filesystem/File.hpp"
#include "ModelInstances/Hyperelasticity/InputData.hpp"
using namespace MoReFEM;
#include "Test/Tools/CheckIdenticalFiles.hpp"
#include "Test/Tools/CompareEnsightFiles.hpp"
#include "Test/Tools/Fixture/Environment.hpp"
namespace // anonymous
{
void CommonTestCase(std::string&& seq_or_par);
} // namespace anonymous
PRAGMA_DIAGNOSTIC(push)
# ifdef __clang__
PRAGMA_DIAGNOSTIC(ignored "-Wdisabled-macro-expansion")
# endif // __clang__
BOOST_FIXTURE_TEST_CASE(sequential, TestNS::FixtureNS::Environment)
{
CommonTestCase("Seq");
}
BOOST_FIXTURE_TEST_CASE(mpi4, TestNS::FixtureNS::Environment)
{
CommonTestCase("Mpi4");
}
PRAGMA_DIAGNOSTIC(pop)
namespace // anonymous
{
void CommonTestCase(std::string&& seq_or_par)
{
decltype(auto) environment = Utilities::Environment::GetInstance(__FILE__, __LINE__);
std::string root_dir, output_dir;
/* BOOST_REQUIRE_NO_THROW */(root_dir = environment.GetEnvironmentVariable("MOREFEM_ROOT", __FILE__, __LINE__));
/* BOOST_REQUIRE_NO_THROW */(output_dir = environment.GetEnvironmentVariable("MOREFEM_TEST_OUTPUT_DIR", __FILE__, __LINE__));
BOOST_REQUIRE(Advanced::FilesystemNS::DirectoryNS::DoExist(root_dir));
BOOST_REQUIRE(Advanced::FilesystemNS::DirectoryNS::DoExist(output_dir));
std::string ref_dir_path = root_dir + "/Sources/Test/Operators/VariationalInstances/Microsphere/ExpectedResults/Rank_0";
std::string obtained_dir_path = output_dir + std::string("/") + seq_or_par
+ std::string("/Microsphere/") + std::string("/Rank_0");
FilesystemNS::Directory ref_dir(ref_dir_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
FilesystemNS::Directory obtained_dir(obtained_dir_path,
FilesystemNS::behaviour::read,
__FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "input_data.lua", __FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "model_name.hhdata", __FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "unknowns.hhdata", __FILE__, __LINE__);
ref_dir.AddSubdirectory("Mesh_1", __FILE__, __LINE__);
obtained_dir.AddSubdirectory("Mesh_1", __FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "interfaces.hhdata", __FILE__, __LINE__);
ref_dir.AddSubdirectory("Ensight6", __FILE__, __LINE__);
obtained_dir.AddSubdirectory("Ensight6", __FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "mesh.geo", __FILE__, __LINE__);
TestNS::CheckIdenticalFiles(ref_dir, obtained_dir, "problem.case", __FILE__, __LINE__);
std::ostringstream oconv;
oconv.str("");
oconv << "displacement." << std::setw(5) << std::setfill('0') << 0 << ".scl";
TestNS::CompareEnsightFiles(ref_dir, obtained_dir, oconv.str(), __FILE__, __LINE__);
}
} // namespace anonymous
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