Commit 29c5b3e0 authored by GILLES Sebastien's avatar GILLES Sebastien

#1520 Test GlobalCoordsQuadPt: Remove the hardcoded output directory and use...

#1520 Test GlobalCoordsQuadPt: Remove the hardcoded output directory and use instead the one extracted from the Lua file.
parent 15787a3b
......@@ -23,6 +23,7 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
void CheckQuadratureRule(const QuadratureRulePerTopology& quadrature_rule_per_topology,
const ParameterAtQuadraturePoint<ParameterNS::Type::vector>& global_coords,
const FilesystemNS::Directory& result_directory_path,
std::string_view quadrature_order);
......@@ -89,28 +90,29 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
write_at_quad_pt_operator.Update();
CheckQuadratureRule(*quadrature_rule, global_coords_quad_pt, quadrature_order);
CheckQuadratureRule(*quadrature_rule, global_coords_quad_pt, GetOutputDirectory(), quadrature_order);
}
void Model::CheckLowOrderQuadrature() const
{
auto rule = std::make_unique<const QuadratureRulePerTopology>(1, 1);
CheckQuadrature(rule.get(), "low");
CheckQuadrature(rule.get(), "low_order_global_coords.txt");
}
void Model::CheckMediumOrderQuadrature() const
{
auto rule = std::make_unique<const QuadratureRulePerTopology>(3, 3);
CheckQuadrature(rule.get(), "medium");
CheckQuadrature(rule.get(), "medium_order_global_coords.txt");
}
void Model::CheckHighOrderQuadrature() const
{
auto rule = std::make_unique<const QuadratureRulePerTopology>(5, 5);
CheckQuadrature(rule.get(), "high");
CheckQuadrature(rule.get(), "high_order_global_coords.txt");
}
void Model::Forward()
......@@ -131,6 +133,7 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
void CheckQuadratureRule(const QuadratureRulePerTopology& quadrature_rule_per_topology,
const ParameterAtQuadraturePoint<ParameterNS::Type::vector>& obtained_global_coords,
const FilesystemNS::Directory& result_directory_path,
std::string_view quadrature_order)
{
decltype(auto) domain = DomainManager::GetInstance(__FILE__, __LINE__)
......@@ -181,18 +184,12 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
for (auto i = Ndimension; i < 3; ++i)
expected_global_coords.push_back(0.);
}
decltype(auto) environment = Utilities::Environment::GetInstance(__FILE__, __LINE__);
std::string output_dir = environment.SubstituteValues("${MOREFEM_TEST_OUTPUT_DIR}/Operators/GlobalCoordsQuadPts/");
output_dir += ref_geom_elt.GetTopologyName();
if (!Advanced::FilesystemNS::DirectoryNS::DoExist(output_dir))
Advanced::FilesystemNS::DirectoryNS::Create(output_dir, __FILE__, __LINE__);
std::string output_file(output_dir);
output_file += "/" + std::string(quadrature_order) + "_order_global_coords.txt";
FilesystemNS::Directory output_directory(result_directory_path,
ref_geom_elt.GetTopologyName(),
__FILE__, __LINE__);
const std::string output_file = output_directory.AddFile(quadrature_order);
obtained_global_coords.Write(output_file);
// Read from output and compare results.
......
......@@ -113,6 +113,21 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
void SupplFinalize();
//! \copydoc doxygen_hide_model_SupplHasFinishedConditions_always_true
bool SupplHasFinishedConditions() const;
/*!
* \brief Part of InitializedStep() specific to Elastic model.
*
* As there are none, the body of this method is empty.
*/
void SupplInitializeStep();
///@}
public:
/*!
......@@ -135,6 +150,9 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
private:
//! Accessor to the directory object which holds the main output directory.
const FilesystemNS::Directory& GetOutputDirectory() const noexcept;
/*!
* \brief Checks that the global coordinates for the quadrature given as argument are the expected ones.
*
......@@ -144,21 +162,6 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
std::string_view quadrature_order) const;
//! \copydoc doxygen_hide_model_SupplHasFinishedConditions_always_true
bool SupplHasFinishedConditions() const;
/*!
* \brief Part of InitializedStep() specific to Elastic model.
*
* As there are none, the body of this method is empty.
*/
void SupplInitializeStep();
///@}
};
......
......@@ -33,6 +33,12 @@ namespace MoReFEM::TestNS::GlobalCoordsQuadPt
{ }
inline const FilesystemNS::Directory& Model::GetOutputDirectory() const noexcept
{
return GetMoReFEMData().GetResultDirectory();
}
} // namespace MoReFEM::TestNS::GlobalCoordsQuadPt
......
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