1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2003-2014 by The University of Queensland //
// Centre for Geoscience Computing //
// http://earth.uq.edu.au/centre-geoscience-computing //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
/////////////////////////////////////////////////////////////
#include "Parallel/mpibuf.h"
#include "Parallel/LatticeParam.h"
namespace esys
{
namespace lsm
{
//----------------------------------------------
// CLatticeParam functions
//----------------------------------------------
CLatticeParam::CLatticeParam(
const std::string & s,
double r,
double a,
const ProcessDims &dims
)
{
m_particle_type=s;
m_nrange=r;
m_alpha=a;
m_dims = dims;
}
void CLatticeParam::packInto(AMPIBuffer *B) const
{
B->append(m_nrange);
B->append(m_alpha);
B->append(m_particle_type.c_str());
B->append(static_cast<int>(m_dims[0]));
B->append(static_cast<int>(m_dims[1]));
B->append(static_cast<int>(m_dims[2]));
}
CLatticeParam CLatticeParam::extractLatticeParam(AMPIBuffer *B)
{
double nrange = B->pop_double();
double alpha = B->pop_double();
std::string particleType = B->pop_string();
CLatticeParam::ProcessDims dims = CLatticeParam::ProcessDims(3, 0);
dims[0] = B->pop_int();
dims[1] = B->pop_int();
dims[2] = B->pop_int();
return CLatticeParam(particleType, nrange, alpha, dims);
}
ostream& operator<<(ostream& ost,const CLatticeParam& CP)
{
ost << "CLatticeParam\n";
ost << "ptype : " << CP.m_particle_type << endl;
ost << "nrange : " << CP.m_nrange << endl;
ost << "alpha : " << CP.m_alpha << endl;
return ost;
}
}
}
|