Commit 288f9cd6 authored by Kilian Lackhove's avatar Kilian Lackhove

reformatted newly added files

parent 95c31b13
......@@ -80,11 +80,17 @@ IF ( NEKTAR_USE_CWIPI )
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build CWIPI: ${TPDIST}/lib/lib${CWIPI_LIBRARY}.so ${TPDIST}/lib/lib${CWIPI_LIBRARY_FVMC}.so ${TPDIST}/lib/lib${CWIPI_LIBRARY_BFTC}.so")
MESSAGE(STATUS "Build CWIPI:
${CWIPI_LIBRARY}
${CWIPI_LIBRARY_FVMC}
${CWIPI_LIBRARY_BFTC}")
SET(CWIPI_CONFIG_INCLUDE_DIR ${TPINC})
ELSE ()
ADD_CUSTOM_TARGET(cwipi-0.8.2 ALL)
MESSAGE(STATUS "Found CWIPI: ${CWIPI_LIBRARY} ${CWIPI_LIBRARY_FVMC} ${CWIPI_LIBRARY_BFTC}")
MESSAGE(STATUS "Found CWIPI:
${CWIPI_LIBRARY}
${CWIPI_LIBRARY_FVMC}
${CWIPI_LIBRARY_BFTC}")
SET(CWIPI_CONFIG_INCLUDE_DIR ${CWIPI_INCLUDE_DIR})
ENDIF()
ENDIF( NEKTAR_USE_CWIPI )
......
......@@ -6,7 +6,7 @@
//
// The MIT License
//
// Copyright (c) 2015 Kilian Lackhove
// Copyright (c) 2018 Kilian Lackhove
// 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).
......@@ -34,8 +34,8 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/Communication/CommCwipi.h>
#include <LibUtilities/BasicUtils/SharedArray.hpp>
#include <LibUtilities/Communication/CommCwipi.h>
#include <cwipi.h>
......@@ -44,15 +44,13 @@ namespace Nektar
namespace LibUtilities
{
std::string CommCwipi::className
= GetCommFactory().RegisterCreatorFunction("CWIPI", CommCwipi::create,
"Parallel communication using MPI with CWIPI.");
std::string CommCwipi::className = GetCommFactory().RegisterCreatorFunction(
"CWIPI", CommCwipi::create, "Parallel communication using MPI with CWIPI.");
/**
*
*/
CommCwipi::CommCwipi(int narg, char* arg[])
: CommMpi()
CommCwipi::CommCwipi(int narg, char *arg[]) : CommMpi()
{
int init = 0;
MPI_Initialized(&init);
......@@ -69,7 +67,7 @@ CommCwipi::CommCwipi(int narg, char* arg[])
{
if (!std::strcmp(arg[i], "--cwipi"))
{
localName = arg[i+1];
localName = arg[i + 1];
}
}
......@@ -77,13 +75,12 @@ CommCwipi::CommCwipi(int narg, char* arg[])
cwipi_init(MPI_COMM_WORLD, localName.c_str(), &localComm);
m_comm = localComm;
MPI_Comm_size( m_comm, &m_size );
MPI_Comm_rank( m_comm, &m_rank );
MPI_Comm_size(m_comm, &m_size);
MPI_Comm_rank(m_comm, &m_rank);
m_type = "Parallel MPI with CWIPI";
}
/**
*
*/
......@@ -99,7 +96,5 @@ void CommCwipi::v_Finalise()
cwipi_finalize();
CommMpi::v_Finalise();
}
}
}
......@@ -6,7 +6,7 @@
//
// The MIT License
//
// Copyright (c) 2015 Kilian Lackhove
// Copyright (c) 2018 Kilian Lackhove
// 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).
......@@ -36,8 +36,8 @@
#ifndef NEKTAR_LIB_UTILITIES_COMMCWIPI_H
#define NEKTAR_LIB_UTILITIES_COMMCWIPI_H
#include <string>
#include <mpi.h>
#include <string>
#include <LibUtilities/Communication/CommMpi.h>
#include <LibUtilities/Memory/NekMemoryManager.hpp>
......@@ -58,7 +58,7 @@ class CommCwipi : public CommMpi
public:
/// Creates an instance of this class
static CommSharedPtr create(int narg, char* arg[])
static CommSharedPtr create(int narg, char *arg[])
{
return MemoryManager<CommCwipi>::AllocateSharedPtr(narg, arg);
}
......@@ -66,16 +66,13 @@ public:
/// Name of class
static std::string className;
CommCwipi(int narg, char* arg[]);
CommCwipi(int narg, char *arg[]);
virtual ~CommCwipi();
protected:
virtual void v_Finalise();
};
}
}
......
......@@ -115,8 +115,7 @@ void Coupling::v_Init()
ParseUtils::GenerateVector(m_config["RECEIVEVARIABLES"], m_recvFieldNames);
m_nRecvVars = m_recvFieldNames.size();
ParseUtils::GenerateVector(m_config["SENDVARIABLES"],
m_sendFieldNames);
ParseUtils::GenerateVector(m_config["SENDVARIABLES"], m_sendFieldNames);
m_nSendVars = m_sendFieldNames.size();
m_recvSteps = boost::lexical_cast<int>(m_config["RECEIVESTEPS"]);
......
......@@ -33,9 +33,9 @@
#include "CouplingCwipi.h"
#include <LibUtilities/BasicUtils/CsvIO.h>
#include <LibUtilities/BasicUtils/ParseUtils.h>
#include <LibUtilities/BasicUtils/PtsField.h>
#include <LibUtilities/BasicUtils/CsvIO.h>
#include <LibUtilities/BasicUtils/Timer.h>
#include <LibUtilities/BasicUtils/Vmath.hpp>
#include <LibUtilities/Foundations/Interp.h>
......@@ -45,8 +45,8 @@
#include <MultiRegions/ContField2D.h>
#include <MultiRegions/ContField3D.h>
#include <boost/functional/hash.hpp>
#include <boost/format.hpp>
#include <boost/functional/hash.hpp>
#define OUTPUT_FREQ 0
......@@ -112,18 +112,20 @@ void CouplingCwipi::InterpCallback(
}
}
CouplingCwipi::CouplingCwipi(MultiRegions::ExpListSharedPtr field): Coupling(field), m_sendHandle(-1), m_recvHandle(-1), m_lastSend(-1E6),m_lastReceive(-1E6), m_points(NULL), m_coords(NULL), m_connecIdx(NULL),
CouplingCwipi::CouplingCwipi(MultiRegions::ExpListSharedPtr field)
: Coupling(field), m_sendHandle(-1), m_recvHandle(-1), m_lastSend(-1E6),
m_lastReceive(-1E6), m_points(NULL), m_coords(NULL), m_connecIdx(NULL),
m_connec(NULL), m_rValsInterl(NULL), m_sValsInterl(NULL)
{
// defaults
m_config["GEOMTOL"] = "0.1";
m_config["LOCALNAME"] = "nektar";
m_config["REMOTENAME"] = "precise";
m_config["OVERSAMPLE"] = "0";
m_config["FILTERWIDTH"] = "-1";
m_config["DUMPRAW"] = "0";
m_config["SENDMETHOD"] = "NEARESTNEIGHBOUR";
m_config["NOTLOCMETHOD"] = "KEEP";
m_config["GEOMTOL"] = "0.1";
m_config["LOCALNAME"] = "nektar";
m_config["REMOTENAME"] = "precise";
m_config["OVERSAMPLE"] = "0";
m_config["FILTERWIDTH"] = "-1";
m_config["DUMPRAW"] = "0";
m_config["SENDMETHOD"] = "NEARESTNEIGHBOUR";
m_config["NOTLOCMETHOD"] = "KEEP";
}
void CouplingCwipi::v_Init()
......@@ -138,7 +140,10 @@ void CouplingCwipi::v_Init()
"recvFieldNames", m_config["RECEIVEVARIABLES"].c_str());
cwipi_add_local_string_control_parameter("sendFieldNames",
m_config["SENDVARIABLES"].c_str());
m_recvTag = boost::hash<std::string>()(m_couplingName + m_config["REMOTENAME"] + m_config["LOCALNAME"]) % INT_MAX;
m_recvTag =
boost::hash<std::string>()(m_couplingName + m_config["REMOTENAME"] +
m_config["LOCALNAME"]) %
INT_MAX;
cwipi_add_local_int_control_parameter("receiveTag", m_recvTag);
m_spacedim = m_evalField->GetGraph()->GetSpaceDimension();
......@@ -170,18 +175,23 @@ void CouplingCwipi::v_Init()
cwipi_dump_application_properties();
}
m_sendTag = cwipi_get_distant_int_control_parameter(m_config["REMOTENAME"].c_str(), "receiveTag");
m_sendTag = cwipi_get_distant_int_control_parameter(
m_config["REMOTENAME"].c_str(), "receiveTag");
if (cwipi_has_int_parameter(m_config["REMOTENAME"].c_str(), "nRecvVars"))
{
int remoteNRecvVars = cwipi_get_distant_int_control_parameter(m_config["REMOTENAME"].c_str(), "nRecvVars");
ASSERTL0(remoteNRecvVars == m_nSendVars, "Number of local send vars different to remote received vars");
int remoteNRecvVars = cwipi_get_distant_int_control_parameter(
m_config["REMOTENAME"].c_str(), "nRecvVars");
ASSERTL0(remoteNRecvVars == m_nSendVars,
"Number of local send vars different to remote received vars");
}
if (cwipi_has_int_parameter(m_config["REMOTENAME"].c_str(), "nSendVars"))
{
int remoteNSendVars = cwipi_get_distant_int_control_parameter(m_config["REMOTENAME"].c_str(), "nSendVars");
ASSERTL0(remoteNSendVars == m_nRecvVars, "Number of local receive vars different to remote sent vars");
int remoteNSendVars = cwipi_get_distant_int_control_parameter(
m_config["REMOTENAME"].c_str(), "nSendVars");
ASSERTL0(remoteNSendVars == m_nRecvVars,
"Number of local receive vars different to remote sent vars");
}
AnnounceMesh();
......@@ -341,8 +351,12 @@ void CouplingCwipi::SetupSend()
std::stringstream sst;
sst << m_spacedim << "," << m_evalField->GetGraph()->GetNvertices() << ","
<< m_nSendVars;
SendCallbackMap[sst.str()] = std::bind(&CouplingCwipi::SendCallback, this, std::placeholders::_1, std::placeholders::_2);
cwipi_set_interpolation_function(m_couplingName.c_str(), CouplingCwipi::InterpCallback);
SendCallbackMap[sst.str()] = std::bind(&CouplingCwipi::SendCallback,
this,
std::placeholders::_1,
std::placeholders::_2);
cwipi_set_interpolation_function(m_couplingName.c_str(),
CouplingCwipi::InterpCallback);
}
void CouplingCwipi::EvaluateFields(
......@@ -464,7 +478,7 @@ void CouplingCwipi::AnnounceMesh()
};
int nVerts = graph->GetNvertices();
int nElts = seggeom.size() + trigeom.size() + quadgeom.size() +
int nElts = seggeom.size() + trigeom.size() + quadgeom.size() +
tetgeom.size() + pyrgeom.size() + prismgeom.size() +
hexgeom.size();
......@@ -564,7 +578,6 @@ void CouplingCwipi::AddElementsToMesh(T geom,
}
}
void CouplingCwipi::SendCallback(
Array<OneD, Array<OneD, NekDouble> > &interpField,
Array<OneD, Array<OneD, NekDouble> > &distCoords)
......@@ -577,10 +590,9 @@ void CouplingCwipi::SendCallback(
}
if (boost::to_upper_copy(m_config["SENDMETHOD"]) == "NEARESTNEIGHBOUR" ||
boost::to_upper_copy(m_config["SENDMETHOD"]) == "SHEPARD"
)
boost::to_upper_copy(m_config["SENDMETHOD"]) == "SHEPARD")
{
if (! m_sendInterpolator)
if (!m_sendInterpolator)
{
SetupSendInterpolation();
}
......@@ -616,8 +628,9 @@ void CouplingCwipi::v_Send(
m_lastSend = step;
vector<int> sendVarsToVars = GenerateVariableMapping(varNames, m_sendFieldNames);
m_sendField = Array<OneD, Array<OneD, NekDouble> > (m_nSendVars);
vector<int> sendVarsToVars =
GenerateVariableMapping(varNames, m_sendFieldNames);
m_sendField = Array<OneD, Array<OneD, NekDouble> >(m_nSendVars);
for (int i = 0; i < sendVarsToVars.size(); ++i)
{
m_sendField[i] = field[sendVarsToVars[i]];
......@@ -637,14 +650,14 @@ void CouplingCwipi::v_Send(
strcpy(sendFN, "dummyName");
cwipi_issend(m_couplingName.c_str(),
"ex1",
m_sendTag,
m_nSendVars,
step,
time,
sendFN,
m_sValsInterl,
&m_sendHandle);
"ex1",
m_sendTag,
m_nSendVars,
step,
time,
sendFN,
m_sValsInterl,
&m_sendHandle);
timer1.Stop();
if (m_evalField->GetComm()->GetRank() == 0 &&
......@@ -655,7 +668,6 @@ void CouplingCwipi::v_Send(
}
}
void CouplingCwipi::SendComplete()
{
if (m_sendHandle < 0)
......@@ -678,7 +690,6 @@ void CouplingCwipi::SendComplete()
}
}
void CouplingCwipi::ReceiveStart()
{
if (m_recvHandle >= 0)
......@@ -712,9 +723,9 @@ void CouplingCwipi::ReceiveStart()
}
void CouplingCwipi::v_Receive(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames)
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames)
{
if (m_nRecvVars < 1 || m_recvSteps < 1)
{
......@@ -722,7 +733,8 @@ void CouplingCwipi::v_Receive(const int step,
}
Array<OneD, Array<OneD, NekDouble> > recvFields(m_nRecvVars);
vector<int> recvVarsToVars = GenerateVariableMapping(varNames, m_recvFieldNames);
vector<int> recvVarsToVars =
GenerateVariableMapping(varNames, m_recvFieldNames);
ASSERTL1(m_nRecvVars == recvVarsToVars.size(), "field size mismatch");
for (int i = 0; i < recvVarsToVars.size(); ++i)
{
......@@ -769,8 +781,8 @@ void CouplingCwipi::v_Receive(const int step,
}
void CouplingCwipi::ReceiveCwipi(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field)
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field)
{
ASSERTL1(m_nRecvVars == field.num_elements(), "field size mismatch");
......@@ -786,7 +798,8 @@ void CouplingCwipi::ReceiveCwipi(const int step,
if (m_evalField->GetComm()->GetRank() == 0 &&
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
{
cout << "waiting for receive at i = " << step << ", t = " << time << endl;
cout << "waiting for receive at i = " << step << ", t = " << time
<< endl;
}
LibUtilities::Timer timer1, timer2, timer3;
......@@ -806,15 +819,15 @@ void CouplingCwipi::ReceiveCwipi(const int step,
// set to -1 so we know we can start receiving again
m_recvHandle = -1;
int nNotLoc = cwipi_get_n_not_located_points(m_couplingName.c_str());
Array<OneD, int> notLoc;
if (nNotLoc != 0)
{
cout << "WARNING: relocating " << nNotLoc << " of " << m_nPoints
<< " points" << endl;
<< " points" << endl;
const int *tmp = cwipi_get_not_located_points(m_couplingName.c_str());
const int *tmp =
cwipi_get_not_located_points(m_couplingName.c_str());
notLoc = Array<OneD, int>(nNotLoc);
for (int i = 0; i < nNotLoc; ++i)
{
......@@ -832,7 +845,6 @@ void CouplingCwipi::ReceiveCwipi(const int step,
}
}
for (int i = 0, locPos = 0, intPos = 0; i < m_nPoints; ++i)
{
if (locPos < nNotLoc && notLoc[locPos] == i)
......@@ -857,7 +869,8 @@ void CouplingCwipi::ReceiveCwipi(const int step,
{
doExtrapolate = 1;
}
m_evalField->GetSession()->GetComm()->AllReduce(doExtrapolate, LibUtilities::ReduceMax);
m_evalField->GetSession()->GetComm()->AllReduce(
doExtrapolate, LibUtilities::ReduceMax);
if (doExtrapolate > 0)
{
ExtrapolateFields(rVals, notLoc);
......@@ -898,10 +911,11 @@ void CouplingCwipi::ReceiveCwipi(const int step,
timer3.Stop();
if (m_evalField->GetComm()->GetRank() == 0 &&
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
m_evalField->GetSession()->DefinesCmdLineArgument(
"verbose"))
{
cout << "Smoother time (" << m_recvFieldNames[i]
<< "): " << timer3.TimePerTest(1) << endl;
<< "): " << timer3.TimePerTest(1) << endl;
}
}
}
......@@ -926,7 +940,6 @@ void CouplingCwipi::ReceiveCwipi(const int step,
}
}
void CouplingCwipi::ExtrapolateFields(
Array<OneD, Array<OneD, NekDouble> > &rVals, Array<OneD, int> &notLoc)
{
......@@ -1025,7 +1038,7 @@ void CouplingCwipi::ExtrapolateFields(
// perform a nearest neighbour interpolation from locatedVals to the not
// located rVals
if (! m_extrapInterpolator)
if (!m_extrapInterpolator)
{
m_extrapInterpolator =
MemoryManager<FieldUtils::Interpolator>::AllocateSharedPtr(
......@@ -1064,7 +1077,7 @@ void CouplingCwipi::DumpRawFields(const NekDouble time,
// two digits in the exponents of Scientific notation.
unsigned int old_exponent_format;
old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
filename = boost::str(boost::format(filename) % m_time);
filename = boost::str(boost::format(filename) % m_time);
_set_output_format(old_exponent_format);
#else
std::string filename =
......@@ -1091,7 +1104,7 @@ void CouplingCwipi::DumpRawFields(const NekDouble time,
timer1.Stop();
if (m_evalField->GetComm()->GetRank() == 0 &&
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
{
cout << "DumpRawFields total time: " << timer1.TimePerTest(1) << endl;
}
......
......@@ -49,17 +49,14 @@ namespace SolverUtils
class CouplingCwipi;
class CouplingCwipi : public Coupling
{
public:
static std::string className;
/// Creates an instance of this class
static CouplingSharedPtr create(
MultiRegions::ExpListSharedPtr field)
static CouplingSharedPtr create(MultiRegions::ExpListSharedPtr field)
{
CouplingSharedPtr p =
MemoryManager<CouplingCwipi>::AllocateSharedPtr(field);
......@@ -69,10 +66,11 @@ public:
SOLVER_UTILS_EXPORT CouplingCwipi(MultiRegions::ExpListSharedPtr field);
SOLVER_UTILS_EXPORT virtual ~CouplingCwipi();
SOLVER_UTILS_EXPORT virtual ~CouplingCwipi();
SOLVER_UTILS_EXPORT void SendCallback(Array<OneD, Array<OneD, NekDouble> > &interpField,
Array<OneD, Array<OneD, NekDouble> > &distCoords);
SOLVER_UTILS_EXPORT void SendCallback(
Array<OneD, Array<OneD, NekDouble> > &interpField,
Array<OneD, Array<OneD, NekDouble> > &distCoords);
SOLVER_UTILS_EXPORT static void InterpCallback(
const int entities_dim,
......@@ -98,7 +96,6 @@ public:
void *distant_field);
protected:
NekDouble m_filtWidth;
Array<OneD, Array<OneD, NekDouble> > m_sendField;
......@@ -134,19 +131,22 @@ 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);
SOLVER_UTILS_EXPORT virtual void v_Send(
const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames);
SOLVER_UTILS_EXPORT virtual void v_Receive(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames);
SOLVER_UTILS_EXPORT virtual void v_Receive(
const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames);
SOLVER_UTILS_EXPORT virtual void v_Finalize();
SOLVER_UTILS_EXPORT const NekDouble GetSendField(const int i, const int j) const
SOLVER_UTILS_EXPORT const NekDouble GetSendField(const int i,
const int j) const
{
return m_sendField[i][j];
}
......@@ -163,8 +163,8 @@ private:
void ReceiveStart();
void ReceiveCwipi(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field);
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field);
void EvaluateFields(Array<OneD, Array<OneD, NekDouble> > interpField,
Array<OneD, Array<OneD, NekDouble> > distCoords);
......@@ -191,7 +191,6 @@ typedef std::function<void(Array<OneD, Array<OneD, NekDouble> > &interpField,
SendCallbackType;
static std::map<std::string, SendCallbackType> SendCallbackMap;
}
}
......
......@@ -33,8 +33,8 @@
#include "CouplingFile.h"
#include <LibUtilities/BasicUtils/ParseUtils.h>
#include <LibUtilities/BasicUtils/ErrorUtil.hpp>
#include <LibUtilities/BasicUtils/ParseUtils.h>
#include <LibUtilities/BasicUtils/PtsField.h>
#include <LibUtilities/BasicUtils/PtsIO.h>
......@@ -55,7 +55,7 @@ CouplingFile::CouplingFile(MultiRegions::ExpListSharedPtr field)
: Coupling(field), m_lastSend(-1E6), m_lastReceive(-1E6)
{
m_config["RECEIVEFUNCTION"] = "CouplingIn";
m_config["SENDFILENAME"] = "CouplingOut_%14.8E.pts";
m_config["SENDFILENAME"] = "CouplingOut_%14.8E.pts";
}
CouplingFile::~CouplingFile()
......@@ -69,7 +69,10 @@ void CouplingFile::v_Init()
if (m_nRecvVars > 0 && m_recvSteps > 0)
{
m_inputFunction = MemoryManager<SessionFunction>::AllocateSharedPtr(
m_evalField->GetSession(), m_evalField, m_config["RECEIVEFUNCTION"], true);
m_evalField->GetSession(),
m_evalField,
m_config["RECEIVEFUNCTION"],
true);
}
}
......@@ -93,8 +96,7 @@ void CouplingFile::v_Send(
if (m_evalField->GetComm()->GetRank() == 0 &&
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
{
cout << "sending fields at i = " << step << ", t = " << time
<< endl;
cout << "sending fields at i = " << step << ", t = " << time << endl;
}
vector<int> sendVarsToVars =
......@@ -105,7 +107,8 @@ void CouplingFile::v_Send(
// two digits in the exponents of Scientific notation.
unsigned int old_exponent_format;
old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
std::string filename = boost::str(boost::format(m_config["SENDFILENAME"]) % time);
std::string filename =
boost::str(boost::format(m_config["SENDFILENAME"]) % time);
_set_output_format(old_exponent_format);
#else
std::string filename =
......@@ -154,26 +157,25 @@ void CouplingFile::v_Receive(const int step,
if (m_evalField->GetComm()->GetRank() == 0 &&
m_evalField->GetSession()->DefinesCmdLineArgument("verbose"))
{
cout << "receiving fields at i = " << step << ", t = " << time
<< endl;
cout << "receiving fields at i = " << step << ", t = " << time << endl;
}
string filename = m_evalField->GetSession()->GetFunctionFilename(m_config["RECEIVEFUNCTION"], m_recvFieldNames[0]);
string filename = m_evalField->GetSession()->GetFunctionFilename(
m_config["RECEIVEFUNCTION"], m_recvFieldNames[0]);
#ifdef _WIN32
// We need this to make sure boost::format has always
// two digits in the exponents of Scientific notation.
unsigned int old_exponent_format;
old_exponent_format = _set_output_format(_TWO_DIGIT_EXPONENT);
filename = boost::str(boost::format(filename) % time);
filename = boost::str(boost::format(filename) % time);
_set_output_format(old_exponent_format);
#else
filename =
boost::str(boost::format(filename) % time);
filename = boost::str(boost::format(filename) % time);
#endif
int exists = 0;
while (! exists)
while (!exists)
{
exists = fs::exists(filename);
m_evalField->GetComm()->AllReduce(exists, LibUtilities::ReduceMin);
......@@ -187,9 +189,12 @@ void CouplingFile::v_Receive(const int step,
ASSERTL1(m_nRecvVars == recvVarsToVars.size(), "field size mismatch");
for (int i = 0; i < recvVarsToVars.size(); ++i)
{
Vmath::Vcopy(recvFields[i].num_elements(), recvFields[i], 1, field[recvVarsToVars[i]], 1);
Vmath::Vcopy(recvFields[i].num_elements(),
recvFields[i],
1,
field[recvVarsToVars[i]],
1);
}
}
}
}
......@@ -27,7 +27,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: File based Coupling class. Rather pointless, only for demonstration.
// Description: File based Coupling class. Rather pointless, only for
// demonstration.
//
///////////////////////////////////////////////////////////////////////////////
......@@ -51,7 +52,8 @@ public:
static std::string className;
/// Creates an instance of this class
SOLVER_UTILS_EXPORT static CouplingSharedPtr create(MultiRegions::ExpListSharedPtr field)
SOLVER_UTILS_EXPORT static CouplingSharedPtr create(
MultiRegions::ExpListSharedPtr field)
{
CouplingSharedPtr p =
MemoryManager<CouplingFile>::AllocateSharedPtr(field);
......@@ -66,15 +68,17 @@ public:
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);
SOLVER_UTILS_EXPORT virtual void v_Send(
const int step,
const NekDouble time,
const Array<OneD, const Array<OneD, NekDouble> > &field,
vector<string> &varNames);
SOLVER_UTILS_EXPORT virtual void v_Receive(const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames);
SOLVER_UTILS_EXPORT virtual void v_Receive(
const int step,
const NekDouble time,
Array<OneD, Array<OneD, NekDouble> > &field,
vector<string> &varNames);
private:
int m_lastSend;
......
......@@ -34,8 +34,8 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <SolverUtils/Driver.h>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <SolverUtils/Driver.h>
using namespace std;
using namespace Nektar;
......
......@@ -47,9 +47,8 @@ string Dummy::className = GetEquationSystemFactory().RegisterCreatorFunction(
Dummy::create,
"Dummy Equation System that only sends/receives fields");
Dummy::Dummy(
const LibUtilities::SessionReaderSharedPtr& pSession,
const SpatialDomains::MeshGraphSharedPtr& pGraph)
Dummy::Dummy(const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &pGraph)
: UnsteadySystem(pSession, pGraph)
{
}
......@@ -68,7 +67,7 @@ void Dummy::v_InitObject()
if (m_session->DefinesElement("Nektar/Coupling"))
{
TiXmlElement* vCoupling = m_session->GetElement("Nektar/Coupling");
TiXmlElement *vCoupling = m_session->GetElement("Nektar/Coupling");
ASSERTL0(vCoupling->Attribute("TYPE"),
"Missing TYPE attribute in Coupling");
......@@ -94,7 +93,6 @@ Dummy::~Dummy()
{
}
/**
* @brief v_PreIntegrate
*/
......@@ -107,7 +105,7 @@ bool Dummy::v_PreIntegrate(int step)