Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+93 -109
View File
@@ -5,9 +5,23 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Curve.hh,v 1.4 2000/02/16 12:02:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4Curve.hh,v 1.7 2000/11/08 14:22:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ----------------------------------------------------------------------
// Class G4Curve
//
// Class Description:
//
// Definition of a generic curve.
// To Initialize objects derived from G4Curve:
// - Construct curve (the constructor takes no parameters)
// - call Init()
// - if the curve is bounded, call one of the SetBounds() methods.
// Author: J.Sulkimo, P.Urban.
// Revisions by: L.Broglia, G.Cosmo.
// ----------------------------------------------------------------------
#ifndef __CURVE_H
#define __CURVE_H
@@ -18,147 +32,113 @@
#include "G4Transform3D.hh"
#include "G4Ray.hh"
class G4Ray;
class G4CurveRayIntersection;
class G4CurvePoint;
class G4Surface;
class G4Curve
{
public:
// The right way to Initialize objects derived from G4Curve is:
// . Construct (the constructor takes no parameters)
// . call Init()
// . call one of the SetBounds(), if the curve is bounded (most are)
public: // with description
G4Curve();
virtual ~G4Curve();
// Constructor & destructor.
virtual G4String GetEntityType() const { return "G4Curve"; }
G4Curve(const G4Curve& c);
G4Curve& operator=(const G4Curve& c);
// Copy contructor and assignment operator.
private:
inline G4bool operator==(const G4Curve& right) const;
// Equality operator.
G4Curve(const G4Curve&);
G4Curve& operator=(const G4Curve&);
virtual G4String GetEntityType() const;
// Returns shape identifier.
public:
// transformation of the curve
// virtual void Transform(const G4Transform3D& tr);
// projection onto the xy plane after transformation tr
// the returned object is allocated dynamically;
// it is the caller's responsibility to delete it
// in case the projection maps two distinct points into one,
// 0 is returned
// NOTE: this should not occur when using projection
// with G4SurfaceOfRevolution.
// For other uses this might be too restrictive...
virtual G4Curve* Project(const G4Transform3D& tr=G4Transform3D::Identity)= 0;
// tangent vector to a curve at the point with parameter u
// true if exists
// vector comes into v
// Projection onto the xy plane after the transformation tr.
// The returned object is allocated dynamically; it's caller's
// responsibility to delete it.
// In case the projection maps two distinct points into one, 0 is returned.
// NOTE: this should not occur when using projection with
// G4SurfaceOfRevolution.
virtual G4bool Tangent(G4CurvePoint& cp, G4Vector3D& v)= 0;
// Returns tangent vector v to a curve at the point cp.
// Returns true if v exists.
// intersect a 2D curve (probably obtained with Project) with a ray.
// the ray is projected onto the xy plane.
// no intersection: return false
// intersection: return true, and set intersection0
// the intersection point is ray.start+ray.dir*intersection0
// virtual void IntersectRay2D(const G4Ray& ray, G4CurveRayIntersection& is)= 0;
virtual G4int IntersectRay2D(const G4Ray& ray)= 0;
// Intersects a 2D curve with a ray.
// The ray is projected onto the xy plane.
// If no intersection it returns false, otherwise it returns true,
// the intersection point is ray.start+ray.dir*intersection0.
// start and endpoints
// in 3D space
const G4Point3D& GetStart() const;
const G4Point3D& GetEnd() const;
inline const G4Point3D& GetStart() const;
inline const G4Point3D& GetEnd() const;
// Return start and endpoints in 3D space.
inline G4double GetPStart() const;
inline G4double GetPEnd() const;
// Return start and endpoints in parameter space.
// in parameter space
G4double GetPStart() const;
G4double GetPEnd() const;
inline void SetBounds(G4double p1, G4double p2);
inline void SetBounds(G4double p1, const G4Point3D& p2);
inline void SetBounds(const G4Point3D& p1, G4double p2);
inline void SetBounds(const G4Point3D& p1, const G4Point3D& p2);
// Set start and endpoints, given points as parameter values
// or 3D points.
inline G4bool IsBounded() const;
// Returns if the curve is bounded.
// set start and endpoints
// four versions, as both points can be given as parameter values
// or 3D points
void SetBounds(G4double p1, G4double p2);
void SetBounds(G4double p1, const G4Point3D& p2);
void SetBounds(const G4Point3D& p1, G4double p2);
void SetBounds(const G4Point3D& p1, const G4Point3D& p2);
inline G4bool IsPOn(G4double param) const;
// Returns if the parameter is on the curve.
inline void SetSameSense(G4int sameSense0);
inline G4int GetSameSense() const;
// The sameSense flag can be used to reverse the orientation
// of the curve (value false).
// The curves themselves never use the value of this flag;
// this is just a convenient mean of storing this piece of
// topological information.
// returns if the curve is bounded
G4bool IsBounded() const;
virtual G4double GetPMax() const = 0;
// If the parameter space is closed, return the max value
// if not, return <=0.
virtual G4Point3D GetPoint(G4double param) const = 0;
// Return the point in the 3D space, given correspondent parameter.
// returns if the parameter is on the curve
G4bool IsPOn(G4double param);
virtual G4double GetPPoint(const G4Point3D& p) const = 0;
// Return parapmeter give a point in space.
// In case the point is further off the curve than some tolerance
// the result is undefined.
// the sameSense flag can be used to reverse the orientation
// of the curve (value false).
// the curves themselves never use the value of this flag;
// this is just a convenient means of storing
// this piece of topological information.
void SetSameSense(G4int sameSense0);
G4int GetSameSense() const;
// if the parameter space is closed, return the max value
// if not, return <=0
virtual G4double GetPMax()= 0;
// parameter -> point
virtual G4Point3D GetPoint(G4double param)= 0;
// point -> parameter
// result is undefined
// if the point is further off the curve than some tolerance
virtual G4double GetPPoint(const G4Point3D& p)= 0;
// get the bounding box for the curve
// this function only works when the curve is bounded!
// otherwise, the result is undefined.
const G4BoundingBox3D* BBox() const;
// Gets the bounding box for the curve
// If the curve is not bounded, the result is undefined.
// To be moved to a derived class
// really needed?
virtual void SetParentSrfPtr(const G4Surface* srf){}
virtual const char* Name() const;
// Returns type name.
public: // without description
virtual const char* Name() const {return "G4Curve";}
// virtual void Transform(const G4Transform3D& tr);
// Transformation of the curve.
// virtual void IntersectRay2D(const G4Ray&, G4CurveRayIntersection&)= 0;
G4bool operator==(const G4Curve& right) const
{
return this == &right;
}
virtual void SetParentSrfPtr(const G4Surface*);
// To be moved to a derived class. Is it really needed?
protected:
G4BoundingBox3D bBox;
// This function will be called after the bounds are set:
protected:
virtual void InitBounded()= 0;
// This function will be called after the bounds are set.
private:
void SetStart(const G4Point3D& pt);
void SetStart(G4double p);
void SetEnd(const G4Point3D& p);
void SetEnd(G4double p);
void SetBoundsRest();
protected:
G4BoundingBox3D bBox;
G4Point3D start;
G4Point3D end;
G4double pStart;
@@ -166,13 +146,17 @@ private:
G4double pRange;
G4bool bounded;
G4int sameSense;
};
private:
inline void SetStart(const G4Point3D& pt);
inline void SetStart(G4double p);
inline void SetEnd(const G4Point3D& p);
inline void SetEnd(G4double p);
inline void SetBoundsRest();
};
#include "G4Curve.icc"
#endif