Commit 2dcb7181 authored by mike's avatar mike
Browse files

windows fixes

parent 6718b000
......@@ -100,19 +100,19 @@ class ThreadJob
{
public:
/// Base constructor
ThreadJob();
LIB_UTILITIES_EXPORT ThreadJob();
/// Base destructor.
virtual ~ThreadJob();
LIB_UTILITIES_EXPORT virtual ~ThreadJob();
/**
* This method will be called when the task is loaded
* onto a worker thread and is ready to run. When Run
* has finished this instance will be destructed.
*/
virtual void Run() = 0;
LIB_UTILITIES_EXPORT virtual void Run() = 0;
/// Set number of worker threads.
void SetWorkerNum(unsigned int num);
LIB_UTILITIES_EXPORT void SetWorkerNum(unsigned int num);
protected:
/**
......@@ -168,7 +168,7 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
{
public:
/// Destructor.
virtual ~ThreadManager();
LIB_UTILITIES_EXPORT virtual ~ThreadManager();
/**
* @brief Pass a list of tasklets to the master queue.
* @param joblist Vector of ThreadJob pointers.
......@@ -181,7 +181,7 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
*
* @see SchedType
*/
virtual void QueueJobs(std::vector<ThreadJob*>& joblist) = 0;
LIB_UTILITIES_EXPORT virtual void QueueJobs(std::vector<ThreadJob*>& joblist) = 0;
/**
* @brief Pass a single job to the master queue.
* @param job A pointer to a ThreadJob subclass.
......@@ -190,14 +190,14 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
* issue then suspend the workers with SetNumWorkers(0) until the jobs
* are queued.
*/
virtual void QueueJob(ThreadJob* job) = 0;
LIB_UTILITIES_EXPORT virtual void QueueJob(ThreadJob* job) = 0;
/**
* @brief Return the number of active workers.
*
* Active workers are threads that are either running jobs
* or are waiting for jobs to be queued.
*/
virtual unsigned int GetNumWorkers() = 0;
LIB_UTILITIES_EXPORT virtual unsigned int GetNumWorkers() = 0;
/**
* @brief Returns the worker number of the executing thread.
*
......@@ -216,7 +216,7 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
*
* Returns 0 if called by non-thread.
*/
virtual unsigned int GetWorkerNum() = 0;
LIB_UTILITIES_EXPORT virtual unsigned int GetWorkerNum() = 0;
/**
* @brief Sets the number of active workers.
* @param num The number of active workers.
......@@ -227,18 +227,18 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
* If num is greater than the maximum allowed number of active workers,
* then the maximum value will be used instead.
*/
virtual void SetNumWorkers(const unsigned int num) = 0;
LIB_UTILITIES_EXPORT virtual void SetNumWorkers(const unsigned int num) = 0;
/**
* @brief Sets the number of active workers to the maximum.
*
* Sets the number of active workers to the maximum available.
*/
virtual void SetNumWorkers() = 0;
LIB_UTILITIES_EXPORT virtual void SetNumWorkers() = 0;
/**
* @brief Gets the maximum available number of threads.
* @return The maximum number of workers.
*/
virtual unsigned int GetMaxNumWorkers() = 0;
LIB_UTILITIES_EXPORT virtual unsigned int GetMaxNumWorkers() = 0;
/**
* @brief Waits until all queued jobs are finished.
*
......@@ -261,7 +261,7 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
* number of worker threads, implementations should increase the number
* of active workers by 1 on entering Wait().
*/
virtual void Wait() = 0;
LIB_UTILITIES_EXPORT virtual void Wait() = 0;
/**
* @brief Controls how many jobs are sent to each worker at a time.
*
......@@ -271,17 +271,17 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
* @see SchedType
* @see SetSchedType()
*/
virtual void SetChunkSize(unsigned int chnk) = 0;
LIB_UTILITIES_EXPORT virtual void SetChunkSize(unsigned int chnk) = 0;
/**
* @brief Sets the current scheduling algorithm.
* @see SetChunkSize()
*/
virtual void SetSchedType(SchedType s) = 0;
LIB_UTILITIES_EXPORT virtual void SetSchedType(SchedType s) = 0;
/**
* @brief Indicates whether the code is in a worker thread or not.
* @return True if the caller is in a worker thread.
*/
virtual bool InThread() = 0;
LIB_UTILITIES_EXPORT virtual bool InThread() = 0;
/**
* @brief A calling threads holds until all active threads call this
* method.
......@@ -294,16 +294,16 @@ class ThreadManager : public boost::enable_shared_from_this<ThreadManager>
* is altered after a thread has called this method. It is only safe to
* call SetNumWorkers() when no threads are holding.
*/
virtual void Hold() = 0;
LIB_UTILITIES_EXPORT virtual void Hold() = 0;
/**
* @brief Returns a description of the type of threading.
*
* E.g. "Threading with Boost"
*/
virtual const std::string& GetType() const = 0;
LIB_UTILITIES_EXPORT virtual const std::string& GetType() const = 0;
/// ThreadManager implementation.
virtual bool IsInitialised();
LIB_UTILITIES_EXPORT virtual bool IsInitialised();
inline int GetThrFromPartition(int pPartition)
{
......@@ -354,17 +354,17 @@ class ThreadMaster
THREADMANAGER_MAX
};
/// Constructor
ThreadMaster();
LIB_UTILITIES_EXPORT ThreadMaster();
/// Destructor
~ThreadMaster();
LIB_UTILITIES_EXPORT ~ThreadMaster();
/// Sets what ThreadManagers will be created in CreateInstance.
void SetThreadingType(const std::string &p_type);
LIB_UTILITIES_EXPORT void SetThreadingType(const std::string &p_type);
/// Gets the ThreadManager associated with string s.
ThreadManagerSharedPtr& GetInstance(const ThreadManagerName t);
LIB_UTILITIES_EXPORT ThreadManagerSharedPtr& GetInstance(const ThreadManagerName t);
/// Creates an instance of a ThreadManager (which one is determined by
/// a previous call to SetThreadingType) and associates it with
/// the string s.
ThreadManagerSharedPtr CreateInstance(const ThreadManagerName t,
LIB_UTILITIES_EXPORT ThreadManagerSharedPtr CreateInstance(const ThreadManagerName t,
unsigned int nThr);
};
......
......@@ -52,17 +52,17 @@ using namespace std;
*
* @return Jacobian of @p jac.
*/
template <int DIM> inline NekDouble Determinant(NekDouble jac[DIM][DIM])
template <int DIM> inline NekDouble Determinant(NekDouble jac[][DIM])
{
return 0.0;
}
template <> inline NekDouble Determinant<2>(NekDouble jac[2][2])
template <> inline NekDouble Determinant<2>(NekDouble jac[][2])
{
return jac[0][0] * jac[1][1] - jac[0][1] * jac[1][0];
}
template <> inline NekDouble Determinant<3>(NekDouble jac[3][3])
template <> inline NekDouble Determinant<3>(NekDouble jac[][3])
{
return jac[0][0] * (jac[1][1] * jac[2][2] - jac[2][1] * jac[1][2]) -
jac[0][1] * (jac[1][0] * jac[2][2] - jac[1][2] * jac[2][0]) +
......@@ -78,13 +78,13 @@ template <> inline NekDouble Determinant<3>(NekDouble jac[3][3])
* @param out Output matrix \f$ A^{-\top} \f$
*/
template <int DIM>
inline void InvTrans(NekDouble in[DIM][DIM], NekDouble out[DIM][DIM])
inline void InvTrans(NekDouble in[][DIM], NekDouble out[][DIM])
{
}
template <> inline void InvTrans<2>(NekDouble in[2][2], NekDouble out[2][2])
template <> inline void InvTrans<2>(NekDouble in[][2], NekDouble out[][2])
{
NekDouble invDet = 1.0 / Determinant(in);
NekDouble invDet = 1.0 / Determinant<2>(in);
out[0][0] = in[1][1] * invDet;
out[1][0] = -in[0][1] * invDet;
......@@ -92,9 +92,9 @@ template <> inline void InvTrans<2>(NekDouble in[2][2], NekDouble out[2][2])
out[1][1] = in[0][0] * invDet;
}
template <> inline void InvTrans<3>(NekDouble in[3][3], NekDouble out[3][3])
template <> inline void InvTrans<3>(NekDouble in[][3], NekDouble out[][3])
{
NekDouble invdet = 1.0 / Determinant(in);
NekDouble invdet = 1.0 / Determinant<3>(in);
out[0][0] = (in[1][1] * in[2][2] - in[2][1] * in[1][2]) * invdet;
out[1][0] = -(in[0][1] * in[2][2] - in[0][2] * in[2][1]) * invdet;
......@@ -117,11 +117,11 @@ template <> inline void InvTrans<3>(NekDouble in[3][3], NekDouble out[3][3])
* @param out Output matrix \f$ F^\top F - I \f$
*/
template <int DIM>
inline void EMatrix(NekDouble in[DIM][DIM], NekDouble out[DIM][DIM])
inline void EMatrix(NekDouble in[][DIM], NekDouble out[][DIM])
{
}
template <> inline void EMatrix<2>(NekDouble in[2][2], NekDouble out[2][2])
template <> inline void EMatrix<2>(NekDouble in[][2], NekDouble out[][2])
{
out[0][0] = 0.5 * (in[0][0] * in[0][0] + in[1][0] * in[1][0] - 1.0);
out[1][0] = 0.5 * (in[0][0] * in[0][1] + in[1][0] * in[1][1]);
......@@ -129,7 +129,7 @@ template <> inline void EMatrix<2>(NekDouble in[2][2], NekDouble out[2][2])
out[1][1] = 0.5 * (in[1][1] * in[1][1] + in[0][1] * in[0][1] - 1.0);
}
template <> inline void EMatrix<3>(NekDouble in[3][3], NekDouble out[3][3])
template <> inline void EMatrix<3>(NekDouble in[][3], NekDouble out[][3])
{
out[0][0] = 0.5 * (in[0][0] * in[0][0] + in[1][0] * in[1][0] +
in[2][0] * in[2][0] - 1.0);
......@@ -228,7 +228,7 @@ inline void LEM3(NekDouble jacDerivPhi[DIM][DIM][DIM],
* @brief Calculate Frobenius inner product of input matrices.
*/
template <int DIM>
inline NekDouble FrobProd(NekDouble in1[DIM][DIM], NekDouble in2[DIM][DIM])
inline NekDouble FrobProd(NekDouble in1[][DIM], NekDouble in2[][DIM])
{
NekDouble ret = 0;
for (int n = 0; n < DIM; ++n)
......@@ -258,7 +258,7 @@ typedef boost::multi_array<NekDouble, 4> DerivArray;
template <int DIM>
inline NekDouble CalcIdealJac(int elmt, int point, DerivArray &deriv,
std::vector<ElUtilSharedPtr> &data,
NekDouble jacIdeal[DIM][DIM])
NekDouble jacIdeal[][DIM])
{
for (int m = 0; m < DIM; ++m)
{
......@@ -281,7 +281,7 @@ inline NekDouble CalcIdealJac(int elmt, int point, DerivArray &deriv,
*
* @param inarray Input matrix \f$ A \f$
*/
template <int DIM> inline NekDouble FrobeniusNorm(NekDouble inarray[DIM][DIM])
template <int DIM> inline NekDouble FrobeniusNorm(NekDouble inarray[][DIM])
{
NekDouble ret = 0.0, *start = &inarray[0][0];
for (int i = 0; i < DIM * DIM; ++i, ++start)
......@@ -305,9 +305,9 @@ NekDouble NodeOpti::GetFunctional(NekDouble &minJacNew, bool gradient)
for (typeIt = m_data.begin(); typeIt != m_data.end(); typeIt++)
{
const int nElmt = typeIt->second.size();
const int totpts = m_derivUtils[typeIt->first]->ptsStd * nElmt;
NekDouble X[DIM * totpts];
int nElmt = typeIt->second.size();
int totpts = m_derivUtils[typeIt->first]->ptsStd * nElmt;
NekDouble* X = new NekDouble[DIM*totpts];
// Store x/y components of each element sequentially in memory
for (int i = 0, cnt = 0; i < nElmt; ++i)
......
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