Commit 95c31b13 by Kilian Lackhove

addressed Dave's suggestions

parent 7daea9ba
......@@ -10,13 +10,10 @@ OPTION(NEKTAR_USE_CWIPI
"Use CWIPI for Coupling." OFF)
IF ( NEKTAR_USE_CWIPI )
set(CWIPI_DIR "/usr/local/cwipi" CACHE PATH "CWIPI base path")
find_package(Cwipi)
include_directories(${CWIPI_INCLUDE_DIRS})
ADD_DEFINITIONS(-DNEKTAR_USE_CWIPI)
ENDIF ( NEKTAR_USE_CWIPI )
IF (NEKTAR_USE_CWIPI)
# Set some common CWIPI search paths.
SET(CWIPI_SEARCH_PATHS $ENV{LD_LIBRARY_PATH} $ENV{CWIPI_HOME}/lib)
FIND_LIBRARY(CWIPI_LIBRARY NAMES cwipi fvmc bftc PATHS ${CWIPI_SEARCH_PATHS})
......@@ -71,12 +68,12 @@ IF (NEKTAR_USE_CWIPI)
BUILD_COMMAND make -j 1
)
SET(CWIPI_LIBRARY cwipi CACHE FILEPATH
"CWIPI library" FORCE)
SET(CWIPI_LIBRARY_FVMC fvmc CACHE FILEPATH
"CWIPI library" FORCE)
SET(CWIPI_LIBRARY_BFTC bftc CACHE FILEPATH
"CWIPI library" FORCE)
THIRDPARTY_LIBRARY(CWIPI_LIBRARY SHARED cwipi
DESCRIPTION "CWIPI main library")
THIRDPARTY_LIBRARY(CWIPI_LIBRARY_FVMC SHARED fvmc
DESCRIPTION "CWIPI fvmc library")
THIRDPARTY_LIBRARY(CWIPI_LIBRARY_BFTC SHARED bftc
DESCRIPTION "CWIPI bftc library")
SET(CWIPI_INCLUDE_DIR ${TPDIST}/include CACHE FILEPATH
"CWIPI include" FORCE)
......@@ -94,7 +91,6 @@ ENDIF( NEKTAR_USE_CWIPI )
INCLUDE_DIRECTORIES(SYSTEM ${CWIPI_INCLUDE_DIR})
MARK_AS_ADVANCED(CWIPI_DIR)
MARK_AS_ADVANCED(CWIPI_LIBRARY)
MARK_AS_ADVANCED(CWIPI_LIBRARY_FVMC)
MARK_AS_ADVANCED(CWIPI_LIBRARY_BFTC)
......
......@@ -115,7 +115,7 @@ public:
Array<OneD, int> &pRecvDataSizeMap,
Array<OneD, int> &pRecvDataOffsetMap);
template <class T>
void AllGathervI(T &pRecvData,
void AllGatherv(T &pRecvData,
Array<OneD, int> &pRecvDataSizeMap,
Array<OneD, int> &pRecvDataOffsetMap);
......@@ -170,8 +170,8 @@ protected:
virtual void v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype,
void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype) = 0;
virtual void v_AllGathervI(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype) = 0;
virtual void v_AllGatherv(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype) = 0;
virtual void v_Bcast(void *buffer, int count, CommDataType dt,
int root) = 0;
......@@ -371,18 +371,18 @@ void Comm::AllGatherv(T &pSendData,
*
*/
template <class T>
void Comm::AllGathervI(T &pRecvData,
Array<OneD, int> &pRecvDataSizeMap,
Array<OneD, int> &pRecvDataOffsetMap)
void Comm::AllGatherv(T &pRecvData,
Array<OneD, int> &pRecvDataSizeMap,
Array<OneD, int> &pRecvDataOffsetMap)
{
BOOST_STATIC_ASSERT_MSG(
CommDataTypeTraits<T>::IsVector,
"AllGatherv only valid with Array or vector arguments.");
v_AllGathervI(CommDataTypeTraits<T>::GetPointer(pRecvData),
pRecvDataSizeMap.get(),
pRecvDataOffsetMap.get(),
CommDataTypeTraits<T>::GetDataType());
v_AllGatherv(CommDataTypeTraits<T>::GetPointer(pRecvData),
pRecvDataSizeMap.get(),
pRecvDataOffsetMap.get(),
CommDataTypeTraits<T>::GetDataType());
}
/**
......
......@@ -65,7 +65,8 @@ CommCwipi::CommCwipi(int narg, char* arg[])
}
std::string localName = "";
for (int i = 0; i < narg; ++i) {
for (int i = 0; i < narg; ++i)
{
if (!std::strcmp(arg[i], "--cwipi"))
{
localName = arg[i+1];
......
......@@ -50,7 +50,7 @@ namespace LibUtilities
class CommCwipi;
/// Pointer to a Communicator object.
typedef boost::shared_ptr<CommCwipi> CommCwipiSharedPtr;
typedef std::shared_ptr<CommCwipi> CommCwipiSharedPtr;
/// A global linear system.
class CommCwipi : public CommMpi
......
......@@ -294,8 +294,8 @@ void CommMpi::v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype,
ASSERTL0(retval == MPI_SUCCESS, "MPI error performing Allgather.");
}
void CommMpi::v_AllGathervI(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype)
void CommMpi::v_AllGatherv(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype)
{
int retval = MPI_Allgatherv(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL, recvbuf,
recvcounts, rdispls, recvtype, m_comm);
......
......@@ -110,8 +110,8 @@ protected:
virtual void v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype,
void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype);
virtual void v_AllGathervI(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype);
virtual void v_AllGatherv(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype);
virtual void v_Bcast(void *buffer, int count, CommDataType dt, int root);
virtual void v_Exscan(Array<OneD, unsigned long long> &pData,
const enum ReduceOperator pOp,
......
......@@ -171,8 +171,8 @@ void CommSerial::v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtyp
{
}
void CommSerial::v_AllGathervI(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype)
void CommSerial::v_AllGatherv(void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype)
{
}
......
......@@ -96,18 +96,18 @@ protected:
void *sendbuf, int sendcounts[], int sensdispls[],
CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[],
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_AllGather(void *sendbuf, int sendcount,
CommDataType sendtype,
void *recvbuf, int recvcount,
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_AllGather(void *sendbuf, int sendcount,
CommDataType sendtype,
void *recvbuf, int recvcount,
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_AllGatherv(void *sendbuf, int sendcount,
CommDataType sendtype,
void *recvbuf, int recvcounts[],
int rdispls[],
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_AllGathervI(void *recvbuf, int recvcounts[],
int rdispls[],
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_AllGatherv(void *recvbuf, int recvcounts[],
int rdispls[],
CommDataType recvtype);
LIB_UTILITIES_EXPORT virtual void v_Bcast(void *buffer, int count,
CommDataType dt, int root);
LIB_UTILITIES_EXPORT virtual void v_Exscan(
......
......@@ -45,13 +45,12 @@ namespace SolverUtils
class Coupling;
SOLVER_UTILS_EXPORT typedef std::shared_ptr<Coupling> CouplingSharedPointer;
SOLVER_UTILS_EXPORT typedef std::shared_ptr<Coupling> CouplingSharedPtr;
/// Declaration of the Coupling factory
SOLVER_UTILS_EXPORT typedef LibUtilities::NekFactory<std::string,
Coupling,
MultiRegions::ExpListSharedPtr>
CouplingFactory;
SOLVER_UTILS_EXPORT typedef LibUtilities::
NekFactory<std::string, Coupling, MultiRegions::ExpListSharedPtr>
CouplingFactory;
/// Declaration of the Coupling factory singleton
SOLVER_UTILS_EXPORT CouplingFactory &GetCouplingFactory();
......@@ -62,12 +61,14 @@ class Coupling
public:
typedef std::map<std::string, std::string> CouplingConfigMap;
SOLVER_UTILS_EXPORT virtual ~Coupling(){};
SOLVER_UTILS_EXPORT virtual ~Coupling()
{
}
SOLVER_UTILS_EXPORT inline void Init()
{
v_Init();
};
}
SOLVER_UTILS_EXPORT inline const std::map<std::string, std::string> GetConfig()
{
......@@ -87,23 +88,25 @@ public:
SOLVER_UTILS_EXPORT inline void Finalize()
{
v_Finalize();
};
}
SOLVER_UTILS_EXPORT inline void Send(const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames)
SOLVER_UTILS_EXPORT inline void Send(
const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames)
{
v_Send(step, time, field, varNames);
};
}
SOLVER_UTILS_EXPORT inline void Receive(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames)
SOLVER_UTILS_EXPORT inline void Receive(
const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames)
{
v_Receive(step, time, field, varNames);
};
}
protected:
std::string m_couplingName;
......@@ -124,10 +127,11 @@ protected:
SOLVER_UTILS_EXPORT virtual void v_Init();
SOLVER_UTILS_EXPORT virtual void v_Send(const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames) = 0;
SOLVER_UTILS_EXPORT virtual void v_Send(
const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames) = 0;
SOLVER_UTILS_EXPORT virtual void v_Receive(
const int step,
......@@ -137,10 +141,10 @@ protected:
SOLVER_UTILS_EXPORT virtual void v_Finalize()
{
};
SOLVER_UTILS_EXPORT std::vector<int> GenerateVariableMapping(std::vector<std::string> &vars, std::vector<std::string> &transVars);
}
SOLVER_UTILS_EXPORT std::vector<int> GenerateVariableMapping(
std::vector<std::string> &vars, std::vector<std::string> &transVars);
};
}
}
......
......@@ -341,7 +341,7 @@ void CouplingCwipi::SetupSend()
std::stringstream sst;
sst << m_spacedim << "," << m_evalField->GetGraph()->GetNvertices() << ","
<< m_nSendVars;
SendCallbackMap[sst.str()] = boost::bind(&CouplingCwipi::SendCallback, this, _1, _2);
SendCallbackMap[sst.str()] = std::bind(&CouplingCwipi::SendCallback, this, std::placeholders::_1, std::placeholders::_2);
cwipi_set_interpolation_function(m_couplingName.c_str(), CouplingCwipi::InterpCallback);
}
......@@ -999,7 +999,7 @@ void CouplingCwipi::ExtrapolateFields(
timer2.Start();
for (int i = 0; i < totvars; ++i)
{
m_evalField->GetSession()->GetComm()->AllGathervI(
m_evalField->GetSession()->GetComm()->AllGatherv(
locatedVals[i], sizeMap, offsetMap);
}
timer2.Stop();
......
......@@ -40,6 +40,8 @@
#include <cwipi.h>
#include <functional>
namespace Nektar
{
namespace SolverUtils
......@@ -47,8 +49,6 @@ namespace SolverUtils
class CouplingCwipi;
typedef std::shared_ptr<CouplingCwipi> CouplingCwipiSharedPointer;
class CouplingCwipi : public Coupling
{
......@@ -58,10 +58,10 @@ public:
static std::string className;
/// Creates an instance of this class
static CouplingSharedPointer create(
static CouplingSharedPtr create(
MultiRegions::ExpListSharedPtr field)
{
CouplingSharedPointer p =
CouplingSharedPtr p =
MemoryManager<CouplingCwipi>::AllocateSharedPtr(field);
p->Init();
return p;
......@@ -186,8 +186,8 @@ private:
int &conidxPos);
};
typedef boost::function<void(Array<OneD, Array<OneD, NekDouble> > &interpField,
Array<OneD, Array<OneD, NekDouble> > &distCoords)>
typedef std::function<void(Array<OneD, Array<OneD, NekDouble> > &interpField,
Array<OneD, Array<OneD, NekDouble> > &distCoords)>
SendCallbackType;
static std::map<std::string, SendCallbackType> SendCallbackMap;
......
......@@ -44,8 +44,6 @@ namespace SolverUtils
class CouplingFile;
typedef std::shared_ptr<CouplingFile> CouplingFileSharedPointer;
class CouplingFile : public Coupling
{
......@@ -53,9 +51,9 @@ public:
static std::string className;
/// Creates an instance of this class
SOLVER_UTILS_EXPORT static CouplingSharedPointer create(MultiRegions::ExpListSharedPtr field)
SOLVER_UTILS_EXPORT static CouplingSharedPtr create(MultiRegions::ExpListSharedPtr field)
{
CouplingSharedPointer p =
CouplingSharedPtr p =
MemoryManager<CouplingFile>::AllocateSharedPtr(field);
p->Init();
return p;
......
......@@ -74,7 +74,7 @@ class APE : public AdvectionSystem
virtual ~APE();
protected:
SolverUtils::CouplingSharedPointer m_coupling;
SolverUtils::CouplingSharedPtr m_coupling;
SolverUtils::AdvectionSharedPtr m_advection;
std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
SolverUtils::RiemannSolverSharedPtr m_riemannSolver;
......
......@@ -69,7 +69,7 @@ public:
protected:
SolverUtils::CouplingSharedPointer m_coupling;
SolverUtils::CouplingSharedPtr m_coupling;
/// Initialises UnsteadySystem class members.
Dummy(const LibUtilities::SessionReaderSharedPtr& pSession,
......
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