Commit 288f9cd6 by 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"]);
......
......@@ -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)
for (int i = 0; i < m_fields.num_elements(); ++i)
{
varNames.push_back(m_session->GetVariable(i));
phys[i] = m_fields[i]->UpdatePhys();
phys[i] = m_fields[i]->UpdatePhys();
}
m_coupling->Send(step, m_time, phys, varNames);
......@@ -117,7 +115,6 @@ bool Dummy::v_PreIntegrate(int step)
return UnsteadySystem::v_PreIntegrate(step);
}
/**
* @brief v_PostIntegrate
*/
......@@ -165,7 +162,6 @@ void Dummy::v_Output()
UnsteadySystem::v_Output();
}
/**
* @brief Compute the right-hand side.
*/
......
......@@ -37,9 +37,8 @@
#ifndef NEKTAR_SOLVERS_DummySOLVER_EQUATIONSYSTEMS_DUMMY_H
#define NEKTAR_SOLVERS_DummySOLVER_EQUATIONSYSTEMS_DUMMY_H
#include <SolverUtils/UnsteadySystem.h>
#include <SolverUtils/Core/Coupling.h>
#include <SolverUtils/UnsteadySystem.h>
using namespace Nektar::SolverUtils;
......@@ -53,11 +52,11 @@ public:
/// Creates an instance of this class
static EquationSystemSharedPtr create(
const LibUtilities::SessionReaderSharedPtr& pSession,
const SpatialDomains::MeshGraphSharedPtr& pGraph)
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &pGraph)
{
EquationSystemSharedPtr p = MemoryManager<Dummy>
::AllocateSharedPtr(pSession, pGraph);
EquationSystemSharedPtr p =
MemoryManager<Dummy>::AllocateSharedPtr(pSession, pGraph);
p->InitObject();
return p;
}
......@@ -68,12 +67,11 @@ public:
virtual ~Dummy();
protected:
SolverUtils::CouplingSharedPtr m_coupling;
/// Initialises UnsteadySystem class members.
Dummy(const LibUtilities::SessionReaderSharedPtr& pSession,
const SpatialDomains::MeshGraphSharedPtr& pGraph);
Dummy(const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &pGraph);
virtual void v_InitObject();
......@@ -96,7 +94,6 @@ protected:
{
return false;
}
};
}
......
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