Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nektar/redesign-prototypes
1 result
Show changes
Commits on Source (4)
......@@ -42,6 +42,15 @@ target_include_directories(test_ipwrtbase PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_ipwrtbase PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
add_executable(test_ipwrtbase_matfree test_ipwrtbase_matfree.cpp)
target_link_libraries(test_ipwrtbase_matfree PRIVATE Operators)
target_link_libraries(test_ipwrtbase_matfree PRIVATE ${NEKTAR++_LIBRARIES})
target_link_libraries(test_ipwrtbase_matfree PRIVATE Boost::unit_test_framework)
target_include_directories(test_ipwrtbase_matfree PRIVATE "${CMAKE_SOURCE_DIR}")
target_include_directories(test_ipwrtbase_matfree PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_ipwrtbase_matfree PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
IF (NEKTAR_USE_CUDA)
add_executable(test_ipwrtbasecuda test_ipwrtbasecuda.cpp)
target_link_libraries(test_ipwrtbasecuda PRIVATE Operators)
......@@ -62,6 +71,15 @@ target_include_directories(test_physderiv PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_physderiv PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
add_executable(test_physderiv_matfree test_physderiv_matfree.cpp)
target_link_libraries(test_physderiv_matfree PRIVATE Operators)
target_link_libraries(test_physderiv_matfree PRIVATE ${NEKTAR++_LIBRARIES})
target_link_libraries(test_physderiv_matfree PRIVATE Boost::unit_test_framework)
target_include_directories(test_physderiv_matfree PRIVATE "${CMAKE_SOURCE_DIR}")
target_include_directories(test_physderiv_matfree PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_physderiv_matfree PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
IF (NEKTAR_USE_CUDA)
add_executable(test_physderivcuda test_physderivcuda.cpp)
target_link_libraries(test_physderivcuda PRIVATE Operators)
......@@ -93,6 +111,26 @@ IF (NEKTAR_USE_CUDA)
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
ENDIF()
add_executable(test_helmholtz test_helmholtz.cpp)
target_link_libraries(test_helmholtz PRIVATE Operators)
target_link_libraries(test_helmholtz PRIVATE ${NEKTAR++_LIBRARIES})
target_link_libraries(test_helmholtz PRIVATE Boost::unit_test_framework)
target_include_directories(test_helmholtz PRIVATE "${CMAKE_SOURCE_DIR}")
target_include_directories(test_helmholtz PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_helmholtz PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
IF (NEKTAR_USE_CUDA)
add_executable(test_helmholtzcuda test_physderivcuda.cpp)
target_link_libraries(test_helmholtzcuda PRIVATE Operators)
target_link_libraries(test_helmholtzcuda PRIVATE ${NEKTAR++_LIBRARIES})
target_link_libraries(test_helmholtzcuda PRIVATE Boost::unit_test_framework)
target_include_directories(test_helmholtzcuda PRIVATE "${CMAKE_SOURCE_DIR}")
target_include_directories(test_helmholtzcuda PRIVATE ${NEKTAR++_INCLUDE_DIRS})
target_compile_definitions(test_helmholtzcuda PRIVATE
-DTEST_PATH="${CMAKE_SOURCE_DIR}")
ENDIF()
add_test(
NAME BwdTrans
COMMAND test_bwdtrans
......@@ -119,6 +157,12 @@ add_test(
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_test(
NAME IProductWRTBaseMatFree
COMMAND test_ipwrtbase_matfree
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
IF (NEKTAR_USE_CUDA)
add_test(
NAME IProductWRTBaseCUDA
......@@ -133,6 +177,12 @@ add_test(
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
add_test(
NAME PhysDerivMatFree
COMMAND test_physderiv_matfree
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
IF (NEKTAR_USE_CUDA)
add_test(
NAME PhysDerivCUDA
......@@ -154,3 +204,17 @@ IF (NEKTAR_USE_CUDA)
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
ENDIF()
add_test(
NAME Helmholtz
COMMAND test_helmholtz
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
IF (NEKTAR_USE_CUDA)
add_test(
NAME HelmholtzCUDA
COMMAND test_helmholtzcuda
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
ENDIF()
......@@ -128,11 +128,13 @@ public:
{
for (size_t phys = 0; phys < block.num_pts; ++phys)
{
if (fabs(*(outptr++) - *(expptr++)) > tol)
if (fabs(*outptr - *expptr) > tol)
{
printf("%04zu %04zu %20.16f %20.16f %20.16f\n", el,
phys, *outptr, *expptr, fabs(*outptr - *expptr));
}
expptr++;
outptr++;
}
}
}
......
#include "init_fields.hpp"
using namespace std;
using namespace Nektar::Operators;
using namespace Nektar::LibUtilities;
using namespace Nektar;
class HelmholtzField
: public InitFields<double, FieldState::Coeff, FieldState::Coeff>
{
public:
HelmholtzField() : InitFields<double, FieldState::Coeff, FieldState::Coeff>()
{
}
void SetTestCase(const std::vector<BlockAttributes> &blocks, double *inptr,
bool padding = true)
{
for (auto const &block : fixt_in->GetBlocks())
{
for (size_t el = 0; el < block.num_elements; ++el)
{
for (size_t coeff = 0; coeff < block.num_pts; ++coeff)
{
*(inptr++) = coeff;
}
}
if (padding)
{
for (size_t el = 0; el < block.num_padding_elements; ++el)
{
for (size_t coeff = 0; coeff < block.num_pts; ++coeff)
{
inptr++;
}
}
}
}
}
void ExpectedSolution(const std::vector<BlockAttributes> &blocks,
double *inptr)
{
Array<OneD, NekDouble> incoeffs(fixt_explist->GetNcoeffs());
Array<OneD, NekDouble> bwdtrans(fixt_explist->GetTotPoints());
Array<OneD, NekDouble> deriv(fixt_explist->GetCoordim(0) *
fixt_explist->GetTotPoints());
Array<OneD, NekDouble> deriv0 = deriv;
Array<OneD, NekDouble> deriv1 = deriv0 + fixt_explist->GetTotPoints();
Array<OneD, NekDouble> deriv2 = deriv1 + fixt_explist->GetTotPoints();
Array<OneD, Array<OneD, NekDouble>> derivarray(fixt_explist->GetCoordim(0));
if (fixt_explist->GetCoordim(0) > 0)
{
derivarray[0] = deriv0;
}
if (fixt_explist->GetCoordim(0) > 1)
{
derivarray[1] = deriv1;
}
if (fixt_explist->GetCoordim(0) > 2)
{
derivarray[2] = deriv2;
}
Array<OneD, NekDouble> mass(fixt_explist->GetNcoeffs());
Array<OneD, NekDouble> outcoeffs(fixt_explist->GetNcoeffs());
// Set test case
SetTestCase(blocks, incoeffs.get(), false);
// Calculate expected result from Nektar++
fixt_explist->BwdTrans(incoeffs, bwdtrans);
fixt_explist->PhysDeriv(bwdtrans, deriv0, deriv1, deriv2);
fixt_explist->IProductWRTDerivBase(derivarray, outcoeffs);
fixt_explist->IProductWRTBase(bwdtrans, mass);
// Copy expected result from Array to fixt_expected
double *coeffptr = outcoeffs.get();
double *massptr = mass.get();
for (auto const &block : blocks)
{
for (size_t el = 0; el < block.num_elements; ++el)
{
for (size_t coeff = 0; coeff < block.num_pts; ++coeff)
{
(*inptr++) = (*coeffptr++) + (*massptr++);
}
}
for (size_t el = 0; el < block.num_padding_elements; ++el)
{
for (size_t coeff = 0; coeff < block.num_pts; ++coeff)
{
inptr++;
}
}
}
}
};
class Seg : public HelmholtzField
{
public:
Seg()
{
meshName = "line.xml";
}
};
class Quad : public HelmholtzField
{
public:
Quad()
{
meshName = "square.xml";
}
};
class Tri : public HelmholtzField
{
public:
Tri()
{
meshName = "run/tri.xml";
}
};
class SquareAllElements : public HelmholtzField
{
public:
SquareAllElements()
{
meshName = "run/square_all_elements.xml";
}
};
class Hex : public HelmholtzField
{
public:
Hex()
{
meshName = "run/hex.xml";
}
};
class Prism : public HelmholtzField
{
public:
Prism()
{
meshName = "run/prism.xml";
}
};
class Pyr : public HelmholtzField
{
public:
Pyr()
{
meshName = "run/pyr.xml";
}
};
class Tet : public HelmholtzField
{
public:
Tet()
{
meshName = "run/tet.xml";
}
};
class CubePrismHex : public HelmholtzField
{
public:
CubePrismHex()
{
meshName = "run/cube_prismhex.xml";
}
};
class CubeAllElements : public HelmholtzField
{
public:
CubeAllElements()
{
meshName = "run/cube_all_elements.xml";
}
};
#define BOOST_TEST_MODULE TestHelmholtz
#include <boost/test/tools/output_test_stream.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <memory>
#include "Operators/OperatorHelmholtz.hpp"
#include "init_helmholtzfields.hpp"
BOOST_AUTO_TEST_SUITE(TestHelmholtz)
using namespace std;
using namespace Nektar::Operators;
using namespace Nektar::LibUtilities;
using namespace Nektar;
BOOST_FIXTURE_TEST_CASE(helmholtz_seg, Seg)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_quad, Quad)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_tri, Tri)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_square_all_elements, SquareAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_hex, Hex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_prism, Prism)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_pyr, Pyr)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_tet, Tet)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_cube_prism_hex, CubePrismHex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtz_cube_all_elements, CubeAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_out);
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_TEST_MODULE TestHelmholtzCUDA
#include <boost/test/tools/output_test_stream.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <memory>
#include "Operators/OperatorHelmholtz.hpp"
#include "init_helmholtzfields.hpp"
BOOST_AUTO_TEST_SUITE(TestHelmholtzCUDA)
using namespace std;
using namespace Nektar::Operators;
using namespace Nektar::LibUtilities;
using namespace Nektar;
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_seg, Seg)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_quad, Quad)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_tri, Tri)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_square_all_elements, SquareAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_hex, Hex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_prism, Prism)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_pyr, Pyr)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_tet, Tet)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_cube_prism_hex, CubePrismHex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(helmholtzcuda_cube_all_elements, CubeAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
SetTestCase(
fixtcuda_in->GetBlocks(),
fixtcuda_in->template GetStorage<MemoryRegionCUDA>().GetCPUPtr());
Helmholtz<>::create(fixt_explist, "StdMat")->apply(*fixt_in, *fixt_expected);
Helmholtz<>::create(fixt_explist, "CUDA")
->apply(*fixtcuda_in, *fixtcuda_out);
BOOST_TEST(fixtcuda_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixtcuda_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_TEST_MODULE TestIProductWRTBase
#include <boost/test/tools/output_test_stream.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <memory>
#include "Operators/OperatorIProductWRTBase.hpp"
#include "init_ipwrtbasefields.hpp"
BOOST_AUTO_TEST_SUITE(TestIProductWRTBase)
using namespace std;
using namespace Nektar::Operators;
using namespace Nektar::LibUtilities;
using namespace Nektar;
BOOST_FIXTURE_TEST_CASE(ipwrtbase_seg, Seg)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_quad, Quad)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_tri, Tri)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_square_all_elements, SquareAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_hex, Hex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_prism, Prism)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_pyr, Pyr)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_tet, Tet)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_cube_prism_hex, CubePrismHex)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(ipwrtbase_cube_all_elements, CubeAllElements)
{
Configure();
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
IProductWRTBase<>::create(fixt_explist, "MatFree")
->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_AUTO_TEST_SUITE_END()
......@@ -8,6 +8,8 @@
#include "Operators/OperatorPhysDeriv.hpp"
#include "init_physderivfields.hpp"
BOOST_AUTO_TEST_SUITE(TestPhysDeriv)
BOOST_FIXTURE_TEST_CASE(physderiv_seg, Seg)
{
Configure(1, 1);
......@@ -157,3 +159,5 @@ BOOST_FIXTURE_TEST_CASE(physderiv_cube_all_elements, CubeAllElements)
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_TEST_MODULE TestPhysDeriv
#include <boost/test/tools/output_test_stream.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <memory>
#include "Operators/OperatorPhysDeriv.hpp"
#include "init_physderivfields.hpp"
BOOST_FIXTURE_TEST_CASE(physderiv_seg, Seg)
{
Configure(1, 1);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_quad, Quad)
{
Configure(1, 2);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_tri, Tri)
{
Configure(1, 2);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_square_all_elements, SquareAllElements)
{
Configure(1, 2);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-12));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_hex, Hex)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_prism, Prism)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_pyr, Pyr)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
NektarSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_tet, Tet)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_cube_prism_hex, CubePrismHex)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
BOOST_FIXTURE_TEST_CASE(physderiv_cube_all_elements, CubeAllElements)
{
Configure(1, 3);
SetTestCase(fixt_in->GetBlocks(), fixt_in->GetStorage().GetCPUPtr());
ExpectedSolution(fixt_expected->GetBlocks(),
fixt_expected->GetStorage().GetCPUPtr());
PhysDeriv<>::create(fixt_explist, "MatFree")->apply(*fixt_in, *fixt_out);
fixt_out->ReshapeStorage<1>();
BOOST_TEST(fixt_out->compare(*fixt_expected, 1.0E-10));
boost::test_tools::output_test_stream output;
{
OutputIfNotMatch(fixt_out->GetStorage().GetCPUPtr(),
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-12);
}
}
......@@ -8,6 +8,8 @@
#include "Operators/OperatorPhysDeriv.hpp"
#include "init_physderivfields.hpp"
BOOST_AUTO_TEST_SUITE(TestPhysDerivCUDA)
BOOST_FIXTURE_TEST_CASE(physderivcuda_seg, Seg)
{
Configure(1, 1);
......@@ -187,3 +189,5 @@ BOOST_FIXTURE_TEST_CASE(physderivcuda_cube_all_elements, CubeAllElements)
fixt_expected->GetStorage().GetCPUPtr(), 1.0E-10);
}
}
BOOST_AUTO_TEST_SUITE_END()