File: atom.cpp

package info (click to toggle)
mldemos 0.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,224 kB
  • ctags: 46,525
  • sloc: cpp: 306,887; ansic: 167,718; ml: 126; sh: 109; makefile: 2
file content (131 lines) | stat: -rw-r--r-- 2,972 bytes parent folder | download | duplicates (2)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "atom.h"


JACAtomsXYZR::JACAtomsXYZR(const float *xyzr,
                           unsigned int count,
                           const unsigned int *selected,
                           unsigned int sel_mask)
    : _xyzr(xyzr),
      _count(count),
      _selected(selected),
      _sel_mask(sel_mask)
{
}


unsigned int JACAtomsXYZR::GetCount() const
{
    return _count;
}

bool JACAtomsXYZR::IsSelected(unsigned int i) const
{
    return !_selected || (_selected[i] & _sel_mask);
}

//const float *JACAtomsXYZR::GetCoord(unsigned int i) const
//{
//  return &_xyzr[i*4];
//}

const float*JACAtomsXYZR::GetCoord(unsigned int i) const
{
    return &_xyzr[i*4];
}

float JACAtomsXYZR::GetRadius(unsigned int i) const
{
    return _xyzr[i*4+3];
}


JACAtomsXYZROTE::JACAtomsXYZROTE(const float *xyzr,
                                 unsigned int count,
                                 const float *occupancy,
                                 const float *bfactor,
                                 const unsigned short *element,
                                 const unsigned int *selected,
                                 unsigned int sel_mask)
    : JACAtomsXYZR(xyzr, count, selected, sel_mask),
      _occupancy(occupancy),
      _bfactor(bfactor),
      _element(element)
{
}

float JACAtomsXYZROTE::GetOccupancy(unsigned int i) const
{
    return _occupancy[i];
}

float JACAtomsXYZROTE::GetBFactor(unsigned int i) const
{
    return _bfactor[i];
}

unsigned short JACAtomsXYZROTE::GetElement(unsigned int i) const
{
    return _element[i];
}

JACAtomsMerge::JACAtomsMerge(const JACAtomsBase &atoms1,
                             const JACAtomsBase &atoms2)
    : _atoms1(atoms1),
      _atoms2(atoms2)
{
}

unsigned int JACAtomsMerge::GetCount() const
{
    return _atoms1.GetCount() + _atoms2.GetCount();
}

bool JACAtomsMerge::IsSelected(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.IsSelected(i);
    return _atoms2.IsSelected(i);
}

//const float *JACAtomsMerge::GetCoord(unsigned int i) const
//{
//  if (i<_atoms1.GetCount())
//    return _atoms1.GetCoord(i);
//  return _atoms2.GetCoord(i);
//}

const float*JACAtomsMerge::GetCoord(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.GetCoord(i);
    return _atoms2.GetCoord(i);
}

float JACAtomsMerge::GetRadius(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.GetRadius(i);
    return _atoms2.GetRadius(i);
}

float JACAtomsMerge::GetOccupancy(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.GetOccupancy(i);
    return _atoms2.GetOccupancy(i);
}

float JACAtomsMerge::GetBFactor(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.GetBFactor(i);
    return _atoms2.GetBFactor(i);
}

unsigned short JACAtomsMerge::GetElement(unsigned int i) const
{
    if (i<_atoms1.GetCount())
        return _atoms1.GetElement(i);
    return _atoms2.GetElement(i);
}