"src/scheme/HyperelasticSolver.hpp" did not exist on "b1d83081bcfacf2f61fe483e79de17a1ff83ccaf"
Select Git revision
ReadArray.hpp
test_InterpolateItemArray.cpp 18.60 KiB
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp>
#include <language/ast/ASTBuilder.hpp>
#include <language/ast/ASTModulesImporter.hpp>
#include <language/ast/ASTNodeDataTypeBuilder.hpp>
#include <language/ast/ASTNodeExpressionBuilder.hpp>
#include <language/ast/ASTNodeFunctionEvaluationExpressionBuilder.hpp>
#include <language/ast/ASTNodeFunctionExpressionBuilder.hpp>
#include <language/ast/ASTNodeTypeCleaner.hpp>
#include <language/ast/ASTSymbolTableBuilder.hpp>
#include <language/utils/PugsFunctionAdapter.hpp>
#include <language/utils/SymbolTable.hpp>
#include <MeshDataBaseForTests.hpp>
#include <mesh/Connectivity.hpp>
#include <mesh/Mesh.hpp>
#include <mesh/MeshData.hpp>
#include <mesh/MeshDataManager.hpp>
#include <language/utils/InterpolateItemArray.hpp>
#include <pegtl/string_input.hpp>
// clazy:excludeall=non-pod-global-static
TEST_CASE("InterpolateItemArray", "[language]")
{
SECTION("interpolate on all items")
{
auto same_cell_array = [](auto f, auto g) -> bool {
using ItemIdType = typename decltype(f)::index_type;
for (ItemIdType item_id = 0; item_id < f.numberOfItems(); ++item_id) {
for (size_t i = 0; i < f.sizeOfArrays(); ++i) {
if (f[item_id][i] != g[item_id][i]) {
return false;
}
}
}
return true;
};
SECTION("1D")
{
constexpr size_t Dimension = 1;
std::array mesh_list = MeshDataBaseForTests::get().all1DMeshes();
for (const auto& named_mesh : mesh_list) {
SECTION(named_mesh.name())
{
auto mesh_1d = named_mesh.mesh();
auto xj = MeshDataManager::instance().getMeshData(*mesh_1d).xj();
std::string_view data = R"(
import math;
let scalar_affine_1d: R^1 -> R, x -> 2*x[0] + 2;
let scalar_non_linear_1d: R^1 -> R, x -> 2 * exp(x[0]) + 3;
)";
TAO_PEGTL_NAMESPACE::string_input input{data, "test.pgs"};
auto ast = ASTBuilder::build(input);
ASTModulesImporter{*ast};
ASTNodeTypeCleaner<language::import_instruction>{*ast};
ASTSymbolTableBuilder{*ast};