File indexing completed on 2025-01-30 10:09:32
0001
0002
0003
0004
0005
0006
0007
0008 #pragma once
0009
0010 #include <unordered_map>
0011
0012 #include "corecel/Types.hh"
0013 #include "corecel/cont/Array.hh"
0014
0015 class G4VSolid;
0016 class G4BooleanSolid;
0017
0018 namespace vecgeom
0019 {
0020 inline namespace cxx
0021 {
0022 class VPlacedVolume;
0023 class VUnplacedVolume;
0024 }
0025 }
0026
0027 namespace celeritas
0028 {
0029 namespace g4vg
0030 {
0031
0032 class Scaler;
0033 class Transformer;
0034
0035
0036
0037
0038
0039 class SolidConverter
0040 {
0041 public:
0042
0043
0044 using arg_type = G4VSolid const&;
0045 using result_type = vecgeom::VUnplacedVolume*;
0046
0047
0048 public:
0049 inline SolidConverter(Scaler const& convert_scale,
0050 Transformer const& convert_transform,
0051 bool compare_volumes);
0052
0053
0054 result_type operator()(arg_type);
0055
0056
0057 result_type to_sphere(arg_type) const;
0058
0059 private:
0060
0061
0062 using PlacedBoolVolumes = Array<vecgeom::VPlacedVolume const*, 2>;
0063
0064
0065
0066 Scaler const& scale_;
0067 Transformer const& transform_;
0068 bool compare_volumes_;
0069 std::unordered_map<G4VSolid const*, result_type> cache_;
0070
0071
0072
0073
0074 result_type convert_impl(arg_type);
0075
0076
0077 result_type box(arg_type);
0078 result_type cons(arg_type);
0079 result_type cuttubs(arg_type);
0080 result_type ellipsoid(arg_type);
0081 result_type ellipticalcone(arg_type);
0082 result_type ellipticaltube(arg_type);
0083 result_type extrudedsolid(arg_type);
0084 result_type genericpolycone(arg_type);
0085 result_type generictrap(arg_type);
0086 result_type hype(arg_type);
0087 result_type intersectionsolid(arg_type);
0088 result_type orb(arg_type);
0089 result_type para(arg_type);
0090 result_type paraboloid(arg_type);
0091 result_type polycone(arg_type);
0092 result_type polyhedra(arg_type);
0093 result_type reflectedsolid(arg_type);
0094 result_type sphere(arg_type);
0095 result_type subtractionsolid(arg_type);
0096 result_type tessellatedsolid(arg_type);
0097 result_type tet(arg_type);
0098 result_type torus(arg_type);
0099 result_type trap(arg_type);
0100 result_type trd(arg_type);
0101 result_type tubs(arg_type);
0102 result_type unionsolid(arg_type);
0103
0104
0105 PlacedBoolVolumes convert_bool_impl(G4BooleanSolid const&);
0106
0107 void compare_volumes(G4VSolid const&, vecgeom::VUnplacedVolume const&);
0108
0109 double calc_capacity(G4VSolid const&) const;
0110 };
0111
0112
0113
0114
0115
0116 SolidConverter::SolidConverter(Scaler const& convert_scale,
0117 Transformer const& convert_transform,
0118 bool compare_volumes)
0119 : scale_(convert_scale)
0120 , transform_(convert_transform)
0121 , compare_volumes_(compare_volumes)
0122 {
0123 }
0124
0125
0126 }
0127 }