Commit 00c8ef7c authored by Blake Nelson's avatar Blake Nelson

Added explicit instantiation of commonly used template classes (NekVector,...

Added explicit instantiation of commonly used template classes (NekVector, NekMatrix) to speed up compilation.

Added a ctest interface for the unit tests.

git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@3397 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 8627feb0
This diff is collapsed.
......@@ -30,6 +30,8 @@
#ifndef EXPRESSION_TEMPLATES_ASSOCIATIVE_TRAITS_HPP
#define EXPRESSION_TEMPLATES_ASSOCIATIVE_TRAITS_HPP
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/Node.hpp>
#include <ExpressionTemplates/Operators.hpp>
#include <boost/type_traits.hpp>
......@@ -66,4 +68,6 @@ namespace expt
};
}
#endif // NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //EXPRESSION_TEMPLATES_ASSOCIATIVE_TRAITS_HPP
......@@ -30,6 +30,8 @@
#ifndef EXPRESSION_TEMPLATES_ASSOCIATIVE_TRANSFORM_HPP
#define EXPRESSION_TEMPLATES_ASSOCIATIVE_TRANSFORM_HPP
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/CommutativeTransform.hpp>
#include <ExpressionTemplates/Operators.hpp>
#include <ExpressionTemplates/AssociativeTraits.hpp>
......@@ -87,5 +89,7 @@ namespace expt
};
}
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //EXPRESSION_TEMPLATES_ASSOCIATIVE_TRANSFORM_HPP
......@@ -30,6 +30,8 @@
#ifndef EXPRESSION_TEMPLATES_COMMUTATIVE_TRAITS_HPP
#define EXPRESSION_TEMPLATES_COMMUTATIVE_TRAITS_HPP
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/Operators.hpp>
#include <boost/type_traits.hpp>
......@@ -64,4 +66,5 @@ namespace expt
// };
}
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //EXPRESSION_TEMPLATES_COMMUTATIVE_TRAITS_HPP
......@@ -30,6 +30,8 @@
#ifndef EXPRESSION_TEMPLATES_COMMUTATIVE_TRANSFORM_HPP
#define EXPRESSION_TEMPLATES_COMMUTATIVE_TRANSFORM_HPP
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/Node.hpp>
namespace expt
......@@ -76,4 +78,5 @@ namespace expt
};
}
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //EXPRESSION_TEMPLATES_COMMUTATIVE_TRANSFORM_HPP
......@@ -31,6 +31,8 @@
#ifndef EXPRESSION_TEMPLATES_NODE_HPP
#define EXPRESSION_TEMPLATES_NODE_HPP
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#define FUSION_MAX_VECTOR_SIZE 50
#include <boost/mpl/vector.hpp>
#include <boost/mpl/vector_c.hpp>
......@@ -352,4 +354,6 @@ namespace expt
}
}
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //EXPRESSION_TEMPLATES_NODE_HPP
......@@ -29,6 +29,7 @@
#ifndef EXPRESSION_TEMPLATES_REMOVE_ALL_UNECESSARY_TEMPORARIES_H
#define EXPRESSION_TEMPLATES_REMOVE_ALL_UNECESSARY_TEMPORARIES_H
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/AssociativeTraits.hpp>
#include <ExpressionTemplates/CommutativeTraits.hpp>
......@@ -390,6 +391,7 @@ namespace Nektar
}
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
#endif //NEKTAR_EXPRESSION_TEMPLATES_REMOVE_ALL_UNECESSARY_TEMPORARIES_H
......
......@@ -49,10 +49,10 @@
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#include <ExpressionTemplates/Operators.hpp>
#ifdef NEKTAR_USE_EXPRESSION_TEMPLATES
#include <ExpressionTemplates/Node.hpp>
#include <ExpressionTemplates/Operators.hpp>
#endif //NEKTAR_USE_EXPRESSION_TEMPLATES
namespace Nektar
......
......@@ -560,7 +560,7 @@ namespace Nektar
using BaseType::data;
element* data() { return this->m_data + 1 +this->m_offset; }
template<typename T1, typename dim, typename space>
template<typename T1>
friend class NekVector;
template<typename T1, typename T3>
......
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
//
// File mojo.hpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Scientific Computing and Imaging Institute,
// University of Utah (USA) and Department of Aeronautics, Imperial
// College London (UK).
//
// 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: Move Constructors. See Generic Programming: Move Constructors
// by Andrei Alexandrescu in the C++ User's Journal.
//
// These classes were originally used with SharedArray. We had problems with
// some code not compiling because of too many implicit conversion operators,
// so we backed that out. These objects are currently not used but they are
// being left in because the idiom may prove useful in other contexts.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_MOJO_HPP
#define NEKTAR_LIB_UTILITIES_BASIC_UTILS_MOJO_HPP
namespace Nektar
{
template<typename ClassType>
class Constant
{
public:
explicit Constant(const ClassType& rhs) :
data(&rhs)
{
}
const ClassType& GetValue() const { return *data; }
private:
const ClassType* data;
};
template<typename ClassType>
class Temporary : private Constant<ClassType>
{
public:
explicit Temporary(ClassType& rhs) :
Constant<ClassType>(rhs)
{
}
ClassType& GetValue()
{
return const_cast<ClassType&>(Constant<ClassType>::GetValue());
}
};
template<typename ClassType>
class MojoEnabled
{
public:
operator Temporary<ClassType>()
{
return Temporary<ClassType>(static_cast<ClassType&>(*this));
}
operator Constant<ClassType>() const
{
return Constant<ClassType>(static_cast<const ClassType&>(*this));
}
protected:
MojoEnabled() {}
~MojoEnabled() {}
};
}
#endif //NEKTAR_LIB_UTILITIES_BASIC_UTILS_MOJO_HPP
......@@ -11,6 +11,7 @@ SET(LinearAlgebraHeaders
./LinearAlgebra/BlasArray.hpp
./LinearAlgebra/BlockMatrix.hpp
./LinearAlgebra/CanGetRawPtr.hpp
./LinearAlgebra/ExplicitInstantiation.h
./LinearAlgebra/IsDgemmTraits.hpp
./LinearAlgebra/Lapack.hpp
./LinearAlgebra/MatrixBase.hpp
......@@ -97,7 +98,6 @@ SET(BasicUtilsHeaders
./BasicUtils/Equation.h
./BasicUtils/ErrorUtil.hpp
./BasicUtils/ErrorUtil.cpp
./BasicUtils/mojo.hpp
./BasicUtils/MeshPartition.h
./BasicUtils/NekManager.hpp
./BasicUtils/NekFactory.hpp
......@@ -120,13 +120,13 @@ SET(BasicUtilsSources
./BasicUtils/Equation.cpp
./BasicUtils/MeshPartition.cpp
./BasicUtils/SessionReader.cpp
./BasicUtils/VMath.cpp
)
SET(Memory
./Memory/ThreadSpecificPool.cpp
./Memory/ThreadSpecificPool.hpp
./Memory/NekMemoryManager.hpp
./Memory/DeleteNothing.hpp
)
......@@ -170,7 +170,13 @@ ENDIF(NEKTAR_USE_MPI)
SET(LinearAlgebraSources
./LinearAlgebra/blas.cpp
./LinearAlgebra/BlockMatrix.cpp
./LinearAlgebra/MatrixBase.cpp
./LinearAlgebra/MatrixFuncs.cpp
./LinearAlgebra/MatrixVectorMultiplication.cpp
./LinearAlgebra/NekVector.cpp
./LinearAlgebra/ScaledMatrix.cpp
./LinearAlgebra/StandardMatrix.cpp
# ./LinearAlgebra/lapack.cpp
)
......
......@@ -33,7 +33,6 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/LibUtilities.h>
#include <iostream>
#include <LibUtilities/Foundations/Points.h>
#include <LibUtilities/Foundations/Foundations.hpp>
......
......@@ -75,7 +75,7 @@ namespace Nektar
I0 = PointsManager()[fpoints0]->GetI(tpoints0);
NekVector<const NekDouble> in(fpoints0.GetNumPoints(),from,eWrapper);
NekVector<NekDouble> in(fpoints0.GetNumPoints(),from,eWrapper);
NekVector<NekDouble> out(tpoints0.GetNumPoints(),to,eWrapper);
out = (*I0)*in;
......
......@@ -64,7 +64,7 @@ namespace Nektar
DNekMatSharedPtr ftB = BasisManager()[fbasis0]->GetI(tbasis0);
NekVector<const NekDouble> in(fbasis0.GetNumModes(),from,eWrapper);
NekVector<NekDouble> in(fbasis0.GetNumModes(),from,eWrapper);
NekVector<NekDouble> out(tbasis0.GetNumModes(),to,eWrapper);
out = (*ftB)*in;
......
......@@ -41,7 +41,6 @@
#include <LibUtilities/BasicConst/NektarUnivConsts.hpp>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <LibUtilities/Polylib/Polylib.h>
#include <LibUtilities/Memory/DeleteNothing.hpp>
#include <LibUtilities/Memory/NekMemoryManager.hpp>
#include <LibUtilities/Memory/ThreadSpecificPool.hpp>
......@@ -100,7 +99,6 @@
#include <LibUtilities/BasicUtils/Concepts.hpp>
#include <LibUtilities/BasicUtils/ConsistentObjectAccess.hpp>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/mojo.hpp>
#include <LibUtilities/BasicUtils/NekManager.hpp>
#include <LibUtilities/BasicUtils/OperatorGenerators.hpp>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
......
This diff is collapsed.
......@@ -50,8 +50,8 @@ namespace Nektar
template<typename T>
struct CanGetRawPtr<NekMatrix<T, StandardMatrixTag> > : public boost::true_type {};
template<typename T>
struct CanGetRawPtr<NekMatrix<NekMatrix<T>, ScaledMatrixTag> > : public boost::true_type {};
template<typename T, typename R>
struct CanGetRawPtr<NekMatrix<NekMatrix<T, R>, ScaledMatrixTag> > : public boost::true_type {};
template<typename T, typename M>
struct CanGetRawPtr<NekMatrix<T, M> > :
......
///////////////////////////////////////////////////////////////////////////////
//
// 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_LIBUTILITIES_LINEARALGEBRA_EXPLICIT_INSTANTIATION_H
#define NEKTAR_LIBUTILITIES_LINEARALGEBRA_EXPLICIT_INSTANTIATION_H
#include <boost/preprocessor/repetition/for.hpp>
#include <boost/preprocessor/array/elem.hpp>
#include <boost/preprocessor/array/size.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/punctuation/paren.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <boost/preprocessor/logical/bool.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#include <boost/preprocessor/array/pop_front.hpp>
#include <boost/preprocessor/array/push_back.hpp>
#include <LibUtilities/LinearAlgebra/NekTypeDefs.hpp>
// Macros to make creating explicit instantiations of all possible matrix types for methods easier.
#define NEKTAR_ALL_MATRIX_TYPES (6, (const DNekMat&, const DNekScalMat&, const DNekBlkMat&, const BlkMatDNekBlkMat&, const DNekScalBlkMat&, const BlkMatDNekScalBlkMat&))
#define NEKTAR_BLOCK_MATRIX_TYPES (4, (const DNekBlkMat&, const BlkMatDNekBlkMat&, const DNekScalBlkMat&, const BlkMatDNekScalBlkMat&))
#define NEKTAR_STANDARD_AND_SCALED_MATRICES (2, (const DNekMat&, const DNekScalMat&))
#define NEKTAR_PRINT_ARRAY(z, n, data) \
BOOST_PP_ARRAY_ELEM(n, data) \
BOOST_PP_COMMA_IF(BOOST_PP_LESS(n, BOOST_PP_SUB(BOOST_PP_ARRAY_SIZE(data), 1)))
#define NEKTAR_CREATE_EXPLICIT_INTSTANTIATION(z, n, data) \
template LIB_UTILITIES_EXPORT \
BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_ELEM(2, data)) BOOST_PP_ARRAY_ELEM(0, data) BOOST_PP_LPAREN() \
BOOST_PP_REPEAT(BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_ELEM(3, data)), NEKTAR_PRINT_ARRAY, BOOST_PP_ARRAY_ELEM(3, data)) \
BOOST_PP_COMMA_IF(BOOST_PP_GREATER(BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_ELEM(3, data)), 0)) \
BOOST_PP_ARRAY_ELEM(n, BOOST_PP_ARRAY_ELEM(1, data))\
BOOST_PP_COMMA_IF(BOOST_PP_GREATER(BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_ELEM(4, data)), 0)) \
BOOST_PP_REPEAT(BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_ELEM(4, data)), NEKTAR_PRINT_ARRAY, BOOST_PP_ARRAY_ELEM(4, data)) \
BOOST_PP_RPAREN() ;
#define NEKTAR_GENERATE_EXPLICIT_FUNCTION_INSTANTIATION_SINGLE_MATRIX(MethodName, MatrixTypes, ReturnType, BeforeArgs, AfterArgs) \
BOOST_PP_REPEAT(BOOST_PP_ARRAY_SIZE(MatrixTypes), NEKTAR_CREATE_EXPLICIT_INTSTANTIATION, (5, (MethodName, MatrixTypes, ReturnType, BeforeArgs, AfterArgs)))
#define NEKTAR_GENERATE_EXPLICIT_FUNCTION_INSTANTIATION_TWO_MATRICES_INNER(z, n, data) \
BOOST_PP_REPEAT(BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_ELEM(2, data)), NEKTAR_CREATE_EXPLICIT_INTSTANTIATION, (5, (BOOST_PP_ARRAY_ELEM(0, data), BOOST_PP_ARRAY_ELEM(2, data), BOOST_PP_ARRAY_ELEM(3, data), BOOST_PP_ARRAY_PUSH_BACK(BOOST_PP_ARRAY_ELEM(4, data), BOOST_PP_ARRAY_ELEM(n, BOOST_PP_ARRAY_ELEM(1, data))), BOOST_PP_ARRAY_ELEM(5, data))))
// Assumes the matrices are adjacent in parameter list.
#define NEKTAR_GENERATE_EXPLICIT_FUNCTION_INSTANTIATION_TWO_MATRICES(MethodName, FirstMatrixTypes, SecondMatrixTypes, ReturnType, BeforeArgs, AfterArgs) \
BOOST_PP_REPEAT(BOOST_PP_ARRAY_SIZE(FirstMatrixTypes), NEKTAR_GENERATE_EXPLICIT_FUNCTION_INSTANTIATION_TWO_MATRICES_INNER, (6, (MethodName, FirstMatrixTypes, SecondMatrixTypes, ReturnType, BeforeArgs, AfterArgs)))
#endif //NEKTAR_LIBUTILITIES_LINEARALGEBRA_EXPLICIT_INSTANTIATION_H
This diff is collapsed.
......@@ -38,7 +38,7 @@
#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_MATRIX_FUNCS_H
#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_MATRIX_FUNCS_H
#include <boost/call_traits.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tuple/tuple.hpp>
#include <limits>
#include <LibUtilities/LinearAlgebra/Lapack.hpp>
......
......@@ -49,11 +49,11 @@ namespace Nektar
/// match the size of the input then an error occurred.
/// This algorithm is taken from "Parallel Scientific Computing in
/// C++ and MPI", Karniadakis and Kirby, page 55.
template<typename DataType, typename VectorDimension, typename space>
std::vector<NekVector<DataType, VectorDimension, space> >
GramSchmidtOrthogonalization(const std::vector<NekVector<DataType, VectorDimension, space> >& x)
template<typename DataType>
std::vector<NekVector<DataType> >
GramSchmidtOrthogonalization(const std::vector<NekVector<DataType> >& x)
{
typedef NekVector<DataType, VectorDimension, space> VectorType;
typedef NekVector<DataType> VectorType;
typedef NekMatrix<DataType> MatrixType;
//typename dim = x[0].GetDimension();
......@@ -101,17 +101,3 @@ namespace Nektar
#endif //NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LIN_ALG_ALGORITHMS_HPP
/**
$Log: NekLinAlgAlgorithms.hpp,v $
Revision 1.3 2008/03/03 02:28:39 bnelson
Changed OneD, TwoD, and ThreeD to classes instead of enums to support type parameters in NekVector instead of unsigned int for the dimensions.
Added a new NekVector<const DataType> to allow wrapping of ConstArrays.
Revision 1.2 2007/02/15 06:56:55 bnelson
*** empty log message ***
Revision 1.1 2006/11/20 03:39:06 bnelson
Initial Revision
**/
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -403,7 +403,7 @@ namespace Nektar
DNekScalMatSharedPtr matsys = m_matrixManager[masskey];
// copy inarray in case inarray == outarray
NekVector<const NekDouble> in(m_ncoeffs,outarray,eCopy);
NekVector<NekDouble> in(m_ncoeffs,outarray,eCopy);
NekVector<NekDouble> out(m_ncoeffs,outarray,eWrapper);
out = (*matsys)*in;
......@@ -656,7 +656,7 @@ namespace Nektar
vdm.Invert();
NekVector<const NekDouble> in(GetNcoeffs(),m_coeffs,eWrapper);
NekVector<NekDouble> in(GetNcoeffs(),m_coeffs,eWrapper);
NekVector<NekDouble> out(GetNcoeffs());
out = vdm*in;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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