#include <G4SurfBits.hh>
Definition at line 50 of file G4SurfBits.hh.
◆ G4SurfBits() [1/2]
G4SurfBits::G4SurfBits |
( |
unsigned int |
nbits = 0 | ) |
|
◆ G4SurfBits() [2/2]
G4SurfBits::G4SurfBits |
( |
const G4SurfBits & |
original | ) |
|
◆ ~G4SurfBits()
G4SurfBits::~G4SurfBits |
( |
| ) |
|
◆ Clear()
void G4SurfBits::Clear |
( |
| ) |
|
◆ Compact()
void G4SurfBits::Compact |
( |
| ) |
|
Definition at line 100 of file G4SurfBits.cc.
101{
102
103
105 unsigned int needed;
106 for(needed=
fNBytes-1; needed > 0 &&
fAllBits[needed]==0; ) { --needed; }
107 ++needed;
108
110 {
111 unsigned char* old_location =
fAllBits;
112 fAllBits =
new unsigned char[needed];
113
114 std::memcpy(
fAllBits,old_location,needed);
115 delete [] old_location;
116
119 }
120}
◆ Get() [1/2]
void G4SurfBits::Get |
( |
char * |
array | ) |
const |
◆ Get() [2/2]
void G4SurfBits::Get |
( |
G4int * |
array | ) |
const |
Definition at line 206 of file G4SurfBits.cc.
207{
208
209
211}
void Get(char *array) const
◆ GetNbits()
unsigned int G4SurfBits::GetNbits |
( |
| ) |
const |
|
inline |
◆ GetNbytes()
unsigned int G4SurfBits::GetNbytes |
( |
| ) |
const |
|
inline |
◆ operator=()
Definition at line 58 of file G4SurfBits.cc.
59{
60
61 if (this != &rhs)
62 {
63
68 {
71 }
72 else
73 {
75 }
76 }
77 return *this;
78}
◆ operator[]()
G4bool G4SurfBits::operator[] |
( |
unsigned int |
bitnumber | ) |
const |
|
inline |
Definition at line 159 of file G4SurfBits.hh.
160{
162}
G4bool TestBitNumber(unsigned int bitnumber) const
◆ Output()
void G4SurfBits::Output |
( |
std::ostream & |
os | ) |
const |
Definition at line 123 of file G4SurfBits.cc.
124{
125
126 for(
unsigned int i=0; i<
fNBytes; ++i)
127 {
129 for (unsigned int j=0; j<8; ++j)
130 {
132 val <<= 1;
133 }
134 }
135}
◆ Print()
void G4SurfBits::Print |
( |
| ) |
const |
Definition at line 138 of file G4SurfBits.cc.
139{
140
142 for(
unsigned int i=0; i<
fNBytes; ++i)
143 {
145 for (unsigned int j=0; j<8; ++j)
146 {
147 if (val & 1)
G4cout <<
" bit:" << count <<
" = 1" <<
G4endl;
148 ++count;
149 val = val >> 1;
150 }
151 }
152}
G4GLOB_DLL std::ostream G4cout
◆ ReserveBytes()
void G4SurfBits::ReserveBytes |
( |
unsigned int |
nbytes | ) |
|
|
protected |
Definition at line 161 of file G4SurfBits.cc.
162{
163
164
166 {
167
168 unsigned char *newBits = new unsigned char[nbytes];
172 }
173}
Referenced by set().
◆ ResetAllBits()
void G4SurfBits::ResetAllBits |
( |
G4bool |
value = false | ) |
|
◆ ResetBitNumber()
void G4SurfBits::ResetBitNumber |
( |
unsigned int |
bitnumber | ) |
|
|
inline |
◆ set() [1/2]
void G4SurfBits::set |
( |
unsigned int |
nbits, |
|
|
const char * |
array |
|
) |
| |
◆ set() [2/2]
void G4SurfBits::set |
( |
unsigned int |
nbits, |
|
|
const G4int * |
array |
|
) |
| |
Definition at line 198 of file G4SurfBits.cc.
199{
200
201
202 set(nBits, (
const char*)array);
203}
void set(unsigned int nbits, const char *array)
◆ SetBitNumber()
void G4SurfBits::SetBitNumber |
( |
unsigned int |
bitnumber, |
|
|
G4bool |
value = true |
|
) |
| |
|
inline |
Definition at line 114 of file G4SurfBits.hh.
115{
116
117
119 {
120 unsigned int new_size = (bitnumber/8) + 1;
122 {
123 if (new_size < 100 * 1024 * 1024) new_size *= 2;
124 unsigned char *old_location =
fAllBits;
125 fAllBits =
new unsigned char[new_size];
129 delete [] old_location;
130 }
132 }
133 unsigned int loc = bitnumber/8;
134 unsigned char bit = bitnumber%8;
135 if (value)
137 else
139}
Referenced by G4MultiUnion::DistanceToOutVoxels(), and ResetBitNumber().
◆ TestBitNumber()
G4bool G4SurfBits::TestBitNumber |
( |
unsigned int |
bitnumber | ) |
const |
|
inline |
Definition at line 141 of file G4SurfBits.hh.
142{
143
144
145 if (bitnumber >=
fNBits)
return false;
146 unsigned int loc = bitnumber/8;
147 unsigned char value =
fAllBits[loc];
148 unsigned char bit = bitnumber%8;
149 G4bool result = (value & (1<<bit)) != 0;
150 return result;
151
152}
Referenced by operator[]().
◆ fAllBits
unsigned char* G4SurfBits::fAllBits = nullptr |
Definition at line 104 of file G4SurfBits.hh.
Referenced by Clear(), Compact(), G4SurfBits(), Get(), G4Voxelizer::GetCandidatesVoxelArray(), operator=(), Output(), Print(), ReserveBytes(), ResetAllBits(), set(), SetBitNumber(), TestBitNumber(), and ~G4SurfBits().
◆ fNBits
unsigned int G4SurfBits::fNBits |
|
protected |
◆ fNBytes
unsigned int G4SurfBits::fNBytes |
|
protected |
The documentation for this class was generated from the following files: