Skip to content

Commit

Permalink
Preparing release 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
peremato committed Jan 9, 2025
1 parent bd199c7 commit ec99537
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Geant4"
uuid = "559df036-b7a0-42fd-85df-7d5dd9d70f44"
authors = ["Pere Mato <[email protected]>"]
version = "0.2.0"
version = "0.2.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
18 changes: 18 additions & 0 deletions docs/src/examples/Solids_lit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,24 @@ img = draw(pcon, wireframe=true, color=:blue)
#md PNG(img) #hide
#nb display("image/png", img)

# ## G4GenericPolycone
# A genric polycone is constructed using:
#
# | parameter | description |
# | :-------- | :---------- |
# | ϕ₀ | Starting phi angle in radians ( ϕ₀+Δϕ <= 2π, ϕ₀ > -2π) |
# | Δϕ | Delta angle of the segment in radians |
# | numRZ | Number of RZ corners |
# | r | r coordinate of corners |
# | z | z coordinate of corners |
gpcon = G4GenericPolycone("pcone", 0, π, 4,
[ 5., 10., 10., 5.,],
[ 0., 10., 20., 30.]
)
img = draw(gpcon, wireframe=true, color=:blue)
#md PNG(img) #hide
#nb display("image/png", img)

# ## G4Polyhedra
# A polyhedra is constructed using:
#
Expand Down
7 changes: 5 additions & 2 deletions docs/src/releases.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
## Release Notes
### 0.2.x
### 0.2.1
- New Features
- Added wrappers for classes `LBE`, `G4GenericPolycone`
- Added Visualization for `G4GenericPolycone`
- New Examples:
- UserLib: how to build and call a user custom library providing additional Geant4 functionally that is not provided by the set of wrapped classes
- JuliaAction: emmbeding Julia in a C++ application. In this example we call user actions implemented in Julia
- JuliaAction: embedding Julia in a C++ application. In this example we call user actions implemented in Julia

### 0.2.0
- New Features
Expand Down
51 changes: 51 additions & 0 deletions ext/G4Vis/Cones.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,54 @@ function GeometryBasics.faces(pcon::G4Polycone, facets=24)
end
return faces
end

#---G4GenericPolycone-------------------------------------------------------------------------------------

mutable struct GenericPolyconeParams
startPhi::Float64
endPhi::Float64
phiIsOpen::Bool
numCorner::Int32
corners::Ptr{SideRZ}
end

function GeometryBasics.coordinates(pcon::G4GenericPolycone, facets=24)
ϕ₀ = GetStartPhi(pcon)
ϕₑ = GetEndPhi(pcon)
n = GetNumRZCorner(pcon)
issector = !(ϕₑ-ϕ₀ 2π)
rz = [unsafe_load(Ptr{SideRZ}(GetPolyCorner(pcon, i-1).cpp_object)) for i in 1:n]
ϕfacets = round(Int64, (facets/2π) * (ϕₑ-ϕ₀))
ϕ = LinRange(ϕ₀, ϕₑ, ϕfacets)
inner(ϕ, r, z) = Point(r * cos(ϕ), r * sin(ϕ), z)
points = vec([inner(ϕ, rz[j].r, rz[j].z) for ϕ in ϕ, j in 1:n])
#if issector
# for ϕ in (ϕ₀, ϕₑ)
# for i in 1:n
# push!(points, Point(rz[i].r * cos(ϕ), rz[i].r * sin(ϕ), rz[i].z))
# end
# end
#end
return points
end

function GeometryBasics.faces(pcon::G4GenericPolycone, facets=24)
ϕ₀ = GetStartPhi(pcon)
ϕₑ = GetEndPhi(pcon)
n = GetNumRZCorner(pcon)
issector = !(ϕₑ-ϕ₀ 2π)
ϕfacets = round(Int64, (facets/2π) * (ϕₑ-ϕ₀))
idx = LinearIndices((ϕfacets, n))
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)])
faces = vec([quad(i, j) for i in 1:(ϕfacets - 1), j in 1:n])
#if issector
# offset = ϕfacets * n
# for c in 0:1
# for i in 0:n-2
# odx = offset + 2*i + 2*n*c
# push!(faces, QuadFace{Int}(odx+1, odx+2, odx+4, odx+3))
# end
# end
#end
return faces
end
1 change: 1 addition & 0 deletions gen/Geant4.wit.in
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ input = [ "Geant4Wrap.h",
"G4Trap.hh",
"G4Torus.hh",
"G4Polycone.hh",
"G4GenericPolycone.hh",
"G4Polyhedra.hh",
"G4EllipticalTube.hh",
"G4Ellipsoid.hh",
Expand Down
6 changes: 6 additions & 0 deletions gen/cpp/Geant4Wrap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "G4PVPlacement.hh"
#include "G4ParticleTable.hh"
#include "G4Polycone.hh"
#include "G4GenericPolycone.hh"
#include "G4Polyhedra.hh"
#include "G4VIsotopeTable.hh"
#include "G4IonTable.hh"
Expand Down Expand Up @@ -133,6 +134,11 @@ G4PolyconeSideRZ& GetPolyCorner(const G4Polycone& pc, G4int index) {
side = pc.GetCorner(index);
return side;
}
G4PolyconeSideRZ& GetPolyCorner(const G4GenericPolycone& pc, G4int index) {
static G4PolyconeSideRZ side;
side = pc.GetCorner(index);
return side;
}
G4PolyhedraSideRZ& GetPolyCorner(const G4Polyhedra& pc, G4int index) {
static G4PolyhedraSideRZ side;
side = pc.GetCorner(index);
Expand Down
2 changes: 2 additions & 0 deletions gen/cpp/Geant4Wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ class G4PolyconeSideRZ;
class G4PolyhedraSideRZ;
class G4Polycone;
class G4Polyhedra;
class G4GenericPolycone;
G4PolyconeSideRZ& GetPolyCorner(const G4Polycone&, G4int);
G4PolyconeSideRZ& GetPolyCorner(const G4GenericPolycone&, G4int);
G4PolyhedraSideRZ& GetPolyCorner(const G4Polyhedra&, G4int);

void SetParticleByName(G4ParticleGun* gun, const char* pname);
Expand Down
65 changes: 55 additions & 10 deletions gen/jlGeant4-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ G4JLStackingAction
G4JLStateDependent
G4PolyconeSideRZ
G4Polycone
G4GenericPolycone
G4PolyhedraSideRZ
G4Polyhedra
std::pair
Expand Down Expand Up @@ -1031,6 +1032,8 @@ EVolume G4VPhysicalVolume::DeduceVolumeType()
void G4LogicalVolume::G4LogicalVolume(G4VSolid *, G4Material *, const G4String &, G4FieldManager *, G4VSensitiveDetector *, G4UserLimits *, G4bool)
const G4String & G4LogicalVolume::GetName()
void G4LogicalVolume::SetName(const G4String &)
size_t G4LogicalVolume::GetNoDaughters()
G4VPhysicalVolume * G4LogicalVolume::GetDaughter(const size_t)
void G4LogicalVolume::AddDaughter(G4VPhysicalVolume *)
G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume *)
G4bool G4LogicalVolume::IsAncestor(const G4VPhysicalVolume *)
Expand Down Expand Up @@ -1182,6 +1185,8 @@ const G4AffineTransform * G4NavigationHistory::GetPtrTopTransform()
G4int G4NavigationHistory::GetTopReplicaNo()
EVolume G4NavigationHistory::GetTopVolumeType()
G4VPhysicalVolume * G4NavigationHistory::GetTopVolume()
size_t G4NavigationHistory::GetDepth()
size_t G4NavigationHistory::GetMaxDepth()
const G4AffineTransform & G4NavigationHistory::GetTransform(G4int)
G4int G4NavigationHistory::GetReplicaNo(G4int)
EVolume G4NavigationHistory::GetVolumeType(G4int)
Expand Down Expand Up @@ -1261,6 +1266,7 @@ G4double G4Material::GetDensity()
G4State G4Material::GetState()
G4double G4Material::GetTemperature()
G4double G4Material::GetPressure()
size_t G4Material::GetNumberOfElements()
const G4ElementVector * G4Material::GetElementVector()
const G4double * G4Material::GetFractionVector()
const G4int * G4Material::GetAtomsVector()
Expand All @@ -1280,9 +1286,12 @@ G4double G4Material::GetZ()
G4double G4Material::GetA()
void G4Material::SetMaterialPropertiesTable(G4MaterialPropertiesTable *)
G4MaterialPropertiesTable * G4Material::GetMaterialPropertiesTable()
size_t G4Material::GetIndex()
G4MaterialTable * G4Material::GetMaterialTable()
size_t G4Material::GetNumberOfMaterials()
G4Material * G4Material::GetMaterial(const G4String &, G4bool)
G4Material * G4Material::GetMaterial(G4double, G4double, G4double)
G4Material * G4Material::GetMaterial(size_t, G4double)
void G4Material::SetName(const G4String &)
G4bool G4Material::IsExtended()
void G4UserLimits::G4UserLimits(G4double, G4double, G4double, G4double, G4double)
Expand Down Expand Up @@ -1572,6 +1581,7 @@ void G4Step::UpdateTrack()
void G4Step::CopyPostToPreStepPoint()
void G4Step::SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector> *)
std::vector<G4ThreeVector> * G4Step::GetPointerToVectorOfAuxiliaryPoints()
size_t G4Step::GetNumberOfSecondariesInCurrentStep()
const std::vector<const G4Track *> * G4Step::GetSecondaryInCurrentStep()
const G4TrackVector * G4Step::GetSecondary()
G4TrackVector * G4Step::GetfSecondary()
Expand Down Expand Up @@ -1876,8 +1886,8 @@ void G4VCSGfaceted::SetAreaStatistics(G4int)
void G4VCSGfaceted::SetAreaAccuracy(G4double)
G4double G4VCSGfaceted::GetCubicVolume()
G4double G4VCSGfaceted::GetSurfaceArea()
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double[], const G4double[], const G4double[])
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double[], const G4double[])
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [], const G4double [])
void G4Polycone::G4Polycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [])
EInside G4Polycone::Inside(const G4ThreeVector &)
G4double G4Polycone::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
G4double G4Polycone::DistanceToIn(const G4ThreeVector &)
Expand All @@ -1903,8 +1913,31 @@ G4PolyconeHistorical * G4Polycone::GetOriginalParameters()
void G4Polycone::SetOriginalParameters(G4PolyconeHistorical *)
void G4Polycone::G4Polycone(const G4Polycone &)
G4Polycone & G4Polycone::operator=(const G4Polycone &)
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double[], const G4double[], const G4double[])
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double[], const G4double[])
void G4GenericPolycone::G4GenericPolycone(const G4String &, G4double, G4double, G4int, const G4double [], const G4double [])
EInside G4GenericPolycone::Inside(const G4ThreeVector &)
G4double G4GenericPolycone::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
G4double G4GenericPolycone::DistanceToIn(const G4ThreeVector &)
void G4GenericPolycone::BoundingLimits(G4ThreeVector &, G4ThreeVector &)
G4double G4GenericPolycone::GetCubicVolume()
G4double G4GenericPolycone::GetSurfaceArea()
G4ThreeVector G4GenericPolycone::GetPointOnSurface()
G4GeometryType G4GenericPolycone::GetEntityType()
G4VSolid * G4GenericPolycone::Clone()
G4Polyhedron * G4GenericPolycone::CreatePolyhedron()
G4bool G4GenericPolycone::Reset()
G4double G4GenericPolycone::GetStartPhi()
G4double G4GenericPolycone::GetEndPhi()
G4double G4GenericPolycone::GetSinStartPhi()
G4double G4GenericPolycone::GetCosStartPhi()
G4double G4GenericPolycone::GetSinEndPhi()
G4double G4GenericPolycone::GetCosEndPhi()
G4bool G4GenericPolycone::IsOpen()
G4int G4GenericPolycone::GetNumRZCorner()
G4PolyconeSideRZ G4GenericPolycone::GetCorner(G4int)
void G4GenericPolycone::G4GenericPolycone(const G4GenericPolycone &)
G4GenericPolycone & G4GenericPolycone::operator=(const G4GenericPolycone &)
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double [], const G4double [], const G4double [])
void G4Polyhedra::G4Polyhedra(const G4String &, G4double, G4double, G4int, G4int, const G4double [], const G4double [])
EInside G4Polyhedra::Inside(const G4ThreeVector &)
G4double G4Polyhedra::DistanceToIn(const G4ThreeVector &, const G4ThreeVector &)
G4double G4Polyhedra::DistanceToIn(const G4ThreeVector &)
Expand Down Expand Up @@ -1951,9 +1984,12 @@ const std::vector<G4ThreeVector> * G4VTrajectoryPoint::GetAuxiliaryPoints()
std::vector<G4AttValue> * G4VTrajectoryPoint::CreateAttValues()
G4bool G4TrajectoryContainer::operator==(const G4TrajectoryContainer &)
G4bool G4TrajectoryContainer::operator!=(const G4TrajectoryContainer &)
size_t G4TrajectoryContainer::size()
void G4TrajectoryContainer::push_back(G4VTrajectory *)
size_t G4TrajectoryContainer::entries()
G4bool G4TrajectoryContainer::insert(G4VTrajectory *)
void G4TrajectoryContainer::clearAndDestroy()
G4VTrajectory * G4TrajectoryContainer::operator[](size_t)
TrajectoryVector * G4TrajectoryContainer::GetVector()
void G4DisplacedSolid::G4DisplacedSolid(const G4String &, G4VSolid *, G4RotationMatrix *, const G4ThreeVector &)
void G4DisplacedSolid::G4DisplacedSolid(const G4String &, G4VSolid *, const G4Transform3D &)
Expand Down Expand Up @@ -2041,8 +2077,8 @@ double CLHEP::HepRandomEngine::flat()
void CLHEP::HepRandomEngine::flatArray(const int, double *)
void CLHEP::HepRandomEngine::setSeed(long, int)
void CLHEP::HepRandomEngine::setSeeds(const long *, int)
void CLHEP::HepRandomEngine::saveStatus(const char[])
void CLHEP::HepRandomEngine::restoreStatus(const char[])
void CLHEP::HepRandomEngine::saveStatus(const char [])
void CLHEP::HepRandomEngine::restoreStatus(const char [])
void CLHEP::HepRandomEngine::showStatus()
std::string CLHEP::HepRandomEngine::name()
std::string CLHEP::HepRandomEngine::beginTag()
Expand All @@ -2069,8 +2105,8 @@ void CLHEP::HepRandom::getTheTableSeeds(long *, int)
CLHEP::HepRandom * CLHEP::HepRandom::getTheGenerator()
void CLHEP::HepRandom::setTheEngine(CLHEP::HepRandomEngine *)
CLHEP::HepRandomEngine * CLHEP::HepRandom::getTheEngine()
void CLHEP::HepRandom::saveEngineStatus(const char[])
void CLHEP::HepRandom::restoreEngineStatus(const char[])
void CLHEP::HepRandom::saveEngineStatus(const char [])
void CLHEP::HepRandom::restoreEngineStatus(const char [])
void CLHEP::HepRandom::showEngineStatus()
int CLHEP::HepRandom::createInstance()
std::string CLHEP::HepRandom::distributionName()
Expand Down Expand Up @@ -2110,8 +2146,8 @@ double CLHEP::RandFlat::operator()(double, double)
std::string CLHEP::RandFlat::name()
CLHEP::HepRandomEngine & CLHEP::RandFlat::engine()
std::string CLHEP::RandFlat::distributionName()
void CLHEP::RandFlat::saveEngineStatus(const char[])
void CLHEP::RandFlat::restoreEngineStatus(const char[])
void CLHEP::RandFlat::saveEngineStatus(const char [])
void CLHEP::RandFlat::restoreEngineStatus(const char [])
void CLHEP::RandExponential::RandExponential(CLHEP::HepRandomEngine &, double)
void CLHEP::RandExponential::RandExponential(CLHEP::HepRandomEngine *, double)
double CLHEP::RandExponential::shoot()
Expand Down Expand Up @@ -2202,9 +2238,12 @@ std::string CLHEP::RandPoissonQ::name()
CLHEP::HepRandomEngine & CLHEP::RandPoissonQ::engine()
std::string CLHEP::RandPoissonQ::distributionName()
int CLHEP::RandPoissonQ::tableBoundary()
void G4ProcessVector::G4ProcessVector(size_t)
void G4ProcessVector::G4ProcessVector(const G4ProcessVector &)
G4ProcessVector & G4ProcessVector::operator=(const G4ProcessVector &)
G4bool G4ProcessVector::operator==(const G4ProcessVector &)
size_t G4ProcessVector::entries()
size_t G4ProcessVector::index(G4VProcess *)
G4bool G4ProcessVector::contains(G4VProcess *)
G4bool G4ProcessVector::insert(G4VProcess *)
G4bool G4ProcessVector::insertAt(G4int, G4VProcess *)
Expand Down Expand Up @@ -2766,6 +2805,8 @@ void G4TransportationManager::SetFieldManager(G4FieldManager *)
G4Navigator * G4TransportationManager::GetNavigatorForTracking()
void G4TransportationManager::SetNavigatorForTracking(G4Navigator *)
void G4TransportationManager::SetWorldForTracking(G4VPhysicalVolume *)
size_t G4TransportationManager::GetNoActiveNavigators()
size_t G4TransportationManager::GetNoWorlds()
G4SafetyHelper * G4TransportationManager::GetSafetyHelper()
G4VPhysicalVolume * G4TransportationManager::GetParallelWorld(const G4String &)
G4VPhysicalVolume * G4TransportationManager::IsWorldExisting(const G4String &)
Expand Down Expand Up @@ -3275,9 +3316,11 @@ G4LogicalBorderSurface * G4LogicalBorderSurface::GetSurface(const G4VPhysicalVol
void G4LogicalBorderSurface::SetPhysicalVolumes(G4VPhysicalVolume *, G4VPhysicalVolume *)
const G4VPhysicalVolume * G4LogicalBorderSurface::GetVolume1()
const G4VPhysicalVolume * G4LogicalBorderSurface::GetVolume2()
size_t G4LogicalBorderSurface::GetIndex()
void G4LogicalBorderSurface::SetVolume1(G4VPhysicalVolume *)
void G4LogicalBorderSurface::SetVolume2(G4VPhysicalVolume *)
void G4LogicalBorderSurface::CleanSurfaceTable()
size_t G4LogicalBorderSurface::GetNumberOfBorderSurfaces()
void G4LogicalBorderSurface::DumpInfo()
void G4LogicalSkinSurface::G4LogicalSkinSurface(const G4String &, G4LogicalVolume *, G4SurfaceProperty *)
G4bool G4LogicalSkinSurface::operator==(const G4LogicalSkinSurface &)
Expand All @@ -3287,6 +3330,7 @@ const G4LogicalVolume * G4LogicalSkinSurface::GetLogicalVolume()
void G4LogicalSkinSurface::SetLogicalVolume(G4LogicalVolume *)
void G4LogicalSkinSurface::CleanSurfaceTable()
const G4LogicalSkinSurfaceTable * G4LogicalSkinSurface::GetSurfaceTable()
size_t G4LogicalSkinSurface::GetNumberOfSkinSurfaces()
void G4LogicalSkinSurface::DumpInfo()
void G4VMPLData::initialize()
void G4VModularPhysicsList::ConstructParticle()
Expand Down Expand Up @@ -3731,6 +3775,7 @@ CLHEP::Hep2Vector CLHEP::operator-(const CLHEP::Hep2Vector &, const CLHEP::Hep2V
size_t size(const G4LogicalVolumeStore *)
G4LogicalVolume * GetVolume(const G4LogicalVolumeStore *, size_t)
G4PolyconeSideRZ & GetPolyCorner(const G4Polycone &, G4int)
G4PolyconeSideRZ & GetPolyCorner(const G4GenericPolycone &, G4int)
G4PolyhedraSideRZ & GetPolyCorner(const G4Polyhedra &, G4int)
void SetParticleByName(G4ParticleGun *, const char *)
G4ParticleDefinition * FindParticle(const char *)
Expand Down
2 changes: 1 addition & 1 deletion src/Geant4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Geant4
else
using Geant4_julia_jll
include(Geant4_julia_jll.Geant4_exports)
export G4GenericPolycone, LBE # Export the C++ classes that where forgotten in the binary package
@wrapmodule(()->Geant4_julia_jll.libGeant4Wrap)
end

Expand Down Expand Up @@ -49,4 +50,3 @@ module Geant4
H1D() = "Not implemented" # Constructors
H2D() = "Not implemented" # Constructors
end

2 comments on commit ec99537

@peremato
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes

  • New Features
    • Added wrappers for classes LBE, G4GenericPolycone
    • Added Visualization for G4GenericPolycone
  • New Examples:
    • UserLib: how to build and call a user custom library providing additional Geant4 functionally that is not provided by the set of wrapped classes
    • JuliaAction: embedding Julia in a C++ application. In this example we call user actions implemented in Julia

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/122663

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" ec995374c3985c6c0237583bc81718a4a70a2c1e
git push origin v0.2.1

Please sign in to comment.