Commit 2a8932c8 authored by Dave Moxey's avatar Dave Moxey
Browse files

Fix declspecs for Windows compilation

parent 2ae29183
......@@ -196,7 +196,9 @@ public:
/// Name of class
LIB_UTILITIES_EXPORT static std::string className;
FieldIOHdf5(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem);
LIB_UTILITIES_EXPORT FieldIOHdf5(
LibUtilities::CommSharedPtr pComm,
bool sharedFilesystem);
/// Get class name
inline virtual const std::string &GetClassName() const
......
......@@ -188,7 +188,9 @@ public:
/// Name of class
LIB_UTILITIES_EXPORT static std::string className;
FieldIOXml(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem);
LIB_UTILITIES_EXPORT FieldIOXml(
LibUtilities::CommSharedPtr pComm,
bool sharedFilesystem);
LIB_UTILITIES_EXPORT void ImportFieldDefs(
DataSourceSharedPtr dataSource,
......
......@@ -33,72 +33,67 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/Communication/CommDataType.h>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/Communication/CommDataType.h>
namespace Nektar
{
namespace LibUtilities
{
int CommDataTypeGetSize(CommDataType dt)
{
namespace LibUtilities
{
int CommDataTypeGetSize(CommDataType dt)
{
#ifdef NEKTAR_USE_MPI
int size;
MPI_Type_size(dt, &size);
return size;
int size;
MPI_Type_size(dt, &size);
return size;
#else
switch (dt)
{
case MPI_INT:
return sizeof(int);
break;
case MPI_UNSIGNED:
return sizeof(unsigned);
break;
case MPI_LONG:
return sizeof(long);
break;
case MPI_UNSIGNED_LONG:
return sizeof(unsigned long);
break;
case MPI_LONG_LONG:
return sizeof(long long);
break;
case MPI_UNSIGNED_LONG_LONG:
return sizeof(unsigned long long);
break;
case MPI_FLOAT:
return sizeof(float);
break;
case MPI_DOUBLE:
return sizeof(double);
break;
case MPI_LONG_DOUBLE:
return sizeof(long double);
break;
default:
ASSERTL0(false, "Unrecognised datatype!");
}
switch (dt)
{
case MPI_INT:
return sizeof(int);
break;
case MPI_UNSIGNED:
return sizeof(unsigned);
break;
case MPI_LONG:
return sizeof(long);
break;
case MPI_UNSIGNED_LONG:
return sizeof(unsigned long);
break;
case MPI_LONG_LONG:
return sizeof(long long);
break;
case MPI_UNSIGNED_LONG_LONG:
return sizeof(unsigned long long);
break;
case MPI_FLOAT:
return sizeof(float);
break;
case MPI_DOUBLE:
return sizeof(double);
break;
case MPI_LONG_DOUBLE:
return sizeof(long double);
break;
default:
ASSERTL0(false, "Unrecognised datatype!");
}
#endif
}
}
template<>
CommDataType CommDataTypeTraits<int>::type = MPI_INT;
template<>
CommDataType CommDataTypeTraits<unsigned>::type = MPI_UNSIGNED;
template<>
CommDataType CommDataTypeTraits<long>::type = MPI_LONG;
template<>
CommDataType CommDataTypeTraits<unsigned long>::type = MPI_UNSIGNED_LONG;
template<>
CommDataType CommDataTypeTraits<long long>::type = MPI_LONG_LONG;
template<>
CommDataType CommDataTypeTraits<unsigned long long>::type = MPI_UNSIGNED_LONG_LONG;
template<>
CommDataType CommDataTypeTraits<float>::type = MPI_FLOAT;
template<>
CommDataType CommDataTypeTraits<double>::type = MPI_DOUBLE;
template<>
CommDataType CommDataTypeTraits<long double>::type = MPI_LONG_DOUBLE;
}
template <> CommDataType CommDataTypeTraits<int>::type = MPI_INT;
template <> CommDataType CommDataTypeTraits<unsigned>::type = MPI_UNSIGNED;
template <> CommDataType CommDataTypeTraits<long>::type = MPI_LONG;
template <>
CommDataType CommDataTypeTraits<unsigned long>::type = MPI_UNSIGNED_LONG;
template <> CommDataType CommDataTypeTraits<long long>::type = MPI_LONG_LONG;
template <>
CommDataType CommDataTypeTraits<unsigned long long>::type =
MPI_UNSIGNED_LONG_LONG;
template <> CommDataType CommDataTypeTraits<float>::type = MPI_FLOAT;
template <> CommDataType CommDataTypeTraits<double>::type = MPI_DOUBLE;
template <>
CommDataType CommDataTypeTraits<long double>::type = MPI_LONG_DOUBLE;
}
}
......@@ -32,124 +32,131 @@
// Description: Describes data types (using MPI_Datatype if available)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_COMMDATATYPE_H
#define NEKTAR_LIB_UTILITIES_COMMDATATYPE_H
#include <vector>
#include <LibUtilities/BasicConst/NektarUnivTypeDefs.hpp>
#include <vector>
#ifdef NEKTAR_USE_MPI
#include <mpi.h>
namespace Nektar
{
namespace LibUtilities
{
typedef MPI_Datatype CommDataType;
}
namespace LibUtilities
{
typedef MPI_Datatype CommDataType;
}
}
#else
namespace Nektar
{
namespace LibUtilities
{
enum CommDataType
{
MPI_INT, MPI_UNSIGNED,
MPI_LONG, MPI_UNSIGNED_LONG,
MPI_LONG_LONG, MPI_UNSIGNED_LONG_LONG,
MPI_FLOAT, MPI_DOUBLE, MPI_LONG_DOUBLE
};
}
namespace LibUtilities
{
enum CommDataType
{
MPI_INT,
MPI_UNSIGNED,
MPI_LONG,
MPI_UNSIGNED_LONG,
MPI_LONG_LONG,
MPI_UNSIGNED_LONG_LONG,
MPI_FLOAT,
MPI_DOUBLE,
MPI_LONG_DOUBLE
};
}
}
#endif
namespace Nektar
{
template<typename Dim, typename DataType> class Array;
template <typename Dim, typename DataType> class Array;
namespace LibUtilities
{
int CommDataTypeGetSize(CommDataType);
namespace LibUtilities
{
int CommDataTypeGetSize(CommDataType);
template<class T>
class CommDataTypeTraits
{
static CommDataType type;
public:
static CommDataType& GetDataType()
{
return type;
}
static void* GetPointer(T& val)
{
return &val;
}
static const void* GetPointer(const T& val)
{
return &val;
}
static int GetCount(const T& val)
{
return 1;
}
LIB_UTILITIES_EXPORT template <class T> class CommDataTypeTraits
{
static CommDataType type;
const static bool IsVector = false;
};
public:
static CommDataType &GetDataType()
{
return type;
}
static void *GetPointer(T &val)
{
return &val;
}
static const void *GetPointer(const T &val)
{
return &val;
}
static int GetCount(const T &val)
{
return 1;
}
/**
* Partial specialisation for vectors
*/
template<class elemT>
class CommDataTypeTraits<std::vector<elemT> >
{
public:
static CommDataType& GetDataType()
{
return CommDataTypeTraits<elemT>::GetDataType();
}
static void* GetPointer(std::vector<elemT>& val)
{
return &val[0];
}
static const void* GetPointer(const std::vector<elemT>& val)
{
return &val[0];
}
static int GetCount(const std::vector<elemT>& val)
{
return val.size();
}
const static bool IsVector = true;
};
const static bool IsVector = false;
};
/**
* Partial specialisation for vectors
*/
template<class elemT>
class CommDataTypeTraits<Array<OneD, elemT> >
{
public:
static CommDataType& GetDataType()
{
return CommDataTypeTraits<elemT>::GetDataType();
}
static void* GetPointer(Array<OneD, elemT>& val)
{
return val.get();
}
static const void* GetPointer(const Array<OneD, elemT>& val)
{
return val.get();
}
static int GetCount(const Array<OneD, elemT>& val)
{
return val.num_elements();
}
const static bool IsVector = true;
};
/**
* Partial specialisation for vectors
*/
LIB_UTILITIES_EXPORT template <class elemT>
class CommDataTypeTraits<std::vector<elemT> >
{
public:
static CommDataType &GetDataType()
{
return CommDataTypeTraits<elemT>::GetDataType();
}
static void *GetPointer(std::vector<elemT> &val)
{
return &val[0];
}
static const void *GetPointer(const std::vector<elemT> &val)
{
return &val[0];
}
static int GetCount(const std::vector<elemT> &val)
{
return val.size();
}
const static bool IsVector = true;
};
/**
* Partial specialisation for vectors
*/
LIB_UTILITIES_EXPORT template <class elemT>
class CommDataTypeTraits<Array<OneD, elemT> >
{
public:
static CommDataType &GetDataType()
{
return CommDataTypeTraits<elemT>::GetDataType();
}
static void *GetPointer(Array<OneD, elemT> &val)
{
return val.get();
}
static const void *GetPointer(const Array<OneD, elemT> &val)
{
return val.get();
}
static int GetCount(const Array<OneD, elemT> &val)
{
return val.num_elements();
}
const static bool IsVector = true;
};
}
}
#endif
Supports Markdown
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