45 const G4int nReplicas,
49 pMotherPhysical != nullptr ? pMotherPhysical->GetLogicalVolume() : nullptr ),
56 if( motherLogical !=
nullptr )
63 if ((pMotherPhysical !=
nullptr) && (pMotherPhysical->
IsParameterised()))
65 std::ostringstream message, hint;
66 message <<
"A parameterised volume is being placed" <<
G4endl
67 <<
"inside another parameterised volume !";
68 hint <<
"To make sure that no overlaps are generated," <<
G4endl
69 <<
"you should verify the mother replicated shapes" <<
G4endl
70 <<
"are of the same type and dimensions." <<
G4endl
71 <<
" Mother physical volume: " << pMotherPhysical->
GetName() <<
G4endl
72 <<
" Parameterised volume: " << pName <<
G4endl
73 <<
" (To switch this warning off, compile with G4_NO_VERBOSE)";
74 G4Exception(
"G4PVParameterised::G4PVParameterised()",
"GeomVol1002",
88 const G4int nReplicas,
91 :
G4PVReplica(pName, nReplicas, pAxis, pLogical, pMotherLogical ),
95 if( pMotherLogical !=
nullptr )
175 if (res<=0) {
return false; }
179 G4VSolid *solidA =
nullptr, *solidB =
nullptr;
182 std::vector<G4ThreeVector> points;
186 G4cout <<
"Checking overlaps for parameterised volume "
205 for (
auto n=0; n<res; ++n)
216 ++trials; retval =
true;
217 std::ostringstream message;
218 message <<
"Overlap with mother volume !" <<
G4endl
219 <<
" Overlap is detected for volume "
221 <<
" with its mother volume "
223 <<
" at mother local point " << mp <<
", "
224 <<
"overlapping by at least: "
229 <<
"NOTE: Reached maximum fixed number -" << maxErr
230 <<
"- of overlaps reports for this volume !";
234 if (trials>=maxErr) {
return true; }
237 points.push_back(mp);
252 for (
const auto & point : points)
258 if (solidB->Inside(md)==
kInside)
260 G4double distout = solidB->DistanceToOut(md);
263 ++trials; retval =
true;
264 std::ostringstream message;
265 message <<
"Overlap within parameterised volumes !" <<
G4endl
266 <<
" Overlap is detected for volume "
268 <<
" with parameterised volume instance: " << j
270 <<
" at local point " << md <<
", "
271 <<
"overlapping by at least: "
273 <<
", related to volume instance: " << j <<
".";
277 <<
"NOTE: Reached maximum fixed number -" << maxErr
278 <<
"- of overlaps reports for this volume !";
282 if (trials>=maxErr) {
return true; }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
G4VSolid * GetSolid() const
void AddDaughter(G4VPhysicalVolume *p)
const G4String & GetName() const
G4bool IsParameterised() const override
void SetRegularStructureId(G4int code) override
G4VPVParameterisation * GetParameterisation() const override
EVolume VolumeType() const final
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1) override
void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const override
G4PVParameterised(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMotherLogical, const EAxis pAxis, const G4int nReplicas, G4VPVParameterisation *pParam, G4bool pSurfChk=false)
~G4PVParameterised() override
virtual void SetRegularStructureId(G4int code)
G4int GetMultiplicity() const override
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
virtual void ComputeTransformation(const G4int, G4VPhysicalVolume *) const =0
G4LogicalVolume * GetMotherLogical() const
const G4RotationMatrix * GetRotation() const
const G4ThreeVector GetTranslation() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual G4bool IsParameterised() const =0
void SetMotherLogical(G4LogicalVolume *pMother)
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
virtual G4ThreeVector GetPointOnSurface() const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0