-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMGhostParticleData.cpp
More file actions
executable file
·66 lines (52 loc) · 1.28 KB
/
MGhostParticleData.cpp
File metadata and controls
executable file
·66 lines (52 loc) · 1.28 KB
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
#include "MGhostParticleData.h"
MGhostParticleData::MGhostParticleData()
{
sph_ngp = 0;
}
MGhostParticleData::~MGhostParticleData()
{
}
int MGhostParticleData::CreateGhostFromReal(MParticle &realpar, int id, RealVector &addVec, int &llgrid_cell)
{
MGhostParticle ghostpar;
ghostpar.par = id;
ghostpar.mat = realpar.mat;
ghostpar.mass = realpar.mass;
ghostpar.h = realpar.h;
ghostpar.hold = realpar.hold;
ghostpar.rho = realpar.rho;
ghostpar.color = realpar.color;
ghostpar.x = realpar.x + addVec;
ghostpar.xzero = realpar.xzero + addVec;
ghostpar.v = realpar.v;
//ghostpar.p = realpar.p;
ghostpar.vabs = realpar.vabs;
ghostpar.llpointer = llgrid_cell;
llgrid_cell = - (++sph_ngp);
m_GhostParList.push_back(ghostpar);
return OK;
}
int MGhostParticleData::AddParticle(const MGhostParticle &gpar)
{
m_GhostParList.push_back(gpar);
return m_GhostParList.size()-1;
}
int MGhostParticleData::DeleteContents()
{
sph_ngp = 0;
m_GhostParList.clear();
return OK;
}
int MGhostParticleData::GetSize()
{
return m_GhostParList.size();
}
MGhostParticle& MGhostParticleData::GetParticle(int ID)
{
return m_GhostParList[ID-1];
}
// IMPORTANT: The operator [] uses one based notation, not zero based
MGhostParticle& MGhostParticleData::operator[](int ID)
{
return m_GhostParList[ID-1];
}