Skip to content

Commit ec99537

Browse files
committed
Preparing release 0.2.1
1 parent bd199c7 commit ec99537

File tree

9 files changed

+140
-14
lines changed

9 files changed

+140
-14
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Geant4"
22
uuid = "559df036-b7a0-42fd-85df-7d5dd9d70f44"
33
authors = ["Pere Mato <[email protected]>"]
4-
version = "0.2.0"
4+
version = "0.2.1"
55

66
[deps]
77
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

docs/src/examples/Solids_lit.jl

+18
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,24 @@ img = draw(pcon, wireframe=true, color=:blue)
188188
#md PNG(img) #hide
189189
#nb display("image/png", img)
190190

191+
# ## G4GenericPolycone
192+
# A genric polycone is constructed using:
193+
#
194+
# | parameter | description |
195+
# | :-------- | :---------- |
196+
# | ϕ₀ | Starting phi angle in radians ( ϕ₀+Δϕ <= 2π, ϕ₀ > -2π) |
197+
# | Δϕ | Delta angle of the segment in radians |
198+
# | numRZ | Number of RZ corners |
199+
# | r | r coordinate of corners |
200+
# | z | z coordinate of corners |
201+
gpcon = G4GenericPolycone("pcone", 0, π, 4,
202+
[ 5., 10., 10., 5.,],
203+
[ 0., 10., 20., 30.]
204+
)
205+
img = draw(gpcon, wireframe=true, color=:blue)
206+
#md PNG(img) #hide
207+
#nb display("image/png", img)
208+
191209
# ## G4Polyhedra
192210
# A polyhedra is constructed using:
193211
#

docs/src/releases.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
## Release Notes
2-
### 0.2.x
2+
### 0.2.1
3+
- New Features
4+
- Added wrappers for classes `LBE`, `G4GenericPolycone`
5+
- Added Visualization for `G4GenericPolycone`
36
- New Examples:
47
- UserLib: how to build and call a user custom library providing additional Geant4 functionally that is not provided by the set of wrapped classes
5-
- JuliaAction: emmbeding Julia in a C++ application. In this example we call user actions implemented in Julia
8+
- JuliaAction: embedding Julia in a C++ application. In this example we call user actions implemented in Julia
69

710
### 0.2.0
811
- New Features

ext/G4Vis/Cones.jl

+51
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,54 @@ function GeometryBasics.faces(pcon::G4Polycone, facets=24)
140140
end
141141
return faces
142142
end
143+
144+
#---G4GenericPolycone-------------------------------------------------------------------------------------
145+
146+
mutable struct GenericPolyconeParams
147+
startPhi::Float64
148+
endPhi::Float64
149+
phiIsOpen::Bool
150+
numCorner::Int32
151+
corners::Ptr{SideRZ}
152+
end
153+
154+
function GeometryBasics.coordinates(pcon::G4GenericPolycone, facets=24)
155+
ϕ₀ = GetStartPhi(pcon)
156+
ϕₑ = GetEndPhi(pcon)
157+
n = GetNumRZCorner(pcon)
158+
issector = !(ϕₑ-ϕ₀ 2π)
159+
rz = [unsafe_load(Ptr{SideRZ}(GetPolyCorner(pcon, i-1).cpp_object)) for i in 1:n]
160+
ϕfacets = round(Int64, (facets/2π) * (ϕₑ-ϕ₀))
161+
ϕ = LinRange(ϕ₀, ϕₑ, ϕfacets)
162+
inner(ϕ, r, z) = Point(r * cos(ϕ), r * sin(ϕ), z)
163+
points = vec([inner(ϕ, rz[j].r, rz[j].z) for ϕ in ϕ, j in 1:n])
164+
#if issector
165+
# for ϕ in (ϕ₀, ϕₑ)
166+
# for i in 1:n
167+
# push!(points, Point(rz[i].r * cos(ϕ), rz[i].r * sin(ϕ), rz[i].z))
168+
# end
169+
# end
170+
#end
171+
return points
172+
end
173+
174+
function GeometryBasics.faces(pcon::G4GenericPolycone, facets=24)
175+
ϕ₀ = GetStartPhi(pcon)
176+
ϕₑ = GetEndPhi(pcon)
177+
n = GetNumRZCorner(pcon)
178+
issector = !(ϕₑ-ϕ₀ 2π)
179+
ϕfacets = round(Int64, (facets/2π) * (ϕₑ-ϕ₀))
180+
idx = LinearIndices((ϕfacets, n))
181+
quad(i, j) = QuadFace{Int}(idx[i, j], idx[i + 1, j], idx[i + 1, cyc(j + 1,n)], idx[i, cyc(j + 1,n)])
182+
faces = vec([quad(i, j) for i in 1:(ϕfacets - 1), j in 1:n])
183+
#if issector
184+
# offset = ϕfacets * n
185+
# for c in 0:1
186+
# for i in 0:n-2
187+
# odx = offset + 2*i + 2*n*c
188+
# push!(faces, QuadFace{Int}(odx+1, odx+2, odx+4, odx+3))
189+
# end
190+
# end
191+
#end
192+
return faces
193+
end

gen/Geant4.wit.in

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ input = [ "Geant4Wrap.h",
100100
"G4Trap.hh",
101101
"G4Torus.hh",
102102
"G4Polycone.hh",
103+
"G4GenericPolycone.hh",
103104
"G4Polyhedra.hh",
104105
"G4EllipticalTube.hh",
105106
"G4Ellipsoid.hh",

gen/cpp/Geant4Wrap.cxx

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "G4PVPlacement.hh"
77
#include "G4ParticleTable.hh"
88
#include "G4Polycone.hh"
9+
#include "G4GenericPolycone.hh"
910
#include "G4Polyhedra.hh"
1011
#include "G4VIsotopeTable.hh"
1112
#include "G4IonTable.hh"
@@ -133,6 +134,11 @@ G4PolyconeSideRZ& GetPolyCorner(const G4Polycone& pc, G4int index) {
133134
side = pc.GetCorner(index);
134135
return side;
135136
}
137+
G4PolyconeSideRZ& GetPolyCorner(const G4GenericPolycone& pc, G4int index) {
138+
static G4PolyconeSideRZ side;
139+
side = pc.GetCorner(index);
140+
return side;
141+
}
136142
G4PolyhedraSideRZ& GetPolyCorner(const G4Polyhedra& pc, G4int index) {
137143
static G4PolyhedraSideRZ side;
138144
side = pc.GetCorner(index);

gen/cpp/Geant4Wrap.h

+2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ class G4PolyconeSideRZ;
280280
class G4PolyhedraSideRZ;
281281
class G4Polycone;
282282
class G4Polyhedra;
283+
class G4GenericPolycone;
283284
G4PolyconeSideRZ& GetPolyCorner(const G4Polycone&, G4int);
285+
G4PolyconeSideRZ& GetPolyCorner(const G4GenericPolycone&, G4int);
284286
G4PolyhedraSideRZ& GetPolyCorner(const G4Polyhedra&, G4int);
285287

286288
void SetParticleByName(G4ParticleGun* gun, const char* pname);

gen/jlGeant4-report.txt

+55-10
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ G4JLStackingAction
180180
G4JLStateDependent
181181
G4PolyconeSideRZ
182182
G4Polycone
183+
G4GenericPolycone
183184
G4PolyhedraSideRZ
184185
G4Polyhedra
185186
std::pair
@@ -1031,6 +1032,8 @@ EVolume G4VPhysicalVolume::DeduceVolumeType()
10311032
void G4LogicalVolume::G4LogicalVolume(G4VSolid *, G4Material *, const G4String &, G4FieldManager *, G4VSensitiveDetector *, G4UserLimits *, G4bool)
10321033
const G4String & G4LogicalVolume::GetName()
10331034
void G4LogicalVolume::SetName(const G4String &)
1035+
size_t G4LogicalVolume::GetNoDaughters()
1036+
G4VPhysicalVolume * G4LogicalVolume::GetDaughter(const size_t)
10341037
void G4LogicalVolume::AddDaughter(G4VPhysicalVolume *)
10351038
G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume *)
10361039
G4bool G4LogicalVolume::IsAncestor(const G4VPhysicalVolume *)
@@ -1182,6 +1185,8 @@ const G4AffineTransform * G4NavigationHistory::GetPtrTopTransform()
11821185
G4int G4NavigationHistory::GetTopReplicaNo()
11831186
EVolume G4NavigationHistory::GetTopVolumeType()
11841187
G4VPhysicalVolume * G4NavigationHistory::GetTopVolume()
1188+
size_t G4NavigationHistory::GetDepth()
1189+
size_t G4NavigationHistory::GetMaxDepth()
11851190
const G4AffineTransform & G4NavigationHistory::GetTransform(G4int)
11861191
G4int G4NavigationHistory::GetReplicaNo(G4int)
11871192
EVolume G4NavigationHistory::GetVolumeType(G4int)
@@ -1261,6 +1266,7 @@ G4double G4Material::GetDensity()
12611266
G4State G4Material::GetState()
12621267
G4double G4Material::GetTemperature()
12631268
G4double G4Material::GetPressure()
1269+
size_t G4Material::GetNumberOfElements()
12641270
const G4ElementVector * G4Material::GetElementVector()
12651271
const G4double * G4Material::GetFractionVector()
12661272
const G4int * G4Material::GetAtomsVector()
@@ -1280,9 +1286,12 @@ G4double G4Material::GetZ()
12801286
G4double G4Material::GetA()
12811287
void G4Material::SetMaterialPropertiesTable(G4MaterialPropertiesTable *)
12821288
G4MaterialPropertiesTable * G4Material::GetMaterialPropertiesTable()
1289+
size_t G4Material::GetIndex()
12831290
G4MaterialTable * G4Material::GetMaterialTable()
1291+
size_t G4Material::GetNumberOfMaterials()
12841292
G4Material * G4Material::GetMaterial(const G4String &, G4bool)
12851293
G4Material * G4Material::GetMaterial(G4double, G4double, G4double)
1294+
G4Material * G4Material::GetMaterial(size_t, G4double)
12861295
void G4Material::SetName(const G4String &)
12871296
G4bool G4Material::IsExtended()
12881297
void G4UserLimits::G4UserLimits(G4double, G4double, G4double, G4double, G4double)
@@ -1572,6 +1581,7 @@ void G4Step::UpdateTrack()
15721581
void G4Step::CopyPostToPreStepPoint()
15731582
void G4Step::SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector> *)
15741583
std::vector<G4ThreeVector> * G4Step::GetPointerToVectorOfAuxiliaryPoints()
1584+
size_t G4Step::GetNumberOfSecondariesInCurrentStep()
15751585
const std::vector<const G4Track *> * G4Step::GetSecondaryInCurrentStep()
15761586
const G4TrackVector * G4Step::GetSecondary()
15771587
G4TrackVector * G4Step::GetfSecondary()
@@ -1876,8 +1886,8 @@ void G4VCSGfaceted::SetAreaStatistics(G4int)
18761886
void G4VCSGfaceted::SetAreaAccuracy(G4double)
18771887
G4double G4VCSGfaceted::GetCubicVolume()
18781888
G4double G4VCSGfaceted::GetSurfaceArea()
1879-
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double[], const G4double[], const G4double[])
1880-
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double[], const G4double[])
1889+
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [], const G4double [])
1890+
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [])
18811891
EInside G4Polycone::Inside(const G4ThreeVector &)
18821892
G4double G4Polycone::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
18831893
G4double G4Polycone::DistanceToIn(const G4ThreeVector &)
@@ -1903,8 +1913,31 @@ G4PolyconeHistorical * G4Polycone::GetOriginalParameters()
19031913
void G4Polycone::SetOriginalParameters(G4PolyconeHistorical *)
19041914
void G4Polycone::G4Polycone(const G4Polycone &)
19051915
G4Polycone & G4Polycone::operator=(const G4Polycone &)
1906-
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double[], const G4double[], const G4double[])
1907-
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double[], const G4double[])
1916+
void G4GenericPolycone::G4GenericPolycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [])
1917+
EInside G4GenericPolycone::Inside(const G4ThreeVector &)
1918+
G4double G4GenericPolycone::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
1919+
G4double G4GenericPolycone::DistanceToIn(const G4ThreeVector &)
1920+
void G4GenericPolycone::BoundingLimits(G4ThreeVector &, G4ThreeVector &)
1921+
G4double G4GenericPolycone::GetCubicVolume()
1922+
G4double G4GenericPolycone::GetSurfaceArea()
1923+
G4ThreeVector G4GenericPolycone::GetPointOnSurface()
1924+
G4GeometryType G4GenericPolycone::GetEntityType()
1925+
G4VSolid * G4GenericPolycone::Clone()
1926+
G4Polyhedron * G4GenericPolycone::CreatePolyhedron()
1927+
G4bool G4GenericPolycone::Reset()
1928+
G4double G4GenericPolycone::GetStartPhi()
1929+
G4double G4GenericPolycone::GetEndPhi()
1930+
G4double G4GenericPolycone::GetSinStartPhi()
1931+
G4double G4GenericPolycone::GetCosStartPhi()
1932+
G4double G4GenericPolycone::GetSinEndPhi()
1933+
G4double G4GenericPolycone::GetCosEndPhi()
1934+
G4bool G4GenericPolycone::IsOpen()
1935+
G4int G4GenericPolycone::GetNumRZCorner()
1936+
G4PolyconeSideRZ G4GenericPolycone::GetCorner(G4int)
1937+
void G4GenericPolycone::G4GenericPolycone(const G4GenericPolycone &)
1938+
G4GenericPolycone & G4GenericPolycone::operator=(const G4GenericPolycone &)
1939+
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double [], const G4double [], const G4double [])
1940+
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double [], const G4double [])
19081941
EInside G4Polyhedra::Inside(const G4ThreeVector &)
19091942
G4double G4Polyhedra::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
19101943
G4double G4Polyhedra::DistanceToIn(const G4ThreeVector &)
@@ -1951,9 +1984,12 @@ const std::vector<G4ThreeVector> * G4VTrajectoryPoint::GetAuxiliaryPoints()
19511984
std::vector<G4AttValue> * G4VTrajectoryPoint::CreateAttValues()
19521985
G4bool G4TrajectoryContainer::operator==(const G4TrajectoryContainer &)
19531986
G4bool G4TrajectoryContainer::operator!=(const G4TrajectoryContainer &)
1987+
size_t G4TrajectoryContainer::size()
19541988
void G4TrajectoryContainer::push_back(G4VTrajectory *)
1989+
size_t G4TrajectoryContainer::entries()
19551990
G4bool G4TrajectoryContainer::insert(G4VTrajectory *)
19561991
void G4TrajectoryContainer::clearAndDestroy()
1992+
G4VTrajectory * G4TrajectoryContainer::operator[](size_t)
19571993
TrajectoryVector * G4TrajectoryContainer::GetVector()
19581994
void G4DisplacedSolid::G4DisplacedSolid(const G4String &, G4VSolid *, G4RotationMatrix *, const G4ThreeVector &)
19591995
void G4DisplacedSolid::G4DisplacedSolid(const G4String &, G4VSolid *, const G4Transform3D &)
@@ -2041,8 +2077,8 @@ double CLHEP::HepRandomEngine::flat()
20412077
void CLHEP::HepRandomEngine::flatArray(const int, double *)
20422078
void CLHEP::HepRandomEngine::setSeed(long, int)
20432079
void CLHEP::HepRandomEngine::setSeeds(const long *, int)
2044-
void CLHEP::HepRandomEngine::saveStatus(const char[])
2045-
void CLHEP::HepRandomEngine::restoreStatus(const char[])
2080+
void CLHEP::HepRandomEngine::saveStatus(const char [])
2081+
void CLHEP::HepRandomEngine::restoreStatus(const char [])
20462082
void CLHEP::HepRandomEngine::showStatus()
20472083
std::string CLHEP::HepRandomEngine::name()
20482084
std::string CLHEP::HepRandomEngine::beginTag()
@@ -2069,8 +2105,8 @@ void CLHEP::HepRandom::getTheTableSeeds(long *, int)
20692105
CLHEP::HepRandom * CLHEP::HepRandom::getTheGenerator()
20702106
void CLHEP::HepRandom::setTheEngine(CLHEP::HepRandomEngine *)
20712107
CLHEP::HepRandomEngine * CLHEP::HepRandom::getTheEngine()
2072-
void CLHEP::HepRandom::saveEngineStatus(const char[])
2073-
void CLHEP::HepRandom::restoreEngineStatus(const char[])
2108+
void CLHEP::HepRandom::saveEngineStatus(const char [])
2109+
void CLHEP::HepRandom::restoreEngineStatus(const char [])
20742110
void CLHEP::HepRandom::showEngineStatus()
20752111
int CLHEP::HepRandom::createInstance()
20762112
std::string CLHEP::HepRandom::distributionName()
@@ -2110,8 +2146,8 @@ double CLHEP::RandFlat::operator()(double, double)
21102146
std::string CLHEP::RandFlat::name()
21112147
CLHEP::HepRandomEngine & CLHEP::RandFlat::engine()
21122148
std::string CLHEP::RandFlat::distributionName()
2113-
void CLHEP::RandFlat::saveEngineStatus(const char[])
2114-
void CLHEP::RandFlat::restoreEngineStatus(const char[])
2149+
void CLHEP::RandFlat::saveEngineStatus(const char [])
2150+
void CLHEP::RandFlat::restoreEngineStatus(const char [])
21152151
void CLHEP::RandExponential::RandExponential(CLHEP::HepRandomEngine &, double)
21162152
void CLHEP::RandExponential::RandExponential(CLHEP::HepRandomEngine *, double)
21172153
double CLHEP::RandExponential::shoot()
@@ -2202,9 +2238,12 @@ std::string CLHEP::RandPoissonQ::name()
22022238
CLHEP::HepRandomEngine & CLHEP::RandPoissonQ::engine()
22032239
std::string CLHEP::RandPoissonQ::distributionName()
22042240
int CLHEP::RandPoissonQ::tableBoundary()
2241+
void G4ProcessVector::G4ProcessVector(size_t)
22052242
void G4ProcessVector::G4ProcessVector(const G4ProcessVector &)
22062243
G4ProcessVector & G4ProcessVector::operator=(const G4ProcessVector &)
22072244
G4bool G4ProcessVector::operator==(const G4ProcessVector &)
2245+
size_t G4ProcessVector::entries()
2246+
size_t G4ProcessVector::index(G4VProcess *)
22082247
G4bool G4ProcessVector::contains(G4VProcess *)
22092248
G4bool G4ProcessVector::insert(G4VProcess *)
22102249
G4bool G4ProcessVector::insertAt(G4int, G4VProcess *)
@@ -2766,6 +2805,8 @@ void G4TransportationManager::SetFieldManager(G4FieldManager *)
27662805
G4Navigator * G4TransportationManager::GetNavigatorForTracking()
27672806
void G4TransportationManager::SetNavigatorForTracking(G4Navigator *)
27682807
void G4TransportationManager::SetWorldForTracking(G4VPhysicalVolume *)
2808+
size_t G4TransportationManager::GetNoActiveNavigators()
2809+
size_t G4TransportationManager::GetNoWorlds()
27692810
G4SafetyHelper * G4TransportationManager::GetSafetyHelper()
27702811
G4VPhysicalVolume * G4TransportationManager::GetParallelWorld(const G4String &)
27712812
G4VPhysicalVolume * G4TransportationManager::IsWorldExisting(const G4String &)
@@ -3275,9 +3316,11 @@ G4LogicalBorderSurface * G4LogicalBorderSurface::GetSurface(const G4VPhysicalVol
32753316
void G4LogicalBorderSurface::SetPhysicalVolumes(G4VPhysicalVolume *, G4VPhysicalVolume *)
32763317
const G4VPhysicalVolume * G4LogicalBorderSurface::GetVolume1()
32773318
const G4VPhysicalVolume * G4LogicalBorderSurface::GetVolume2()
3319+
size_t G4LogicalBorderSurface::GetIndex()
32783320
void G4LogicalBorderSurface::SetVolume1(G4VPhysicalVolume *)
32793321
void G4LogicalBorderSurface::SetVolume2(G4VPhysicalVolume *)
32803322
void G4LogicalBorderSurface::CleanSurfaceTable()
3323+
size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces()
32813324
void G4LogicalBorderSurface::DumpInfo()
32823325
void G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String &, G4LogicalVolume *, G4SurfaceProperty *)
32833326
G4bool G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface &)
@@ -3287,6 +3330,7 @@ const G4LogicalVolume * G4LogicalSkinSurface::GetLogicalVolume()
32873330
void G4LogicalSkinSurface::SetLogicalVolume(G4LogicalVolume *)
32883331
void G4LogicalSkinSurface::CleanSurfaceTable()
32893332
const G4LogicalSkinSurfaceTable * G4LogicalSkinSurface::GetSurfaceTable()
3333+
size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces()
32903334
void G4LogicalSkinSurface::DumpInfo()
32913335
void G4VMPLData::initialize()
32923336
void G4VModularPhysicsList::ConstructParticle()
@@ -3731,6 +3775,7 @@ CLHEP::Hep2Vector CLHEP::operator-(const CLHEP::Hep2Vector &, const CLHEP::Hep2V
37313775
size_t size(const G4LogicalVolumeStore *)
37323776
G4LogicalVolume * GetVolume(const G4LogicalVolumeStore *, size_t)
37333777
G4PolyconeSideRZ & GetPolyCorner(const G4Polycone &, G4int)
3778+
G4PolyconeSideRZ & GetPolyCorner(const G4GenericPolycone &, G4int)
37343779
G4PolyhedraSideRZ & GetPolyCorner(const G4Polyhedra &, G4int)
37353780
void SetParticleByName(G4ParticleGun *, const char *)
37363781
G4ParticleDefinition * FindParticle(const char *)

src/Geant4.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module Geant4
1111
else
1212
using Geant4_julia_jll
1313
include(Geant4_julia_jll.Geant4_exports)
14+
export G4GenericPolycone, LBE # Export the C++ classes that where forgotten in the binary package
1415
@wrapmodule(()->Geant4_julia_jll.libGeant4Wrap)
1516
end
1617

@@ -49,4 +50,3 @@ module Geant4
4950
H1D() = "Not implemented" # Constructors
5051
H2D() = "Not implemented" # Constructors
5152
end
52-

0 commit comments

Comments
 (0)