Commit 075dbb4f authored by Douglas Serson's avatar Douglas Serson

Remove BoostUtils (MakePtr)

parent 623a8b06
////////////////////////////////////////////////////////////////////////////////
//
// File: ThreadSpecificPool.hpp
//
// 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).
//
// License for the specific language governing rights and limitations under
// 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:
//
//
////////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_BOOST_UTIL_HPP
#define NEKTAR_LIB_UTILITIES_BOOST_UTIL_HPP
#include <memory>
namespace Nektar
{
template<typename DataType>
std::shared_ptr<DataType> MakePtr(DataType* d)
{
return std::shared_ptr<DataType>(d);
}
}
#endif //NEKTAR_LIB_UTILITIES_BOOST_UTIL_HPP
......@@ -7,7 +7,6 @@ SET(BasicConstHeaders
SET(BasicUtilsHeaders
./BasicUtils/ArrayPolicies.hpp
./BasicUtils/BoostUtil.hpp
./BasicUtils/ConsistentObjectAccess.hpp
./BasicUtils/CompressData.h
./BasicUtils/CsvIO.h
......
......@@ -34,14 +34,12 @@
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/LinearAlgebra/NekMatrix.hpp>
#include <LibUtilities/BasicUtils/BoostUtil.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/progress.hpp>
#include <iostream>
#include <LibUtilities/LinearAlgebra/NekTypeDefs.hpp>
namespace Nektar
......
......@@ -2,7 +2,6 @@ SET(UnitTestSources
main.cpp
ScaledMatrixUnitTests.cpp
BlockMatrixUnitTests.cpp
testBoostUtil.cpp
testLinearSystem.cpp
testNekLinAlgAlgorithms.cpp
testNekMatrix.cpp
......
......@@ -36,8 +36,6 @@
#ifndef NEKTAR_UNIT_TESTS_LIB_UTILITIES_LINEAR_ALGEBRA_TEST_COMBINATION_RUNNER_H
#define NEKTAR_UNIT_TESTS_LIB_UTILITIES_LINEAR_ALGEBRA_TEST_COMBINATION_RUNNER_H
#include <LibUtilities/BasicUtils/BoostUtil.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/floating_point_comparison.hpp>
......@@ -45,6 +43,8 @@
#include <boost/test/auto_unit_test.hpp>
#include <memory>
namespace Nektar
{
template<typename LhsScaledInnerMatrixType,
......@@ -106,11 +106,11 @@ namespace Nektar
std::shared_ptr<NekMatrix<NumberType, StandardMatrixTag> > inner(
new NekMatrix<NumberType, StandardMatrixTag>(m1.GetRows(), m1.GetColumns(), inner_values, s, m1.GetNumberOfSubDiagonals(),
m1.GetNumberOfSuperDiagonals()));
m2 = MakePtr(new NekMatrix<NekMatrix<NumberType, StandardMatrixTag>, ScaledMatrixTag>(scale, inner));
m2 = std::make_shared<NekMatrix<NekMatrix<NumberType, StandardMatrixTag>, ScaledMatrixTag>>(scale, inner);
unsigned int numberOfRows = m1.GetRows()/blockRows;
unsigned int numberOfColumns = m1.GetColumns()/blockColumns;
m3 = MakePtr(new NekMatrix<NekMatrix<NumberType>, BlockMatrixTag>(blockRows, blockColumns, numberOfRows, numberOfColumns));
m3 = std::make_shared<NekMatrix<NekMatrix<NumberType>, BlockMatrixTag>>(blockRows, blockColumns, numberOfRows, numberOfColumns);
for(unsigned int blockRow = 0; blockRow < blockRows; ++blockRow)
{
......
......@@ -34,7 +34,6 @@
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/LinearAlgebra/NekMatrix.hpp>
#include <LibUtilities/BasicUtils/BoostUtil.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/floating_point_comparison.hpp>
......
......@@ -35,7 +35,6 @@
#include <LibUtilities/LinearAlgebra/NekMatrix.hpp>
#include <UnitTests/LibUtilities/LinearAlgebra/TestCombinationRunner.h>
#include <LibUtilities/BasicUtils/BoostUtil.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/floating_point_comparison.hpp>
......@@ -43,6 +42,7 @@
#include <boost/progress.hpp>
#include <iostream>
#include <functional>
#include <memory>
namespace Nektar
{
......@@ -51,14 +51,14 @@ namespace Nektar
std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag> >& m2,
std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag> >& m3)
{
m1 = MakePtr(new NekMatrix<NekDouble, StandardMatrixTag>(4, 4, values));
m1 = std::make_shared<NekMatrix<NekDouble, StandardMatrixTag>>(4, 4, values);
double inner_values[16];
std::transform(values, values+16, inner_values, std::bind(std::divides<NekDouble>(), std::placeholders::_1, scale));
std::shared_ptr<NekMatrix<NekDouble> > inner(
new NekMatrix<NekDouble>(4, 4, inner_values));
m2 = MakePtr(new NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>(scale, inner));
m2 = std::make_shared<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>>(scale, inner);
double block_1_values[] = {values[0], values[1],
values[4], values[5]};
......@@ -73,7 +73,7 @@ namespace Nektar
std::shared_ptr<NekMatrix<NekDouble> > block3(new NekMatrix<NekDouble>(2, 2, block_3_values));
std::shared_ptr<NekMatrix<NekDouble> > block4(new NekMatrix<NekDouble>(2, 2, block_4_values));
m3 = MakePtr(new NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>(2, 2, 2, 2));
m3 = std::make_shared<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>>(2, 2, 2, 2);
m3->SetBlock(0,0, block1);
m3->SetBlock(1,0, block2);
m3->SetBlock(0,1, block3);
......@@ -85,14 +85,14 @@ namespace Nektar
std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag> >& m2,
std::shared_ptr<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag> >& m3)
{
m1 = MakePtr(new NekMatrix<NekDouble, StandardMatrixTag>(4, 4, values, eUPPER_TRIANGULAR));
m1 = std::make_shared<NekMatrix<NekDouble, StandardMatrixTag>>(4, 4, values, eUPPER_TRIANGULAR);
double inner_values[10];
std::transform(values, values+10, inner_values, std::bind(std::divides<NekDouble>(), std::placeholders::_1, scale));
std::shared_ptr<NekMatrix<NekDouble> > inner(
new NekMatrix<NekDouble>(4, 4, inner_values, eUPPER_TRIANGULAR));
m2 = MakePtr(new NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>(scale, inner));
m2 = std::make_shared<NekMatrix<NekMatrix<NekDouble>, ScaledMatrixTag>>(scale, inner);
double block_1_values[] = {values[0], 0.0,
values[1], values[2]};
......@@ -104,7 +104,7 @@ namespace Nektar
std::shared_ptr<NekMatrix<NekDouble> > block2(new NekMatrix<NekDouble>(2, 2, block_2_values));
std::shared_ptr<NekMatrix<NekDouble> > block4(new NekMatrix<NekDouble>(2, 2, block_4_values));
m3 = MakePtr(new NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>(2, 2, 2, 2));
m3 = std::make_shared<NekMatrix<NekMatrix<NekDouble>, BlockMatrixTag>>(2, 2, 2, 2);
m3->SetBlock(0,0, block1);
m3->SetBlock(0,1, block2);
m3->SetBlock(1,1, block4);
......
///////////////////////////////////////////////////////////////////////////////
//
// File: testBoostUtil.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).
//
// License for the specific language governing rights and limitations under
// 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: Tests the boost utility functions.
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/BasicUtils/BoostUtil.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/test/test_case_template.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/progress.hpp>
#include <LibUtilities/BasicUtils/ConsistentObjectAccess.hpp>
namespace Nektar
{
namespace UnitTests
{
class TestClass
{
public:
TestClass()
{
++constructionCount;
}
~TestClass()
{
++destructionCount;
}
static unsigned int constructionCount;
static unsigned int destructionCount;
};
unsigned int TestClass::constructionCount = 0;
unsigned int TestClass::destructionCount = 0;
template<typename T>
class FakeClass {};
BOOST_AUTO_TEST_CASE(testMakePtr)
{
std::shared_ptr<FakeClass<int> > a(new FakeClass<int>());
//FakeClass<int>& b = ConsistentObjectAccess<std::shared_ptr<FakeClass<int> > >::reference(a);
{
std::shared_ptr<TestClass> p = MakePtr(new TestClass());
BOOST_CHECK(TestClass::constructionCount == 1);
BOOST_CHECK(TestClass::destructionCount == 0);
}
BOOST_CHECK(TestClass::constructionCount == 1);
BOOST_CHECK(TestClass::destructionCount == 1);
}
}
}
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