~esys-p-dev/esys-particle/trunk

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
/*=============================================================================
??
??******************************************************************************
??*                                                                            *
??*       COPYRIGHT  ???????  -  All Rights Reserved                           *
??*                                                                            *
??* This software is the property of ??????????????.  No part of this code     *
??* may be copied in any form or by any means without the expressed written    *
??* consent of ???????????.  Copying, use or modification of this software     *
??* by any unauthorised person is illegal unless that                          *
??* person has a software license agreement with ?????????????.                *
??*                                                                            *
??******************************************************************************
??
*********************************************************************************/

#include "Model/BodyForceGroup.h"

namespace esys
{
  namespace lsm
  {
    BodyForceIGP::BodyForceIGP() : AIGParam(), m_acceleration()
    {
    }

    BodyForceIGP::BodyForceIGP(const std::string &name, const Vec3 &acceleration)
      : AIGParam(name),
        m_acceleration(acceleration)
    {
    }

    BodyForceIGP::~BodyForceIGP()
    {
    }

    const Vec3 &BodyForceIGP::getAcceleration() const
    {
      return m_acceleration;
    }

    const std::string &BodyForceIGP::getName() const
    {
      return Name();
    }

    void BodyForceIGP::packInto(CVarMPIBuffer *pBuffer) const
    {
      pBuffer->append(getName().c_str());
      pBuffer->append(m_acceleration.X());
      pBuffer->append(m_acceleration.Y());
      pBuffer->append(m_acceleration.Z());
    }

    BodyForceIGP BodyForceIGP::extract(CVarMPIBuffer *pBuffer)
    {
      const std::string name = std::auto_ptr<char>(pBuffer->pop_string()).get();

      const double x = pBuffer->pop_double();
      const double y = pBuffer->pop_double();
      const double z = pBuffer->pop_double();

      return BodyForceIGP(name, Vec3(x, y, z));
    }
  }
}