Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4qss_misc.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Qss_misc
27//
28// Auxiliary namespace for QSS data.
29//
30// Authors: Lucio Santi, Rodrigo Castro (Univ. Buenos Aires), 2018-2021
31// --------------------------------------------------------------------
32#ifndef _QSS_MISC_H_
33#define _QSS_MISC_H_ 1
34
35#include "G4Types.hh"
36
38using QSSSubstep = struct QSSSubstep_*;
39
40/**
41 * @brief Qss_misc defines an auxiliary namespace for QSS drivers data.
42 */
43
44namespace Qss_misc
45{
46 // Convention of Geant4 notation of indices
47 constexpr unsigned int PXidx= 0;
48 constexpr unsigned int PYidx= 1;
49 constexpr unsigned int PZidx= 2;
50
51 constexpr unsigned int VXidx= 3;
52 constexpr unsigned int VYidx= 4;
53 constexpr unsigned int VZidx= 5;
54
55 // Method parameters & constants
56 constexpr unsigned int MAX_QSS_STEPPER_ORDER= 3;
57 constexpr unsigned int VAR_IDX_END= 6;
58 constexpr unsigned int MIN_SUBSTEPS= 20;
59
60 constexpr G4double INF= 1.0e20;
61}
62
63#if defined(WIN32) || defined(__MINGW32__)
64#define unlikely(x) (x) // Until C++20 can be assumed
65#define likely(x) (x) // >> ditto >>
66#else
67#define unlikely(x) __builtin_expect((x),0) // gcc/clang extension - not portable
68#define likely(x) __builtin_expect((x),1)
69#endif
70
71// #define likely(x) (x) // [[likely]] // The C++20 portable way
72// #define likely(x) (x) // [[unlikely]] // >> >>
73// This syntax appears to be part of C++20
74// See
75// - https://en.cppreference.com/w/cpp/language/attributes/likely
76// - https://stackoverflow.com/questions/51797959/how-to-use-c20s-likely-unlikely-attribute-in-if-else-statement
77// - https://usingstdcpp.org/2018/03/18/jacksonville18-iso-cpp-report/
78
79#define SUBSTEP_STRUCT(sim, i) (sim->substeps[i])
80#define SUBSTEP_START(sim, i) (sim->substeps[(i)].start_time)
81#define SUBSTEP_X(sim, i) (sim->substeps[(i)].x)
82#define SUBSTEP_TX(sim, i) (sim->substeps[(i)].tx)
83#define SUBSTEP_LEN(sim, i) (sim->substeps[(i)].len)
84
85#define LAST_SUBSTEP_STRUCT(sim) (SUBSTEP_STRUCT(sim, sim->cur_substep_idx-1))
86
87#define CUR_SUBSTEP_START(sim) (SUBSTEP_START(sim, sim->cur_substep_idx))
88#define CUR_SUBSTEP_X(sim) (SUBSTEP_X(sim, sim->cur_substep_idx))
89#define CUR_SUBSTEP_TX(sim) (SUBSTEP_TX(sim, sim->cur_substep_idx))
90#define CUR_SUBSTEP_LEN(sim) (SUBSTEP_LEN(sim, sim->cur_substep_idx))
91
92#define CUR_SUBSTEP(sim) (sim->cur_substep_idx)
93#define LAST_SUBSTEP(sim) (sim->cur_substep_idx-1)
94#define MAX_SUBSTEP(sim) (sim->max_substep_idx)
95#define SUBSTEPS(sim) (sim->substeps)
96
105
132
133#endif
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
struct QSS_simulator_ * QSS_simulator
Definition G4qss_misc.hh:37
struct QSSSubstep_ * QSSSubstep
Definition G4qss_misc.hh:38
Qss_misc defines an auxiliary namespace for QSS drivers data.
Definition G4qss_misc.hh:45
constexpr unsigned int PZidx
Definition G4qss_misc.hh:49
constexpr unsigned int PYidx
Definition G4qss_misc.hh:48
constexpr unsigned int VZidx
Definition G4qss_misc.hh:53
constexpr unsigned int VXidx
Definition G4qss_misc.hh:51
constexpr unsigned int VAR_IDX_END
Definition G4qss_misc.hh:57
constexpr G4double INF
Definition G4qss_misc.hh:60
constexpr unsigned int MIN_SUBSTEPS
Definition G4qss_misc.hh:58
constexpr unsigned int PXidx
Definition G4qss_misc.hh:47
constexpr unsigned int MAX_QSS_STEPPER_ORDER
Definition G4qss_misc.hh:56
constexpr unsigned int VYidx
Definition G4qss_misc.hh:52
G4double len
G4double tx[Qss_misc::VAR_IDX_END]
G4double x[Qss_misc::VAR_IDX_END *(Qss_misc::MAX_QSS_STEPPER_ORDER+1)]
Definition G4qss_misc.hh:99
G4double start_time
G4int cur_substep_idx
G4double dQMin[Qss_misc::VAR_IDX_END]
G4double x[Qss_misc::VAR_IDX_END *(Qss_misc::MAX_QSS_STEPPER_ORDER+1)]
G4double lqu[Qss_misc::VAR_IDX_END]
G4int max_substep_idx
G4double nextStateTime[Qss_misc::VAR_IDX_END]
G4int * SD[Qss_misc::VAR_IDX_END]
G4double alg[Qss_misc::VAR_IDX_END]
G4double dQRel[Qss_misc::VAR_IDX_END]
G4double q[Qss_misc::VAR_IDX_END *(Qss_misc::MAX_QSS_STEPPER_ORDER+1)]
G4double tx[Qss_misc::VAR_IDX_END]
QSSSubstep substeps
G4double tq[Qss_misc::VAR_IDX_END]