Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
cornelius.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file cornelius.h
1
#ifndef CORNELIUS_H
2
#define CORNELIUS_H
3
4
#include <iostream>
5
#include <fstream>
6
#include <math.h>
7
#include <stdlib.h>
8
9
using namespace
std;
10
17
class
GeneralElement
18
{
19
protected
:
20
static
const
int
DIM = 4;
21
double
*centroid;
22
double
*normal;
23
int
normal_calculated;
24
int
centroid_calculated;
25
virtual
void
calculate_centroid
() {};
26
virtual
void
calculate_normal
() {};
27
void
check_normal_direction(
double
*normal,
double
*
out
);
28
public
:
29
GeneralElement
();
30
~
GeneralElement
();
31
double
*get_centroid();
32
double
*get_normal();
33
};
34
41
class
Line
:
public
GeneralElement
42
{
43
private
:
44
static
const
int
LINE_CORNERS = 2;
45
static
const
int
LINE_DIM = 2;
46
int
x1,x2;
47
int
start_point;
48
int
end_point;
49
double
**corners;
50
double
*
out
;
51
int
*const_i;
52
void
calculate_centroid();
53
void
calculate_normal();
54
public
:
55
Line
();
56
~
Line
();
57
void
init
(
double
**,
double
*,
int
*);
58
void
flip_start_end();
59
double
*get_start();
60
double
*get_end();
61
double
*get_out();
62
};
63
70
class
Polygon
:
public
GeneralElement
71
{
72
private
:
73
static
const
int
MAX_LINES = 24;
74
static
const
int
POLYGON_DIM = 3;
75
Line
**
lines
;
76
int
Nlines;
77
int
x1,x2,x3;
78
int
const_i;
79
void
calculate_centroid();
80
void
calculate_normal();
81
public
:
82
Polygon
();
83
~
Polygon
();
84
void
init
(
int
);
85
bool
add_line(
Line
*,
int
);
86
int
get_Nlines();
87
Line
** get_lines();
88
void
print
(ofstream &
file
,
double
*);
89
};
90
97
class
Polyhedron
:
public
GeneralElement
98
{
99
private
:
100
static
const
int
MAX_POLYGONS = 24;
101
Polygon
**polygons;
102
int
Npolygons;
103
int
Ntetrahedra;
104
int
x1,x2,x3,x4;
105
bool
lines_equal(
Line
*,
Line
*);
106
void
tetravolume(
double
*,
double
*,
double
*,
double
*);
107
void
calculate_centroid();
108
void
calculate_normal();
109
public
:
110
Polyhedron
();
111
~
Polyhedron
();
112
void
init
();
113
bool
add_polygon(
Polygon
*,
int
);
114
};
115
125
class
Square
126
{
127
private
:
128
static
const
int
DIM = 4;
129
static
const
int
SQUARE_DIM = 2;
130
static
const
int
MAX_POINTS = 4;
131
static
const
int
MAX_LINES = 2;
132
double
**points;
133
double
**
cuts
;
134
double
**
out
;
135
double
**points_temp;
136
double
*out_temp;
137
int
*const_i;
138
double
*const_value;
139
int
x1, x2;
140
double
*dx;
141
int
Ncuts;
142
int
Nlines;
143
Line
*
lines
;
144
int
ambiguous;
145
void
ends_of_edge(
double
);
146
void
find_outside(
double
);
147
public
:
148
Square
();
149
~
Square
();
150
void
init
(
double
**,
int
*,
double
*,
double
*);
151
void
construct_lines(
double
);
152
int
is_ambiguous();
153
int
get_Nlines();
154
Line
* get_lines();
155
};
156
165
class
Cube
166
{
167
private
:
168
static
const
int
DIM = 4;
169
static
const
int
CUBE_DIM = 4;
170
static
const
int
MAX_POLY = 8;
171
static
const
int
NSQUARES = 6;
172
static
const
int
STEPS = 2;
173
double
***cube;
174
Line
**
lines
;
175
Polygon
*polygons;
176
Square
*squares;
177
int
Nlines;
178
int
Npolygons;
179
int
ambiguous;
180
int
const_i;
181
double
const_value;
182
int
x1,x2,x3;
183
double
*dx;
184
void
split_to_squares();
185
void
check_ambiguous(
int
);
186
public
:
187
Cube
();
188
~
Cube
();
189
void
init
(
double
***&,
int
,
double
,
double
*&);
190
void
construct_polygons(
double
);
191
int
get_Nlines();
192
int
get_Npolygons();
193
int
is_ambiguous();
194
Polygon
* get_polygons();
195
};
196
197
206
class
Hypercube
207
{
208
private
:
209
static
const
int
DIM = 4;
210
static
const
int
MAX_POLY = 10;
211
static
const
int
NCUBES = 8;
212
static
const
int
STEPS = 2;
213
double
****hcube;
214
Polyhedron
*polyhedrons;
215
Polygon
**polygons;
216
Cube
*cubes;
217
int
Npolyhedrons;
218
int
ambiguous;
219
int
x1,x2,x3,x4;
220
double
*dx;
221
void
split_to_cubes();
222
void
check_ambiguous(
double
);
223
public
:
224
Hypercube
();
225
~
Hypercube
();
226
void
init
(
double
****,
double
*);
227
void
construct_polyhedrons(
double
);
228
int
get_Npolyhedrons();
229
Polyhedron
* get_polyhedrons();
230
};
231
244
class
Cornelius
245
{
246
private
:
247
static
const
int
STEPS = 2;
248
static
const
int
DIM = 4;
249
static
const
int
MAX_ELEMENTS = 10;
250
int
Nelements;
251
double
**normals;
252
double
**centroids;
253
int
cube_dim;
254
int
initialized;
255
int
print_initialized;
256
double
value0;
257
double
*dx;
258
ofstream output_print;
259
void
surface_3d(
double
***,
double
*,
int
);
260
Square
cu2d;
261
Cube
cu3d;
262
Hypercube
cu4d;
263
public
:
264
Cornelius
();
265
~
Cornelius
();
266
void
init
(
int
,
double
,
double
*);
267
void
init_print(
string
);
268
void
find_surface_2d(
double
**);
269
void
find_surface_3d(
double
***);
270
void
find_surface_3d_print(
double
***,
double
*);
271
void
find_surface_4d(
double
****);
272
int
get_Nelements();
273
double
**get_normals();
274
double
**get_centroids();
275
double
**get_normals_4d();
276
double
**get_centroids_4d();
277
double
get_centroid_elem(
int
,
int
);
278
double
get_normal_elem(
int
,
int
);
279
};
280
281
#endif
/* CORNELIUS_H */
JETSCAPE
blob
main
external_packages
cornelius.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:18
using
1.8.2 with
sPHENIX GitHub integration