diff --git a/DDSurfaces/CMakeLists.txt b/DDSurfaces/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..967d57672ab9d7989349ca4fab322b03d0aea416 --- /dev/null +++ b/DDSurfaces/CMakeLists.txt @@ -0,0 +1,48 @@ +cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) + +#--------------------------- +set( PackageName DDSurfaces ) +#--------------------------- + +project(${PackageName}) + +# project version +SET( DDSurfaces_VERSION_MAJOR 0 ) +SET( DDSurfaces_VERSION_MINOR 1 ) +SET( DDSurfaces_VERSION_PATCH 0 ) + +SET( DDSurfaces_VERSION "${DDSurfaces_VERSION_MAJOR}.${DDSurfaces_VERSION_MINOR}" ) +SET( DDSurfaces_SOVERSION "${DDSurfaces_VERSION_MAJOR}.${DDSurfaces_VERSION_MINOR}" ) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ) +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) +set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) + +IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + SET( CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR} CACHE PATH + "install prefix path - overwrite with -D CMAKE_INSTALL_PREFIX = ..." + FORCE ) + MESSAGE(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX} - overwrite with -D CMAKE_INSTALL_PREFIX" ) +ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + +file(GLOB sources src/*.cpp) + +add_library(${PackageName} SHARED ${sources} ) + +SET(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") +SET_TARGET_PROPERTIES( ${PackageName} PROPERTIES VERSION ${DDSurfaces_VERSION} SOVERSION ${DDSurfaces_SOVERSION}) + +#--- install target------------------------------------- +install(DIRECTORY include/${PackageName} + DESTINATION include + PATTERN ".svn" EXCLUDE ) + +install(TARGETS ${PackageName} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib +) + +# to do: add corresponding uninstall... +#------------------------------------------------------- diff --git a/DDSurfaces/include/DDSurfaces/DiskSurface.h b/DDSurfaces/include/DDSurfaces/DiskSurface.h index 477ebd7e5420784614c575d4be8811717f724b90..0d4afec36fb51b6367e0766853f6a7f8bb04d8ec 100644 --- a/DDSurfaces/include/DDSurfaces/DiskSurface.h +++ b/DDSurfaces/include/DDSurfaces/DiskSurface.h @@ -12,7 +12,9 @@ namespace DDSurfaces { -class DiskBoundary; +struct DiskBoundary { + ; +}; class DiskSurface: public ISurface { public: @@ -23,13 +25,13 @@ public: virtual ~DiskSurface(); /// Checks if the given point lies within the surface - bool isInsideBoundaries(const Vector3D& point) const; + virtual bool isInsideBoundaries(const Vector3D& point) const; /// Access to the normal direction at the given point - Vector3D getNormal(const Vector3D& point) const; + virtual Vector3D getNormal(const Vector3D& point) const; /// Access to the measurement directions at the given point - Measurement measurement(const Vector3D& point) const; + virtual Measurement measurement(const Vector3D& point) const; protected: DiskBoundary m_boundary; diff --git a/DDSurfaces/include/DDSurfaces/ISurface.h b/DDSurfaces/include/DDSurfaces/ISurface.h index 7d907a6d7c08e198f4879df90420ef12335688eb..f1ca8ce274319a2139b797fad580d14922a710f4 100644 --- a/DDSurfaces/include/DDSurfaces/ISurface.h +++ b/DDSurfaces/include/DDSurfaces/ISurface.h @@ -25,18 +25,18 @@ public: } /// Checks if the surface has measurement directions - bool hasMeasurement() const { + virtual bool hasMeasurement() const { return m_measurement != 0; } /// Checks if the given point lies within the surface - bool isInsideBoundaries(const Vector3D& point) const = 0; + virtual bool isInsideBoundaries(const Vector3D& point) const = 0; /// Access to the normal direction at the given point - Vector3D getNormal(const Vector3D& point) const = 0; + virtual Vector3D getNormal(const Vector3D& point) const = 0; /// Access to the measurement directions at the given point - Measurement measurement(const Vector3D& point) const = 0; + virtual Measurement measurement(const Vector3D& point) const = 0; /// Access to the material in opposite direction of the normal const Material& innerMaterial() const { @@ -65,7 +65,7 @@ public: protected: /// Constructor which can be used by derived classes - ISurface(const Material& innerMaterial=Material(), const Material& outerMaterial=Material()) : + ISurface(const Material& innerMaterial = Material(), const Material& outerMaterial = Material()) : m_innerMaterial(innerMaterial), m_outerMaterial(outerMaterial), m_measurement(0) { } diff --git a/DDSurfaces/include/DDSurfaces/Material.h b/DDSurfaces/include/DDSurfaces/Material.h index ccb00970c49e2ac2b83293d6006532730c6c9113..69da036677d6774155df5f61b6b1e8dfef09dfe0 100644 --- a/DDSurfaces/include/DDSurfaces/Material.h +++ b/DDSurfaces/include/DDSurfaces/Material.h @@ -14,7 +14,7 @@ namespace DDSurfaces { class Material { public: /// Default constructor - Material(int Z=0, int A=0, double density=0., double radiationLength = 0.) : + Material(int Z = 0, int A = 0, double density = 0., double radiationLength = 0.) : m_Z(Z), m_A(A), m_density(density), m_radiationLength( radiationLength) { } diff --git a/DDSurfaces/include/DDSurfaces/Measurement.h b/DDSurfaces/include/DDSurfaces/Measurement.h index 661053461df09d191628e0a9f98b93c52284d16a..4e010babe37c40b2638febf75fddec6e231cab21 100644 --- a/DDSurfaces/include/DDSurfaces/Measurement.h +++ b/DDSurfaces/include/DDSurfaces/Measurement.h @@ -16,7 +16,7 @@ namespace DDSurfaces { class Measurement { public: /// Default constructor - Measurement(const Vector3D& u, const Vector3D& v) : + Measurement(const Vector3D& u = Vector3D(), const Vector3D& v = Vector3D()) : m_u(u), m_v(v) { } diff --git a/DDSurfaces/include/DDSurfaces/StraightLineSurface.h b/DDSurfaces/include/DDSurfaces/StraightLineSurface.h index df96a5baa4004e28e8e099c2cd247242ef7dc20c..48468db90cdfe250ae8ce35ea5ef0e7bdcc2e1f8 100644 --- a/DDSurfaces/include/DDSurfaces/StraightLineSurface.h +++ b/DDSurfaces/include/DDSurfaces/StraightLineSurface.h @@ -12,7 +12,9 @@ namespace DDSurfaces { -class StraightLineBoundary; +struct StraightLineBoundary { + ; +}; class StraightLineSurface: public ISurface { public: @@ -23,13 +25,13 @@ public: virtual ~StraightLineSurface(); /// Checks if the given point lies within the surface - bool isInsideBoundaries(const Vector3D& point) const; + virtual bool isInsideBoundaries(const Vector3D& point) const; /// Access to the normal direction at the given point - Vector3D getNormal(const Vector3D& point) const; + virtual Vector3D getNormal(const Vector3D& point) const; /// Access to the measurement directions at the given point - Measurement measurement(const Vector3D& point) const; + virtual Measurement measurement(const Vector3D& point) const; protected: StraightLineBoundary m_boundary; diff --git a/DDSurfaces/include/DDSurfaces/Vector3D.h b/DDSurfaces/include/DDSurfaces/Vector3D.h index 85d871e1dd2c8df592577da200535fe048ab8d09..3b710a815611d1aad944362d8c602b91d5e6e79c 100644 --- a/DDSurfaces/include/DDSurfaces/Vector3D.h +++ b/DDSurfaces/include/DDSurfaces/Vector3D.h @@ -14,7 +14,7 @@ namespace DDSurfaces { class Vector3D { public: /// Default constructor - Vector3D(double x=0., double y=0., double z=0.) : + Vector3D(double x = 0., double y = 0., double z = 0.) : m_x(x), m_y(y), m_z(z) { } diff --git a/DDSurfaces/include/DDSurfaces/ZCylinderSurface.h b/DDSurfaces/include/DDSurfaces/ZCylinderSurface.h index 7eb4835e53677094aeae42c589211d9da2bb8198..3161f1dd61ca41d646f1e91b1c7d857eb6507a0e 100644 --- a/DDSurfaces/include/DDSurfaces/ZCylinderSurface.h +++ b/DDSurfaces/include/DDSurfaces/ZCylinderSurface.h @@ -12,7 +12,9 @@ namespace DDSurfaces { -class ZCylinderBoundary; +struct ZCylinderBoundary { + ; +}; class ZCylinderSurface: public ISurface { public: @@ -23,13 +25,13 @@ public: virtual ~ZCylinderSurface(); /// Checks if the given point lies within the surface - bool isInsideBoundaries(const Vector3D& point) const; + virtual bool isInsideBoundaries(const Vector3D& point) const; /// Access to the normal direction at the given point - Vector3D getNormal(const Vector3D& point) const; + virtual Vector3D getNormal(const Vector3D& point) const; /// Access to the measurement directions at the given point - Measurement measurement(const Vector3D& point) const; + virtual Measurement measurement(const Vector3D& point) const; protected: ZCylinderBoundary m_boundary; diff --git a/DDSurfaces/include/DDSurfaces/ZPlanarSurface.h b/DDSurfaces/include/DDSurfaces/ZPlanarSurface.h index 7d7a98314524cca146b5c2fbd9b8e1f4c8b3213f..d690a42c050cfa4947d4ebf2ebcc8eda0af19033 100644 --- a/DDSurfaces/include/DDSurfaces/ZPlanarSurface.h +++ b/DDSurfaces/include/DDSurfaces/ZPlanarSurface.h @@ -12,7 +12,9 @@ namespace DDSurfaces { -class ZPlanarBoundary; +struct ZPlanarBoundary { + ; +}; class ZPlanarSurface: public ISurface { public: @@ -23,13 +25,13 @@ public: virtual ~ZPlanarSurface(); /// Checks if the given point lies within the surface - bool isInsideBoundaries(const Vector3D& point) const; + virtual bool isInsideBoundaries(const Vector3D& point) const; /// Access to the normal direction at the given point - Vector3D getNormal(const Vector3D& point) const; + virtual Vector3D getNormal(const Vector3D& point) const; /// Access to the measurement directions at the given point - Measurement measurement(const Vector3D& point) const; + virtual Measurement measurement(const Vector3D& point) const; protected: ZPlanarBoundary m_boundary; diff --git a/DDSurfaces/src/DiskSurface.cpp b/DDSurfaces/src/DiskSurface.cpp index f342d376bc71314503e08a817cb1e7de104ae01d..bbc249463a44da47f10b96b8461c7e6490450953 100644 --- a/DDSurfaces/src/DiskSurface.cpp +++ b/DDSurfaces/src/DiskSurface.cpp @@ -34,7 +34,7 @@ Vector3D DiskSurface::getNormal(const Vector3D& point) const { /// Access to the measurement directions at the given point Measurement DiskSurface::measurement(const Vector3D& point) const { // TODO - return Vector3D(); + return Measurement(); } } /* namespace DDSurfaces */ diff --git a/DDSurfaces/src/StraightLineSurface.cpp b/DDSurfaces/src/StraightLineSurface.cpp index e03fbaf046319cf2f07321fadfce0ccef78aed5c..a8eb02ff59f24adf44ea4eb66ebe00b4f2eb6272 100644 --- a/DDSurfaces/src/StraightLineSurface.cpp +++ b/DDSurfaces/src/StraightLineSurface.cpp @@ -34,7 +34,7 @@ Vector3D StraightLineSurface::getNormal(const Vector3D& point) const { /// Access to the measurement directions at the given point Measurement StraightLineSurface::measurement(const Vector3D& point) const { // TODO - return Vector3D(); + return Measurement(); } } /* namespace DDSurfaces */ diff --git a/DDSurfaces/src/ZCylinderSurface.cpp b/DDSurfaces/src/ZCylinderSurface.cpp index 04f1c032ac9792590b939962437db234d64df2db..6ff626bed576ad56d5dd0f2e0c9958eabcd33fa0 100644 --- a/DDSurfaces/src/ZCylinderSurface.cpp +++ b/DDSurfaces/src/ZCylinderSurface.cpp @@ -34,7 +34,7 @@ Vector3D ZCylinderSurface::getNormal(const Vector3D& point) const { /// Access to the measurement directions at the given point Measurement ZCylinderSurface::measurement(const Vector3D& point) const { // TODO - return Vector3D(); + return Measurement(); } } /* namespace DDSurfaces */ diff --git a/DDSurfaces/src/ZPlanarSurface.cpp b/DDSurfaces/src/ZPlanarSurface.cpp index 0b5a4513f42ed6904bbdf7cc1e0f72f2c8b1d15e..4fbe8547518777e24794359a7e4bfb16b27f3cd1 100644 --- a/DDSurfaces/src/ZPlanarSurface.cpp +++ b/DDSurfaces/src/ZPlanarSurface.cpp @@ -34,7 +34,7 @@ Vector3D ZPlanarSurface::getNormal(const Vector3D& point) const { /// Access to the measurement directions at the given point Measurement ZPlanarSurface::measurement(const Vector3D& point) const { // TODO - return Vector3D(); + return Measurement(); } } /* namespace DDSurfaces */