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

« back to all changes in this revision

Viewing changes to Model/BodyForceGroup.cpp

  • Committer: slatham
  • Date: 2004-04-07 02:48:47 UTC
  • Revision ID: svn-v4:1ddc92f8-1f06-0410-a909-b11019f1b28a:lsmtrunk:212
Added esys::lsm::BodyForceGroup class for applying gravitational force to particles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=============================================================================
 
2
??
 
3
??******************************************************************************
 
4
??*������������� ����������������                                              *
 
5
??*������ COPYRIGHT� ???????� -� All Rights Reserved�������������������������� *
 
6
??*�������������� ������������������������������������������������������������ *
 
7
??* This software is the property of ??????????????.� No part of this code��   *
 
8
??* may be copied in any form or by any means without the expressed written�   *
 
9
??* consent of ???????????.� Copying, use or modification of this software     *
 
10
??* by any unauthorised person is illegal unless that����������������������    *
 
11
??* person has a software license agreement with ?????????????.����            *
 
12
??*������������������                                                          *
 
13
??******************************************************************************
 
14
??
 
15
*********************************************************************************/
 
16
 
 
17
#include "Model/BodyForceGroup.h"
 
18
 
 
19
namespace esys
 
20
{
 
21
  namespace lsm
 
22
  {
 
23
    BodyForceIGP::BodyForceIGP() : AIGParam(), m_acceleration()
 
24
    {
 
25
    }
 
26
 
 
27
    BodyForceIGP::BodyForceIGP(const std::string &name, const Vec3 &acceleration)
 
28
      : AIGParam(name),
 
29
        m_acceleration(acceleration)
 
30
    {
 
31
    }
 
32
 
 
33
    BodyForceIGP::~BodyForceIGP()
 
34
    {
 
35
    }
 
36
 
 
37
    const Vec3 &BodyForceIGP::getAcceleration() const
 
38
    {
 
39
      return m_acceleration;
 
40
    }
 
41
 
 
42
    const std::string &BodyForceIGP::getName() const
 
43
    {
 
44
      return Name();
 
45
    }
 
46
 
 
47
    void BodyForceIGP::packInto(CVarMPIBuffer *pBuffer) const
 
48
    {
 
49
      pBuffer->append(getName().c_str());
 
50
      pBuffer->append(m_acceleration.X());
 
51
      pBuffer->append(m_acceleration.Y());
 
52
      pBuffer->append(m_acceleration.Z());
 
53
    }
 
54
 
 
55
    BodyForceIGP BodyForceIGP::extract(CVarMPIBuffer *pBuffer)
 
56
    {
 
57
      const std::string name = std::auto_ptr<char>(pBuffer->pop_string()).get();
 
58
 
 
59
      const double x = pBuffer->pop_double();
 
60
      const double y = pBuffer->pop_double();
 
61
      const double z = pBuffer->pop_double();
 
62
 
 
63
      return BodyForceIGP(name, Vec3(x, y, z));
 
64
    }
 
65
  }
 
66
}