Skip to content
Snippets Groups Projects
Commit 8bc4b309 authored by Dave Moxey's avatar Dave Moxey
Browse files

Merge branch 'feature/nekmesh-unit-tests' into 'master'

NekMesh unit tests

See merge request nektar/nektar!1753
parents 1ba8005c 7eedd480
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,8 @@ v5.6.0
- Fix optiKind flags in VarOpti for freenodes that are on more than a single curve / surface (!1597)
- Fix VarOpti Surface Node Sliding on the CAD in 2D (!1569)
- Add feature for r-adaption on user-defined CAD curves (!1349)
- Add feature for r-adaption on user-defined CAD curves (!1349)
- Add unit testing infrustructure and initial example (!1753)
v5.5.0
------
......
......@@ -17,4 +17,4 @@ ADD_NEKTAR_EXECUTABLE(UnitTests
COMPONENT unit-test DEPENDS StdRegions SOURCES ${UnitTestSources})
ADD_TEST(NAME UnitTests COMMAND UnitTests --detect_memory_leaks=0)
SUBDIRS(LibUtilities LocalRegions Collections MultiRegions SpatialDomains)
SUBDIRS(LibUtilities LocalRegions Collections MultiRegions SpatialDomains NekMesh)
SET(NekMeshUnitTestsSources
main.cpp
TestTetrahedron.cpp
)
ADD_DEFINITIONS(-DENABLE_NEKTAR_EXCEPTIONS)
ADD_NEKTAR_EXECUTABLE(NekMeshUnitTests
COMPONENT unit-test DEPENDS libNekMesh SOURCES ${NekMeshUnitTestsSources})
ADD_TEST(NAME NekMeshUnitTests COMMAND NekMeshUnitTests --detect_memory_leaks=0)
///////////////////////////////////////////////////////////////////////////////
//
// File: TestTetrahedron.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
/// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description:
//
///////////////////////////////////////////////////////////////////////////////
#include <NekMesh/MeshElements/Element.h>
#include <NekMesh/NekMeshDeclspec.h>
#include <boost/test/unit_test.hpp>
namespace Nektar::NekMeshTetrahedronUnitTest
{
using namespace Nektar::NekMesh;
BOOST_AUTO_TEST_CASE(TestConstruction)
{
// Setup element config
ElmtConfig el_conf(LibUtilities::eTetrahedron, 1, false, false, false);
// Setup element node list -- order matters!
std::vector<NodeSharedPtr> node_set(4);
node_set[0] = std::make_shared<Node>(0, -1., 0., 0.);
node_set[1] = std::make_shared<Node>(1, 1., 0., 0.);
node_set[2] = std::make_shared<Node>(2, 0., 1., 0.);
node_set[3] = std::make_shared<Node>(3, 0., 0.5, 1.);
std::vector<int> tags;
tags.push_back(0);
ElementSharedPtr TestTet = GetElementFactory().CreateInstance(
LibUtilities::eTetrahedron, el_conf, node_set, tags);
BOOST_CHECK_EQUAL(TestTet->GetVertex(3)->m_x, 0.);
BOOST_CHECK_EQUAL(TestTet->GetVertex(3)->m_y, 0.5);
BOOST_CHECK_EQUAL(TestTet->GetVertex(3)->m_z, 1.);
}
} // namespace Nektar::NekMeshTetrahedronUnitTest
///////////////////////////////////////////////////////////////////////////////
//
// File: main.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Unit tests for NekMesh
//
///////////////////////////////////////////////////////////////////////////////
#define BOOST_AUTO_TEST_MAIN
#define BOOST_TEST_MODULE NekMeshUnitTests test
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/included/unit_test_framework.hpp>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment