From 037d938147d14afdf1e0c2c545862a896397e821 Mon Sep 17 00:00:00 2001 From: buzinsky Date: Mon, 7 Jan 2019 10:17:06 -0500 Subject: [PATCH] Update to Kassiopeia 3.6.1 --- .gitignore | 29 +- CMakeLists.txt | 4 +- KEMField/CMakeLists.txt | 63 +- .../{ => 2.0}/Math/include/KEMThreeMatrix.hh | 15 + .../AspectRatioFromKbdROOT.cc | 54 +- .../{ => Calculation}/CMakeLists.txt | 91 +-- .../CompareFieldsAndPotentialsROOT.cc | 16 +- .../ComputeChargeDensities.cc | 24 - .../ComputeChargeDensitiesFromElcd33File.cc | 0 .../ComputeSphericalCapacitor.cc | 14 +- .../DistanceRatioFromKbdROOT.cc | 24 +- .../Test}/CMakeLists.txt | 139 ++--- .../Test}/TestAnisotropicPoisson.cc | 0 .../Test}/TestBinaryTruncation.cc | 0 .../Test}/TestCubatureSpeedStandAlone.cc | 4 +- .../Test}/TestCubeCapacitance.cc | 4 +- .../Test}/TestDielectrics.cc | 149 +++-- .../Test}/TestDiskCapacitance.cc | 3 +- .../Test}/TestEMFileInterface.cc | 6 +- .../Test}/TestElectromagnetViewer.cc | 2 +- .../Test}/TestElectromagnets.cc | 14 +- .../Test}/TestGeometry.cc | 10 +- .../TestIntegratorDistRatioLineSegmentROOT.cc | 66 +-- .../TestIntegratorDistRatioRectangleROOT.cc | 74 +-- .../TestIntegratorDistRatioTriangleROOT.cc | 74 +-- .../Test}/TestIntegratorFunctionality.cc | 37 +- .../TestIntegratorFunctionalityOpenCL.cc | 21 +- .../TestIntegratorLineSegmentROOTOpenCL.cc | 24 +- .../Test}/TestIntegratorRWG.cc | 61 +- .../Test}/TestIntegratorRWGAccuracy.cc | 51 +- .../TestIntegratorRectangleROOTOpenCL.cc | 28 +- .../Test}/TestIntegratorSpeed.cc | 37 +- .../Test}/TestIntegratorSpeedWithKbdInput.cc | 8 +- .../Test}/TestIntegratorTriangleROOTOpenCL.cc | 28 +- .../Test}/TestInverseDistance.cc | 0 .../Test}/TestKMessageInterface.cc | 0 .../{Tests => Applications/Test}/TestKSP1.cc | 0 .../{Tests => Applications/Test}/TestKSP2.cc | 0 .../Test}/TestOpenCL.cc | 0 .../Test}/TestOpenCLPlugin.cc | 4 +- .../{Tests => Applications/Test}/TestPETSc.cc | 0 .../Test}/TestPETSc1.cc | 0 .../Test}/TestPETSc2.cc | 0 .../Test}/TestSVDSolver.cc | 0 .../Test}/TestSphereCapacitance.cc | 2 +- .../Test}/TestSuperposition.cc | 4 +- .../Test}/TestSymmetryGroups.cc | 10 +- .../Test}/TestTriangles.cc | 4 +- .../Test}/TestTypelists.cc | 0 .../Test}/TestVectorTypes.cc | 33 +- .../Test}/TestVisitor.cc | 12 +- .../Test}/TestZonalHarmonics.cc | 30 +- ...KElectrostaticBoundaryIntegratorOptions.hh | 6 +- .../include/TestCubatureTriangleIntegrator.hh | 0 .../include/TestRWGTriangleIntegrator.hh | 0 .../{ => Tools}/ApplicationFiles/.gitignore | 0 .../Source/Applications/Tools/CMakeLists.txt | 119 ++++ .../{ => Tools}/HashEMGeometry.cc | 0 .../Applications/{ => Tools}/InspectEMFile.cc | 0 .../Applications/{ => Tools}/KdbConverter.cc | 0 .../{ => Tools}/TransferEMElement.cc | 0 .../{ => Tools}/VisualizeEMGeometry.cc | 0 .../{ => Tools}/WriteAsciiToPCD.cc | 0 .../{ => Tools}/WriteKbdToAscii.cc | 1 + .../{ => Tools}/greedy_projection.cpp | 0 .../{Plugins => }/Bindings/CMakeLists.txt | 26 +- .../KCachedChargeDensitySolverBuilder.hh | 6 +- ...ticBoundaryIntegratorAttributeProcessor.hh | 8 +- ...ositionCachedChargeDensitySolverBuilder.hh | 6 +- ...itSuperpositionSolutionComponentBuilder.hh | 6 +- .../KFMElectrostaticParametersBuilder.hh | 6 +- .../KFastMultipoleMatrixGeneratorBuilder.hh | 9 +- ...anEliminationChargeDensitySolverBuilder.hh | 10 +- .../KKrylovChargeDensitySolverBuilder.hh | 13 +- .../KKrylovChargeDensitySolverOldBuilder.hh | 8 +- .../KKrylovPreconditionerGeneratorBuilder.hh | 10 +- .../KKrylovSolverConfigurationReader.hh | 8 +- .../KRobinHoodChargeDensitySolverBuilder.hh | 8 +- .../src/KCachedChargeDensitySolverBuilder.cc | 7 +- ...ositionCachedChargeDensitySolverBuilder.cc | 1 + ...itSuperpositionSolutionComponentBuilder.cc | 0 .../src/KFMElectrostaticParametersBuilder.cc | 0 .../KFastMultipoleMatrixGeneratorBuilder.cc | 0 ...anEliminationChargeDensitySolverBuilder.cc | 1 + .../src/KKrylovChargeDensitySolverBuilder.cc | 1 + .../KKrylovChargeDensitySolverOldBuilder.cc | 3 +- .../KKrylovPreconditionerGeneratorBuilder.cc | 1 + .../KRobinHoodChargeDensitySolverBuilder.cc | 3 +- ...ElectricFastMultipoleFieldSolverBuilder.hh | 6 +- .../include/KElectricZHFieldSolverBuilder.hh | 8 +- .../KFMVTKElectrostaticTreeViewerBuilder.hh | 6 +- ...egratingElectrostaticFieldSolverBuilder.hh | 8 +- ...ElectricFastMultipoleFieldSolverBuilder.cc | 1 + .../src/KElectricZHFieldSolverBuilder.cc | 1 + .../KFMVTKElectrostaticTreeViewerBuilder.cc | 1 + ...egratingElectrostaticFieldSolverBuilder.cc | 1 + ...egratingMagnetostaticFieldSolverBuilder.hh | 20 + ...HarmonicMagnetostaticFieldSolverBuilder.hh | 6 +- ...egratingMagnetostaticFieldSolverBuilder.cc | 1 + ...HarmonicMagnetostaticFieldSolverBuilder.cc | 1 + .../KBoundaryElementInfoDisplayBuilder.hh | 6 +- .../KElectricQuadrupoleFieldBuilder.hh | 6 +- .../KElectrostaticBoundaryFieldBuilder.hh | 29 +- ...KElectrostaticBoundaryFieldTimerBuilder.hh | 6 +- .../KElectrostaticConstantFieldBuilder.hh | 0 .../KElectrostaticPotentialmapBuilder.hh | 13 +- .../KInducedAzimuthalElectricFieldBuilder.hh | 8 +- .../include/KRampedElectric2FieldBuilder.hh | 6 +- .../include/KRampedElectricFieldBuilder.hh | 6 +- .../include/KVTKViewerVisitorBuilder.hh | 6 +- .../src/KBoundaryElementInfoDisplayBuilder.cc | 0 .../src/KElectricQuadrupoleFieldBuilder.cc | 0 .../src/KElectrostaticBoundaryFieldBuilder.cc | 3 +- ...KElectrostaticBoundaryFieldTimerBuilder.cc | 1 + .../src/KElectrostaticConstantFieldBuilder.cc | 1 + .../src/KElectrostaticPotentialmapBuilder.cc | 5 +- .../KInducedAzimuthalElectricFieldBuilder.cc | 1 + .../src/KRampedElectric2FieldBuilder.cc | 1 + .../src/KRampedElectricFieldBuilder.cc | 1 + .../Electric/src/KVTKViewerVisitorBuilder.cc | 1 + .../include/KMagneticDipoleFieldBuilder.hh | 6 +- .../KMagneticSuperpositionFieldBuilder.hh | 6 +- .../KMagnetostaticConstantFieldBuilder.hh | 6 +- .../include/KMagnetostaticFieldmapBuilder.hh | 17 +- .../include/KRampedMagneticFieldBuilder.hh | 8 +- .../KStaticElectromagnetFieldBuilder.hh | 12 +- .../src/KMagneticDipoleFieldBuilder.cc | 1 + .../src/KMagneticSuperpositionFieldBuilder.cc | 0 .../src/KMagnetostaticConstantFieldBuilder.cc | 1 + .../src/KMagnetostaticFieldmapBuilder.cc | 3 +- .../src/KRampedMagneticFieldBuilder.cc | 1 + .../src/KStaticElectromagnetFieldBuilder.cc | 3 +- .../KGeoBag/include/KGBEMBuilder.hh | 1 - .../KGeoBag/include/KGElectromagnetBuilder.hh | 0 .../KGeoBag/src/KGBEMBuilder.cc | 1 + .../KGeoBag/src/KGElectromagnetBuilder.cc | 0 .../Utilities/include/KEMBindingsMessage.hh | 0 .../Bindings/Utilities/include/KEMToolbox.hh | 0 .../Utilities/include/KEMToolboxBuilder.hh | 0 .../Utilities/include/KEMToolboxHelper.hh | 8 +- .../Utilities/include/KSmartPointerRelease.hh | 6 +- .../Utilities/src/KEMBindingsMessage.cc | 0 .../Bindings/Utilities/src/KEMToolbox.cc | 0 .../Utilities/src/KEMToolboxBuilder.cc | 4 + .../Core/include/KBoundaryMatrixGenerator.hh | 6 +- ...trostaticAnalyticConicSectionIntegrator.hh | 2 +- ...ctrostaticAnalyticLineSegmentIntegrator.hh | 2 +- ...lectrostaticAnalyticRectangleIntegrator.hh | 2 +- .../KElectrostaticAnalyticRingIntegrator.hh | 2 +- ...ElectrostaticAnalyticTriangleIntegrator.hh | 2 +- ...trostaticAnalyticConicSectionIntegrator.cc | 4 +- ...ctrostaticAnalyticLineSegmentIntegrator.cc | 2 +- ...lectrostaticAnalyticRectangleIntegrator.cc | 10 +- .../KElectrostaticAnalyticRingIntegrator.cc | 4 +- ...ElectrostaticAnalyticTriangleIntegrator.cc | 6 +- .../KElectrostaticBoundaryIntegrator.hh | 59 +- ...KElectrostaticBoundaryIntegratorFactory.hh | 8 +- .../KElectrostaticElementIntegrator.hh | 26 +- .../src/KElectrostaticBoundaryIntegrator.cc | 40 +- ...lectrostaticCubatureRectangleIntegrator.hh | 12 +- ...ElectrostaticCubatureTriangleIntegrator.hh | 12 +- ...rostaticQuadratureLineSegmentIntegrator.hh | 12 +- ...lectrostaticCubatureRectangleIntegrator.cc | 22 +- ...ElectrostaticCubatureTriangleIntegrator.cc | 22 +- ...rostaticQuadratureLineSegmentIntegrator.cc | 22 +- .../KElectrostaticRWGRectangleIntegrator.hh | 12 +- .../KElectrostaticRWGTriangleIntegrator.hh | 12 +- .../KElectrostaticRWGRectangleIntegrator.cc | 40 +- .../KElectrostaticRWGTriangleIntegrator.cc | 42 +- ...c256NodeQuadratureLineSegmentIntegrator.hh | 8 +- ...rostaticBiQuadratureRectangleIntegrator.hh | 8 +- ...trostaticBiQuadratureTriangleIntegrator.hh | 10 +- ...c256NodeQuadratureLineSegmentIntegrator.cc | 18 +- ...rostaticBiQuadratureRectangleIntegrator.cc | 20 +- ...trostaticBiQuadratureTriangleIntegrator.cc | 68 +-- KEMField/Source/Core/CMakeLists.txt | 77 +-- .../Source/Core/include/KEMStringUtils.hh | 6 +- .../Source/Core/include/KMPIEnvironment.hh | 6 +- KEMField/Source/Core/include/KTimer.hh | 6 +- KEMField/Source/Core/src/KEMConstants.cc | 15 - .../Exceptions/include/KEMSimpleException.hh | 6 +- .../Electromagnets/include/KCoilIntegrator.hh | 4 +- .../Electromagnets/include/KCurrentLoop.hh | 3 +- .../include/KCurrentLoopIntegrator.hh | 4 +- .../KElectromagnetIntegratingFieldSolver.hh | 23 +- .../include/KLineCurrentIntegrator.hh | 4 +- .../include/KSolenoidIntegrator.hh | 4 +- .../Electromagnets/src/KCoilIntegrator.cc | 8 +- .../src/KCurrentLoopIntegrator.cc | 8 +- .../src/KLineCurrentIntegrator.cc | 12 +- .../Electromagnets/src/KSolenoidIntegrator.cc | 8 +- .../AccuracyComparisonFastMultipole.cc | 32 +- .../FastMultipole/Applications/CMakeLists.txt | 82 +-- .../Applications/CompareChargeDensities.cc | 4 +- .../Applications/TestFastMultipoleDualTree.cc | 18 +- .../Electrostatics/CMakeLists.txt | 4 +- .../include/KFMElectrostaticParameters.hh | 2 +- .../BoundaryIntegrals/CMakeLists.txt | 4 +- .../KFMElectrostaticBoundaryIntegrator.hh | 4 +- .../KFMElectrostaticBoundaryIntegrator_MPI.hh | 2 +- .../KFMTreeSurfaceOrderingPredicate.hh | 4 +- .../src/KFMElementAspectRatioExtractor.cc | 3 +- .../src/KFMSurfaceToPointCloudConverter.cc | 3 +- ...FMElectrostaticFastMultipoleFieldSolver.hh | 2 +- ...ticFastMultipoleMultipleTreeFieldSolver.hh | 8 +- ...FMElectrostaticFastMultipoleFieldSolver.cc | 6 +- ...ticFastMultipoleMultipleTreeFieldSolver.cc | 10 +- .../FastMultipole/Math/include/KFMPoint.hh | 10 +- .../Source/FastMultipole/Test/CMakeLists.txt | 71 +-- .../Test/TestFastMultipoleDualTree.cc | 18 +- .../Test/TestFastMultipoleFieldMap.cc | 30 +- .../Test/TestFastMultipoleFieldSolver.cc | 30 +- .../Test/TestFastMultipoleTranslation.cc | 17 +- .../Test/TestMultilevelPreconditioners.cc | 30 +- .../Test/TestMultipoleCalculators.cc | 37 +- .../Test/TestMultipoleExpansionSpeed.cc | 2 +- .../TestSingleTriangleMultipoleExpansion.cc | 2 +- .../FastMultipole/Test/TestVectorMath.cc | 25 +- .../Source/FastMultipole/Tree/CMakeLists.txt | 4 +- .../KFMScalarMomentLocalToLocalConverter.hh | 1 - .../KFMScalarMomentRemoteToLocalConverter.hh | 3 - .../FastMultipole/Utility/CMakeLists.txt | 10 +- .../KFMElectrostaticMatrixGenerator.hh | 6 +- .../Utility/include/KFMElectrostaticTypes.hh | 6 +- .../include/KFastMultipoleMatrixGenerator.hh | 6 +- .../KElectrostaticIntegratingFieldSolver.hh | 74 +-- .../KElectromagnetZonalHarmonicFieldSolver.hh | 33 +- .../KElectrostaticZonalHarmonicFieldSolver.hh | 21 +- .../KElectromagnetZonalHarmonicFieldSolver.cc | 64 +- .../KElectrostaticZonalHarmonicFieldSolver.cc | 16 +- .../Source/IO/FileManipulation/CMakeLists.txt | 2 +- .../Source/IO/HashGenerator/CMakeLists.txt | 2 +- .../IO/StructuredASCII/src/KSAFileReader.cc | 22 +- .../KElectrostaticBoundaryIntegratorPolicy.hh | 6 +- .../Electric/CMakeLists.txt | 72 +-- .../include/KCachedChargeDensitySolver.hh | 6 +- .../Electric/include/KChargeDensitySolver.hh | 9 +- ...tSuperpositionCachedChargeDensitySolver.hh | 6 +- ...KExplicitSuperpositionSolutionComponent.hh | 6 +- ...KGaussianEliminationChargeDensitySolver.hh | 6 +- .../include/KKrylovChargeDensitySolver.hh | 6 +- .../include/KKrylovChargeDensitySolverOld.hh | 6 +- .../include/KKrylovPreconditionerGenerator.hh | 6 +- .../include/KRobinHoodChargeDensitySolver.hh | 6 +- .../test/KChargeDensitySolver_test.cc | 1 + .../FieldSolvers/Electric/CMakeLists.txt | 12 +- .../KElectricFastMultipoleFieldSolver.hh | 8 +- .../Electric/include/KElectricFieldSolver.hh | 20 +- .../include/KElectricZHFieldSolver.hh | 10 +- .../KIntegratingElectrostaticFieldSolver.hh | 8 +- .../src/KElectricFastMultipoleFieldSolver.cc | 2 +- .../Electric/src/KElectricZHFieldSolver.cc | 4 +- .../KIntegratingElectrostaticFieldSolver.cc | 2 +- .../KIntegratingMagnetostaticFieldSolver.hh | 10 +- .../Magnetic/include/KMagneticFieldSolver.hh | 22 +- .../KZonalHarmonicMagnetostaticFieldSolver.hh | 12 +- .../KIntegratingMagnetostaticFieldSolver.cc | 4 +- .../KZonalHarmonicMagnetostaticFieldSolver.cc | 6 +- .../include/KBoundaryElementInfoDisplay.hh | 6 +- .../Fields/Electric/include/KElectricField.hh | 15 +- .../include/KElectricQuadrupoleField.hh | 8 +- .../include/KElectrostaticBoundaryField.hh | 10 +- .../KElectrostaticBoundaryFieldTimer.hh | 6 +- .../include/KElectrostaticConstantField.hh | 10 +- .../Electric/include/KElectrostaticField.hh | 14 +- .../include/KInducedAzimuthalElectricField.hh | 8 +- .../Electric/include/KRampedElectric2Field.hh | 8 +- .../Electric/include/KRampedElectricField.hh | 8 +- .../Electric/src/KElectricQuadrupoleField.cc | 2 +- .../src/KElectrostaticBoundaryField.cc | 4 +- .../src/KInducedAzimuthalElectricField.cc | 10 +- .../Electric/src/KRampedElectric2Field.cc | 6 +- .../Electric/src/KRampedElectricField.cc | 4 +- .../Magnetic/include/KMagneticDipoleField.hh | 10 +- .../Fields/Magnetic/include/KMagneticField.hh | 20 +- .../include/KMagneticSuperpositionField.hh | 22 +- .../include/KMagnetostaticConstantField.hh | 20 +- .../Magnetic/include/KMagnetostaticField.hh | 26 +- .../Magnetic/include/KRampedMagneticField.hh | 10 +- .../include/KStaticElectromagnetField.hh | 12 +- .../Magnetic/src/KMagneticDipoleField.cc | 8 +- .../src/KMagneticSuperpositionField.cc | 28 +- .../Magnetic/src/KRampedMagneticField.cc | 8 +- .../Magnetic/src/KStaticElectromagnetField.cc | 6 +- .../Source/Interface/KGeoBag/CMakeLists.txt | 36 ++ .../KGeoBag/include/KGBEM.hh | 2 +- .../KGeoBag/include/KGBEMConverter.hh | 11 +- .../KGeoBag/include/KGElectromagnet.hh | 2 +- .../include/KGElectromagnetConverter.hh | 12 +- .../include/KGElectrostaticBoundaryField.hh} | 19 +- .../include/KGStaticElectromagnetField.hh} | 21 +- .../KGeoBag/src/KGBEM.cc | 0 .../KGeoBag/src/KGBEMConverter.cc | 20 +- .../KGeoBag/src/KGElectromagnet.cc | 0 .../KGeoBag/src/KGElectromagnetConverter.cc | 14 +- .../src/KGElectrostaticBoundaryField.cc} | 53 +- .../src/KGStaticElectromagnetField.cc} | 39 +- .../include/KMatrixPreconditioner.hh | 6 +- .../LinearAlgebra/Solvers/CMakeLists.txt | 4 +- .../include/KKrylovSolverConfiguration.hh | 6 +- .../Solvers/include/KKrylovSolverFactory.hh | 6 +- .../include/KSimpleIterativeKrylovSolver.hh | 6 +- .../Visitors/include/KIterativeSolverTimer.hh | 8 +- .../Math/Array/include/KFMArrayOperator.hh | 4 +- KEMField/Source/Math/CMakeLists.txt | 14 +- .../Source/Math/VectorMath/CMakeLists.txt | 2 +- .../VectorMath/include/KVMSpaceLineSegment.hh | 8 +- .../VectorMath/include/KVMSpaceRectangle.hh | 8 +- .../VectorMath/include/KVMSpaceTriangle.hh | 10 +- .../Math/include/KEMCoordinateSystem.hh | 8 +- .../Math/include/KEMStreamableThreeVector.hh | 9 +- .../Source/Math/include/KEMThreeVector.hh | 466 --------------- .../Source/Math/include/KEMTransformation.hh | 2 +- .../Math/include/KThreeMatrix_KEMField.hh | 82 +++ .../Math/include/KThreeVector_KEMField.hh | 130 +++++ .../Source/Math/src/KEMCoordinateSystem.cc | 12 +- KEMField/Source/Math/src/KEMThreeMatrix.cc | 27 - KEMField/Source/Math/src/KEMThreeVector.cc | 21 - ...egratingMagnetostaticFieldSolverBuilder.hh | 20 - .../Source/Plugins/KGeoBag/CMakeLists.txt | 55 -- .../KGeoBag/include/KEMVectorConverters.hh | 45 -- ...kEMField_ElectrostaticBoundaryIntegrals.cl | 29 +- .../KOpenCLElectrostaticBoundaryIntegrator.hh | 31 +- ...CLElectrostaticBoundaryIntegratorConfig.hh | 6 +- ...LElectrostaticBoundaryIntegratorFactory.hh | 6 +- ...d_ElectrostaticNumericBoundaryIntegrals.cl | 17 +- ...LElectrostaticNumericBoundaryIntegrator.hh | 29 +- ...Field_ElectrostaticRWGBoundaryIntegrals.cl | 29 +- ...penCLElectrostaticRWGBoundaryIntegrator.hh | 31 +- KEMField/Source/Plugins/OpenCL/CMakeLists.txt | 156 +++-- ...rostaticFastMultipoleFieldSolver_OpenCL.hh | 2 +- ...rostaticFastMultipoleFieldSolver_OpenCL.cc | 4 +- ...enCLElectrostaticIntegratingFieldSolver.hh | 40 +- .../cl/kEMField_RobinHood_kernel.cl | 26 +- .../include/KRobinHood_MPI_OpenCL.hh | 18 +- .../include/KRobinHood_OpenCL.hh | 18 +- .../OpenCL/Surfaces/cl/kEMField_SolidAngle.cl | 2 +- KEMField/Source/Plugins/PETSc/CMakeLists.txt | 15 +- KEMField/Source/Plugins/Root/CMakeLists.txt | 9 +- .../include/KEMElectricFieldPointsRootFile.hh | 3 +- KEMField/Source/Plugins/VTK/CMakeLists.txt | 6 +- .../Plugins/VTK/include/KEMVTKViewer.hh | 62 +- .../include/KFMVTKElectrostaticTreeViewer.hh | 3 +- .../Source/Plugins/VTKPart2/CMakeLists.txt | 24 +- .../include/KElectrostaticPotentialmap.hh | 22 +- .../include/KMagnetostaticFieldmap.hh | 25 +- .../KVTKViewerAsBoundaryFieldVisitor.hh | 6 +- .../src/KElectrostaticPotentialmap.cc | 35 +- .../VTKPart2/src/KMagnetostaticFieldmap.cc | 60 +- KEMField/Source/Surfaces/CMakeLists.txt | 4 +- .../Source/Surfaces/include/KConicSection.hh | 5 +- .../Surfaces/include/KElectromagneticBasis.hh | 2 +- .../Surfaces/include/KElectrostaticBasis.hh | 2 +- .../Source/Surfaces/include/KLineSegment.hh | 5 +- .../Surfaces/include/KMagnetostaticBasis.hh | 2 +- .../include/KOrderedSurfaceContainer.hh | 4 +- .../Source/Surfaces/include/KRectangle.hh | 5 +- KEMField/Source/Surfaces/include/KRing.hh | 5 +- KEMField/Source/Surfaces/include/KShape.hh | 2 +- .../Source/Surfaces/include/KSolidAngle.hh | 9 +- .../include/KSortedSurfaceContainer.hh | 2 +- KEMField/Source/Surfaces/include/KSurface.hh | 8 +- .../Source/Surfaces/include/KSurfaceAction.hh | 5 +- .../Surfaces/include/KSurfaceContainer.hh | 2 +- .../include/KSurfaceOrderingPredicate.hh | 4 +- .../Source/Surfaces/include/KSurfaceTypes.hh | 22 +- .../Surfaces/include/KSurfaceVisitors.hh | 3 +- .../Source/Surfaces/include/KSymmetryGroup.hh | 10 +- KEMField/Source/Surfaces/include/KTriangle.hh | 5 +- KEMField/Source/Surfaces/src/KConicSection.cc | 2 +- KEMField/Source/Surfaces/src/KLineSegment.cc | 2 +- .../Surfaces/src/KOrderedSurfaceContainer.cc | 2 +- KEMField/Source/Surfaces/src/KRectangle.cc | 2 +- KEMField/Source/Surfaces/src/KRing.cc | 4 +- .../Surfaces/src/KSortedSurfaceContainer.cc | 2 +- KEMField/Source/Surfaces/src/KSurface.cc | 2 +- .../Source/Surfaces/src/KSurfaceContainer.cc | 2 +- KEMField/Source/Surfaces/src/KTriangle.cc | 5 +- KEMField/Source/XML/CMakeLists.txt | 12 +- .../Complete/ElectricFieldDiscreteAxial.xml | 93 +++ .../Source/XML/Complete/ElectricFields.xml | 2 +- .../Source/XML/Complete/MagneticFields.xml | 2 +- KEMField/data/CMakeLists.txt | 2 +- KGeoBag/CMakeLists.txt | 2 +- KGeoBag/Source/Bindings/CMakeLists.txt | 8 + .../Core/Include/KGInterfaceBuilder.hh | 4 +- .../Shapes/Complex/Include/KGBeamBuilder.hh | 4 +- .../Complex/Include/KGCircleWireBuilder.hh | 98 ++++ .../Include/KGCircularWirePinsBuilder.hh | 117 ++++ .../Include/KGComplexAnnulusBuilder.hh | 2 +- .../Include/KGConicSectPortHousingBuilder.hh | 4 +- .../Include/KGConicalWireArrayBuilder.hh | 4 +- .../Include/KGExtrudedObjectBuilder.hh | 4 +- .../Include/KGLinearWireGridBuilder.hh | 111 ++++ .../Complex/Include/KGPortHousingBuilder.hh | 4 +- .../Include/KGQuadraticWireGridBuilder.hh | 106 ++++ .../Shapes/Complex/Include/KGRodBuilder.hh | 4 +- .../Complex/Include/KGRotatedObjectBuilder.hh | 4 +- .../Complex/Source/KGCircleWireBuilder.cc | 29 + .../Source/KGCircularWirePinsBuilder.cc | 33 ++ .../Complex/Source/KGLinearWireGridBuilder.cc | 32 + .../Source/KGQuadraticWireGridBuilder.cc | 31 + KGeoBag/Source/Core/CMakeLists.txt | 2 + KGeoBag/Source/Core/Include/KGArea.hh | 8 +- KGeoBag/Source/Core/Include/KGBoundary.hh | 35 ++ KGeoBag/Source/Core/Include/KGSpace.hh | 6 +- KGeoBag/Source/Core/Include/KGSurface.hh | 6 +- KGeoBag/Source/Core/Include/KGVolume.hh | 3 +- KGeoBag/Source/Core/Source/KGArea.cc | 3 +- KGeoBag/Source/Core/Source/KGBoundary.cc | 21 + KGeoBag/Source/Core/Source/KGSpace.cc | 24 +- KGeoBag/Source/Core/Source/KGSurface.cc | 14 +- .../Deformation/Include/KGDeformed.hh | 6 +- .../Deformation/Include/KGMeshDeformer.hh | 2 +- .../Deformation/Source/KGDeformed.cc | 4 +- .../DiscreteRotationalMesh/CMakeLists.txt | 1 + ...onicalWireArrayDiscreteRotationalMesher.hh | 5 +- ...onicalWireArrayDiscreteRotationalMesher.cc | 48 +- .../Include/KGDiscreteRotationalAreaMesher.hh | 29 + .../Include/KGDiscreteRotationalMesher.hh | 23 +- .../Include/KGDiscreteRotationalMesherBase.hh | 8 +- .../Source/KGDiscreteRotationalMesher.cc | 97 +-- .../Source/KGDiscreteRotationalMesherBase.cc | 9 +- KGeoBag/Source/Extensions/Mesh/CMakeLists.txt | 8 + .../Complex/Include/KGCircleWireMesher.hh | 32 + .../Include/KGCircularWirePinsMesher.hh | 31 + .../KGConicSectPortHousingSurfaceMesher.hh | 2 +- .../Complex/Include/KGLinearWireGridMesher.hh | 32 + .../Include/KGPortHousingSurfaceMesher.hh | 2 +- .../Include/KGQuadraticWireGridMesher.hh | 32 + .../Complex/Source/KGBeamSurfaceMesher.cc | 2 +- .../Mesh/Complex/Source/KGCircleWireMesher.cc | 38 ++ .../Source/KGCircularWirePinsMesher.cc | 57 ++ .../KGConicSectPortHousingSurfaceMesher.cc | 4 - .../Source/KGConicalWireArrayMesher.cc | 41 +- .../Complex/Source/KGLinearWireGridMesher.cc | 141 +++++ .../Source/KGQuadraticWireGridMesher.cc | 220 +++++++ .../Mesh/Complex/Source/KGRodSurfaceMesher.cc | 2 +- .../Complex/Source/KGRotatedSurfaceMesher.cc | 2 +- .../Extensions/Mesh/Include/KGMesher.hh | 12 + .../Source/KGRotatedArcSegmentSpaceMesher.cc | 4 +- .../Source/KGRotatedLineSegmentSpaceMesher.cc | 4 +- .../Source/KGRotatedPolyLineSpaceMesher.cc | 4 +- .../Extensions/Mesh/Source/KGMeshWire.cc | 2 +- .../Random/Source/KGCutConeSurfaceRandom.cc | 5 +- .../Random/Source/KGCylinderSurfaceRandom.cc | 7 - .../Random/Source/KGRotatedSurfaceRandom.cc | 2 +- .../Source/Math/2DUtility/Source/KG2DArc.cc | 4 - .../Math/2DUtility/Source/KG2DLineSegment.cc | 2 - KGeoBag/Source/Math/Include/KRotation.hh | 6 + KGeoBag/Source/Math/Include/KThreeMatrix.hh | 80 ++- KGeoBag/Source/Math/Include/KThreeVector.hh | 28 +- KGeoBag/Source/Math/Include/KTwoMatrix.hh | 4 +- KGeoBag/Source/Math/Include/KTwoVector.hh | 2 +- KGeoBag/Source/Math/Source/KRotation.cc | 77 ++- KGeoBag/Source/Math/Source/KThreeMatrix.cc | 3 - KGeoBag/Source/Math/Source/KThreeVector.cc | 3 - KGeoBag/Source/Math/Source/KTwoMatrix.cc | 3 - KGeoBag/Source/Math/Source/KTwoVector.cc | 3 - .../Source/Math/SpaceTree/Include/KGPoint.hh | 10 +- KGeoBag/Source/Shapes/CMakeLists.txt | 17 +- .../Source/Shapes/Complex/Include/KGBeam.hh | 3 +- .../Shapes/Complex/Include/KGCircleWire.hh | 73 +++ .../Complex/Include/KGCircleWireSpace.hh | 15 + .../Complex/Include/KGCircleWireSurface.hh | 15 + .../Complex/Include/KGCircularWirePins.hh | 114 ++++ .../Include/KGCircularWirePinsSpace.hh | 15 + .../Include/KGCircularWirePinsSurface.hh | 15 + .../Complex/Include/KGConicSectPortHousing.hh | 3 +- .../Complex/Include/KGConicalWireArray.hh | 4 +- .../Complex/Include/KGExtrudedObject.hh | 4 +- .../Complex/Include/KGLinearWireGrid.hh | 74 +++ .../Complex/Include/KGLinearWireGridSpace.hh | 15 + .../Include/KGLinearWireGridSurface.hh | 15 + .../Shapes/Complex/Include/KGPortHousing.hh | 3 +- .../Complex/Include/KGQuadraticWireGrid.hh | 69 +++ .../Include/KGQuadraticWireGridSpace.hh | 15 + .../Include/KGQuadraticWireGridSurface.hh | 15 + .../Source/Shapes/Complex/Include/KGRod.hh | 4 +- .../Shapes/Complex/Include/KGRotatedObject.hh | 6 +- .../Shapes/Complex/Include/KGWrappedSpace.hh | 17 +- .../Complex/Include/KGWrappedSurface.hh | 18 +- .../Shapes/Complex/Source/KGCircleWire.cc | 54 ++ .../Complex/Source/KGCircularWirePins.cc | 58 ++ .../Source/KGConicSectPortHousingSpace.cc | 43 +- .../Complex/Source/KGConicalWireArray.cc | 4 - .../Shapes/Complex/Source/KGLinearWireGrid.cc | 57 ++ .../Complex/Source/KGPortHousingSpace.cc | 10 +- .../Complex/Source/KGQuadraticWireGrid.cc | 56 ++ .../Shapes/Complex/Source/KGRotatedObject.cc | 4 - .../Shapes/Complex/Source/KGRotatedSpace.cc | 6 +- .../Include/KGExtrudedPathSurface.hh | 10 +- .../Include/KGExtrudedClosedPathSpace.hh | 14 +- .../Include/KGFlattenedClosedPathSurface.hh | 10 +- .../PlanarShapes/Include/KGPlanarPath.hh | 3 - .../Include/KGRotatedPathSurface.hh | 10 +- .../Include/KGRotatedClosedPathSpace.hh | 10 +- .../Include/KGRotatedOpenPathSpace.hh | 23 +- .../ShellAreas/Include/KGShellPathSurface.hh | 10 +- .../TestCylinderDiscretization.cc | 2 +- KGeoBag/Source/Visualization/CMakeLists.txt | 2 +- .../Root/Include/KGROOTGeometryPainter.hh | 4 +- .../Root/Source/KGROOTGeometryPainter.cc | 10 +- .../Vtk/Source/KGVTKDistanceTester.cc | 2 +- .../Vtk/Source/KGVTKMeshIntersectionTester.cc | 2 +- .../Vtk/Source/KGVTKNormalTester.cc | 2 +- .../Vtk/Source/KGVTKOutsideTester.cc | 2 +- .../Vtk/Source/KGVTKPointTester.cc | 2 +- .../Vtk/Source/KGVTKRandomPointTester.cc | 2 +- KGeoBag/Source/XML/Examples/ComplexShapes.xml | 41 ++ .../Source/TrackMagneticTransitionCheck.cxx | 2 +- .../Simulation/Source/Kassiopeia.cxx | 4 +- .../Source/TestZonalHarmonicsConvergence.cxx | 6 +- Kassiopeia/Bindings/CMakeLists.txt | 12 + .../Source/KSFieldKEMFieldObjectsBuilder.cxx | 4 +- .../KSGenSpinRelativeCompositeBuilder.h | 55 ++ .../Source/KSGenGeneratorCompositeBuilder.cxx | 2 + .../KSGenSpinRelativeCompositeBuilder.cxx | 60 ++ .../Include/KSIntCalculatorIonBuilder.h | 14 +- .../Include/KSIntSpinFlipPulseBuilder.h | 32 + .../Include/KSIntSpinRotateYPulseBuilder.h | 42 ++ .../Include/KSIntSurfaceUCNBuilder.h | 18 +- .../Source/KSIntSpinFlipPulseBuilder.cxx | 22 + .../Source/KSIntSpinRotateYPulseBuilder.cxx | 24 + .../Source/KSIntSurfaceUCNBuilder.cxx | 6 +- .../Include/KSTermMaxStepTimeBuilder.h | 31 + .../Include/KSTermMaxTotalTimeBuilder.h | 31 + .../Source/KSTermMaxStepTimeBuilder.cxx | 22 + .../Source/KSTermMaxTotalTimeBuilder.cxx | 22 + .../Source/KSTermTrappedBuilder.cxx | 2 +- .../KSWriteROOTConditionPeriodicBuilder.h | 255 ++++++++ .../KSWriteROOTConditionPeriodicBuilder.cxx | 30 + Kassiopeia/CMakeLists.txt | 6 +- .../Fields/Source/KSElectricKEMField.cxx | 11 +- Kassiopeia/Fields/Source/KSExampleFields.cxx | 5 +- .../Fields/Source/KSMagneticKEMField.cxx | 14 +- Kassiopeia/Generators/CMakeLists.txt | 2 + .../Include/KSGenSpinRelativeComposite.h | 40 ++ .../Source/KSGenPositionMeshSurfaceRandom.cxx | 4 + .../Generators/Source/KSGenSpinComposite.cxx | 12 +- .../Source/KSGenSpinRelativeComposite.cxx | 160 +++++ .../Source/KSGenValueAngleCosine.cxx | 14 +- Kassiopeia/Interactions/CMakeLists.txt | 4 + .../Interactions/Include/KSIntCalculatorIon.h | 13 +- .../Interactions/Include/KSIntSpinFlipPulse.h | 62 ++ .../Include/KSIntSpinRotateYPulse.h | 66 +++ .../Interactions/Include/KSIntSurfaceUCN.h | 16 +- .../Source/KSIntCalculatorArgon.cxx | 2 +- .../Source/KSIntCalculatorIon.cxx | 550 ++++++++++++------ .../Source/KSIntCalculatorTritium.cxx | 4 +- .../Interactions/Source/KSIntSpinFlip.cxx | 21 - .../Source/KSIntSpinFlipPulse.cxx | 91 +++ .../Source/KSIntSpinRotateYPulse.cxx | 116 ++++ .../Interactions/Source/KSIntSurfaceUCN.cxx | 93 ++- Kassiopeia/Navigators/CMakeLists.txt | 2 +- Kassiopeia/Operators/Include/KSParticle.h | 8 + Kassiopeia/Operators/Source/KSParticle.cxx | 52 +- Kassiopeia/Python/CMakeLists.txt | 4 +- Kassiopeia/Python/KassiopeiaReader.py | 1 + Kassiopeia/Simulation/Include/KSEvent.h | 1 + .../Include/KSRootSurfaceInteraction.h | 1 - Kassiopeia/Simulation/Include/KSRun.h | 1 + Kassiopeia/Simulation/Include/KSStep.h | 1 + Kassiopeia/Simulation/Include/KSTrack.h | 1 + Kassiopeia/Simulation/Source/KSEvent.cxx | 4 + Kassiopeia/Simulation/Source/KSRoot.cxx | 24 + .../Source/KSRootSpaceInteraction.cxx | 12 + .../Source/KSRootSpaceNavigator.cxx | 10 +- .../Simulation/Source/KSRootStepModifier.cxx | 12 + .../Source/KSRootSurfaceInteraction.cxx | 8 + .../Source/KSRootSurfaceNavigator.cxx | 4 + .../Simulation/Source/KSRootTerminator.cxx | 12 + .../Simulation/Source/KSRootTrajectory.cxx | 9 + Kassiopeia/Simulation/Source/KSRun.cxx | 10 +- Kassiopeia/Simulation/Source/KSStep.cxx | 4 + Kassiopeia/Simulation/Source/KSTrack.cxx | 4 + Kassiopeia/Terminators/CMakeLists.txt | 4 + .../Terminators/Include/KSTermMaxStepTime.h | 41 ++ .../Terminators/Include/KSTermMaxTotalTime.h | 40 ++ .../Terminators/Source/KSTermMaxStepTime.cxx | 47 ++ .../Terminators/Source/KSTermMaxTotalTime.cxx | 44 ++ .../Source/KSTrajAdiabaticSpinParticle.cxx | 8 +- .../Source/KSTrajInterpolatorFast.cxx | 2 + .../Source/KSTrajTermPropagation.cxx | 81 +-- Kassiopeia/Writers/CMakeLists.txt | 9 +- .../Include/KSWriteROOTConditionPeriodic.h | 96 +++ Kassiopeia/XML/CMakeLists.txt | 18 +- .../XML/Examples/QuadrupoleTrapSimulation.xml | 38 +- .../TestDiscreteRotationalField.xml | 90 +-- .../XML/Validation/TestElectricFieldLines.xml | 6 +- Kommon/Boost/Utility/KStringUtils.h | 36 +- Kommon/CMakeLists.txt | 12 +- Kommon/Core/CMakeLists.txt | 5 + Kommon/Core/Initialization/KArgumentList.cxx | 2 +- Kommon/Core/Initialization/KArgumentList.h | 2 +- Kommon/Core/Initialization/KAttributeBase.cc | 4 +- Kommon/Core/Initialization/KElementBase.cc | 12 +- .../Core/Initialization/KIncludeProcessor.cc | 110 ++-- .../Core/Initialization/KIncludeProcessor.hh | 4 +- Kommon/Core/Initialization/KToken.hh | 2 +- Kommon/Core/Initialization/KVariant.cxx | 34 +- Kommon/Core/Initialization/KVariant.h | 37 +- .../Core/Utility/KApplicationRunnerBuilder.h | 2 +- Kommon/Core/Utility/KConst.h | 33 +- Kommon/Core/Utility/KMathIntegrator.h | 46 +- Kommon/Core/Utility/KMathRegulaFalsi.h | 4 +- Kommon/Core/Utility/KNamed.cxx | 17 +- Kommon/Core/Utility/KNamed.h | 40 +- Kommon/Core/Utility/KSmartPointer.h | 2 + Kommon/Core/Utility/PositiveValue.h | 133 +++++ Kommon/Core/Utility/Printable.cxx | 17 + Kommon/Core/Utility/Printable.h | 26 + Kommon/Root/Utility/KROOTPad.cxx | 2 +- Kommon/Root/Utility/KROOTWindow.cxx | 2 +- Kommon/TBB/Utility/KMathIntegratorThreaded.h | 96 ++- Kommon/cmake/FindROOT.cmake | 2 +- Kommon/cmake/FindTBB.cmake | 15 +- Kommon/cmake/KasperDefaults.cmake | 25 +- Kommon/kasperenv.sh | 65 --- ...y.sh => create_kasper_user_directory.sh.in | 0 kasperenv.sh.in | 77 +++ 621 files changed, 8157 insertions(+), 4176 deletions(-) rename KEMField/Source/{ => 2.0}/Math/include/KEMThreeMatrix.hh (97%) rename KEMField/Source/Applications/{ => Calculation}/AspectRatioFromKbdROOT.cc (90%) rename KEMField/Source/Applications/{ => Calculation}/CMakeLists.txt (55%) rename KEMField/Source/Applications/{ => Calculation}/CompareFieldsAndPotentialsROOT.cc (98%) rename KEMField/Source/Applications/{ => Calculation}/ComputeChargeDensities.cc (94%) rename KEMField/Source/Applications/{ => Calculation}/ComputeChargeDensitiesFromElcd33File.cc (100%) rename KEMField/Source/Applications/{ => Calculation}/ComputeSphericalCapacitor.cc (99%) rename KEMField/Source/Applications/{ => Calculation}/DistanceRatioFromKbdROOT.cc (93%) rename KEMField/Source/{Tests => Applications/Test}/CMakeLists.txt (83%) rename KEMField/Source/{Tests => Applications/Test}/TestAnisotropicPoisson.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestBinaryTruncation.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestCubatureSpeedStandAlone.cc (98%) rename KEMField/Source/{Tests => Applications/Test}/TestCubeCapacitance.cc (99%) rename KEMField/Source/{Tests => Applications/Test}/TestDielectrics.cc (93%) rename KEMField/Source/{Tests => Applications/Test}/TestDiskCapacitance.cc (99%) rename KEMField/Source/{Tests => Applications/Test}/TestEMFileInterface.cc (94%) rename KEMField/Source/{Tests => Applications/Test}/TestElectromagnetViewer.cc (96%) rename KEMField/Source/{Tests => Applications/Test}/TestElectromagnets.cc (98%) rename KEMField/Source/{Tests => Applications/Test}/TestGeometry.cc (98%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorDistRatioLineSegmentROOT.cc (92%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorDistRatioRectangleROOT.cc (92%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorDistRatioTriangleROOT.cc (92%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorFunctionality.cc (96%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorFunctionalityOpenCL.cc (97%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorLineSegmentROOTOpenCL.cc (96%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorRWG.cc (80%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorRWGAccuracy.cc (90%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorRectangleROOTOpenCL.cc (95%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorSpeed.cc (89%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorSpeedWithKbdInput.cc (95%) rename KEMField/Source/{Tests => Applications/Test}/TestIntegratorTriangleROOTOpenCL.cc (95%) rename KEMField/Source/{Tests => Applications/Test}/TestInverseDistance.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestKMessageInterface.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestKSP1.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestKSP2.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestOpenCL.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestOpenCLPlugin.cc (98%) rename KEMField/Source/{Tests => Applications/Test}/TestPETSc.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestPETSc1.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestPETSc2.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestSVDSolver.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestSphereCapacitance.cc (99%) rename KEMField/Source/{Tests => Applications/Test}/TestSuperposition.cc (99%) rename KEMField/Source/{Tests => Applications/Test}/TestSymmetryGroups.cc (93%) rename KEMField/Source/{Tests => Applications/Test}/TestTriangles.cc (99%) rename KEMField/Source/{Tests => Applications/Test}/TestTypelists.cc (100%) rename KEMField/Source/{Tests => Applications/Test}/TestVectorTypes.cc (86%) rename KEMField/Source/{Tests => Applications/Test}/TestVisitor.cc (89%) rename KEMField/Source/{Tests => Applications/Test}/TestZonalHarmonics.cc (96%) rename KEMField/Source/{Tests => Applications/Test}/include/KElectrostaticBoundaryIntegratorOptions.hh (80%) rename KEMField/Source/{Tests => Applications/Test}/include/TestCubatureTriangleIntegrator.hh (100%) rename KEMField/Source/{Tests => Applications/Test}/include/TestRWGTriangleIntegrator.hh (100%) rename KEMField/Source/Applications/{ => Tools}/ApplicationFiles/.gitignore (100%) create mode 100644 KEMField/Source/Applications/Tools/CMakeLists.txt rename KEMField/Source/Applications/{ => Tools}/HashEMGeometry.cc (100%) rename KEMField/Source/Applications/{ => Tools}/InspectEMFile.cc (100%) rename KEMField/Source/Applications/{ => Tools}/KdbConverter.cc (100%) rename KEMField/Source/Applications/{ => Tools}/TransferEMElement.cc (100%) rename KEMField/Source/Applications/{ => Tools}/VisualizeEMGeometry.cc (100%) rename KEMField/Source/Applications/{ => Tools}/WriteAsciiToPCD.cc (100%) rename KEMField/Source/Applications/{ => Tools}/WriteKbdToAscii.cc (98%) rename KEMField/Source/Applications/{ => Tools}/greedy_projection.cpp (100%) rename KEMField/Source/{Plugins => }/Bindings/CMakeLists.txt (92%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh (67%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh (83%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh (71%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh (68%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh (90%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh (91%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh (64%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh (75%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh (90%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh (72%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh (89%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh (84%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc (70%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KFMElectrostaticParametersBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KFastMultipoleMatrixGeneratorBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh (88%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh (90%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh (80%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh (68%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc (99%) create mode 100644 KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh (90%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh (61%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh (81%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh (78%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh (61%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KElectrostaticConstantFieldBuilder.hh (100%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh (93%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh (83%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh (91%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh (89%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh (81%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KBoundaryElementInfoDisplayBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KElectricQuadrupoleFieldBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc (90%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc (94%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc (96%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh (77%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh (85%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh (72%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh (91%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh (90%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh (89%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc (99%) rename KEMField/Source/{Plugins => }/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc (89%) rename KEMField/Source/{Plugins => Bindings}/KGeoBag/include/KGBEMBuilder.hh (99%) rename KEMField/Source/{Plugins => Bindings}/KGeoBag/include/KGElectromagnetBuilder.hh (100%) rename KEMField/Source/{Plugins => Bindings}/KGeoBag/src/KGBEMBuilder.cc (99%) rename KEMField/Source/{Plugins => Bindings}/KGeoBag/src/KGElectromagnetBuilder.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/include/KEMBindingsMessage.hh (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/include/KEMToolbox.hh (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/include/KEMToolboxBuilder.hh (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/include/KEMToolboxHelper.hh (73%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/include/KSmartPointerRelease.hh (78%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/src/KEMBindingsMessage.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/src/KEMToolbox.cc (100%) rename KEMField/Source/{Plugins => }/Bindings/Utilities/src/KEMToolboxBuilder.cc (70%) create mode 100644 KEMField/Source/Interface/KGeoBag/CMakeLists.txt rename KEMField/Source/{Plugins => Interface}/KGeoBag/include/KGBEM.hh (98%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/include/KGBEMConverter.hh (97%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/include/KGElectromagnet.hh (97%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/include/KGElectromagnetConverter.hh (87%) rename KEMField/Source/{Plugins/KGeoBag/include/KElectrostaticBoundaryFieldWithKGeoBag.hh => Interface/KGeoBag/include/KGElectrostaticBoundaryField.hh} (65%) rename KEMField/Source/{Plugins/KGeoBag/include/KStaticElectromagnetFieldWithKGeoBag.hh => Interface/KGeoBag/include/KGStaticElectromagnetField.hh} (55%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/src/KGBEM.cc (100%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/src/KGBEMConverter.cc (94%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/src/KGElectromagnet.cc (100%) rename KEMField/Source/{Plugins => Interface}/KGeoBag/src/KGElectromagnetConverter.cc (92%) rename KEMField/Source/{Plugins/KGeoBag/src/KElectrostaticBoundaryFieldWithKGeoBag.cc => Interface/KGeoBag/src/KGElectrostaticBoundaryField.cc} (58%) rename KEMField/Source/{Plugins/KGeoBag/src/KStaticElectromagnetFieldWithKGeoBag.cc => Interface/KGeoBag/src/KGStaticElectromagnetField.cc} (56%) delete mode 100644 KEMField/Source/Math/include/KEMThreeVector.hh create mode 100644 KEMField/Source/Math/include/KThreeMatrix_KEMField.hh create mode 100644 KEMField/Source/Math/include/KThreeVector_KEMField.hh delete mode 100644 KEMField/Source/Math/src/KEMThreeMatrix.cc delete mode 100644 KEMField/Source/Math/src/KEMThreeVector.cc delete mode 100644 KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh delete mode 100644 KEMField/Source/Plugins/KGeoBag/CMakeLists.txt delete mode 100644 KEMField/Source/Plugins/KGeoBag/include/KEMVectorConverters.hh create mode 100644 KEMField/Source/XML/Complete/ElectricFieldDiscreteAxial.xml create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircleWireBuilder.hh create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircularWirePinsBuilder.hh create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Include/KGLinearWireGridBuilder.hh create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Include/KGQuadraticWireGridBuilder.hh create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircleWireBuilder.cc create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircularWirePinsBuilder.cc create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Source/KGLinearWireGridBuilder.cc create mode 100644 KGeoBag/Source/Bindings/Shapes/Complex/Source/KGQuadraticWireGridBuilder.cc create mode 100644 KGeoBag/Source/Core/Include/KGBoundary.hh create mode 100644 KGeoBag/Source/Core/Source/KGBoundary.cc create mode 100644 KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalAreaMesher.hh create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircleWireMesher.hh create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircularWirePinsMesher.hh create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Include/KGLinearWireGridMesher.hh create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Include/KGQuadraticWireGridMesher.hh create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircleWireMesher.cc create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircularWirePinsMesher.cc create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Source/KGLinearWireGridMesher.cc create mode 100644 KGeoBag/Source/Extensions/Mesh/Complex/Source/KGQuadraticWireGridMesher.cc create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircleWire.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSpace.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSurface.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePins.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSpace.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSurface.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGrid.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSpace.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSurface.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGrid.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSpace.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSurface.hh create mode 100644 KGeoBag/Source/Shapes/Complex/Source/KGCircleWire.cc create mode 100644 KGeoBag/Source/Shapes/Complex/Source/KGCircularWirePins.cc create mode 100644 KGeoBag/Source/Shapes/Complex/Source/KGLinearWireGrid.cc create mode 100644 KGeoBag/Source/Shapes/Complex/Source/KGQuadraticWireGrid.cc create mode 100644 Kassiopeia/Bindings/Generators/Include/KSGenSpinRelativeCompositeBuilder.h create mode 100644 Kassiopeia/Bindings/Generators/Source/KSGenSpinRelativeCompositeBuilder.cxx create mode 100644 Kassiopeia/Bindings/Interactions/Include/KSIntSpinFlipPulseBuilder.h create mode 100644 Kassiopeia/Bindings/Interactions/Include/KSIntSpinRotateYPulseBuilder.h create mode 100644 Kassiopeia/Bindings/Interactions/Source/KSIntSpinFlipPulseBuilder.cxx create mode 100644 Kassiopeia/Bindings/Interactions/Source/KSIntSpinRotateYPulseBuilder.cxx create mode 100644 Kassiopeia/Bindings/Terminators/Include/KSTermMaxStepTimeBuilder.h create mode 100644 Kassiopeia/Bindings/Terminators/Include/KSTermMaxTotalTimeBuilder.h create mode 100644 Kassiopeia/Bindings/Terminators/Source/KSTermMaxStepTimeBuilder.cxx create mode 100644 Kassiopeia/Bindings/Terminators/Source/KSTermMaxTotalTimeBuilder.cxx create mode 100644 Kassiopeia/Bindings/Writers/Include/KSWriteROOTConditionPeriodicBuilder.h create mode 100644 Kassiopeia/Bindings/Writers/Source/KSWriteROOTConditionPeriodicBuilder.cxx create mode 100644 Kassiopeia/Generators/Include/KSGenSpinRelativeComposite.h create mode 100644 Kassiopeia/Generators/Source/KSGenSpinRelativeComposite.cxx create mode 100644 Kassiopeia/Interactions/Include/KSIntSpinFlipPulse.h create mode 100644 Kassiopeia/Interactions/Include/KSIntSpinRotateYPulse.h create mode 100644 Kassiopeia/Interactions/Source/KSIntSpinFlipPulse.cxx create mode 100644 Kassiopeia/Interactions/Source/KSIntSpinRotateYPulse.cxx create mode 100644 Kassiopeia/Terminators/Include/KSTermMaxStepTime.h create mode 100644 Kassiopeia/Terminators/Include/KSTermMaxTotalTime.h create mode 100644 Kassiopeia/Terminators/Source/KSTermMaxStepTime.cxx create mode 100644 Kassiopeia/Terminators/Source/KSTermMaxTotalTime.cxx create mode 100644 Kassiopeia/Writers/Include/KSWriteROOTConditionPeriodic.h create mode 100644 Kommon/Core/Utility/PositiveValue.h create mode 100644 Kommon/Core/Utility/Printable.cxx create mode 100644 Kommon/Core/Utility/Printable.h delete mode 100755 Kommon/kasperenv.sh rename Kommon/create_kasper_user_directory.sh => create_kasper_user_directory.sh.in (100%) create mode 100755 kasperenv.sh.in diff --git a/.gitignore b/.gitignore index 971a06926..6f1a5233f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /*install* /*Install* /IndependentKassiopeia/ +/.settings *~ *.bak *.tmp @@ -12,27 +13,27 @@ *.cbp *.cproject *.DS_store +*.DS_Store +*.kdev4* +*.vscode +*.doxygen +*.pc +*.vtp +*.vti +*.pyc +*.creator +*.files +*.includes +*.srctrl* CMakeCache.txt CMakeLists.txt.user CMakeLists.txt.user.* -/.settings CMakeFiles/ -.idea/ -*.kdev4* -home/ CTestTestfile.cmake cmake_install.cmake *Config.cmake *ConfigVersion.cmake *ConfigInstalled.cmake -*.doxygen -*.pc -*.vtp -*.vti -*.pyc +home/ +.idea/ .ipynb_checkpoints/ -*.DS_Store -Kasper.config -Kasper.creator -Kasper.files -Kasper.includes diff --git a/CMakeLists.txt b/CMakeLists.txt index df14b79e5..adb3d8a9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,6 @@ endif() install( EXPORT KasperTargets DESTINATION ${CMAKE_INSTALL_DIR} ) -configure_file( Kommon/kasperenv.sh ${CMAKE_CURRENT_BINARY_DIR}/kasperenv.sh @ONLY ) -configure_file( Kommon/create_kasper_user_directory.sh ${CMAKE_CURRENT_BINARY_DIR}/create_kasper_user_directory.sh @ONLY ) +configure_file( kasperenv.sh.in ${CMAKE_CURRENT_BINARY_DIR}/kasperenv.sh @ONLY ) +configure_file( create_kasper_user_directory.sh.in ${CMAKE_CURRENT_BINARY_DIR}/create_kasper_user_directory.sh @ONLY ) install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/kasperenv.sh ${CMAKE_CURRENT_BINARY_DIR}/create_kasper_user_directory.sh DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/KEMField/CMakeLists.txt b/KEMField/CMakeLists.txt index 868cf5ad4..8c363e411 100644 --- a/KEMField/CMakeLists.txt +++ b/KEMField/CMakeLists.txt @@ -1,48 +1,54 @@ cmake_minimum_required( VERSION ${CMAKE_MINIMUM_VERSION} ) +if(POLICY CMP0053) + cmake_policy(SET CMP0053 NEW) +endif() + # KEMField version set(MODULE_VERSION_MAJOR 3) -set(MODULE_VERSION_MINOR 0) +set(MODULE_VERSION_MINOR 6) set(MODULE_VERSION_PATCH 0) set(MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_PATCH}") -#project(KEMField VERSION ${MODULE_VERSION}) -project(KEMField) - -include(KasperDefaults) +project( KEMField ) -if(POLICY CMP0053) - cmake_policy(SET CMP0053 OLD) -endif() +include( KasperDefaults ) -# paths -kasper_module_paths( KEMField ) +# require c++11 +kasper_require_cpp11() -#set(MODULE_HEADER_DIRS) -#set(MODULE_CFLAGS) -#set(KASPER_INCLUDE_DIRS) -#set(EXTERNAL_INCLUDE_DIRS) +# module options -kasper_find_module(Kommon) - -#option (@PROJECT_NAME@_USE_VTK "Enables the use of VTK for visualization" OFF) -set (@PROJECT_NAME@_USE_VTK ${KASPER_USE_VTK}) -if (@PROJECT_NAME@_USE_VTK) +#option (${PROJECT_NAME}_USE_VTK "Enables the use of VTK for visualization" OFF) +set (${PROJECT_NAME}_USE_VTK ${KASPER_USE_VTK}) +if (${PROJECT_NAME}_USE_VTK) kasper_find_vtk() endif() -#option (@PROJECT_NAME@_USE_ROOT "Link against ROOT" OFF) -set (@PROJECT_NAME@_USE_ROOT ${KASPER_USE_ROOT}) -if (@PROJECT_NAME@_USE_ROOT) +#option (${PROJECT_NAME}_USE_ROOT "Link against ROOT" OFF) +set (${PROJECT_NAME}_USE_ROOT ${KASPER_USE_ROOT}) +if (${PROJECT_NAME}_USE_ROOT) find_package(ROOT REQUIRED) endif() #option (KEMField_USE_GSL "Use GSL" OFF) -set (@PROJECT_NAME@_USE_GSL ${KASPER_USE_GSL}) -if (@PROJECT_NAME@_USE_GSL) +set (${PROJECT_NAME}_USE_GSL ${KASPER_USE_GSL}) +if (${PROJECT_NAME}_USE_GSL) find_package(GSL REQUIRED) endif () +# paths +kasper_module_paths( KEMField ) + +# internal dependencies: kommon +kasper_find_module( Kommon ) +add_cflag (KEMFIELD_USE_KOMMON) + +# internal dependencies: kgeobag +kasper_find_module( KGeoBag ) +add_cflag (KEMFIELD_USE_KGEOBAG) + + # Input files add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/data) @@ -94,12 +100,13 @@ add_subdirectory(${SOURCE}/Interface/FieldSolvers/Electric) add_subdirectory(${SOURCE}/Interface/FieldSolvers/Magnetic) add_subdirectory(${SOURCE}/Interface/Fields/Magnetic) add_subdirectory(${SOURCE}/Interface/Fields/Electric) -add_subdirectory(${SOURCE}/Plugins/KGeoBag) +add_subdirectory(${SOURCE}/Interface/KGeoBag) add_subdirectory(${SOURCE}/Plugins/VTKPart2) -add_subdirectory(${SOURCE}/Plugins/Bindings) +add_subdirectory(${SOURCE}/Bindings) add_subdirectory(${SOURCE}/Plugins/Root) -add_subdirectory(${SOURCE}/Applications) -add_subdirectory(${SOURCE}/Tests) +add_subdirectory(${SOURCE}/Applications/Calculation) +add_subdirectory(${SOURCE}/Applications/Test) +add_subdirectory(${SOURCE}/Applications/Tools) add_subdirectory(${SOURCE}/FastMultipole/Test) add_subdirectory(${SOURCE}/FastMultipole/Applications) add_subdirectory(${SOURCE}/XML) diff --git a/KEMField/Source/Math/include/KEMThreeMatrix.hh b/KEMField/Source/2.0/Math/include/KEMThreeMatrix.hh similarity index 97% rename from KEMField/Source/Math/include/KEMThreeMatrix.hh rename to KEMField/Source/2.0/Math/include/KEMThreeMatrix.hh index 94576bd41..dc0efa3a3 100644 --- a/KEMField/Source/Math/include/KEMThreeMatrix.hh +++ b/KEMField/Source/2.0/Math/include/KEMThreeMatrix.hh @@ -48,6 +48,8 @@ namespace KEMField double& operator()( int aRow, int aColumn ); const double& operator()( int aRow, int aColumn ) const; + void SetComponents( const double* aData ); + //properties KEMThreeMatrix Inverse() const; @@ -195,6 +197,19 @@ namespace KEMField return fData[3 * aRow + aColumn]; } + inline void KEMThreeMatrix::SetComponents( const double* aData ) + { + fData[ 0 ] = aData[ 0 ]; + fData[ 1 ] = aData[ 1 ]; + fData[ 2 ] = aData[ 2 ]; + fData[ 3 ] = aData[ 3 ]; + fData[ 4 ] = aData[ 4 ]; + fData[ 5 ] = aData[ 5 ]; + fData[ 6 ] = aData[ 6 ]; + fData[ 7 ] = aData[ 7 ]; + fData[ 8 ] = aData[ 8 ]; + } + inline KEMThreeMatrix KEMThreeMatrix::Inverse() const { double tDeterminant = Determinant(); diff --git a/KEMField/Source/Applications/AspectRatioFromKbdROOT.cc b/KEMField/Source/Applications/Calculation/AspectRatioFromKbdROOT.cc similarity index 90% rename from KEMField/Source/Applications/AspectRatioFromKbdROOT.cc rename to KEMField/Source/Applications/Calculation/AspectRatioFromKbdROOT.cc index 9015e0a53..f5d1e5511 100644 --- a/KEMField/Source/Applications/AspectRatioFromKbdROOT.cc +++ b/KEMField/Source/Applications/Calculation/AspectRatioFromKbdROOT.cc @@ -45,7 +45,7 @@ class AspectRatioVisitor : void ProcessTriangle(KTriangle& tri) { - fShapeType = KEMThreeVector(1, 0, 0); + fShapeType = KThreeVector(1, 0, 0); const double data[11] = { tri.GetA(), @@ -89,37 +89,37 @@ class AspectRatioVisitor : c = std::sqrt( delx * delx + dely * dely + delz * delz ); - KEMThreeVector PA; - KEMThreeVector PB; - KEMThreeVector PC; - KEMThreeVector V; - KEMThreeVector X; - KEMThreeVector Y; - KEMThreeVector Q; - KEMThreeVector SUB; + KThreeVector PA; + KThreeVector PB; + KThreeVector PC; + KThreeVector V; + KThreeVector X; + KThreeVector Y; + KThreeVector Q; + KThreeVector SUB; //find the longest side: if( a > b ) { max = a; - PA = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); - PB = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); - PC = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PA = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PB = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PC = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); } else { max = b; - PA = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); - PB = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); - PC = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PA = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PB = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PC = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); } if( c > max ) { max = c; - PA = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); - PB = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); - PC = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PA = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PB = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PC = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); } //the line pointing along v is the y-axis @@ -144,10 +144,10 @@ class AspectRatioVisitor : void ProcessRectangle(KRectangle& r) { - fShapeType = KEMThreeVector(0, 1, 0); + fShapeType = KThreeVector(0, 1, 0); //figure out which vertices make the sides - KEMThreeVector p[4]; + KThreeVector p[4]; p[0] = r.GetP0(); p[1] = r.GetP1(); p[2] = r.GetP2(); @@ -175,21 +175,21 @@ class AspectRatioVisitor : void ProcessLineSegment(KLineSegment& l) { - fShapeType = KEMThreeVector(0, 0, 1); + fShapeType = KThreeVector(0, 0, 1); fAspectRatio = (l.GetP1()-l.GetP0()).Magnitude()/l.GetDiameter(); } double GetAspectRatio() { return fAspectRatio; } - KEMThreeVector GetShapeType(){ return fShapeType; } + KThreeVector GetShapeType(){ return fShapeType; } private: double fAspectRatio; - KEMThreeVector fShapeType; /* ( vector component 0=triangle, 1=rectangle, 2=line segment ) */ + KThreeVector fShapeType; /* ( vector component 0=triangle, 1=rectangle, 2=line segment ) */ }; } /* KEMField namespace*/ -void GetMinMaxAspectRatio( double* retValues, unsigned int containerSize, std::vector &shapeTypes, std::vector &arValues ) +void GetMinMaxAspectRatio( double* retValues, unsigned int containerSize, std::vector &shapeTypes, std::vector &arValues ) { double aspectRatioTri = 0.; double aspectRatioTriMin = 0.; @@ -258,7 +258,7 @@ void GetMinMaxAspectRatio( double* retValues, unsigned int containerSize, std::v return; } -std::vector ComputeAspectRatios( unsigned int contSize, std::vector &types, std::vector &arvalues ) +std::vector ComputeAspectRatios( unsigned int contSize, std::vector &types, std::vector &arvalues ) { // get min and max aspect ratio values double minmax[6]; @@ -401,8 +401,8 @@ int main(int argc, char* argv[]) AspectRatioVisitor fShapeVisitor; std::vector values; - std::vector types; - KEMThreeVector countShapeTypes( 0, 0, 0 ); + std::vector types; + KThreeVector countShapeTypes( 0, 0, 0 ); KSurfaceContainer::iterator it; diff --git a/KEMField/Source/Applications/CMakeLists.txt b/KEMField/Source/Applications/Calculation/CMakeLists.txt similarity index 55% rename from KEMField/Source/Applications/CMakeLists.txt rename to KEMField/Source/Applications/Calculation/CMakeLists.txt index 954740310..6c2604397 100644 --- a/KEMField/Source/Applications/CMakeLists.txt +++ b/KEMField/Source/Applications/Calculation/CMakeLists.txt @@ -1,11 +1,13 @@ -# CMakeLists for KEMField/Applications -# Author: T.J. Corona +# CMakeLists for KEMField/Applications/Calculation +# Author: T.J. Corona, D. Hilk kasper_include_default_dirs() set (APPLICATIONS_LIBS ${ROOT_LIBRARIES} ${GSL_LIBRARIES} + ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} KEMCore KEMHashGenerator KEMStructuredASCII @@ -19,49 +21,44 @@ set (APPLICATIONS_LIBS KEMZHSolver KEMVisualization KFMMathUtilities + KGeoBagInterface + KGeoBagMath ) -if (@PROJECT_NAME@_USE_ROOT) +if (${PROJECT_NAME}_USE_ROOT) kasper_external_include_directories( ${ROOT_INCLUDE_DIRS} ) list (APPEND APPLICATIONS_LIBS KEMRootPlugin ) -endif (@PROJECT_NAME@_USE_ROOT) +endif (${PROJECT_NAME}_USE_ROOT) -if (@PROJECT_NAME@_USE_OPENCL) +if (${PROJECT_NAME}_USE_OPENCL) kasper_external_include_directories( ${OPENCL_INCLUDE_DIRS} ) list (APPEND APPLICATIONS_LIBS KEMOpenCLPlugin ) -endif (@PROJECT_NAME@_USE_OPENCL) +endif (${PROJECT_NAME}_USE_OPENCL) -if (@PROJECT_NAME@_USE_KGEOBAG) - kasper_find_module(KGeoBag) - list (APPEND APPLICATIONS_LIBS - KEMGeoBagPlugin - ) -endif (@PROJECT_NAME@_USE_KGEOBAG) - -if (@PROJECT_NAME@_USE_PETSc) +if (${PROJECT_NAME}_USE_PETSc) list (APPEND APPLICATIONS_LIBS KEMPETScPlugin ) -endif (@PROJECT_NAME@_USE_PETSc) +endif (${PROJECT_NAME}_USE_PETSc) -if (@PROJECT_NAME@_USE_VTK) +if (${PROJECT_NAME}_USE_VTK) list (APPEND APPLICATIONS_LIBS KEMVTKPlugin ${Kommon_Vtk_LIBRARIES} ) -endif (@PROJECT_NAME@_USE_VTK) +endif (${PROJECT_NAME}_USE_VTK) set_property( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ComputeSphericalCapacitor.cc - APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${@PROJECT_NAME@_CONFIG_INSTALL_DIR}" + APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${${PROJECT_NAME}_CONFIG_INSTALL_DIR}" ) set_property( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/ComputeSphericalCapacitor.cc - APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_OUTPUT_DIR="${@PROJECT_NAME@_OUTPUT_INSTALL_DIR}" + APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_OUTPUT_DIR="${${PROJECT_NAME}_OUTPUT_INSTALL_DIR}" ) add_executable (ComputeChargeDensities @@ -76,43 +73,16 @@ add_executable (ComputeSphericalCapacitor ${CMAKE_CURRENT_SOURCE_DIR}/ComputeSphericalCapacitor.cc) target_link_libraries (ComputeSphericalCapacitor ${APPLICATIONS_LIBS} ) -add_executable (KdbConverter - ${CMAKE_CURRENT_SOURCE_DIR}/KdbConverter.cc) -target_link_libraries (KdbConverter ${APPLICATIONS_LIBS} ) - -add_executable (TransferEMElement - ${CMAKE_CURRENT_SOURCE_DIR}/TransferEMElement.cc) -target_link_libraries (TransferEMElement ${APPLICATIONS_LIBS} ) - -add_executable (HashEMGeometry - ${CMAKE_CURRENT_SOURCE_DIR}/HashEMGeometry.cc) -target_link_libraries (HashEMGeometry ${APPLICATIONS_LIBS} ) - -add_executable (InspectEMFile - ${CMAKE_CURRENT_SOURCE_DIR}/InspectEMFile.cc) -target_link_libraries (InspectEMFile ${APPLICATIONS_LIBS} ) - -add_executable (WriteKbdToAscii - ${CMAKE_CURRENT_SOURCE_DIR}/WriteKbdToAscii.cc) -target_link_libraries (WriteKbdToAscii ${APPLICATIONS_LIBS} ) - -add_executable (WriteAsciiToPCD - ${CMAKE_CURRENT_SOURCE_DIR}/WriteAsciiToPCD.cc) -target_link_libraries (WriteAsciiToPCD ${APPLICATIONS_LIBS} ) kasper_install_executables ( ComputeChargeDensities ComputeChargeDensitiesFromElcd33File ComputeSphericalCapacitor - KdbConverter - TransferEMElement - HashEMGeometry - InspectEMFile - WriteKbdToAscii - WriteAsciiToPCD ) -if (@PROJECT_NAME@_USE_ROOT) +# ROOT + +if (${PROJECT_NAME}_USE_ROOT) add_executable (AspectRatioFromKbdROOT ${CMAKE_CURRENT_SOURCE_DIR}/AspectRatioFromKbdROOT.cc) @@ -132,29 +102,10 @@ if (@PROJECT_NAME@_USE_ROOT) DistanceRatioFromKbdROOT ) -endif (@PROJECT_NAME@_USE_ROOT) - - - - -if (@PROJECT_NAME@_USE_VTK) - - add_executable (VisualizeEMGeometry - ${CMAKE_CURRENT_SOURCE_DIR}/VisualizeEMGeometry.cc) - target_link_libraries (VisualizeEMGeometry ${APPLICATIONS_LIBS} ) - - kasper_install_executables ( - VisualizeEMGeometry - ) - -install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ApplicationFiles - DESTINATION ${@PROJECT_NAME@_CONFIG_INSTALL_DIR} - PATTERN "*.gitignore" EXCLUDE - ) - -endif (@PROJECT_NAME@_USE_VTK) +endif (${PROJECT_NAME}_USE_ROOT) #PCL Stuff + #cmake_minimum_required(VERSION 2.8 FATAL_ERROR) #project(greedy_projection) diff --git a/KEMField/Source/Applications/CompareFieldsAndPotentialsROOT.cc b/KEMField/Source/Applications/Calculation/CompareFieldsAndPotentialsROOT.cc similarity index 98% rename from KEMField/Source/Applications/CompareFieldsAndPotentialsROOT.cc rename to KEMField/Source/Applications/Calculation/CompareFieldsAndPotentialsROOT.cc index 59d399f1a..431c05816 100644 --- a/KEMField/Source/Applications/CompareFieldsAndPotentialsROOT.cc +++ b/KEMField/Source/Applications/Calculation/CompareFieldsAndPotentialsROOT.cc @@ -228,7 +228,7 @@ int main(int argc, char* argv[]) double cylZmin( -4.43 ); double cylZmax( 4.43 ); double cylR( 2.5 ); - std::vector tPositions; + std::vector tPositions; for( unsigned int i=0; i set1; - std::pair set2; + KThreeVector field1, field2; + std::pair set1; + std::pair set2; std::vector potDiffContainer; std::vector fieldDiffContainer; @@ -342,7 +342,7 @@ int main(int argc, char* argv[]) double y = sin(phi) * r; // y double z = cylZmin + zRnd*(cylZmax-cylZmin); // z - tPositions.push_back( KEMThreeVector(x,y,z) ); + tPositions.push_back( KThreeVector(x,y,z) ); } for( unsigned int i=0; iSetMarkerSize( 0.2 ); plotDiffField->SetMarkerStyle( 8 ); - KEMThreeVector tPos; + KThreeVector tPos; for( unsigned int i=0; iSetA(d[9]); @@ -1342,10 +1337,6 @@ void ReadInTriangles(std::string fileName,KSurfaceContainer& surfaceContainer) } else { -// dir = false; - // if (dir_ == true) - // std::cout<<"switch to neumann at "<SetA(d[9]); @@ -1357,7 +1348,6 @@ void ReadInTriangles(std::string fileName,KSurfaceContainer& surfaceContainer) surfaceContainer.push_back(t); } -// dir_ = dir; counter++; } } diff --git a/KEMField/Source/Applications/DistanceRatioFromKbdROOT.cc b/KEMField/Source/Applications/Calculation/DistanceRatioFromKbdROOT.cc similarity index 93% rename from KEMField/Source/Applications/DistanceRatioFromKbdROOT.cc rename to KEMField/Source/Applications/Calculation/DistanceRatioFromKbdROOT.cc index a2f02e0d1..4ab50c0f4 100644 --- a/KEMField/Source/Applications/DistanceRatioFromKbdROOT.cc +++ b/KEMField/Source/Applications/Calculation/DistanceRatioFromKbdROOT.cc @@ -81,18 +81,18 @@ class DistRatioVisitor : } double GetAverageSideLength() { return fAverageSideLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } - KEMThreeVector GetShapeType(){ return fShapeType; } + KThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetShapeType(){ return fShapeType; } private: double fAverageSideLength; - KEMThreeVector fShapeCentroid; - KEMThreeVector fShapeType; /* ( triangle, rectangle, line segment ) */ + KThreeVector fShapeCentroid; + KThreeVector fShapeType; /* ( triangle, rectangle, line segment ) */ }; } /* KEMField namespace*/ -void GetMinMaxDistanceRatio( double* retValues, KEMThreeVector fP, unsigned int containerSize, std::vector &shapeTypes, - std::vector &avgLengths, std::vector ¢erPoints ) +void GetMinMaxDistanceRatio( double* retValues, KThreeVector fP, unsigned int containerSize, std::vector &shapeTypes, + std::vector &avgLengths, std::vector ¢erPoints ) { double distanceRatioTri = 0.; double distanceRatioTriMin = 0.; @@ -162,8 +162,8 @@ void GetMinMaxDistanceRatio( double* retValues, KEMThreeVector fP, unsigned int return; } -std::vector ComputeDistanceRatios( KEMThreeVector selectedPoint, - unsigned int contSize, std::vector &types, std::vector &lengths, std::vector ¢roids ) +std::vector ComputeDistanceRatios( KThreeVector selectedPoint, + unsigned int contSize, std::vector &types, std::vector &lengths, std::vector ¢roids ) { // get min and max dr values for chosen field point double minmax[6]; @@ -309,13 +309,13 @@ int main(int argc, char* argv[]) //loop over every element in the container and retrieve shape data and the charge density - KEMThreeVector fieldPoint( 0., 0., 0. ); + KThreeVector fieldPoint( 0., 0., 0. ); DistRatioVisitor fShapeVisitor; std::vector lengths; - std::vector centroids; - std::vector types; - KEMThreeVector countShapeTypes( 0, 0, 0 ); + std::vector centroids; + std::vector types; + KThreeVector countShapeTypes( 0, 0, 0 ); KSurfaceContainer::iterator it; diff --git a/KEMField/Source/Tests/CMakeLists.txt b/KEMField/Source/Applications/Test/CMakeLists.txt similarity index 83% rename from KEMField/Source/Tests/CMakeLists.txt rename to KEMField/Source/Applications/Test/CMakeLists.txt index c01e22cd9..5f586a163 100644 --- a/KEMField/Source/Tests/CMakeLists.txt +++ b/KEMField/Source/Applications/Test/CMakeLists.txt @@ -1,14 +1,14 @@ # CMakeLists for KEMField/Tests # Author: T.J. Corona -option (@PROJECT_NAME@_ENABLE_TEST "Build test applications" OFF) -if (@PROJECT_NAME@_ENABLE_TEST) +option (${PROJECT_NAME}_ENABLE_TEST "Build test applications" OFF) +if (${PROJECT_NAME}_ENABLE_TEST) enable_testing () -endif (@PROJECT_NAME@_ENABLE_TEST) +endif (${PROJECT_NAME}_ENABLE_TEST) -if (@PROJECT_NAME@_ENABLE_TEST) +if (${PROJECT_NAME}_ENABLE_TEST) - kasper_internal_include_directories(${@PROJECT_NAME@_INCLUDE_DIRS}) + kasper_internal_include_directories(${${PROJECT_NAME}_INCLUDE_DIRS}) set (TESTS_HEADERS include/KElectrostaticBoundaryIntegratorOptions.hh @@ -22,6 +22,8 @@ if (@PROJECT_NAME@_ENABLE_TEST) set (TESTS_LIBS ${ROOT_LIBRARIES} ${GSL_LIBRARIES} + ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} KEMCore KEMHashGenerator KEMStructuredASCII @@ -35,56 +37,43 @@ if (@PROJECT_NAME@_ENABLE_TEST) KEMZHGenerator KEMZHSolver KEMVisualization + KGeoBagInterface ) - if (@PROJECT_NAME@_USE_VTK) + + if (${PROJECT_NAME}_USE_VTK) list (APPEND TESTS_LIBS ${Kommon_Vtk_LIBRARIES} KEMVTKPlugin ) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) - if (@PROJECT_NAME@_USE_ROOT) + if (${PROJECT_NAME}_USE_ROOT) find_package(ROOT REQUIRED) kasper_external_include_directories( ${ROOT_INCLUDE_DIRS} ) list (APPEND TESTS_LIBS KEMRootPlugin ) - endif (@PROJECT_NAME@_USE_ROOT) + endif (${PROJECT_NAME}_USE_ROOT) - if (@PROJECT_NAME@_USE_OPENCL) + if (${PROJECT_NAME}_USE_OPENCL) find_package(OpenCL REQUIRED) kasper_external_include_directories( ${OPENCL_INCLUDE_DIRS} ) list (APPEND TESTS_LIBS KEMOpenCLPlugin ) - endif (@PROJECT_NAME@_USE_OPENCL) - - if (@PROJECT_NAME@_USE_KGEOBAG) - kasper_find_module(KGeoBag) - list (APPEND TESTS_LIBS - KEMGeoBagPlugin - ${KOMMON_LIBRARIES} - ) - endif (@PROJECT_NAME@_USE_KGEOBAG) - - if (@PROJECT_NAME@_USE_KMESSAGE) - kasper_find_module(Kommon) - list (APPEND TESTS_LIBS - ${KOMMON_LIBRARIES} - ) - endif (@PROJECT_NAME@_USE_KMESSAGE) + endif (${PROJECT_NAME}_USE_OPENCL) - if (@PROJECT_NAME@_USE_PETSc) + if (${PROJECT_NAME}_USE_PETSc) list (APPEND TESTS_LIBS KEMPETScPlugin ) - endif (@PROJECT_NAME@_USE_PETSc) + endif (${PROJECT_NAME}_USE_PETSc) - if (@PROJECT_NAME@_USE_VTK) + if (${PROJECT_NAME}_USE_VTK) list (APPEND TESTS_LIBS ${VTK_LIBRARIES}) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) add_executable (TestElectromagnets ${CMAKE_CURRENT_SOURCE_DIR}/TestElectromagnets.cc) @@ -162,6 +151,26 @@ if (@PROJECT_NAME@_ENABLE_TEST) ${CMAKE_CURRENT_SOURCE_DIR}/TestZonalHarmonics.cc) target_link_libraries (TestZonalHarmonics ${TESTS_LIBS} ) + add_executable (TestCubeCapacitance + ${CMAKE_CURRENT_SOURCE_DIR}/TestCubeCapacitance.cc) + target_link_libraries (TestCubeCapacitance ${TESTS_LIBS}) + + add_executable (TestSphereCapacitance + ${CMAKE_CURRENT_SOURCE_DIR}/TestSphereCapacitance.cc) + target_link_libraries (TestSphereCapacitance ${TESTS_LIBS}) + + add_executable (TestSuperposition + ${CMAKE_CURRENT_SOURCE_DIR}/TestSuperposition.cc) + target_link_libraries (TestSuperposition ${TESTS_LIBS} ) + + add_executable (TestSymmetryGroups + ${CMAKE_CURRENT_SOURCE_DIR}/TestSymmetryGroups.cc) + target_link_libraries (TestSymmetryGroups ${TESTS_LIBS} ) + +# add_executable (TestSphericalImageCharge +# ${CMAKE_CURRENT_SOURCE_DIR}/TestSphericalImageCharge.cc) +# target_link_libraries (TestSphericalImageCharge ${TESTS_LIBS}) + kasper_install_executables ( TestCubatureSpeedStandAlone TestDiskCapacitance @@ -182,13 +191,18 @@ if (@PROJECT_NAME@_ENABLE_TEST) TestTypelists TestVisitor TestZonalHarmonics + TestCubeCapacitance + TestSphereCapacitance + TestSuperposition + TestSymmetryGroups + # TestSphericalImageCharge ) ############ ### ROOT ### ############ - if (@PROJECT_NAME@_USE_ROOT) + if (${PROJECT_NAME}_USE_ROOT) add_executable (TestDielectrics ${CMAKE_CURRENT_SOURCE_DIR}/TestDielectrics.cc) @@ -218,29 +232,29 @@ if (@PROJECT_NAME@_ENABLE_TEST) TestVectorTypes ) - endif (@PROJECT_NAME@_USE_ROOT) + endif (${PROJECT_NAME}_USE_ROOT) ################ ### KMessage ### ################ - if (@PROJECT_NAME@_USE_KMESSAGE) +# if (${PROJECT_NAME}_USE_KMESSAGE) add_executable (TestKMessageInterface ${CMAKE_CURRENT_SOURCE_DIR}/TestKMessageInterface.cc) - target_link_libraries (TestKMessageInterface ${TESTS_LIBS} ) + target_link_libraries (TestKMessageInterface ${TESTS_LIBS}) kasper_install_executables ( TestKMessageInterface ) - endif (@PROJECT_NAME@_USE_KMESSAGE) +# endif (${PROJECT_NAME}_USE_KMESSAGE) #################### ### OpenCL + MPI ### #################### -# if (@PROJECT_NAME@_USE_OPENCL AND @PROJECT_NAME@_USE_MPI) +# if (${PROJECT_NAME}_USE_OPENCL AND ${PROJECT_NAME}_USE_MPI) # # add_executable (TestOpenCL # ${CMAKE_CURRENT_SOURCE_DIR}/TestOpenCL.cc) @@ -250,15 +264,15 @@ if (@PROJECT_NAME@_ENABLE_TEST) # TestOpenCL # ) -# endif (@PROJECT_NAME@_USE_OPENCL AND @PROJECT_NAME@_USE_MPI) +# endif (${PROJECT_NAME}_USE_OPENCL AND ${PROJECT_NAME}_USE_MPI) ############## ### OpenCL ### ############## - if (@PROJECT_NAME@_USE_OPENCL) + if (${PROJECT_NAME}_USE_OPENCL) - if (@PROJECT_NAME@_USE_ROOT) + if (${PROJECT_NAME}_USE_ROOT) add_executable (TestIntegratorTriangleROOTOpenCL ${CMAKE_CURRENT_SOURCE_DIR}/TestIntegratorTriangleROOTOpenCL.cc) target_link_libraries (TestIntegratorTriangleROOTOpenCL ${OPENCL_LIBRARIES} ${TESTS_LIBS} ) @@ -277,7 +291,7 @@ if (@PROJECT_NAME@_ENABLE_TEST) TestIntegratorLineSegmentROOTOpenCL ) - endif (@PROJECT_NAME@_USE_ROOT) + endif (${PROJECT_NAME}_USE_ROOT) add_executable (TestOpenCLPlugin ${CMAKE_CURRENT_SOURCE_DIR}/TestOpenCLPlugin.cc) @@ -292,54 +306,19 @@ if (@PROJECT_NAME@_ENABLE_TEST) TestOpenCLPlugin ) - endif (@PROJECT_NAME@_USE_OPENCL) - -############### -### KGeoBag ### -############### - - if (@PROJECT_NAME@_USE_KGEOBAG) - - add_executable (TestCubeCapacitance - ${CMAKE_CURRENT_SOURCE_DIR}/TestCubeCapacitance.cc) - target_link_libraries (TestCubeCapacitance ${TESTS_LIBS}) - - add_executable (TestSphereCapacitance - ${CMAKE_CURRENT_SOURCE_DIR}/TestSphereCapacitance.cc) - target_link_libraries (TestSphereCapacitance ${TESTS_LIBS}) - - add_executable (TestSuperposition - ${CMAKE_CURRENT_SOURCE_DIR}/TestSuperposition.cc) - target_link_libraries (TestSuperposition ${TESTS_LIBS} ) - - add_executable (TestSymmetryGroups - ${CMAKE_CURRENT_SOURCE_DIR}/TestSymmetryGroups.cc) - target_link_libraries (TestSymmetryGroups ${TESTS_LIBS} ) - -# add_executable (TestSphericalImageCharge -# ${CMAKE_CURRENT_SOURCE_DIR}/TestSphericalImageCharge.cc) -# target_link_libraries (TestSphericalImageCharge ${TESTS_LIBS} ${Kommon_LIBRARIES}) - - kasper_install_executables ( - TestCubeCapacitance - TestSphereCapacitance - TestSuperposition - TestSymmetryGroups -# TestSphericalImageCharge - ) + endif (${PROJECT_NAME}_USE_OPENCL) - endif (@PROJECT_NAME@_USE_KGEOBAG) ############# ### PETSc ### ############# - if (@PROJECT_NAME@_USE_PETSc) + if (${PROJECT_NAME}_USE_PETSc) set_property( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/TestPETSc.cc - APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${DATA_INSTALL_DIR}/${@PROJECT_NAME@_DATA_DIR}" + APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${DATA_INSTALL_DIR}/${${PROJECT_NAME}_DATA_DIR}" ) add_executable (TestPETSc @@ -360,6 +339,6 @@ set_property( TestPETSc2 ) - endif (@PROJECT_NAME@_USE_PETSc) + endif (${PROJECT_NAME}_USE_PETSc) -endif (@PROJECT_NAME@_ENABLE_TEST) +endif (${PROJECT_NAME}_ENABLE_TEST) diff --git a/KEMField/Source/Tests/TestAnisotropicPoisson.cc b/KEMField/Source/Applications/Test/TestAnisotropicPoisson.cc similarity index 100% rename from KEMField/Source/Tests/TestAnisotropicPoisson.cc rename to KEMField/Source/Applications/Test/TestAnisotropicPoisson.cc diff --git a/KEMField/Source/Tests/TestBinaryTruncation.cc b/KEMField/Source/Applications/Test/TestBinaryTruncation.cc similarity index 100% rename from KEMField/Source/Tests/TestBinaryTruncation.cc rename to KEMField/Source/Applications/Test/TestBinaryTruncation.cc diff --git a/KEMField/Source/Tests/TestCubatureSpeedStandAlone.cc b/KEMField/Source/Applications/Test/TestCubatureSpeedStandAlone.cc similarity index 98% rename from KEMField/Source/Tests/TestCubatureSpeedStandAlone.cc rename to KEMField/Source/Applications/Test/TestCubatureSpeedStandAlone.cc index ad782dcef..acd02be1e 100644 --- a/KEMField/Source/Tests/TestCubatureSpeedStandAlone.cc +++ b/KEMField/Source/Applications/Test/TestCubatureSpeedStandAlone.cc @@ -8,8 +8,8 @@ // constants needed for stand-alone integrator functions below #define M_ONEOVER_4PI_EPS0 8987551787.9979107161559640186992 -#include "include/TestRWGTriangleIntegrator.hh" -#include "include/TestCubatureTriangleIntegrator.hh" +#include "TestRWGTriangleIntegrator.hh" +#include "TestCubatureTriangleIntegrator.hh" // number of triangles #define NUMTRI 1500000 diff --git a/KEMField/Source/Tests/TestCubeCapacitance.cc b/KEMField/Source/Applications/Test/TestCubeCapacitance.cc similarity index 99% rename from KEMField/Source/Tests/TestCubeCapacitance.cc rename to KEMField/Source/Applications/Test/TestCubeCapacitance.cc index 13918a72b..b4eb5db98 100644 --- a/KEMField/Source/Tests/TestCubeCapacitance.cc +++ b/KEMField/Source/Applications/Test/TestCubeCapacitance.cc @@ -5,7 +5,7 @@ #include #include - +#include "../Test/include/KElectrostaticBoundaryIntegratorOptions.hh" #include "KGBox.hh" #include "KGRectangle.hh" @@ -21,8 +21,6 @@ #include "KDataDisplay.hh" -#include "KElectrostaticBoundaryIntegratorOptions.hh" - #include "KBoundaryIntegralMatrix.hh" #include "KBoundaryIntegralVector.hh" #include "KBoundaryIntegralSolutionVector.hh" diff --git a/KEMField/Source/Tests/TestDielectrics.cc b/KEMField/Source/Applications/Test/TestDielectrics.cc similarity index 93% rename from KEMField/Source/Tests/TestDielectrics.cc rename to KEMField/Source/Applications/Test/TestDielectrics.cc index d7effe579..7e3dfefe3 100644 --- a/KEMField/Source/Tests/TestDielectrics.cc +++ b/KEMField/Source/Applications/Test/TestDielectrics.cc @@ -75,17 +75,18 @@ using namespace KEMField; using namespace std; -// typedefs for dirichlet and neumann elements +// typedefs for Dirichlet and Neumann elements typedef KSurface KEMBoundary; +typedef KSurface KEMBoundaryTriangle; typedef KSurface KEMRectangle; typedef KSurface KEMWire; - +// Multi-Element Robin Hood #define MULTIRH - - +// Use triangles instead of rectangles for Neumann boundary +#define USENEUMANNTRI bool StrToBool( std::string s ) { @@ -95,7 +96,6 @@ bool StrToBool( std::string s ) return b; } - /** * This function takes an interval of length and discretizes it * into # of segments, with the size distribution determined by @@ -141,7 +141,7 @@ void DiscretizeInterval(double interval, int nSegments, double power, std::vecto * approximation of constant charge density is more reasonable. */ void AddRect(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double fA, double fB, - KEMThreeVector fP0, KEMThreeVector fN1, KEMThreeVector fN2, double fU, /* potential */ + KThreeVector fP0, KThreeVector fN1, KThreeVector fN2, double fU, /* potential */ double fNRot, int fNumDiscA, int fNumDiscB) { fNRot++; @@ -310,9 +310,95 @@ void AddWire(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, return; } +#ifdef USENEUMANNTRI +void AddBoundary(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double fA, double fB, + KThreeVector fP0, KThreeVector fN1, KThreeVector fN2, double fEpsRAbove, double fEpsRBelow, + double fNRot, int fNumDiscA, int fNumDiscB) +{ + (void)fNRot; + fChDen += (fNumDiscA * fNumDiscB); + + // do not discretize if discretization parameters are set to 0 + if( fNumDiscA==0 || fNumDiscB==0 ) { + std::cout << "No discretization parameter set! No boundary element added." << std::endl; + + return; + } + const double scale = 1.; + const double power = 2.; + + // rescale the discretization parameters by GetDiscScale() + fNumDiscA*=scale; + fNumDiscB*=scale; + + // vectors a,b contain the lengths of the rectangles + std::vector a(fNumDiscA); + std::vector b(fNumDiscB); + + DiscretizeInterval(fA,fNumDiscA,power,a); + DiscretizeInterval(fB,fNumDiscB,power,b); + + // dA and db are the offsets for each fP0[3] cornerpoint + double dA = 0; + double dB = 0; + + for( int i=0; i SetP0( fP0 + dA*fN1 + dB*fN2 ); + tri1 -> SetN1( fN1 ); + tri1 -> SetN2( fN2 ); + tri2 -> SetP0( fP0 + (dA+a[i])*fN1 + (dB+b[j]) * fN2); + tri2 -> SetN1( -1.*fN1 ); + tri2 -> SetN2( -1.*fN2 ); + + // switch N1 and N2 if necessary for positive n3.Z + if( tri1->GetN3().Z() < 0 ) { + std::cout << "The normal vectors N1 and N2 have been exchanged for positive N3.\n"; + tri1->SetN1( fN2 ); + tri1->SetN2( fN1 ); + tri1->SetN3(); + } + if( tri2->GetN3().Z() < 0 ) { + std::cout << "The normal vectors N1 and N2 have been exchanged for positive N3.\n"; + tri2->SetN1( fN2 ); + tri2->SetN2( fN1 ); + tri2->SetN3(); + } + + tri1->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); + tri2->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); + + // set length A + tri1->SetA( a[i] ); + tri2->SetA( a[i] ); + + // set length B + tri1->SetB( b[j] ); + tri2->SetB( b[j] ); + + // add tri1 and tri2 to the surface container + fContainer.push_back( tri1 ); + fContainer.push_back( tri2 ); + + dB+=b[j]; + } /*B direction*/ + dA+=a[i]; + } /*A direction*/ + + fGroup++; + return; +} +#else void AddBoundary(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double fA, double fB, - KEMThreeVector fP0, KEMThreeVector fN1, KEMThreeVector fN2, double fEpsRAbove, double fEpsRBelow, + KThreeVector fP0, KThreeVector fN1, KThreeVector fN2, double fEpsRAbove, double fEpsRBelow, double fNRot, int fNumDiscA, int fNumDiscB) { (void)fNRot; @@ -329,16 +415,14 @@ void AddBoundary(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double rectangle->SetN2( fN2 ); rectangle->SetN3(); - // switch N1 and N2 if necessary + // switch N1 and N2 if necessary for positive n3.Z if( rectangle->GetN3().Z() < 0 ) { rectangle->SetN1( fN2 ); rectangle->SetN2( fN1 ); rectangle->SetN3(); } - //rectangle->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); // TODO: Check!!!! - rectangle->SetNormalBoundaryFlux(0, fEpsRAbove ); - rectangle->SetNormalBoundaryFlux(1, fEpsRBelow ); + rectangle->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); fContainer.push_back( rectangle ); @@ -373,16 +457,15 @@ void AddBoundary(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double rectangle->SetN1(fN1 ); rectangle->SetN2( fN2 ); rectangle->SetN3(); - // switch N1 and N2 if necessary + // switch N1 and N2 if necessary for positive n3.Z if( rectangle->GetN3().Z() < 0 ) { std::cout << "The normal vectors N1 and N2 have been exchanged for positive N3.\n"; rectangle->SetN1( fN2 ); rectangle->SetN2( fN1 ); rectangle->SetN3(); } - //rectangle->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); // TODO: Check!!!! - rectangle->SetNormalBoundaryFlux(1, fEpsRAbove ); - rectangle->SetNormalBoundaryFlux(0, fEpsRBelow ); + + rectangle->SetNormalBoundaryFlux( fEpsRBelow / fEpsRAbove ); // set length A rectangle->SetA( a[i] ); @@ -403,13 +486,13 @@ void AddBoundary(KSurfaceContainer &fContainer, int &fGroup, int &fChDen, double fGroup++; return; } +#endif - -KEMThreeVector CalcTime(double fDuration) +KThreeVector CalcTime(double fDuration) { // Calculating a time, given in seconds, in hours, minutes and seconds. // Result will be written into a vector. - KEMThreeVector fTime; + KThreeVector fTime; int fSecondsTotal(fDuration); @@ -444,7 +527,7 @@ int main(int argc, char *argv[]) int k(0); bool fFixedPoints(false); (void) fFixedPoints; - KEMThreeVector gLocation(0., 0., -0.25); + KThreeVector gLocation(0., 0., -0.25); int gSteps(5000); double gStepsize(0.0001); vector v; @@ -548,22 +631,22 @@ int main(int argc, char *argv[]) // ---------------------------------------------------------------------------- // Start- and endpoints: - KEMThreeVector fWireAnodePA(fWireLengthX,fRunAbsY,fLayerDistanceZ); - KEMThreeVector fWireAnodePB(-fWireLengthX,fRunAbsY,fLayerDistanceZ); - KEMThreeVector fWireCathodePA(fWireLengthX,fRunAbsY,-fLayerDistanceZ); - KEMThreeVector fWireCathodePB(-fWireLengthX,fRunAbsY,-fLayerDistanceZ); + KThreeVector fWireAnodePA(fWireLengthX,fRunAbsY,fLayerDistanceZ); + KThreeVector fWireAnodePB(-fWireLengthX,fRunAbsY,fLayerDistanceZ); + KThreeVector fWireCathodePA(fWireLengthX,fRunAbsY,-fLayerDistanceZ); + KThreeVector fWireCathodePB(-fWireLengthX,fRunAbsY,-fLayerDistanceZ); // End points of connecting wires: - KEMThreeVector fWireConnectPA; - KEMThreeVector fWireConnectPB; + KThreeVector fWireConnectPA; + KThreeVector fWireConnectPB; // Normal vectors: - KEMThreeVector fNx(1.,0.,0.); - KEMThreeVector fNy(0.,1.,0.); - KEMThreeVector fNz(0.,0.,1.); + KThreeVector fNx(1.,0.,0.); + KThreeVector fNy(0.,1.,0.); + KThreeVector fNz(0.,0.,1.); // Common P0 vector for rectangles: - KEMThreeVector fP0(0.,0.,0.); + KThreeVector fP0(0.,0.,0.); // ---------------------------------------------------------------------------- @@ -1203,7 +1286,7 @@ int main(int argc, char *argv[]) clock_t fTimeChDenEnd(0); double fTimeChDen1(0.); - KEMThreeVector fTimeChDen2(0.,0.,0.); + KThreeVector fTimeChDen2(0.,0.,0.); fTimeChDenStart = clock(); @@ -1244,12 +1327,12 @@ int main(int argc, char *argv[]) clock_t fTimeFieldEnd(0); double fTimeField1(0.); - KEMThreeVector fTimeField2(0., 0., 0.); + KThreeVector fTimeField2(0., 0., 0.); fTimeFieldStart = clock(); - KEMThreeVector gEField(0.,0.,0.); + KThreeVector gEField(0.,0.,0.); double gPotential(0.); @@ -1267,7 +1350,7 @@ int main(int argc, char *argv[]) gGraphD->SetTitle("Electric displacement field in z-Direction;z [m];D_z [V/m]"); double Er(0.); - std::pair result; + std::pair result; for(int i=0; i #include +#include "../Test/include/KElectrostaticBoundaryIntegratorOptions.hh" #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" -#include "KElectrostaticBoundaryIntegratorOptions.hh" - #include "KBoundaryIntegralMatrix.hh" #include "KBoundaryIntegralVector.hh" #include "KBoundaryIntegralSolutionVector.hh" diff --git a/KEMField/Source/Tests/TestEMFileInterface.cc b/KEMField/Source/Applications/Test/TestEMFileInterface.cc similarity index 94% rename from KEMField/Source/Tests/TestEMFileInterface.cc rename to KEMField/Source/Applications/Test/TestEMFileInterface.cc index 554dc131f..196f0c6bb 100644 --- a/KEMField/Source/Tests/TestEMFileInterface.cc +++ b/KEMField/Source/Applications/Test/TestEMFileInterface.cc @@ -29,9 +29,9 @@ int main() double a = 1.5; double b = 1.3; - KEMThreeVector p0(0.,0.,0.); - KEMThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); - KEMThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); + KThreeVector p0(0.,0.,0.); + KThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); + KThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); double dirichletValue = 10.2; diff --git a/KEMField/Source/Tests/TestElectromagnetViewer.cc b/KEMField/Source/Applications/Test/TestElectromagnetViewer.cc similarity index 96% rename from KEMField/Source/Tests/TestElectromagnetViewer.cc rename to KEMField/Source/Applications/Test/TestElectromagnetViewer.cc index fff1161fc..07296f528 100644 --- a/KEMField/Source/Tests/TestElectromagnetViewer.cc +++ b/KEMField/Source/Applications/Test/TestElectromagnetViewer.cc @@ -7,7 +7,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KEMConstants.hh" #include "KEMCout.hh" diff --git a/KEMField/Source/Tests/TestElectromagnets.cc b/KEMField/Source/Applications/Test/TestElectromagnets.cc similarity index 98% rename from KEMField/Source/Tests/TestElectromagnets.cc rename to KEMField/Source/Applications/Test/TestElectromagnets.cc index cd5f007ba..40369a170 100644 --- a/KEMField/Source/Tests/TestElectromagnets.cc +++ b/KEMField/Source/Applications/Test/TestElectromagnets.cc @@ -7,7 +7,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -108,8 +108,8 @@ int main(int /*argc*/, char** /*argv*/) KEMField::cout<<"CURRENT LOOP: magnetic field at "<(); - w->SetP0(KEMThreeVector(0.,1.,0.)); - w->SetP1(KEMThreeVector(1.,0.,0.)); + w->SetP0(KThreeVector(0.,1.,0.)); + w->SetP1(KThreeVector(1.,0.,0.)); w->SetDiameter(1.e-4); w->SetNormalBoundaryFlux(3.3); w->SetSolution(12.6); diff --git a/KEMField/Source/Tests/TestIntegratorDistRatioLineSegmentROOT.cc b/KEMField/Source/Applications/Test/TestIntegratorDistRatioLineSegmentROOT.cc similarity index 92% rename from KEMField/Source/Tests/TestIntegratorDistRatioLineSegmentROOT.cc rename to KEMField/Source/Applications/Test/TestIntegratorDistRatioLineSegmentROOT.cc index 07f232b30..b6aebcbfb 100644 --- a/KEMField/Source/Tests/TestIntegratorDistRatioLineSegmentROOT.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorDistRatioLineSegmentROOT.cc @@ -1,7 +1,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -61,7 +61,7 @@ typedef KSurface KEMLineSeg void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -90,11 +90,11 @@ class LineSegmentVisitor : } double GetLength() { return fLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; // visitor for computing fields and potentials @@ -161,43 +161,43 @@ class LineSegmentVisitorForElectricFieldAndPotential : void SetPosition(const KPosition& p) const { fP = p; } - std::pair& GetQuad256ElectricFieldAndPotential() const { return fQuad256ElectricFieldAndPotential;} + std::pair& GetQuad256ElectricFieldAndPotential() const { return fQuad256ElectricFieldAndPotential;} - std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} + std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} - std::pair& GetQuad2ElectricFieldAndPotential() const { return fQuad2ElectricFieldAndPotential;} - std::pair& GetQuad3ElectricFieldAndPotential() const { return fQuad3ElectricFieldAndPotential;} - std::pair& GetQuad4ElectricFieldAndPotential() const { return fQuad4ElectricFieldAndPotential;} - std::pair& GetQuad6ElectricFieldAndPotential() const { return fQuad6ElectricFieldAndPotential;} - std::pair& GetQuad8ElectricFieldAndPotential() const { return fQuad8ElectricFieldAndPotential;} - std::pair& GetQuad16ElectricFieldAndPotential() const { return fQuad16ElectricFieldAndPotential;} - std::pair& GetQuad32ElectricFieldAndPotential() const { return fQuad32ElectricFieldAndPotential;} + std::pair& GetQuad2ElectricFieldAndPotential() const { return fQuad2ElectricFieldAndPotential;} + std::pair& GetQuad3ElectricFieldAndPotential() const { return fQuad3ElectricFieldAndPotential;} + std::pair& GetQuad4ElectricFieldAndPotential() const { return fQuad4ElectricFieldAndPotential;} + std::pair& GetQuad6ElectricFieldAndPotential() const { return fQuad6ElectricFieldAndPotential;} + std::pair& GetQuad8ElectricFieldAndPotential() const { return fQuad8ElectricFieldAndPotential;} + std::pair& GetQuad16ElectricFieldAndPotential() const { return fQuad16ElectricFieldAndPotential;} + std::pair& GetQuad32ElectricFieldAndPotential() const { return fQuad32ElectricFieldAndPotential;} - std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} + std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} private: mutable KPosition fP; // 256-point quadrature as reference - mutable std::pair fQuad256ElectricFieldAndPotential; + mutable std::pair fQuad256ElectricFieldAndPotential; KElectrostatic256NodeQuadratureLineSegmentIntegrator fQuad256Integrator; // analytical integration - mutable std::pair fAnaElectricFieldAndPotential; + mutable std::pair fAnaElectricFieldAndPotential; KElectrostaticAnalyticLineSegmentIntegrator fAnaIntegrator; // quadrature n-node integration rules - mutable std::pair fQuad2ElectricFieldAndPotential; - mutable std::pair fQuad3ElectricFieldAndPotential; - mutable std::pair fQuad4ElectricFieldAndPotential; - mutable std::pair fQuad6ElectricFieldAndPotential; - mutable std::pair fQuad8ElectricFieldAndPotential; - mutable std::pair fQuad16ElectricFieldAndPotential; - mutable std::pair fQuad32ElectricFieldAndPotential; + mutable std::pair fQuad2ElectricFieldAndPotential; + mutable std::pair fQuad3ElectricFieldAndPotential; + mutable std::pair fQuad4ElectricFieldAndPotential; + mutable std::pair fQuad6ElectricFieldAndPotential; + mutable std::pair fQuad8ElectricFieldAndPotential; + mutable std::pair fQuad16ElectricFieldAndPotential; + mutable std::pair fQuad32ElectricFieldAndPotential; KElectrostaticQuadratureLineSegmentIntegrator fQuadIntegrator; // adjusted quadrature integrator dependent from distance ratio - mutable std::pair fNumElectricFieldAndPotential; + mutable std::pair fNumElectricFieldAndPotential; }; } /* KEMField namespace*/ @@ -213,7 +213,7 @@ int main() double length; // assign a unique direction vector for field point to each line segment and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' line segments will be diced in the beginning and added to a surface container // This value decides how much 'line segments=field points' will be computed for each distance ratio value @@ -233,8 +233,8 @@ int main() length = sqrt( POW2(P1[0]-P0[0]) + POW2(P1[1]-P0[1]) + POW2(P1[2]-P0[2]) ); - line->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - line->SetP1( KEMThreeVector(P1[0],P1[1],P1[2]) ); + line->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + line->SetP1( KThreeVector(P1[0],P1[1],P1[2]) ); line->SetDiameter( length*0.1 ); line->SetBoundaryValue( 1. ); @@ -246,7 +246,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -269,12 +269,12 @@ int main() KEMField::cout << "Taking averaged relative error for " << container->size() << " line segments for each dist. ratio value." << KEMField::endl; // field point - KEMThreeVector fP; + KThreeVector fP; - std::pair valQuad256; - std::pair valAna; - std::pair valQuad[7]; - std::pair valNum; + std::pair valQuad256; + std::pair valAna; + std::pair valQuad[7]; + std::pair valNum; // variables for accuracy check of n-node quadrature integration diff --git a/KEMField/Source/Tests/TestIntegratorDistRatioRectangleROOT.cc b/KEMField/Source/Applications/Test/TestIntegratorDistRatioRectangleROOT.cc similarity index 92% rename from KEMField/Source/Tests/TestIntegratorDistRatioRectangleROOT.cc rename to KEMField/Source/Applications/Test/TestIntegratorDistRatioRectangleROOT.cc index 51b7c86ef..3f134c7e6 100644 --- a/KEMField/Source/Tests/TestIntegratorDistRatioRectangleROOT.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorDistRatioRectangleROOT.cc @@ -1,7 +1,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -64,7 +64,7 @@ typedef KSurface KEMRectangle void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -94,11 +94,11 @@ class RectangleVisitor : } double GetAverageSideLength() { return fAverageSideLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fAverageSideLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; // visitor for computing fields and potentials @@ -186,48 +186,48 @@ class RectangleVisitorForElectricFieldAndPotential : void SetPosition(const KPosition& p) const { fP = p; } - std::pair& GetQuadElectricFieldAndPotential() const { return fQuadElectricFieldAndPotential;} + std::pair& GetQuadElectricFieldAndPotential() const { return fQuadElectricFieldAndPotential;} - std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} - std::pair& GetRwgElectricFieldAndPotential() const { return fRwgElectricFieldAndPotential;} + std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} + std::pair& GetRwgElectricFieldAndPotential() const { return fRwgElectricFieldAndPotential;} - std::pair& GetCub4ElectricFieldAndPotential() const { return fCub4ElectricFieldAndPotential;} - std::pair& GetCub7ElectricFieldAndPotential() const { return fCub7ElectricFieldAndPotential;} - std::pair& GetCub9ElectricFieldAndPotential() const { return fCub9ElectricFieldAndPotential;} - std::pair& GetCub12ElectricFieldAndPotential() const { return fCub12ElectricFieldAndPotential;} - std::pair& GetCub17ElectricFieldAndPotential() const { return fCub17ElectricFieldAndPotential;} - std::pair& GetCub20ElectricFieldAndPotential() const { return fCub20ElectricFieldAndPotential;} - std::pair& GetCub33ElectricFieldAndPotential() const { return fCub33ElectricFieldAndPotential;} + std::pair& GetCub4ElectricFieldAndPotential() const { return fCub4ElectricFieldAndPotential;} + std::pair& GetCub7ElectricFieldAndPotential() const { return fCub7ElectricFieldAndPotential;} + std::pair& GetCub9ElectricFieldAndPotential() const { return fCub9ElectricFieldAndPotential;} + std::pair& GetCub12ElectricFieldAndPotential() const { return fCub12ElectricFieldAndPotential;} + std::pair& GetCub17ElectricFieldAndPotential() const { return fCub17ElectricFieldAndPotential;} + std::pair& GetCub20ElectricFieldAndPotential() const { return fCub20ElectricFieldAndPotential;} + std::pair& GetCub33ElectricFieldAndPotential() const { return fCub33ElectricFieldAndPotential;} - std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} + std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} private: mutable KPosition fP; // Bi-Quadrature integrator as reference - mutable std::pair fQuadElectricFieldAndPotential; + mutable std::pair fQuadElectricFieldAndPotential; KElectrostaticBiQuadratureRectangleIntegrator fQuadIntegrator; // analytical integration - mutable std::pair fAnaElectricFieldAndPotential; + mutable std::pair fAnaElectricFieldAndPotential; KElectrostaticAnalyticRectangleIntegrator fAnaIntegrator; // analytical integration with RWG - mutable std::pair fRwgElectricFieldAndPotential; + mutable std::pair fRwgElectricFieldAndPotential; KElectrostaticRWGRectangleIntegrator fRwgIntegrator; // cubature n-point integration rules - mutable std::pair fCub4ElectricFieldAndPotential; - mutable std::pair fCub7ElectricFieldAndPotential; - mutable std::pair fCub9ElectricFieldAndPotential; - mutable std::pair fCub12ElectricFieldAndPotential; - mutable std::pair fCub17ElectricFieldAndPotential; - mutable std::pair fCub20ElectricFieldAndPotential; - mutable std::pair fCub33ElectricFieldAndPotential; + mutable std::pair fCub4ElectricFieldAndPotential; + mutable std::pair fCub7ElectricFieldAndPotential; + mutable std::pair fCub9ElectricFieldAndPotential; + mutable std::pair fCub12ElectricFieldAndPotential; + mutable std::pair fCub17ElectricFieldAndPotential; + mutable std::pair fCub20ElectricFieldAndPotential; + mutable std::pair fCub33ElectricFieldAndPotential; KElectrostaticCubatureRectangleIntegrator fCubIntegrator; // adjusted cubature integrator dependent from distance ratio - mutable std::pair fNumElectricFieldAndPotential; + mutable std::pair fNumElectricFieldAndPotential; }; } /* KEMField namespace*/ @@ -244,7 +244,7 @@ int main() double N2[3]; // assign a unique direction vector for field point to each rectangle and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' rectangles will be diced in the beginning and added to a surface container // This values decides how much rectangles=field points will be computed for each distance ratio value @@ -281,9 +281,9 @@ int main() rectangle->SetA( A ); rectangle->SetB( B ); - rectangle->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - rectangle->SetN1( KEMThreeVector(N1[0],N1[1],N1[2]) ); - rectangle->SetN2( KEMThreeVector(N2[0],N2[1],N2[2]) ); + rectangle->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + rectangle->SetN1( KThreeVector(N1[0],N1[1],N1[2]) ); + rectangle->SetN2( KThreeVector(N2[0],N2[1],N2[2]) ); rectangle->SetBoundaryValue( 1. ); rectangle->SetSolution( 1. ); @@ -296,7 +296,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -319,15 +319,15 @@ int main() KEMField::cout << "Taking averaged relative error for " << container->size() << " rectangles for each dist. ratio value." << KEMField::endl; // field point - KEMThreeVector fP; + KThreeVector fP; // double u[3]; // double costheta, sintheta, phi; - std::pair valQuad; - std::pair valAna; - std::pair valRwg; - std::pair valCub[7]; - std::pair valNum; + std::pair valQuad; + std::pair valAna; + std::pair valRwg; + std::pair valCub[7]; + std::pair valNum; // variables for accuracy check diff --git a/KEMField/Source/Tests/TestIntegratorDistRatioTriangleROOT.cc b/KEMField/Source/Applications/Test/TestIntegratorDistRatioTriangleROOT.cc similarity index 92% rename from KEMField/Source/Tests/TestIntegratorDistRatioTriangleROOT.cc rename to KEMField/Source/Applications/Test/TestIntegratorDistRatioTriangleROOT.cc index 7af2a00f8..836cf6f00 100644 --- a/KEMField/Source/Tests/TestIntegratorDistRatioTriangleROOT.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorDistRatioTriangleROOT.cc @@ -1,7 +1,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -62,7 +62,7 @@ typedef KSurface KEMTriangle; void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -93,11 +93,11 @@ class TriangleVisitor : } double GetAverageSideLength() { return fAverageSideLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fAverageSideLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; // visitor for computing fields and potentials @@ -183,46 +183,46 @@ class TriangleVisitorForElectricFieldAndPotential : void SetPosition(const KPosition& p) const { fP = p; } - std::pair& GetQuadElectricFieldAndPotential() const { return fQuadElectricFieldAndPotential;} + std::pair& GetQuadElectricFieldAndPotential() const { return fQuadElectricFieldAndPotential;} - std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} - std::pair& GetRwgElectricFieldAndPotential() const { return fRwgElectricFieldAndPotential;} + std::pair& GetAnaElectricFieldAndPotential() const { return fAnaElectricFieldAndPotential;} + std::pair& GetRwgElectricFieldAndPotential() const { return fRwgElectricFieldAndPotential;} - std::pair& GetCub4ElectricFieldAndPotential() const { return fCub4ElectricFieldAndPotential;} - std::pair& GetCub7ElectricFieldAndPotential() const { return fCub7ElectricFieldAndPotential;} - std::pair& GetCub12ElectricFieldAndPotential() const { return fCub12ElectricFieldAndPotential;} - std::pair& GetCub16ElectricFieldAndPotential() const { return fCub16ElectricFieldAndPotential;} - std::pair& GetCub19ElectricFieldAndPotential() const { return fCub19ElectricFieldAndPotential;} - std::pair& GetCub33ElectricFieldAndPotential() const { return fCub33ElectricFieldAndPotential;} + std::pair& GetCub4ElectricFieldAndPotential() const { return fCub4ElectricFieldAndPotential;} + std::pair& GetCub7ElectricFieldAndPotential() const { return fCub7ElectricFieldAndPotential;} + std::pair& GetCub12ElectricFieldAndPotential() const { return fCub12ElectricFieldAndPotential;} + std::pair& GetCub16ElectricFieldAndPotential() const { return fCub16ElectricFieldAndPotential;} + std::pair& GetCub19ElectricFieldAndPotential() const { return fCub19ElectricFieldAndPotential;} + std::pair& GetCub33ElectricFieldAndPotential() const { return fCub33ElectricFieldAndPotential;} - std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} + std::pair& GetNumElectricFieldAndPotential() const { return fNumElectricFieldAndPotential;} private: mutable KPosition fP; // Bi-Quadrature integrator as reference - mutable std::pair fQuadElectricFieldAndPotential; + mutable std::pair fQuadElectricFieldAndPotential; KElectrostaticBiQuadratureTriangleIntegrator fQuadIntegrator; // analytical integration - mutable std::pair fAnaElectricFieldAndPotential; + mutable std::pair fAnaElectricFieldAndPotential; KElectrostaticAnalyticTriangleIntegrator fAnaIntegrator; // analytical integration with RWG - mutable std::pair fRwgElectricFieldAndPotential; + mutable std::pair fRwgElectricFieldAndPotential; KElectrostaticRWGTriangleIntegrator fRwgIntegrator; // cubature n-point integration rules - mutable std::pair fCub4ElectricFieldAndPotential; - mutable std::pair fCub7ElectricFieldAndPotential; - mutable std::pair fCub12ElectricFieldAndPotential; - mutable std::pair fCub16ElectricFieldAndPotential; - mutable std::pair fCub19ElectricFieldAndPotential; - mutable std::pair fCub33ElectricFieldAndPotential; + mutable std::pair fCub4ElectricFieldAndPotential; + mutable std::pair fCub7ElectricFieldAndPotential; + mutable std::pair fCub12ElectricFieldAndPotential; + mutable std::pair fCub16ElectricFieldAndPotential; + mutable std::pair fCub19ElectricFieldAndPotential; + mutable std::pair fCub33ElectricFieldAndPotential; KElectrostaticCubatureTriangleIntegrator fCubIntegrator; // adjusted cubature integrator dependent from distance ratio - mutable std::pair fNumElectricFieldAndPotential; + mutable std::pair fNumElectricFieldAndPotential; }; } /* KEMField namespace*/ @@ -241,7 +241,7 @@ int main() double N2[3]; // assign a unique direction vector for field point to each rectangle and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' triangles will be diced in the beginning and added to a surface container // This values decides how much triangles=field points will be computed for each distance ratio value @@ -271,9 +271,9 @@ int main() triangle->SetA( A ); triangle->SetB( B ); - triangle->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - triangle->SetN1( KEMThreeVector(N1[0],N1[1],N1[2]) ); - triangle->SetN2( KEMThreeVector(N2[0],N2[1],N2[2]) ); + triangle->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + triangle->SetN1( KThreeVector(N1[0],N1[1],N1[2]) ); + triangle->SetN2( KThreeVector(N2[0],N2[1],N2[2]) ); triangle->SetBoundaryValue( 1. ); triangle->SetSolution( 1. ); @@ -284,7 +284,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -307,14 +307,14 @@ int main() KEMField::cout << "Taking averaged relative error for " << container->size() << " triangles for each dist. ratio value." << KEMField::endl; // field point - KEMThreeVector fP; + KThreeVector fP; // field and potential values - std::pair valQuad; - std::pair valAna; - std::pair valRwg; - std::pair valCub[6]; - std::pair valNum; + std::pair valQuad; + std::pair valAna; + std::pair valRwg; + std::pair valCub[6]; + std::pair valNum; // variables for accuracy check of n-point cubature integration @@ -780,7 +780,7 @@ int main() l.SetTextFont(62); l.SetTextSize(0.032); - if( (PLOTRWG)||(PLOTANA) ) { + if( (PLOTRWG)|(PLOTANA) ) { l.SetTextAngle(29); if( PLOTRWG ) l.SetTextColor( COLRWG ); if( (PLOTANA)&&!(PLOTRWG) ) l.SetTextColor( COLANA ); @@ -846,7 +846,7 @@ int main() mgField->GetYaxis()->SetTitle( "relative error" ); mgField->GetYaxis()->CenterTitle(); - if( (PLOTRWG)||(PLOTANA) ) { + if( (PLOTRWG)|(PLOTANA) ) { l.SetTextAngle(29); if( PLOTRWG ) l.SetTextColor( COLRWG ); if( (PLOTANA)&&!(PLOTRWG) ) l.SetTextColor( COLANA ); diff --git a/KEMField/Source/Tests/TestIntegratorFunctionality.cc b/KEMField/Source/Applications/Test/TestIntegratorFunctionality.cc similarity index 96% rename from KEMField/Source/Tests/TestIntegratorFunctionality.cc rename to KEMField/Source/Applications/Test/TestIntegratorFunctionality.cc index 929036101..ca6ab3960 100644 --- a/KEMField/Source/Tests/TestIntegratorFunctionality.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorFunctionality.cc @@ -3,10 +3,9 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KElectrostaticBiQuadratureRectangleIntegrator.hh" #include "KElectrostaticBiQuadratureTriangleIntegrator.hh" -#include "KEMThreeVector.hh" - #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" @@ -27,7 +26,7 @@ using namespace KEMField; -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -50,11 +49,11 @@ int main() // KSurface* tL = new KSurface(); // tL->SetA( 1. ); // positive x-direction // tL->SetB( 2. ); // positive y-direction -// KEMThreeVector tLp0( 3., 5., -6. ); /* P0 */ +// KThreeVector tLp0( 3., 5., -6. ); /* P0 */ // tL->SetP0(tLp0); -// KEMThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ +// KThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ // tL->SetN1( tLn1 ); -// KEMThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ +// KThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ // tL->SetN2( tLn2 ); // //tL->SetSolution(1.); // charge density (electrostatic basis) // tL->SetBoundaryValue( 100. ); // electric potential @@ -129,11 +128,11 @@ int main() KSurface* tR = new KSurface(); tR->SetA( 1.133 ); // positive x-direction tR->SetB( 2.2323 ); // positive y-direction - KEMThreeVector tRp0( 0., 0., 1. ); /* P0 */ + KThreeVector tRp0( 0., 0., 1. ); /* P0 */ tR->SetP0(tRp0); - KEMThreeVector tRn1( 1., 0., 0. ); /* N1 */ + KThreeVector tRn1( 1., 0., 0. ); /* N1 */ tR->SetN1( tRn1 ); - KEMThreeVector tRn2( 0., 1., 0. ); /* N2 */ + KThreeVector tRn2( 0., 1., 0. ); /* N2 */ tR->SetN2( tRn2 ); //tR->SetSolution(12.); // charge density (electrostatic basis) tR->SetBoundaryValue( -100. ); // electric potential @@ -145,11 +144,11 @@ int main() KSurface* rL = new KSurface(); rL->SetA( 3. ); // positive x-direction rL->SetB( 2. ); // positive y-direction - KEMThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ + KThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ rL->SetP0(rLp0); - KEMThreeVector rLn1( 1., 0., 0. ); /* N1 */ + KThreeVector rLn1( 1., 0., 0. ); /* N1 */ rL->SetN1( rLn1 ); - KEMThreeVector rLn2( 0., 1., 0. ); /* N2 */ + KThreeVector rLn2( 0., 1., 0. ); /* N2 */ rL->SetN2( rLn2 ); //rL->SetSolution(12.); // charge density (electrostatic basis) rL->SetBoundaryValue( -200. ); // electric potential @@ -171,11 +170,11 @@ int main() KSurface* rR = new KSurface(); rR->SetA( 1. ); // positive x-direction rR->SetB( 2. ); // positive y-direction - KEMThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ + KThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ rR->SetP0(rRp0); - KEMThreeVector rRn1( 1., 0., 0. ); /* N1 */ + KThreeVector rRn1( 1., 0., 0. ); /* N1 */ rR->SetN1( rRn1 ); - KEMThreeVector rRn2( 0., 1., 0. ); /* N2 */ + KThreeVector rRn2( 0., 1., 0. ); /* N2 */ rR->SetN2( rRn2 ); //rR->SetSolution(12.); // charge density (electrostatic basis) rR->SetBoundaryValue( 200. ); // electric potential @@ -185,8 +184,8 @@ int main() // ------------- KSurface* wL = new KSurface(); - wL->SetP0(KEMThreeVector(0.1,-1.5,-0.5)); - wL->SetP1(KEMThreeVector(0.1,1.,-0.5)); + wL->SetP0(KThreeVector(0.1,-1.5,-0.5)); + wL->SetP1(KThreeVector(0.1,1.,-0.5)); wL->SetDiameter(0.003); wL->SetBoundaryValue(-1000); @@ -201,8 +200,8 @@ int main() }; KSurface* wR = new KSurface(); - wR->SetP0(KEMThreeVector(0.1,-1.,0.5)); - wR->SetP1(KEMThreeVector(0.1,1.,0.5)); + wR->SetP0(KThreeVector(0.1,-1.,0.5)); + wR->SetP1(KThreeVector(0.1,1.,0.5)); wR->SetDiameter(0.003); wR->SetBoundaryValue(-1000); diff --git a/KEMField/Source/Tests/TestIntegratorFunctionalityOpenCL.cc b/KEMField/Source/Applications/Test/TestIntegratorFunctionalityOpenCL.cc similarity index 97% rename from KEMField/Source/Tests/TestIntegratorFunctionalityOpenCL.cc rename to KEMField/Source/Applications/Test/TestIntegratorFunctionalityOpenCL.cc index 0ebdb4320..4173745a8 100644 --- a/KEMField/Source/Tests/TestIntegratorFunctionalityOpenCL.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorFunctionalityOpenCL.cc @@ -3,6 +3,7 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KElectrostaticAnalyticTriangleIntegrator.hh" #include "KElectrostaticCubatureTriangleIntegrator.hh" #include "KElectrostaticRWGTriangleIntegrator.hh" @@ -16,8 +17,6 @@ #include "KElectrostaticAnalyticLineSegmentIntegrator.hh" #include "KElectrostaticQuadratureLineSegmentIntegrator.hh" -#include "KEMThreeVector.hh" - #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" @@ -34,7 +33,7 @@ using namespace KEMField; -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -111,11 +110,11 @@ int main() KSurface* tL = new KSurface(); tL->SetA( 1. ); // positive x-direction tL->SetB( 2. ); // positive y-direction - KEMThreeVector tLp0( 3., 5., -6. ); /* P0 */ + KThreeVector tLp0( 3., 5., -6. ); /* P0 */ tL->SetP0(tLp0); - KEMThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ + KThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ tL->SetN1( tLn1 ); - KEMThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ + KThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ tL->SetN2( tLn2 ); //tL->SetSolution(1.); // charge density (electrostatic basis) tL->SetBoundaryValue( 100. ); // electric potential @@ -142,11 +141,11 @@ int main() KSurface* rL = new KSurface(); rL->SetA( 3. ); // positive x-direction rL->SetB( 2. ); // positive y-direction - KEMThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ + KThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ rL->SetP0(rLp0); - KEMThreeVector rLn1( 1., 0., 0. ); /* N1 */ + KThreeVector rLn1( 1., 0., 0. ); /* N1 */ rL->SetN1( rLn1 ); - KEMThreeVector rLn2( 0., 1., 0. ); /* N2 */ + KThreeVector rLn2( 0., 1., 0. ); /* N2 */ rL->SetN2( rLn2 ); //rL->SetSolution(12.); // charge density (electrostatic basis) rL->SetBoundaryValue( -200. ); // electric potential @@ -171,8 +170,8 @@ int main() // ------------- KSurface* wL = new KSurface(); - wL->SetP0(KEMThreeVector(0.1,-1.5,-0.5)); - wL->SetP1(KEMThreeVector(0.1,1.,-0.5)); + wL->SetP0(KThreeVector(0.1,-1.5,-0.5)); + wL->SetP1(KThreeVector(0.1,1.,-0.5)); wL->SetDiameter(0.003); wL->SetBoundaryValue(-1000); diff --git a/KEMField/Source/Tests/TestIntegratorLineSegmentROOTOpenCL.cc b/KEMField/Source/Applications/Test/TestIntegratorLineSegmentROOTOpenCL.cc similarity index 96% rename from KEMField/Source/Tests/TestIntegratorLineSegmentROOTOpenCL.cc rename to KEMField/Source/Applications/Test/TestIntegratorLineSegmentROOTOpenCL.cc index 0d0267650..56a878bda 100644 --- a/KEMField/Source/Tests/TestIntegratorLineSegmentROOTOpenCL.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorLineSegmentROOTOpenCL.cc @@ -1,7 +1,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -45,7 +45,7 @@ typedef KSurface KEMLineSeg void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -74,11 +74,11 @@ class LineSegmentVisitor : } double GetLength() { return fLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; } /* KEMField namespace*/ @@ -94,7 +94,7 @@ int main() double length; // assign a unique direction vector for field point to each line segment and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' line segments will be diced in the beginning and added to a surface container // This value decides how much 'line segments=field points' will be computed for each distance ratio value @@ -114,8 +114,8 @@ int main() length = sqrt( POW2(P1[0]-P0[0]) + POW2(P1[1]-P0[1]) + POW2(P1[2]-P0[2]) ); - line->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - line->SetP1( KEMThreeVector(P1[0],P1[1],P1[2]) ); + line->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + line->SetP1( KThreeVector(P1[0],P1[1],P1[2]) ); line->SetDiameter( length*0.1 ); line->SetBoundaryValue( 1. ); @@ -127,7 +127,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -160,11 +160,11 @@ int main() KEMField::cout << "Taking averaged relative error for " << container->size() << " line segments for each dist. ratio value." << KEMField::endl; // field point - KEMThreeVector fP; + KThreeVector fP; - std::pair valQuad256; - std::pair valAna; - std::pair valNum; + std::pair valQuad256; + std::pair valAna; + std::pair valNum; // plot diff --git a/KEMField/Source/Tests/TestIntegratorRWG.cc b/KEMField/Source/Applications/Test/TestIntegratorRWG.cc similarity index 80% rename from KEMField/Source/Tests/TestIntegratorRWG.cc rename to KEMField/Source/Applications/Test/TestIntegratorRWG.cc index 590ad7332..3b92cd7c3 100644 --- a/KEMField/Source/Tests/TestIntegratorRWG.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorRWG.cc @@ -3,10 +3,9 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KElectrostaticBiQuadratureRectangleIntegrator.hh" #include "KElectrostaticBiQuadratureTriangleIntegrator.hh" -#include "KEMThreeVector.hh" - #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" @@ -24,12 +23,12 @@ using namespace KEMField; -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } -void printVecKEM( std::string add, KEMThreeVector input ) +void printVecKEM( std::string add, KThreeVector input ) { KEMField::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << KEMField::endl; } @@ -50,16 +49,16 @@ int main() KSurface* tri1 = new KSurface(); - KEMThreeVector tri1P0( -1.75, 0.25, 0. ); + KThreeVector tri1P0( -1.75, 0.25, 0. ); tri1->SetP0( tri1P0) ; - KEMThreeVector tri1P1( 1.75, 0.25, 0. ); - KEMThreeVector tri1N1 = (tri1P1-tri1P0).Unit(); + KThreeVector tri1P1( 1.75, 0.25, 0. ); + KThreeVector tri1N1 = (tri1P1-tri1P0).Unit(); tri1->SetA( (tri1P1-tri1P0).Magnitude() ); tri1->SetN1( tri1N1 ); - KEMThreeVector tri1P2( 0., 2.25, 0. ); - KEMThreeVector tri1N2 = (tri1P2-tri1P0).Unit(); + KThreeVector tri1P2( 0., 2.25, 0. ); + KThreeVector tri1N2 = (tri1P2-tri1P0).Unit(); tri1->SetB( (tri1P2-tri1P0).Magnitude() ); tri1->SetN2( tri1N2 ); @@ -68,16 +67,16 @@ int main() // triangle 1 from rectangle KSurface* tri2 = new KSurface(); - KEMThreeVector tri2P0( -2., -2, 0. ); + KThreeVector tri2P0( -2., -2, 0. ); tri2->SetP0( tri2P0) ; - KEMThreeVector tri2P1( 2., -2., 0. ); - KEMThreeVector tri2N1 = (tri2P1-tri2P0).Unit(); + KThreeVector tri2P1( 2., -2., 0. ); + KThreeVector tri2N1 = (tri2P1-tri2P0).Unit(); tri2->SetA( (tri2P1-tri2P0).Magnitude() ); tri2->SetN1( tri2N1 ); - KEMThreeVector tri2P2( 2., 2., 0. ); - KEMThreeVector tri2N2 = (tri2P2-tri2P0).Unit(); + KThreeVector tri2P2( 2., 2., 0. ); + KThreeVector tri2N2 = (tri2P2-tri2P0).Unit(); tri2->SetB( (tri2P2-tri2P0).Magnitude() ); tri2->SetN2( tri2N2 ); @@ -89,11 +88,11 @@ int main() KSurface* rL = new KSurface(); rL->SetA( 4. ); // positive x-direction rL->SetB( 4. ); // positive y-direction - KEMThreeVector rLp0( -2., -2., 0. ); /* P0 */ + KThreeVector rLp0( -2., -2., 0. ); /* P0 */ rL->SetP0(rLp0); - KEMThreeVector rLn1( 1., 0., 0. ); /* N1 */ + KThreeVector rLn1( 1., 0., 0. ); /* N1 */ rL->SetN1( rLn1 ); - KEMThreeVector rLn2( 0., 1., 0. ); /* N2 */ + KThreeVector rLn2( 0., 1., 0. ); /* N2 */ rL->SetN2( rLn2 ); //rL->SetSolution(12.); // charge density (electrostatic basis) rL->SetBoundaryValue( 10. ); // electric potential @@ -101,11 +100,11 @@ int main() KSurface* rR = new KSurface(); rR->SetA( 1. ); // positive x-direction rR->SetB( 2. ); // positive y-direction - KEMThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ + KThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ rR->SetP0(rRp0); - KEMThreeVector rRn1( 1., 0., 0. ); /* N1 */ + KThreeVector rRn1( 1., 0., 0. ); /* N1 */ rR->SetN1( rRn1 ); - KEMThreeVector rRn2( 0., 1., 0. ); /* N2 */ + KThreeVector rRn2( 0., 1., 0. ); /* N2 */ rR->SetN2( rRn2 ); //rR->SetSolution(12.); // charge density (electrostatic basis) rR->SetBoundaryValue( 10. ); // electric potential @@ -117,7 +116,7 @@ int main() KSurface* testRect; testRect = rL; - KEMThreeVector reEvalPoint[7]; + KThreeVector reEvalPoint[7]; std::vector textRe; // points for rL @@ -126,22 +125,22 @@ int main() reEvalPoint[0] = testRect->GetP0(); textRe.push_back((std::string)("arbitrary point on surface:\t")); - reEvalPoint[1] = KEMThreeVector( 0.1, -1.5, 0. ); + reEvalPoint[1] = KThreeVector( 0.1, -1.5, 0. ); textRe.push_back((std::string)("point in center of rectangle:\t")); reEvalPoint[2] = testRect->Centroid(); textRe.push_back((std::string)("point in plane of rectangle but far outside:\t")); - reEvalPoint[3] = KEMThreeVector( 10., 10., 0. ); + reEvalPoint[3] = KThreeVector( 10., 10., 0. ); textRe.push_back((std::string)("point on side line of rectangle:\t")); - reEvalPoint[4] = KEMThreeVector( 0., -2., 0. ); + reEvalPoint[4] = KThreeVector( 0., -2., 0. ); textRe.push_back((std::string)("arbitrary point:\t")); - reEvalPoint[5] = KEMThreeVector( 10., -20.5, 33.58 ); + reEvalPoint[5] = KThreeVector( 10., -20.5, 33.58 ); textRe.push_back((std::string)("point on line subdividing the rectangle into two triangles:\t")); - reEvalPoint[6] = KEMThreeVector( -1, -1., 0. ); + reEvalPoint[6] = KThreeVector( -1, -1., 0. ); KEMField::cout << "Testing RWG rectangles ..." << KEMField::endl; for( unsigned int i=0; i* testTri; testTri = tri1; - KEMThreeVector triEvalPoint[6]; + KThreeVector triEvalPoint[6]; std::vector textTri; // points for tri1 @@ -168,19 +167,19 @@ int main() triEvalPoint[0] = testTri->GetP0(); textTri.push_back((std::string)("arbitrary point on surface:\t")); - triEvalPoint[1] = KEMThreeVector( 0.01, 0.5, 0. ); + triEvalPoint[1] = KThreeVector( 0.01, 0.5, 0. ); textTri.push_back((std::string)("point in center of triangle:\t")); triEvalPoint[2] = testTri->Centroid(); textTri.push_back((std::string)("point in plane of triangle but far outside:\t")); - triEvalPoint[3] = KEMThreeVector( 10., 1., 0. ); + triEvalPoint[3] = KThreeVector( 10., 1., 0. ); textTri.push_back((std::string)("point on side line of triangle:\t")); - triEvalPoint[4] = KEMThreeVector( 0., 0.25, 0. ); + triEvalPoint[4] = KThreeVector( 0., 0.25, 0. ); textTri.push_back((std::string)("arbitrary point:\t")); - triEvalPoint[5] = KEMThreeVector( 10., -20.5, 33.58 ); + triEvalPoint[5] = KThreeVector( 10., -20.5, 33.58 ); KEMField::cout << "Testing RWG triangles ..." << KEMField::endl; for( unsigned int i=0; i #include +#include "KThreeVector_KEMField.hh" #include "KElectrostaticBiQuadratureRectangleIntegrator.hh" #include "KElectrostaticBiQuadratureTriangleIntegrator.hh" -#include "KEMThreeVector.hh" - #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" @@ -36,18 +35,18 @@ double randomnumber(); double fToleranceLambda = 1.E-15; /* tolerance for determining if field point is on vertex */ -void AddTriangle( std::vector &v, KEMThreeVector triP0, KEMThreeVector triP1, KEMThreeVector triP2 ) +void AddTriangle( std::vector &v, KThreeVector triP0, KThreeVector triP1, KThreeVector triP2 ) { KEMTriangle newTri; newTri.SetA( sqrt(POW2(triP1[0]-triP0[0]) + POW2(triP1[1]-triP0[1]) + POW2(triP1[2]-triP0[2])) ); newTri.SetB( sqrt(POW2(triP2[0]-triP0[0]) + POW2(triP2[1]-triP0[1]) + POW2(triP2[2]-triP0[2])) ); newTri.SetP0( triP0 ); - newTri.SetN1( KEMThreeVector((triP1[0]-triP0[0]) / newTri.GetA(), + newTri.SetN1( KThreeVector((triP1[0]-triP0[0]) / newTri.GetA(), (triP1[1]-triP0[1]) / newTri.GetA(), (triP1[2]-triP0[2]) / newTri.GetA()) ); - newTri.SetN2( KEMThreeVector((triP2[0]-triP0[0]) / newTri.GetB(), + newTri.SetN2( KThreeVector((triP2[0]-triP0[0]) / newTri.GetB(), (triP2[1]-triP0[1]) / newTri.GetB(), (triP2[2]-triP0[2]) / newTri.GetB()) ); @@ -183,9 +182,9 @@ int main() KEMTriangle* triangle = new KEMTriangle(); triangle->SetA( triData[0] ); triangle->SetB( triData[1] ); - triangle->SetP0( KEMThreeVector(triP0[0],triP0[1],triP0[2]) ); - triangle->SetN1( KEMThreeVector(triData[5],triData[6],triData[7]) ); - triangle->SetN2( KEMThreeVector(triData[8],triData[9],triData[10]) ); + triangle->SetP0( KThreeVector(triP0[0],triP0[1],triP0[2]) ); + triangle->SetN1( KThreeVector(triData[5],triData[6],triData[7]) ); + triangle->SetN2( KThreeVector(triData[8],triData[9],triData[10]) ); triangle->SetBoundaryValue( 1. ); triangle->SetSolution( 1. ); @@ -201,14 +200,14 @@ int main() double averageSideLength = (triAlongSideLengthP0P1 + triAlongSideLengthP1P2 + triAlongSideLengthP2P0)/3.; double dirN3 = 2. * averageSideLength * randomnumber(); - KEMThreeVector fP(0., 0., 0.); - fP = KEMThreeVector(triData[2], triData[3], triData[4]) - + (dirN1*KEMThreeVector(triData[5],triData[6],triData[7])) - + (dirN2*KEMThreeVector(triData[8],triData[9],triData[10]) ); + KThreeVector fP(0., 0., 0.); + fP = KThreeVector(triData[2], triData[3], triData[4]) + + (dirN1*KThreeVector(triData[5],triData[6],triData[7])) + + (dirN2*KThreeVector(triData[8],triData[9],triData[10]) ); if( print ) std::cout << "fP = " << fP[0] << " " << fP[1] << " " << fP[2] << std::endl; - KEMThreeVector fPN3(0., 0., 0.); + KThreeVector fPN3(0., 0., 0.); fPN3 = fP + ( dirN3*(triangle->GetN3()) ); // compute distance ratio @@ -341,22 +340,22 @@ int main() // m = unit vector as cross product of two perpendicular unit vectors - KEMThreeVector goOut; + KThreeVector goOut; // decide which m has to be taken - if( lineIndex==0 ) goOut = KEMThreeVector( m0[0], m0[1], m0[2] ); // Unit vectors ??????? - if( lineIndex==1 ) goOut = KEMThreeVector( m1[0], m1[1], m1[2] ); - if( lineIndex==2 ) goOut = KEMThreeVector( m2[0], m2[1], m2[2] ); + if( lineIndex==0 ) goOut = KThreeVector( m0[0], m0[1], m0[2] ); // Unit vectors ??????? + if( lineIndex==1 ) goOut = KThreeVector( m1[0], m1[1], m1[2] ); + if( lineIndex==2 ) goOut = KThreeVector( m2[0], m2[1], m2[2] ); - KEMThreeVector goAlong; + KThreeVector goAlong; - if( lineIndex==0 ) goAlong = KEMThreeVector( triAlongSideP0P1Unit[0], triAlongSideP0P1Unit[1], triAlongSideP0P1Unit[2] ); - if( lineIndex==1 ) goAlong = KEMThreeVector( triAlongSideP1P2Unit[0], triAlongSideP1P2Unit[1], triAlongSideP1P2Unit[2] ); - if( lineIndex==2 ) goAlong = KEMThreeVector( triAlongSideP2P0Unit[0], triAlongSideP2P0Unit[1], triAlongSideP2P0Unit[2] ); + if( lineIndex==0 ) goAlong = KThreeVector( triAlongSideP0P1Unit[0], triAlongSideP0P1Unit[1], triAlongSideP0P1Unit[2] ); + if( lineIndex==1 ) goAlong = KThreeVector( triAlongSideP1P2Unit[0], triAlongSideP1P2Unit[1], triAlongSideP1P2Unit[2] ); + if( lineIndex==2 ) goAlong = KThreeVector( triAlongSideP2P0Unit[0], triAlongSideP2P0Unit[1], triAlongSideP2P0Unit[2] ); // save rectangle points - std::vector rect; + std::vector rect; rect.push_back( fP+(distToLineMin*goOut) ); rect.push_back( fP+(distToLineMin*goAlong) ); @@ -366,9 +365,9 @@ int main() // define triangle corner points relatively to side with min distance - KEMThreeVector p0Rel; - KEMThreeVector p1Rel; - KEMThreeVector p2Rel; + KThreeVector p0Rel; + KThreeVector p1Rel; + KThreeVector p2Rel; if( lineIndex==0 ) { p0Rel = triP0; @@ -399,7 +398,7 @@ int main() // compute field/potential via Gauss Legendre and sum up values !! double triPotential = 0.; - KEMThreeVector triField; + KThreeVector triField; for( unsigned int i=0; i #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -48,7 +48,7 @@ typedef KSurface KEMRectangle void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -78,11 +78,11 @@ class RectangleVisitor : } double GetAverageSideLength() { return fAverageSideLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fAverageSideLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; } /* KEMField namespace*/ @@ -99,7 +99,7 @@ int main() double N2[3]; // assign a unique direction vector for field point to each rectangle and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' rectangles will be diced in the beginning and added to a surface container // This values decides how much rectangles=field points will be computed for each distance ratio value @@ -136,9 +136,9 @@ int main() rectangle->SetA( A ); rectangle->SetB( B ); - rectangle->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - rectangle->SetN1( KEMThreeVector(N1[0],N1[1],N1[2]) ); - rectangle->SetN2( KEMThreeVector(N2[0],N2[1],N2[2]) ); + rectangle->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + rectangle->SetN1( KThreeVector(N1[0],N1[1],N1[2]) ); + rectangle->SetN2( KThreeVector(N2[0],N2[1],N2[2]) ); rectangle->SetBoundaryValue( 1. ); rectangle->SetSolution( 1. ); @@ -151,7 +151,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -187,12 +187,12 @@ int main() // field point - KEMThreeVector fP; + KThreeVector fP; - std::pair valQuad; - std::pair valAna; - std::pair valRwg; - std::pair valNum; + std::pair valQuad; + std::pair valAna; + std::pair valRwg; + std::pair valNum; // plot diff --git a/KEMField/Source/Tests/TestIntegratorSpeed.cc b/KEMField/Source/Applications/Test/TestIntegratorSpeed.cc similarity index 89% rename from KEMField/Source/Tests/TestIntegratorSpeed.cc rename to KEMField/Source/Applications/Test/TestIntegratorSpeed.cc index 5b4d35bda..6fd4feab2 100644 --- a/KEMField/Source/Tests/TestIntegratorSpeed.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorSpeed.cc @@ -3,8 +3,7 @@ #include #include -#include "KEMThreeVector.hh" - +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KSurface.hh" #include "KSurfaceTypes.hh" @@ -28,7 +27,7 @@ using namespace KEMField; -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -58,11 +57,11 @@ int main() KSurface* tL = new KSurface(); tL->SetA( 1. ); // positive x-direction tL->SetB( 2. ); // positive y-direction - KEMThreeVector tLp0( 3., 5., -6. ); /* P0 */ + KThreeVector tLp0( 3., 5., -6. ); /* P0 */ tL->SetP0(tLp0); - KEMThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ + KThreeVector tLn1( 1./sqrt(2.), 1./sqrt(2.), 0. ); /* N1 */ tL->SetN1( tLn1 ); - KEMThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ + KThreeVector tLn2( 0., 1./sqrt(2.), 1./sqrt(2.) ); /* N2 */ tL->SetN2( tLn2 ); //tL->SetSolution(1.); // charge density (electrostatic basis) tL->SetBoundaryValue( 100. ); // electric potential @@ -84,11 +83,11 @@ int main() KSurface* tR = new KSurface(); tR->SetA( 1.133 ); // positive x-direction tR->SetB( 2.2323 ); // positive y-direction - KEMThreeVector tRp0( 0., 0., 1. ); /* P0 */ + KThreeVector tRp0( 0., 0., 1. ); /* P0 */ tR->SetP0(tRp0); - KEMThreeVector tRn1( 1., 0., 0. ); /* N1 */ + KThreeVector tRn1( 1., 0., 0. ); /* N1 */ tR->SetN1( tRn1 ); - KEMThreeVector tRn2( 0., 1., 0. ); /* N2 */ + KThreeVector tRn2( 0., 1., 0. ); /* N2 */ tR->SetN2( tRn2 ); //tR->SetSolution(12.); // charge density (electrostatic basis) tR->SetBoundaryValue( -100. ); // electric potential @@ -100,11 +99,11 @@ int main() KSurface* rL = new KSurface(); rL->SetA( 3. ); // positive x-direction rL->SetB( 2. ); // positive y-direction - KEMThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ + KThreeVector rLp0( 0., 0., -0.9 ); /* P0 */ rL->SetP0(rLp0); - KEMThreeVector rLn1( 1., 0., 0. ); /* N1 */ + KThreeVector rLn1( 1., 0., 0. ); /* N1 */ rL->SetN1( rLn1 ); - KEMThreeVector rLn2( 0., 1., 0. ); /* N2 */ + KThreeVector rLn2( 0., 1., 0. ); /* N2 */ rL->SetN2( rLn2 ); //rL->SetSolution(12.); // charge density (electrostatic basis) rL->SetBoundaryValue( -200. ); // electric potential @@ -112,11 +111,11 @@ int main() KSurface* rR = new KSurface(); rR->SetA( 1. ); // positive x-direction rR->SetB( 2. ); // positive y-direction - KEMThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ + KThreeVector rRp0( 0., 0., 0.9 ); /* P0 */ rR->SetP0(rRp0); - KEMThreeVector rRn1( 1., 0., 0. ); /* N1 */ + KThreeVector rRn1( 1., 0., 0. ); /* N1 */ rR->SetN1( rRn1 ); - KEMThreeVector rRn2( 0., 1., 0. ); /* N2 */ + KThreeVector rRn2( 0., 1., 0. ); /* N2 */ rR->SetN2( rRn2 ); //rR->SetSolution(12.); // charge density (electrostatic basis) rR->SetBoundaryValue( 200. ); // electric potential @@ -126,14 +125,14 @@ int main() // ------------- KSurface* wL = new KSurface(); - wL->SetP0(KEMThreeVector(0.1,-1.5,-0.5)); - wL->SetP1(KEMThreeVector(0.1,1.,-0.5)); + wL->SetP0(KThreeVector(0.1,-1.5,-0.5)); + wL->SetP1(KThreeVector(0.1,1.,-0.5)); wL->SetDiameter(0.003); wL->SetBoundaryValue(-1000); KSurface* wR = new KSurface(); - wR->SetP0(KEMThreeVector(0.1,-1.,0.5)); - wR->SetP1(KEMThreeVector(0.1,1.,0.5)); + wR->SetP0(KThreeVector(0.1,-1.,0.5)); + wR->SetP1(KThreeVector(0.1,1.,0.5)); wR->SetDiameter(0.003); wR->SetBoundaryValue(-1000); diff --git a/KEMField/Source/Tests/TestIntegratorSpeedWithKbdInput.cc b/KEMField/Source/Applications/Test/TestIntegratorSpeedWithKbdInput.cc similarity index 95% rename from KEMField/Source/Tests/TestIntegratorSpeedWithKbdInput.cc rename to KEMField/Source/Applications/Test/TestIntegratorSpeedWithKbdInput.cc index 8abe03073..6341f141b 100644 --- a/KEMField/Source/Tests/TestIntegratorSpeedWithKbdInput.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorSpeedWithKbdInput.cc @@ -155,7 +155,7 @@ int main(int argc, char* argv[]) fieldPoints[(i*3)+1] = sin(phi) * r; // y fieldPoints[(i*3)+2] = cylZmin + z*(cylZmax-cylZmin); // z - //KEMField::cout << KEMThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) << KEMField::endl; + //KEMField::cout << KThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) << KEMField::endl; } #ifdef KEMFIELD_USE_OPENCL @@ -185,10 +185,10 @@ double totalTime=0.; for( unsigned int i=0; iElectricFieldAndPotential( KEMThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); - //fOpenCLIntegratingFieldSolver->Potential( KEMThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); + fOpenCLIntegratingFieldSolver->ElectricFieldAndPotential( KThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); + //fOpenCLIntegratingFieldSolver->Potential( KThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); #else - fIntegratingFieldSolver->ElectricFieldAndPotentialNoKahanSum( KEMThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); + fIntegratingFieldSolver->ElectricFieldAndPotentialNoKahanSum( KThreeVector(fieldPoints[(i*3)],fieldPoints[(i*3)+1],fieldPoints[(i*3)+2]) ); totalTime+=Time(); #endif } diff --git a/KEMField/Source/Tests/TestIntegratorTriangleROOTOpenCL.cc b/KEMField/Source/Applications/Test/TestIntegratorTriangleROOTOpenCL.cc similarity index 95% rename from KEMField/Source/Tests/TestIntegratorTriangleROOTOpenCL.cc rename to KEMField/Source/Applications/Test/TestIntegratorTriangleROOTOpenCL.cc index d01282488..00bcd5ebd 100644 --- a/KEMField/Source/Tests/TestIntegratorTriangleROOTOpenCL.cc +++ b/KEMField/Source/Applications/Test/TestIntegratorTriangleROOTOpenCL.cc @@ -1,7 +1,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -48,7 +48,7 @@ typedef KSurface KEMTriangle; void subrn(double *u,int len); double randomnumber(); -void printVec( std::string add, KEMThreeVector input ) +void printVec( std::string add, KThreeVector input ) { std::cout << add.c_str() << input.X() << "\t" << input.Y() << "\t" << input.Z() << std::endl; } @@ -79,11 +79,11 @@ class TriangleVisitor : } double GetAverageSideLength() { return fAverageSideLength; } - KEMThreeVector GetCentroid(){ return fShapeCentroid; } + KThreeVector GetCentroid(){ return fShapeCentroid; } private: double fAverageSideLength; - KEMThreeVector fShapeCentroid; + KThreeVector fShapeCentroid; }; } /* KEMField namespace*/ @@ -102,7 +102,7 @@ int main() double N2[3]; // assign a unique direction vector for field point to each rectangle and save into std::vector - std::vector fPointDirections; + std::vector fPointDirections; // 'Num' triangles will be diced in the beginning and added to a surface container // This values decides how much triangles=field points will be computed for each distance ratio value @@ -132,9 +132,9 @@ int main() triangle->SetA( A ); triangle->SetB( B ); - triangle->SetP0( KEMThreeVector(P0[0],P0[1],P0[2]) ); - triangle->SetN1( KEMThreeVector(N1[0],N1[1],N1[2]) ); - triangle->SetN2( KEMThreeVector(N2[0],N2[1],N2[2]) ); + triangle->SetP0( KThreeVector(P0[0],P0[1],P0[2]) ); + triangle->SetN1( KThreeVector(N1[0],N1[1],N1[2]) ); + triangle->SetN2( KThreeVector(N2[0],N2[1],N2[2]) ); triangle->SetBoundaryValue( 1. ); triangle->SetSolution( 1. ); @@ -145,7 +145,7 @@ int main() const double sinthetaFP = sqrt( 1. - POW2(costhetaFP) ); const double phiFP = 2.*M_PI*randomnumber(); - fPointDirections.push_back( KEMThreeVector( + fPointDirections.push_back( KThreeVector( sinthetaFP*cos(phiFP), sinthetaFP*sin(phiFP), costhetaFP ) ); @@ -180,13 +180,13 @@ int main() KEMField::cout << "Taking averaged relative error for " << container->size() << " triangles for each dist. ratio value." << KEMField::endl; // field point - KEMThreeVector fP; + KThreeVector fP; // field and potential values - std::pair valQuad; - std::pair valAna; - std::pair valRwg; - std::pair valNum; + std::pair valQuad; + std::pair valAna; + std::pair valRwg; + std::pair valNum; // plot diff --git a/KEMField/Source/Tests/TestInverseDistance.cc b/KEMField/Source/Applications/Test/TestInverseDistance.cc similarity index 100% rename from KEMField/Source/Tests/TestInverseDistance.cc rename to KEMField/Source/Applications/Test/TestInverseDistance.cc diff --git a/KEMField/Source/Tests/TestKMessageInterface.cc b/KEMField/Source/Applications/Test/TestKMessageInterface.cc similarity index 100% rename from KEMField/Source/Tests/TestKMessageInterface.cc rename to KEMField/Source/Applications/Test/TestKMessageInterface.cc diff --git a/KEMField/Source/Tests/TestKSP1.cc b/KEMField/Source/Applications/Test/TestKSP1.cc similarity index 100% rename from KEMField/Source/Tests/TestKSP1.cc rename to KEMField/Source/Applications/Test/TestKSP1.cc diff --git a/KEMField/Source/Tests/TestKSP2.cc b/KEMField/Source/Applications/Test/TestKSP2.cc similarity index 100% rename from KEMField/Source/Tests/TestKSP2.cc rename to KEMField/Source/Applications/Test/TestKSP2.cc diff --git a/KEMField/Source/Tests/TestOpenCL.cc b/KEMField/Source/Applications/Test/TestOpenCL.cc similarity index 100% rename from KEMField/Source/Tests/TestOpenCL.cc rename to KEMField/Source/Applications/Test/TestOpenCL.cc diff --git a/KEMField/Source/Tests/TestOpenCLPlugin.cc b/KEMField/Source/Applications/Test/TestOpenCLPlugin.cc similarity index 98% rename from KEMField/Source/Tests/TestOpenCLPlugin.cc rename to KEMField/Source/Applications/Test/TestOpenCLPlugin.cc index cdbd6b76d..84f5c1b24 100644 --- a/KEMField/Source/Tests/TestOpenCLPlugin.cc +++ b/KEMField/Source/Applications/Test/TestOpenCLPlugin.cc @@ -227,8 +227,8 @@ int main(int /*argc*/, char** /*argv*/) KDirichletBoundary, KLineSegment>(); - w->SetP0(KEMThreeVector(-0.457222, 0.0504778, -0.51175)); - w->SetP1(KEMThreeVector(-0.463342, 0.0511534, -0.515712)); + w->SetP0(KThreeVector(-0.457222, 0.0504778, -0.51175)); + w->SetP1(KThreeVector(-0.463342, 0.0511534, -0.515712)); w->SetDiameter(0.0003); w->SetBoundaryValue(-900); diff --git a/KEMField/Source/Tests/TestPETSc.cc b/KEMField/Source/Applications/Test/TestPETSc.cc similarity index 100% rename from KEMField/Source/Tests/TestPETSc.cc rename to KEMField/Source/Applications/Test/TestPETSc.cc diff --git a/KEMField/Source/Tests/TestPETSc1.cc b/KEMField/Source/Applications/Test/TestPETSc1.cc similarity index 100% rename from KEMField/Source/Tests/TestPETSc1.cc rename to KEMField/Source/Applications/Test/TestPETSc1.cc diff --git a/KEMField/Source/Tests/TestPETSc2.cc b/KEMField/Source/Applications/Test/TestPETSc2.cc similarity index 100% rename from KEMField/Source/Tests/TestPETSc2.cc rename to KEMField/Source/Applications/Test/TestPETSc2.cc diff --git a/KEMField/Source/Tests/TestSVDSolver.cc b/KEMField/Source/Applications/Test/TestSVDSolver.cc similarity index 100% rename from KEMField/Source/Tests/TestSVDSolver.cc rename to KEMField/Source/Applications/Test/TestSVDSolver.cc diff --git a/KEMField/Source/Tests/TestSphereCapacitance.cc b/KEMField/Source/Applications/Test/TestSphereCapacitance.cc similarity index 99% rename from KEMField/Source/Tests/TestSphereCapacitance.cc rename to KEMField/Source/Applications/Test/TestSphereCapacitance.cc index d50dcc2b8..bd9353caf 100644 --- a/KEMField/Source/Tests/TestSphereCapacitance.cc +++ b/KEMField/Source/Applications/Test/TestSphereCapacitance.cc @@ -6,7 +6,7 @@ #include #include -#include "KElectrostaticBoundaryIntegratorOptions.hh" +#include "../Test/include/KElectrostaticBoundaryIntegratorOptions.hh" #include "KGRotatedObject.hh" #include "KGMesher.hh" diff --git a/KEMField/Source/Tests/TestSuperposition.cc b/KEMField/Source/Applications/Test/TestSuperposition.cc similarity index 99% rename from KEMField/Source/Tests/TestSuperposition.cc rename to KEMField/Source/Applications/Test/TestSuperposition.cc index 2691c02eb..7d34b9d54 100644 --- a/KEMField/Source/Tests/TestSuperposition.cc +++ b/KEMField/Source/Applications/Test/TestSuperposition.cc @@ -433,7 +433,7 @@ KBoundaryIntegralVector v2(surfaceContainer2,a field_numeric[0] = field.Potential(P); - KEMThreeVector f = field.ElectricField(P); + KThreeVector f = field.ElectricField(P); for (int j=0;j<3;j++) field_numeric[j+1] = f[j]; @@ -521,7 +521,7 @@ KBoundaryIntegralVector v2(surfaceContainer2,a field_numeric[0] = field.Potential(P); - KEMThreeVector f = field.ElectricField(P); + KThreeVector f = field.ElectricField(P); for (int j=0;j<3;j++) field_numeric[j+1] = f[j]; diff --git a/KEMField/Source/Tests/TestSymmetryGroups.cc b/KEMField/Source/Applications/Test/TestSymmetryGroups.cc similarity index 93% rename from KEMField/Source/Tests/TestSymmetryGroups.cc rename to KEMField/Source/Applications/Test/TestSymmetryGroups.cc index 843f71571..2d7deb456 100644 --- a/KEMField/Source/Tests/TestSymmetryGroups.cc +++ b/KEMField/Source/Applications/Test/TestSymmetryGroups.cc @@ -42,9 +42,9 @@ int main(int argc, char** argv) { double a = 1.5; double b = 1.3; - KEMThreeVector p0(0.,0.,-1.); - KEMThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); - KEMThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); + KThreeVector p0(0.,0.,-1.); + KThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); + KThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); double dirichletValue = 10.2; @@ -66,8 +66,8 @@ int main(int argc, char** argv) KEMField::cout<<"Before symmetry: "<AddReflectionThroughPlane(KEMField::KEMThreeVector(0.,0.,0.), - KEMField::KEMThreeVector(0.,0.,-1.)); + tg->AddReflectionThroughPlane(KGeoBag::KThreeVector(0.,0.,0.), + KGeoBag::KThreeVector(0.,0.,-1.)); KEMField::cout<<"After symmetry: "<SetBoundaryValue(1.); KPosition P(0,0,0); - KEMThreeVector field_1; - KEMThreeVector field_2; + KThreeVector field_1; + KThreeVector field_2; double max[4] = {0,0,0,0}; double min[4] = {1.e10,1.e10,1.e10,1.e10}; diff --git a/KEMField/Source/Tests/TestTypelists.cc b/KEMField/Source/Applications/Test/TestTypelists.cc similarity index 100% rename from KEMField/Source/Tests/TestTypelists.cc rename to KEMField/Source/Applications/Test/TestTypelists.cc diff --git a/KEMField/Source/Tests/TestVectorTypes.cc b/KEMField/Source/Applications/Test/TestVectorTypes.cc similarity index 86% rename from KEMField/Source/Tests/TestVectorTypes.cc rename to KEMField/Source/Applications/Test/TestVectorTypes.cc index ba955f8de..bba9ba75a 100644 --- a/KEMField/Source/Tests/TestVectorTypes.cc +++ b/KEMField/Source/Applications/Test/TestVectorTypes.cc @@ -3,8 +3,7 @@ #include #include -#include "KEMThreeVector.hh" -#include "KThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "TVector3.h" // This program tests speed of different classes for math. vectors, @@ -12,7 +11,6 @@ // // * std::vector containing TVector3 (ROOT) // * std::vector containing KThreeVector (Kassiopeia/KGeoBag) -// * std::vector containing KEMThreeVector (KEMField) // * double values in std::vector // * 1-dim. double array // @@ -48,8 +46,6 @@ int main() KThreeVector kasperVector; std::vector coKa; - KEMThreeVector kemVector; - std::vector coKe; double dblVector = 0.; (void) dblVector; @@ -66,8 +62,6 @@ int main() kasperVector.SetComponents( i, i*i, i*2. ); coKa.push_back( kasperVector ); - kemVector.SetComponents( i, i*i, i*2. ); - coKe.push_back( kemVector ); coDbl.push_back(i); coDbl.push_back(i*i); @@ -80,7 +74,6 @@ int main() std::cout << "std::vector size = " << coRo.size() << std::endl; std::cout << "std::vector size = " < size = " << coKe.size() << std::endl; std::cout << "std::vector size = " << coDbl.size() << std::endl; std::cout << "Items in double array = " << 3*N << std::endl << std::endl; @@ -90,7 +83,6 @@ int main() TVector3 rootCross; KThreeVector kasperCross; - KEMThreeVector kemCross; #ifdef USEHEAP double *dblCross = new double[3]; double *arrayCross = new double[3]; @@ -110,11 +102,6 @@ int main() kasperCross = coKa[l].Cross(coKa[l+1]); std::cout << "std::vector t = " << Time() << std::endl; - StartTimer(); - for( unsigned long l=0; l<(N-1); l++ ) - kemCross = coKe[l].Cross(coKe[l+1]); - std::cout << "std::vector t = " << Time() << std::endl; - StartTimer(); for( unsigned long l=0; l<(N-1); l++ ) { dblCross[0] = (coDbl[(l*3) + 1] * coDbl[( (l+1)*3 ) + 2]) - (coDbl[(l*3) + 2]*coDbl[( (l+1)*3 ) + 1]); @@ -135,7 +122,6 @@ int main() TVector3 rootSc; KThreeVector kasperSc; - KEMThreeVector kemSc; #ifdef USEHEAP double *dblSc = new double[3]; double *arraySc = new double[3]; @@ -155,11 +141,6 @@ int main() kasperSc = l*coKa[l]; std::cout << "std::vector t = " << Time() << std::endl; - StartTimer(); - for( unsigned long l=0; l t = " << Time() << std::endl; - StartTimer(); for( unsigned long l=0; l t = " << Time() << std::endl; - StartTimer(); - for( unsigned long l=0; l<(N-1); l++ ) - kemAdd = coKe[l] + coKe[l+1]; - std::cout << "std::vector t = " << Time() << std::endl; - StartTimer(); for( unsigned long l=0; l<(N-1); l++ ) { dblAdd[0] = coDbl[l*3]+coDbl[((l+1)*3)+0]; @@ -236,12 +211,6 @@ int main() std::cout << "std::vector t = " << Time() << std::endl; - StartTimer(); - for( unsigned long l=0; l t = " << Time() << std::endl; - - StartTimer(); for( unsigned long l=0; l #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KEMConstants.hh" #include "KEMCout.hh" @@ -18,9 +18,9 @@ int main(int /*argc*/, char** /*argv*/) { double a = 1.5; double b = 1.3; - KEMThreeVector p0(0.,0.,0.); - KEMThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); - KEMThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); + KThreeVector p0(0.,0.,0.); + KThreeVector n1(1./sqrt(2.),1./sqrt(2.),0.); + KThreeVector n2(1./sqrt(2.),-1./sqrt(2.),0.); double dirichletValue = 10.2; @@ -94,8 +94,8 @@ int main(int /*argc*/, char** /*argv*/) KRobinBoundary, KLineSegment>(); - w->SetP0(KEMThreeVector(0.,1.,0.)); - w->SetP1(KEMThreeVector(1.,0.,0.)); + w->SetP0(KThreeVector(0.,1.,0.)); + w->SetP1(KThreeVector(1.,0.,0.)); w->SetDiameter(1.e-4); w->SetNormalBoundaryFlux(3.3); w->SetSolution(12.6); diff --git a/KEMField/Source/Tests/TestZonalHarmonics.cc b/KEMField/Source/Applications/Test/TestZonalHarmonics.cc similarity index 96% rename from KEMField/Source/Tests/TestZonalHarmonics.cc rename to KEMField/Source/Applications/Test/TestZonalHarmonics.cc index 3d582405e..5207b322f 100644 --- a/KEMField/Source/Tests/TestZonalHarmonics.cc +++ b/KEMField/Source/Applications/Test/TestZonalHarmonics.cc @@ -7,7 +7,8 @@ #include #include -#include "KEMThreeVector.hh" +#include "KThreeMatrix_KEMField.hh" +#include "KThreeVector_KEMField.hh" #include "KEMConstants.hh" #include "KEMCout.hh" #include "KEMTicker.hh" @@ -29,19 +30,18 @@ #include "KZonalHarmonicContainer.hh" -#include "KEMThreeMatrix.hh" using namespace KEMField; template void ComputeEField(Solver&, KPosition&, - KEMThreeVector&); + KThreeVector&); template void ComputeBField(Solver&, KPosition&, - KEMThreeVector&); + KThreeVector&); int main(int /*argc*/, char** /*argv*/) { @@ -177,27 +177,27 @@ int main(int /*argc*/, char** /*argv*/) KPosition P; double phi[2]; - KEMThreeVector A[2],B[2],E[2]; + KThreeVector A[2],B[2],E[2]; KGradient Bp[2]; - KEMThreeVector E_Numeric; - KEMThreeVector B_Numeric; + KThreeVector E_Numeric; + KThreeVector B_Numeric; double deltaPhi = 0.; - KEMThreeVector deltaA,deltaB,deltaE; + KThreeVector deltaA,deltaB,deltaE; KGradient deltaBp; double deltaPhi_av = 0.; - KEMThreeVector deltaA_av,deltaB_av,deltaE_av; + KThreeVector deltaA_av,deltaB_av,deltaE_av; KGradient deltaBp_av; double deltaPhi2_av = 0.; - KEMThreeVector deltaA2_av,deltaB2_av,deltaE2_av; + KThreeVector deltaA2_av,deltaB2_av,deltaE2_av; KGradient deltaBp2_av; double deltaPhi_min = 0.; - KEMThreeVector deltaA_min,deltaB_min,deltaE_min; + KThreeVector deltaA_min,deltaB_min,deltaE_min; KGradient deltaBp_min; double deltaPhi_max = 0.; - KEMThreeVector deltaA_max,deltaB_max,deltaE_max; + KThreeVector deltaA_max,deltaB_max,deltaE_max; KGradient deltaBp_max; unsigned int nSamples = 1.e3; @@ -366,7 +366,7 @@ int main(int /*argc*/, char** /*argv*/) template void ComputeEField(Solver& s, KPosition& P, - KEMThreeVector& E) + KThreeVector& E) { static KDirection axis[3] = {KDirection(1.,0.,0.), KDirection(0.,1.,0.), @@ -382,14 +382,14 @@ void ComputeEField(Solver& s, template void ComputeBField(Solver& s, KPosition& P, - KEMThreeVector& B) + KThreeVector& B) { static KDirection axis[3] = {KDirection(1.,0.,0.), KDirection(0.,1.,0.), KDirection(0.,0.,1.)}; static double eps = 1.e-6; - KEMThreeVector partialA[3]; + KThreeVector partialA[3]; for (unsigned int i=0;i<3;i++) partialA[i] = (s.VectorPotential(P+eps*axis[i]) - diff --git a/KEMField/Source/Tests/include/KElectrostaticBoundaryIntegratorOptions.hh b/KEMField/Source/Applications/Test/include/KElectrostaticBoundaryIntegratorOptions.hh similarity index 80% rename from KEMField/Source/Tests/include/KElectrostaticBoundaryIntegratorOptions.hh rename to KEMField/Source/Applications/Test/include/KElectrostaticBoundaryIntegratorOptions.hh index beb83acd5..cbc02a484 100644 --- a/KEMField/Source/Tests/include/KElectrostaticBoundaryIntegratorOptions.hh +++ b/KEMField/Source/Applications/Test/include/KElectrostaticBoundaryIntegratorOptions.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_TESTS_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ -#define KEMFIELD_SOURCE_2_0_TESTS_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ +#ifndef KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ +#define KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ #include #include "KElectrostaticBoundaryIntegratorFactory.hh" @@ -44,4 +44,4 @@ static std::map integratorOptionList { } /* KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_TESTS_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ */ +#endif /* KELECTROSTATICBOUNDARYINTEGRATOROPTIONS_HH_ */ diff --git a/KEMField/Source/Tests/include/TestCubatureTriangleIntegrator.hh b/KEMField/Source/Applications/Test/include/TestCubatureTriangleIntegrator.hh similarity index 100% rename from KEMField/Source/Tests/include/TestCubatureTriangleIntegrator.hh rename to KEMField/Source/Applications/Test/include/TestCubatureTriangleIntegrator.hh diff --git a/KEMField/Source/Tests/include/TestRWGTriangleIntegrator.hh b/KEMField/Source/Applications/Test/include/TestRWGTriangleIntegrator.hh similarity index 100% rename from KEMField/Source/Tests/include/TestRWGTriangleIntegrator.hh rename to KEMField/Source/Applications/Test/include/TestRWGTriangleIntegrator.hh diff --git a/KEMField/Source/Applications/ApplicationFiles/.gitignore b/KEMField/Source/Applications/Tools/ApplicationFiles/.gitignore similarity index 100% rename from KEMField/Source/Applications/ApplicationFiles/.gitignore rename to KEMField/Source/Applications/Tools/ApplicationFiles/.gitignore diff --git a/KEMField/Source/Applications/Tools/CMakeLists.txt b/KEMField/Source/Applications/Tools/CMakeLists.txt new file mode 100644 index 000000000..634aeb0da --- /dev/null +++ b/KEMField/Source/Applications/Tools/CMakeLists.txt @@ -0,0 +1,119 @@ +# CMakeLists for KEMField/Applications/Tools +# Author: T.J. Corona, D. Hilk + +kasper_include_default_dirs() + +set (APPLICATIONS_LIBS + ${ROOT_LIBRARIES} + ${GSL_LIBRARIES} + ${Kommon_LIBRRIES} + ${KGeoBag_LIBRRIES} + KEMCore + KEMHashGenerator + KEMStructuredASCII + KEMMath + KEMSurfaces + KEMIO + KEMFileManipulation + KEMElectrostaticBoundaryIntegrals + KEMElectromagnets + KEMZHGenerator + KEMZHSolver + KEMVisualization + KFMMathUtilities + KGeoBagInterface + ) + +if (${PROJECT_NAME}_USE_ROOT) + kasper_external_include_directories( ${ROOT_INCLUDE_DIRS} ) + list (APPEND APPLICATIONS_LIBS + KEMRootPlugin + ) +endif (${PROJECT_NAME}_USE_ROOT) + +if (${PROJECT_NAME}_USE_OPENCL) + kasper_external_include_directories( ${OPENCL_INCLUDE_DIRS} ) + list (APPEND APPLICATIONS_LIBS + KEMOpenCLPlugin + ) +endif (${PROJECT_NAME}_USE_OPENCL) + +if (${PROJECT_NAME}_USE_PETSc) + list (APPEND APPLICATIONS_LIBS + KEMPETScPlugin + ) +endif (${PROJECT_NAME}_USE_PETSc) + +if (${PROJECT_NAME}_USE_VTK) + list (APPEND APPLICATIONS_LIBS KEMVTKPlugin ${Kommon_Vtk_LIBRARIES} ) +endif (${PROJECT_NAME}_USE_VTK) + +add_executable (KdbConverter + ${CMAKE_CURRENT_SOURCE_DIR}/KdbConverter.cc) +target_link_libraries (KdbConverter ${APPLICATIONS_LIBS} ) + +add_executable (TransferEMElement + ${CMAKE_CURRENT_SOURCE_DIR}/TransferEMElement.cc) +target_link_libraries (TransferEMElement ${APPLICATIONS_LIBS} ) + +add_executable (HashEMGeometry + ${CMAKE_CURRENT_SOURCE_DIR}/HashEMGeometry.cc) +target_link_libraries (HashEMGeometry ${APPLICATIONS_LIBS} ) + +add_executable (InspectEMFile + ${CMAKE_CURRENT_SOURCE_DIR}/InspectEMFile.cc) +target_link_libraries (InspectEMFile ${APPLICATIONS_LIBS} ) + +add_executable (WriteKbdToAscii + ${CMAKE_CURRENT_SOURCE_DIR}/WriteKbdToAscii.cc) +target_link_libraries (WriteKbdToAscii ${APPLICATIONS_LIBS} ) + +add_executable (WriteAsciiToPCD + ${CMAKE_CURRENT_SOURCE_DIR}/WriteAsciiToPCD.cc) +target_link_libraries (WriteAsciiToPCD ${APPLICATIONS_LIBS} ) + +kasper_install_executables ( + KdbConverter + TransferEMElement + HashEMGeometry + InspectEMFile + WriteKbdToAscii + WriteAsciiToPCD +) + +# VTK + +if (${PROJECT_NAME}_USE_VTK) + + add_executable (VisualizeEMGeometry + ${CMAKE_CURRENT_SOURCE_DIR}/VisualizeEMGeometry.cc) + target_link_libraries (VisualizeEMGeometry ${APPLICATIONS_LIBS} ) + + kasper_install_executables ( + VisualizeEMGeometry + ) + +install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ApplicationFiles + DESTINATION ${${PROJECT_NAME}_CONFIG_INSTALL_DIR} + PATTERN "*.gitignore" EXCLUDE +) + +endif (${PROJECT_NAME}_USE_VTK) + +#PCL Stuff +#cmake_minimum_required(VERSION 2.8 FATAL_ERROR) + +#project(greedy_projection) + +#find_package(PCL 1.2 REQUIRED) + +#include_directories(${PCL_INCLUDE_DIRS}) +#link_directories(${PCL_LIBRARY_DIRS}) +#add_definitions(${PCL_DEFINITIONS}) + +#add_executable (greedy_projection ${CMAKE_CURRENT_SOURCE_DIR}/greedy_projection.cpp) +#target_link_libraries (greedy_projection ${PCL_LIBRARIES}) + +#kasper_install_executables ( +# greedy_projection +# ) diff --git a/KEMField/Source/Applications/HashEMGeometry.cc b/KEMField/Source/Applications/Tools/HashEMGeometry.cc similarity index 100% rename from KEMField/Source/Applications/HashEMGeometry.cc rename to KEMField/Source/Applications/Tools/HashEMGeometry.cc diff --git a/KEMField/Source/Applications/InspectEMFile.cc b/KEMField/Source/Applications/Tools/InspectEMFile.cc similarity index 100% rename from KEMField/Source/Applications/InspectEMFile.cc rename to KEMField/Source/Applications/Tools/InspectEMFile.cc diff --git a/KEMField/Source/Applications/KdbConverter.cc b/KEMField/Source/Applications/Tools/KdbConverter.cc similarity index 100% rename from KEMField/Source/Applications/KdbConverter.cc rename to KEMField/Source/Applications/Tools/KdbConverter.cc diff --git a/KEMField/Source/Applications/TransferEMElement.cc b/KEMField/Source/Applications/Tools/TransferEMElement.cc similarity index 100% rename from KEMField/Source/Applications/TransferEMElement.cc rename to KEMField/Source/Applications/Tools/TransferEMElement.cc diff --git a/KEMField/Source/Applications/VisualizeEMGeometry.cc b/KEMField/Source/Applications/Tools/VisualizeEMGeometry.cc similarity index 100% rename from KEMField/Source/Applications/VisualizeEMGeometry.cc rename to KEMField/Source/Applications/Tools/VisualizeEMGeometry.cc diff --git a/KEMField/Source/Applications/WriteAsciiToPCD.cc b/KEMField/Source/Applications/Tools/WriteAsciiToPCD.cc similarity index 100% rename from KEMField/Source/Applications/WriteAsciiToPCD.cc rename to KEMField/Source/Applications/Tools/WriteAsciiToPCD.cc diff --git a/KEMField/Source/Applications/WriteKbdToAscii.cc b/KEMField/Source/Applications/Tools/WriteKbdToAscii.cc similarity index 98% rename from KEMField/Source/Applications/WriteKbdToAscii.cc rename to KEMField/Source/Applications/Tools/WriteKbdToAscii.cc index 520182d6f..83a44cd41 100644 --- a/KEMField/Source/Applications/WriteKbdToAscii.cc +++ b/KEMField/Source/Applications/Tools/WriteKbdToAscii.cc @@ -171,6 +171,7 @@ int main(int argc, char* argv[]) "\tAvailable options:\n" "\t -h, --help (shows this message and exits)\n" "\t -f, --file (specify the input kbd file)\n" + "\t -n, --name (required; name of surface container, e.g from InspectEMFile)\n" "\n"; static struct option longOptions[] = { diff --git a/KEMField/Source/Applications/greedy_projection.cpp b/KEMField/Source/Applications/Tools/greedy_projection.cpp similarity index 100% rename from KEMField/Source/Applications/greedy_projection.cpp rename to KEMField/Source/Applications/Tools/greedy_projection.cpp diff --git a/KEMField/Source/Plugins/Bindings/CMakeLists.txt b/KEMField/Source/Bindings/CMakeLists.txt similarity index 92% rename from KEMField/Source/Plugins/Bindings/CMakeLists.txt rename to KEMField/Source/Bindings/CMakeLists.txt index 11093027b..90c3df8c8 100644 --- a/KEMField/Source/Plugins/Bindings/CMakeLists.txt +++ b/KEMField/Source/Bindings/CMakeLists.txt @@ -1,23 +1,18 @@ -# CMakeLists for KEMField/Plugins/Bindings +# CMakeLists for KEMField/Source/Bindings # W. Gosda -#@PROJECT_NAME@_USE_KOMMON is defined in Core/CMakeLists.txt +#${PROJECT_NAME}_USE_KOMMON is defined in Core/CMakeLists.txt -cmake_dependent_option (@PROJECT_NAME@_USE_KOMMON_BINDINGS "Use Kommon Bindings" ON - "@PROJECT_NAME@_USE_KOMMON" OFF) - -if (@PROJECT_NAME@_USE_KOMMON_BINDINGS) +# Bindings need to be linked against Kommon, KMessage and KGeoBag add_cflag (KEMFIELD_USE_KOMMON_BINDINGS) -set( @PROJECT_NAME@_USE_KMESSAGE ON CACHE BOOL "(Required)" FORCE ) -set( @PROJECT_NAME@_USE_KGEOBAG ON CACHE BOOL "(Required)" FORCE ) - kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Utilities/include) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Fields/Electric/include) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/include) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/FieldSolvers/Electric/include) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/include) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/FieldSolvers/Magnetic/include) + kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/KGeoBag/include) set (KEMFIELD_BINDINGS_HEADERFILES # ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/include/KEMToolbox.hh @@ -38,6 +33,8 @@ set( @PROJECT_NAME@_USE_KGEOBAG ON CACHE BOOL "(Required)" FORCE ) ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh + ${CMAKE_CURRENT_SOURCE_DIR}/KGeoBag/include/KGBEMBuilder.hh + ${CMAKE_CURRENT_SOURCE_DIR}/KGeoBag/include/KGElectromagnetBuilder.hh ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh @@ -78,6 +75,8 @@ set( @PROJECT_NAME@_USE_KGEOBAG ON CACHE BOOL "(Required)" FORCE ) ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc + ${CMAKE_CURRENT_SOURCE_DIR}/KGeoBag/src/KGBEMBuilder.cc + ${CMAKE_CURRENT_SOURCE_DIR}/KGeoBag/src/KGElectromagnetBuilder.cc ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc ${CMAKE_CURRENT_SOURCE_DIR}/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc @@ -98,18 +97,19 @@ set( @PROJECT_NAME@_USE_KGEOBAG ON CACHE BOOL "(Required)" FORCE ) ${CMAKE_CURRENT_SOURCE_DIR}/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc ) - if (@PROJECT_NAME@_USE_VTK) + if (${PROJECT_NAME}_USE_VTK) list (APPEND KEMFIELD_BINDINGS_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh ) list (APPEND KEMFIELD_BINDINGS_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc ) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) add_library (KEMFieldBindings SHARED ${KEMFIELD_BINDINGS_SOURCEFILES}) target_link_libraries (KEMFieldBindings ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} KEMFieldElectricBoundaryIntegrators KEMFieldsElectric KEMFieldsMagnetic @@ -117,10 +117,8 @@ set( @PROJECT_NAME@_USE_KGEOBAG ON CACHE BOOL "(Required)" FORCE ) KEMMagneticFieldSolvers KEMMath KEMVTKPart2 - KEMGeoBagPlugin + KGeoBagInterface ) kasper_install_headers (${KEMFIELD_BINDINGS_HEADERFILES}) kasper_install_libraries (KEMFieldBindings) - -endif (@PROJECT_NAME@_USE_KOMMON_BINDINGS) diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh similarity index 67% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh index c079f32f6..c4df9caf7 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolverBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_INCLUDE_KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_INCLUDE_KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ +#ifndef KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ +#define KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ #include "KComplexElement.hh" #include "KCachedChargeDensitySolver.hh" @@ -37,4 +37,4 @@ inline bool KCachedChargeDensitySolverBuilder::AddAttribute( KContainer* aContai } // katrin -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_INCLUDE_KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ */ +#endif /* KCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh similarity index 83% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh index fdade2264..dfcc712d0 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KElectrostaticBoundaryIntegratorAttributeProcessor.hh @@ -5,12 +5,12 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ +#ifndef KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ +#define KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ +#include "KEMBindingsMessage.hh" #include "KElectrostaticBoundaryIntegratorPolicy.hh" #include "KContainer.hh" -#include "KEMBindingsMessage.hh" #include "KEMSimpleException.hh" namespace katrin { @@ -75,4 +75,4 @@ bool AddElectrostaticIntegrator(XType* reciever,KContainer* aContainer) } /* katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ */ +#endif /* KELECTROSTATICBOUNDARYINTEGRATORATTRIBUTEPROCESSOR_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh similarity index 71% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh index c9832cbdb..bd12bbef7 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ +#ifndef KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ +#define KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ #include "KComplexElement.hh" #include "KExplicitSuperpositionCachedChargeDensitySolver.hh" @@ -40,4 +40,4 @@ inline bool KExplicitSuperpositionCachedChargeDensitySolverBuilder::AddElement( } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ */ +#endif /* KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh similarity index 68% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh index cac525340..aedb0a826 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponentBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ +#ifndef KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ +#define KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ #include "KComplexElement.hh" #include "KExplicitSuperpositionSolutionComponent.hh" @@ -39,4 +39,4 @@ inline bool KExplicitSuperpositionSolutionComponentBuilder::AddAttribute( KConta } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ */ +#endif /* KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENTBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh similarity index 90% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh index 3d4ba75b3..eedafabfd 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFMElectrostaticParametersBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFMELECTROSTATICPARAMETERSBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFMELECTROSTATICPARAMETERSBUILDER_HH_ +#ifndef KFMELECTROSTATICPARAMETERSBUILDER_HH_ +#define KFMELECTROSTATICPARAMETERSBUILDER_HH_ #include"KComplexElement.hh" #include"KFMElectrostaticParameters.hh" @@ -113,4 +113,4 @@ AddAttribute(KContainer* aContainer) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFMELECTROSTATICPARAMETERSBUILDER_HH_ */ +#endif /* KFMELECTROSTATICPARAMETERSBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh similarity index 91% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh index 7eea98c36..9fe7e2ac0 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KFastMultipoleMatrixGeneratorBuilder.hh @@ -5,13 +5,12 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ +#ifndef KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ +#define KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ +#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" #include "KComplexElement.hh" #include "KFastMultipoleMatrixGenerator.hh" -#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" - #include "KEMStreamableThreeVector.hh" namespace katrin { @@ -126,4 +125,4 @@ inline bool KFastMultipoleMatrixGeneratorBuilder:: } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ */ +#endif /* KFASTMULTIPOLEMATRIXGENERATORBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh similarity index 64% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh index 938243a52..c5b90995e 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolverBuilder.hh @@ -5,14 +5,14 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ +#ifndef KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ +#define KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ +#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" +#include "KEMBindingsMessage.hh" #include "KComplexElement.hh" #include "KGaussianEliminationChargeDensitySolver.hh" #include "KElectrostaticBoundaryIntegratorPolicy.hh" -#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" -#include "KEMBindingsMessage.hh" namespace katrin { @@ -32,4 +32,4 @@ bool KGaussianEliminationChargeDensitySolverBuilder::AddAttribute(KContainer* aC -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ */ +#endif /* KGAUSSIANELIMINATIONCHARGEDENSITYSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh similarity index 75% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh index 3cb5896fc..d03cf7888 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverBuilder.hh @@ -5,20 +5,19 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ +#ifndef KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ +#define KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ +#include "KKrylovSolverConfigurationReader.hh" +#include "KEMBindingsMessage.hh" +#include "KSmartPointerRelease.hh" #include "KKrylovChargeDensitySolver.hh" #include "KComplexElement.hh" #include "KBoundaryMatrixGenerator.hh" -#include "KEMBindingsMessage.hh" - -#include "KSmartPointerRelease.hh" #include "KEMStringUtils.hh" -#include "KKrylovSolverConfigurationReader.hh" namespace katrin { @@ -56,4 +55,4 @@ inline bool KKrylovChargeDensitySolverBuilder::End() { } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ */ +#endif /* KKRYLOVCHARGEDENSITYSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh similarity index 90% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh index 70ff5568a..efa187c1a 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOldBuilder.hh @@ -5,12 +5,12 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ +#ifndef KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ +#define KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ +#include "KFMElectrostaticParametersBuilder.hh" #include "KKrylovChargeDensitySolverOld.hh" #include "KComplexElement.hh" -#include "KFMElectrostaticParametersBuilder.hh" #include "KFMElectrostaticFastMultipoleBoundaryValueSolverConfiguration.hh" namespace katrin { @@ -132,4 +132,4 @@ inline bool KKrylovChargeDensitySolverOldBuilder:: } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ */ +#endif /* KKRYLOVCHARGEDENSITYSOLVEROLDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh similarity index 72% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh index 1e89bb44d..3066b85b5 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGeneratorBuilder.hh @@ -5,13 +5,13 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_PreconditionerGeneratorS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_PreconditionerGeneratorS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ +#ifndef KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ +#define KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ +#include "KKrylovSolverConfigurationReader.hh" +#include "KEMBindingsMessage.hh" #include "KComplexElement.hh" #include "KKrylovPreconditionerGenerator.hh" -#include "KEMBindingsMessage.hh" -#include "KKrylovSolverConfigurationReader.hh" namespace katrin { @@ -49,4 +49,4 @@ inline bool KKrylovPreconditionerGeneratorBuilder::End() { } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_PreconditionerGeneratorS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ */ +#endif /* KKRYLOVPRECONDITIONERGENERATORBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh similarity index 89% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh index 9e596b0a1..17a7b1b7b 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KKrylovSolverConfigurationReader.hh @@ -5,11 +5,11 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVSOLVERCONFIGURATIONREADER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVSOLVERCONFIGURATIONREADER_HH_ +#ifndef KKRYLOVSOLVERCONFIGURATIONREADER_HH_ +#define KKRYLOVSOLVERCONFIGURATIONREADER_HH_ -#include "KKrylovChargeDensitySolver.hh" #include "KSmartPointerRelease.hh" +#include "KKrylovChargeDensitySolver.hh" #include "KEMStringUtils.hh" namespace katrin { @@ -100,4 +100,4 @@ bool SetKrylovSolverConfiguration(KContainer& aContainer, ObjectType& fObject) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVSOLVERCONFIGURATIONREADER_HH_ */ +#endif /* KKRYLOVSOLVERCONFIGURATIONREADER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh similarity index 84% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh index abed5c1eb..cbf8ff849 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolverBuilder.hh @@ -5,12 +5,12 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ +#ifndef KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ +#define KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ +#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" #include "KComplexElement.hh" #include "KRobinHoodChargeDensitySolver.hh" -#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" namespace katrin { @@ -69,4 +69,4 @@ inline bool KRobinHoodChargeDensitySolverBuilder::AddAttribute( KContainer* aCon } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ */ +#endif /* KROBINHOODCHARGEDENSITYSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc similarity index 70% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc index a62004e3b..d2434573a 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KCachedChargeDensitySolverBuilder.cc @@ -5,10 +5,11 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ +#ifndef SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ +#define SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ #include "KCachedChargeDensitySolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; @@ -31,4 +32,4 @@ KElectrostaticBoundaryFieldBuilder::ComplexElement< KCachedChargeDensitySolver > -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_CHARGEDENSITYSOLVERS_SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ */ +#endif /* SRC_KCACHEDCHARGEDENSITYSOLVERBUILDER_CC_ */ diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc index 9561211e5..f51b84cc3 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionCachedChargeDensitySolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KExplicitSuperpositionCachedChargeDensitySolverBuilder.hh" + #include "KExplicitSuperpositionSolutionComponentBuilder.hh" #include "KElectrostaticBoundaryFieldBuilder.hh" diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KExplicitSuperpositionSolutionComponentBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KFMElectrostaticParametersBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KFMElectrostaticParametersBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KFMElectrostaticParametersBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KFMElectrostaticParametersBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KFastMultipoleMatrixGeneratorBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KFastMultipoleMatrixGeneratorBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KFastMultipoleMatrixGeneratorBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KFastMultipoleMatrixGeneratorBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc index cfd0dc7e3..920f304bd 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KGaussianEliminationChargeDensitySolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KGaussianEliminationChargeDensitySolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc index 65bac55e4..bc262c287 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KKrylovChargeDensitySolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc index 4cd873a49..d61dd09f9 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovChargeDensitySolverOldBuilder.cc @@ -6,9 +6,10 @@ */ #include "KKrylovChargeDensitySolverOldBuilder.hh" -#include "KFMElectrostaticParameters.hh" #include "KElectrostaticBoundaryFieldBuilder.hh" +#include "KFMElectrostaticParameters.hh" + using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc index 2d328246e..fdecb9cc3 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KKrylovPreconditionerGeneratorBuilder.cc @@ -6,6 +6,7 @@ */ #include "KKrylovPreconditionerGeneratorBuilder.hh" + #include "KKrylovChargeDensitySolverBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc rename to KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc index d19c16028..cd1cd3b21 100644 --- a/KEMField/Source/Plugins/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc +++ b/KEMField/Source/Bindings/ChargeDensitySolvers/Electric/src/KRobinHoodChargeDensitySolverBuilder.cc @@ -6,8 +6,9 @@ */ #include "KRobinHoodChargeDensitySolverBuilder.hh" -#include "KElectrostaticBoundaryFieldBuilder.hh" + #include +#include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh similarity index 88% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh rename to KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh index 9239b937b..6e17f1dea 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolverBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ +#ifndef KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ +#define KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ #include "KComplexElement.hh" #include "KElectricFastMultipoleFieldSolver.hh" @@ -99,4 +99,4 @@ inline bool KElectricFastMultipoleFieldSolverBuilder::AddAttribute( KContainer* } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ */ +#endif /* KELECTRICFASTMULTIPOLEFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh similarity index 90% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh rename to KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh index ead2b0483..55ca7e797 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KElectricZHFieldSolverBuilder.hh @@ -5,12 +5,12 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVERBUILDER_HH_ +#ifndef KELECTRICZHFIELDSOLVERBUILDER_HH_ +#define KELECTRICZHFIELDSOLVERBUILDER_HH_ +#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" #include "KComplexElement.hh" #include "KElectricZHFieldSolver.hh" -#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" namespace katrin { @@ -94,4 +94,4 @@ inline bool KElectricZHFieldSolverBuilder::AddAttribute( KContainer* aContainer } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVERBUILDER_HH_ */ +#endif /* KELECTRICZHFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh similarity index 80% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh rename to KEMField/Source/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh index fdd5387c1..00dae54bc 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KFMVTKElectrostaticTreeViewerBuilder.hh @@ -5,8 +5,8 @@ * Author: */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ +#ifndef KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ +#define KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ #include "KFMVTKElectrostaticTreeViewer.hh" #include "KComplexElement.hh" @@ -69,4 +69,4 @@ inline bool KFMVTKElectrostaticTreeViewerBuilder::End() } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ */ +#endif /* KFMVTKELECTROSTATICTREEVIEWERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh similarity index 68% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh rename to KEMField/Source/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh index e567d9e0b..8143a1db4 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolverBuilder.hh @@ -5,12 +5,12 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ +#ifndef KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ +#define KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ +#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" #include "KComplexElement.hh" #include "KIntegratingElectrostaticFieldSolver.hh" -#include "KElectrostaticBoundaryIntegratorAttributeProcessor.hh" namespace katrin { @@ -35,4 +35,4 @@ inline bool KIntegratingElectrostaticFieldSolverBuilder::AddAttribute( KContaine -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ */ +#endif /* KINTEGRATINGELECTROSTATICFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc index af2ced64c..028c2f038 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KElectricFastMultipoleFieldSolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc index 9b959071e..829692a8a 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KElectricZHFieldSolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KElectricZHFieldSolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc index 2f8f88a23..ef6ca9793 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KFMVTKElectrostaticTreeViewerBuilder.cc @@ -6,6 +6,7 @@ */ #include "KFMVTKElectrostaticTreeViewerBuilder.hh" + #include "KElectricFastMultipoleFieldSolverBuilder.hh" namespace katrin { diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc index 97bfb81fc..2d88558ba 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KIntegratingElectrostaticFieldSolverBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh new file mode 100644 index 000000000..377495ebc --- /dev/null +++ b/KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh @@ -0,0 +1,20 @@ +/* + * KIntegratingMagnetostaticFieldSolverBuilder.hh + * + * Created on: 28 Mar 2016 + * Author: wolfgang + */ + +#ifndef KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ +#define KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ + +#include "KComplexElement.hh" +#include "KIntegratingMagnetostaticFieldSolver.hh" +namespace katrin { + +typedef KComplexElement< KEMField::KIntegratingMagnetostaticFieldSolver > +KIntegratingMagnetostaticFieldSolverBuilder; + +} /* namespace katrin */ + +#endif /* KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh b/KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh similarity index 90% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh rename to KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh index fdf8f1a1a..931a576f2 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh +++ b/KEMField/Source/Bindings/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolverBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ +#ifndef KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ +#define KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ #include "KComplexElement.hh" #include "KZonalHarmonicMagnetostaticFieldSolver.hh" @@ -94,4 +94,4 @@ inline bool KZonalHarmonicMagnetostaticFieldSolverBuilder::AddAttribute( KContai } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ */ +#endif /* KZONALHARMONICMAGNETOSTATICFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc index 896229129..52d42c824 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KIntegratingMagnetostaticFieldSolverBuilder.hh" + #include "KStaticElectromagnetFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc b/KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc rename to KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc index aa34293b2..b6aec1416 100644 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc +++ b/KEMField/Source/Bindings/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolverBuilder.cc @@ -6,6 +6,7 @@ */ #include "KZonalHarmonicMagnetostaticFieldSolverBuilder.hh" + #include "KStaticElectromagnetFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh similarity index 61% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh index c4d9f6bec..7a294c619 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KBoundaryElementInfoDisplayBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ +#ifndef KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ +#define KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ #include "KBoundaryElementInfoDisplay.hh" #include "KComplexElement.hh" @@ -31,4 +31,4 @@ bool KBoundaryElementInfoDisplayBuilder::AddElement(KContainer*) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ */ +#endif /* KBOUNDARYELEMENTINFODISPLAYBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh similarity index 81% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh index 829bf1de1..06ab41fb8 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KElectricQuadrupoleFieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELDBUILDER_HH_ +#ifndef KELECTRICQUADRUPOLEFIELDBUILDER_HH_ +#define KELECTRICQUADRUPOLEFIELDBUILDER_HH_ #include "KComplexElement.hh" @@ -57,4 +57,4 @@ inline bool KElectricQuadrupoleFieldBuilder::AddAttribute( KContainer* aContaine } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELDBUILDER_HH_ */ +#endif /* KELECTRICQUADRUPOLEFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh similarity index 78% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh index cc1b19a03..62b3330fb 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldBuilder.hh @@ -5,18 +5,17 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ +#ifndef KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ +#define KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ +#include "KGElectrostaticBoundaryField.hh" #include "KEMBindingsMessage.hh" #include "KSmartPointerRelease.hh" #include "KComplexElement.hh" -#include "KElectrostaticBoundaryFieldWithKGeoBag.hh" -#include "KSmartPointerRelease.hh" namespace katrin { -typedef KComplexElement< KEMField::KElectrostaticBoundaryFieldWithKGeoBag> +typedef KComplexElement< KEMField::KGElectrostaticBoundaryField> KElectrostaticBoundaryFieldBuilder; template< > @@ -31,11 +30,11 @@ inline bool KElectrostaticBoundaryFieldBuilder::AddAttribute( KContainer* aConta } else if( aContainer->GetName() == "directory" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetDirectory ); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetDirectory ); } else if( aContainer->GetName() == "file" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetFile ); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetFile ); } else if( aContainer->GetName() == "system" ) { @@ -89,17 +88,17 @@ inline bool KElectrostaticBoundaryFieldBuilder::AddAttribute( KContainer* aConta { if( aContainer->AsReference< string >() == "none" ) { - fObject->SetSymmetry( KEMField::KElectrostaticBoundaryFieldWithKGeoBag::NoSymmetry ); + fObject->SetSymmetry( KEMField::KGElectrostaticBoundaryField::NoSymmetry ); return true; } if( aContainer->AsReference< string >() == "axial" ) { - fObject->SetSymmetry( KEMField::KElectrostaticBoundaryFieldWithKGeoBag::AxialSymmetry ); + fObject->SetSymmetry( KEMField::KGElectrostaticBoundaryField::AxialSymmetry ); return true; } if( aContainer->AsReference< string >() == "discrete_axial" ) { - fObject->SetSymmetry( KEMField::KElectrostaticBoundaryFieldWithKGeoBag::DiscreteAxialSymmetry ); + fObject->SetSymmetry( KEMField::KGElectrostaticBoundaryField::DiscreteAxialSymmetry ); return true; } BINDINGMSG( eWarning ) << "symmetry must be , , or " << eom; @@ -107,19 +106,19 @@ inline bool KElectrostaticBoundaryFieldBuilder::AddAttribute( KContainer* aConta } else if( aContainer->GetName() == "hash_masked_bits" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetHashMaskedBits ); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetHashMaskedBits ); } else if( aContainer->GetName() == "hash_threshold" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetHashThreshold ); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetHashThreshold ); } else if( aContainer->GetName() == "minimum_element_area" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetMinimumElementArea); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetMinimumElementArea); } else if( aContainer->GetName() == "maximum_element_aspect_ratio" ) { - aContainer->CopyTo( fObject, &KEMField::KElectrostaticBoundaryFieldWithKGeoBag::SetMaximumElementAspectRatio); + aContainer->CopyTo( fObject, &KEMField::KGElectrostaticBoundaryField::SetMaximumElementAspectRatio); } else return false; return true; @@ -183,4 +182,4 @@ inline bool KElectrostaticBoundaryFieldBuilder::End() { } // katrin -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ */ +#endif /* KELECTROSTATICBOUNDARYFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh similarity index 61% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh index ba704cf3c..188a03fd5 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticBoundaryFieldTimerBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ +#ifndef KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ +#define KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ #include "KComplexElement.hh" #include "KElectrostaticBoundaryFieldTimer.hh" @@ -31,4 +31,4 @@ bool KElectrostaticBoundaryFieldTimerBuilder::AddElement(KContainer*) } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ */ +#endif /* KELECTROSTATICBOUNDARYFIELDTIMERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticConstantFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticConstantFieldBuilder.hh similarity index 100% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticConstantFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticConstantFieldBuilder.hh diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh similarity index 93% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh index 14f1e4364..b884b0a05 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KElectrostaticPotentialmapBuilder.hh @@ -5,12 +5,11 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICPOTENTIALMAPBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICPOTENTIALMAPBUILDER_HH_ +#ifndef KELECTROSTATICPOTENTIALMAPBUILDER_HH_ +#define KELECTROSTATICPOTENTIALMAPBUILDER_HH_ -#include "KComplexElement.hh" #include "KEMBindingsMessage.hh" - +#include "KComplexElement.hh" #include "KEMStreamableThreeVector.hh" #include "KToolbox.h" @@ -175,9 +174,9 @@ namespace KEMField virtual double PotentialCore(const KPosition& /*P*/) const{ return std::numeric_limits::quiet_NaN(); } - virtual KEMThreeVector ElectricFieldCore(const KPosition& /*P*/) const { + virtual KThreeVector ElectricFieldCore(const KPosition& /*P*/) const { double nan = std::numeric_limits::quiet_NaN(); - return KEMThreeVector(nan,nan,nan); + return KThreeVector(nan,nan,nan); } }; class KElectrostaticPotentialmapCalculator{}; @@ -221,4 +220,4 @@ inline bool KElectrostaticPotentialmapCalculatorBuilder::End(){ #endif /* KEMFIELD_USE_VTK */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICPOTENTIALMAPBUILDER_HH_ */ +#endif /* KELECTROSTATICPOTENTIALMAPBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh similarity index 83% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh index ede02c078..f9117b7b9 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KInducedAzimuthalElectricFieldBuilder.hh @@ -5,14 +5,14 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ +#ifndef KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ +#define KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ +#include "KEMBindingsMessage.hh" #include "KComplexElement.hh" #include "KInducedAzimuthalElectricField.hh" #include "KRampedMagneticField.hh" #include "KToolbox.h" -#include "KEMBindingsMessage.hh" namespace katrin { @@ -50,4 +50,4 @@ typedef KComplexElement< KEMField::KInducedAzimuthalElectricField > KInducedAzim } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ */ +#endif /* KINDUCEDAZIMUTHALELECTRICFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh similarity index 91% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh index a09bf59c5..1060e577f 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KRampedElectric2FieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELDBUILDER_HH_ +#ifndef KRAMPEDELECTRIC2FIELDBUILDER_HH_ +#define KRAMPEDELECTRIC2FIELDBUILDER_HH_ #include "KComplexElement.hh" #include "KRampedElectric2Field.hh" @@ -96,4 +96,4 @@ inline bool KRampedElectric2FieldBuilder::AddAttribute( KContainer* aContainer ) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELDBUILDER_HH_ */ +#endif /* KRAMPEDELECTRIC2FIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh similarity index 89% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh index 5f6455b7b..ea6a9aff1 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KRampedElectricFieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELDBUILDER_HH_ +#ifndef KRAMPEDELECTRICFIELDBUILDER_HH_ +#define KRAMPEDELECTRICFIELDBUILDER_HH_ #include "KRampedElectricField.hh" #include "KComplexElement.hh" @@ -87,4 +87,4 @@ inline bool KRampedElectricFieldBuilder::AddAttribute( KContainer* aContainer ) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELDBUILDER_HH_ */ +#endif /* KRAMPEDELECTRICFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh b/KEMField/Source/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh similarity index 81% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh rename to KEMField/Source/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh index 58505951b..2e1ced6d2 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Electric/include/KVTKViewerVisitorBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KVTKVIEWERVISITORBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KVTKVIEWERVISITORBUILDER_HH_ +#ifndef KVTKVIEWERVISITORBUILDER_HH_ +#define KVTKVIEWERVISITORBUILDER_HH_ #include "KVTKViewerAsBoundaryFieldVisitor.hh" #include "KComplexElement.hh" @@ -63,4 +63,4 @@ inline bool KVTKViewerVisitorBuilder::AddAttribute( KContainer* aContainer ) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KVTKVIEWERVISITORBUILDER_HH_ */ +#endif /* KVTKVIEWERVISITORBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KBoundaryElementInfoDisplayBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KBoundaryElementInfoDisplayBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KBoundaryElementInfoDisplayBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KBoundaryElementInfoDisplayBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectricQuadrupoleFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KElectricQuadrupoleFieldBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectricQuadrupoleFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KElectricQuadrupoleFieldBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc similarity index 90% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc index 7863c50fa..aa636f375 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldBuilder.cc @@ -4,6 +4,7 @@ * Created on: 17 Jun 2015 * Author: wolfgang */ +#include "KEMToolboxBuilder.hh" #include "KElectrostaticBoundaryFieldBuilder.hh" #include "KEMToolboxBuilder.hh" @@ -18,7 +19,7 @@ KElectrostaticBoundaryFieldBuilder::~KComplexElement() } STATICINT sKEMToolBoxBuilder = - KEMToolboxBuilder::ComplexElement< KElectrostaticBoundaryFieldWithKGeoBag >( "electrostatic_field" ); + KEMToolboxBuilder::ComplexElement< KGElectrostaticBoundaryField >( "electrostatic_field" ); STATICINT sKElectrostaticBoundaryFieldBuilder = KElectrostaticBoundaryFieldBuilder::Attribute( "name" ) + diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc index 2ee79b49b..b0072a70d 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticBoundaryFieldTimerBuilder.cc @@ -6,6 +6,7 @@ */ #include "KElectrostaticBoundaryFieldTimerBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc similarity index 94% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc index 57d97b263..a6f66de22 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticConstantFieldBuilder.cc @@ -1,3 +1,4 @@ +#include "KEMToolboxBuilder.hh" #include "KElectrostaticConstantFieldBuilder.hh" #include "KEMToolboxBuilder.hh" diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc similarity index 96% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc index 33b459975..4d26ac04a 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KElectrostaticPotentialmapBuilder.cc @@ -6,9 +6,10 @@ */ #include "KElectrostaticPotentialmapBuilder.hh" -#include "KElectrostaticConstantFieldBuilder.hh" + #include "KElectricQuadrupoleFieldBuilder.hh" #include "KElectrostaticBoundaryFieldBuilder.hh" +#include "KElectrostaticConstantFieldBuilder.hh" #include "KEMToolboxBuilder.hh" using namespace KEMField; @@ -53,7 +54,7 @@ STATICINT sKElectrostaticPotentialmapCalculatorStructure = KElectrostaticPotentialmapCalculatorBuilder:: ComplexElement< KElectricQuadrupoleField >( "field_electric_quadrupole" ) + KElectrostaticPotentialmapCalculatorBuilder:: - ComplexElement< KElectrostaticBoundaryFieldWithKGeoBag >( "field_electrostatic" ); + ComplexElement< KGElectrostaticBoundaryField >( "field_electrostatic" ); STATICINT sKElectrostaticPotentialmapCalculator = KEMToolboxBuilder::ComplexElement< KElectrostaticPotentialmapCalculator >( "electric_potentialmap_calculator" ); diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc index 2e3c6ec39..a76a841c4 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KInducedAzimuthalElectricFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KInducedAzimuthalElectricFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc index 67bc21738..4b1a0a9e1 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KRampedElectric2FieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KRampedElectric2FieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc index 5eb9f396e..a5efeb9fa 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KRampedElectricFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KRampedElectricFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc b/KEMField/Source/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc rename to KEMField/Source/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc index 8b18ae11f..1f38b798b 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Electric/src/KVTKViewerVisitorBuilder.cc @@ -6,6 +6,7 @@ */ #include "KVTKViewerVisitorBuilder.hh" + #include "KElectrostaticBoundaryFieldBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh similarity index 77% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh index de0056471..59d4f79b6 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticDipoleFieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELDBUILDER_HH_ +#ifndef KMAGNETICDIPOLEFIELDBUILDER_HH_ +#define KMAGNETICDIPOLEFIELDBUILDER_HH_ #include "KComplexElement.hh" #include "KMagneticDipoleField.hh" @@ -45,4 +45,4 @@ inline bool KMagneticDipoleFieldBuilder::AddAttribute( KContainer* aContainer ) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELDBUILDER_HH_ */ +#endif /* KMAGNETICDIPOLEFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh similarity index 85% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh index 76bef4b1f..03786e0cb 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagneticSuperpositionFieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ +#ifndef KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ +#define KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ #include "KComplexElement.hh" #include "KMagneticSuperpositionField.hh" @@ -80,4 +80,4 @@ inline bool KMagneticSuperpositionFieldBuilder::AddElement( KContainer* aContain } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ */ +#endif /* KMAGNETICSUPERPOSITIONFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh similarity index 72% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh index d167d2c1c..399611bfa 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticConstantFieldBuilder.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ +#ifndef KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ +#define KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ #include "KComplexElement.hh" #include "KMagnetostaticConstantField.hh" @@ -41,4 +41,4 @@ inline bool KSFieldMagneticConstantBuilder::AddAttribute( KContainer* aContainer } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ */ +#endif /* KMAGNETOSTATICCONSTANTFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh similarity index 91% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh index 59a007768..7be0e7530 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KMagnetostaticFieldmapBuilder.hh @@ -5,12 +5,11 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELDMAPBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELDMAPBUILDER_HH_ +#ifndef KMAGNETOSTATICFIELDMAPBUILDER_HH_ +#define KMAGNETOSTATICFIELDMAPBUILDER_HH_ -#include "KComplexElement.hh" #include "KEMBindingsMessage.hh" - +#include "KComplexElement.hh" #include "KEMStreamableThreeVector.hh" #include "KToolbox.h" @@ -172,13 +171,13 @@ namespace KEMField { class KMagnetostaticFieldmap : public KMagnetostaticField { - virtual KEMThreeVector MagneticPotentialCore(const KPosition& /*P*/) const { + virtual KThreeVector MagneticPotentialCore(const KPosition& /*P*/) const { double nan = std::numeric_limits::quiet_NaN(); - return KEMThreeVector(nan,nan,nan); + return KThreeVector(nan,nan,nan); } - virtual KEMThreeVector MagneticFieldCore(const KPosition& /*P*/) const { + virtual KThreeVector MagneticFieldCore(const KPosition& /*P*/) const { double nan = std::numeric_limits::quiet_NaN(); - return KEMThreeVector(nan,nan,nan); + return KThreeVector(nan,nan,nan); } virtual KGradient MagneticGradientCore(const KPosition& /*P*/) const { double nan = std::numeric_limits::quiet_NaN(); @@ -226,4 +225,4 @@ inline bool KMagnetostaticFieldmapCalculatorBuilder::End(){ #endif /* KEMFIELD_USE_VTK */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELDMAPBUILDER_HH_ */ +#endif /* KMAGNETOSTATICFIELDMAPBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh similarity index 90% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh index 63ffc42f6..314338277 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KRampedMagneticFieldBuilder.hh @@ -5,13 +5,13 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELDBUILDER_HH_ +#ifndef KRAMPEDMAGNETICFIELDBUILDER_HH_ +#define KRAMPEDMAGNETICFIELDBUILDER_HH_ +#include "KEMBindingsMessage.hh" #include "KRampedMagneticField.hh" #include "KComplexElement.hh" #include "KToolbox.h" -#include "KEMBindingsMessage.hh" namespace katrin { @@ -87,4 +87,4 @@ inline bool KRampedMagneticFieldBuilder::AddAttribute( KContainer* aContainer ) } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELDBUILDER_HH_ */ +#endif /* KRAMPEDMAGNETICFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh b/KEMField/Source/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh similarity index 89% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh rename to KEMField/Source/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh index 6c356646d..a5b10a789 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh +++ b/KEMField/Source/Bindings/Fields/Magnetic/include/KStaticElectromagnetFieldBuilder.hh @@ -5,17 +5,17 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELDBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELDBUILDER_HH_ +#ifndef KSTATICELECTROMAGNETFIELDBUILDER_HH_ +#define KSTATICELECTROMAGNETFIELDBUILDER_HH_ -#include "KComplexElement.hh" -#include "KStaticElectromagnetFieldWithKGeoBag.hh" +#include "KGStaticElectromagnetField.hh" #include "KEMBindingsMessage.hh" #include "KSmartPointerRelease.hh" +#include "KComplexElement.hh" namespace katrin { -typedef KComplexElement< KEMField::KStaticElectromagnetFieldWithKGeoBag > KStaticElectromagnetFieldBuilder; +typedef KComplexElement< KEMField::KGStaticElectromagnetField > KStaticElectromagnetFieldBuilder; template< > inline bool KStaticElectromagnetFieldBuilder::AddAttribute( KContainer* aContainer ) @@ -127,4 +127,4 @@ typedef KComplexElement< KEMField::KStaticElectromagnetFieldWithKGeoBag > KStati } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELDBUILDER_HH_ */ +#endif /* KSTATICELECTROMAGNETFIELDBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc index 106dfa3e8..a34cd614d 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagneticDipoleFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KMagneticDipoleFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KMagneticSuperpositionFieldBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc index 41f26d7ab..11e443e73 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticConstantFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KMagnetostaticConstantFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc index edfe5367a..53732fd6e 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Magnetic/src/KMagnetostaticFieldmapBuilder.cc @@ -6,8 +6,9 @@ */ #include "KMagnetostaticFieldmapBuilder.hh" -#include "KMagnetostaticConstantFieldBuilder.hh" + #include "KMagneticDipoleFieldBuilder.hh" +#include "KMagnetostaticConstantFieldBuilder.hh" #include "KStaticElectromagnetFieldBuilder.hh" #include "KEMToolboxBuilder.hh" diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc index 80c38e09e..cc1b0a152 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Magnetic/src/KRampedMagneticFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KRampedMagneticFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; diff --git a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc b/KEMField/Source/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc similarity index 89% rename from KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc rename to KEMField/Source/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc index ebd56c07e..6804e2960 100644 --- a/KEMField/Source/Plugins/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc +++ b/KEMField/Source/Bindings/Fields/Magnetic/src/KStaticElectromagnetFieldBuilder.cc @@ -6,6 +6,7 @@ */ #include "KStaticElectromagnetFieldBuilder.hh" + #include "KEMToolboxBuilder.hh" using namespace KEMField; @@ -27,5 +28,5 @@ STATICINT sKStaticElectromagnetFieldStructure = KStaticElectromagnetFieldBuilder::Attribute< string >( "spaces" ); STATICINT sKStaticElectromagnetField = - KEMToolboxBuilder::ComplexElement< KStaticElectromagnetFieldWithKGeoBag >( "electromagnet_field" ); + KEMToolboxBuilder::ComplexElement< KGStaticElectromagnetField >( "electromagnet_field" ); } /* namespace katrin */ diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGBEMBuilder.hh b/KEMField/Source/Bindings/KGeoBag/include/KGBEMBuilder.hh similarity index 99% rename from KEMField/Source/Plugins/KGeoBag/include/KGBEMBuilder.hh rename to KEMField/Source/Bindings/KGeoBag/include/KGBEMBuilder.hh index 87911661f..261aa01c7 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KGBEMBuilder.hh +++ b/KEMField/Source/Bindings/KGeoBag/include/KGBEMBuilder.hh @@ -2,7 +2,6 @@ #define KGELECTRODEBUILDER_HH_ #include "KGBEM.hh" - #include "KTagged.h" namespace KGeoBag diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGElectromagnetBuilder.hh b/KEMField/Source/Bindings/KGeoBag/include/KGElectromagnetBuilder.hh similarity index 100% rename from KEMField/Source/Plugins/KGeoBag/include/KGElectromagnetBuilder.hh rename to KEMField/Source/Bindings/KGeoBag/include/KGElectromagnetBuilder.hh diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGBEMBuilder.cc b/KEMField/Source/Bindings/KGeoBag/src/KGBEMBuilder.cc similarity index 99% rename from KEMField/Source/Plugins/KGeoBag/src/KGBEMBuilder.cc rename to KEMField/Source/Bindings/KGeoBag/src/KGBEMBuilder.cc index 31118125e..acb49fe8b 100644 --- a/KEMField/Source/Plugins/KGeoBag/src/KGBEMBuilder.cc +++ b/KEMField/Source/Bindings/KGeoBag/src/KGBEMBuilder.cc @@ -1,4 +1,5 @@ #include "KGBEMBuilder.hh" + #include "KGInterfaceBuilder.hh" using namespace KGeoBag; diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGElectromagnetBuilder.cc b/KEMField/Source/Bindings/KGeoBag/src/KGElectromagnetBuilder.cc similarity index 100% rename from KEMField/Source/Plugins/KGeoBag/src/KGElectromagnetBuilder.cc rename to KEMField/Source/Bindings/KGeoBag/src/KGElectromagnetBuilder.cc diff --git a/KEMField/Source/Plugins/Bindings/Utilities/include/KEMBindingsMessage.hh b/KEMField/Source/Bindings/Utilities/include/KEMBindingsMessage.hh similarity index 100% rename from KEMField/Source/Plugins/Bindings/Utilities/include/KEMBindingsMessage.hh rename to KEMField/Source/Bindings/Utilities/include/KEMBindingsMessage.hh diff --git a/KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolbox.hh b/KEMField/Source/Bindings/Utilities/include/KEMToolbox.hh similarity index 100% rename from KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolbox.hh rename to KEMField/Source/Bindings/Utilities/include/KEMToolbox.hh diff --git a/KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolboxBuilder.hh b/KEMField/Source/Bindings/Utilities/include/KEMToolboxBuilder.hh similarity index 100% rename from KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolboxBuilder.hh rename to KEMField/Source/Bindings/Utilities/include/KEMToolboxBuilder.hh diff --git a/KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolboxHelper.hh b/KEMField/Source/Bindings/Utilities/include/KEMToolboxHelper.hh similarity index 73% rename from KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolboxHelper.hh rename to KEMField/Source/Bindings/Utilities/include/KEMToolboxHelper.hh index da8ff5d79..1f69ba2ca 100644 --- a/KEMField/Source/Plugins/Bindings/Utilities/include/KEMToolboxHelper.hh +++ b/KEMField/Source/Bindings/Utilities/include/KEMToolboxHelper.hh @@ -5,11 +5,11 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_UTILITIES_INCLUDE_KEMTOOLBOXHELPER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_UTILITIES_INCLUDE_KEMTOOLBOXHELPER_HH_ +#ifndef KEMTOOLBOXHELPER_HH_ +#define KEMTOOLBOXHELPER_HH_ -#include "KContainer.hh" #include "KEMToolbox.hh" +#include "KContainer.hh" namespace katrin { @@ -32,4 +32,4 @@ bool tryLoadAs(KContainer* aContainer){ } /* namespace katrin */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_UTILITIES_INCLUDE_KEMTOOLBOXHELPER_HH_ */ +#endif /* KEMTOOLBOXHELPER_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Utilities/include/KSmartPointerRelease.hh b/KEMField/Source/Bindings/Utilities/include/KSmartPointerRelease.hh similarity index 78% rename from KEMField/Source/Plugins/Bindings/Utilities/include/KSmartPointerRelease.hh rename to KEMField/Source/Bindings/Utilities/include/KSmartPointerRelease.hh index b87c5eeb8..89b6a1c16 100644 --- a/KEMField/Source/Plugins/Bindings/Utilities/include/KSmartPointerRelease.hh +++ b/KEMField/Source/Bindings/Utilities/include/KSmartPointerRelease.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_TOOLBOX_KSMARTPOINTERRELEASE_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_TOOLBOX_KSMARTPOINTERRELEASE_HH_ +#ifndef KSMARTPOINTERRELEASE_HH_ +#define KSMARTPOINTERRELEASE_HH_ #include "KSmartPointer.hh" #include "KContainer.hh" @@ -39,4 +39,4 @@ KEMField::KSmartPointer ReleaseToSmartPtr( } // katrin -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_TOOLBOX_KSMARTPOINTERRELEASE_HH_ */ +#endif /* KSMARTPOINTERRELEASE_HH_ */ diff --git a/KEMField/Source/Plugins/Bindings/Utilities/src/KEMBindingsMessage.cc b/KEMField/Source/Bindings/Utilities/src/KEMBindingsMessage.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/Utilities/src/KEMBindingsMessage.cc rename to KEMField/Source/Bindings/Utilities/src/KEMBindingsMessage.cc diff --git a/KEMField/Source/Plugins/Bindings/Utilities/src/KEMToolbox.cc b/KEMField/Source/Bindings/Utilities/src/KEMToolbox.cc similarity index 100% rename from KEMField/Source/Plugins/Bindings/Utilities/src/KEMToolbox.cc rename to KEMField/Source/Bindings/Utilities/src/KEMToolbox.cc diff --git a/KEMField/Source/Plugins/Bindings/Utilities/src/KEMToolboxBuilder.cc b/KEMField/Source/Bindings/Utilities/src/KEMToolboxBuilder.cc similarity index 70% rename from KEMField/Source/Plugins/Bindings/Utilities/src/KEMToolboxBuilder.cc rename to KEMField/Source/Bindings/Utilities/src/KEMToolboxBuilder.cc index 4593a63ae..8dc716631 100644 --- a/KEMField/Source/Plugins/Bindings/Utilities/src/KEMToolboxBuilder.cc +++ b/KEMField/Source/Bindings/Utilities/src/KEMToolboxBuilder.cc @@ -5,6 +5,7 @@ * Author: gosda */ #include "KEMToolboxBuilder.hh" +#include "KElementProcessor.hh" #include "KRoot.h" namespace katrin { @@ -17,5 +18,8 @@ KEMToolboxBuilder::~KComplexElement() STATICINT sKEMRoot = KRootBuilder::ComplexElement< KEMRoot >( "kemfield" ); +STATICINT sKEMRootCompat = + KElementProcessor::ComplexElement< KEMRoot >( "kemfield" ); + } //katrin diff --git a/KEMField/Source/BoundaryIntegrals/Core/include/KBoundaryMatrixGenerator.hh b/KEMField/Source/BoundaryIntegrals/Core/include/KBoundaryMatrixGenerator.hh index b8024f9ab..ca59c3fdb 100644 --- a/KEMField/Source/BoundaryIntegrals/Core/include/KBoundaryMatrixGenerator.hh +++ b/KEMField/Source/BoundaryIntegrals/Core/include/KBoundaryMatrixGenerator.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_CORE_INCLUDE_KBOUNDARYMATRIXGENERATOR_HH_ -#define KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_CORE_INCLUDE_KBOUNDARYMATRIXGENERATOR_HH_ +#ifndef KBOUNDARYMATRIXGENERATOR_HH_ +#define KBOUNDARYMATRIXGENERATOR_HH_ #include "KSmartPointer.hh" #include "KSquareMatrix.hh" @@ -29,4 +29,4 @@ public: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_CORE_INCLUDE_KBOUNDARYMATRIXGENERATOR_HH_ */ +#endif /* KBOUNDARYMATRIXGENERATOR_HH_ */ diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticConicSectionIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticConicSectionIntegrator.hh index 3ffb0fb7b..22e644d2f 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticConicSectionIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticConicSectionIntegrator.hh @@ -19,7 +19,7 @@ namespace KEMField ~KElectrostaticAnalyticConicSectionIntegrator() {} double Potential( const KConicSection* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KConicSection* source, const KPosition& P ) const; + KThreeVector ElectricField( const KConicSection* source, const KPosition& P ) const; using KElectrostaticElementIntegrator::Potential; using KElectrostaticElementIntegrator::ElectricField; }; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticLineSegmentIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticLineSegmentIntegrator.hh index fcf7f066f..83f6e6a96 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticLineSegmentIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticLineSegmentIntegrator.hh @@ -19,7 +19,7 @@ namespace KEMField ~KElectrostaticAnalyticLineSegmentIntegrator() {} double Potential( const KLineSegment* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KLineSegment* source, const KPosition& P ) const; + KThreeVector ElectricField( const KLineSegment* source, const KPosition& P ) const; using KElectrostaticElementIntegrator::Potential; using KElectrostaticElementIntegrator::ElectricField; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRectangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRectangleIntegrator.hh index bcb9b5b93..98186fdf6 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRectangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRectangleIntegrator.hh @@ -20,7 +20,7 @@ namespace KEMField ~KElectrostaticAnalyticRectangleIntegrator() {} double Potential( const KRectangle* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRectangle* source, const KPosition& P ) const; + KThreeVector ElectricField( const KRectangle* source, const KPosition& P ) const; using KElectrostaticElementIntegrator::Potential; using KElectrostaticElementIntegrator::ElectricField; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRingIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRingIntegrator.hh index 296333574..06e20ab9b 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRingIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticRingIntegrator.hh @@ -21,7 +21,7 @@ namespace KEMField ~KElectrostaticAnalyticRingIntegrator() {} double Potential( const KRing* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRing* source, const KPosition& P ) const; + KThreeVector ElectricField( const KRing* source, const KPosition& P ) const; using KElectrostaticElementIntegrator::Potential; using KElectrostaticElementIntegrator::ElectricField; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticTriangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticTriangleIntegrator.hh index 9c1bede88..0e8a43786 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticTriangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/include/KElectrostaticAnalyticTriangleIntegrator.hh @@ -22,7 +22,7 @@ namespace KEMField double Potential( const KTriangle* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KTriangle* source, const KPosition& P ) const; + KThreeVector ElectricField( const KTriangle* source, const KPosition& P ) const; using KElectrostaticElementIntegrator::Potential; using KElectrostaticElementIntegrator::ElectricField; private: diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticConicSectionIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticConicSectionIntegrator.cc index e1242640b..85e0d86eb 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticConicSectionIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticConicSectionIntegrator.cc @@ -114,7 +114,7 @@ double KElectrostaticAnalyticConicSectionIntegrator::Potential(const KConicSecti } -KEMThreeVector KElectrostaticAnalyticConicSectionIntegrator::ElectricField(const KConicSection* source,const KPosition& P) const +KThreeVector KElectrostaticAnalyticConicSectionIntegrator::ElectricField(const KConicSection* source,const KPosition& P) const { static const double ln4=1.386294361119890; @@ -205,7 +205,7 @@ KEMThreeVector KElectrostaticAnalyticConicSectionIntegrator::ElectricField(const double Er = 1./(KEMConstants::Pi*KEMConstants::Eps0)*q[0]; double Ez = 1./(KEMConstants::Pi*KEMConstants::Eps0)*q[1]; - KEMThreeVector field; + KThreeVector field; field[2] = Ez; if (par[1]<1.e-14) diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticLineSegmentIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticLineSegmentIntegrator.cc index 3573cb9b4..c9a3139ae 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticLineSegmentIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticLineSegmentIntegrator.cc @@ -51,7 +51,7 @@ double KElectrostaticAnalyticLineSegmentIntegrator::Potential(const KLineSegment } -KEMThreeVector KElectrostaticAnalyticLineSegmentIntegrator::ElectricField(const KLineSegment* source,const KPosition& P) const +KThreeVector KElectrostaticAnalyticLineSegmentIntegrator::ElectricField(const KLineSegment* source,const KPosition& P) const { double L = (source->GetP1()-source->GetP0()).Magnitude(); double Da = (source->GetP0()-P).Magnitude(); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRectangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRectangleIntegrator.cc index a6ab0ee25..9281a8028 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRectangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRectangleIntegrator.cc @@ -25,7 +25,7 @@ namespace KEMField double KElectrostaticAnalyticRectangleIntegrator::Potential(const KRectangle* source, const KPosition& P) const { - KEMThreeVector p = P - source->GetP0(); + KThreeVector p = P - source->GetP0(); double uP = p.Dot(source->GetN1()); double vP = p.Dot(source->GetN2()); double w = p.Dot(source->GetN3()); @@ -44,10 +44,10 @@ double KElectrostaticAnalyticRectangleIntegrator::Potential(const KRectangle* so return I/(4.*M_PI*KEMConstants::Eps0); } -KEMThreeVector KElectrostaticAnalyticRectangleIntegrator::ElectricField(const KRectangle* source, +KThreeVector KElectrostaticAnalyticRectangleIntegrator::ElectricField(const KRectangle* source, const KPosition& P) const { - KEMThreeVector p = P - source->GetP0(); + KThreeVector p = P - source->GetP0(); double uP = p.Dot(source->GetN1()); double vP = p.Dot(source->GetN2()); double w = p.Dot(source->GetN3()); @@ -60,7 +60,7 @@ KEMThreeVector KElectrostaticAnalyticRectangleIntegrator::ElectricField(const KR double prefac = 1./(4.*KEMConstants::Pi*KEMConstants::Eps0); - KEMThreeVector field_local(0.,0.,0.); + KThreeVector field_local(0.,0.,0.); field_local[0] = prefac*EFieldLocalXY(xmin,xmax,ymin,ymax,w); field_local[1] = prefac*EFieldLocalXY(ymin,ymax,xmin,xmax,w); @@ -95,7 +95,7 @@ KEMThreeVector KElectrostaticAnalyticRectangleIntegrator::ElectricField(const KR field_local[2] =prefac*sign_z*fabs(EFieldLocalZ(xmin,xmax,ymax,ymin,w)); } - KEMThreeVector field(0.,0.,0.); + KThreeVector field(0.,0.,0.); for (unsigned int i=0;i<3;i++) field[i] = (source->GetN1()[i]*field_local[0] + diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRingIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRingIntegrator.cc index dc1f92fcf..bca2f5794 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRingIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticRingIntegrator.cc @@ -38,7 +38,7 @@ double KElectrostaticAnalyticRingIntegrator::Potential(const KRing* source,const } -KEMThreeVector KElectrostaticAnalyticRingIntegrator::ElectricField(const KRing* source,const KPosition& P) const +KThreeVector KElectrostaticAnalyticRingIntegrator::ElectricField(const KRing* source,const KPosition& P) const { double par[7]; @@ -50,7 +50,7 @@ KEMThreeVector KElectrostaticAnalyticRingIntegrator::ElectricField(const KRing* double c = 1./(par[3]*2.*KEMConstants::Pi*KEMConstants::Pi*KEMConstants::Eps0); - KEMThreeVector field; + KThreeVector field; field[2] = c*EFieldZFromChargedRing(P,par); double Er = c*EFieldRFromChargedRing(P,par); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticTriangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticTriangleIntegrator.cc index 9f9c9b646..c4379a010 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticTriangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Analytic/src/KElectrostaticAnalyticTriangleIntegrator.cc @@ -91,7 +91,7 @@ double KElectrostaticAnalyticTriangleIntegrator::Potential(const KTriangle* sour return I/(4.*M_PI*KEMConstants::Eps0); } -KEMThreeVector KElectrostaticAnalyticTriangleIntegrator +KThreeVector KElectrostaticAnalyticTriangleIntegrator ::ElectricField(const KTriangle* source, const KPosition& P) const { @@ -102,8 +102,8 @@ ::ElectricField(const KTriangle* source, double b_loc[2]; double u_loc[2]; double z_sign; - KEMThreeVector local_field; - KEMThreeVector field; + KThreeVector local_field; + KThreeVector field; double dist = (source->Centroid()-P).Magnitude(); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegrator.hh index ef96cc047..1fe767583 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegrator.hh @@ -60,12 +60,12 @@ namespace KEMField void SetTriangleIntegrator( KSmartPointer > triangleIntegrator ); double Potential( const KTriangle* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KTriangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P) const; + KThreeVector ElectricField( const KTriangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P) const; double Potential( const KTriangleGroup* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KTriangleGroup* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KTriangleGroup* source, const KPosition& P) const; + KThreeVector ElectricField( const KTriangleGroup* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KTriangleGroup* source, const KPosition& P) const; private: KSmartPointer > fTriangleIntegrator; @@ -77,12 +77,12 @@ namespace KEMField void SetRectangleIntegrator( KSmartPointer > RectangleIntegrator ); double Potential( const KRectangle* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRectangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P) const; + KThreeVector ElectricField( const KRectangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P) const; double Potential( const KRectangleGroup* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRectangleGroup* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KRectangleGroup* source, const KPosition& P) const; + KThreeVector ElectricField( const KRectangleGroup* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KRectangleGroup* source, const KPosition& P) const; private: KSmartPointer > fRectangleIntegrator; @@ -94,12 +94,12 @@ namespace KEMField void SetLineSegmentIntegrator( KSmartPointer > LineSegmentIntegrator ); double Potential( const KLineSegment* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KLineSegment* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P) const; + KThreeVector ElectricField( const KLineSegment* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P) const; double Potential( const KLineSegmentGroup* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KLineSegmentGroup* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KLineSegmentGroup* source, const KPosition& P) const; + KThreeVector ElectricField( const KLineSegmentGroup* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KLineSegmentGroup* source, const KPosition& P) const; private: KSmartPointer > fLineSegmentIntegrator; @@ -111,12 +111,12 @@ namespace KEMField void SetConicSectionIntegrator( KSmartPointer > ConicSectionIntegrator ); double Potential( const KConicSection* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KConicSection* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KConicSection* source, const KPosition& P) const; + KThreeVector ElectricField( const KConicSection* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KConicSection* source, const KPosition& P) const; double Potential( const KConicSectionGroup* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KConicSectionGroup* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KConicSectionGroup* source, const KPosition& P) const; + KThreeVector ElectricField( const KConicSectionGroup* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KConicSectionGroup* source, const KPosition& P) const; private: KSmartPointer > fConicSectionIntegrator; @@ -128,12 +128,12 @@ namespace KEMField void SetRingIntegrator( KSmartPointer > RingIntegrator ); double Potential( const KRing* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRing* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KRing* source, const KPosition& P) const; + KThreeVector ElectricField( const KRing* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KRing* source, const KPosition& P) const; double Potential( const KRingGroup* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRingGroup* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KRingGroup* source, const KPosition& P) const; + KThreeVector ElectricField( const KRingGroup* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KRingGroup* source, const KPosition& P) const; private: KSmartPointer > fRingIntegrator; @@ -221,13 +221,18 @@ namespace KEMField } else { - KEMThreeVector field = this->ElectricField(&source, - fTarget->GetShape()->Centroid()); - fValue = field.Dot(fTarget->GetShape()->Normal()); - double dist = (source.Centroid() - - fTarget->GetShape()->Centroid()).Magnitude(); - if (dist<1.e-12) - fValue *= fBoundaryVisitor.Prefactor(); + double dist = (source.Centroid() - fTarget->GetShape()->Centroid()).Magnitude(); + + if( dist>=1.e-12 ) { + KThreeVector field = this->ElectricField(&source,fTarget->GetShape()->Centroid()); + fValue = field.Dot(fTarget->GetShape()->Normal()); + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axialsymmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + fValue = fBoundaryVisitor.Prefactor()/(2.*KEMConstants::Eps0); + } } } } diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegratorFactory.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegratorFactory.hh index 692299542..08dee808f 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegratorFactory.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticBoundaryIntegratorFactory.hh @@ -1,12 +1,12 @@ /* - * EBIFactory.hh + * KElectrostaticBoundaryIntegratorFactory.hh * * Created on: 26 Aug 2016 * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_CORE_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ -#define KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_CORE_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ +#ifndef KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ +#define KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ #include "KElectrostaticBoundaryIntegrator.hh" #include @@ -44,4 +44,4 @@ using KEBIFactory = KElectrostaticBoundaryIntegratorFactory; } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_CORE_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ */ +#endif /* KELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ */ diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticElementIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticElementIntegrator.hh index 5c0151a0d..b0813baf4 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticElementIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/include/KElectrostaticElementIntegrator.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KELECTROSTATICELEMENTINTEGRATOR_HH_ -#define KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KELECTROSTATICELEMENTINTEGRATOR_HH_ +#ifndef KELECTROSTATICELEMENTINTEGRATOR_HH_ +#define KELECTROSTATICELEMENTINTEGRATOR_HH_ namespace KEMField { @@ -17,12 +17,12 @@ class KElectrostaticElementIntegrator public: virtual ~KElectrostaticElementIntegrator(){}; virtual double Potential( const Shape* source, const KPosition& P ) const = 0; - virtual KEMThreeVector ElectricField( const Shape* source, const KPosition& P) const = 0; - virtual std::pair ElectricFieldAndPotential( const Shape* source, const KPosition& P) const; + virtual KThreeVector ElectricField( const Shape* source, const KPosition& P) const = 0; + virtual std::pair ElectricFieldAndPotential( const Shape* source, const KPosition& P) const; virtual double Potential( const KSymmetryGroup* source, const KPosition& P ) const; - virtual KEMThreeVector ElectricField( const KSymmetryGroup* source, const KPosition& P ) const; - virtual std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P) const; + virtual KThreeVector ElectricField( const KSymmetryGroup* source, const KPosition& P ) const; + virtual std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P) const; private: typedef typename KSymmetryGroup::ShapeCIt ShapeGroupCIt; }; @@ -32,7 +32,7 @@ private: template -inline std::pair KElectrostaticElementIntegrator< +inline std::pair KElectrostaticElementIntegrator< Shape>::ElectricFieldAndPotential(const Shape* source, const KPosition& P) const { @@ -50,23 +50,23 @@ inline double KElectrostaticElementIntegrator::Potential( } template -inline KEMThreeVector KElectrostaticElementIntegrator::ElectricField( +inline KThreeVector KElectrostaticElementIntegrator::ElectricField( const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for ( ShapeGroupCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } template -inline std::pair KElectrostaticElementIntegrator< +inline std::pair KElectrostaticElementIntegrator< Shape>::ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( ShapeGroupCIt it=source->begin(); it!=source->end(); ++it ) { @@ -80,4 +80,4 @@ Shape>::ElectricFieldAndPotential( } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KELECTROSTATICELEMENTINTEGRATOR_HH_ */ +#endif /* KELECTROSTATICELEMENTINTEGRATOR_HH_ */ diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/src/KElectrostaticBoundaryIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/src/KElectrostaticBoundaryIntegrator.cc index f09ed107b..732c8ce79 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/src/KElectrostaticBoundaryIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Core/src/KElectrostaticBoundaryIntegrator.cc @@ -108,13 +108,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fTriangleIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KTriangle* source, const KPosition& P) const { return fTriangleIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KTriangle* source, const KPosition& P) const { return fTriangleIntegrator->ElectricFieldAndPotential(source,P); @@ -126,13 +126,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fTriangleIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KTriangleGroup* source, const KPosition& P) const { return fTriangleIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KTriangleGroup* source, const KPosition& P) const { return fTriangleIntegrator->ElectricFieldAndPotential(source,P); @@ -156,13 +156,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fRectangleIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KRectangle* source, const KPosition& P) const { return fRectangleIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KRectangle* source, const KPosition& P) const { return fRectangleIntegrator->ElectricFieldAndPotential(source,P); @@ -174,13 +174,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fRectangleIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KRectangleGroup* source, const KPosition& P) const { return fRectangleIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KRectangleGroup* source, const KPosition& P) const { return fRectangleIntegrator->ElectricFieldAndPotential(source,P); @@ -204,13 +204,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fLineSegmentIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KLineSegment* source, const KPosition& P) const { return fLineSegmentIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P) const { return fLineSegmentIntegrator->ElectricFieldAndPotential(source,P); @@ -222,13 +222,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fLineSegmentIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KLineSegmentGroup* source, const KPosition& P) const { return fLineSegmentIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KLineSegmentGroup* source, const KPosition& P) const { return fLineSegmentIntegrator->ElectricFieldAndPotential(source,P); @@ -252,13 +252,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fConicSectionIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KConicSection* source, const KPosition& P) const { return fConicSectionIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KConicSection* source, const KPosition& P) const { return fConicSectionIntegrator->ElectricFieldAndPotential(source,P); @@ -270,13 +270,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fConicSectionIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KConicSectionGroup* source, const KPosition& P) const { return fConicSectionIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KConicSectionGroup* source, const KPosition& P) const { return fConicSectionIntegrator->ElectricFieldAndPotential(source,P); @@ -301,13 +301,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fRingIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KRing* source, const KPosition& P) const { return fRingIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KRing* source, const KPosition& P) const { return fRingIntegrator->ElectricFieldAndPotential(source,P); @@ -319,13 +319,13 @@ double KElectrostaticBoundaryIntegrator::Potential( return fRingIntegrator->Potential(source,P); } -KEMThreeVector KElectrostaticBoundaryIntegrator::ElectricField( +KThreeVector KElectrostaticBoundaryIntegrator::ElectricField( const KRingGroup* source, const KPosition& P) const { return fRingIntegrator->ElectricField(source,P); } -std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( +std::pair KElectrostaticBoundaryIntegrator::ElectricFieldAndPotential( const KRingGroup* source, const KPosition& P) const { return fRingIntegrator->ElectricFieldAndPotential(source,P); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureRectangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureRectangleIntegrator.hh index 8405ab07a..616a87bdf 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureRectangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureRectangleIntegrator.hh @@ -31,18 +31,18 @@ namespace KEMField double Potential_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const; - KEMThreeVector ElectricField_RectNP( const double* data, const KPosition& P, + KThreeVector ElectricField_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const; - std::pair ElectricFieldAndPotential_RectNP( const double* source, const KPosition& P, + std::pair ElectricFieldAndPotential_RectNP( const double* source, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights) const; double Potential( const KRectangle* source, const KPosition& P ) const; - KEMThreeVector ElectricField( const KRectangle* source, const KPosition& P ) const; - std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; + KThreeVector ElectricField( const KRectangle* source, const KPosition& P ) const; + std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureTriangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureTriangleIntegrator.hh index cdf5153eb..9e1ebbb14 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureTriangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticCubatureTriangleIntegrator.hh @@ -29,18 +29,18 @@ namespace KEMField double Potential_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const; - KEMThreeVector ElectricField_TriNP( const double* data, const KPosition& P, + KThreeVector ElectricField_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const; - std::pair ElectricFieldAndPotential_TriNP( const double* data, const KPosition& P, + std::pair ElectricFieldAndPotential_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights) const; double Potential(const KTriangle* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; + KThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticQuadratureLineSegmentIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticQuadratureLineSegmentIntegrator.hh index 3c5dd91a1..bf81da5b7 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticQuadratureLineSegmentIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/include/KElectrostaticQuadratureLineSegmentIntegrator.hh @@ -21,18 +21,18 @@ namespace KEMField double Potential_nNodes( const double* data, const KPosition& P, const unsigned short halfNoNodes, const double* nodes, const double* weights ) const; - KEMThreeVector ElectricField_nNodes( const double* data, const KPosition& P, + KThreeVector ElectricField_nNodes( const double* data, const KPosition& P, const unsigned short halfNoNodes, const double* nodes, const double* weights ) const; - std::pair ElectricFieldAndPotential_nNodes(const double* data, const KPosition& P, + std::pair ElectricFieldAndPotential_nNodes(const double* data, const KPosition& P, const unsigned short halfNoNodes, const double* nodes, const double* weights ) const; double Potential(const KLineSegment* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KLineSegment* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const; + KThreeVector ElectricField(const KLineSegment* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureRectangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureRectangleIntegrator.cc index 9b6041aba..17eac2436 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureRectangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureRectangleIntegrator.cc @@ -372,7 +372,7 @@ double KElectrostaticCubatureRectangleIntegrator::Potential_RectNP( const double return (prefac*finalSum); } -KEMThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const +KThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const { const double area = data[0] * data[1]; const double prefac = area * KEMConstants::OneOverFourPiEps0; @@ -430,10 +430,10 @@ KEMThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField_RectNP( finalSum[i] = prefac * finalSum[i]; } - return KEMThreeVector( finalSum[0], finalSum[1], finalSum[2] ); + return KThreeVector( finalSum[0], finalSum[1], finalSum[2] ); } -std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const +std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential_RectNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const { const double area = data[0] * data[1]; const double prefac = area * KEMConstants::OneOverFourPiEps0; @@ -493,7 +493,7 @@ std::pair KElectrostaticCubatureRectangleIntegrator::Elec finalSum[i] = prefac*finalSum[i]; } - return std::make_pair( KEMThreeVector(finalSum[0],finalSum[1],finalSum[2]), finalSum[3] ); + return std::make_pair( KThreeVector(finalSum[0],finalSum[1],finalSum[2]), finalSum[3] ); } double KElectrostaticCubatureRectangleIntegrator::Potential(const KRectangle* source, const KPosition& P) const @@ -556,7 +556,7 @@ double KElectrostaticCubatureRectangleIntegrator::Potential(const KRectangle* so return KElectrostaticRWGRectangleIntegrator::Potential( source, P ); } -KEMThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField(const KRectangle* source, const KPosition& P) const +KThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField(const KRectangle* source, const KPosition& P) const { // save geometry info on rectangle into array, same convention as OpenCL implementation @@ -616,7 +616,7 @@ KEMThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField(const KR return KElectrostaticRWGRectangleIntegrator::ElectricField( source, P ); } -std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential(const KRectangle* source, const KPosition& P) const +std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential(const KRectangle* source, const KPosition& P) const { // save geometry info on rectangle into array, same convention as OpenCL implementation @@ -684,19 +684,19 @@ double KElectrostaticCubatureRectangleIntegrator::Potential(const KSymmetryGroup return potential; } -KEMThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticCubatureRectangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticCubatureRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureTriangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureTriangleIntegrator.cc index 819cd0599..39c32d5df 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureTriangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticCubatureTriangleIntegrator.cc @@ -310,7 +310,7 @@ double KElectrostaticCubatureTriangleIntegrator::Potential_TriNP( const double* return (prefac*finalSum); } -KEMThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const +KThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const { // triangle area as defined in class KTriangle: A = 0.5*fA*fB*fN1.Cross(fN2).Magnitude() const double area = 0.5*data[0]*data[1]*sqrt( @@ -373,10 +373,10 @@ KEMThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField_TriNP( co finalSum[i] = prefac * finalSum[i]; } - return KEMThreeVector( finalSum[0], finalSum[1], finalSum[2] ); + return KThreeVector( finalSum[0], finalSum[1], finalSum[2] ); } -std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const +std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential_TriNP( const double* data, const KPosition& P, const unsigned short noPoints, double* Q, const double* weights ) const { // triangle area as defined in class KTriangle: A = 0.5*fA*fB*fN1.Cross(fN2).Magnitude() const double area = 0.5*data[0]*data[1]*sqrt( @@ -441,7 +441,7 @@ std::pair KElectrostaticCubatureTriangleIntegrator::Elec finalSum[i] = prefac*finalSum[i]; } - return std::make_pair( KEMThreeVector(finalSum[0],finalSum[1],finalSum[2]), finalSum[3] ); + return std::make_pair( KThreeVector(finalSum[0],finalSum[1],finalSum[2]), finalSum[3] ); } double KElectrostaticCubatureTriangleIntegrator::Potential(const KTriangle* source, const KPosition& P) const @@ -518,7 +518,7 @@ double KElectrostaticCubatureTriangleIntegrator::Potential(const KTriangle* sour return KElectrostaticRWGTriangleIntegrator::Potential( source, P ); } -KEMThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField(const KTriangle* source, const KPosition& P) const +KThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField(const KTriangle* source, const KPosition& P) const { // save geometry info on triangle into array, same convention as OpenCL implementation @@ -592,7 +592,7 @@ KEMThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField(const KTr return KElectrostaticRWGTriangleIntegrator::ElectricField( source, P ); } -std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential(const KTriangle* source, const KPosition& P) const +std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential(const KTriangle* source, const KPosition& P) const { // save geometry info on triangle into array, same convention as OpenCL implementation @@ -674,19 +674,19 @@ double KElectrostaticCubatureTriangleIntegrator::Potential(const KSymmetryGroup< return potential; } -KEMThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticCubatureTriangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for( KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it ) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticCubatureTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticQuadratureLineSegmentIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticQuadratureLineSegmentIntegrator.cc index 567411e07..5a1a5d571 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticQuadratureLineSegmentIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Numeric/src/KElectrostaticQuadratureLineSegmentIntegrator.cc @@ -63,7 +63,7 @@ double KElectrostaticQuadratureLineSegmentIntegrator::Potential_nNodes( const do return (0.25*oneOverEps0*sum*data[6]); } -KEMThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField_nNodes( const double* data, const KPosition& P, +KThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField_nNodes( const double* data, const KPosition& P, const unsigned short halfNoNodes, const double* nodes, const double* weights ) const { const double lineCenter[3] = { @@ -125,10 +125,10 @@ KEMThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField_nNod EField[l] = prefac * sum[l]; } - return KEMThreeVector( EField[0], EField[1], EField[2] ); + return KThreeVector( EField[0], EField[1], EField[2] ); } -std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential_nNodes( const double* data, const KPosition& P, +std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential_nNodes( const double* data, const KPosition& P, const unsigned short halfNoNodes, const double* nodes, const double* weights ) const { const double lineCenter[3] = { @@ -195,7 +195,7 @@ std::pair KElectrostaticQuadratureLineSegmentIntegrator:: EField[l] = prefac * sumField[l]; } Phi = prefac * sumPhi; - return std::make_pair( KEMThreeVector(EField[0], EField[1], EField[2]), Phi ); + return std::make_pair( KThreeVector(EField[0], EField[1], EField[2]), Phi ); } double KElectrostaticQuadratureLineSegmentIntegrator::Potential(const KLineSegment* source,const KPosition& P) const @@ -243,7 +243,7 @@ double KElectrostaticQuadratureLineSegmentIntegrator::Potential(const KLineSegme } -KEMThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField(const KLineSegment* source,const KPosition& P) const +KThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField(const KLineSegment* source,const KPosition& P) const { // save geometry info on triangle into array, same convention as OpenCL implementation @@ -287,7 +287,7 @@ KEMThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField(cons return KElectrostaticAnalyticLineSegmentIntegrator::ElectricField( source, P ); } -std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential(const KLineSegment* source, const KPosition& P) const +std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential(const KLineSegment* source, const KPosition& P) const { // save geometry info on triangle into array, same convention as OpenCL implementation @@ -339,19 +339,19 @@ double KElectrostaticQuadratureLineSegmentIntegrator::Potential(const KSymmetryG return potential; } -KEMThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticQuadratureLineSegmentIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const +std::pair KElectrostaticQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGRectangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGRectangleIntegrator.hh index 112cce253..ad772d09f 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGRectangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGRectangleIntegrator.hh @@ -22,12 +22,12 @@ public: ~KElectrostaticRWGRectangleIntegrator() {} double Potential(const KRectangle* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KRectangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; + KThreeVector ElectricField(const KRectangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: double LogArgTaylor( const double sMin, const double dist ) const; @@ -35,10 +35,10 @@ private: double IqLPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; - KEMThreeVector IqLField( const double* data, const double* P, + KThreeVector IqLField( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; - std::pair IqLFieldAndPotential( const double* data, const double* P, + std::pair IqLFieldAndPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; KSolidAngle solidAngle; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGTriangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGTriangleIntegrator.hh index 3e7631050..01d50de18 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGTriangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/include/KElectrostaticRWGTriangleIntegrator.hh @@ -22,12 +22,12 @@ public: ~KElectrostaticRWGTriangleIntegrator() {} double Potential(const KTriangle* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; + KThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: double LogArgTaylor( const double sMin, const double dist ) const; @@ -35,10 +35,10 @@ private: double IqLPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; - KEMThreeVector IqLField( const double* data, const double* P, + KThreeVector IqLField( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; - std::pair IqLFieldAndPotential( const double* data, const double* P, + std::pair IqLFieldAndPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGRectangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGRectangleIntegrator.cc index dcd5a2cca..d066c815f 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGRectangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGRectangleIntegrator.cc @@ -255,7 +255,7 @@ double KElectrostaticRWGRectangleIntegrator::IqLPotential( const double* data, c return iL; } -KEMThreeVector KElectrostaticRWGRectangleIntegrator::IqLField( const double* data, const double* P, +KThreeVector KElectrostaticRWGRectangleIntegrator::IqLField( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const { // computes first term of equation (74) in the case q = -1 @@ -487,10 +487,10 @@ KEMThreeVector KElectrostaticRWGRectangleIntegrator::IqLField( const double* dat iL[2] += ( m3[2] * tmpScalar ); } - return KEMThreeVector( iL[0], iL[1], iL[2] ); + return KThreeVector( iL[0], iL[1], iL[2] ); } -std::pair KElectrostaticRWGRectangleIntegrator::IqLFieldAndPotential( const double* data, const double* P, +std::pair KElectrostaticRWGRectangleIntegrator::IqLFieldAndPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const { // corner points P0, P1, P2 and P3 @@ -1016,7 +1016,7 @@ double KElectrostaticRWGRectangleIntegrator::Potential( const KRectangle* source return finalResult*KEMConstants::OneOverFourPiEps0; } -KEMThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField( const KRectangle* source, const KPosition& P ) const +KThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField( const KRectangle* source, const KPosition& P ) const { // save rectangle data into double array @@ -1235,12 +1235,12 @@ KEMThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField( const KRecta // compute IqL - const KEMThreeVector IqLUp + const KThreeVector IqLUp = IqLField( rectData, upEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector IqLDown + const KThreeVector IqLDown = IqLField( rectData, downEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector finalResult( + const KThreeVector finalResult( (rectN3[0]*solidAngleUp + IqLUp[0]) + (rectN3[0]*solidAngleDown + IqLDown[0]), (rectN3[1]*solidAngleUp + IqLUp[1]) + (rectN3[1]*solidAngleDown + IqLDown[1]), (rectN3[2]*solidAngleUp + IqLUp[2]) + (rectN3[2]*solidAngleDown + IqLDown[2]) ); @@ -1252,10 +1252,10 @@ KEMThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField( const KRecta const double rectSolidAngle = solidAngle.SolidAngleRectangleAsArray( rectData, fieldPoint ); - const KEMThreeVector IqLEField + const KThreeVector IqLEField = IqLField( rectData, fieldPoint, correctionCounter, correctionLineIndex, distToLineMin ); - const KEMThreeVector finalResult ( + const KThreeVector finalResult ( (rectN3[0]*rectSolidAngle + IqLEField.X()), (rectN3[1]*rectSolidAngle + IqLEField.Y()), (rectN3[2]*rectSolidAngle + IqLEField.Z()) ); @@ -1263,7 +1263,7 @@ KEMThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField( const KRecta return finalResult*KEMConstants::OneOverFourPiEps0; } -std::pair KElectrostaticRWGRectangleIntegrator::ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const +std::pair KElectrostaticRWGRectangleIntegrator::ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const { // save rectangle data into double array @@ -1496,13 +1496,13 @@ std::pair KElectrostaticRWGRectangleIntegrator::Electric // compute IqL - std::pair IqLFieldAndPotentialUp + std::pair IqLFieldAndPotentialUp = IqLFieldAndPotential( rectData, upEps, 9, 9, 9 ); /* no line correction */ - std::pair IqLFieldAndPotentialDown + std::pair IqLFieldAndPotentialDown = IqLFieldAndPotential( rectData, downEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector finalField( + const KThreeVector finalField( KEMConstants::OneOverFourPiEps0 * 0.5 * ((rectN3[0]*solidAngleUp + IqLFieldAndPotentialUp.first[0]) + (rectN3[0]*solidAngleDown + IqLFieldAndPotentialDown.first[0])), KEMConstants::OneOverFourPiEps0 * 0.5 * ((rectN3[1]*solidAngleUp + IqLFieldAndPotentialUp.first[1]) + (rectN3[1]*solidAngleDown + IqLFieldAndPotentialDown.first[1])), KEMConstants::OneOverFourPiEps0 * 0.5 * ((rectN3[2]*solidAngleUp + IqLFieldAndPotentialUp.first[2]) + (rectN3[2]*solidAngleDown + IqLFieldAndPotentialDown.first[2])) ); @@ -1522,12 +1522,12 @@ std::pair KElectrostaticRWGRectangleIntegrator::Electric const double rectSolidAngle = solidAngle.SolidAngleRectangleAsArray( rectData, fieldPoint ); - std::pair IqLFieldAndPhi + std::pair IqLFieldAndPhi = IqLFieldAndPotential( rectData, fieldPoint, correctionCounter, correctionLineIndex, distToLineMin ); const double finalPhi = KEMConstants::OneOverFourPiEps0*((-h*rectSolidAngle) - IqLFieldAndPhi.second); - const KEMThreeVector finalField( + const KThreeVector finalField( KEMConstants::OneOverFourPiEps0*(rectN3[0]*rectSolidAngle + IqLFieldAndPhi.first[0]), KEMConstants::OneOverFourPiEps0*(rectN3[1]*rectSolidAngle + IqLFieldAndPhi.first[1]), KEMConstants::OneOverFourPiEps0*(rectN3[2]*rectSolidAngle + IqLFieldAndPhi.first[2]) ); @@ -1545,9 +1545,9 @@ double KElectrostaticRWGRectangleIntegrator::Potential(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); @@ -1555,11 +1555,11 @@ KEMThreeVector KElectrostaticRWGRectangleIntegrator::ElectricField(const KSymmet return electricField; } -std::pair KElectrostaticRWGRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticRWGRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGTriangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGTriangleIntegrator.cc index 0728cf56e..d2849d4f7 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGTriangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/RWG/src/KElectrostaticRWGTriangleIntegrator.cc @@ -220,7 +220,7 @@ double KElectrostaticRWGTriangleIntegrator::IqLPotential( const double* data, co return iL; } -KEMThreeVector KElectrostaticRWGTriangleIntegrator::IqLField( const double* data, const double* P, +KThreeVector KElectrostaticRWGTriangleIntegrator::IqLField( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const { // function computes first term of equation (74) in the case q = -1 @@ -412,10 +412,10 @@ KEMThreeVector KElectrostaticRWGTriangleIntegrator::IqLField( const double* data iL[2] += ( m2[2] * tmpScalar ); } - return KEMThreeVector(iL[0], iL[1], iL[2]); + return KThreeVector(iL[0], iL[1], iL[2]); } -std::pair KElectrostaticRWGTriangleIntegrator::IqLFieldAndPotential( const double* data, const double* P, +std::pair KElectrostaticRWGTriangleIntegrator::IqLFieldAndPotential( const double* data, const double* P, const unsigned short countCross, const unsigned short lineIndex, const double dist ) const { // corner points P0, P1 and P2 @@ -640,7 +640,7 @@ std::pair KElectrostaticRWGTriangleIntegrator::IqLFieldA iLPhi += ( t2 * tmpScalar ); } - return std::make_pair( KEMThreeVector(iLField[0], iLField[1], iLField[2]), iLPhi ); + return std::make_pair( KThreeVector(iLField[0], iLField[1], iLField[2]), iLPhi ); } double KElectrostaticRWGTriangleIntegrator::Potential( const KTriangle* source, const KPosition& P ) const @@ -873,7 +873,7 @@ double KElectrostaticRWGTriangleIntegrator::Potential( const KTriangle* source, -KEMThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField( const KTriangle* source, const KPosition& P ) const +KThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField( const KTriangle* source, const KPosition& P ) const { // save triangle data into double array @@ -1064,12 +1064,12 @@ KEMThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField( const KTriang // compute IqL - const KEMThreeVector IqLUp + const KThreeVector IqLUp = IqLField( triData, upEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector IqLDown + const KThreeVector IqLDown = IqLField( triData, downEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector finalResult( + const KThreeVector finalResult( (triN3[0]*solidAngleUp + IqLUp[0]) + (triN3[0]*solidAngleDown + IqLDown[0]), (triN3[1]*solidAngleUp + IqLUp[1]) + (triN3[1]*solidAngleDown + IqLDown[1]), (triN3[2]*solidAngleUp + IqLUp[2]) + (triN3[2]*solidAngleDown + IqLDown[2]) ); @@ -1081,10 +1081,10 @@ KEMThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField( const KTriang const double triSolidAngle = solidAngle.SolidAngleTriangleAsArray( triData, fieldPoint ); - const KEMThreeVector IqLEField + const KThreeVector IqLEField = IqLField( triData, fieldPoint, correctionCounter, correctionLineIndex, distToLineMin ); - const KEMThreeVector finalResult ( + const KThreeVector finalResult ( (triN3[0]*triSolidAngle + IqLEField.X()), (triN3[1]*triSolidAngle + IqLEField.Y()), (triN3[2]*triSolidAngle + IqLEField.Z()) ); @@ -1092,7 +1092,7 @@ KEMThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField( const KTriang return finalResult*KEMConstants::OneOverFourPiEps0; } -std::pair KElectrostaticRWGTriangleIntegrator::ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const +std::pair KElectrostaticRWGTriangleIntegrator::ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const { // save triangle data into double array @@ -1296,13 +1296,13 @@ std::pair KElectrostaticRWGTriangleIntegrator::ElectricF // compute IqL - std::pair IqLFieldAndPotentialUp + std::pair IqLFieldAndPotentialUp = IqLFieldAndPotential( triData, upEps, 9, 9, 9 ); /* no line correction */ - std::pair IqLFieldAndPotentialDown + std::pair IqLFieldAndPotentialDown = IqLFieldAndPotential( triData, downEps, 9, 9, 9 ); /* no line correction */ - const KEMThreeVector finalField( + const KThreeVector finalField( KEMConstants::OneOverFourPiEps0 * 0.5 * ((triN3[0]*solidAngleUp + IqLFieldAndPotentialUp.first[0]) + (triN3[0]*solidAngleDown + IqLFieldAndPotentialDown.first[0])), KEMConstants::OneOverFourPiEps0 * 0.5 * ((triN3[1]*solidAngleUp + IqLFieldAndPotentialUp.first[1]) + (triN3[1]*solidAngleDown + IqLFieldAndPotentialDown.first[1])), KEMConstants::OneOverFourPiEps0 * 0.5 * ((triN3[2]*solidAngleUp + IqLFieldAndPotentialUp.first[2]) + (triN3[2]*solidAngleDown + IqLFieldAndPotentialDown.first[2])) ); @@ -1323,10 +1323,10 @@ std::pair KElectrostaticRWGTriangleIntegrator::ElectricF const double triSolidAngle = solidAngle.SolidAngleTriangleAsArray( triData, fieldPoint ); - std::pair IqLFieldAndPhi + std::pair IqLFieldAndPhi = IqLFieldAndPotential( triData, fieldPoint, correctionCounter, correctionLineIndex, distToLineMin ); - const KEMThreeVector finalField( + const KThreeVector finalField( KEMConstants::OneOverFourPiEps0*(triN3[0]*triSolidAngle + IqLFieldAndPhi.first[0]), KEMConstants::OneOverFourPiEps0*(triN3[1]*triSolidAngle + IqLFieldAndPhi.first[1]), KEMConstants::OneOverFourPiEps0*(triN3[2]*triSolidAngle + IqLFieldAndPhi.first[2]) ); @@ -1347,9 +1347,9 @@ double KElectrostaticRWGTriangleIntegrator::Potential(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) electricField += ElectricField(*it,P); @@ -1357,11 +1357,11 @@ KEMThreeVector KElectrostaticRWGTriangleIntegrator::ElectricField(const KSymmetr return electricField; } -std::pair KElectrostaticRWGTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticRWGTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostatic256NodeQuadratureLineSegmentIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostatic256NodeQuadratureLineSegmentIntegrator.hh index 541c57e87..3b3fd9c51 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostatic256NodeQuadratureLineSegmentIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostatic256NodeQuadratureLineSegmentIntegrator.hh @@ -20,12 +20,12 @@ namespace KEMField ~KElectrostatic256NodeQuadratureLineSegmentIntegrator() {} double Potential(const KLineSegment* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KLineSegment* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const; + KThreeVector ElectricField(const KLineSegment* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; }; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureRectangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureRectangleIntegrator.hh index af91d18ee..c62198269 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureRectangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureRectangleIntegrator.hh @@ -21,12 +21,12 @@ namespace KEMField ~KElectrostaticBiQuadratureRectangleIntegrator() {} double Potential(const KRectangle* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KRectangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; + KThreeVector ElectricField(const KRectangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KRectangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: static double rectQuadGaussLegendreVarN(double (*f)(double),double a,double b,unsigned int n); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureTriangleIntegrator.hh b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureTriangleIntegrator.hh index 3d5fbeee3..03e9676db 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureTriangleIntegrator.hh +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/include/KElectrostaticBiQuadratureTriangleIntegrator.hh @@ -21,19 +21,19 @@ namespace KEMField ~KElectrostaticBiQuadratureTriangleIntegrator() {} double Potential(const KTriangle* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; + KThreeVector ElectricField(const KTriangle* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KTriangle* source, const KPosition& P ) const; double Potential(const KSymmetryGroup* source, const KPosition& P) const; - KEMThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; - std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; + KThreeVector ElectricField(const KSymmetryGroup* source, const KPosition& P) const; + std::pair ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const; private: static double triQuadGaussLegendreVarN(double (*f)(double),double a,double b,unsigned int n); static double triF1( double x ); static double triF2( double y ); - static double triF( KEMThreeVector x, KEMThreeVector y ); + static double triF( KThreeVector x, KThreeVector y ); }; diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostatic256NodeQuadratureLineSegmentIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostatic256NodeQuadratureLineSegmentIntegrator.cc index 3acfb736b..5ea28e38b 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostatic256NodeQuadratureLineSegmentIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostatic256NodeQuadratureLineSegmentIntegrator.cc @@ -87,7 +87,7 @@ double KElectrostatic256NodeQuadratureLineSegmentIntegrator::Potential( const KL return Phi; } -KEMThreeVector KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricField( const KLineSegment* source, const KPosition& P ) const +KThreeVector KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricField( const KLineSegment* source, const KPosition& P ) const { const double data[7] = { source->GetP0().X(), @@ -174,10 +174,10 @@ KEMThreeVector KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricFie } } - return KEMThreeVector(EField[0], EField[1], EField[2]); + return KThreeVector(EField[0], EField[1], EField[2]); } -std::pair KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const +std::pair KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KLineSegment* source, const KPosition& P ) const { const double data[7] = { source->GetP0().X(), @@ -270,7 +270,7 @@ std::pair KElectrostatic256NodeQuadratureLineSegmentInteg Phi = prefac * sumPhi; } - return std::make_pair( KEMThreeVector(EField[0], EField[1], EField[2]), Phi ); + return std::make_pair( KThreeVector(EField[0], EField[1], EField[2]), Phi ); } double KElectrostatic256NodeQuadratureLineSegmentIntegrator::Potential(const KSymmetryGroup* source, const KPosition& P) const @@ -281,19 +281,19 @@ double KElectrostatic256NodeQuadratureLineSegmentIntegrator::Potential(const KSy return potential; } -KEMThreeVector KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const +std::pair KElectrostatic256NodeQuadratureLineSegmentIntegrator::ElectricFieldAndPotential( const KSymmetryGroup* source, const KPosition& P ) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureRectangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureRectangleIntegrator.cc index 2f5c46f0f..c587b36ef 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureRectangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureRectangleIntegrator.cc @@ -10,7 +10,7 @@ unsigned int gReIntNodes = 32; double reAcommon, reBcommon; -KEMThreeVector reP, reP0, gReN1, gReN2; +KThreeVector reP, reP0, gReN1, gReN2; double gReX; @@ -31,7 +31,7 @@ double KElectrostaticBiQuadratureRectangleIntegrator::rectF2( double y ) double KElectrostaticBiQuadratureRectangleIntegrator::rectF( double x, double y ) { double R,R3; - KEMThreeVector Q,QP; + KThreeVector Q,QP; Q = reP0 + x*gReN1 + y*gReN2; QP=reP-Q; R=QP.Magnitude(); @@ -87,7 +87,7 @@ double KElectrostaticBiQuadratureRectangleIntegrator::Potential(const KRectangle return rectQuadGaussLegendreVarN( &KElectrostaticBiQuadratureRectangleIntegrator::rectF1, 0., source->GetA(), gReIntNodes ); } -KEMThreeVector KElectrostaticBiQuadratureRectangleIntegrator::ElectricField(const KRectangle* source, const KPosition& P) const +KThreeVector KElectrostaticBiQuadratureRectangleIntegrator::ElectricField(const KRectangle* source, const KPosition& P) const { double EField[3]; @@ -103,10 +103,10 @@ KEMThreeVector KElectrostaticBiQuadratureRectangleIntegrator::ElectricField(cons EField[j] = rectQuadGaussLegendreVarN( &KElectrostaticBiQuadratureRectangleIntegrator::rectF1, 0., source->GetA(), gReIntNodes ); } - return KEMThreeVector( EField[0], EField[1], EField[2] ); + return KThreeVector( EField[0], EField[1], EField[2] ); } -std::pair KElectrostaticBiQuadratureRectangleIntegrator::ElectricFieldAndPotential(const KRectangle* source, const KPosition& P) const +std::pair KElectrostaticBiQuadratureRectangleIntegrator::ElectricFieldAndPotential(const KRectangle* source, const KPosition& P) const { return std::make_pair( ElectricField(source, P), Potential(source, P) ); } @@ -119,19 +119,19 @@ double KElectrostaticBiQuadratureRectangleIntegrator::Potential(const KSymmetryG return potential; } -KEMThreeVector KElectrostaticBiQuadratureRectangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticBiQuadratureRectangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostaticBiQuadratureRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticBiQuadratureRectangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureTriangleIntegrator.cc b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureTriangleIntegrator.cc index 46c386435..8ce8309c1 100644 --- a/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureTriangleIntegrator.cc +++ b/KEMField/Source/BoundaryIntegrals/Electrostatic/Reference/src/KElectrostaticBiQuadratureTriangleIntegrator.cc @@ -3,18 +3,18 @@ namespace KEMField { -KEMThreeVector triCommonFieldPoint; // = Pcommon +KThreeVector triCommonFieldPoint; // = Pcommon -KEMThreeVector triCommonP1; // Bcommon +KThreeVector triCommonP1; // Bcommon -KEMThreeVector triCommonAlongSideP2P0; // = acommon -KEMThreeVector triCommonAlongSideP2P1; // = bcommon -KEMThreeVector triCommonAlongSideP2P0Unit; // = uacommon +KThreeVector triCommonAlongSideP2P0; // = acommon +KThreeVector triCommonAlongSideP2P1; // = bcommon +KThreeVector triCommonAlongSideP2P0Unit; // = uacommon double triCommonHeightP2onP0P1; // = hcommon -KEMThreeVector triCommonAlongSideP0P1; // = ccommon +KThreeVector triCommonAlongSideP0P1; // = ccommon -KEMThreeVector triCommonHeightIterSideP2P1; // = Ecommon +KThreeVector triCommonHeightIterSideP2P1; // = Ecommon unsigned short triComputationFlag; // 0: Ex, 1: Ey, 2: Ez, 3: Phi @@ -24,8 +24,8 @@ unsigned int triIntNodes = 32; double KElectrostaticBiQuadratureTriangleIntegrator::triF1( double y ) { - KEMThreeVector triHeightIterSideP2P1; // = E - KEMThreeVector triHeightIterSideP0P1; // = F + KThreeVector triHeightIterSideP2P1; // = E + KThreeVector triHeightIterSideP0P1; // = F double triLengthConnectSideIter; // = L triCommonHeightIterSideP2P1 = triCommonP1 - ((y/triCommonHeightP2onP0P1) * triCommonAlongSideP2P1); @@ -39,14 +39,14 @@ double KElectrostaticBiQuadratureTriangleIntegrator::triF1( double y ) double KElectrostaticBiQuadratureTriangleIntegrator::triF2( double x ) { - KEMThreeVector Q = triCommonHeightIterSideP2P1 + x*triCommonAlongSideP2P0Unit; + KThreeVector Q = triCommonHeightIterSideP2P1 + x*triCommonAlongSideP2P0Unit; return KElectrostaticBiQuadratureTriangleIntegrator::triF( Q, triCommonFieldPoint ); } -double KElectrostaticBiQuadratureTriangleIntegrator::triF( KEMThreeVector Q, KEMThreeVector P ) +double KElectrostaticBiQuadratureTriangleIntegrator::triF( KThreeVector Q, KThreeVector P ) { double R,C3,C; - KEMThreeVector QP; + KThreeVector QP; QP=P-Q; R=QP.Magnitude(); C=1./R; @@ -94,17 +94,17 @@ double KElectrostaticBiQuadratureTriangleIntegrator::Potential(const KTriangle* triComputationFlag = 3; // corner points of the triangle - const KEMThreeVector triP0 = source->GetP0(); // = A + const KThreeVector triP0 = source->GetP0(); // = A - const KEMThreeVector triP1 = source->GetP1(); // = B + const KThreeVector triP1 = source->GetP1(); // = B triCommonP1 = triP1; // = Bcommon - const KEMThreeVector triP2 = source->GetP2(); // = C + const KThreeVector triP2 = source->GetP2(); // = C - const KEMThreeVector triAlongSideP2P0 = triP0 - triP2; // = a + const KThreeVector triAlongSideP2P0 = triP0 - triP2; // = a triCommonAlongSideP2P0 = triAlongSideP2P0; // set global value - const KEMThreeVector triAlongSideP2P1 = triP1 - triP2; // = b + const KThreeVector triAlongSideP2P1 = triP1 - triP2; // = b triCommonAlongSideP2P1 = triAlongSideP2P1; // set global value const double triAlongSideP2P0Length = triAlongSideP2P0.Magnitude(); // = absa @@ -113,12 +113,12 @@ double KElectrostaticBiQuadratureTriangleIntegrator::Potential(const KTriangle* triCommonAlongSideP2P0Unit = (1./triAlongSideP2P0Length)*triAlongSideP2P0; // = uacommon const double cosgamma = triAlongSideP2P0.Dot(triAlongSideP2P1)/(triAlongSideP2P0Length*triAlongSideP2P1Length); - const KEMThreeVector triProjP2onP0P1 = triP2+(triAlongSideP2P1Length*cosgamma)*triCommonAlongSideP2P0Unit; // = D + const KThreeVector triProjP2onP0P1 = triP2+(triAlongSideP2P1Length*cosgamma)*triCommonAlongSideP2P0Unit; // = D const double triHeightP2onP0P1 = (triProjP2onP0P1-triP1).Magnitude(); // = h triCommonHeightP2onP0P1 = triHeightP2onP0P1; // = hcommon - const KEMThreeVector triAlongSideP0P1 = triP1 - triP0; // = c + const KThreeVector triAlongSideP0P1 = triP1 - triP0; // = c triCommonAlongSideP0P1 = triAlongSideP0P1; // = ccommon phi = triQuadGaussLegendreVarN( &KElectrostaticBiQuadratureTriangleIntegrator::triF1, 0., triHeightP2onP0P1, triIntNodes ); @@ -126,20 +126,20 @@ double KElectrostaticBiQuadratureTriangleIntegrator::Potential(const KTriangle* return phi; } -KEMThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const KTriangle* source, const KPosition& P) const +KThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const KTriangle* source, const KPosition& P) const { triCommonFieldPoint = P; - KEMThreeVector eField(0., 0., 0.); + KThreeVector eField(0., 0., 0.); // corner points of the triangle - const KEMThreeVector triP0 = source->GetP0(); // A - const KEMThreeVector triP1 = source->GetP1(); // B - const KEMThreeVector triP2 = source->GetP2(); // C + const KThreeVector triP0 = source->GetP0(); // A + const KThreeVector triP1 = source->GetP1(); // B + const KThreeVector triP2 = source->GetP2(); // C - KEMThreeVector triAlongSideP2P0 = triP0 - triP2; // = a + KThreeVector triAlongSideP2P0 = triP0 - triP2; // = a triCommonAlongSideP2P0 = triAlongSideP2P0; // set global value - KEMThreeVector triAlongSideP2P1 = triP1 - triP2; // = b + KThreeVector triAlongSideP2P1 = triP1 - triP2; // = b triCommonAlongSideP2P1 = triAlongSideP2P1; // set global value const double triAlongSideP2P0Length = triAlongSideP2P0.Magnitude(); // = absa @@ -148,12 +148,12 @@ KEMThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const triCommonAlongSideP2P0Unit = (1/triAlongSideP2P0Length)*triAlongSideP2P0; // = uacommon const double cosgamma = triAlongSideP2P0.Dot(triAlongSideP2P1)/(triAlongSideP2P0Length*triAlongSideP2P1Length); - const KEMThreeVector triProjP2onP0P1 = triP2+(triAlongSideP2P1Length*cosgamma)*triCommonAlongSideP2P0Unit; // = D + const KThreeVector triProjP2onP0P1 = triP2+(triAlongSideP2P1Length*cosgamma)*triCommonAlongSideP2P0Unit; // = D const double triHeightP2onP0P1 = (triProjP2onP0P1-triP1).Magnitude(); // = h triCommonHeightP2onP0P1 = triHeightP2onP0P1; // = hcommon - KEMThreeVector triAlongSideP0P1 = triP1 - triP0; // = c + KThreeVector triAlongSideP0P1 = triP1 - triP0; // = c triCommonAlongSideP0P1 = triAlongSideP0P1; // = ccommon for( unsigned short i=0; i<3; i++ ) { @@ -163,7 +163,7 @@ KEMThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const return eField; } -std::pair KElectrostaticBiQuadratureTriangleIntegrator::ElectricFieldAndPotential(const KTriangle* source, const KPosition& P) const +std::pair KElectrostaticBiQuadratureTriangleIntegrator::ElectricFieldAndPotential(const KTriangle* source, const KPosition& P) const { return std::make_pair( ElectricField(source,P), Potential(source, P)); } @@ -176,19 +176,19 @@ double KElectrostaticBiQuadratureTriangleIntegrator::Potential(const KSymmetryGr return potential; } -KEMThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const +KThreeVector KElectrostaticBiQuadratureTriangleIntegrator::ElectricField(const KSymmetryGroup* source, const KPosition& P) const { - KEMThreeVector electricField(0.,0.,0.); + KThreeVector electricField(0.,0.,0.); for (KSymmetryGroup::ShapeCIt it=source->begin();it!=source->end();++it) electricField += ElectricField(*it,P); return electricField; } -std::pair KElectrostaticBiQuadratureTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const +std::pair KElectrostaticBiQuadratureTriangleIntegrator::ElectricFieldAndPotential(const KSymmetryGroup* source, const KPosition& P) const { - std::pair fieldAndPotential; + std::pair fieldAndPotential; double potential( 0. ); - KEMThreeVector electricField( 0., 0., 0. ); + KThreeVector electricField( 0., 0., 0. ); for( KSymmetryGroup::ShapeCIt it=source->begin(); it!=source->end(); ++it ) { fieldAndPotential = ElectricFieldAndPotential( *it, P ); diff --git a/KEMField/Source/Core/CMakeLists.txt b/KEMField/Source/Core/CMakeLists.txt index 780b635ff..43ee992c9 100644 --- a/KEMField/Source/Core/CMakeLists.txt +++ b/KEMField/Source/Core/CMakeLists.txt @@ -1,37 +1,26 @@ # CMakeLists for KEMField/Core -# Author: T.J. Corona - -option (@PROJECT_NAME@_SILENT "Disable all messaging" OFF) -if (@PROJECT_NAME@_SILENT) - add_cflag (KEMFIELD_SILENT) -endif (@PROJECT_NAME@_SILENT) - -cmake_dependent_option (@PROJECT_NAME@_USE_KOMMON "Use KOMMON" ON - "BUILD_KOMMON" OFF) -if (NOT BUILD_KOMMON) - set (@PROJECT_NAME@_USE_KOMMON OFF) - set (@PROJECT_NAME@_USE_KOMMON ${@PROJECT_NAME@_USE_KOMMON} PARENT_SCOPE) - set (@PROJECT_NAME@_USE_KMESSAGE OFF) - set (@PROJECT_NAME@_USE_KMESSAGE ${@PROJECT_NAME@_USE_KMESSAGE} PARENT_SCOPE) - set (Kommon_LIBRARIES "") -else() - kasper_require_cpp11() -endif() - -cmake_dependent_option (@PROJECT_NAME@_USE_KMESSAGE "Use KMessage" ON - "@PROJECT_NAME@_USE_KOMMON;NOT @PROJECT_NAME@_SILENT" OFF) - -if (@PROJECT_NAME@_USE_KOMMON) - kasper_find_module(Kommon) - add_cflag (KEMFIELD_USE_KOMMON) -endif (@PROJECT_NAME@_USE_KOMMON) - -if (@PROJECT_NAME@_USE_KMESSAGE) +# Author: T.J. Corona, D. Hilk + +# Bindings need to be linked against KGeoBag, Kommon and KMessage + +#option (${PROJECT_NAME}_SILENT "Disable all messaging" OFF) +#if (${PROJECT_NAME}_SILENT) +# add_cflag (KEMFIELD_SILENT) +#endif (${PROJECT_NAME}_SILENT) + +kasper_require_cpp11() +kasper_find_module(Kommon) +add_cflag (KEMFIELD_USE_KOMMON) + +#cmake_dependent_option (${PROJECT_NAME}_USE_KMESSAGE "Use KMessage" ON "NOT ${PROJECT_NAME}_SILENT" OFF) + + +#if (${PROJECT_NAME}_USE_KMESSAGE) add_cflag (KEMFIELD_USE_KMESSAGE) -endif (@PROJECT_NAME@_USE_KMESSAGE) +#endif (${PROJECT_NAME}_USE_KMESSAGE) -option (@PROJECT_NAME@_USE_MPI "Use MPI to accelerate calculations using multiple processors" OFF) -if (@PROJECT_NAME@_USE_MPI) +option (${PROJECT_NAME}_USE_MPI "Use MPI to accelerate calculations using multiple processors" OFF) +if (${PROJECT_NAME}_USE_MPI) find_package(MPI) if (MPI_CXX_FOUND) if (MPI_CXX_COMPILER) # MPICH2 style @@ -61,16 +50,16 @@ if (@PROJECT_NAME@_USE_MPI) set (CMAKE_SHARED_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX} PARENT_SCOPE) set (CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX} PARENT_SCOPE) -# set( @PROJECT_NAME@_USE_ROOT OFF CACHE BOOL "(Required)" FORCE ) - set( @PROJECT_NAME@_USE_ROOT ${KASPER_USE_ROOT} ) +# set( ${PROJECT_NAME}_USE_ROOT OFF CACHE BOOL "(Required)" FORCE ) + set( ${PROJECT_NAME}_USE_ROOT ${KASPER_USE_ROOT} ) -endif (@PROJECT_NAME@_USE_MPI) +endif (${PROJECT_NAME}_USE_MPI) -option(@PROJECT_NAME@_USE_REALTIME_CLOCK "Use real time clock for timing applications." OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_USE_REALTIME_CLOCK) -if (@PROJECT_NAME@_USE_REALTIME_CLOCK) +option(${PROJECT_NAME}_USE_REALTIME_CLOCK "Use real time clock for timing applications." OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_USE_REALTIME_CLOCK) +if (${PROJECT_NAME}_USE_REALTIME_CLOCK) add_cflag (KEMFIELD_USE_REALTIME_CLOCK) -endif (@PROJECT_NAME@_USE_REALTIME_CLOCK) +endif (${PROJECT_NAME}_USE_REALTIME_CLOCK) kasper_internal_include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -100,31 +89,29 @@ set (KEMCORE_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KTimer.cc ) -if (@PROJECT_NAME@_USE_MPI) +if (${PROJECT_NAME}_USE_MPI) list (APPEND KEMCORE_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KMPIInterface.hh ) list (APPEND KEMCORE_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KMPIInterface.cc ) -endif (@PROJECT_NAME@_USE_MPI) +endif (${PROJECT_NAME}_USE_MPI) -if (@PROJECT_NAME@_USE_KMESSAGE) +#if (${PROJECT_NAME}_USE_KMESSAGE) list (APPEND KEMCORE_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KMessageInterface.hh ) list (APPEND KEMCORE_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KMessageInterface.cc ) - -endif (@PROJECT_NAME@_USE_KMESSAGE) +#endif (${PROJECT_NAME}_USE_KMESSAGE) add_library (KEMCore SHARED ${KEMCORE_SOURCEFILES}) target_link_libraries (KEMCore ${Kommon_LIBRARIES}) add_executable( KSmartPointer_test test/KSmartPointer_test.cc ) - target_link_libraries( KSmartPointer_test - KEMCore + target_link_libraries( KSmartPointer_test KEMCore ) kasper_install_executables( KSmartPointer_test ) diff --git a/KEMField/Source/Core/include/KEMStringUtils.hh b/KEMField/Source/Core/include/KEMStringUtils.hh index 36118d4cc..10594724c 100644 --- a/KEMField/Source/Core/include/KEMStringUtils.hh +++ b/KEMField/Source/Core/include/KEMStringUtils.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KEMSTRINGUTILS_HH_ -#define KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KEMSTRINGUTILS_HH_ +#ifndef KEMSTRINGUTILS_HH_ +#define KEMSTRINGUTILS_HH_ #include @@ -16,4 +16,4 @@ bool endsWith(std::string aString, std::string ending); } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KEMSTRINGUTILS_HH_ */ +#endif /* KEMSTRINGUTILS_HH_ */ diff --git a/KEMField/Source/Core/include/KMPIEnvironment.hh b/KEMField/Source/Core/include/KMPIEnvironment.hh index 1f12d2179..3cab9d56d 100644 --- a/KEMField/Source/Core/include/KMPIEnvironment.hh +++ b/KEMField/Source/Core/include/KMPIEnvironment.hh @@ -7,8 +7,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KMPIENVIRONMENT_HH_ -#define KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KMPIENVIRONMENT_HH_ +#ifndef KMPIENVIRONMENT_HH_ +#define KMPIENVIRONMENT_HH_ #ifdef KEMFIELD_USE_MPI #include "KMPIInterface.hh" @@ -22,4 +22,4 @@ #define MPI_SECOND_PROCESS #endif -#endif /* KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KMPIENVIRONMENT_HH_ */ +#endif /* KMPIENVIRONMENT_HH_ */ diff --git a/KEMField/Source/Core/include/KTimer.hh b/KEMField/Source/Core/include/KTimer.hh index 6abf59ced..ec97f4ac7 100644 --- a/KEMField/Source/Core/include/KTimer.hh +++ b/KEMField/Source/Core/include/KTimer.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KTIMER_HH_ -#define KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KTIMER_HH_ +#ifndef KTIMER_HH_ +#define KTIMER_HH_ #include @@ -33,4 +33,4 @@ private: } /* namespace Kassiopeia */ -#endif /* KEMFIELD_SOURCE_2_0_CORE_INCLUDE_KTIMER_HH_ */ +#endif /* KTIMER_HH_ */ diff --git a/KEMField/Source/Core/src/KEMConstants.cc b/KEMField/Source/Core/src/KEMConstants.cc index 13574b43b..2b6e33cf4 100644 --- a/KEMField/Source/Core/src/KEMConstants.cc +++ b/KEMField/Source/Core/src/KEMConstants.cc @@ -2,8 +2,6 @@ #include -#ifdef KEMFIELD_USE_KOMMON - #include "KConst.h" namespace KEMField @@ -15,16 +13,3 @@ namespace KEMField const double KEMConstants::Mu0 = katrin::KConst::MuNull(); const double KEMConstants::Mu0OverPi = 4.*1.e-7; } - -#else - -namespace KEMField -{ - const double KEMConstants::Pi = M_PI; - const double KEMConstants::PiOverTwo = M_PI/2.; - const double KEMConstants::Eps0 = 8.854187817E-12; - const double KEMConstants::OneOverFourPiEps0 = 1./(4.*M_PI*KEMConstants::Eps0); - const double KEMConstants::Mu0 = 1.25663706e-06; - const double KEMConstants::Mu0OverPi = 4.*1.e-7; -} -#endif diff --git a/KEMField/Source/Exceptions/include/KEMSimpleException.hh b/KEMField/Source/Exceptions/include/KEMSimpleException.hh index edb14e6ec..bda852396 100644 --- a/KEMField/Source/Exceptions/include/KEMSimpleException.hh +++ b/KEMField/Source/Exceptions/include/KEMSimpleException.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_EXCEPTIONS_INCLUDE_KEMSIMPLEEXCEPTION_HH_ -#define KEMFIELD_SOURCE_2_0_EXCEPTIONS_INCLUDE_KEMSIMPLEEXCEPTION_HH_ +#ifndef KEMSIMPLEEXCEPTION_HH_ +#define KEMSIMPLEEXCEPTION_HH_ #include #include @@ -29,4 +29,4 @@ private: -#endif /* KEMFIELD_SOURCE_2_0_EXCEPTIONS_INCLUDE_KEMSIMPLEEXCEPTION_HH_ */ +#endif /* KEMSIMPLEEXCEPTION_HH_ */ diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KCoilIntegrator.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KCoilIntegrator.hh index 6682467a6..e2fa81215 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KCoilIntegrator.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KCoilIntegrator.hh @@ -11,8 +11,8 @@ namespace KEMField KCoilIntegrator() {} virtual ~KCoilIntegrator() {} - KEMThreeVector VectorPotential(const KCoil& coil, const KPosition& P) const; - KEMThreeVector MagneticField(const KCoil& coil, const KPosition& P) const; + KThreeVector VectorPotential(const KCoil& coil, const KPosition& P) const; + KThreeVector MagneticField(const KCoil& coil, const KPosition& P) const; }; } diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoop.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoop.hh index 103a4e845..8a56dea7e 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoop.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoop.hh @@ -1,8 +1,7 @@ #ifndef KCURRENTLOOP_H #define KCURRENTLOOP_H -#include "KEMThreeVector.hh" - +#include "KThreeVector_KEMField.hh" #include "KElectromagnet.hh" namespace KEMField diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoopIntegrator.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoopIntegrator.hh index a7c998b92..9c7fa43dd 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoopIntegrator.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KCurrentLoopIntegrator.hh @@ -11,9 +11,9 @@ namespace KEMField KCurrentLoopIntegrator() {} virtual ~KCurrentLoopIntegrator() {} - KEMThreeVector VectorPotential(const KCurrentLoop& currentLoop, + KThreeVector VectorPotential(const KCurrentLoop& currentLoop, const KPosition& P) const; - KEMThreeVector MagneticField(const KCurrentLoop& currentLoop, + KThreeVector MagneticField(const KCurrentLoop& currentLoop, const KPosition& P) const; }; } diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KElectromagnetIntegratingFieldSolver.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KElectromagnetIntegratingFieldSolver.hh index 31340bfc6..fd9cc1aa8 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KElectromagnetIntegratingFieldSolver.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KElectromagnetIntegratingFieldSolver.hh @@ -1,8 +1,7 @@ #ifndef KELECTROMAGNETINTEGRATINGFIELDSOLVER_DEF #define KELECTROMAGNETINTEGRATINGFIELDSOLVER_DEF -#include "KEMThreeMatrix.hh" - +#include "KThreeMatrix_KEMField.hh" #include "KElectromagnetContainer.hh" #include "KIntegratingFieldSolverTemplate.hh" @@ -20,8 +19,8 @@ namespace KEMField fIntegrator(integrator) {} virtual ~KIntegratingFieldSolver() {} - KEMThreeVector VectorPotential(const KPosition& P) const; - KEMThreeVector MagneticField(const KPosition& P) const; + KThreeVector VectorPotential(const KPosition& P) const; + KThreeVector MagneticField(const KPosition& P) const; KGradient MagneticFieldGradient(const KPosition& P) const; const KElectromagnetContainer& GetContainer() const { return fContainer; } @@ -36,7 +35,7 @@ namespace KEMField fContainer(container),fIntegrator(integrator),fP(P),fVectorPotential(0.,0.,0.) {} ~VectorPotentialAction() {} - KEMThreeVector GetVectorPotential() const { return fVectorPotential; } + KThreeVector GetVectorPotential() const { return fVectorPotential; } template void Act(Type2Type) @@ -50,7 +49,7 @@ namespace KEMField const KElectromagnetContainer& fContainer; const Integrator& fIntegrator; const KPosition& fP; - KEMThreeVector fVectorPotential; + KThreeVector fVectorPotential; }; class MagneticFieldAction @@ -62,7 +61,7 @@ namespace KEMField fContainer(container),fIntegrator(integrator),fP(P),fMagneticField(0.,0.,0.) {} ~MagneticFieldAction() {} - KEMThreeVector GetMagneticField() const { return fMagneticField; } + KThreeVector GetMagneticField() const { return fMagneticField; } template void Act(Type2Type) @@ -76,7 +75,7 @@ namespace KEMField const KElectromagnetContainer& fContainer; const Integrator& fIntegrator; const KPosition& fP; - KEMThreeVector fMagneticField; + KThreeVector fMagneticField; }; KElectromagnetContainer& fContainer; @@ -85,7 +84,7 @@ namespace KEMField template - KEMThreeVector KIntegratingFieldSolver::VectorPotential(const KPosition& P) const + KThreeVector KIntegratingFieldSolver::VectorPotential(const KPosition& P) const { VectorPotentialAction action(fContainer,fIntegrator,P); @@ -95,7 +94,7 @@ namespace KEMField } template - KEMThreeVector KIntegratingFieldSolver::MagneticField(const KPosition& P) const + KThreeVector KIntegratingFieldSolver::MagneticField(const KPosition& P) const { MagneticFieldAction action(fContainer,fIntegrator,P); @@ -115,8 +114,8 @@ namespace KEMField Pplus[i] += epsilon; KPosition Pminus = P; Pminus[i] -= epsilon; - KEMThreeVector Bplus = MagneticField(Pplus); - KEMThreeVector Bminus = MagneticField(Pminus); + KThreeVector Bplus = MagneticField(Pplus); + KThreeVector Bminus = MagneticField(Pminus); for (unsigned int j=0;j<3;j++) g[j + 3*i] = (Bplus[j]-Bminus[j])/(2.*epsilon); } diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KLineCurrentIntegrator.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KLineCurrentIntegrator.hh index 3d61d07de..e45a22ad5 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KLineCurrentIntegrator.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KLineCurrentIntegrator.hh @@ -11,9 +11,9 @@ namespace KEMField KLineCurrentIntegrator() {} virtual ~KLineCurrentIntegrator() {} - KEMThreeVector VectorPotential(const KLineCurrent& lineCurrent, + KThreeVector VectorPotential(const KLineCurrent& lineCurrent, const KPosition& P) const; - KEMThreeVector MagneticField(const KLineCurrent& lineCurrent, + KThreeVector MagneticField(const KLineCurrent& lineCurrent, const KPosition& P) const; }; } diff --git a/KEMField/Source/ExternalFields/Electromagnets/include/KSolenoidIntegrator.hh b/KEMField/Source/ExternalFields/Electromagnets/include/KSolenoidIntegrator.hh index 2cb4a5890..563763752 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/include/KSolenoidIntegrator.hh +++ b/KEMField/Source/ExternalFields/Electromagnets/include/KSolenoidIntegrator.hh @@ -13,8 +13,8 @@ namespace KEMField friend class KCoilIntegrator; - KEMThreeVector VectorPotential(const KSolenoid& solenoid, const KPosition& P) const; - KEMThreeVector MagneticField(const KSolenoid& solenoid, const KPosition& P) const; + KThreeVector VectorPotential(const KSolenoid& solenoid, const KPosition& P) const; + KThreeVector MagneticField(const KSolenoid& solenoid, const KPosition& P) const; protected: static double A_theta(const double *p, double *par); diff --git a/KEMField/Source/ExternalFields/Electromagnets/src/KCoilIntegrator.cc b/KEMField/Source/ExternalFields/Electromagnets/src/KCoilIntegrator.cc index 2cf4d3039..1af98b572 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/src/KCoilIntegrator.cc +++ b/KEMField/Source/ExternalFields/Electromagnets/src/KCoilIntegrator.cc @@ -6,7 +6,7 @@ namespace KEMField { - KEMThreeVector KCoilIntegrator::VectorPotential(const KCoil& coil,const KPosition& P) const + KThreeVector KCoilIntegrator::VectorPotential(const KCoil& coil,const KPosition& P) const { static double (*f[1])(const double*,double*) = {&KSolenoidIntegrator::A_theta}; static KGaussianQuadrature Quad; @@ -37,10 +37,10 @@ namespace KEMField double cos = p[0]/par[1]; double sin = p[1]/par[1]; - return coil.GetCoordinateSystem().ToGlobal(KEMThreeVector(-sin*a_theta,cos*a_theta,0.)); + return coil.GetCoordinateSystem().ToGlobal(KThreeVector(-sin*a_theta,cos*a_theta,0.)); } - KEMThreeVector KCoilIntegrator::MagneticField(const KCoil& coil, const KPosition& P) const + KThreeVector KCoilIntegrator::MagneticField(const KCoil& coil, const KPosition& P) const { static double (*f[2])(const double*,double*) = {&KSolenoidIntegrator::B_r,&KSolenoidIntegrator::B_z}; @@ -95,6 +95,6 @@ namespace KEMField double cosine = p[0]/par[1]; double sine = p[1]/par[1]; - return coil.GetCoordinateSystem().ToGlobal(KEMThreeVector(cosine*b_r,sine*b_r,b_z)); + return coil.GetCoordinateSystem().ToGlobal(KThreeVector(cosine*b_r,sine*b_r,b_z)); } } diff --git a/KEMField/Source/ExternalFields/Electromagnets/src/KCurrentLoopIntegrator.cc b/KEMField/Source/ExternalFields/Electromagnets/src/KCurrentLoopIntegrator.cc index 288a1663b..bbe799baa 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/src/KCurrentLoopIntegrator.cc +++ b/KEMField/Source/ExternalFields/Electromagnets/src/KCurrentLoopIntegrator.cc @@ -7,7 +7,7 @@ namespace KEMField { - KEMThreeVector KCurrentLoopIntegrator::VectorPotential(const KCurrentLoop& currentLoop, const KPosition& P) const + KThreeVector KCurrentLoopIntegrator::VectorPotential(const KCurrentLoop& currentLoop, const KPosition& P) const { static KCompleteEllipticIntegral1stKind K_elliptic; static KEllipticEMinusKOverkSquared EK_elliptic; @@ -34,10 +34,10 @@ namespace KEMField sine = p[1]/r; } - return currentLoop.GetCoordinateSystem().ToGlobal(KEMThreeVector(-sine*A_theta,cosine*A_theta,0.)); + return currentLoop.GetCoordinateSystem().ToGlobal(KThreeVector(-sine*A_theta,cosine*A_theta,0.)); } - KEMThreeVector KCurrentLoopIntegrator::MagneticField(const KCurrentLoop& currentLoop, const KPosition& P) const + KThreeVector KCurrentLoopIntegrator::MagneticField(const KCurrentLoop& currentLoop, const KPosition& P) const { static KCompleteEllipticIntegral1stKind K_elliptic; static KCompleteEllipticIntegral2ndKind E_elliptic; @@ -73,6 +73,6 @@ namespace KEMField sine = p[1]/r; } - return currentLoop.GetCoordinateSystem().ToGlobal(KEMThreeVector(cosine*B_r,sine*B_r,B_z)); + return currentLoop.GetCoordinateSystem().ToGlobal(KThreeVector(cosine*B_r,sine*B_r,B_z)); } } diff --git a/KEMField/Source/ExternalFields/Electromagnets/src/KLineCurrentIntegrator.cc b/KEMField/Source/ExternalFields/Electromagnets/src/KLineCurrentIntegrator.cc index e53db4c28..9163997ec 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/src/KLineCurrentIntegrator.cc +++ b/KEMField/Source/ExternalFields/Electromagnets/src/KLineCurrentIntegrator.cc @@ -6,7 +6,7 @@ namespace KEMField { - KEMThreeVector KLineCurrentIntegrator::VectorPotential(const KLineCurrent& lineCurrent,const KPosition& P) const + KThreeVector KLineCurrentIntegrator::VectorPotential(const KLineCurrent& lineCurrent,const KPosition& P) const { KPosition p = lineCurrent.GetCoordinateSystem().ToLocal(P); @@ -16,18 +16,18 @@ namespace KEMField KDirection i = (lineCurrent.GetP1() - lineCurrent.GetP0()).Unit(); if (1.-fabs((lineCurrent.GetP0() - p).Unit().Dot(i))<1.e-8) - return KEMThreeVector(0.,0.,0.); + return KThreeVector(0.,0.,0.); double l = (lineCurrent.GetP0() - p).Dot(i); double prefac =(KEMConstants::Mu0OverPi*lineCurrent.GetCurrent()*.25* log((L+l+r1)/(l+r0))); - KEMThreeVector A = i*prefac; + KThreeVector A = i*prefac; return lineCurrent.GetCoordinateSystem().ToGlobal(A); } - KEMThreeVector KLineCurrentIntegrator::MagneticField(const KLineCurrent& lineCurrent,const KPosition& P) const + KThreeVector KLineCurrentIntegrator::MagneticField(const KLineCurrent& lineCurrent,const KPosition& P) const { KPosition p = lineCurrent.GetCoordinateSystem().ToLocal(P); @@ -36,7 +36,7 @@ namespace KEMField KDirection i = (lineCurrent.GetP1() - lineCurrent.GetP0()).Unit(); if (1.-fabs((lineCurrent.GetP0() - p).Unit().Dot(i))<1.e-8) - return KEMThreeVector(0.,0.,0.); + return KThreeVector(0.,0.,0.); double l = r0.Dot(i); @@ -48,7 +48,7 @@ namespace KEMField double prefac = (KEMConstants::Mu0OverPi*lineCurrent.GetCurrent()/(4.*s)* (sinTheta1-sinTheta0)); - KEMThreeVector BField = r0.Cross(i).Unit()*prefac; + KThreeVector BField = r0.Cross(i).Unit()*prefac; return lineCurrent.GetCoordinateSystem().ToGlobal(BField); } diff --git a/KEMField/Source/ExternalFields/Electromagnets/src/KSolenoidIntegrator.cc b/KEMField/Source/ExternalFields/Electromagnets/src/KSolenoidIntegrator.cc index f199fc4fa..34ce465b4 100644 --- a/KEMField/Source/ExternalFields/Electromagnets/src/KSolenoidIntegrator.cc +++ b/KEMField/Source/ExternalFields/Electromagnets/src/KSolenoidIntegrator.cc @@ -7,7 +7,7 @@ namespace KEMField { - KEMThreeVector KSolenoidIntegrator::VectorPotential(const KSolenoid& solenoid, const KPosition& P) const + KThreeVector KSolenoidIntegrator::VectorPotential(const KSolenoid& solenoid, const KPosition& P) const { KPosition localP = solenoid.GetCoordinateSystem().ToLocal(P); double p[1] = {solenoid.GetP0()[0]}; @@ -27,10 +27,10 @@ namespace KEMField sine = localP[1]/par[1]; } - return solenoid.GetCoordinateSystem().ToGlobal(KEMThreeVector(-sine*a_theta,cosine*a_theta,0.)); + return solenoid.GetCoordinateSystem().ToGlobal(KThreeVector(-sine*a_theta,cosine*a_theta,0.)); } - KEMThreeVector KSolenoidIntegrator::MagneticField(const KSolenoid& solenoid, const KPosition& P) const + KThreeVector KSolenoidIntegrator::MagneticField(const KSolenoid& solenoid, const KPosition& P) const { KPosition localP = solenoid.GetCoordinateSystem().ToLocal(P); double p[1] = {solenoid.GetP0()[0]}; @@ -53,7 +53,7 @@ namespace KEMField sine = localP[1]/par[1]; } - return solenoid.GetCoordinateSystem().ToGlobal(KEMThreeVector(cosine*b_r,sine*b_r,b_z)); + return solenoid.GetCoordinateSystem().ToGlobal(KThreeVector(cosine*b_r,sine*b_r,b_z)); } double KSolenoidIntegrator::A_theta(const double *p, double *par) diff --git a/KEMField/Source/FastMultipole/Applications/AccuracyComparisonFastMultipole.cc b/KEMField/Source/FastMultipole/Applications/AccuracyComparisonFastMultipole.cc index 6dbaa1882..efc7a71b8 100644 --- a/KEMField/Source/FastMultipole/Applications/AccuracyComparisonFastMultipole.cc +++ b/KEMField/Source/FastMultipole/Applications/AccuracyComparisonFastMultipole.cc @@ -591,21 +591,21 @@ int main(int argc, char* argv[]) double length_c = world_length/2.0 - 0.001*world_length; KFMPoint<3> center = world->GetCenter(); - KEMThreeVector direction_a; - KEMThreeVector direction_b; - KEMThreeVector direction_c; + KThreeVector direction_a; + KThreeVector direction_b; + KThreeVector direction_c; - KEMThreeVector p0(center[0], center[1], center[2]); - KEMThreeVector point; + KThreeVector p0(center[0], center[1], center[2]); + KThreeVector point; unsigned int n_points = 0; - KEMThreeVector* points = NULL; + KThreeVector* points = NULL; switch( mode ) { case 0: n_points = NEvaluations; - points = new KEMThreeVector[n_points]; + points = new KThreeVector[n_points]; direction_a[0] = 1.0; direction_a[1] = 0.0; direction_a[2] = 0.0; direction_b[0] = 0.0; direction_b[1] = 1.0; direction_b[2] = 0.0; direction_c[0] = 0.0; direction_c[1] = 0.0; direction_c[2] = 1.0; @@ -634,7 +634,7 @@ int main(int argc, char* argv[]) break; case 1: n_points = NEvaluations; - points = new KEMThreeVector[n_points]; + points = new KThreeVector[n_points]; direction_a[0] = 1.0; direction_a[1] = 0.0; direction_a[2] = 0.0; p0 = p0 - length_a*direction_a; for(unsigned int i=0; iElectricField(points[i]); + KThreeVector field = fast_solver->ElectricField(points[i]); //std::cout<<"field = "<ElectricField(points[i]); + KThreeVector field = direct_solver->ElectricField(points[i]); direct_field_x.AddNextValue(field[0]); direct_field_y.AddNextValue(field[1]); direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Applications/CMakeLists.txt b/KEMField/Source/FastMultipole/Applications/CMakeLists.txt index 50b7bf4c6..0b4870901 100644 --- a/KEMField/Source/FastMultipole/Applications/CMakeLists.txt +++ b/KEMField/Source/FastMultipole/Applications/CMakeLists.txt @@ -1,18 +1,20 @@ # CMakeLists for FastMultipole/Test # Author: J. P. Barrett -option (@PROJECT_NAME@_ENABLE_FM_APP "Build fast multipole applications" OFF) -if (@PROJECT_NAME@_ENABLE_FM_APP) +option (${PROJECT_NAME}_ENABLE_FM_APP "Build fast multipole applications" OFF) +if (${PROJECT_NAME}_ENABLE_FM_APP) enable_testing () -endif (@PROJECT_NAME@_ENABLE_FM_APP) +endif (${PROJECT_NAME}_ENABLE_FM_APP) -if (@PROJECT_NAME@_ENABLE_FM_APP) +if (${PROJECT_NAME}_ENABLE_FM_APP) - kasper_internal_include_directories(${@PROJECT_NAME@_INCLUDE_DIRS}) + kasper_internal_include_directories(${${PROJECT_NAME}_INCLUDE_DIRS}) add_definitions( -Wno-overloaded-virtual ) set (FAST_MULTIPOLE_APP_LIBS + ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} KFMCore KFMMath KFMMathUtilities @@ -30,75 +32,54 @@ if (@PROJECT_NAME@_ENABLE_FM_APP) KEMSurfaces KEMIO KEMElectrostaticBoundaryIntegrals + KGeoBagInterface ) - if (@PROJECT_NAME@_USE_VTK) + if (${PROJECT_NAME}_USE_VTK) list (APPEND FAST_MULTIPOLE_APP_LIBS KEMVTKPlugin ) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) - if (@PROJECT_NAME@_USE_ROOT) + if (${PROJECT_NAME}_USE_ROOT) find_package(ROOT REQUIRED) kasper_external_include_directories( ${ROOT_INCLUDE_DIRS} ) list (APPEND FAST_MULTIPOLE_APP_LIBS KEMRootPlugin ) - endif (@PROJECT_NAME@_USE_ROOT) + endif (${PROJECT_NAME}_USE_ROOT) - if (@PROJECT_NAME@_USE_OPENCL) + if (${PROJECT_NAME}_USE_OPENCL) kasper_external_include_directories( ${OPENCL_INCLUDE_DIRS} ) list (APPEND FAST_MULTIPOLE_APP_LIBS KEMOpenCLPlugin ) - endif (@PROJECT_NAME@_USE_OPENCL) + endif (${PROJECT_NAME}_USE_OPENCL) - if (@PROJECT_NAME@_USE_KGEOBAG) - kasper_find_module(KGeoBag) - list (APPEND FAST_MULTIPOLE_APP_LIBS - KEMGeoBagPlugin - ${KOMMON_LIBRARIES} - ) - endif (@PROJECT_NAME@_USE_KGEOBAG) - - if (@PROJECT_NAME@_USE_KMESSAGE) - kasper_find_module(Kommon) - list (APPEND FAST_MULTIPOLE_APP_LIBS - ${KOMMON_LIBRARIES} - ) - endif (@PROJECT_NAME@_USE_KMESSAGE) - - if (@PROJECT_NAME@_USE_PETSc) + if (${PROJECT_NAME}_USE_PETSc) list (APPEND FAST_MULTIPOLE_APP_LIBS KEMPETScPlugin ) - endif (@PROJECT_NAME@_USE_PETSc) + endif (${PROJECT_NAME}_USE_PETSc) - if (@PROJECT_NAME@_USE_VTK) + if (${PROJECT_NAME}_USE_VTK) list (APPEND FAST_MULTIPOLE_APP_LIBS ${Kommon_Vtk_LIBRARIES} ${VTK_LIBRARIES}) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) set_property( SOURCE #${CMAKE_CURRENT_SOURCE_DIR}/ComputeSphericalCapacitorFastMultipole.cc ${CMAKE_CURRENT_SOURCE_DIR}/AccuracyComparisonFastMultipole.cc ${CMAKE_CURRENT_SOURCE_DIR}/CompareChargeDensities.cc - APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${DATA_INSTALL_DIR}/${@PROJECT_NAME@_DATA_DIR}" + APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_DATA_DIR="${DATA_INSTALL_DIR}/${${PROJECT_NAME}_DATA_DIR}" ) add_executable (CompareChargeDensities ${CMAKE_CURRENT_SOURCE_DIR}/CompareChargeDensities.cc) target_link_libraries (CompareChargeDensities ${FAST_MULTIPOLE_APP_LIBS} ${KasperCommon_LIBRARIES}) - kasper_install_executables ( - CompareChargeDensities - ) - - - if(@PROJECT_NAME@_USE_KGEOBAG) - # add_executable (ComputeSphericalCapacitorFastMultipole # ${CMAKE_CURRENT_SOURCE_DIR}/ComputeSphericalCapacitorFastMultipole.cc) # target_link_libraries (ComputeSphericalCapacitorFastMultipole ${FAST_MULTIPOLE_APP_LIBS} ${KasperCommon_LIBRARIES}) @@ -107,15 +88,13 @@ if (@PROJECT_NAME@_ENABLE_FM_APP) ${CMAKE_CURRENT_SOURCE_DIR}/AccuracyComparisonFastMultipole.cc) target_link_libraries (AccuracyComparisonFastMultipole ${FAST_MULTIPOLE_APP_LIBS} ${KasperCommon_LIBRARIES}) - kasper_install_executables ( -# ComputeSphericalCapacitorFastMultipole - AccuracyComparisonFastMultipole - ) - - endif (@PROJECT_NAME@_USE_KGEOBAG) - + kasper_install_executables ( + CompareChargeDensities + # ComputeSphericalCapacitorFastMultipole + AccuracyComparisonFastMultipole + ) - if (@PROJECT_NAME@_USE_ROOT) + if (${PROJECT_NAME}_USE_ROOT) add_executable (ConvertFieldMapToROOT ${CMAKE_CURRENT_SOURCE_DIR}/ConvertFieldMapToROOT.cc) target_link_libraries (ConvertFieldMapToROOT ${FAST_MULTIPOLE_APP_LIBS} ${KasperCommon_LIBRARIES}) @@ -124,9 +103,9 @@ if (@PROJECT_NAME@_ENABLE_FM_APP) ConvertFieldMapToROOT ) - endif (@PROJECT_NAME@_USE_ROOT) + endif (${PROJECT_NAME}_USE_ROOT) - if (@PROJECT_NAME@_USE_VTK) + if (${PROJECT_NAME}_USE_VTK) add_executable (ConvertFieldMapToVTK ${CMAKE_CURRENT_SOURCE_DIR}/ConvertFieldMapToVTK.cc) @@ -142,13 +121,12 @@ if (@PROJECT_NAME@_ENABLE_FM_APP) VisualizeElectrostaticMultipoleTree ) - endif (@PROJECT_NAME@_USE_VTK) + endif (${PROJECT_NAME}_USE_VTK) install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FastMultipoleApplicationFiles - DESTINATION ${@PROJECT_NAME@_CONFIG_INSTALL_DIR} + DESTINATION ${${PROJECT_NAME}_CONFIG_INSTALL_DIR} PATTERN "*.gitignore" EXCLUDE ) - -endif (@PROJECT_NAME@_ENABLE_FM_APP) +endif (${PROJECT_NAME}_ENABLE_FM_APP) diff --git a/KEMField/Source/FastMultipole/Applications/CompareChargeDensities.cc b/KEMField/Source/FastMultipole/Applications/CompareChargeDensities.cc index b1db8a928..0f5281975 100644 --- a/KEMField/Source/FastMultipole/Applications/CompareChargeDensities.cc +++ b/KEMField/Source/FastMultipole/Applications/CompareChargeDensities.cc @@ -342,7 +342,7 @@ int main(int argc, char* argv[]) - std::vector< KEMThreeVector > random_points; + std::vector< KThreeVector > random_points; for(unsigned int i=0; i<100; i++) { @@ -367,7 +367,7 @@ int main(int argc, char* argv[]) z = len*(gsl_rng_uniform(fR)); #endif - random_points.push_back( KEMThreeVector(x,y,z) ); + random_points.push_back( KThreeVector(x,y,z) ); } double l2_pot_diff = 0.0; diff --git a/KEMField/Source/FastMultipole/Applications/TestFastMultipoleDualTree.cc b/KEMField/Source/FastMultipole/Applications/TestFastMultipoleDualTree.cc index 67fcd381f..41a5bd3e3 100644 --- a/KEMField/Source/FastMultipole/Applications/TestFastMultipoleDualTree.cc +++ b/KEMField/Source/FastMultipole/Applications/TestFastMultipoleDualTree.cc @@ -7,6 +7,7 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KGBox.hh" #include "KGRectangle.hh" #include "KGRotatedObject.hh" @@ -20,7 +21,6 @@ #include "KSurface.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" #include "KEMFileInterface.hh" #include "KDataDisplay.hh" @@ -139,8 +139,8 @@ double FieldDifference(double *x, double* /*par*/) KPosition position(point); - KEMThreeVector fmm_field = fast_solver->ElectricField(position); - KEMThreeVector direct_field = direct_solver->ElectricField(position); + KThreeVector fmm_field = fast_solver->ElectricField(position); + KThreeVector direct_field = direct_solver->ElectricField(position); double del = 0; del += (fmm_field[0] - direct_field[0])*(fmm_field[0] - direct_field[0]); del += (fmm_field[1] - direct_field[1])*(fmm_field[1] - direct_field[1]); @@ -419,10 +419,10 @@ int main(int argc, char** argv) //compute the positions of the evaluation points double length_a = 3.0; double length_b = 3.0; - KEMThreeVector direction_a(1.0, 0.0, 0.0); - KEMThreeVector direction_b(0.0, 1.0, 0.0); - KEMThreeVector p0(-1.5, -1.5, 0.0); - KEMThreeVector point; + KThreeVector direction_a(1.0, 0.0, 0.0); + KThreeVector direction_b(0.0, 1.0, 0.0); + KThreeVector p0(-1.5, -1.5, 0.0); + KThreeVector point; for(unsigned int i=0; iElectricField(position); + KThreeVector field = fast_solver->ElectricField(position); fmm_field_x.AddNextValue(field[0]); fmm_field_y.AddNextValue(field[1]); fmm_field_z.AddNextValue(field[2]); @@ -495,7 +495,7 @@ int main(int argc, char** argv) { KPosition position; position = p0 + i*(length_a/NEvaluations)*direction_a + j*(length_b/NEvaluations)*direction_b; - KEMThreeVector field = direct_solver->ElectricField(position); + KThreeVector field = direct_solver->ElectricField(position); direct_field_x.AddNextValue(field[0]); direct_field_y.AddNextValue(field[1]); direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Electrostatics/CMakeLists.txt b/KEMField/Source/FastMultipole/Electrostatics/CMakeLists.txt index a123fb975..17da8a753 100644 --- a/KEMField/Source/FastMultipole/Electrostatics/CMakeLists.txt +++ b/KEMField/Source/FastMultipole/Electrostatics/CMakeLists.txt @@ -44,14 +44,14 @@ set (KFMELECTROSTATICS_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KFMElectrostaticNodeWorkScoreCalculator.cc ) - if (@PROJECT_NAME@_USE_MPI) + if (${PROJECT_NAME}_USE_MPI) list (APPEND KFMELECTROSTATICS_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KFMElectrostaticTreeBuilder_MPI.hh ) list (APPEND KFMELECTROSTATICS_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KFMElectrostaticTreeBuilder_MPI.cc ) - endif (@PROJECT_NAME@_USE_MPI) + endif (${PROJECT_NAME}_USE_MPI) ################################################## diff --git a/KEMField/Source/FastMultipole/Electrostatics/include/KFMElectrostaticParameters.hh b/KEMField/Source/FastMultipole/Electrostatics/include/KFMElectrostaticParameters.hh index 340e6e5ff..26b55b261 100644 --- a/KEMField/Source/FastMultipole/Electrostatics/include/KFMElectrostaticParameters.hh +++ b/KEMField/Source/FastMultipole/Electrostatics/include/KFMElectrostaticParameters.hh @@ -1,6 +1,7 @@ #ifndef KFMElectrostaticParameters_HH__ #define KFMElectrostaticParameters_HH__ +#include "KThreeVector_KEMField.hh" #include "KFMSubdivisionStrategy.hh" /* @@ -16,7 +17,6 @@ * */ -#include "KEMThreeVector.hh" namespace KEMField { diff --git a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/CMakeLists.txt b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/CMakeLists.txt index 1f0334e0d..c521db26e 100644 --- a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/CMakeLists.txt +++ b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/CMakeLists.txt @@ -11,11 +11,11 @@ set (INTERFACE_BOUNDARY_INTEGRAL_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KFMSparseBoundaryIntegralMatrix_CompressedRow.hh ) - if (@PROJECT_NAME@_USE_MPI) + if (${PROJECT_NAME}_USE_MPI) list (APPEND INTERFACE_BOUNDARY_INTEGRAL_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KFMElectrostaticBoundaryIntegrator_MPI.hh ) - endif (@PROJECT_NAME@_USE_MPI) + endif (${PROJECT_NAME}_USE_MPI) ################################################## diff --git a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator.hh b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator.hh index 39fe44ebd..45bb5fe4e 100644 --- a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator.hh +++ b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator.hh @@ -315,7 +315,7 @@ class KFMElectrostaticBoundaryIntegrator: public KElectrostaticBoundaryIntegrato } else { - KEMThreeVector field; + KThreeVector field; fFastFieldSolver.ElectricField(target->GetShape()->Centroid(),field); ret_val = field.Dot(target->GetShape()->Normal()); } @@ -351,7 +351,7 @@ class KFMElectrostaticBoundaryIntegrator: public KElectrostaticBoundaryIntegrato } else { - KEMThreeVector field; + KThreeVector field; fFastFieldSolver.ElectricField(target->GetShape()->Centroid(),field); ret_val = field.Dot(target->GetShape()->Normal()); } diff --git a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator_MPI.hh b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator_MPI.hh index 48ecf361e..004133c24 100644 --- a/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator_MPI.hh +++ b/KEMField/Source/FastMultipole/Interface/BoundaryIntegrals/include/KFMElectrostaticBoundaryIntegrator_MPI.hh @@ -970,7 +970,7 @@ class KFMElectrostaticBoundaryIntegrator_MPI: public KElectrostaticBoundaryInteg } else { - KEMThreeVector field; + KThreeVector field; fFastFieldSolver.ElectricField(fSurfaceContainer.at(id)->GetShape()->Centroid(),field); ret_val = field.Dot(fSurfaceContainer.at(id)->GetShape()->Normal()); } diff --git a/KEMField/Source/FastMultipole/Interface/Extraction/include/KFMTreeSurfaceOrderingPredicate.hh b/KEMField/Source/FastMultipole/Interface/Extraction/include/KFMTreeSurfaceOrderingPredicate.hh index f0a73ef6e..e0b97e4ae 100644 --- a/KEMField/Source/FastMultipole/Interface/Extraction/include/KFMTreeSurfaceOrderingPredicate.hh +++ b/KEMField/Source/FastMultipole/Interface/Extraction/include/KFMTreeSurfaceOrderingPredicate.hh @@ -44,8 +44,8 @@ public KSurfaceOrderingPredicateGetShape()->Centroid(); - KEMThreeVector center_j = fSurfaceContainer[j]->GetShape()->Centroid(); + KThreeVector center_i = fSurfaceContainer[i]->GetShape()->Centroid(); + KThreeVector center_j = fSurfaceContainer[j]->GetShape()->Centroid(); } diff --git a/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMElementAspectRatioExtractor.cc b/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMElementAspectRatioExtractor.cc index 1343e9c73..97ba431bd 100644 --- a/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMElementAspectRatioExtractor.cc +++ b/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMElementAspectRatioExtractor.cc @@ -1,5 +1,6 @@ #include "KFMElementAspectRatioExtractor.hh" -#include "KEMThreeVector.hh" + +#include "KThreeVector_KEMField.hh" namespace KEMField { diff --git a/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMSurfaceToPointCloudConverter.cc b/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMSurfaceToPointCloudConverter.cc index 735fc3bf8..1df68efdb 100644 --- a/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMSurfaceToPointCloudConverter.cc +++ b/KEMField/Source/FastMultipole/Interface/Extraction/src/KFMSurfaceToPointCloudConverter.cc @@ -1,5 +1,6 @@ #include "KFMSurfaceToPointCloudConverter.hh" -#include "KEMThreeVector.hh" + +#include "KThreeVector_KEMField.hh" namespace KEMField { diff --git a/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleFieldSolver.hh b/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleFieldSolver.hh index ade6c74c4..cc47bb106 100644 --- a/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleFieldSolver.hh +++ b/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleFieldSolver.hh @@ -34,7 +34,7 @@ class KFMElectrostaticFastMultipoleFieldSolver //computes the potential and field at a given point double Potential(const KPosition& P) const; - KEMThreeVector ElectricField(const KPosition& P) const; + KThreeVector ElectricField(const KPosition& P) const; //for debugging and information purposes int GetSubsetSize(const KPosition& P) const {SetPoint(P); return fSubsetSize;}; diff --git a/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.hh b/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.hh index 7d605ea08..28ec5e196 100644 --- a/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.hh +++ b/KEMField/Source/FastMultipole/Interface/FieldSolvers/include/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.hh @@ -34,7 +34,7 @@ class KFMElectrostaticFastMultipoleMultipleTreeFieldSolver //computes the potential and field at a given point double Potential(const KPosition& P) const; - KEMThreeVector ElectricField(const KPosition& P) const; + KThreeVector ElectricField(const KPosition& P) const; protected: @@ -69,9 +69,9 @@ class KFMElectrostaticFastMultipoleMultipleTreeFieldSolver mutable std::vector< double > fFastPotential; mutable std::vector< double > fDirectPotential; mutable std::vector< double > fTotalPotential; - mutable std::vector< KEMThreeVector > fFastField; - mutable std::vector< KEMThreeVector > fDirectField; - mutable std::vector< KEMThreeVector > fTotalField; + mutable std::vector< KThreeVector > fFastField; + mutable std::vector< KThreeVector > fDirectField; + mutable std::vector< KThreeVector > fTotalField; }; diff --git a/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleFieldSolver.cc b/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleFieldSolver.cc index 1bb6bd4cd..26e4e4b5e 100644 --- a/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleFieldSolver.cc +++ b/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleFieldSolver.cc @@ -68,7 +68,7 @@ KFMElectrostaticFastMultipoleFieldSolver::Potential(const KPosition& P) const } } -KEMThreeVector +KThreeVector KFMElectrostaticFastMultipoleFieldSolver::ElectricField(const KPosition& P) const { SetPoint(P); @@ -76,13 +76,13 @@ KFMElectrostaticFastMultipoleFieldSolver::ElectricField(const KPosition& P) cons if(!fFallback) { double fast_f[3]; - KEMThreeVector f; + KThreeVector f; fFastFieldSolver.ElectricField(P, fast_f); f[0] = fast_f[0]; f[1] = fast_f[1]; f[2] = fast_f[2]; - KEMThreeVector direct_f; + KThreeVector direct_f; if(fSubsetSize != 0) { diff --git a/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.cc b/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.cc index d323471ea..6a2dfbd0e 100644 --- a/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.cc +++ b/KEMField/Source/FastMultipole/Interface/FieldSolvers/src/KFMElectrostaticFastMultipoleMultipleTreeFieldSolver.cc @@ -47,9 +47,9 @@ KFMElectrostaticFastMultipoleMultipleTreeFieldSolver::AddTree(KFMElectrostaticTr fFastPotential.push_back(0.0); fDirectPotential.push_back(0.0); fTotalPotential.push_back(0.0); - fFastField.push_back(KEMThreeVector()); - fDirectField.push_back(KEMThreeVector()); - fTotalField.push_back(KEMThreeVector()); + fFastField.push_back(KThreeVector()); + fDirectField.push_back(KThreeVector()); + fTotalField.push_back(KThreeVector()); } @@ -105,7 +105,7 @@ KFMElectrostaticFastMultipoleMultipleTreeFieldSolver::Potential(const KPosition& } -KEMThreeVector +KThreeVector KFMElectrostaticFastMultipoleMultipleTreeFieldSolver::ElectricField(const KPosition& P) const { //weighted average of different tree fields @@ -159,7 +159,7 @@ KFMElectrostaticFastMultipoleMultipleTreeFieldSolver::ElectricField(const KPosit } } - KEMThreeVector val; + KThreeVector val; val[0] = numer_x/denom; val[1] = numer_y/denom; val[2] = numer_z/denom; diff --git a/KEMField/Source/FastMultipole/Math/include/KFMPoint.hh b/KEMField/Source/FastMultipole/Math/include/KFMPoint.hh index 17e8f5176..3f76cfa91 100644 --- a/KEMField/Source/FastMultipole/Math/include/KFMPoint.hh +++ b/KEMField/Source/FastMultipole/Math/include/KFMPoint.hh @@ -197,7 +197,7 @@ inline double operator*( const KFMPoint& aLeft, const KFMPoint& aRig } template -inline KFMPoint operator*( register double aScalar, const KFMPoint& aVector ) +inline KFMPoint operator*( double aScalar, const KFMPoint& aVector ) { KFMPoint aResult( aVector ); for(unsigned int i=0; i operator*( register double aScalar, const KFMPoint& } template -inline KFMPoint operator*( const KFMPoint& aVector, register double aScalar ) +inline KFMPoint operator*( const KFMPoint& aVector, double aScalar ) { KFMPoint aResult( aVector ); for(unsigned int i=0; i operator*( const KFMPoint& aVector, register double } template -inline KFMPoint& operator*=( KFMPoint& aVector, register double aScalar ) +inline KFMPoint& operator*=( KFMPoint& aVector, double aScalar ) { for(unsigned int i=0; i& operator*=( KFMPoint& aVector, register double aSca } template -inline KFMPoint operator/( const KFMPoint& aVector, register double aScalar ) +inline KFMPoint operator/( const KFMPoint& aVector, double aScalar ) { KFMPoint aResult( aVector ); for(unsigned int i=0; i operator/( const KFMPoint& aVector, register double } template -inline KFMPoint& operator/=( KFMPoint& aVector, register double aScalar ) +inline KFMPoint& operator/=( KFMPoint& aVector, double aScalar ) { for(unsigned int i=0; i #include +#include "KThreeVector_KEMField.hh" #include "KGBox.hh" #include "KGRectangle.hh" #include "KGRotatedObject.hh" @@ -20,7 +21,6 @@ #include "KSurface.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" #include "KEMFileInterface.hh" #include "KDataDisplay.hh" @@ -123,8 +123,8 @@ double FieldDifference(double *x, double* /*par*/) KPosition position(point); - KEMThreeVector fmm_field = fast_solver->ElectricField(position); - KEMThreeVector direct_field = direct_solver->ElectricField(position); + KThreeVector fmm_field = fast_solver->ElectricField(position); + KThreeVector direct_field = direct_solver->ElectricField(position); double del = 0; del += (fmm_field[0] - direct_field[0])*(fmm_field[0] - direct_field[0]); del += (fmm_field[1] - direct_field[1])*(fmm_field[1] - direct_field[1]); @@ -348,10 +348,10 @@ int main(int argc, char** argv) //compute the positions of the evaluation points double length_a = 3.0; double length_b = 3.0; - KEMThreeVector direction_a(1.0, 0.0, 0.0); - KEMThreeVector direction_b(0.0, 1.0, 0.0); - KEMThreeVector p0(-1.5, -1.5, 0.0); - KEMThreeVector point; + KThreeVector direction_a(1.0, 0.0, 0.0); + KThreeVector direction_b(0.0, 1.0, 0.0); + KThreeVector p0(-1.5, -1.5, 0.0); + KThreeVector point; for(unsigned int i=0; iElectricField(position); + KThreeVector field = fast_solver->ElectricField(position); fmm_field_x.AddNextValue(field[0]); fmm_field_y.AddNextValue(field[1]); fmm_field_z.AddNextValue(field[2]); @@ -424,7 +424,7 @@ int main(int argc, char** argv) { KPosition position; position = p0 + i*(length_a/NEvaluations)*direction_a + j*(length_b/NEvaluations)*direction_b; - KEMThreeVector field = direct_solver->ElectricField(position); + KThreeVector field = direct_solver->ElectricField(position); direct_field_x.AddNextValue(field[0]); direct_field_y.AddNextValue(field[1]); direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldMap.cc b/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldMap.cc index 5949cd477..7bc5f9187 100644 --- a/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldMap.cc +++ b/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldMap.cc @@ -7,6 +7,7 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KGBox.hh" @@ -22,7 +23,6 @@ #include "KSurface.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" #include "KEMFileInterface.hh" #include "KDataDisplay.hh" @@ -463,21 +463,21 @@ int main(int argc, char** argv) double length_b = world_length/2.0 - 0.001*world_length; KFMPoint<3> center = world->GetCenter(); - KEMThreeVector direction_a; - KEMThreeVector direction_b; - KEMThreeVector direction_c; + KThreeVector direction_a; + KThreeVector direction_b; + KThreeVector direction_c; - KEMThreeVector p0(center[0], center[1], center[2]); - KEMThreeVector point; + KThreeVector p0(center[0], center[1], center[2]); + KThreeVector point; unsigned int n_points = 0; - KEMThreeVector* points; + KThreeVector* points; switch( mode ) { case 0: //x-axis n_points = n_evaluations; - points = new KEMThreeVector[n_points]; + points = new KThreeVector[n_points]; direction_a[0] = 1.0; direction_a[1] = 0.0; direction_a[2] = 0.0; p0 = p0 - length_a*direction_a; for(unsigned int i=0; iElectricField(points[i]); + KThreeVector field = fast_solver->ElectricField(points[i]); fmm_field_x.AddNextValue(field[0]); fmm_field_y.AddNextValue(field[1]); fmm_field_z.AddNextValue(field[2]); @@ -640,7 +640,7 @@ int main(int argc, char** argv) //evaluate direct field for(unsigned int i=0; iElectricField(points[i]); + KThreeVector field = direct_solver->ElectricField(points[i]); direct_field_x.AddNextValue(field[0]); direct_field_y.AddNextValue(field[1]); direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldSolver.cc b/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldSolver.cc index a38715266..671cda77f 100644 --- a/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldSolver.cc +++ b/KEMField/Source/FastMultipole/Test/TestFastMultipoleFieldSolver.cc @@ -7,6 +7,7 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KGBox.hh" #include "KGRectangle.hh" #include "KGRotatedObject.hh" @@ -20,7 +21,6 @@ #include "KSurface.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" #include "KEMFileInterface.hh" #include "KBoundaryIntegralMatrix.hh" @@ -581,21 +581,21 @@ int main(int argc, char** argv) double length_b = world_length/2.0 - 0.001*world_length; KFMPoint<3> center = world->GetCenter(); - KEMThreeVector direction_a; - KEMThreeVector direction_b; - KEMThreeVector direction_c; + KThreeVector direction_a; + KThreeVector direction_b; + KThreeVector direction_c; - KEMThreeVector p0(center[0], center[1], center[2]); - KEMThreeVector point; + KThreeVector p0(center[0], center[1], center[2]); + KThreeVector point; unsigned int n_points = 0; - KEMThreeVector* points = NULL; + KThreeVector* points = NULL; switch( mode ) { case 0: //x-axis n_points = n_evaluations; - points = new KEMThreeVector[n_points]; + points = new KThreeVector[n_points]; direction_a[0] = 1.0; direction_a[1] = 0.0; direction_a[2] = 0.0; p0 = p0 - length_a*direction_a; for(unsigned int i=0; iElectricField(points[i]); + KThreeVector field = fast_solver->ElectricField(points[i]); fmm_field_x.AddNextValue(field[0]); fmm_field_y.AddNextValue(field[1]); fmm_field_z.AddNextValue(field[2]); @@ -761,7 +761,7 @@ int main(int argc, char** argv) //evaluate direct field for(unsigned int i=0; iElectricField(points[i]); + KThreeVector field = direct_solver->ElectricField(points[i]); direct_field_x.AddNextValue(field[0]); direct_field_y.AddNextValue(field[1]); direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Test/TestFastMultipoleTranslation.cc b/KEMField/Source/FastMultipole/Test/TestFastMultipoleTranslation.cc index 18e5795d4..9af79eac6 100644 --- a/KEMField/Source/FastMultipole/Test/TestFastMultipoleTranslation.cc +++ b/KEMField/Source/FastMultipole/Test/TestFastMultipoleTranslation.cc @@ -6,8 +6,6 @@ #include "KFMPoint.hh" #include "KFMPointCloud.hh" -#include "KEMThreeVector.hh" - #include "KVMPathIntegral.hh" #include "KVMLineIntegral.hh" #include "KVMSurfaceIntegral.hh" @@ -26,6 +24,7 @@ #include #include +#include "KThreeVector_KEMField.hh" using namespace KEMField; @@ -42,13 +41,13 @@ int main() aCalc->SetDegree(degree); - KEMThreeVector origin1(0.,0.,0.); - KEMThreeVector origin2(1.32, 0.434231, 0.34534); - KEMThreeVector point(1.4, 2.1454, 1.343432); - KEMThreeVector del1 = point - origin1; - KEMThreeVector del2 = point - origin2; - KEMThreeVector del_origin = origin2 - origin1; - KEMThreeVector del_origin_par = origin1 - origin2; + KThreeVector origin1(0.,0.,0.); + KThreeVector origin2(1.32, 0.434231, 0.34534); + KThreeVector point(1.4, 2.1454, 1.343432); + KThreeVector del1 = point - origin1; + KThreeVector del2 = point - origin2; + KThreeVector del_origin = origin2 - origin1; + KThreeVector del_origin_par = origin1 - origin2; std::vector< std::complex > source; std::vector< std::complex > source1; diff --git a/KEMField/Source/FastMultipole/Test/TestMultilevelPreconditioners.cc b/KEMField/Source/FastMultipole/Test/TestMultilevelPreconditioners.cc index 91216a302..c50579c6d 100644 --- a/KEMField/Source/FastMultipole/Test/TestMultilevelPreconditioners.cc +++ b/KEMField/Source/FastMultipole/Test/TestMultilevelPreconditioners.cc @@ -7,6 +7,7 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KGBox.hh" #include "KGRectangle.hh" #include "KGRotatedObject.hh" @@ -20,7 +21,6 @@ #include "KSurface.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" #include "KEMFileInterface.hh" #include "KElectrostaticIntegratingFieldSolver.hh" @@ -613,21 +613,21 @@ int main(int argc, char** argv) // double length_b = world_length/2.0 - 0.001*world_length; // KFMPoint<3> center = world->GetCenter(); // - // KEMThreeVector direction_a; - // KEMThreeVector direction_b; - // KEMThreeVector direction_c; + // KThreeVector direction_a; + // KThreeVector direction_b; + // KThreeVector direction_c; // - // KEMThreeVector p0(center[0], center[1], center[2]); - // KEMThreeVector point; + // KThreeVector p0(center[0], center[1], center[2]); + // KThreeVector point; // // unsigned int n_points = 0; - // KEMThreeVector* points; + // KThreeVector* points; // // switch( mode ) // { // case 0: //x-axis // n_points = n_evaluations; - // points = new KEMThreeVector[n_points]; + // points = new KThreeVector[n_points]; // direction_a[0] = 1.0; direction_a[1] = 0.0; direction_a[2] = 0.0; // p0 = p0 - length_a*direction_a; // for(unsigned int i=0; iElectricField(points[i]); + // KThreeVector field = fast_solver->ElectricField(points[i]); // fmm_field_x.AddNextValue(field[0]); // fmm_field_y.AddNextValue(field[1]); // fmm_field_z.AddNextValue(field[2]); @@ -793,7 +793,7 @@ int main(int argc, char** argv) // //evaluate direct field // for(unsigned int i=0; iElectricField(points[i]); + // KThreeVector field = direct_solver->ElectricField(points[i]); // direct_field_x.AddNextValue(field[0]); // direct_field_y.AddNextValue(field[1]); // direct_field_z.AddNextValue(field[2]); diff --git a/KEMField/Source/FastMultipole/Test/TestMultipoleCalculators.cc b/KEMField/Source/FastMultipole/Test/TestMultipoleCalculators.cc index aa12bc1b7..8d13137fd 100644 --- a/KEMField/Source/FastMultipole/Test/TestMultipoleCalculators.cc +++ b/KEMField/Source/FastMultipole/Test/TestMultipoleCalculators.cc @@ -12,7 +12,7 @@ #include "KFMPoint.hh" #include "KFMPointCloud.hh" -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KVMPathIntegral.hh" #include "KVMLineIntegral.hh" @@ -93,15 +93,15 @@ void GenerateTriangle(gsl_rng* rng, double r, double& a, double& b, double* p0, //now make sure that it is an acute triangle - KEMThreeVector v0(p0[0], p0[1], p0[2]); - KEMThreeVector v1(p1[0], p1[1], p1[2]); - KEMThreeVector v2(p2[0], p2[1], p2[2]); - KEMThreeVector vn1 = (v1 - v0); + KThreeVector v0(p0[0], p0[1], p0[2]); + KThreeVector v1(p1[0], p1[1], p1[2]); + KThreeVector v2(p2[0], p2[1], p2[2]); + KThreeVector vn1 = (v1 - v0); a = vn1.Magnitude(); vn1 = vn1.Unit(); n1[0] = vn1.X(); n1[1] = vn1.Y(); n1[2] = vn1.Z(); - KEMThreeVector vn2 = (v2 - v0); + KThreeVector vn2 = (v2 - v0); b = vn2.Magnitude(); vn2 = vn2.Unit(); n2[0] = vn2.X(); n2[1] = vn2.Y(); n2[2] = vn2.Z(); @@ -159,9 +159,9 @@ void GenerateRectangle(gsl_rng* rng, double r, double& a, double& b, double* p0, n4[2] = r*(z/norm); //take cross product with first direction so we know we have perpendicular vectors - KEMThreeVector v1(n1[0], n1[1], n1[2]); - KEMThreeVector v4(n4[0], n4[1], n4[2]); - KEMThreeVector v2 = v1.Cross(v4); + KThreeVector v1(n1[0], n1[1], n1[2]); + KThreeVector v4(n4[0], n4[1], n4[2]); + KThreeVector v2 = v1.Cross(v4); v2 = v2.Unit(); n2[0] = v2[0]; n2[1] = v2[1]; @@ -234,6 +234,7 @@ int main(int argc, char* argv[]) unsigned int samples = 10; (void) samples; //remove unused var warning when GSL is not available unsigned int oclforce = 0; + (void) oclforce; unsigned int degree = 3; static struct option longOptions[] = @@ -313,12 +314,12 @@ int main(int argc, char* argv[]) double z_offset = 1.1; //triangle descriptors - KEMThreeVector v1(-1.,0.,0.); - KEMThreeVector v2(0.5, std::sqrt(3.)/2.0, z_offset) ; - KEMThreeVector v3(0.5, -1.0*std::sqrt(3.0)/2.0, z_offset); + KThreeVector v1(-1.,0.,0.); + KThreeVector v2(0.5, std::sqrt(3.)/2.0, z_offset) ; + KThreeVector v3(0.5, -1.0*std::sqrt(3.0)/2.0, z_offset); - KEMThreeVector axis1 = (v2 - v1).Unit(); - KEMThreeVector axis2 = (v3 - v1).Unit(); + KThreeVector axis1 = (v2 - v1).Unit(); + KThreeVector axis2 = (v3 - v1).Unit(); axis1 = axis1.Unit(); axis2 = axis2.Unit(); double Tsize = 1; @@ -327,8 +328,8 @@ int main(int argc, char* argv[]) double TriA = Tsize*(v2 - v1).Magnitude();//1.732038; //length of side 1 double TriB = Tsize*(v3 - v1).Magnitude();//1.732038; //lenght of side 2 double TriP[3] = {0.0,0.0,0.};//{v1.X(), v1.Y(), v1.Z()};// {Tsize,0,z_offset}; //corner1 - KEMThreeVector TriP2;//corner2 - KEMThreeVector TriP3; //corner3 + KThreeVector TriP2;//corner2 + KThreeVector TriP3; //corner3 TriP2.SetComponents(TriP[0], TriP[1], TriP[2]); TriP2 += TriA*axis1; TriP3.SetComponents(TriP[0], TriP[1], TriP[2]); @@ -347,7 +348,7 @@ int main(int argc, char* argv[]) double WireLength = 1.1010101; // double WireDiameter = 0.01; double WireStartPoint[3] = {0,0,0}; - KEMThreeVector dir(1.,2.,3.); dir = dir.Unit(); + KThreeVector dir(1.,2.,3.); dir = dir.Unit(); double WireDirection[3] = {dir[0], dir[1], dir[2]}; double WireEndPoint[3] = {WireStartPoint[0]+WireLength*WireDirection[0], WireStartPoint[1]+WireLength*WireDirection[1], @@ -382,7 +383,7 @@ int main(int argc, char* argv[]) double origin[3]; - KEMThreeVector origin_vec(0.,0.,-1.0); + KThreeVector origin_vec(0.,0.,-1.0); origin_vec = origin_vec.Unit(); double mag = 1.0; origin_vec *= mag; diff --git a/KEMField/Source/FastMultipole/Test/TestMultipoleExpansionSpeed.cc b/KEMField/Source/FastMultipole/Test/TestMultipoleExpansionSpeed.cc index 9bb4f32bd..65854c3c9 100644 --- a/KEMField/Source/FastMultipole/Test/TestMultipoleExpansionSpeed.cc +++ b/KEMField/Source/FastMultipole/Test/TestMultipoleExpansionSpeed.cc @@ -24,7 +24,7 @@ #include "KFMPoint.hh" #include "KFMPointCloud.hh" -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KVMPathIntegral.hh" #include "KVMLineIntegral.hh" diff --git a/KEMField/Source/FastMultipole/Test/TestSingleTriangleMultipoleExpansion.cc b/KEMField/Source/FastMultipole/Test/TestSingleTriangleMultipoleExpansion.cc index aabdbf75a..8d18e8fa0 100644 --- a/KEMField/Source/FastMultipole/Test/TestSingleTriangleMultipoleExpansion.cc +++ b/KEMField/Source/FastMultipole/Test/TestSingleTriangleMultipoleExpansion.cc @@ -24,7 +24,7 @@ #include "KFMPoint.hh" #include "KFMPointCloud.hh" -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KVMPathIntegral.hh" #include "KVMLineIntegral.hh" diff --git a/KEMField/Source/FastMultipole/Test/TestVectorMath.cc b/KEMField/Source/FastMultipole/Test/TestVectorMath.cc index 5fc6253a1..8e3515a8a 100644 --- a/KEMField/Source/FastMultipole/Test/TestVectorMath.cc +++ b/KEMField/Source/FastMultipole/Test/TestVectorMath.cc @@ -2,8 +2,7 @@ #include #include -#include "KEMThreeVector.hh" - +#include "KThreeVector_KEMField.hh" #include "KVMPathIntegral.hh" #include "KVMLineIntegral.hh" #include "KVMSurfaceIntegral.hh" @@ -60,11 +59,11 @@ class FieldTestCase range[2] = dom[2] - fOrigin.Z(); } - void SetOrigin(KEMThreeVector origin){fOrigin = origin;}; + void SetOrigin(KThreeVector origin){fOrigin = origin;}; private: - KEMThreeVector fOrigin; + KThreeVector fOrigin; }; @@ -75,11 +74,11 @@ int main(int /*argc*/, char** /*argv[]*/) double z_offset = 0.0; //triangle descriptors - KEMThreeVector v1(1.,0.,0.); - KEMThreeVector v2(-0.5, std::sqrt(3.)/2.0, z_offset); - KEMThreeVector v3(-0.5, -1.0*std::sqrt(3.0)/2.0, z_offset); - KEMThreeVector axis1 = (v2 - v1).Unit(); - KEMThreeVector axis2 = (v3 - v1).Unit(); + KThreeVector v1(1.,0.,0.); + KThreeVector v2(-0.5, std::sqrt(3.)/2.0, z_offset); + KThreeVector v3(-0.5, -1.0*std::sqrt(3.0)/2.0, z_offset); + KThreeVector axis1 = (v2 - v1).Unit(); + KThreeVector axis2 = (v3 - v1).Unit(); axis1 = axis1.Unit(); axis2 = axis2.Unit(); double Tsize = 1; @@ -88,8 +87,8 @@ int main(int /*argc*/, char** /*argv[]*/) double TriA = Tsize*(v2 - v1).Magnitude();//1.732038; //length of side 1 double TriB = Tsize*(v3 - v1).Magnitude();//1.732038; //lenght of side 2 double TriP[3] = {Tsize,0,z_offset}; //corner1 - KEMThreeVector TriP2;//corner2 - KEMThreeVector TriP3; //corner3 + KThreeVector TriP2;//corner2 + KThreeVector TriP3; //corner3 TriP2.SetComponents(TriP[0], TriP[1], TriP[2]); TriP2 += TriA*axis1; TriP3.SetComponents(TriP[0], TriP[1], TriP[2]); @@ -108,7 +107,7 @@ int main(int /*argc*/, char** /*argv[]*/) double WireLength = 1.1010101; //double WireDiameter = 0.01; double WireStartPoint[3] = {0,0,0}; - KEMThreeVector dir(1.,2.,3.); dir = dir.Unit(); + KThreeVector dir(1.,2.,3.); dir = dir.Unit(); double WireDirection[3] = {dir[0], dir[1], dir[2]}; double WireEndPoint[3] = {WireStartPoint[0]+WireLength*WireDirection[0], WireStartPoint[1]+WireLength*WireDirection[1], @@ -133,7 +132,7 @@ int main(int /*argc*/, char** /*argv[]*/) FieldTestCase testcase; //set some internal variables - KEMThreeVector o(0.,0.,0.); + KThreeVector o(0.,0.,0.); testcase.SetOrigin(o); //all functions that we wish to integrate over must take as an argument diff --git a/KEMField/Source/FastMultipole/Tree/CMakeLists.txt b/KEMField/Source/FastMultipole/Tree/CMakeLists.txt index b9868616d..b92cb5cf7 100644 --- a/KEMField/Source/FastMultipole/Tree/CMakeLists.txt +++ b/KEMField/Source/FastMultipole/Tree/CMakeLists.txt @@ -49,11 +49,11 @@ set (TREE_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KFMWorkLoadBalanceWeights.hh ) -if (@PROJECT_NAME@_USE_MPI) +if (${PROJECT_NAME}_USE_MPI) list (APPEND TREE_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KFMCubicSpaceTreeStaticLoadBalancer.hh ) -endif (@PROJECT_NAME@_USE_MPI) +endif (${PROJECT_NAME}_USE_MPI) set (TREE_SOURCEFILES diff --git a/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentLocalToLocalConverter.hh b/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentLocalToLocalConverter.hh index bfe6abfa5..40eddc3fa 100644 --- a/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentLocalToLocalConverter.hh +++ b/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentLocalToLocalConverter.hh @@ -260,7 +260,6 @@ class KFMScalarMomentLocalToLocalConverter: public KFMNodeActor< KFMNode zero(0,0); unsigned int tsi = 0; for(int j=0; j <= fDegree; j++) { diff --git a/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentRemoteToLocalConverter.hh b/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentRemoteToLocalConverter.hh index 912fc1791..436f4d16c 100644 --- a/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentRemoteToLocalConverter.hh +++ b/KEMField/Source/FastMultipole/Tree/include/KFMScalarMomentRemoteToLocalConverter.hh @@ -518,9 +518,6 @@ class KFMScalarMomentRemoteToLocalConverter: public KFMNodeActor< KFMNodeExecuteOperation(); } - //pointwise multiply the multipoles with the (DFT'd) response functions and sum - std::complex zero(0,0); - //since the local coefficients with k < 0 are conjuates of the k > 0 coefficients //we only need to compute values of k <= 0, this saves about a factor of two computation unsigned int tsi; diff --git a/KEMField/Source/FastMultipole/Utility/CMakeLists.txt b/KEMField/Source/FastMultipole/Utility/CMakeLists.txt index b0330a792..5ed4cf4f2 100644 --- a/KEMField/Source/FastMultipole/Utility/CMakeLists.txt +++ b/KEMField/Source/FastMultipole/Utility/CMakeLists.txt @@ -42,18 +42,18 @@ set (KFM_UTIL_LIBS KEMIO ) -if(@PROJECT_NAME@_USE_OPENCL) +if(${PROJECT_NAME}_USE_OPENCL) list (APPEND KFM_UTIL_LIBS KEMOpenCLPlugin ${OPENCL_LIBRARIES}) add_cflag (KEMFIELD_USE_OPENCL) -endif(@PROJECT_NAME@_USE_OPENCL) +endif(${PROJECT_NAME}_USE_OPENCL) -if (@PROJECT_NAME@_USE_VTK) +if (${PROJECT_NAME}_USE_VTK) list (APPEND KFM_UTIL_LIBS KEMVTKPlugin) add_cflag (KEMFIELD_USE_VTK) -endif (@PROJECT_NAME@_USE_VTK) +endif (${PROJECT_NAME}_USE_VTK) add_library (KFMUtility SHARED ${KFM_UTIL_SOURCEFILES}) -target_link_libraries (KFMUtility ${KFM_UTIL_LIBS}) +target_link_libraries (KFMUtility ${Kommon_LIBRARIES} ${KGeoBag_LIBRARIES} ${KFM_UTIL_LIBS}) kasper_install_headers (${KFM_UTIL_HEADERFILES}) kasper_install_libraries (KFMUtility) diff --git a/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticMatrixGenerator.hh b/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticMatrixGenerator.hh index 005b44773..f1eaa6d08 100644 --- a/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticMatrixGenerator.hh +++ b/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticMatrixGenerator.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_INTERFACE_BOUNDARYINTEGRALS_KFMELECTROSTATICMATRIXGENERATOR_HH_ -#define KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_INTERFACE_BOUNDARYINTEGRALS_KFMELECTROSTATICMATRIXGENERATOR_HH_ +#ifndef KFMELECTROSTATICMATRIXGENERATOR_HH_ +#define KFMELECTROSTATICMATRIXGENERATOR_HH_ #include "KBoundaryMatrixGenerator.hh" @@ -28,4 +28,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_INTERFACE_BOUNDARYINTEGRALS_KFMELECTROSTATICMATRIXGENERATOR_HH_ */ +#endif /* KFMELECTROSTATICMATRIXGENERATOR_HH_ */ diff --git a/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticTypes.hh b/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticTypes.hh index 0a45a479c..9076b5ad8 100644 --- a/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticTypes.hh +++ b/KEMField/Source/FastMultipole/Utility/include/KFMElectrostaticTypes.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFMELECTROSTATICTYPES_HH_ -#define KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFMELECTROSTATICTYPES_HH_ +#ifndef KFMELECTROSTATICTYPES_HH_ +#define KFMELECTROSTATICTYPES_HH_ #include "KFMElectrostaticBoundaryIntegrator.hh" @@ -92,4 +92,4 @@ FastMultipoleMatrix; -#endif /* KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFMELECTROSTATICTYPES_HH_ */ +#endif /* KFMELECTROSTATICTYPES_HH_ */ diff --git a/KEMField/Source/FastMultipole/Utility/include/KFastMultipoleMatrixGenerator.hh b/KEMField/Source/FastMultipole/Utility/include/KFastMultipoleMatrixGenerator.hh index 8a7757148..b31e6b869 100644 --- a/KEMField/Source/FastMultipole/Utility/include/KFastMultipoleMatrixGenerator.hh +++ b/KEMField/Source/FastMultipole/Utility/include/KFastMultipoleMatrixGenerator.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFASTMULTIPOLEMATRIXGENERATOR_HH_ -#define KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFASTMULTIPOLEMATRIXGENERATOR_HH_ +#ifndef KFASTMULTIPOLEMATRIXGENERATOR_HH_ +#define KFASTMULTIPOLEMATRIXGENERATOR_HH_ #include "KFMElectrostaticTypes.hh" #include "KBoundaryMatrixGenerator.hh" @@ -104,4 +104,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FASTMULTIPOLE_UTILITY_INCLUDE_KFASTMULTIPOLEMATRIXGENERATOR_HH_ */ +#endif /* KFASTMULTIPOLEMATRIXGENERATOR_HH_ */ diff --git a/KEMField/Source/FieldSolvers/Integrating/include/KElectrostaticIntegratingFieldSolver.hh b/KEMField/Source/FieldSolvers/Integrating/include/KElectrostaticIntegratingFieldSolver.hh index 6e422db06..bc9e128a1 100644 --- a/KEMField/Source/FieldSolvers/Integrating/include/KElectrostaticIntegratingFieldSolver.hh +++ b/KEMField/Source/FieldSolvers/Integrating/include/KElectrostaticIntegratingFieldSolver.hh @@ -20,17 +20,17 @@ public: virtual void Initialize() {} double Potential(const KPosition& P) const; - KEMThreeVector ElectricField(const KPosition& P) const; - std::pair ElectricFieldAndPotential(const KPosition& P) const; + KThreeVector ElectricField(const KPosition& P) const; + std::pair ElectricFieldAndPotential(const KPosition& P) const; // functions without Kahan summation double PotentialNoKahanSum(const KPosition& P) const; - KEMThreeVector ElectricFieldNoKahanSum(const KPosition& P) const; - std::pair ElectricFieldAndPotentialNoKahanSum(const KPosition& P) const; + KThreeVector ElectricFieldNoKahanSum(const KPosition& P) const; + std::pair ElectricFieldAndPotentialNoKahanSum(const KPosition& P) const; double Potential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const; - KEMThreeVector ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const; - std::pair ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const; + KThreeVector ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const; + std::pair ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const; protected: const KSurfaceContainer& fContainer; @@ -99,11 +99,11 @@ private: } void SetPosition(const KPosition& p) const { fP = p; } - KEMThreeVector& GetNormalizedElectricField() const { return fElectricField;} + KThreeVector& GetNormalizedElectricField() const { return fElectricField;} private: mutable KPosition fP; - mutable KEMThreeVector fElectricField; + mutable KThreeVector fElectricField; Integrator& fIntegrator; }; @@ -134,11 +134,11 @@ private: } void SetPosition(const KPosition& p) const { fP = p; } - std::pair& GetNormalizedElectricFieldAndPotential() const { return fElectricFieldAndPotential;} + std::pair& GetNormalizedElectricFieldAndPotential() const { return fElectricFieldAndPotential;} private: mutable KPosition fP; - mutable std::pair fElectricFieldAndPotential; + mutable std::pair fElectricFieldAndPotential; Integrator& fIntegrator; }; @@ -183,14 +183,14 @@ double KIntegratingFieldSolver::Potential } template -KEMThreeVector KIntegratingFieldSolver::ElectricField(const KPosition& P) const +KThreeVector KIntegratingFieldSolver::ElectricField(const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricField.SetPosition(P); - KEMThreeVector sum(0.,0.,0.); - KEMThreeVector c(0.,0.,0.); - KEMThreeVector y(0.,0.,0.); - KEMThreeVector t(0.,0.,0.); + KThreeVector sum(0.,0.,0.); + KThreeVector c(0.,0.,0.); + KThreeVector y(0.,0.,0.); + KThreeVector t(0.,0.,0.); KSurfaceContainer::iterator it; for (it=fContainer.begin();it!=fContainer.end();++it) { @@ -204,15 +204,15 @@ KEMThreeVector KIntegratingFieldSolver::E } template -std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const KPosition& P) const +std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricFieldAndPotential.SetPosition(P); - KEMThreeVector sumField(0.,0.,0.); - KEMThreeVector cField(0.,0.,0.); - KEMThreeVector yField(0.,0.,0.); - KEMThreeVector tField(0.,0.,0.); + KThreeVector sumField(0.,0.,0.); + KThreeVector cField(0.,0.,0.); + KThreeVector yField(0.,0.,0.); + KThreeVector tField(0.,0.,0.); double sumPot = 0.; double cPot = 0.; @@ -220,7 +220,7 @@ std::pair KIntegratingFieldSolver itFieldAndPot; + std::pair itFieldAndPot; double itBasisValue = 0.; for (it=fContainer.begin();it!=fContainer.end();++it) @@ -259,11 +259,11 @@ double KIntegratingFieldSolver::Potential } template -KEMThreeVector KIntegratingFieldSolver::ElectricFieldNoKahanSum(const KPosition& P) const +KThreeVector KIntegratingFieldSolver::ElectricFieldNoKahanSum(const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricField.SetPosition(P); - KEMThreeVector sum(0.,0.,0.); + KThreeVector sum(0.,0.,0.); KSurfaceContainer::iterator it; for (it=fContainer.begin();it!=fContainer.end();++it) { @@ -274,16 +274,16 @@ KEMThreeVector KIntegratingFieldSolver::E } template -std::pair KIntegratingFieldSolver::ElectricFieldAndPotentialNoKahanSum(const KPosition& P) const +std::pair KIntegratingFieldSolver::ElectricFieldAndPotentialNoKahanSum(const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricFieldAndPotential.SetPosition(P); - KEMThreeVector sumField(0.,0.,0.); + KThreeVector sumField(0.,0.,0.); double sumPot = 0.; KSurfaceContainer::iterator it; - std::pair itFieldAndPot; + std::pair itFieldAndPot; double itBasisValue = 0.; for (it=fContainer.begin();it!=fContainer.end();++it) @@ -322,14 +322,14 @@ double KIntegratingFieldSolver::Potential } template -KEMThreeVector KIntegratingFieldSolver::ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const +KThreeVector KIntegratingFieldSolver::ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricField.SetPosition(P); - KEMThreeVector sum(0.,0.,0.); - KEMThreeVector c(0.,0.,0.); - KEMThreeVector y(0.,0.,0.); - KEMThreeVector t(0.,0.,0.); + KThreeVector sum(0.,0.,0.); + KThreeVector c(0.,0.,0.); + KThreeVector y(0.,0.,0.); + KThreeVector t(0.,0.,0.); unsigned int id; for(unsigned int i=0; i::E } template -std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const +std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& P) const { // Kahan Sum to mitigate rounding error fShapeVisitorForElectricFieldAndPotential.SetPosition(P); - KEMThreeVector sumField(0.,0.,0.); - KEMThreeVector cField(0.,0.,0.); - KEMThreeVector yField(0.,0.,0.); - KEMThreeVector tField(0.,0.,0.); + KThreeVector sumField(0.,0.,0.); + KThreeVector cField(0.,0.,0.); + KThreeVector yField(0.,0.,0.); + KThreeVector tField(0.,0.,0.); double sumPot = 0.; double cPot = 0.; @@ -360,7 +360,7 @@ std::pair KIntegratingFieldSolver itFieldAndPot; + std::pair itFieldAndPot; double itBasisValue = 0.; unsigned int id; diff --git a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectromagnetZonalHarmonicFieldSolver.hh b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectromagnetZonalHarmonicFieldSolver.hh index ae19a0698..da95ae3e5 100644 --- a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectromagnetZonalHarmonicFieldSolver.hh +++ b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectromagnetZonalHarmonicFieldSolver.hh @@ -1,9 +1,8 @@ #ifndef KELECTROMAGNETZONALHARMONICFIELDSOLVER_DEF #define KELECTROMAGNETZONALHARMONICFIELDSOLVER_DEF -#include "KEMThreeVector.hh" -#include "KEMThreeMatrix.hh" - +#include "KThreeMatrix_KEMField.hh" +#include "KThreeVector_KEMField.hh" #include "KZonalHarmonicComputer.hh" #include "KElectromagnetIntegratingFieldSolver.hh" @@ -31,23 +30,23 @@ namespace KEMField virtual ~KZonalHarmonicFieldSolver() {} - KEMThreeVector VectorPotential(const KPosition& P) const; - KEMThreeVector MagneticField(const KPosition& P) const; + KThreeVector VectorPotential(const KPosition& P) const; + KThreeVector MagneticField(const KPosition& P) const; KGradient MagneticFieldGradient(const KPosition& P) const; - std::pair MagneticFieldAndGradient(const KPosition& P) const; + std::pair MagneticFieldAndGradient(const KPosition& P) const; private: KZHLegendreCoefficients* fZHCoeffSingleton; bool CentralExpansionMagneticField(const KPosition& P, - KEMThreeVector& B) const; + KThreeVector& B) const; bool CentralExpansionVectorPotential(const KPosition& P, - KEMThreeVector& A) const; + KThreeVector& A) const; bool RemoteExpansionMagneticField(const KPosition& P, - KEMThreeVector& B) const; + KThreeVector& B) const; bool RemoteExpansionVectorPotential(const KPosition& P, - KEMThreeVector& A) const; + KThreeVector& A) const; bool CentralGradientExpansion(const KPosition& P, KGradient& g) const; bool RemoteGradientExpansion(const KPosition& P, @@ -58,10 +57,10 @@ namespace KEMField KGradient& g) const; bool CentralMagneticFieldAndGradientExpansion(const KPosition& P, KGradient& g, - KEMThreeVector& B) const; + KThreeVector& B) const; bool RemoteMagneticFieldAndGradientExpansion(const KPosition& P, KGradient& g, - KEMThreeVector& B) const; + KThreeVector& B) const; KIntegratingFieldSolver fIntegratingFieldSolver; @@ -69,7 +68,7 @@ namespace KEMField { public: VectorPotentialAccumulator(const KPosition& P) : fP(P) {} - KEMThreeVector operator()(KEMThreeVector vectorPotential, + KThreeVector operator()(KThreeVector vectorPotential, KZonalHarmonicFieldSolver* c) { return vectorPotential + c->VectorPotential(fP); @@ -83,7 +82,7 @@ namespace KEMField { public: MagneticFieldAccumulator(const KPosition& P) : fP(P) {} - KEMThreeVector operator()(KEMThreeVector magneticField, + KThreeVector operator()(KThreeVector magneticField, KZonalHarmonicFieldSolver* c) { return magneticField + c->MagneticField(fP); @@ -97,7 +96,7 @@ namespace KEMField { public: MagneticFieldGradientAccumulator(const KPosition& P) : fP(P) {} - KEMThreeMatrix operator()(KEMThreeMatrix magneticFieldGradient, + KThreeMatrix operator()(KThreeMatrix magneticFieldGradient, KZonalHarmonicFieldSolver* c) { return magneticFieldGradient + c->MagneticFieldGradient(fP); @@ -111,10 +110,10 @@ namespace KEMField { public: MagneticFieldAndGradientAccumulator(const KPosition& P) : fP(P) {} - std::pair operator()(std::pair fieldandgradient, + std::pair operator()(std::pair fieldandgradient, KZonalHarmonicFieldSolver* c) { - std::pair pair = c->MagneticFieldAndGradient(fP); + std::pair pair = c->MagneticFieldAndGradient(fP); return std::make_pair(fieldandgradient.first + pair.first, fieldandgradient.second + pair.second ); } diff --git a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectrostaticZonalHarmonicFieldSolver.hh b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectrostaticZonalHarmonicFieldSolver.hh index 0f8065bd1..18974a104 100644 --- a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectrostaticZonalHarmonicFieldSolver.hh +++ b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/include/KElectrostaticZonalHarmonicFieldSolver.hh @@ -1,8 +1,7 @@ #ifndef KELECTROSTATICZONALHARMONICFIELDSOLVER_DEF #define KELECTROSTATICZONALHARMONICFIELDSOLVER_DEF -#include "KEMThreeVector.hh" - +#include "KThreeVector_KEMField.hh" #include "KZonalHarmonicComputer.hh" #include "KElectrostaticIntegratingFieldSolver.hh" @@ -31,8 +30,8 @@ namespace KEMField virtual ~KZonalHarmonicFieldSolver() {} double Potential(const KPosition& P) const; - KEMThreeVector ElectricField(const KPosition& P) const; - std::pair ElectricFieldAndPotential(const KPosition& P) const; + KThreeVector ElectricField(const KPosition& P) const; + std::pair ElectricFieldAndPotential(const KPosition& P) const; private: @@ -42,11 +41,11 @@ namespace KEMField bool CentralExpansionPotential(const KPosition& P, double& potential) const; bool RemoteExpansionPotential(const KPosition& P, double& potential) const; - bool CentralExpansionField(const KPosition& P, KEMThreeVector& electricField) const; - bool RemoteExpansionField(const KPosition& P, KEMThreeVector& electricField) const; + bool CentralExpansionField(const KPosition& P, KThreeVector& electricField) const; + bool RemoteExpansionField(const KPosition& P, KThreeVector& electricField) const; - bool CentralExpansionFieldAndPotential(const KPosition& P, KEMThreeVector& electricField, double& potential) const; - bool RemoteExpansionFieldAndPotential(const KPosition& P, KEMThreeVector& electricField, double& potential) const; + bool CentralExpansionFieldAndPotential(const KPosition& P, KThreeVector& electricField, double& potential) const; + bool RemoteExpansionFieldAndPotential(const KPosition& P, KThreeVector& electricField, double& potential) const; KIntegratingFieldSolver fIntegratingFieldSolver; @@ -68,7 +67,7 @@ namespace KEMField { public: ElectricFieldAccumulator(const KPosition& P) : fP(P) {} - KEMThreeVector operator()(KEMThreeVector electricField, + KThreeVector operator()(KThreeVector electricField, KZonalHarmonicFieldSolver* c) { return electricField + c->ElectricField(fP); @@ -82,10 +81,10 @@ namespace KEMField { public: ElectricFieldAndPotentialAccumulator(const KPosition& P) : fP(P) {} - std::pair operator()(std::pair FieldandPotential, + std::pair operator()(std::pair FieldandPotential, KZonalHarmonicFieldSolver* c) { - std::pair pair = c->ElectricFieldAndPotential(fP); + std::pair pair = c->ElectricFieldAndPotential(fP); return std::make_pair(FieldandPotential.first + pair.first, FieldandPotential.second + pair.second ); } diff --git a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectromagnetZonalHarmonicFieldSolver.cc b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectromagnetZonalHarmonicFieldSolver.cc index 3c0573ae8..3dcbe8584 100644 --- a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectromagnetZonalHarmonicFieldSolver.cc +++ b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectromagnetZonalHarmonicFieldSolver.cc @@ -4,11 +4,11 @@ namespace KEMField { - KEMThreeVector KZonalHarmonicFieldSolver::VectorPotential(const KPosition& P) const + KThreeVector KZonalHarmonicFieldSolver::VectorPotential(const KPosition& P) const { - KEMThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); + KThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); - KEMThreeVector A; + KThreeVector A; if( fCentralFirst ) { @@ -61,11 +61,11 @@ namespace KEMField return fIntegratingFieldSolver.VectorPotential(P); } - KEMThreeVector KZonalHarmonicFieldSolver::MagneticField(const KPosition& P) const + KThreeVector KZonalHarmonicFieldSolver::MagneticField(const KPosition& P) const { - KEMThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); + KThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); - KEMThreeVector B; + KThreeVector B; if ( fCentralFirst ) { @@ -122,7 +122,7 @@ namespace KEMField KGradient KZonalHarmonicFieldSolver::MagneticFieldGradient(const KPosition& P) const { - KEMThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); + KThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); KGradient g; if( fCentralFirst) @@ -178,11 +178,11 @@ namespace KEMField return g; } - std::pair KZonalHarmonicFieldSolver::MagneticFieldAndGradient(const KPosition& P) const + std::pair KZonalHarmonicFieldSolver::MagneticFieldAndGradient(const KPosition& P) const { - KEMThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); + KThreeVector localP = fContainer.GetCoordinateSystem().ToLocal(P); - KEMThreeVector B; + KThreeVector B; KGradient g; @@ -243,7 +243,7 @@ namespace KEMField return std::make_pair(B, g); } - bool KZonalHarmonicFieldSolver::CentralExpansionMagneticField(const KPosition& P, KEMThreeVector& magneticField) const + bool KZonalHarmonicFieldSolver::CentralExpansionMagneticField(const KPosition& P, KThreeVector& magneticField) const { if (fContainer.GetCentralSourcePoints().empty()) { @@ -371,7 +371,7 @@ namespace KEMField return true; } - bool KZonalHarmonicFieldSolver::CentralExpansionVectorPotential(const KPosition& P,KEMThreeVector& vectorPotential) const + bool KZonalHarmonicFieldSolver::CentralExpansionVectorPotential(const KPosition& P,KThreeVector& vectorPotential) const { if (fContainer.GetCentralSourcePoints().empty()) { @@ -482,7 +482,7 @@ namespace KEMField } - bool KZonalHarmonicFieldSolver::RemoteExpansionMagneticField(const KPosition& P, KEMThreeVector& magneticField) const + bool KZonalHarmonicFieldSolver::RemoteExpansionMagneticField(const KPosition& P, KThreeVector& magneticField) const { // cout <::RemoteExpansionVectorPotential(const KPosition& P, KEMThreeVector& vectorPotential) const + bool KZonalHarmonicFieldSolver::RemoteExpansionVectorPotential(const KPosition& P, KThreeVector& vectorPotential) const { if (fContainer.GetRemoteSourcePoints().empty()) { @@ -703,17 +703,17 @@ namespace KEMField bool KZonalHarmonicFieldSolver::CentralGradientExpansion(const KPosition& P,KGradient& g) const { - KEMThreeVector B(0.,0.,0.); + KThreeVector B(0.,0.,0.); return CentralMagneticFieldAndGradientExpansion(P,g,B); } bool KZonalHarmonicFieldSolver::RemoteGradientExpansion(const KPosition& P,KGradient& g) const { - KEMThreeVector B(0.,0.,0.); + KThreeVector B(0.,0.,0.); return RemoteMagneticFieldAndGradientExpansion(P,g,B); } - bool KZonalHarmonicFieldSolver::CentralMagneticFieldAndGradientExpansion(const KPosition& P,KGradient& g, KEMThreeVector& magneticField) const + bool KZonalHarmonicFieldSolver::CentralMagneticFieldAndGradientExpansion(const KPosition& P,KGradient& g, KThreeVector& magneticField) const { if (fContainer.GetCentralSourcePoints().empty()) { @@ -869,7 +869,7 @@ namespace KEMField return true; } - bool KZonalHarmonicFieldSolver::RemoteMagneticFieldAndGradientExpansion(const KPosition& P,KGradient& g, KEMThreeVector& magneticField) const + bool KZonalHarmonicFieldSolver::RemoteMagneticFieldAndGradientExpansion(const KPosition& P,KGradient& g, KThreeVector& magneticField) const { if (fContainer.GetRemoteSourcePoints().empty()) { @@ -1026,16 +1026,16 @@ namespace KEMField //slow, brute force, three-point numerical differentiation double num_eps = 1e-6; bool retval = true; - KEMThreeVector coord_ax[3]; - KEMThreeVector result[3]; - coord_ax[0] = KEMThreeVector(1,0,0); - coord_ax[1] = KEMThreeVector(0,1,0); - coord_ax[2] = KEMThreeVector(0,0,1); + KThreeVector coord_ax[3]; + KThreeVector result[3]; + coord_ax[0] = KThreeVector(1,0,0); + coord_ax[1] = KThreeVector(0,1,0); + coord_ax[2] = KThreeVector(0,0,1); for(unsigned int i=0; i<3; i++) { - KEMThreeVector forward; - KEMThreeVector backward; + KThreeVector forward; + KThreeVector backward; retval *= CentralExpansionMagneticField( P + num_eps*coord_ax[i], forward); retval *= CentralExpansionMagneticField( P - num_eps*coord_ax[i], backward); result[i] = (forward - backward)/(2.0*num_eps); @@ -1053,16 +1053,16 @@ namespace KEMField //slow, brute force, three-point numerical differentiation double num_eps = 1e-6; bool retval = true; - KEMThreeVector coord_ax[3]; - KEMThreeVector result[3]; - coord_ax[0] = KEMThreeVector(1,0,0); - coord_ax[1] = KEMThreeVector(0,1,0); - coord_ax[2] = KEMThreeVector(0,0,1); + KThreeVector coord_ax[3]; + KThreeVector result[3]; + coord_ax[0] = KThreeVector(1,0,0); + coord_ax[1] = KThreeVector(0,1,0); + coord_ax[2] = KThreeVector(0,0,1); for(unsigned int i=0; i<3; i++) { - KEMThreeVector forward; - KEMThreeVector backward; + KThreeVector forward; + KThreeVector backward; retval *= RemoteExpansionMagneticField( P + num_eps*coord_ax[i], forward); retval *= RemoteExpansionMagneticField( P - num_eps*coord_ax[i], backward); result[i] = (forward - backward)/(2.0*num_eps); diff --git a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectrostaticZonalHarmonicFieldSolver.cc b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectrostaticZonalHarmonicFieldSolver.cc index 7ebb31a58..cc1eae2de 100644 --- a/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectrostaticZonalHarmonicFieldSolver.cc +++ b/KEMField/Source/FieldSolvers/ZonalHarmonic/Solver/src/KElectrostaticZonalHarmonicFieldSolver.cc @@ -31,9 +31,9 @@ namespace KEMField return fIntegratingFieldSolver.Potential(P); } - KEMThreeVector KZonalHarmonicFieldSolver::ElectricField(const KPosition& P) const + KThreeVector KZonalHarmonicFieldSolver::ElectricField(const KPosition& P) const { - KEMThreeVector E; + KThreeVector E; if (UseCentralExpansion(P)) if (CentralExpansionField(P,E)) @@ -56,9 +56,9 @@ namespace KEMField return fIntegratingFieldSolver.ElectricField(P); } - std::pair KZonalHarmonicFieldSolver::ElectricFieldAndPotential(const KPosition& P) const + std::pair KZonalHarmonicFieldSolver::ElectricFieldAndPotential(const KPosition& P) const { - KEMThreeVector E; + KThreeVector E; double phi = 0; if (UseCentralExpansion(P)) @@ -186,7 +186,7 @@ namespace KEMField return true; } - bool KZonalHarmonicFieldSolver::CentralExpansionField(const KPosition& P, KEMThreeVector& electricField) const + bool KZonalHarmonicFieldSolver::CentralExpansionField(const KPosition& P, KThreeVector& electricField) const { if (fContainer.GetCentralSourcePoints().empty()) { @@ -312,7 +312,7 @@ namespace KEMField return true; } - bool KZonalHarmonicFieldSolver::CentralExpansionFieldAndPotential(const KPosition& P,KEMThreeVector& electricField,double& potential) const + bool KZonalHarmonicFieldSolver::CentralExpansionFieldAndPotential(const KPosition& P,KThreeVector& electricField,double& potential) const { if (fContainer.GetCentralSourcePoints().empty()) { @@ -545,7 +545,7 @@ namespace KEMField } - bool KZonalHarmonicFieldSolver::RemoteExpansionField(const KPosition& P, KEMThreeVector& electricField) const + bool KZonalHarmonicFieldSolver::RemoteExpansionField(const KPosition& P, KThreeVector& electricField) const { if (fContainer.GetRemoteSourcePoints().empty()) { @@ -667,7 +667,7 @@ namespace KEMField return true; } - bool KZonalHarmonicFieldSolver::RemoteExpansionFieldAndPotential(const KPosition& P, KEMThreeVector& electricField, double& potential) const + bool KZonalHarmonicFieldSolver::RemoteExpansionFieldAndPotential(const KPosition& P, KThreeVector& electricField, double& potential) const { if (fContainer.GetRemoteSourcePoints().empty()) { diff --git a/KEMField/Source/IO/FileManipulation/CMakeLists.txt b/KEMField/Source/IO/FileManipulation/CMakeLists.txt index d7107f852..a0bef87f5 100644 --- a/KEMField/Source/IO/FileManipulation/CMakeLists.txt +++ b/KEMField/Source/IO/FileManipulation/CMakeLists.txt @@ -5,7 +5,7 @@ set(KEMField_SPARSE_MATRIX_BUFFER "32" CACHE STRING "Buffer size (MB) used for s mark_as_advanced(FORCE KEMField_SPARSE_MATRIX_BUFFER) add_cflag(KEMFIELD_SPARSE_MATRIX_BUFFER_SIZE_MB=${KEMField_SPARSE_MATRIX_BUFFER}) -set(KEMField_CACHE_DIR "${@PROJECT_NAME@_CACHE_INSTALL_DIR}" CACHE STRING "KEMField caching directory.") +set(KEMField_CACHE_DIR "${${PROJECT_NAME}_CACHE_INSTALL_DIR}" CACHE STRING "KEMField caching directory.") mark_as_advanced(FORCE KEMField_CACHE_DIR) diff --git a/KEMField/Source/IO/HashGenerator/CMakeLists.txt b/KEMField/Source/IO/HashGenerator/CMakeLists.txt index 601f0f8a8..05560afc6 100644 --- a/KEMField/Source/IO/HashGenerator/CMakeLists.txt +++ b/KEMField/Source/IO/HashGenerator/CMakeLists.txt @@ -15,7 +15,7 @@ set (HASHGENERATOR_SOURCEFILES ################################################## add_library (KEMHashGenerator SHARED ${HASHGENERATOR_SOURCEFILES}) -target_link_libraries (KEMHashGenerator KEMCore) +target_link_libraries (KEMHashGenerator KEMCore KEMMath KGeoBagMath) kasper_install_headers (${HASHGENERATOR_HEADERFILES}) kasper_install_libraries (KEMHashGenerator) diff --git a/KEMField/Source/IO/StructuredASCII/src/KSAFileReader.cc b/KEMField/Source/IO/StructuredASCII/src/KSAFileReader.cc index 2906829b4..0d79b5b67 100644 --- a/KEMField/Source/IO/StructuredASCII/src/KSAFileReader.cc +++ b/KEMField/Source/IO/StructuredASCII/src/KSAFileReader.cc @@ -1,12 +1,12 @@ -#include "KSAFileReader.hh" - - #include - #include +#include "KSAFileReader.hh" -namespace KEMField{ +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 // compatibility with antediluvian compilers +#endif +namespace KEMField{ KSAFileReader::KSAFileReader():fIsOpen(false),fUseDecompression(false) { @@ -206,13 +206,13 @@ void KSAFileReader::ExtractData() switch (ret) { case Z_NEED_DICT: ret = Z_DATA_ERROR; /* and fall through, use attribute [[fallthrough]] for newer compilers */ - #if defined(__GNUC__) && (__GNUC__ >= 7) - [[fallthrough]]; - #endif + #if __has_cpp_attribute(fallthrough) + [[fallthrough]]; + #endif case Z_DATA_ERROR: - #if defined(__GNUC__) && (__GNUC__ >= 7) - [[fallthrough]]; - #endif + #if __has_cpp_attribute(fallthrough) + [[fallthrough]]; + #endif case Z_MEM_ERROR: (void)inflateEnd(&fZStream); fIsFinished = true; break; }; diff --git a/KEMField/Source/Interface/BoundaryIntegrators/Electric/include/KElectrostaticBoundaryIntegratorPolicy.hh b/KEMField/Source/Interface/BoundaryIntegrators/Electric/include/KElectrostaticBoundaryIntegratorPolicy.hh index 00c08a1d5..71d430be7 100644 --- a/KEMField/Source/Interface/BoundaryIntegrators/Electric/include/KElectrostaticBoundaryIntegratorPolicy.hh +++ b/KEMField/Source/Interface/BoundaryIntegrators/Electric/include/KElectrostaticBoundaryIntegratorPolicy.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_INTERFACE_BOUNDARYINTEGRATORS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ -#define KEMFIELD_SOURCE_2_0_INTERFACE_BOUNDARYINTEGRATORS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ +#ifndef KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ +#define KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ #include #include "KElectrostaticBoundaryIntegrator.hh" @@ -52,4 +52,4 @@ using KEBIPolicy = KElectrostaticBoundaryIntegratorPolicy; } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_INTERFACE_BOUNDARYINTEGRATORS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ */ +#endif /* KELECTROSTATICBOUNDARYINTEGRATORPOLICY_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/CMakeLists.txt b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/CMakeLists.txt index 93033d77e..a634925e0 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/CMakeLists.txt +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/CMakeLists.txt @@ -3,55 +3,56 @@ # header files set( CHARGEDENSITYSOLVER_ELECTRIC_HEADER_BASENAMES - KChargeDensitySolver.hh - KCachedChargeDensitySolver.hh - KExplicitSuperpositionCachedChargeDensitySolver.hh - KExplicitSuperpositionSolutionComponent.hh - KGaussianEliminationChargeDensitySolver.hh - KKrylovChargeDensitySolver.hh - KKrylovChargeDensitySolverOld.hh - KKrylovPreconditionerGenerator.hh - KRobinHoodChargeDensitySolver.hh + KChargeDensitySolver.hh + KCachedChargeDensitySolver.hh + KExplicitSuperpositionCachedChargeDensitySolver.hh + KExplicitSuperpositionSolutionComponent.hh + KGaussianEliminationChargeDensitySolver.hh + KKrylovChargeDensitySolver.hh + KKrylovChargeDensitySolverOld.hh + KKrylovPreconditionerGenerator.hh + KRobinHoodChargeDensitySolver.hh ) set( CHARGEDENSITYSOLVER_ELECTRIC_HEADER_PATH - ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include ) foreach( BASENAME ${CHARGEDENSITYSOLVER_ELECTRIC_HEADER_BASENAMES} ) - list( APPEND CHARGEDENSITYSOLVER_ELECTRIC_HEADER_FILENAMES ${CHARGEDENSITYSOLVER_ELECTRIC_HEADER_PATH}/${BASENAME} ) + list( APPEND CHARGEDENSITYSOLVER_ELECTRIC_HEADER_FILENAMES ${CHARGEDENSITYSOLVER_ELECTRIC_HEADER_PATH}/${BASENAME} ) endforeach( BASENAME ) # source files set( CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_BASENAMES - KChargeDensitySolver.cc - KCachedChargeDensitySolver.cc - KExplicitSuperpositionCachedChargeDensitySolver.cc - KGaussianEliminationChargeDensitySolver.cc - KKrylovChargeDensitySolver.cc - KKrylovChargeDensitySolverOld.cc - KKrylovPreconditionerGenerator.cc - KRobinHoodChargeDensitySolver.cc + KChargeDensitySolver.cc + KCachedChargeDensitySolver.cc + KExplicitSuperpositionCachedChargeDensitySolver.cc + KGaussianEliminationChargeDensitySolver.cc + KKrylovChargeDensitySolver.cc + KKrylovChargeDensitySolverOld.cc + KKrylovPreconditionerGenerator.cc + KRobinHoodChargeDensitySolver.cc ) set( CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_PATH - ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_SOURCE_DIR}/src ) foreach( BASENAME ${CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_BASENAMES} ) - list( APPEND CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_FILENAMES ${CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_PATH}/${BASENAME} ) + list( APPEND CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_FILENAMES ${CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_PATH}/${BASENAME} ) endforeach( BASENAME ) # library kasper_internal_include_directories( ${CHARGEDENSITYSOLVER_ELECTRIC_HEADER_PATH} ) add_library( KEMFieldChargeDensitySolvers SHARED ${CHARGEDENSITYSOLVER_ELECTRIC_SOURCE_FILENAMES} ) set_target_properties( KEMFieldChargeDensitySolvers PROPERTIES COMPILE_FLAGS -Wno-overloaded-virtual ) -target_link_libraries( KEMFieldChargeDensitySolvers - KEMElectrostaticBoundaryIntegrals - KEMFieldElectricBoundaryIntegrators - KEMFileManipulation - KEMFieldExceptions - KEMHashGenerator - KEMLinearAlgebraSolvers - KFMUtility +target_link_libraries( KEMFieldChargeDensitySolvers + ${KGeoBag_LIBRARIES} + KEMElectrostaticBoundaryIntegrals + KEMFieldElectricBoundaryIntegrators + KEMFileManipulation + KEMFieldExceptions + KEMHashGenerator + KEMLinearAlgebraSolvers + KFMUtility ) # install @@ -59,9 +60,10 @@ kasper_install_headers( ${CHARGEDENSITYSOLVER_ELECTRIC_HEADER_FILENAMES} ) kasper_install_libraries( KEMFieldChargeDensitySolvers ) # test executable -add_executable( KChargeDensitySolver_test test/KChargeDensitySolver_test.cc ) -target_link_libraries( KChargeDensitySolver_test - KEMFieldChargeDensitySolvers -) - -kasper_install_executables( KChargeDensitySolver_test ) +#add_executable( KChargeDensitySolver_test test/KChargeDensitySolver_test.cc ) +#target_link_libraries( KChargeDensitySolver_test +# ${KGeoBag_LIBRARIES} +# KEMFieldChargeDensitySolvers +#) + +#kasper_install_executables( KChargeDensitySolver_test ) diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolver.hh index 26ded7a6b..6aec99f13 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KCachedChargeDensitySolver.hh @@ -7,8 +7,8 @@ * Imported from KSFieldElectrostatic */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KCACHEDCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KCACHEDCHARGEDENSITYSOLVER_HH_ +#ifndef KCACHEDCHARGEDENSITYSOLVER_HH_ +#define KCACHEDCHARGEDENSITYSOLVER_HH_ #include "KChargeDensitySolver.hh" @@ -39,4 +39,4 @@ private: } // KEMField -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KCACHEDCHARGEDENSITYSOLVER_HH_ */ +#endif /* KCACHEDCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KChargeDensitySolver.hh index 63028b83c..e6d6d0ee5 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KChargeDensitySolver.hh @@ -5,11 +5,14 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_KCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_KCHARGEDENSITYSOLVER_HH_ +#ifndef KCHARGEDENSITYSOLVER_HH_ +#define KCHARGEDENSITYSOLVER_HH_ +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" +using namespace KGeoBag; + namespace KEMField{ class KChargeDensitySolver @@ -40,4 +43,4 @@ private: } -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_KCHARGEDENSITYSOLVER_HH_ */ +#endif /* KCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolver.hh index 86f9394f7..26070bd64 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionCachedChargeDensitySolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ +#ifndef KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ +#define KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ #include "KExplicitSuperpositionSolutionComponent.hh" #include "KChargeDensitySolver.hh" @@ -46,4 +46,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ */ +#endif /* KEXPLICITSUPERPOSITIONCACHEDCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponent.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponent.hh index e00ede4be..c66f45a1e 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponent.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KExplicitSuperpositionSolutionComponent.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ +#ifndef KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ +#define KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ #include @@ -24,4 +24,4 @@ public: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ */ +#endif /* KEXPLICITSUPERPOSITIONSOLUTIONCOMPONENT_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolver.hh index 9c8dcb297..bb6b68f9d 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KGaussianEliminationChargeDensitySolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ +#ifndef KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ +#define KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ #include "KChargeDensitySolver.hh" #include "KElectrostaticBoundaryIntegratorPolicy.hh" @@ -29,4 +29,4 @@ class KGaussianEliminationChargeDensitySolver : } // KEMField -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ */ +#endif /* KGAUSSIANELIMINATIONCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolver.hh index c35b95850..b87ecec6a 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVER_HH_ +#ifndef KKRYLOVCHARGEDENSITYSOLVER_HH_ +#define KKRYLOVCHARGEDENSITYSOLVER_HH_ #include "KChargeDensitySolver.hh" #include "KElectrostaticBasis.hh" @@ -85,4 +85,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVER_HH_ */ +#endif /* KKRYLOVCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOld.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOld.hh index 7120580c4..d69173211 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOld.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovChargeDensitySolverOld.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ +#ifndef KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ +#define KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ #include "KChargeDensitySolver.hh" @@ -33,4 +33,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ */ +#endif /* KKRYLOVCHARGEDENSITYSOLVEROLD_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGenerator.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGenerator.hh index c310c9869..6aa2ae16c 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGenerator.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KKrylovPreconditionerGenerator.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATOR_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATOR_HH_ +#ifndef KKRYLOVPRECONDITIONERGENERATOR_HH_ +#define KKRYLOVPRECONDITIONERGENERATOR_HH_ #include "KBoundaryMatrixGenerator.hh" @@ -87,4 +87,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KKRYLOVPRECONDITIONERGENERATOR_HH_ */ +#endif /* KKRYLOVPRECONDITIONERGENERATOR_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolver.hh b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolver.hh index 0badb99cc..dd8bcaddd 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolver.hh +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/include/KRobinHoodChargeDensitySolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVER_HH_ +#ifndef KROBINHOODCHARGEDENSITYSOLVER_HH_ +#define KROBINHOODCHARGEDENSITYSOLVER_HH_ #include "KChargeDensitySolver.hh" #include "KElectrostaticBoundaryIntegratorPolicy.hh" @@ -95,4 +95,4 @@ private: } //KEMField -#endif /* KEMFIELD_SOURCE_2_0_CHARGEDENSITYSOLVERS_ELECTRIC_INCLUDE_KROBINHOODCHARGEDENSITYSOLVER_HH_ */ +#endif /* KROBINHOODCHARGEDENSITYSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/test/KChargeDensitySolver_test.cc b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/test/KChargeDensitySolver_test.cc index 788b56112..5b8aec3c5 100644 --- a/KEMField/Source/Interface/ChargeDensitySolvers/Electric/test/KChargeDensitySolver_test.cc +++ b/KEMField/Source/Interface/ChargeDensitySolvers/Electric/test/KChargeDensitySolver_test.cc @@ -9,6 +9,7 @@ #include "KChargeDensitySolver.hh" #include "KGaussianEliminationChargeDensitySolver.hh" +using namespace KGeoBag; using namespace KEMField; int main(int /*argc*/, char** /*args*/) { diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/CMakeLists.txt b/KEMField/Source/Interface/FieldSolvers/Electric/CMakeLists.txt index f032aeeff..a8a1c30e2 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/CMakeLists.txt +++ b/KEMField/Source/Interface/FieldSolvers/Electric/CMakeLists.txt @@ -43,24 +43,24 @@ set (FIELDSOLVER_ELECTRIC_LINK_LIBRARIES KEMFieldExceptions ) -if (@PROJECT_NAME@_USE_OPENCL) +if (${PROJECT_NAME}_USE_OPENCL) kasper_external_include_directories( ${OPENCL_INCLUDE_DIRS} ) list (APPEND FIELDSOLVER_ELECTRIC_LINK_LIBRARIES KEMOpenCLPlugin ) -endif (@PROJECT_NAME@_USE_OPENCL) +endif (${PROJECT_NAME}_USE_OPENCL) -if (@PROJECT_NAME@_USE_MPI) +if (${PROJECT_NAME}_USE_MPI) list (APPEND FIELDSOLVER_ELECTRIC_LINK_LIBRARIES KEMCore #for MPIInterface.hh ) -endif(@PROJECT_NAME@_USE_MPI) +endif(${PROJECT_NAME}_USE_MPI) -if (@PROJECT_NAME@_USE_VTK) +if (${PROJECT_NAME}_USE_VTK) list (APPEND FIELDSOLVER_ELECTRIC_LINK_LIBRARIES KEMVTKPlugin ) -endif (@PROJECT_NAME@_USE_VTK) +endif (${PROJECT_NAME}_USE_VTK) # library kasper_internal_include_directories( ${FIELDSOLVER_ELECTRIC_HEADER_PATH} ) diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolver.hh index 2d75ef336..c68897ae0 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFastMultipoleFieldSolver.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ +#ifndef KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ +#define KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ #include "KElectricFieldSolver.hh" @@ -31,7 +31,7 @@ public: void InitializeCore( KSurfaceContainer& container ); double PotentialCore( const KPosition& P ) const; - KEMThreeVector ElectricFieldCore( const KPosition& P ) const; + KThreeVector ElectricFieldCore( const KPosition& P ) const; void SetIntegratorPolicy(const KEBIPolicy& policy) { fIntegratorPolicy = policy; @@ -58,4 +58,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ */ +#endif /* KELECTRICFASTMULTIPOLEFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFieldSolver.hh index b684edd83..8f1456703 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricFieldSolver.hh @@ -5,11 +5,11 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_KELECTRICFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_KELECTRICFIELDSOLVER_HH_ +#ifndef KELECTRICFIELDSOLVER_HH_ +#define KELECTRICFIELDSOLVER_HH_ +#include "KThreeVector_KEMField.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" namespace KEMField { @@ -30,11 +30,11 @@ public: return PotentialCore(P); } - KEMThreeVector ElectricField(const KPosition& P) const { + KThreeVector ElectricField(const KPosition& P) const { return ElectricFieldCore(P); } - std::pair ElectricFieldAndPotential(const KPosition& P) const + std::pair ElectricFieldAndPotential(const KPosition& P) const { return ElectricFieldAndPotentialCore(P); } @@ -42,9 +42,9 @@ public: private: virtual void InitializeCore(KSurfaceContainer& container) = 0; virtual double PotentialCore(const KPosition& P ) const = 0; - virtual KEMThreeVector ElectricFieldCore( const KPosition& P) const = 0; + virtual KThreeVector ElectricFieldCore( const KPosition& P) const = 0; - virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const + virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const { //the default behavior is just to call the field and potential separately @@ -53,9 +53,9 @@ private: //at the same time with minimal additional work (e.g. ZH and fast multipole). double potential = PotentialCore(P); - KEMThreeVector field = ElectricFieldCore(P); + KThreeVector field = ElectricFieldCore(P); - return std::pair(field,potential); + return std::pair(field,potential); }; bool fInitialized; @@ -63,4 +63,4 @@ private: } -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_KELECTRICFIELDSOLVER_HH_ */ +#endif /* KELECTRICFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricZHFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricZHFieldSolver.hh index f6c459459..108ac2553 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricZHFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Electric/include/KElectricZHFieldSolver.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVER_HH_ +#ifndef KELECTRICZHFIELDSOLVER_HH_ +#define KELECTRICZHFIELDSOLVER_HH_ #include "KElectricFieldSolver.hh" @@ -38,8 +38,8 @@ private: void InitializeCore( KSurfaceContainer& container ); double PotentialCore( const KPosition& P ) const; - KEMThreeVector ElectricFieldCore( const KPosition& P ) const; - std::pair ElectricFieldAndPotentialCore(const KPosition& P) const; + KThreeVector ElectricFieldCore( const KPosition& P ) const; + std::pair ElectricFieldAndPotentialCore(const KPosition& P) const; KEBIPolicy fIntegratorPolicy; KElectrostaticBoundaryIntegrator fIntegrator; @@ -50,4 +50,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KELECTRICZHFIELDSOLVER_HH_ */ +#endif /* KELECTRICZHFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolver.hh index ad88d2bc1..76631f1a5 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Electric/include/KIntegratingElectrostaticFieldSolver.hh @@ -8,8 +8,8 @@ * Imported from KSFieldElectrostatic */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ +#ifndef KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ +#define KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ #include "KElectricFieldSolver.hh" #include "KElectrostaticBoundaryIntegratorPolicy.hh" @@ -41,7 +41,7 @@ private: void InitializeCore( KSurfaceContainer& container ); double PotentialCore( const KPosition& P ) const; - KEMThreeVector ElectricFieldCore( const KPosition& P ) const; + KThreeVector ElectricFieldCore( const KPosition& P ) const; KElectrostaticBoundaryIntegrator* fIntegrator; KEBIPolicy fIntegratorPolicy; @@ -57,4 +57,4 @@ bool fUseOpenCL; } //KEMField -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_ELECTRIC_INCLUDE_KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ */ +#endif /* KINTEGRATINGELECTROSTATICFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolver.cc b/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolver.cc index 0c1b7ead2..28ca54f23 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolver.cc +++ b/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricFastMultipoleFieldSolver.cc @@ -175,7 +175,7 @@ void KElectricFastMultipoleFieldSolver::InitializeCore( KSurfaceContainer& conta return fFastMultipoleFieldSolver->Potential( P ); } - KEMThreeVector KElectricFastMultipoleFieldSolver::ElectricFieldCore( const KPosition& P ) const + KThreeVector KElectricFastMultipoleFieldSolver::ElectricFieldCore( const KPosition& P ) const { if( fUseOpenCL ) { diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricZHFieldSolver.cc b/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricZHFieldSolver.cc index e7f241885..d7e89b5b8 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricZHFieldSolver.cc +++ b/KEMField/Source/Interface/FieldSolvers/Electric/src/KElectricZHFieldSolver.cc @@ -110,12 +110,12 @@ void KElectricZHFieldSolver::InitializeCore( KSurfaceContainer& container ) return fZonalHarmonicFieldSolver->Potential( P ); } - KEMThreeVector KElectricZHFieldSolver::ElectricFieldCore( const KPosition& P ) const + KThreeVector KElectricZHFieldSolver::ElectricFieldCore( const KPosition& P ) const { return fZonalHarmonicFieldSolver->ElectricField( P ); } - std::pair + std::pair KElectricZHFieldSolver::ElectricFieldAndPotentialCore(const KPosition& P) const { return fZonalHarmonicFieldSolver->ElectricFieldAndPotential(P); diff --git a/KEMField/Source/Interface/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolver.cc b/KEMField/Source/Interface/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolver.cc index 95eaa6a7d..88fdbafa0 100644 --- a/KEMField/Source/Interface/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolver.cc +++ b/KEMField/Source/Interface/FieldSolvers/Electric/src/KIntegratingElectrostaticFieldSolver.cc @@ -79,7 +79,7 @@ double KIntegratingElectrostaticFieldSolver::PotentialCore( const KPosition& P ) return fIntegratingFieldSolver->Potential( P ); } -KEMThreeVector KIntegratingElectrostaticFieldSolver::ElectricFieldCore( const KPosition& P ) const +KThreeVector KIntegratingElectrostaticFieldSolver::ElectricFieldCore( const KPosition& P ) const { if( fUseOpenCL ) { diff --git a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolver.hh index 293b695be..133720bfd 100644 --- a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ +#ifndef KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ +#define KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ #include "KMagneticFieldSolver.hh" #include "KElectromagnetIntegrator.hh" @@ -23,8 +23,8 @@ public: void InitializeCore( KElectromagnetContainer& container ); - KEMThreeVector MagneticPotentialCore( const KPosition& P ) const; - KEMThreeVector MagneticFieldCore( const KPosition& P ) const; + KThreeVector MagneticPotentialCore( const KPosition& P ) const; + KThreeVector MagneticFieldCore( const KPosition& P ) const; KGradient MagneticGradientCore( const KPosition& P ) const; private: @@ -34,4 +34,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ */ +#endif /* KINTEGRATINGMAGNETOSTATICFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KMagneticFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KMagneticFieldSolver.hh index ac067dd2b..fc81e0d2c 100644 --- a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KMagneticFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KMagneticFieldSolver.hh @@ -5,12 +5,12 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KMAGNETICFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KMAGNETICFIELDSOLVER_HH_ +#ifndef KMAGNETICFIELDSOLVER_HH_ +#define KMAGNETICFIELDSOLVER_HH_ +#include "KThreeMatrix_KEMField.hh" +#include "KThreeVector_KEMField.hh" #include "KElectromagnetContainer.hh" -#include "KEMThreeVector.hh" -#include "KEMThreeMatrix.hh" namespace KEMField { @@ -27,11 +27,11 @@ public: } } - KEMThreeVector MagneticPotential ( const KPosition& P ) const { + KThreeVector MagneticPotential ( const KPosition& P ) const { return MagneticPotentialCore(P); } - KEMThreeVector MagneticField (const KPosition& P ) const { + KThreeVector MagneticField (const KPosition& P ) const { return MagneticFieldCore(P); } @@ -39,7 +39,7 @@ public: return MagneticGradientCore(P); } - std::pair MagneticFieldAndGradient( const KPosition& P ) const { + std::pair MagneticFieldAndGradient( const KPosition& P ) const { return MagneticFieldAndGradientCore(P); } @@ -47,11 +47,11 @@ private: virtual void InitializeCore(KElectromagnetContainer& container ) = 0; - virtual KEMThreeVector MagneticPotentialCore ( const KPosition& P ) const = 0; - virtual KEMThreeVector MagneticFieldCore (const KPosition& P ) const = 0; + virtual KThreeVector MagneticPotentialCore ( const KPosition& P ) const = 0; + virtual KThreeVector MagneticFieldCore (const KPosition& P ) const = 0; virtual KGradient MagneticGradientCore (const KPosition& P ) const = 0; - virtual std::pair MagneticFieldAndGradientCore( const KPosition& P ) const { + virtual std::pair MagneticFieldAndGradientCore( const KPosition& P ) const { return std::make_pair(MagneticFieldCore(P),MagneticGradientCore(P)); } @@ -64,4 +64,4 @@ private: -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KMAGNETICFIELDSOLVER_HH_ */ +#endif /* KMAGNETICFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolver.hh b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolver.hh index 34542e9a7..d3752fda7 100644 --- a/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolver.hh +++ b/KEMField/Source/Interface/FieldSolvers/Magnetic/include/KZonalHarmonicMagnetostaticFieldSolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ +#ifndef KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ +#define KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ #include "KMagneticFieldSolver.hh" @@ -24,10 +24,10 @@ public: void InitializeCore( KElectromagnetContainer& container ); - KEMThreeVector MagneticPotentialCore( const KPosition& P ) const; - KEMThreeVector MagneticFieldCore( const KPosition& P ) const; + KThreeVector MagneticPotentialCore( const KPosition& P ) const; + KThreeVector MagneticFieldCore( const KPosition& P ) const; KGradient MagneticGradientCore( const KPosition& P ) const; - std::pair MagneticFieldAndGradientCore( const KPosition& P ) const; + std::pair MagneticFieldAndGradientCore( const KPosition& P ) const; KZonalHarmonicParameters* GetParameters() { @@ -43,4 +43,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDSOLVERS_MAGNETIC_INCLUDE_KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ */ +#endif /* KZONALHARMONICMAGNETOSTATICFIELDSOLVER_HH_ */ diff --git a/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolver.cc b/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolver.cc index eb1ca3cee..1bb7cab88 100644 --- a/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolver.cc +++ b/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KIntegratingMagnetostaticFieldSolver.cc @@ -23,12 +23,12 @@ void KIntegratingMagnetostaticFieldSolver::InitializeCore( fIntegrator); } -KEMThreeVector KIntegratingMagnetostaticFieldSolver::MagneticPotentialCore( +KThreeVector KIntegratingMagnetostaticFieldSolver::MagneticPotentialCore( const KPosition& P) const { return fIntegratingFieldSolver->VectorPotential( P ); } -KEMThreeVector KIntegratingMagnetostaticFieldSolver::MagneticFieldCore( +KThreeVector KIntegratingMagnetostaticFieldSolver::MagneticFieldCore( const KPosition& P) const { return fIntegratingFieldSolver->MagneticField( P ); } diff --git a/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolver.cc b/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolver.cc index db2516a44..fcb2bde84 100644 --- a/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolver.cc +++ b/KEMField/Source/Interface/FieldSolvers/Magnetic/src/KZonalHarmonicMagnetostaticFieldSolver.cc @@ -76,12 +76,12 @@ void KZonalHarmonicMagnetostaticFieldSolver::InitializeCore( KElectromagnetConta return; } -KEMThreeVector KZonalHarmonicMagnetostaticFieldSolver::MagneticPotentialCore( const KPosition& P ) const +KThreeVector KZonalHarmonicMagnetostaticFieldSolver::MagneticPotentialCore( const KPosition& P ) const { return fZonalHarmonicFieldSolver->VectorPotential( P ); } -KEMThreeVector KZonalHarmonicMagnetostaticFieldSolver::MagneticFieldCore( const KPosition& P ) const +KThreeVector KZonalHarmonicMagnetostaticFieldSolver::MagneticFieldCore( const KPosition& P ) const { return fZonalHarmonicFieldSolver->MagneticField( P ); } @@ -91,7 +91,7 @@ KGradient KZonalHarmonicMagnetostaticFieldSolver::MagneticGradientCore( const KP return fZonalHarmonicFieldSolver->MagneticFieldGradient( P ); } -std::pair KZonalHarmonicMagnetostaticFieldSolver::MagneticFieldAndGradientCore( const KPosition& P ) const +std::pair KZonalHarmonicMagnetostaticFieldSolver::MagneticFieldAndGradientCore( const KPosition& P ) const { return fZonalHarmonicFieldSolver->MagneticFieldAndGradient( P ); } diff --git a/KEMField/Source/Interface/Fields/Electric/include/KBoundaryElementInfoDisplay.hh b/KEMField/Source/Interface/Fields/Electric/include/KBoundaryElementInfoDisplay.hh index 98f001861..f02ad1d0b 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KBoundaryElementInfoDisplay.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KBoundaryElementInfoDisplay.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAY_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAY_HH_ +#ifndef KBOUNDARYELEMENTINFODISPLAY_HH_ +#define KBOUNDARYELEMENTINFODISPLAY_HH_ #include "KElectrostaticBoundaryField.hh" @@ -26,4 +26,4 @@ public: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KBOUNDARYELEMENTINFODISPLAY_HH_ */ +#endif /* KBOUNDARYELEMENTINFODISPLAY_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectricField.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectricField.hh index 62d5f8ce0..5a7ab135c 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectricField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectricField.hh @@ -9,7 +9,8 @@ #define KELECTRICFIELD_HH_ #include -#include "KEMThreeVector.hh" + +#include "KThreeVector_KEMField.hh" namespace KEMField { @@ -29,11 +30,11 @@ public: return PotentialCore(P,time); } - KEMThreeVector ElectricField(const KPosition& P, const double& time) const { + KThreeVector ElectricField(const KPosition& P, const double& time) const { return ElectricFieldCore(P,time); } - std::pair ElectricFieldAndPotential(const KPosition& P, const double& time) const + std::pair ElectricFieldAndPotential(const KPosition& P, const double& time) const { return ElectricFieldAndPotentialCore(P,time); } @@ -52,10 +53,10 @@ private: virtual double PotentialCore( const KPosition& P,const double& time) const = 0; - virtual KEMThreeVector ElectricFieldCore( + virtual KThreeVector ElectricFieldCore( const KPosition& P,const double& time) const = 0; - virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P, const double& time) const + virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P, const double& time) const { //the default behavior is just to call the field and potential separately @@ -64,9 +65,9 @@ private: //at the same time with minimal additional work (e.g. ZH and fast multipole). double potential = PotentialCore(P,time); - KEMThreeVector field = ElectricFieldCore(P, time); + KThreeVector field = ElectricFieldCore(P, time); - return std::pair(field,potential); + return std::pair(field,potential); } virtual void InitializeCore() {} diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectricQuadrupoleField.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectricQuadrupoleField.hh index 19fe12b8b..f21ce2e5d 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectricQuadrupoleField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectricQuadrupoleField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELD_HH_ +#ifndef KELECTRICQUADRUPOLEFIELD_HH_ +#define KELECTRICQUADRUPOLEFIELD_HH_ #include "KElectrostaticField.hh" @@ -24,7 +24,7 @@ public: private: double PotentialCore( const KPosition& aSamplePoint) const; - KEMThreeVector ElectricFieldCore( const KPosition& aSamplePoint) const; + KThreeVector ElectricFieldCore( const KPosition& aSamplePoint) const; KPosition fLocation; double fStrength; @@ -35,4 +35,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTRICQUADRUPOLEFIELD_HH_ */ +#endif /* KELECTRICQUADRUPOLEFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryField.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryField.hh index dc224dc45..90f8eb278 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryField.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELD_HH_ +#ifndef KELECTROSTATICBOUNDARYFIELD_HH_ +#define KELECTROSTATICBOUNDARYFIELD_HH_ #include "KElectrostaticField.hh" #include "KChargeDensitySolver.hh" @@ -67,8 +67,8 @@ protected: virtual void InitializeCore(); virtual double PotentialCore(const KPosition& P) const; - virtual KEMThreeVector ElectricFieldCore(const KPosition& P) const; - virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const; + virtual KThreeVector ElectricFieldCore(const KPosition& P) const; + virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const; private: void VisitorPreprocessing(); @@ -89,4 +89,4 @@ private: } //KEMField -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELD_HH_ */ +#endif /* KELECTROSTATICBOUNDARYFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryFieldTimer.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryFieldTimer.hh index 5f4512285..efb490749 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryFieldTimer.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticBoundaryFieldTimer.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_KELECTROSTATICBOUNDARYFIELDTIMER_H_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_KELECTROSTATICBOUNDARYFIELDTIMER_H_ +#ifndef KELECTROSTATICBOUNDARYFIELDTIMER_H_ +#define KELECTROSTATICBOUNDARYFIELDTIMER_H_ #include "KElectrostaticBoundaryField.hh" #include "KTimer.hh" @@ -29,4 +29,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_KELECTROSTATICBOUNDARYFIELDTIMER_H_ */ +#endif /* KELECTROSTATICBOUNDARYFIELDTIMER_H_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticConstantField.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticConstantField.hh index 3d36a3859..56b8c07ba 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticConstantField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticConstantField.hh @@ -12,14 +12,14 @@ namespace KEMField KElectrostaticField(), fField() {} - KElectrostaticConstantField(const KEMThreeVector& field) : + KElectrostaticConstantField(const KThreeVector& field) : KElectrostaticField(), fField(field) {} virtual ~KElectrostaticConstantField() {} - void SetField(KEMThreeVector field) { fField = field; } - KEMThreeVector GetField() {return fField;} + void SetField(KThreeVector field) { fField = field; } + KThreeVector GetField() {return fField;} static std::string Name() { return "ElectrostaticConstantFieldSolver"; } @@ -28,13 +28,13 @@ private: return fField.Dot(P); } - virtual KEMThreeVector ElectricFieldCore(const KPosition&) const { + virtual KThreeVector ElectricFieldCore(const KPosition&) const { return fField; } protected: - KEMThreeVector fField; + KThreeVector fField; }; } diff --git a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticField.hh b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticField.hh index 585074498..92a8a93d5 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KElectrostaticField.hh @@ -21,7 +21,7 @@ namespace KEMField using KElectricField::ElectricField; // don't hide time specifying ElectricField call with the overload below - KEMThreeVector ElectricField(const KPosition& P ) const { + KThreeVector ElectricField(const KPosition& P ) const { return ElectricFieldCore(P); } @@ -32,21 +32,21 @@ namespace KEMField return PotentialCore(P); } - virtual KEMThreeVector ElectricFieldCore(const KPosition& P, const double& /*time*/) const + virtual KThreeVector ElectricFieldCore(const KPosition& P, const double& /*time*/) const { return ElectricFieldCore(P); } - virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P, const double& /*time*/) const + virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P, const double& /*time*/) const { return ElectricFieldAndPotentialCore(P); } virtual double PotentialCore(const KPosition& P) const = 0; - virtual KEMThreeVector ElectricFieldCore(const KPosition&) const = 0; + virtual KThreeVector ElectricFieldCore(const KPosition&) const = 0; - virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const + virtual std::pair ElectricFieldAndPotentialCore(const KPosition& P) const { //the default behavior is just to call the field and potential separately @@ -55,9 +55,9 @@ namespace KEMField //at the same time with minimal additional work (e.g. ZH and fast multipole). double potential = PotentialCore(P); - KEMThreeVector field = ElectricFieldCore(P); + KThreeVector field = ElectricFieldCore(P); - return std::pair(field,potential); + return std::pair(field,potential); } diff --git a/KEMField/Source/Interface/Fields/Electric/include/KInducedAzimuthalElectricField.hh b/KEMField/Source/Interface/Fields/Electric/include/KInducedAzimuthalElectricField.hh index 55fd30b33..d3ab7ac6b 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KInducedAzimuthalElectricField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KInducedAzimuthalElectricField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELD_HH_ +#ifndef KINDUCEDAZIMUTHALELECTRICFIELD_HH_ +#define KINDUCEDAZIMUTHALELECTRICFIELD_HH_ #include "KElectricField.hh" @@ -24,7 +24,7 @@ public: private: double PotentialCore( const KPosition& P,const double& time) const; - KEMThreeVector ElectricFieldCore( const KPosition& P, const double& time) const; + KThreeVector ElectricFieldCore( const KPosition& P, const double& time) const; virtual void InitializeCore(); void CheckMagneticField() const; @@ -34,4 +34,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KINDUCEDAZIMUTHALELECTRICFIELD_HH_ */ +#endif /* KINDUCEDAZIMUTHALELECTRICFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KRampedElectric2Field.hh b/KEMField/Source/Interface/Fields/Electric/include/KRampedElectric2Field.hh index 9de39640c..e46827df6 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KRampedElectric2Field.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KRampedElectric2Field.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELD_HH_ +#ifndef KRAMPEDELECTRIC2FIELD_HH_ +#define KRAMPEDELECTRIC2FIELD_HH_ #include "KField.h" #include "KElectricField.hh" @@ -28,7 +28,7 @@ public: private: virtual double PotentialCore( const KPosition& aSamplePoint, const double& aSampleTime) const; - virtual KEMThreeVector ElectricFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; + virtual KThreeVector ElectricFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; public: double GetModulationFactor( const double& aTime ) const; @@ -52,4 +52,4 @@ public: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRIC2FIELD_HH_ */ +#endif /* KRAMPEDELECTRIC2FIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/include/KRampedElectricField.hh b/KEMField/Source/Interface/Fields/Electric/include/KRampedElectricField.hh index 5ec278c3e..bde504dcf 100644 --- a/KEMField/Source/Interface/Fields/Electric/include/KRampedElectricField.hh +++ b/KEMField/Source/Interface/Fields/Electric/include/KRampedElectricField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELD_HH_ +#ifndef KRAMPEDELECTRICFIELD_HH_ +#define KRAMPEDELECTRICFIELD_HH_ #include "KElectricField.hh" #include "KField.h" @@ -28,7 +28,7 @@ public: private: virtual double PotentialCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; - virtual KEMThreeVector ElectricFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; + virtual KThreeVector ElectricFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; public: double GetModulationFactor( const double& aTime ) const; @@ -50,4 +50,4 @@ public: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_ELECTRIC_INCLUDE_KRAMPEDELECTRICFIELD_HH_ */ +#endif /* KRAMPEDELECTRICFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Electric/src/KElectricQuadrupoleField.cc b/KEMField/Source/Interface/Fields/Electric/src/KElectricQuadrupoleField.cc index f0c021f9b..44144c11e 100644 --- a/KEMField/Source/Interface/Fields/Electric/src/KElectricQuadrupoleField.cc +++ b/KEMField/Source/Interface/Fields/Electric/src/KElectricQuadrupoleField.cc @@ -28,7 +28,7 @@ double KElectricQuadrupoleField::PotentialCore( const KPosition& aSamplePoint) c KPosition FieldPoint = aSamplePoint - fLocation; return (fStrength / (2. * fCharacteristic * fCharacteristic)) * (FieldPoint[2] * FieldPoint[2] - (1. / 2.) * FieldPoint[0] * FieldPoint[0] - (1. / 2.) * FieldPoint[1] * FieldPoint[1]); } -KEMThreeVector KElectricQuadrupoleField::ElectricFieldCore( const KPosition& aSamplePoint) const +KThreeVector KElectricQuadrupoleField::ElectricFieldCore( const KPosition& aSamplePoint) const { // thread-safe KPosition FieldPoint = aSamplePoint - fLocation; diff --git a/KEMField/Source/Interface/Fields/Electric/src/KElectrostaticBoundaryField.cc b/KEMField/Source/Interface/Fields/Electric/src/KElectrostaticBoundaryField.cc index 5afde63b1..41d6be108 100644 --- a/KEMField/Source/Interface/Fields/Electric/src/KElectrostaticBoundaryField.cc +++ b/KEMField/Source/Interface/Fields/Electric/src/KElectrostaticBoundaryField.cc @@ -62,12 +62,12 @@ double KElectrostaticBoundaryField::PotentialCore( return fFieldSolver->Potential(P); } -KEMThreeVector KElectrostaticBoundaryField::ElectricFieldCore( +KThreeVector KElectrostaticBoundaryField::ElectricFieldCore( const KPosition& P) const { return fFieldSolver->ElectricField(P); } -std::pair +std::pair KElectrostaticBoundaryField::ElectricFieldAndPotentialCore(const KPosition& P) const { return fFieldSolver->ElectricFieldAndPotential(P); diff --git a/KEMField/Source/Interface/Fields/Electric/src/KInducedAzimuthalElectricField.cc b/KEMField/Source/Interface/Fields/Electric/src/KInducedAzimuthalElectricField.cc index e6bb905c7..cf73c0a65 100644 --- a/KEMField/Source/Interface/Fields/Electric/src/KInducedAzimuthalElectricField.cc +++ b/KEMField/Source/Interface/Fields/Electric/src/KInducedAzimuthalElectricField.cc @@ -27,24 +27,24 @@ KRampedMagneticField* KInducedAzimuthalElectricField::GetRampedMagneticField() c double KInducedAzimuthalElectricField::PotentialCore( const KPosition& P, const double& time) const { - KEMThreeVector electricField = ElectricFieldCore( P, time ); + KThreeVector electricField = ElectricFieldCore( P, time ); return -1. * electricField.Dot( P ); } -KEMThreeVector KInducedAzimuthalElectricField::ElectricFieldCore( +KThreeVector KInducedAzimuthalElectricField::ElectricFieldCore( const KPosition& P, const double& time) const { double tRadius = P.Perp(); if (tRadius > 0.) { - KEMThreeVector tAziDirection = 1. / tRadius * KEMThreeVector( -P.Y(), P.X(), 0. ); + KThreeVector tAziDirection = 1. / tRadius * KThreeVector( -P.Y(), P.X(), 0. ); - KEMThreeVector tMagneticField = fMagneticField->MagneticField( P, time); + KThreeVector tMagneticField = fMagneticField->MagneticField( P, time); double Modulation = fMagneticField->GetDerivModulationFactor( time ); return tAziDirection * (tMagneticField.Z() * (-tRadius / 2.)) * (Modulation * fMagneticField->GetTimeScalingFactor()); } else { - return KEMThreeVector(0.,0.,0.); + return KThreeVector(0.,0.,0.); } } diff --git a/KEMField/Source/Interface/Fields/Electric/src/KRampedElectric2Field.cc b/KEMField/Source/Interface/Fields/Electric/src/KRampedElectric2Field.cc index dfa724a87..e55610c70 100644 --- a/KEMField/Source/Interface/Fields/Electric/src/KRampedElectric2Field.cc +++ b/KEMField/Source/Interface/Fields/Electric/src/KRampedElectric2Field.cc @@ -41,11 +41,11 @@ double KRampedElectric2Field::PotentialCore( const KPosition &aSamplePoint, cons // fieldmsg_debug( "Ramped electric field <" << GetName() << "> returns U=" << aTarget << " at t=" << aSampleTime << eom ); } -KEMThreeVector KRampedElectric2Field::ElectricFieldCore( const KPosition &aSamplePoint, const double &aSampleTime) const +KThreeVector KRampedElectric2Field::ElectricFieldCore( const KPosition &aSamplePoint, const double &aSampleTime) const { - KEMThreeVector field1 = + KThreeVector field1 = fRootElectricField1->ElectricField( aSamplePoint, aSampleTime ); - KEMThreeVector field2 = + KThreeVector field2 = fRootElectricField2->ElectricField( aSamplePoint, aSampleTime ); double Modulation = GetModulationFactor( aSampleTime ); diff --git a/KEMField/Source/Interface/Fields/Electric/src/KRampedElectricField.cc b/KEMField/Source/Interface/Fields/Electric/src/KRampedElectricField.cc index 92258dfc0..399e5cfb4 100644 --- a/KEMField/Source/Interface/Fields/Electric/src/KRampedElectricField.cc +++ b/KEMField/Source/Interface/Fields/Electric/src/KRampedElectricField.cc @@ -38,9 +38,9 @@ double KRampedElectricField::PotentialCore( const KPosition &aSamplePoint, const //fieldmsg_debug( "Ramped electric field <" << GetName() << "> returns U=" << aTarget << " at t=" << aSampleTime << eom ); } -KEMThreeVector KRampedElectricField::ElectricFieldCore( const KPosition &aSamplePoint, const double &aSampleTime) const +KThreeVector KRampedElectricField::ElectricFieldCore( const KPosition &aSamplePoint, const double &aSampleTime) const { - KEMThreeVector field = fRootElectricField->ElectricField( aSamplePoint, aSampleTime ); + KThreeVector field = fRootElectricField->ElectricField( aSamplePoint, aSampleTime ); double Modulation = GetModulationFactor( aSampleTime ); return field * Modulation; //fieldmsg_debug( "Ramped electric field <" << GetName() << "> returns E=" << aTarget << " at t=" << aSampleTime << eom ); diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticDipoleField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticDipoleField.hh index bcba8a8d6..d24c4becc 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticDipoleField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticDipoleField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELD_HH_ +#ifndef KMAGNETICDIPOLEFIELD_HH_ +#define KMAGNETICDIPOLEFIELD_HH_ #include "KMagnetostaticField.hh" @@ -17,8 +17,8 @@ public: KMagneticDipoleField(); virtual ~KMagneticDipoleField(); private: - KEMThreeVector MagneticPotentialCore( const KPosition& aSamplePoint ) const; - KEMThreeVector MagneticFieldCore( const KPosition& aSamplePoint ) const; + KThreeVector MagneticPotentialCore( const KPosition& aSamplePoint ) const; + KThreeVector MagneticFieldCore( const KPosition& aSamplePoint ) const; KGradient MagneticGradientCore( const KPosition& aSamplePoint) const; public: @@ -32,4 +32,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICDIPOLEFIELD_HH_ */ +#endif /* KMAGNETICDIPOLEFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticField.hh index 5ab05f93d..5d072e696 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticField.hh @@ -8,8 +8,8 @@ #ifndef KMAGNETICFIELD_HH_ #define KMAGNETICFIELD_HH_ -#include "KEMThreeVector.hh" -#include "KEMThreeMatrix.hh" +#include "KThreeMatrix_KEMField.hh" +#include "KThreeVector_KEMField.hh" namespace KEMField { @@ -25,11 +25,11 @@ public: // the virtual methods that have to be implemented by subclasses // are named ...Core - KEMThreeVector MagneticPotential(const KPosition& P, const double& time) const { + KThreeVector MagneticPotential(const KPosition& P, const double& time) const { return MagneticPotentialCore(P,time); } - KEMThreeVector MagneticField(const KPosition& P, const double& time) const { + KThreeVector MagneticField(const KPosition& P, const double& time) const { return MagneticFieldCore(P,time); } @@ -37,7 +37,7 @@ public: return MagneticGradientCore(P,time); } - std::pair MagneticFieldAndGradient(const KPosition& P, const double& time) const + std::pair MagneticFieldAndGradient(const KPosition& P, const double& time) const { return MagneticFieldAndGradientCore(P,time); } @@ -55,23 +55,23 @@ public: protected: - virtual KEMThreeVector MagneticPotentialCore( + virtual KThreeVector MagneticPotentialCore( const KPosition& P, const double& time) const = 0; - virtual KEMThreeVector MagneticFieldCore( + virtual KThreeVector MagneticFieldCore( const KPosition& P, const double& time) const = 0; virtual KGradient MagneticGradientCore( const KPosition& P, const double& time) const = 0; - virtual std::pair MagneticFieldAndGradientCore(const KPosition& P, const double& time) const + virtual std::pair MagneticFieldAndGradientCore(const KPosition& P, const double& time) const { //default behavior is to simply call the field and gradient separately //this function may be overloaded to perform a more efficient combined calculation - KEMThreeVector field = MagneticFieldCore(P,time); + KThreeVector field = MagneticFieldCore(P,time); KGradient grad = MagneticGradientCore(P,time); - return std::pair(field,grad); + return std::pair(field,grad); } virtual void InitializeCore() {} diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticSuperpositionField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticSuperpositionField.hh index ab3d9a30c..c24897961 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticSuperpositionField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KMagneticSuperpositionField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELD_HH_ +#ifndef KMAGNETICSUPERPOSITIONFIELD_HH_ +#define KMAGNETICSUPERPOSITIONFIELD_HH_ #include "KMagneticField.hh" #include @@ -20,8 +20,8 @@ public: KMagneticSuperpositionField(); virtual ~KMagneticSuperpositionField(); - KEMThreeVector MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; - KEMThreeVector MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; KGradient MagneticGradientCore( const KPosition& aSamplePoint, const double& aSampleTime ) const; void SetEnhancements( std::vector< double > aEnhancementVector ); @@ -34,12 +34,12 @@ public: private: void InitializeCore(); - KEMThreeVector CalculateCachedPotential( const KPosition& aSamplePoint, const double& aSampleTime ) const; - KEMThreeVector CalculateCachedField( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector CalculateCachedPotential( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector CalculateCachedField( const KPosition& aSamplePoint, const double& aSampleTime ) const; KGradient CalculateCachedGradient( const KPosition& aSamplePoint, const double& aSampleTime ) const; - KEMThreeVector CalculateDirectPotential( const KPosition& aSamplePoint, const double& aSampleTime ) const; - KEMThreeVector CalculateDirectField( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector CalculateDirectPotential( const KPosition& aSamplePoint, const double& aSampleTime ) const; + KThreeVector CalculateDirectField( const KPosition& aSamplePoint, const double& aSampleTime ) const; KGradient CalculateDirectGradient( const KPosition& aSamplePoint, const double& aSampleTime ) const; bool AreAllFieldsStatic(); @@ -50,11 +50,11 @@ private: bool fUseCaching; bool fCachingBlock; - mutable std::map < KPosition, std::vector > fPotentialCache; - mutable std::map < KPosition, std::vector > fFieldCache; + mutable std::map < KPosition, std::vector > fPotentialCache; + mutable std::map < KPosition, std::vector > fFieldCache; mutable std::map < KPosition, std::vector > fGradientCache; }; } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETICSUPERPOSITIONFIELD_HH_ */ +#endif /* KMAGNETICSUPERPOSITIONFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticConstantField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticConstantField.hh index 9963dbdac..527772b58 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticConstantField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticConstantField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELD_HH_ +#ifndef KMAGNETOSTATICCONSTANTFIELD_HH_ +#define KMAGNETOSTATICCONSTANTFIELD_HH_ #include "KMagnetostaticField.hh" @@ -19,7 +19,7 @@ public: KMagnetostaticField(), fFieldVector() {} - KMagnetostaticConstantField( const KEMThreeVector& aField ) : + KMagnetostaticConstantField( const KThreeVector& aField ) : KMagnetostaticField(), fFieldVector(aField) {} @@ -28,29 +28,29 @@ public: private: /** We choose A(r) = 1/2 * B x r as the magnetic potential. * This is a viable choice for Coulomb gauge.*/ - virtual KEMThreeVector MagneticPotentialCore(const KPosition& P) const { + virtual KThreeVector MagneticPotentialCore(const KPosition& P) const { return 0.5 * fFieldVector.Cross(P); } - virtual KEMThreeVector MagneticFieldCore(const KPosition& /*P*/) const { + virtual KThreeVector MagneticFieldCore(const KPosition& /*P*/) const { return fFieldVector; } virtual KGradient MagneticGradientCore(const KPosition& /*P*/) const { - return KEMThreeMatrix::sZero; + return KThreeMatrix::sZero; } public: - void SetField( const KEMThreeVector& aFieldVector ) { + void SetField( const KThreeVector& aFieldVector ) { fFieldVector = aFieldVector; } - KEMThreeVector GetField() const { + KThreeVector GetField() const { return fFieldVector; } private: - KEMThreeVector fFieldVector; + KThreeVector fFieldVector; }; } /* namespace KEMFIELD */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICCONSTANTFIELD_HH_ */ +#endif /* KMAGNETOSTATICCONSTANTFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticField.hh index fb5302687..21543d370 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KMagnetostaticField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELD_HH_ +#ifndef KMAGNETOSTATICFIELD_HH_ +#define KMAGNETOSTATICFIELD_HH_ #include "KMagneticField.hh" @@ -23,11 +23,11 @@ public: using KMagneticField::MagneticPotential; - KEMThreeVector MagneticPotential(const KPosition& P) const { + KThreeVector MagneticPotential(const KPosition& P) const { return MagneticPotentialCore(P); } - KEMThreeVector MagneticField(const KPosition& P) const { + KThreeVector MagneticField(const KPosition& P) const { return MagneticFieldCore(P); } @@ -37,12 +37,12 @@ public: private: - virtual KEMThreeVector MagneticPotentialCore(const KPosition& P, const double& /*time*/) const + virtual KThreeVector MagneticPotentialCore(const KPosition& P, const double& /*time*/) const { return MagneticPotentialCore(P); } - virtual KEMThreeVector MagneticFieldCore(const KPosition& P, const double& /*time*/) const + virtual KThreeVector MagneticFieldCore(const KPosition& P, const double& /*time*/) const { return MagneticFieldCore(P); } @@ -52,22 +52,22 @@ private: return MagneticGradientCore(P); } - virtual std::pair MagneticFieldAndGradientCore(const KPosition& P, const double& /*time*/) const + virtual std::pair MagneticFieldAndGradientCore(const KPosition& P, const double& /*time*/) const { return MagneticFieldAndGradientCore(P); } - virtual KEMThreeVector MagneticPotentialCore(const KPosition& P) const = 0; - virtual KEMThreeVector MagneticFieldCore(const KPosition& P) const = 0; + virtual KThreeVector MagneticPotentialCore(const KPosition& P) const = 0; + virtual KThreeVector MagneticFieldCore(const KPosition& P) const = 0; virtual KGradient MagneticGradientCore(const KPosition& P) const = 0; - virtual std::pair MagneticFieldAndGradientCore(const KPosition& P) const + virtual std::pair MagneticFieldAndGradientCore(const KPosition& P) const { //default behavior is to simply call the field and gradient separately //this function may be overloaded to perform a more efficient combined calculation - KEMThreeVector field = MagneticFieldCore(P); + KThreeVector field = MagneticFieldCore(P); KGradient grad = MagneticGradientCore(P); - return std::pair(field,grad); + return std::pair(field,grad); } }; @@ -75,4 +75,4 @@ private: -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KMAGNETOSTATICFIELD_HH_ */ +#endif /* KMAGNETOSTATICFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KRampedMagneticField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KRampedMagneticField.hh index 44108f6bc..115419108 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KRampedMagneticField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KRampedMagneticField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELD_HH_ +#ifndef KRAMPEDMAGNETICFIELD_HH_ +#define KRAMPEDMAGNETICFIELD_HH_ #include "KMagneticField.hh" @@ -27,8 +27,8 @@ public: virtual ~KRampedMagneticField(); public: - KEMThreeVector MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime) const; - KEMThreeVector MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; + KThreeVector MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime) const; + KThreeVector MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const; KGradient MagneticGradientCore( const KPosition& aSamplePoint, const double& aSampleTime) const; public: @@ -132,4 +132,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KRAMPEDMAGNETICFIELD_HH_ */ +#endif /* KRAMPEDMAGNETICFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/include/KStaticElectromagnetField.hh b/KEMField/Source/Interface/Fields/Magnetic/include/KStaticElectromagnetField.hh index f83d9363e..9a3250ec3 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/include/KStaticElectromagnetField.hh +++ b/KEMField/Source/Interface/Fields/Magnetic/include/KStaticElectromagnetField.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELD_HH_ -#define KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELD_HH_ +#ifndef KSTATICELECTROMAGNETFIELD_HH_ +#define KSTATICELECTROMAGNETFIELD_HH_ #include "KMagnetostaticField.hh" #include "KMagneticFieldSolver.hh" @@ -33,10 +33,10 @@ protected: void InitializeCore(); void CheckSolverExistance() const; - KEMThreeVector MagneticPotentialCore(const KPosition& aSamplePoint) const; - KEMThreeVector MagneticFieldCore(const KPosition& aSamplePoint) const; + KThreeVector MagneticPotentialCore(const KPosition& aSamplePoint) const; + KThreeVector MagneticFieldCore(const KPosition& aSamplePoint) const; KGradient MagneticGradientCore(const KPosition& aSamplePoint) const; - std::pair MagneticFieldAndGradientCore(const KPosition& P) const; + std::pair MagneticFieldAndGradientCore(const KPosition& P) const; private: KSmartPointer fContainer; @@ -48,4 +48,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_FIELDS_MAGNETIC_INCLUDE_KSTATICELECTROMAGNETFIELD_HH_ */ +#endif /* KSTATICELECTROMAGNETFIELD_HH_ */ diff --git a/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticDipoleField.cc b/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticDipoleField.cc index 333fc11ad..599c203f3 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticDipoleField.cc +++ b/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticDipoleField.cc @@ -22,14 +22,14 @@ KMagneticDipoleField::~KMagneticDipoleField() * The magnetic potential of a dipole at the origin can be written as * A(r) = (m x r)/(|r|^3). */ -KEMThreeVector KMagneticDipoleField::MagneticPotentialCore(const KPosition& aSamplePoint) const { +KThreeVector KMagneticDipoleField::MagneticPotentialCore(const KPosition& aSamplePoint) const { KPosition r = aSamplePoint-fLocation; double distance = r.Magnitude(); return fMoment.Cross(r)/(distance * distance * distance); } -KEMThreeVector KMagneticDipoleField::MagneticFieldCore(const KPosition& aSamplePoint) const { - KEMThreeVector aPoint = aSamplePoint - fLocation; +KThreeVector KMagneticDipoleField::MagneticFieldCore(const KPosition& aSamplePoint) const { + KThreeVector aPoint = aSamplePoint - fLocation; double aPointMag = aPoint.Magnitude(); double aPointMag2 = aPointMag * aPointMag; double aPointMag3 = aPointMag * aPointMag2; @@ -40,7 +40,7 @@ KEMThreeVector KMagneticDipoleField::MagneticFieldCore(const KPosition& aSampleP } KGradient KMagneticDipoleField::MagneticGradientCore(const KPosition& aSamplePoint) const { - KEMThreeVector aPoint = aSamplePoint - fLocation; + KThreeVector aPoint = aSamplePoint - fLocation; double aPointMag = aPoint.Magnitude(); double aPointMag2 = aPointMag * aPointMag; double aPointMag3 = aPointMag * aPointMag2; diff --git a/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticSuperpositionField.cc b/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticSuperpositionField.cc index bd5022427..d907296ae 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticSuperpositionField.cc +++ b/KEMField/Source/Interface/Fields/Magnetic/src/KMagneticSuperpositionField.cc @@ -26,7 +26,7 @@ KMagneticSuperpositionField::KMagneticSuperpositionField() : KMagneticSuperpositionField::~KMagneticSuperpositionField() { } -KEMThreeVector KMagneticSuperpositionField::MagneticPotentialCore( +KThreeVector KMagneticSuperpositionField::MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime) const { CheckAndPrintCachingDisabledWarning(); @@ -36,7 +36,7 @@ KEMThreeVector KMagneticSuperpositionField::MagneticPotentialCore( return CalculateDirectPotential(aSamplePoint, aSampleTime); } -KEMThreeVector KMagneticSuperpositionField::MagneticFieldCore( +KThreeVector KMagneticSuperpositionField::MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const { CheckAndPrintCachingDisabledWarning(); @@ -56,9 +56,9 @@ KGradient KMagneticSuperpositionField::MagneticGradientCore( } -KEMThreeVector KMagneticSuperpositionField::CalculateCachedPotential( +KThreeVector KMagneticSuperpositionField::CalculateCachedPotential( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector aPotential (KEMThreeVector::sZero); + KThreeVector aPotential (KThreeVector::sZero); //looking in cache for aSamplePoint auto potentialVector = fPotentialCache.find(aSamplePoint); if(potentialVector != fPotentialCache.end() ) { @@ -70,8 +70,8 @@ KEMThreeVector KMagneticSuperpositionField::CalculateCachedPotential( } //Calculating Fields without Enhancement for aSamplePoint and insert it into the cache - vector tPotentials; - KEMThreeVector tCurrentPotential; + vector tPotentials; + KThreeVector tCurrentPotential; for (size_t tIndex = 0; tIndex < fMagneticFields.size(); tIndex++) { tCurrentPotential = fMagneticFields.at( tIndex )->MagneticPotential( aSamplePoint, aSampleTime ); @@ -82,9 +82,9 @@ KEMThreeVector KMagneticSuperpositionField::CalculateCachedPotential( return aPotential; } -KEMThreeVector KMagneticSuperpositionField::CalculateCachedField( +KThreeVector KMagneticSuperpositionField::CalculateCachedField( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector aField (KEMThreeVector::sZero); + KThreeVector aField (KThreeVector::sZero); //looking in cache for aSamplePoint auto fieldVector = fFieldCache.find(aSamplePoint); if(fieldVector != fFieldCache.end() ) { @@ -96,8 +96,8 @@ KEMThreeVector KMagneticSuperpositionField::CalculateCachedField( } //Calculating Fields without Enhancement for aSamplePoint and insert it into the cache - vector tFields; - KEMThreeVector tCurrentField; + vector tFields; + KThreeVector tCurrentField; for (size_t tIndex = 0; tIndex < fMagneticFields.size(); tIndex++) { tCurrentField = fMagneticFields.at( tIndex )->MagneticField( aSamplePoint, aSampleTime ); @@ -166,10 +166,10 @@ void KMagneticSuperpositionField::InitializeCore() { } } -KEMThreeVector KMagneticSuperpositionField::CalculateDirectPotential( +KThreeVector KMagneticSuperpositionField::CalculateDirectPotential( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector potential(KEMThreeVector::sZero); + KThreeVector potential(KThreeVector::sZero); for (size_t tIndex = 0; tIndex < fMagneticFields.size(); tIndex++) { potential += fEnhancements.at(tIndex) * @@ -178,10 +178,10 @@ KEMThreeVector KMagneticSuperpositionField::CalculateDirectPotential( return potential; } -KEMThreeVector KMagneticSuperpositionField::CalculateDirectField( +KThreeVector KMagneticSuperpositionField::CalculateDirectField( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector field(KEMThreeVector::sZero); + KThreeVector field(KThreeVector::sZero); for (size_t tIndex = 0; tIndex < fMagneticFields.size(); tIndex++) { field += fEnhancements.at(tIndex) * diff --git a/KEMField/Source/Interface/Fields/Magnetic/src/KRampedMagneticField.cc b/KEMField/Source/Interface/Fields/Magnetic/src/KRampedMagneticField.cc index a14763f6a..1888d4b55 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/src/KRampedMagneticField.cc +++ b/KEMField/Source/Interface/Fields/Magnetic/src/KRampedMagneticField.cc @@ -31,16 +31,16 @@ KRampedMagneticField::KRampedMagneticField() : KRampedMagneticField::~KRampedMagneticField() { } -KEMThreeVector KRampedMagneticField::MagneticPotentialCore( +KThreeVector KRampedMagneticField::MagneticPotentialCore( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector aPotential = fRootMagneticField->MagneticPotential( aSamplePoint, aSampleTime ); + KThreeVector aPotential = fRootMagneticField->MagneticPotential( aSamplePoint, aSampleTime ); double Modulation = GetModulationFactor( aSampleTime ); return aPotential * Modulation; } -KEMThreeVector KRampedMagneticField::MagneticFieldCore( +KThreeVector KRampedMagneticField::MagneticFieldCore( const KPosition& aSamplePoint, const double& aSampleTime) const { - KEMThreeVector aField = fRootMagneticField->MagneticField( aSamplePoint, aSampleTime); + KThreeVector aField = fRootMagneticField->MagneticField( aSamplePoint, aSampleTime); double Modulation = GetModulationFactor( aSampleTime ); return aField * Modulation; } diff --git a/KEMField/Source/Interface/Fields/Magnetic/src/KStaticElectromagnetField.cc b/KEMField/Source/Interface/Fields/Magnetic/src/KStaticElectromagnetField.cc index 00683111f..4c35365a7 100644 --- a/KEMField/Source/Interface/Fields/Magnetic/src/KStaticElectromagnetField.cc +++ b/KEMField/Source/Interface/Fields/Magnetic/src/KStaticElectromagnetField.cc @@ -25,12 +25,12 @@ KStaticElectromagnetField::~KStaticElectromagnetField() { } -KEMThreeVector KStaticElectromagnetField::MagneticPotentialCore( +KThreeVector KStaticElectromagnetField::MagneticPotentialCore( const KPosition& aSamplePoint) const { return fFieldSolver->MagneticPotential(aSamplePoint); } -KEMThreeVector KStaticElectromagnetField::MagneticFieldCore( +KThreeVector KStaticElectromagnetField::MagneticFieldCore( const KPosition& aSamplePoint) const { return fFieldSolver->MagneticField(aSamplePoint); } @@ -40,7 +40,7 @@ KGradient KStaticElectromagnetField::MagneticGradientCore( return fFieldSolver->MagneticGradient(aSamplePoint); } -std::pair +std::pair KStaticElectromagnetField::MagneticFieldAndGradientCore(const KPosition& P) const { return fFieldSolver->MagneticFieldAndGradient(P); diff --git a/KEMField/Source/Interface/KGeoBag/CMakeLists.txt b/KEMField/Source/Interface/KGeoBag/CMakeLists.txt new file mode 100644 index 000000000..be76f567c --- /dev/null +++ b/KEMField/Source/Interface/KGeoBag/CMakeLists.txt @@ -0,0 +1,36 @@ +# CMakeLists for KEMField/Interface/KGeoBag +# T.J. Corona, D. Hilk + + kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + + set (KGEOBAGINTERFACE_HEADERFILES + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectrostaticBoundaryField.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGBEM.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGBEMConverter.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectromagnet.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectromagnetConverter.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KGStaticElectromagnetField.hh + ) + + set (KGEOBAGINTERFACE_SOURCEFILES + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectrostaticBoundaryField.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGBEM.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGBEMConverter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectromagnet.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectromagnetConverter.cc + ${CMAKE_CURRENT_SOURCE_DIR}/src/KGStaticElectromagnetField.cc + ) + + add_library (KGeoBagInterface SHARED ${KGEOBAGINTERFACE_SOURCEFILES}) + target_link_libraries (KGeoBagInterface + KEMSurfaces + KEMFieldsElectric + KEMFieldsMagnetic + KEMElectromagnets + ${GSL_LIBRARIES} + ${OPENCL_LIBRARIES} + ${KGeoBag_LIBRARIES} + ) + + kasper_install_headers (${KGEOBAGINTERFACE_HEADERFILES}) + kasper_install_libraries (KGeoBagInterface) diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGBEM.hh b/KEMField/Source/Interface/KGeoBag/include/KGBEM.hh similarity index 98% rename from KEMField/Source/Plugins/KGeoBag/include/KGBEM.hh rename to KEMField/Source/Interface/KGeoBag/include/KGBEM.hh index 968863950..b4b60c44c 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KGBEM.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGBEM.hh @@ -17,7 +17,7 @@ using KEMField::KBoundaryTypes; using KEMField::KPosition; using KEMField::KDirection; -using KEMField::KEMThreeVector; +using KGeoBag::KThreeVector; using KEMField::KTriangle; using KEMField::KRectangle; diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGBEMConverter.hh b/KEMField/Source/Interface/KGeoBag/include/KGBEMConverter.hh similarity index 97% rename from KEMField/Source/Plugins/KGeoBag/include/KGBEMConverter.hh rename to KEMField/Source/Interface/KGeoBag/include/KGBEMConverter.hh index eec8aa72d..9b1573fcd 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KGBEMConverter.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGBEMConverter.hh @@ -1,8 +1,6 @@ #ifndef KGBEMCONVERTER_DEF #define KGBEMCONVERTER_DEF -#include "KGBEM.hh" - #include "KGMesh.hh" #include "KGAxialMesh.hh" #include "KGDiscreteRotationalMesh.hh" @@ -11,6 +9,7 @@ #include "KAxis.hh" #include +#include "KGBEM.hh" namespace KGeoBag { @@ -250,10 +249,10 @@ namespace KGeoBag const KThreeVector& GetZAxis() const; const KAxis& GetAxis() const; - KEMThreeVector GlobalToInternalPosition( const KThreeVector& aPosition ); - KEMThreeVector GlobalToInternalVector( const KThreeVector& aVector ); - KThreeVector InternalToGlobalPosition( const KEMThreeVector& aVector ); - KThreeVector InternalToGlobalVector( const KEMThreeVector& aVector ); + KThreeVector GlobalToInternalPosition( const KThreeVector& aPosition ); + KThreeVector GlobalToInternalVector( const KThreeVector& aVector ); + KThreeVector InternalToGlobalPosition( const KThreeVector& aVector ); + KThreeVector InternalToGlobalVector( const KThreeVector& aVector ); void VisitSurface( KGSurface* aSurface ); void VisitSpace( KGSpace* aSpace ); diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGElectromagnet.hh b/KEMField/Source/Interface/KGeoBag/include/KGElectromagnet.hh similarity index 97% rename from KEMField/Source/Plugins/KGeoBag/include/KGElectromagnet.hh rename to KEMField/Source/Interface/KGeoBag/include/KGElectromagnet.hh index ab9684a0a..810d8cba9 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KGElectromagnet.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGElectromagnet.hh @@ -9,7 +9,7 @@ using KEMField::KMagnetostaticBasis; using KEMField::KPosition; using KEMField::KDirection; using KEMField::KGradient; -using KEMField::KEMThreeVector; +using KGeoBag::KThreeVector; using KEMField::KLineCurrent; using KEMField::KCoil; diff --git a/KEMField/Source/Plugins/KGeoBag/include/KGElectromagnetConverter.hh b/KEMField/Source/Interface/KGeoBag/include/KGElectromagnetConverter.hh similarity index 87% rename from KEMField/Source/Plugins/KGeoBag/include/KGElectromagnetConverter.hh rename to KEMField/Source/Interface/KGeoBag/include/KGElectromagnetConverter.hh index 48c431219..c541eb619 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KGElectromagnetConverter.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGElectromagnetConverter.hh @@ -4,8 +4,8 @@ #include "KTagged.h" using katrin::KTag; -#include "KEMThreeMatrix.hh" -using KEMField::KEMThreeMatrix; +#include "KThreeMatrix_KEMField.hh" +using KGeoBag::KThreeMatrix; #include "KGElectromagnet.hh" @@ -47,10 +47,10 @@ namespace KGeoBag const KThreeVector& GetYAxis() const; const KThreeVector& GetZAxis() const; - KEMThreeVector GlobalToInternalPosition( const KThreeVector& aPosition ); - KEMThreeVector GlobalToInternalVector( const KThreeVector& aVector ); - KThreeVector InternalToGlobalPosition( const KEMThreeVector& aVector ); - KThreeVector InternalToGlobalVector( const KEMThreeVector& aVector ); + KThreeVector GlobalToInternalPosition( const KThreeVector& aPosition ); + KThreeVector GlobalToInternalVector( const KThreeVector& aVector ); + KThreeVector InternalToGlobalPosition( const KThreeVector& aVector ); + KThreeVector InternalToGlobalVector( const KThreeVector& aVector ); KThreeMatrix InternalTensorToGlobal( const KGradient& aGradient ); void VisitSpace( KGSpace* aSpace ); diff --git a/KEMField/Source/Plugins/KGeoBag/include/KElectrostaticBoundaryFieldWithKGeoBag.hh b/KEMField/Source/Interface/KGeoBag/include/KGElectrostaticBoundaryField.hh similarity index 65% rename from KEMField/Source/Plugins/KGeoBag/include/KElectrostaticBoundaryFieldWithKGeoBag.hh rename to KEMField/Source/Interface/KGeoBag/include/KGElectrostaticBoundaryField.hh index cca547bf3..12ae27b00 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KElectrostaticBoundaryFieldWithKGeoBag.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGElectrostaticBoundaryField.hh @@ -1,29 +1,30 @@ /* - * KElectrostaticBoundaryFieldWithKGeoBag.hh + * KGElectrostaticBoundaryField.hh * * Created on: 15 Jun 2015 * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDWITHKGEOBAG_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDWITHKGEOBAG_HH_ +#ifndef KGELECTROSTATICBOUNDARYFIELD_HH_ +#define KGELECTROSTATICBOUNDARYFIELD_HH_ #include "KElectrostaticBoundaryField.hh" #include #include -#include "KGCore.hh" #include "KGBEM.hh" #include "KGBEMConverter.hh" +#include "KGCore.hh" + namespace KEMField { -class KElectrostaticBoundaryFieldWithKGeoBag : +class KGElectrostaticBoundaryField : public KElectrostaticBoundaryField { public: - KElectrostaticBoundaryFieldWithKGeoBag(); - virtual ~KElectrostaticBoundaryFieldWithKGeoBag(); + KGElectrostaticBoundaryField(); + virtual ~KGElectrostaticBoundaryField(); enum Symmetry { NoSymmetry , AxialSymmetry , DiscreteAxialSymmetry }; void SetMinimumElementArea( const double& aArea); @@ -39,7 +40,7 @@ public: private: virtual double PotentialCore(const KPosition& P) const; - virtual KEMThreeVector ElectricFieldCore(const KPosition& P) const; + virtual KThreeVector ElectricFieldCore(const KPosition& P) const; virtual void InitializeCore(); void ConfigureSurfaceContainer(); @@ -59,4 +60,4 @@ private: -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDS_ELECTRIC_INCLUDE_KELECTROSTATICBOUNDARYFIELDWITHKGEOBAG_HH_ */ +#endif /* KGELECTROSTATICBOUNDARYFIELD_HH_ */ diff --git a/KEMField/Source/Plugins/KGeoBag/include/KStaticElectromagnetFieldWithKGeoBag.hh b/KEMField/Source/Interface/KGeoBag/include/KGStaticElectromagnetField.hh similarity index 55% rename from KEMField/Source/Plugins/KGeoBag/include/KStaticElectromagnetFieldWithKGeoBag.hh rename to KEMField/Source/Interface/KGeoBag/include/KGStaticElectromagnetField.hh index 0d9d4f638..8938882b8 100644 --- a/KEMField/Source/Plugins/KGeoBag/include/KStaticElectromagnetFieldWithKGeoBag.hh +++ b/KEMField/Source/Interface/KGeoBag/include/KGStaticElectromagnetField.hh @@ -1,25 +1,26 @@ /* - * KStaticElectromagnetFieldWithKGeoBag.hh + * KGElectrostaticBoundaryField.hh * * Created on: 25 Mar 2016 * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_KGEOBAG_INCLUDE_KSTATICELECTROMAGNETFIELDWITHKGEOBAG_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_KGEOBAG_INCLUDE_KSTATICELECTROMAGNETFIELDWITHKGEOBAG_HH_ +#ifndef KGSTATICELECTROMAGNETFIELD_HH_ +#define KGSTATICELECTROMAGNETFIELD_HH_ #include "KStaticElectromagnetField.hh" #include #include -#include "KGCore.hh" + #include "KGElectromagnetConverter.hh" +#include "KGCore.hh" namespace KEMField { -class KStaticElectromagnetFieldWithKGeoBag: public KStaticElectromagnetField { +class KGStaticElectromagnetField: public KStaticElectromagnetField { public: - KStaticElectromagnetFieldWithKGeoBag(); - virtual ~KStaticElectromagnetFieldWithKGeoBag(); + KGStaticElectromagnetField(); + virtual ~KGStaticElectromagnetField(); void SetSystem( KGeoBag::KGSpace* aSystem ); void AddSurface( KGeoBag::KGSurface* aSurface ); @@ -30,8 +31,8 @@ public: private: void InitializeCore(); - KEMThreeVector MagneticPotentialCore(const KPosition& aSamplePoint) const; - KEMThreeVector MagneticFieldCore(const KPosition& aSamplePoint) const; + KThreeVector MagneticPotentialCore(const KPosition& aSamplePoint) const; + KThreeVector MagneticFieldCore(const KPosition& aSamplePoint) const; KGradient MagneticGradientCore(const KPosition& aSamplePoint) const; void ConfigureSurfaceContainer(); @@ -45,4 +46,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_KGEOBAG_INCLUDE_KSTATICELECTROMAGNETFIELDWITHKGEOBAG_HH_ */ +#endif /* KGSTATICELECTROMAGNETFIELD_HH_ */ diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGBEM.cc b/KEMField/Source/Interface/KGeoBag/src/KGBEM.cc similarity index 100% rename from KEMField/Source/Plugins/KGeoBag/src/KGBEM.cc rename to KEMField/Source/Interface/KGeoBag/src/KGBEM.cc diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGBEMConverter.cc b/KEMField/Source/Interface/KGeoBag/src/KGBEMConverter.cc similarity index 94% rename from KEMField/Source/Plugins/KGeoBag/src/KGBEMConverter.cc rename to KEMField/Source/Interface/KGeoBag/src/KGBEMConverter.cc index 318f1b492..8f15ca051 100644 --- a/KEMField/Source/Plugins/KGeoBag/src/KGBEMConverter.cc +++ b/KEMField/Source/Interface/KGeoBag/src/KGBEMConverter.cc @@ -9,6 +9,8 @@ #include +#include "KGCoreMessage.hh" + namespace KGeoBag { @@ -132,22 +134,22 @@ namespace KGeoBag return fAxis; } - KEMThreeVector KGBEMConverter::GlobalToInternalPosition( const KThreeVector& aVector ) + KThreeVector KGBEMConverter::GlobalToInternalPosition( const KThreeVector& aVector ) { KThreeVector tPosition( aVector - fOrigin ); - return KEMThreeVector( tPosition.Dot( fXAxis ), tPosition.Dot( fYAxis ), tPosition.Dot( fZAxis ) ); + return KThreeVector( tPosition.Dot( fXAxis ), tPosition.Dot( fYAxis ), tPosition.Dot( fZAxis ) ); } - KEMThreeVector KGBEMConverter::GlobalToInternalVector( const KThreeVector& aVector ) + KThreeVector KGBEMConverter::GlobalToInternalVector( const KThreeVector& aVector ) { KThreeVector tVector( aVector ); - return KEMThreeVector( tVector.Dot( fXAxis ), tVector.Dot( fYAxis ), tVector.Dot( fZAxis ) ); + return KThreeVector( tVector.Dot( fXAxis ), tVector.Dot( fYAxis ), tVector.Dot( fZAxis ) ); } - KThreeVector KGBEMConverter::InternalToGlobalPosition( const KEMThreeVector& aVector ) + KThreeVector KGBEMConverter::InternalToGlobalPosition( const KThreeVector& aVector ) { KThreeVector tPosition( aVector.X(), aVector.Y(), aVector.Z() ); return KThreeVector( fOrigin + tPosition.X() * fXAxis + tPosition.Y() * fYAxis + tPosition.Z() * fZAxis ); } - KThreeVector KGBEMConverter::InternalToGlobalVector( const KEMThreeVector& aVector ) + KThreeVector KGBEMConverter::InternalToGlobalVector( const KThreeVector& aVector ) { KThreeVector tVector( aVector.X(), aVector.Y(), aVector.Z() ); return KThreeVector( tVector.X() * fXAxis + tVector.Y() * fYAxis + tVector.Z() * fZAxis ); @@ -261,6 +263,12 @@ namespace KGeoBag { tLineSegment = new LineSegment(); tLineSegment->SetValues( LocalToInternal( tMeshWire->GetP0() ), LocalToInternal( tMeshWire->GetP1() ), tMeshWire->GetDiameter() ); + if (tMeshWire->Aspect() < 1.) { + coremsg( eWarning ) << "Attention at line segment at P0=" << (KThreeVector)(tLineSegment->GetP0()) << ": Length < Diameter" << eom; + coremsg( eNormal ) << "Wires are discretized too finely for the approximation of linear charge density to hold valid." << ret + << "Convergence problems of the Robin Hood charge density solver are expected." << ret + << "To avoid invalid elements, reduce mesh count and / or mesh power." << eom; + } fLineSegments.push_back( tLineSegment ); continue; } diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGElectromagnet.cc b/KEMField/Source/Interface/KGeoBag/src/KGElectromagnet.cc similarity index 100% rename from KEMField/Source/Plugins/KGeoBag/src/KGElectromagnet.cc rename to KEMField/Source/Interface/KGeoBag/src/KGElectromagnet.cc diff --git a/KEMField/Source/Plugins/KGeoBag/src/KGElectromagnetConverter.cc b/KEMField/Source/Interface/KGeoBag/src/KGElectromagnetConverter.cc similarity index 92% rename from KEMField/Source/Plugins/KGeoBag/src/KGElectromagnetConverter.cc rename to KEMField/Source/Interface/KGeoBag/src/KGElectromagnetConverter.cc index 522234967..03524ba52 100644 --- a/KEMField/Source/Plugins/KGeoBag/src/KGElectromagnetConverter.cc +++ b/KEMField/Source/Interface/KGeoBag/src/KGElectromagnetConverter.cc @@ -53,22 +53,22 @@ namespace KGeoBag return fZAxis; } - KEMThreeVector KGElectromagnetConverter::GlobalToInternalPosition( const KThreeVector& aVector ) + KThreeVector KGElectromagnetConverter::GlobalToInternalPosition( const KThreeVector& aVector ) { KThreeVector tPosition( aVector - fOrigin ); - return KEMThreeVector( tPosition.Dot( fXAxis ), tPosition.Dot( fYAxis ), tPosition.Dot( fZAxis ) ); + return KThreeVector( tPosition.Dot( fXAxis ), tPosition.Dot( fYAxis ), tPosition.Dot( fZAxis ) ); } - KEMThreeVector KGElectromagnetConverter::GlobalToInternalVector( const KThreeVector& aVector ) + KThreeVector KGElectromagnetConverter::GlobalToInternalVector( const KThreeVector& aVector ) { KThreeVector tVector( aVector ); - return KEMThreeVector( tVector.Dot( fXAxis ), tVector.Dot( fYAxis ), tVector.Dot( fZAxis ) ); + return KThreeVector( tVector.Dot( fXAxis ), tVector.Dot( fYAxis ), tVector.Dot( fZAxis ) ); } - KThreeVector KGElectromagnetConverter::InternalToGlobalPosition( const KEMThreeVector& aVector ) + KThreeVector KGElectromagnetConverter::InternalToGlobalPosition( const KThreeVector& aVector ) { KThreeVector tPosition( aVector.X(), aVector.Y(), aVector.Z() ); return KThreeVector( fOrigin + tPosition.X() * fXAxis + tPosition.Y() * fYAxis + tPosition.Z() * fZAxis ); } - KThreeVector KGElectromagnetConverter::InternalToGlobalVector( const KEMThreeVector& aVector ) + KThreeVector KGElectromagnetConverter::InternalToGlobalVector( const KThreeVector& aVector ) { KThreeVector tVector( aVector.X(), aVector.Y(), aVector.Z() ); return KThreeVector( tVector.X() * fXAxis + tVector.Y() * fYAxis + tVector.Z() * fZAxis ); @@ -76,7 +76,7 @@ namespace KGeoBag KThreeMatrix KGElectromagnetConverter::InternalTensorToGlobal( const KGradient& aGradient ) { - KEMThreeMatrix tTransform(fXAxis[0],fYAxis[0],fZAxis[0], + KThreeMatrix tTransform(fXAxis[0],fYAxis[0],fZAxis[0], fXAxis[1],fYAxis[1],fZAxis[1], fXAxis[2],fYAxis[2],fZAxis[2]); diff --git a/KEMField/Source/Plugins/KGeoBag/src/KElectrostaticBoundaryFieldWithKGeoBag.cc b/KEMField/Source/Interface/KGeoBag/src/KGElectrostaticBoundaryField.cc similarity index 58% rename from KEMField/Source/Plugins/KGeoBag/src/KElectrostaticBoundaryFieldWithKGeoBag.cc rename to KEMField/Source/Interface/KGeoBag/src/KGElectrostaticBoundaryField.cc index 941a9b9c5..14f101a4b 100644 --- a/KEMField/Source/Plugins/KGeoBag/src/KElectrostaticBoundaryFieldWithKGeoBag.cc +++ b/KEMField/Source/Interface/KGeoBag/src/KGElectrostaticBoundaryField.cc @@ -1,22 +1,11 @@ /* - * KElectrostaticBoundaryFieldWithKGeoBag.cc + * KGElectrostaticBoundaryField.cc * * Created on: 15 Jun 2015 * Author: wolfgang */ -#include "KElectrostaticBoundaryFieldWithKGeoBag.hh" - -//#ifdef KEMFIELD_USE_VTK -//#include "KEMVTKViewer.hh" -//#include "KEMVTKElectromagnetViewer.hh" -//#include "KVTKIterationPlotter.hh" -//using KEMField::KEMVTKViewer; -//using KEMField::KEMVTKElectromagnetViewer; -//using KEMField::KVTKIterationPlotter; -//#endif - -#include "KEMVectorConverters.hh" +#include "KGElectrostaticBoundaryField.hh" #include "KFile.h" @@ -26,7 +15,7 @@ using namespace KGeoBag; namespace KEMField{ -KElectrostaticBoundaryFieldWithKGeoBag::KElectrostaticBoundaryFieldWithKGeoBag() : +KGElectrostaticBoundaryField::KGElectrostaticBoundaryField() : KElectrostaticBoundaryField(), fMinimumElementArea(0.0), fMaximumElementAspectRatio(1e100), @@ -38,64 +27,64 @@ KElectrostaticBoundaryFieldWithKGeoBag::KElectrostaticBoundaryFieldWithKGeoBag() { } -KElectrostaticBoundaryFieldWithKGeoBag::~KElectrostaticBoundaryFieldWithKGeoBag() +KGElectrostaticBoundaryField::~KGElectrostaticBoundaryField() { } -double KElectrostaticBoundaryFieldWithKGeoBag::PotentialCore( const KPosition& P) const +double KGElectrostaticBoundaryField::PotentialCore( const KPosition& P) const { - KPosition internal = fConverter->GlobalToInternalPosition(KEM2KThreeVector(P)); + KPosition internal = fConverter->GlobalToInternalPosition(P); double aPotential = KElectrostaticBoundaryField::PotentialCore( internal ); - //bindingmsg_debug( "potential at " << KEM2KThreeVector(P) << " is " << aPotential <GlobalToInternalPosition(KEM2KThreeVector(P)); - KEMThreeVector internalField = KElectrostaticBoundaryField::ElectricFieldCore(internal); - KEMThreeVector aField = K2KEMThreeVector (fConverter->InternalToGlobalVector(internalField)); - //bindingmsg_debug( "electric field at " << KEM2KThreeVector(P) << " is " << aField <GlobalToInternalPosition(P); + KThreeVector internalField = KElectrostaticBoundaryField::ElectricFieldCore(internal); + KThreeVector aField = fConverter->InternalToGlobalVector(internalField); + //bindingmsg_debug( "electric field at " << P << " is " << aField < KElectrostaticBoundaryFieldWithKGeoBag::GetConverter() +KSmartPointer KGElectrostaticBoundaryField::GetConverter() { return fConverter; } -void KElectrostaticBoundaryFieldWithKGeoBag::InitializeCore() +void KGElectrostaticBoundaryField::InitializeCore() { CheckSolverExistance(); ConfigureSurfaceContainer(); @@ -103,7 +92,7 @@ void KElectrostaticBoundaryFieldWithKGeoBag::InitializeCore() } -void KElectrostaticBoundaryFieldWithKGeoBag::ConfigureSurfaceContainer() { +void KGElectrostaticBoundaryField::ConfigureSurfaceContainer() { KSurfaceContainer* container = new KSurfaceContainer(); fConverter = NULL; diff --git a/KEMField/Source/Plugins/KGeoBag/src/KStaticElectromagnetFieldWithKGeoBag.cc b/KEMField/Source/Interface/KGeoBag/src/KGStaticElectromagnetField.cc similarity index 56% rename from KEMField/Source/Plugins/KGeoBag/src/KStaticElectromagnetFieldWithKGeoBag.cc rename to KEMField/Source/Interface/KGeoBag/src/KGStaticElectromagnetField.cc index 47884c424..549cc22d3 100644 --- a/KEMField/Source/Plugins/KGeoBag/src/KStaticElectromagnetFieldWithKGeoBag.cc +++ b/KEMField/Source/Interface/KGeoBag/src/KGStaticElectromagnetField.cc @@ -1,19 +1,18 @@ /* - * KStaticElectromagnetFieldWithKGeoBag.cc + * KGStaticElectromagnetField.cc * * Created on: 25 Mar 2016 * Author: wolfgang */ -#include "KStaticElectromagnetFieldWithKGeoBag.hh" -#include "KEMVectorConverters.hh" +#include "KGStaticElectromagnetField.hh" using namespace KGeoBag; using namespace std; namespace KEMField { -KStaticElectromagnetFieldWithKGeoBag::KStaticElectromagnetFieldWithKGeoBag() : +KGStaticElectromagnetField::KGStaticElectromagnetField() : KStaticElectromagnetField(), fSystem(NULL), fSurfaces(), @@ -22,59 +21,59 @@ KStaticElectromagnetFieldWithKGeoBag::KStaticElectromagnetFieldWithKGeoBag() : { } -KStaticElectromagnetFieldWithKGeoBag::~KStaticElectromagnetFieldWithKGeoBag() +KGStaticElectromagnetField::~KGStaticElectromagnetField() { } -void KStaticElectromagnetFieldWithKGeoBag::SetSystem(KGeoBag::KGSpace* aSystem) +void KGStaticElectromagnetField::SetSystem(KGeoBag::KGSpace* aSystem) { fSystem = aSystem; } -void KStaticElectromagnetFieldWithKGeoBag::AddSurface( +void KGStaticElectromagnetField::AddSurface( KGeoBag::KGSurface* aSurface) { fSurfaces.push_back( aSurface ); } -void KStaticElectromagnetFieldWithKGeoBag::AddSpace(KGeoBag::KGSpace* aSpace) +void KGStaticElectromagnetField::AddSpace(KGeoBag::KGSpace* aSpace) { fSpaces.push_back( aSpace ); } -KSmartPointer KStaticElectromagnetFieldWithKGeoBag::GetConverter() { +KSmartPointer KGStaticElectromagnetField::GetConverter() { return fConverter; } -void KStaticElectromagnetFieldWithKGeoBag::InitializeCore() +void KGStaticElectromagnetField::InitializeCore() { CheckSolverExistance(); ConfigureSurfaceContainer(); KStaticElectromagnetField::InitializeCore(); } -KEMThreeVector KStaticElectromagnetFieldWithKGeoBag::MagneticPotentialCore( +KThreeVector KGStaticElectromagnetField::MagneticPotentialCore( const KPosition& aSamplePoint) const { - KPosition internal = fConverter->GlobalToInternalPosition(KEM2KThreeVector(aSamplePoint)); + KPosition internal = fConverter->GlobalToInternalPosition(aSamplePoint); KDirection internalPotential = KStaticElectromagnetField::MagneticPotentialCore(internal); - return K2KEMThreeVector(fConverter->InternalToGlobalVector(internalPotential)); + return fConverter->InternalToGlobalVector(internalPotential); } -KEMThreeVector KStaticElectromagnetFieldWithKGeoBag::MagneticFieldCore( +KThreeVector KGStaticElectromagnetField::MagneticFieldCore( const KPosition& aSamplePoint) const { - KPosition internal = fConverter->GlobalToInternalPosition(KEM2KThreeVector(aSamplePoint)); + KPosition internal = fConverter->GlobalToInternalPosition(aSamplePoint); KDirection internalField = KStaticElectromagnetField::MagneticFieldCore(internal); - return K2KEMThreeVector(fConverter->InternalToGlobalVector(internalField)); + return fConverter->InternalToGlobalVector(internalField); } -KGradient KStaticElectromagnetFieldWithKGeoBag::MagneticGradientCore( +KGradient KGStaticElectromagnetField::MagneticGradientCore( const KPosition& aSamplePoint) const { - KPosition internal = fConverter->GlobalToInternalPosition(KEM2KThreeVector(aSamplePoint)); + KPosition internal = fConverter->GlobalToInternalPosition(aSamplePoint); KGradient internalGradient = KStaticElectromagnetField::MagneticGradientCore(internal); - return K2KEMThreeMatrix(fConverter->InternalTensorToGlobal(internalGradient)); + return fConverter->InternalTensorToGlobal(internalGradient); } -void KStaticElectromagnetFieldWithKGeoBag::ConfigureSurfaceContainer() { +void KGStaticElectromagnetField::ConfigureSurfaceContainer() { KElectromagnetContainer* container = new KElectromagnetContainer(); diff --git a/KEMField/Source/LinearAlgebra/Preconditioners/include/KMatrixPreconditioner.hh b/KEMField/Source/LinearAlgebra/Preconditioners/include/KMatrixPreconditioner.hh index 4fdfcd0cb..ff403c94a 100644 --- a/KEMField/Source/LinearAlgebra/Preconditioners/include/KMatrixPreconditioner.hh +++ b/KEMField/Source/LinearAlgebra/Preconditioners/include/KMatrixPreconditioner.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_LINEARALGEBRA_PRECONDITIONERS_INCLUDE_KMATRIXPRECONDITIONER_HH_ -#define KEMFIELD_SOURCE_2_0_LINEARALGEBRA_PRECONDITIONERS_INCLUDE_KMATRIXPRECONDITIONER_HH_ +#ifndef KMATRIXPRECONDITIONER_HH_ +#define KMATRIXPRECONDITIONER_HH_ #include "KPreconditioner.hh" #include "KSmartPointer.hh" @@ -59,4 +59,4 @@ KMatrixPreconditioner::KMatrixPreconditioner( } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_LINEARALGEBRA_PRECONDITIONERS_INCLUDE_KMATRIXPRECONDITIONER_HH_ */ +#endif /* KMATRIXPRECONDITIONER_HH_ */ diff --git a/KEMField/Source/LinearAlgebra/Solvers/CMakeLists.txt b/KEMField/Source/LinearAlgebra/Solvers/CMakeLists.txt index 72a2b21b3..565abf51e 100644 --- a/KEMField/Source/LinearAlgebra/Solvers/CMakeLists.txt +++ b/KEMField/Source/LinearAlgebra/Solvers/CMakeLists.txt @@ -29,14 +29,14 @@ set (LINEARALGEBRASOLVERS_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KSVDSolver.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KProjectionSolver.hh ) - if (@PROJECT_NAME@_USE_MPI) + if (${PROJECT_NAME}_USE_MPI) list (APPEND LINEARALGEBRASOLVERS_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KGaussSeidel_MPI.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KRobinHood_MPI.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KGeneralizedMinimalResidual_MPI.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KPreconditionedGeneralizedMinimalResidual_MPI.hh ) - endif (@PROJECT_NAME@_USE_MPI) + endif (${PROJECT_NAME}_USE_MPI) set( LINEARALGEBRASOLVERS_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KKrylovSolverConfiguration.cc diff --git a/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverConfiguration.hh b/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverConfiguration.hh index 32a6148b9..318c27b78 100644 --- a/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverConfiguration.hh +++ b/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverConfiguration.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERCONFIGURATION_HH_ -#define KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERCONFIGURATION_HH_ +#ifndef KKRYLOVSOLVERCONFIGURATION_HH_ +#define KKRYLOVSOLVERCONFIGURATION_HH_ #include @@ -135,4 +135,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERCONFIGURATION_HH_ */ +#endif /* KKRYLOVSOLVERCONFIGURATION_HH_ */ diff --git a/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverFactory.hh b/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverFactory.hh index 12edb2d78..80029a280 100644 --- a/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverFactory.hh +++ b/KEMField/Source/LinearAlgebra/Solvers/include/KKrylovSolverFactory.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERFACTORY_HH_ -#define KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERFACTORY_HH_ +#ifndef KKRYLOVSOLVERFACTORY_HH_ +#define KKRYLOVSOLVERFACTORY_HH_ #include "KIterativeSolverTimer.hh" #include "KEMSimpleException.hh" @@ -216,4 +216,4 @@ void KKrylovSolverFactory::SetMatrix() { -#endif /* KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KKRYLOVSOLVERFACTORY_HH_ */ +#endif /* KKRYLOVSOLVERFACTORY_HH_ */ diff --git a/KEMField/Source/LinearAlgebra/Solvers/include/KSimpleIterativeKrylovSolver.hh b/KEMField/Source/LinearAlgebra/Solvers/include/KSimpleIterativeKrylovSolver.hh index bde1a502e..7a5febee2 100644 --- a/KEMField/Source/LinearAlgebra/Solvers/include/KSimpleIterativeKrylovSolver.hh +++ b/KEMField/Source/LinearAlgebra/Solvers/include/KSimpleIterativeKrylovSolver.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KSIMPLEITERATIVEKRYLOVSOLVER_HH_ -#define KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KSIMPLEITERATIVEKRYLOVSOLVER_HH_ +#ifndef KSIMPLEITERATIVEKRYLOVSOLVER_HH_ +#define KSIMPLEITERATIVEKRYLOVSOLVER_HH_ #include "KIterativeKrylovSolver.hh" @@ -164,4 +164,4 @@ void KSimpleIterativeKrylovSolver::Solve(const Matrix& -#endif /* KEMFIELD_SOURCE_2_0_LINEARALGEBRA_SOLVERS_INCLUDE_KSIMPLEITERATIVEKRYLOVSOLVER_HH_ */ +#endif /* KSIMPLEITERATIVEKRYLOVSOLVER_HH_ */ diff --git a/KEMField/Source/LinearAlgebra/Visitors/include/KIterativeSolverTimer.hh b/KEMField/Source/LinearAlgebra/Visitors/include/KIterativeSolverTimer.hh index b5afeea44..ab94812d1 100644 --- a/KEMField/Source/LinearAlgebra/Visitors/include/KIterativeSolverTimer.hh +++ b/KEMField/Source/LinearAlgebra/Visitors/include/KIterativeSolverTimer.hh @@ -1,12 +1,12 @@ /* - * KTimer.hh + * KIterativeSolverTimer.hh * * Created on: 17 Aug 2015 * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_LINEARALGEBRA_VISITORS_INCLUDE_KITERATIVESOLVERTIMER_HH_ -#define KEMFIELD_SOURCE_2_0_LINEARALGEBRA_VISITORS_INCLUDE_KITERATIVESOLVERTIMER_HH_ +#ifndef KITERATIVESOLVERTIMER_HH_ +#define KITERATIVESOLVERTIMER_HH_ #include "KIterativeSolver.hh" #include "KFMMessaging.hh" @@ -50,4 +50,4 @@ void KIterativeSolverTimer::Finalize(KIterativeSolver&) } -#endif /* KEMFIELD_SOURCE_2_0_LINEARALGEBRA_VISITORS_INCLUDE_KITERATIVESOLVERTIMER_HH_ */ +#endif /* KITERATIVESOLVERTIMER_HH_ */ diff --git a/KEMField/Source/Math/Array/include/KFMArrayOperator.hh b/KEMField/Source/Math/Array/include/KFMArrayOperator.hh index 2cba3d7e9..ddf6f969c 100644 --- a/KEMField/Source/Math/Array/include/KFMArrayOperator.hh +++ b/KEMField/Source/Math/Array/include/KFMArrayOperator.hh @@ -76,9 +76,7 @@ class KFMArrayOperator static void ZeroArray(KFMArrayWrapper* arr) { - T* ptr = arr->GetData(); - unsigned int n_bytes = (arr->GetArraySize() )*( sizeof(T) ); - std::memset(ptr, 0, n_bytes); + ResetArray(arr, static_cast(0)); } diff --git a/KEMField/Source/Math/CMakeLists.txt b/KEMField/Source/Math/CMakeLists.txt index 05fd68a0f..66f47ea12 100644 --- a/KEMField/Source/Math/CMakeLists.txt +++ b/KEMField/Source/Math/CMakeLists.txt @@ -1,11 +1,7 @@ # CMakeLists for KEMField/Math # Author: T.J. Corona -if (NOT BUILD_COMMON) - set (Kommon_LIBRARIES "") -endif (NOT BUILD_COMMON) - -if (@PROJECT_NAME@_USE_GSL) +if (${PROJECT_NAME}_USE_GSL) kasper_external_include_directories (${GSL_INCLUDE_DIRS}) add_cflag(KEMFIELD_USE_GSL) endif () @@ -16,9 +12,9 @@ set (MATH_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KEllipticIntegrals.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMCoordinateSystem.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMTransformation.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMThreeVector.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KThreeVector_KEMField.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMStreamableThreeVector.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMThreeMatrix.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KThreeMatrix_KEMField.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KGaussianQuadrature.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KGaussLegendreQuadrature.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KShanksTransformation.hh @@ -27,8 +23,6 @@ set (MATH_HEADERFILES set (MATH_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KEllipticIntegrals.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/KEMCoordinateSystem.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KEMThreeVector.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KEMThreeMatrix.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/KGaussianQuadrature.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/KGaussLegendreQuadrature.cc ) @@ -36,7 +30,7 @@ set (MATH_SOURCEFILES ################################################## add_library (KEMMath SHARED ${MATH_SOURCEFILES}) -target_link_libraries (KEMMath KEMCore ${Kommon_LIBRARIES} ${GSL_LIBRARIES}) +target_link_libraries (KEMMath KEMCore ${Kommon_LIBRARIES} ${KGeoBag_LIBRARIES} ${GSL_LIBRARIES}) kasper_install_headers (${MATH_HEADERFILES}) kasper_install_libraries (KEMMath) diff --git a/KEMField/Source/Math/VectorMath/CMakeLists.txt b/KEMField/Source/Math/VectorMath/CMakeLists.txt index 7be4e8b85..795cf7b89 100644 --- a/KEMField/Source/Math/VectorMath/CMakeLists.txt +++ b/KEMField/Source/Math/VectorMath/CMakeLists.txt @@ -41,7 +41,7 @@ set (VECTORMATH_SOURCEFILES ################################################## add_library (KVectorMath SHARED ${VECTORMATH_SOURCEFILES}) -target_link_libraries (KVectorMath KEMMath KFMMathUtilities) +target_link_libraries (KVectorMath KEMMath KFMMathUtilities ${Kommon_LIBRARIES} ${KGeoBag_LIBRARIES}) kasper_install_headers (${VECTORMATH_HEADERFILES}) kasper_install_libraries (KVectorMath) diff --git a/KEMField/Source/Math/VectorMath/include/KVMSpaceLineSegment.hh b/KEMField/Source/Math/VectorMath/include/KVMSpaceLineSegment.hh index 670fd53b9..a984990d0 100644 --- a/KEMField/Source/Math/VectorMath/include/KVMSpaceLineSegment.hh +++ b/KEMField/Source/Math/VectorMath/include/KVMSpaceLineSegment.hh @@ -4,7 +4,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "../../include/KThreeVector_KEMField.hh" namespace KEMField{ @@ -48,9 +48,9 @@ class KVMSpaceLineSegment void SetPoint1(const double* point); //start point void SetPoint2(const double* point); //end point - KEMThreeVector fP1; //start point - KEMThreeVector fP2; //end point - KEMThreeVector fN; //unit vector + KThreeVector fP1; //start point + KThreeVector fP2; //end point + KThreeVector fN; //unit vector double fL; //length }; diff --git a/KEMField/Source/Math/VectorMath/include/KVMSpaceRectangle.hh b/KEMField/Source/Math/VectorMath/include/KVMSpaceRectangle.hh index 479233d15..e7c1c1138 100644 --- a/KEMField/Source/Math/VectorMath/include/KVMSpaceRectangle.hh +++ b/KEMField/Source/Math/VectorMath/include/KVMSpaceRectangle.hh @@ -5,7 +5,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "../../include/KThreeVector_KEMField.hh" @@ -59,9 +59,9 @@ class KVMSpaceRectangle void SetLengthSide2(double len){fL2 = len;}; //indexing is: [0] = x, [1] = y, [2] = z - KEMThreeVector fP; //corner point - KEMThreeVector fN1; //1st basis vector - KEMThreeVector fN2; //2nd basis vector + KThreeVector fP; //corner point + KThreeVector fN1; //1st basis vector + KThreeVector fN2; //2nd basis vector double fL1; //length of side along N1 double fL2; //length of side along N2 diff --git a/KEMField/Source/Math/VectorMath/include/KVMSpaceTriangle.hh b/KEMField/Source/Math/VectorMath/include/KVMSpaceTriangle.hh index da48666db..651e732bf 100644 --- a/KEMField/Source/Math/VectorMath/include/KVMSpaceTriangle.hh +++ b/KEMField/Source/Math/VectorMath/include/KVMSpaceTriangle.hh @@ -5,7 +5,7 @@ #include #include -#include "KEMThreeVector.hh" +#include "../../include/KThreeVector_KEMField.hh" namespace KEMField{ @@ -59,10 +59,10 @@ class KVMSpaceTriangle //descriptor variables //indexing is: [0] = x, [1] = y, [2] = z - KEMThreeVector fP; //corner point - KEMThreeVector fN1; //1st basis vector - KEMThreeVector fN2; //2nd basis vector (non-orthogonal) - KEMThreeVector fN3; //normal vector + KThreeVector fP; //corner point + KThreeVector fN1; //1st basis vector + KThreeVector fN2; //2nd basis vector (non-orthogonal) + KThreeVector fN3; //normal vector double fL1; //length of side along N1 double fL2; //length of side along N2 double fSinTheta; diff --git a/KEMField/Source/Math/include/KEMCoordinateSystem.hh b/KEMField/Source/Math/include/KEMCoordinateSystem.hh index 0cdd2c522..b66ae7e73 100644 --- a/KEMField/Source/Math/include/KEMCoordinateSystem.hh +++ b/KEMField/Source/Math/include/KEMCoordinateSystem.hh @@ -1,8 +1,8 @@ #ifndef KCOORDINATESYSTEM_H #define KCOORDINATESYSTEM_H -#include "KEMThreeVector.hh" -#include "KEMThreeMatrix.hh" +#include "KThreeMatrix_KEMField.hh" +#include "KThreeVector_KEMField.hh" namespace KEMField{ @@ -36,12 +36,12 @@ namespace KEMField{ KPosition ToLocal(const KPosition& p) const; KDirection ToLocal(const KDirection& d) const; - KEMThreeVector ToLocal(const KEMThreeVector& v) const; + KThreeVector ToLocal(const KThreeVector& v) const; KGradient ToLocal(const KGradient& g) const; KPosition ToGlobal(const KPosition& p) const; KDirection ToGlobal(const KDirection& d) const; - KEMThreeVector ToGlobal(const KEMThreeVector& v) const; + KThreeVector ToGlobal(const KThreeVector& v) const; KGradient ToGlobal(const KGradient& g) const; void SetOrigin(const KPosition& origin) { fOrigin = origin; } diff --git a/KEMField/Source/Math/include/KEMStreamableThreeVector.hh b/KEMField/Source/Math/include/KEMStreamableThreeVector.hh index 7694ef78d..438f9a9ce 100644 --- a/KEMField/Source/Math/include/KEMStreamableThreeVector.hh +++ b/KEMField/Source/Math/include/KEMStreamableThreeVector.hh @@ -8,9 +8,8 @@ #ifndef KEMSTREAMABLETHREEVECTOR_HH_ #define KEMSTREAMABLETHREEVECTOR_HH_ -#include "KEMThreeVector.hh" - #include +#include "KThreeVector_KEMField.hh" namespace KEMField { class KEMStreamableThreeVector { @@ -20,13 +19,13 @@ public: fData[1] = 0; fData[2] = 0; } - explicit KEMStreamableThreeVector(const KEMThreeVector& vec) { + explicit KEMStreamableThreeVector(const KThreeVector& vec) { fData[0] = vec.X(); fData[1] = vec.Y(); fData[2] = vec.Z(); } - KEMThreeVector GetThreeVector() { + KThreeVector GetThreeVector() { return fData; } @@ -46,7 +45,7 @@ public: } private: - KEMThreeVector fData; + KThreeVector fData; }; diff --git a/KEMField/Source/Math/include/KEMThreeVector.hh b/KEMField/Source/Math/include/KEMThreeVector.hh deleted file mode 100644 index 194c94d5f..000000000 --- a/KEMField/Source/Math/include/KEMThreeVector.hh +++ /dev/null @@ -1,466 +0,0 @@ -#ifndef KEMTHREEVECTOR_H_ -#define KEMTHREEVECTOR_H_ - -#include -#include -#include - -namespace KEMField -{ - -/** -* @class KEMThreeVector -* -* @brief A three-vector. -* -* @author D.L. Furse -*/ - - class KEMThreeVector - { - public: - static const KEMThreeVector sXUnit; - static const KEMThreeVector sYUnit; - static const KEMThreeVector sZUnit; - static const KEMThreeVector sZero; - - public: - KEMThreeVector(); - virtual ~KEMThreeVector(); - - static std::string Name() { return "KEMThreeVector"; } - - //assignment - - KEMThreeVector( const KEMThreeVector& aVector ); - KEMThreeVector& operator=( const KEMThreeVector& aVector ); - - KEMThreeVector( const double anArray[ 3 ] ); - KEMThreeVector& operator=( const double anArray[ 3 ] ); - - KEMThreeVector( const double& aX, const double& aY, const double& aZ ); - void SetComponents( const double& aX, const double& aY, const double& aZ ); - void SetComponents( const double* aData ); - void SetMagnitude( const double& aMagnitude ); - void SetX( const double& aX ); - void SetY( const double& aY ); - void SetZ( const double& aZ ); - - //cast - - operator double*(); - operator const double*() const; - - //access - - double& operator[]( int anIndex ); - const double& operator[]( int anIndex ) const; - - double& X(); - const double& X() const; - double& Y(); - const double& Y() const; - double& Z(); - const double& Z() const; - - const double* Components() const; - - //comparison - - bool operator==( const KEMThreeVector& aVector ) const; - bool operator!=( const KEMThreeVector& aVector ) const; - - //properties - - double Dot( const KEMThreeVector& aVector ) const; - double Magnitude() const; - double MagnitudeSquared() const; - double Perp() const; - double PerpSquared() const; - double PolarAngle() const; - double AzimuthalAngle() const; - KEMThreeVector Unit() const; - KEMThreeVector Orthogonal() const; - KEMThreeVector Cross( const KEMThreeVector& aVector ) const; - - protected: - double fData[ 3 ]; - }; - - inline KEMThreeVector::KEMThreeVector( const KEMThreeVector& aVector ) - { - fData[ 0 ] = aVector.fData[ 0 ]; - fData[ 1 ] = aVector.fData[ 1 ]; - fData[ 2 ] = aVector.fData[ 2 ]; - } - inline KEMThreeVector& KEMThreeVector::operator=( const KEMThreeVector& aVector ) - { - fData[ 0 ] = aVector.fData[ 0 ]; - fData[ 1 ] = aVector.fData[ 1 ]; - fData[ 2 ] = aVector.fData[ 2 ]; - return *this; - } - - inline KEMThreeVector::KEMThreeVector( const double anArray[ 3 ] ) - { - fData[ 0 ] = anArray[ 0 ]; - fData[ 1 ] = anArray[ 1 ]; - fData[ 2 ] = anArray[ 2 ]; - } - inline KEMThreeVector& KEMThreeVector::operator=( const double anArray[ 3 ] ) - { - fData[ 0 ] = anArray[ 0 ]; - fData[ 1 ] = anArray[ 1 ]; - fData[ 2 ] = anArray[ 2 ]; - return *this; - } - - inline KEMThreeVector::KEMThreeVector( const double& aX, const double& aY, const double& aZ ) - { - fData[ 0 ] = aX; - fData[ 1 ] = aY; - fData[ 2 ] = aZ; - } - inline void KEMThreeVector::SetComponents( const double& aX, const double& aY, const double& aZ ) - { - fData[ 0 ] = aX; - fData[ 1 ] = aY; - fData[ 2 ] = aZ; - } - inline void KEMThreeVector::SetComponents( const double* aData ) - { - fData[ 0 ] = aData[ 0 ]; - fData[ 1 ] = aData[ 1 ]; - fData[ 2 ] = aData[ 2 ]; - } - inline void KEMThreeVector::SetMagnitude( const double& aMagnitude ) - { - const double tMagnitude = Magnitude(); - const double tRatio = aMagnitude / tMagnitude; - fData[ 0 ] *= tRatio; - fData[ 1 ] *= tRatio; - fData[ 2 ] *= tRatio; - return; - } - inline void KEMThreeVector::SetX( const double& aX ) - { - fData[ 0 ] = aX; - } - inline void KEMThreeVector::SetY( const double& aY ) - { - fData[ 1 ] = aY; - } - inline void KEMThreeVector::SetZ( const double& aZ ) - { - fData[ 2 ] = aZ; - } - inline KEMThreeVector::operator double *() - { - return fData; - } - inline KEMThreeVector::operator const double *() const - { - return fData; - } - - inline double& KEMThreeVector::operator[]( int anIndex ) - { - return fData[ anIndex ]; - } - inline const double& KEMThreeVector::operator[]( int anIndex ) const - { - return fData[ anIndex ]; - } - - inline double& KEMThreeVector::X() - { - return fData[ 0 ]; - } - inline const double& KEMThreeVector::X() const - { - return fData[ 0 ]; - } - inline double& KEMThreeVector::Y() - { - return fData[ 1 ]; - } - inline const double& KEMThreeVector::Y() const - { - return fData[ 1 ]; - } - inline double& KEMThreeVector::Z() - { - return fData[ 2 ]; - } - inline const double& KEMThreeVector::Z() const - { - return fData[ 2 ]; - } - inline const double* KEMThreeVector::Components() const - { - return (const double*)fData; - } - - inline double KEMThreeVector::Dot( const KEMThreeVector& aVector ) const - { - return (fData[ 0 ] * aVector.fData[ 0 ] + fData[ 1 ] * aVector.fData[ 1 ] + fData[ 2 ] * aVector.fData[ 2 ]); - } - - inline double KEMThreeVector::Magnitude() const - { - return sqrt( fData[ 0 ] * fData[ 0 ] + fData[ 1 ] * fData[ 1 ] + fData[ 2 ] * fData[ 2 ] ); - } - inline double KEMThreeVector::MagnitudeSquared() const - { - return fData[ 0 ] * fData[ 0 ] + fData[ 1 ] * fData[ 1 ] + fData[ 2 ] * fData[ 2 ]; - } - - inline double KEMThreeVector::Perp() const - { - return sqrt( fData[ 0 ] * fData[ 0 ] + fData[ 1 ] * fData[ 1 ] ); - } - inline double KEMThreeVector::PerpSquared() const - { - return fData[ 0 ] * fData[ 0 ] + fData[ 1 ] * fData[ 1 ]; - } - - inline double KEMThreeVector::PolarAngle() const - { - return acos( fData[ 2 ] ); - } - inline double KEMThreeVector::AzimuthalAngle() const - { - double Radius = sqrt( fData[ 0 ] * fData[ 0 ] + fData[ 1 ] * fData[ 1 ] ); - if( fData[ 1 ] > 0 ) - { - return acos( fData[ 0 ] / Radius ); - } - else - { - return 2. * M_PI - acos( fData[ 0 ] / Radius ); - } - } - - inline KEMThreeVector KEMThreeVector::Unit() const - { - const double tMagnitude = Magnitude(); - return tMagnitude >0.0 ? KEMThreeVector( fData[ 0 ] / tMagnitude, fData[ 1 ] / tMagnitude, fData[ 2 ] / tMagnitude ) : KEMThreeVector( fData[ 0 ], fData[ 1 ], fData[ 2 ] ); - } - inline KEMThreeVector KEMThreeVector::Orthogonal() const - { - const double tX = fData[ 0 ] < 0.0 ? -fData[ 0 ] : fData[ 0 ]; - const double tY = fData[ 1 ] < 0.0 ? -fData[ 1 ] : fData[ 1 ]; - const double tZ = fData[ 2 ] < 0.0 ? -fData[ 2 ] : fData[ 2 ]; - if( tX < tY ) - { - return tX < tZ ? KEMThreeVector( 0., fData[ 2 ], -fData[ 1 ] ) : KEMThreeVector( fData[ 1 ], -fData[ 0 ], 0. ); - } - else - { - return tY < tZ ? KEMThreeVector( -fData[ 2 ], 0., fData[ 0 ] ) : KEMThreeVector( fData[ 1 ], -fData[ 0 ], 0. ); - } - } - inline KEMThreeVector KEMThreeVector::Cross( const KEMThreeVector& aVector ) const - { - return KEMThreeVector( fData[ 1 ] * aVector.fData[ 2 ] - fData[ 2 ] * aVector.fData[ 1 ], fData[ 2 ] * aVector.fData[ 0 ] - fData[ 0 ] * aVector.fData[ 2 ], fData[ 0 ] * aVector.fData[ 1 ] - fData[ 1 ] * aVector.fData[ 0 ] ); - } - - inline bool KEMThreeVector::operator ==( const KEMThreeVector& aVector ) const - { - return (aVector.fData[ 0 ] == fData[ 0 ] && aVector.fData[ 1 ] == fData[ 1 ] && aVector.fData[ 2 ] == fData[ 2 ]) ? true : false; - } - inline bool KEMThreeVector::operator !=( const KEMThreeVector& aVector ) const - { - return (aVector.fData[ 0 ] != fData[ 0 ] || aVector.fData[ 1 ] != fData[ 1 ] || aVector.fData[ 2 ] != fData[ 2 ]) ? true : false; - } - - inline KEMThreeVector operator+( const KEMThreeVector& aLeft, const KEMThreeVector& aRight ) - { - KEMThreeVector aResult( aLeft ); - aResult[ 0 ] += aRight[ 0 ]; - aResult[ 1 ] += aRight[ 1 ]; - aResult[ 2 ] += aRight[ 2 ]; - return aResult; - } - inline KEMThreeVector& operator+=( KEMThreeVector& aLeft, const KEMThreeVector& aRight ) - { - aLeft[ 0 ] += aRight[ 0 ]; - aLeft[ 1 ] += aRight[ 1 ]; - aLeft[ 2 ] += aRight[ 2 ]; - return aLeft; - } - - inline KEMThreeVector operator-( const KEMThreeVector& aLeft, const KEMThreeVector& aRight ) - { - KEMThreeVector aResult( aLeft ); - aResult[ 0 ] -= aRight[ 0 ]; - aResult[ 1 ] -= aRight[ 1 ]; - aResult[ 2 ] -= aRight[ 2 ]; - return aResult; - } - inline KEMThreeVector& operator-=( KEMThreeVector& aLeft, const KEMThreeVector& aRight ) - { - aLeft[ 0 ] -= aRight[ 0 ]; - aLeft[ 1 ] -= aRight[ 1 ]; - aLeft[ 2 ] -= aRight[ 2 ]; - return aLeft; - } - - inline double operator*( const KEMThreeVector& aLeft, const KEMThreeVector& aRight ) - { - return aLeft[ 0 ] * aRight[ 0 ] + aLeft[ 1 ] * aRight[ 1 ] + aLeft[ 2 ] * aRight[ 2 ]; - } - - inline KEMThreeVector operator*( double aScalar, const KEMThreeVector& aVector ) - { - KEMThreeVector aResult( aVector ); - aResult[ 0 ] *= aScalar; - aResult[ 1 ] *= aScalar; - aResult[ 2 ] *= aScalar; - return aResult; - } - inline KEMThreeVector operator*( const KEMThreeVector& aVector, double aScalar ) - { - KEMThreeVector aResult( aVector ); - aResult[ 0 ] *= aScalar; - aResult[ 1 ] *= aScalar; - aResult[ 2 ] *= aScalar; - return aResult; - } - inline KEMThreeVector& operator*=( KEMThreeVector& aVector, double aScalar ) - { - aVector[ 0 ] *= aScalar; - aVector[ 1 ] *= aScalar; - aVector[ 2 ] *= aScalar; - return aVector; - } - inline KEMThreeVector operator/( const KEMThreeVector& aVector, double aScalar ) - { - KEMThreeVector aResult( aVector ); - aResult[ 0 ] /= aScalar; - aResult[ 1 ] /= aScalar; - aResult[ 2 ] /= aScalar; - return aResult; - } - inline KEMThreeVector& operator/=( KEMThreeVector& aVector, double aScalar ) - { - aVector[ 0 ] /= aScalar; - aVector[ 1 ] /= aScalar; - aVector[ 2 ] /= aScalar; - return aVector; - } - - template - Stream& operator>>(Stream& s,KEMThreeVector& aThreeVector) - { - s.PreStreamInAction(aThreeVector); - s >> aThreeVector[ 0 ] >> aThreeVector[ 1 ] >> aThreeVector[ 2 ]; - s.PostStreamInAction(aThreeVector); - return s; - } - - template - Stream& operator<<(Stream& s,const KEMThreeVector& aThreeVector) - { - s.PreStreamOutAction(aThreeVector); - s << aThreeVector[ 0 ] << aThreeVector[ 1 ] << aThreeVector[ 2 ]; - s.PostStreamOutAction(aThreeVector); - return s; - } - - template - class KEMThreeVector_ : public KEMThreeVector - { - public: - KEMThreeVector_() : KEMThreeVector() {} - KEMThreeVector_( const KEMThreeVector& aVector ) : KEMThreeVector(aVector) {} - KEMThreeVector_( const double anArray[ 3 ] ) : KEMThreeVector(anArray) {} - KEMThreeVector_( const double& aX, const double& aY, const double& aZ ) : KEMThreeVector(aX,aY,aZ) {} - static std::string Name(); - - void ReflectThroughPlane( const KEMThreeVector& planePosition, const KEMThreeVector& planeNormal ); - void RotateAboutAxis( const KEMThreeVector& axisPosition, const KEMThreeVector& axisDirection, double angle ); - }; - - template - void KEMThreeVector_::ReflectThroughPlane( const KEMThreeVector& planePosition, const KEMThreeVector& planeNormal ) - { - KEMThreeVector& point = *this; - double signedDistance; - if (isDisplacement) - signedDistance = (point-planePosition).Dot(planeNormal); - else - signedDistance = point.Dot(planeNormal); - point -= 2.*signedDistance*planeNormal; - } - - template - void KEMThreeVector_::RotateAboutAxis( const KEMThreeVector& axisPosition, const KEMThreeVector& axisDirection, double angle ) - { - KEMThreeVector& point = *this; - if (isDisplacement) - point -= axisPosition; - point = (point*cos(angle) + - axisDirection*axisDirection.Dot(point)*(1.-cos(angle)) - - point.Cross(axisDirection)*sin(angle)); - if (isDisplacement) - point += axisPosition; - } - - template - Stream& operator>>(Stream& s,KEMThreeVector_& aThreeVector_) - { - s.PreStreamInAction(aThreeVector_); - s >> aThreeVector_[ 0 ] >> aThreeVector_[ 1 ] >> aThreeVector_[ 2 ]; - s.PostStreamInAction(aThreeVector_); - return s; - } - - template - Stream& operator<<(Stream& s,const KEMThreeVector_& aThreeVector_) - { - s.PreStreamOutAction(aThreeVector_); - s << aThreeVector_[ 0 ] << aThreeVector_[ 1 ] << aThreeVector_[ 2 ]; - s.PostStreamOutAction(aThreeVector_); - return s; - } - -/** -* @class KPosition -* -* @brief A three-vector that transforms with a translation. -* -* @author T.J. Corona -*/ - typedef KEMThreeVector_ KPosition; - - template <> - inline std::string KPosition::Name() { return "KPosition"; } - -/** -* @class KDirection -* -* @brief A three-vector that does not transform with a translation. -* -* @author T.J. Corona -*/ - typedef KEMThreeVector_ KDirection; - - template <> - inline std::string KDirection::Name() { return "KDirection"; } - -/** -* @class KMagneticFieldVector -* -* @brief A three-vector that does not transform with a translation. -* -* @author T.J. Corona -*/ - class KMagneticFieldVector : public KEMThreeVector_ - { - public: - static std::string Name() { return "MagneticFieldVector"; } - }; -} - -#endif diff --git a/KEMField/Source/Math/include/KEMTransformation.hh b/KEMField/Source/Math/include/KEMTransformation.hh index 4787056d4..cbd7e56d1 100644 --- a/KEMField/Source/Math/include/KEMTransformation.hh +++ b/KEMField/Source/Math/include/KEMTransformation.hh @@ -1,9 +1,9 @@ #ifndef KEMTRANSFORMATION_DEF #define KEMTRANSFORMATION_DEF +#include "KThreeVector_KEMField.hh" #include "KTransitiveStreamer.hh" -#include "KEMThreeVector.hh" namespace KEMField { diff --git a/KEMField/Source/Math/include/KThreeMatrix_KEMField.hh b/KEMField/Source/Math/include/KThreeMatrix_KEMField.hh new file mode 100644 index 000000000..9bff690cf --- /dev/null +++ b/KEMField/Source/Math/include/KThreeMatrix_KEMField.hh @@ -0,0 +1,82 @@ +#ifndef KTHREEMATRIX_KEMFIELD_H_ +#define KTHREEMATRIX_KEMFIELD_H_ + +#include "KThreeMatrix.hh" +#include "KThreeVector_KEMField.hh" + +#include + +namespace KEMField +{ + typedef KGeoBag::KThreeMatrix KThreeMatrix; + + template + Stream& operator>>(Stream& s,KThreeMatrix& aThreeMatrix) + { + s.PreStreamInAction(aThreeMatrix); + s >> aThreeMatrix[ 0 ] >> aThreeMatrix[ 1 ] >> aThreeMatrix[ 2 ] + >> aThreeMatrix[ 3 ] >> aThreeMatrix[ 4 ] >> aThreeMatrix[ 5 ] + >> aThreeMatrix[ 6 ] >> aThreeMatrix[ 7 ] >> aThreeMatrix[ 8 ]; + s.PostStreamInAction(aThreeMatrix); + return s; + } + + template + Stream& operator<<(Stream& s,const KThreeMatrix& aThreeMatrix) + { + s.PreStreamOutAction(aThreeMatrix); + s << aThreeMatrix[ 0 ] << aThreeMatrix[ 1 ] << aThreeMatrix[ 2 ] + << aThreeMatrix[ 3 ] << aThreeMatrix[ 4 ] << aThreeMatrix[ 5 ] + << aThreeMatrix[ 6 ] << aThreeMatrix[ 7 ] << aThreeMatrix[ 8 ]; + s.PostStreamOutAction(aThreeMatrix); + return s; + } + +/** +* @class KGradient +* +* @brief A class describing a field gradient. +* +* @author D.L. Furse +*/ + class KGradient : public KThreeMatrix + { + public: + KGradient() : KThreeMatrix() {} + KGradient( const KThreeMatrix& aMatrix) : KThreeMatrix(aMatrix) {} + KGradient( const double& anXX, const double& anXY, const double& anXZ, const double& aYX, const double& aYY, const double& aYZ, const double& aZX, const double& aZY, const double& aZZ ) : KThreeMatrix(anXX,anXY,anXZ,aYX,aYY,aYZ,aZX,aZY,aZZ) {} + + virtual ~KGradient() {} + + static std::string Name() { return "KGradient"; } + + double& dFi_dxj(unsigned int i, unsigned int j) { return operator()(i,j); } + const double& dFi_dxj(unsigned int i, unsigned int j) const { return operator()(i,j); } + + }; + + template + Stream& operator>>(Stream& s,KGradient& aGradient) + { + s.PreStreamInAction(aGradient); + s >> aGradient[ 0 ] >> aGradient[ 1 ] >> aGradient[ 2 ] + >> aGradient[ 3 ] >> aGradient[ 4 ] >> aGradient[ 5 ] + >> aGradient[ 6 ] >> aGradient[ 7 ] >> aGradient[ 8 ]; + s.PostStreamInAction(aGradient); + return s; + } + + template + Stream& operator<<(Stream& s,const KGradient& aGradient) + { + s.PreStreamOutAction(aGradient); + s << aGradient[ 0 ] << aGradient[ 1 ] << aGradient[ 2 ] + << aGradient[ 3 ] << aGradient[ 4 ] << aGradient[ 5 ] + << aGradient[ 6 ] << aGradient[ 7 ] << aGradient[ 8 ]; + s.PostStreamOutAction(aGradient); + return s; + } + +} + +#endif /* KTHREEMATRIX_KEMFIELD_H_ */ diff --git a/KEMField/Source/Math/include/KThreeVector_KEMField.hh b/KEMField/Source/Math/include/KThreeVector_KEMField.hh new file mode 100644 index 000000000..13a8af39e --- /dev/null +++ b/KEMField/Source/Math/include/KThreeVector_KEMField.hh @@ -0,0 +1,130 @@ +#ifndef KTHREEVECTOR_KEMFIELD_H_ +#define KTHREEVECTOR_KEMFIELD_H_ + +#include +#include +#include +#include "KThreeVector.hh" + + +namespace KEMField +{ + typedef KGeoBag::KThreeVector KThreeVector; + + template + Stream& operator>>(Stream& s,KThreeVector& aThreeVector) + { + s.PreStreamInAction(aThreeVector); + s >> aThreeVector[ 0 ] >> aThreeVector[ 1 ] >> aThreeVector[ 2 ]; + s.PostStreamInAction(aThreeVector); + return s; + } + + template + Stream& operator<<(Stream& s,const KThreeVector& aThreeVector) + { + s.PreStreamOutAction(aThreeVector); + s << aThreeVector[ 0 ] << aThreeVector[ 1 ] << aThreeVector[ 2 ]; + s.PostStreamOutAction(aThreeVector); + return s; + } + + template + class KThreeVector_ : public KThreeVector + { + public: + KThreeVector_() : KThreeVector() {} + KThreeVector_( const KThreeVector& aVector ) : KThreeVector(aVector) {} + KThreeVector_( const double anArray[ 3 ] ) : KThreeVector(anArray) {} + KThreeVector_( const double& aX, const double& aY, const double& aZ ) : KThreeVector(aX,aY,aZ) {} + + virtual ~KThreeVector_() {}; + + static std::string Name(); + + void ReflectThroughPlane( const KThreeVector& planePosition, const KThreeVector& planeNormal ); + void RotateAboutAxis( const KThreeVector& axisPosition, const KThreeVector& axisDirection, double angle ); + }; + + template + void KThreeVector_::ReflectThroughPlane( const KThreeVector& planePosition, const KThreeVector& planeNormal ) + { + KThreeVector& point = *this; + double signedDistance; + if (isDisplacement) + signedDistance = (point-planePosition).Dot(planeNormal); + else + signedDistance = point.Dot(planeNormal); + point -= 2.*signedDistance*planeNormal; + } + + template + void KThreeVector_::RotateAboutAxis( const KThreeVector& axisPosition, const KThreeVector& axisDirection, double angle ) + { + KThreeVector& point = *this; + if (isDisplacement) + point -= axisPosition; + point = (point*cos(angle) + + axisDirection*axisDirection.Dot(point)*(1.-cos(angle)) - + point.Cross(axisDirection)*sin(angle)); + if (isDisplacement) + point += axisPosition; + } + + template + Stream& operator>>(Stream& s,KThreeVector_& aThreeVector_) + { + s.PreStreamInAction(aThreeVector_); + s >> aThreeVector_[ 0 ] >> aThreeVector_[ 1 ] >> aThreeVector_[ 2 ]; + s.PostStreamInAction(aThreeVector_); + return s; + } + + template + Stream& operator<<(Stream& s,const KThreeVector_& aThreeVector_) + { + s.PreStreamOutAction(aThreeVector_); + s << aThreeVector_[ 0 ] << aThreeVector_[ 1 ] << aThreeVector_[ 2 ]; + s.PostStreamOutAction(aThreeVector_); + return s; + } + +/** +* @class KPosition +* +* @brief A three-vector that transforms with a translation. +* +* @author T.J. Corona +*/ + typedef KThreeVector_ KPosition; + + template <> + inline std::string KPosition::Name() { return "KPosition"; } + +/** +* @class KDirection +* +* @brief A three-vector that does not transform with a translation. +* +* @author T.J. Corona +*/ + typedef KThreeVector_ KDirection; + + template <> + inline std::string KDirection::Name() { return "KDirection"; } + +/** +* @class KMagneticFieldVector +* +* @brief A three-vector that does not transform with a translation. +* +* @author T.J. Corona +*/ + class KMagneticFieldVector : public KThreeVector_ + { + public: + static std::string Name() { return "MagneticFieldVector"; } + }; +} + +#endif /* KTHREEVECTOR_KEMFIELD_H_ */ diff --git a/KEMField/Source/Math/src/KEMCoordinateSystem.cc b/KEMField/Source/Math/src/KEMCoordinateSystem.cc index a1c6a0301..a57c7f662 100644 --- a/KEMField/Source/Math/src/KEMCoordinateSystem.cc +++ b/KEMField/Source/Math/src/KEMCoordinateSystem.cc @@ -26,14 +26,14 @@ namespace KEMField return KDirection(fXAxis.Dot(d),fYAxis.Dot(d),fZAxis.Dot(d)); } - KEMThreeVector KEMCoordinateSystem::ToLocal(const KEMThreeVector& v) const + KThreeVector KEMCoordinateSystem::ToLocal(const KThreeVector& v) const { - return KEMThreeVector(fXAxis.Dot(v),fYAxis.Dot(v),fZAxis.Dot(v)); + return KThreeVector(fXAxis.Dot(v),fYAxis.Dot(v),fZAxis.Dot(v)); } KGradient KEMCoordinateSystem::ToLocal(const KGradient& g) const { - KEMThreeMatrix transform(fXAxis[0],fXAxis[1],fXAxis[2], + KThreeMatrix transform(fXAxis[0],fXAxis[1],fXAxis[2], fYAxis[0],fYAxis[1],fYAxis[2], fZAxis[0],fZAxis[1],fZAxis[2]); @@ -58,16 +58,16 @@ namespace KEMField fXAxis[2]*p[0] + fYAxis[2]*p[1] + fZAxis[2]*p[2]); } - KEMThreeVector KEMCoordinateSystem::ToGlobal(const KEMThreeVector& v) const + KThreeVector KEMCoordinateSystem::ToGlobal(const KThreeVector& v) const { - return KEMThreeVector(fXAxis[0]*v[0] + fYAxis[0]*v[1] + fZAxis[0]*v[2], + return KThreeVector(fXAxis[0]*v[0] + fYAxis[0]*v[1] + fZAxis[0]*v[2], fXAxis[1]*v[0] + fYAxis[1]*v[1] + fZAxis[1]*v[2], fXAxis[2]*v[0] + fYAxis[2]*v[1] + fZAxis[2]*v[2]); } KGradient KEMCoordinateSystem::ToGlobal(const KGradient& g) const { - KEMThreeMatrix transform(fXAxis[0],fYAxis[0],fZAxis[0], + KThreeMatrix transform(fXAxis[0],fYAxis[0],fZAxis[0], fXAxis[1],fYAxis[1],fZAxis[1], fXAxis[2],fYAxis[2],fZAxis[2]); diff --git a/KEMField/Source/Math/src/KEMThreeMatrix.cc b/KEMField/Source/Math/src/KEMThreeMatrix.cc deleted file mode 100644 index 4fa20e1d9..000000000 --- a/KEMField/Source/Math/src/KEMThreeMatrix.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include "KEMThreeMatrix.hh" - -namespace KEMField -{ - - KEMThreeMatrix::KEMThreeMatrix() - { - fData[0] = 0.; - fData[1] = 0.; - fData[2] = 0.; - - fData[3] = 0.; - fData[4] = 0.; - fData[5] = 0.; - - fData[6] = 0.; - fData[7] = 0.; - fData[8] = 0.; - } - KEMThreeMatrix::~KEMThreeMatrix() - { - } - - const KEMThreeMatrix KEMThreeMatrix::sZero = KEMThreeMatrix(0. , 0. , 0. , - 0. , 0. , 0. , - 0. , 0. , 0. ); -} diff --git a/KEMField/Source/Math/src/KEMThreeVector.cc b/KEMField/Source/Math/src/KEMThreeVector.cc deleted file mode 100644 index 8183fb10a..000000000 --- a/KEMField/Source/Math/src/KEMThreeVector.cc +++ /dev/null @@ -1,21 +0,0 @@ -#include "KEMThreeVector.hh" - -namespace KEMField -{ - - const KEMThreeVector KEMThreeVector::sXUnit( 1., 0., 0. ); - const KEMThreeVector KEMThreeVector::sYUnit( 0., 1., 0. ); - const KEMThreeVector KEMThreeVector::sZUnit( 0., 0., 1. ); - const KEMThreeVector KEMThreeVector::sZero(0., 0., 0. ); - - KEMThreeVector::KEMThreeVector() - { - fData[0] = 0.; - fData[1] = 0.; - fData[2] = 0.; - } - KEMThreeVector::~KEMThreeVector() - { - } - -} diff --git a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh b/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh deleted file mode 100644 index fea15d88b..000000000 --- a/KEMField/Source/Plugins/Bindings/FieldSolvers/Magnetic/include/KIntegratingMagnetostaticFieldSolverBuilder.hh +++ /dev/null @@ -1,20 +0,0 @@ -/* - * KIntegratingMagnetostaticFieldSolverBuilder.hh - * - * Created on: 28 Mar 2016 - * Author: wolfgang - */ - -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ - -#include "KComplexElement.hh" -#include "KIntegratingMagnetostaticFieldSolver.hh" -namespace katrin { - -typedef KComplexElement< KEMField::KIntegratingMagnetostaticFieldSolver > -KIntegratingMagnetostaticFieldSolverBuilder; - -} /* namespace katrin */ - -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_BINDINGS_FIELDSOLVERS_MAGNETIC_INCLUDE_KINTEGRATINGMAGNETOSTATICFIELDSOLVERBUILDER_HH_ */ diff --git a/KEMField/Source/Plugins/KGeoBag/CMakeLists.txt b/KEMField/Source/Plugins/KGeoBag/CMakeLists.txt deleted file mode 100644 index 1c3401820..000000000 --- a/KEMField/Source/Plugins/KGeoBag/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# CMakeLists for KEMField/Plugins/KGeoBag -# T.J. Corona - -cmake_dependent_option (@PROJECT_NAME@_USE_KGEOBAG "Use KGeoBag" ON - "BUILD_KGEOBAG" OFF) -if (NOT BUILD_KGEOBAG) - set (@PROJECT_NAME@_USE_KGEOBAG OFF) - set (@PROJECT_NAME@_USE_KGEOBAG ${@PROJECT_NAME@_USE_KGEOBAG} PARENT_SCOPE) -endif(NOT BUILD_KGEOBAG) - -if (@PROJECT_NAME@_USE_KGEOBAG) - kasper_find_module(Kommon) - kasper_find_module(KGeoBag) - add_cflag (KEMFIELD_USE_KGEOBAG) - - kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - - set (KGEOBAGPLUGIN_HEADERFILES - ${CMAKE_CURRENT_SOURCE_DIR}/include/KElectrostaticBoundaryFieldWithKGeoBag.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMVectorConverters.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGBEM.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGBEMBuilder.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGBEMConverter.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectromagnet.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectromagnetBuilder.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KGElectromagnetConverter.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KStaticElectromagnetFieldWithKGeoBag.hh - ) - - set (KGEOBAGPLUGIN_SOURCEFILES - ${CMAKE_CURRENT_SOURCE_DIR}/src/KElectrostaticBoundaryFieldWithKGeoBag.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGBEM.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGBEMBuilder.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGBEMConverter.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectromagnet.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectromagnetBuilder.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KGElectromagnetConverter.cc - ${CMAKE_CURRENT_SOURCE_DIR}/src/KStaticElectromagnetFieldWithKGeoBag.cc - ) - - add_library (KEMGeoBagPlugin SHARED ${KGEOBAGPLUGIN_SOURCEFILES}) - target_link_libraries (KEMGeoBagPlugin - KEMSurfaces - KEMFieldsElectric - KEMFieldsMagnetic - KEMElectromagnets - ${GSL_LIBRARIES} - ${OPENCL_LIBRARIES} - ${KGeoBag_LIBRARIES} - ) - - kasper_install_headers (${KGEOBAGPLUGIN_HEADERFILES}) - kasper_install_libraries (KEMGeoBagPlugin) - -endif (@PROJECT_NAME@_USE_KGEOBAG) diff --git a/KEMField/Source/Plugins/KGeoBag/include/KEMVectorConverters.hh b/KEMField/Source/Plugins/KGeoBag/include/KEMVectorConverters.hh deleted file mode 100644 index c37453120..000000000 --- a/KEMField/Source/Plugins/KGeoBag/include/KEMVectorConverters.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - * KEMFieldConverters.hh - * - * Created on: 20.05.2015 - * Author: gosda - * Conversion functions between KGeoBag::KThreeVector and KEMField::KEMThreeVector - */ - -#ifndef KEMVECTORCONVERTERS_HH_ -#define KEMVECTORCONVERTERS_HH_ - -#include "KEMThreeVector.hh" -#include "KThreeVector.hh" -#include "KEMThreeMatrix.hh" -#include "KThreeMatrix.hh" - -namespace KEMField { - -inline KGeoBag::KThreeVector KEM2KThreeVector(const KEMField::KEMThreeVector& vec) -{ - return KGeoBag::KThreeVector(vec.X(),vec.Y(),vec.Z()); -} - -inline KEMField::KEMThreeVector K2KEMThreeVector(const KGeoBag::KThreeVector& vec) -{ - return KEMField::KEMThreeVector(vec.X(),vec.Y(),vec.Z()); -} - -inline KGeoBag::KThreeMatrix KEM2KThreeMatrix(const KEMField::KEMThreeMatrix& matrix) -{ - return KGeoBag::KThreeMatrix(matrix[0],matrix[1],matrix[2], - matrix[3],matrix[4],matrix[5], - matrix[6],matrix[7],matrix[8]); -} - -inline KEMField::KEMThreeMatrix K2KEMThreeMatrix(const KGeoBag::KThreeMatrix& matrix) -{ - return KEMField::KEMThreeMatrix(matrix[0],matrix[1],matrix[2], - matrix[3],matrix[4],matrix[5], - matrix[6],matrix[7],matrix[8]); -} - -}// KEMField - -#endif /* KEMFIELDCONVERTERS_H_ */ diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/cl/kEMField_ElectrostaticBoundaryIntegrals.cl b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/cl/kEMField_ElectrostaticBoundaryIntegrals.cl index 18c4e2743..40c5970bf 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/cl/kEMField_ElectrostaticBoundaryIntegrals.cl +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/cl/kEMField_ElectrostaticBoundaryIntegrals.cl @@ -137,19 +137,22 @@ CL_TYPE BI_BoundaryIntegral(int iBoundary, #ifdef NEUMANNBOUNDARY else // NEUMANN { - eField = EBI_EField(P_target,shapeType_source,data_source); - BI_Centroid(&P_source[0],shapeType_source,data_source); - BI_Normal(&N_target[0],shapeType_target,data_target); - - val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; - dist2 = ((P_target[0]-P_source[0])*(P_target[0]-P_source[0]) + - (P_target[1]-P_source[1])*(P_target[1]-P_source[1]) + - (P_target[2]-P_source[2])*(P_target[2]-P_source[2])); - if (dist2<1.e-24) - { - val = val*((1. + boundaryData[iBoundary*BOUNDARYSIZE])/ - (1. - boundaryData[iBoundary*BOUNDARYSIZE])); - } + BI_Centroid(&P_source[0],shapeType_source,data_source); + BI_Normal(&N_target[0],shapeType_target,data_target); + dist2 = ((P_target[0]-P_source[0])*(P_target[0]-P_source[0]) + + (P_target[1]-P_source[1])*(P_target[1]-P_source[1]) + + (P_target[2]-P_source[2])*(P_target[2]-P_source[2])); + + if( dist2 >= 1.e-24) { + eField = EBI_EField(P_target,shapeType_source,data_source); + val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axially symmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + val = ((1. + boundaryData[iBoundary*BOUNDARYSIZE])/(1. - boundaryData[iBoundary*BOUNDARYSIZE]))/(2.*M_EPS0); + } } #endif return val; diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegrator.hh b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegrator.hh index ee77f9e2c..7f7dbbf89 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegrator.hh +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegrator.hh @@ -56,9 +56,9 @@ namespace KEMField template double Potential(const SourceShape*, const KPosition&) const; template - KEMThreeVector ElectricField(const SourceShape*, const KPosition&) const; + KThreeVector ElectricField(const SourceShape*, const KPosition&) const; template - std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; + std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; std::string OpenCLFile() const { return fConfig.fOpenCLSourceFile; } @@ -168,7 +168,7 @@ namespace KEMField } template - KEMThreeVector KOpenCLElectrostaticBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const + KThreeVector KOpenCLElectrostaticBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -199,11 +199,11 @@ namespace KEMField sizeof(CL_TYPE4), &eField); - return KEMThreeVector(eField.s[0],eField.s[1],eField.s[2]); + return KThreeVector(eField.s[0],eField.s[1],eField.s[2]); } template - std::pair KOpenCLElectrostaticBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const + std::pair KOpenCLElectrostaticBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -234,7 +234,7 @@ namespace KEMField sizeof(CL_TYPE4), &eFieldAndPhi); - return std::make_pair( KEMThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); + return std::make_pair( KThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); } template @@ -246,13 +246,18 @@ namespace KEMField } else { - KEMThreeVector field = this->ElectricField(&source, - fTarget->GetShape()->Centroid()); - fValue = field.Dot(fTarget->GetShape()->Normal()); - double dist = (source.Centroid() - - fTarget->GetShape()->Centroid()).Magnitude(); - if (dist<1.e-12) - fValue *= fBoundaryVisitor.Prefactor(); + double dist = (source.Centroid() - fTarget->GetShape()->Centroid()).Magnitude(); + + if( dist>=1.e-12 ) { + KThreeVector field = this->ElectricField(&source,fTarget->GetShape()->Centroid()); + fValue = field.Dot(fTarget->GetShape()->Normal()); + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axialsymmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + fValue = fBoundaryVisitor.Prefactor()/(2.*KEMConstants::Eps0); + } } } } diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorConfig.hh b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorConfig.hh index ef4962180..964de1dde 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorConfig.hh +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorConfig.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ +#ifndef KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ +#define KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ #include #include "KElectrostaticBoundaryIntegratorFactory.hh" @@ -30,4 +30,4 @@ using KoclEBIConfig = KOpenCLElectrostaticBoundaryIntegratorConfig; } /* KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ */ +#endif /* KOPENCLELECTROSTATICBOUNDARYINTEGRATORCONFIG_HH_ */ diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorFactory.hh b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorFactory.hh index 25a94046e..e93f89397 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorFactory.hh +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/Electrostatic/include/KOpenCLElectrostaticBoundaryIntegratorFactory.hh @@ -5,8 +5,8 @@ * Author: gosda */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ +#ifndef KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ +#define KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ #include #include "KOpenCLElectrostaticBoundaryIntegrator.hh" @@ -43,4 +43,4 @@ using KoclEBIFactory = KOpenCLElectrostaticBoundaryIntegratorFactory; } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_OPENCL_BOUNDARYINTEGRALS_ELECTROSTATIC_INCLUDE_KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ */ +#endif /* KOPENCLELECTROSTATICBOUNDARYINTEGRATORFACTORY_HH_ */ diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/cl/kEMField_ElectrostaticNumericBoundaryIntegrals.cl b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/cl/kEMField_ElectrostaticNumericBoundaryIntegrals.cl index e51d29335..060b4bf89 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/cl/kEMField_ElectrostaticNumericBoundaryIntegrals.cl +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/cl/kEMField_ElectrostaticNumericBoundaryIntegrals.cl @@ -457,18 +457,21 @@ CL_TYPE BI_BoundaryIntegral(int iBoundary, #ifdef NEUMANNBOUNDARY else // NEUMANN { - eField = EBI_EField(P_target,shapeType_source,data_source); BI_Centroid(&P_source[0],shapeType_source,data_source); BI_Normal(&N_target[0],shapeType_target,data_target); - - val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; dist2 = ((P_target[0]-P_source[0])*(P_target[0]-P_source[0]) + (P_target[1]-P_source[1])*(P_target[1]-P_source[1]) + (P_target[2]-P_source[2])*(P_target[2]-P_source[2])); - if (dist2<1.e-24) - { - val = val*((1. + boundaryData[iBoundary*BOUNDARYSIZE])/ - (1. - boundaryData[iBoundary*BOUNDARYSIZE])); + + if( dist2 >= 1.e-24) { + eField = EBI_EField(P_target,shapeType_source,data_source); + val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axially symmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + val = ((1. + boundaryData[iBoundary*BOUNDARYSIZE])/(1. - boundaryData[iBoundary*BOUNDARYSIZE]))/(2.*M_EPS0); } } #endif diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/include/KOpenCLElectrostaticNumericBoundaryIntegrator.hh b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/include/KOpenCLElectrostaticNumericBoundaryIntegrator.hh index 68faa1e16..2f3898a26 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/include/KOpenCLElectrostaticNumericBoundaryIntegrator.hh +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/ElectrostaticNumeric/include/KOpenCLElectrostaticNumericBoundaryIntegrator.hh @@ -48,9 +48,9 @@ namespace KEMField template double Potential(const SourceShape*, const KPosition&) const; template - KEMThreeVector ElectricField(const SourceShape*, const KPosition&) const; + KThreeVector ElectricField(const SourceShape*, const KPosition&) const; template - std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; + std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; std::string OpenCLFile() const { return "kEMField_ElectrostaticNumericBoundaryIntegrals.cl"; } @@ -156,7 +156,7 @@ namespace KEMField } template - KEMThreeVector KOpenCLElectrostaticNumericBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const + KThreeVector KOpenCLElectrostaticNumericBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -187,11 +187,11 @@ namespace KEMField sizeof(CL_TYPE4), &eField); - return KEMThreeVector(eField.s[0],eField.s[1],eField.s[2]); + return KThreeVector(eField.s[0],eField.s[1],eField.s[2]); } template - std::pair KOpenCLElectrostaticNumericBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const + std::pair KOpenCLElectrostaticNumericBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -222,7 +222,7 @@ namespace KEMField sizeof(CL_TYPE4), &eFieldAndPhi); - return std::make_pair( KEMThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); + return std::make_pair( KThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); } template @@ -234,13 +234,18 @@ namespace KEMField } else { - KEMThreeVector field = this->ElectricField(&source, fTarget->GetShape()->Centroid()); - fValue = field.Dot(fTarget->GetShape()->Normal()); - double dist = (source.Centroid() - fTarget->GetShape()->Centroid()).Magnitude(); - - if (dist<1.e-12) - fValue *= fBoundaryVisitor.Prefactor(); + + if( dist>=1.e-12 ) { + KThreeVector field = this->ElectricField(&source,fTarget->GetShape()->Centroid()); + fValue = field.Dot(fTarget->GetShape()->Normal()); + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axialsymmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + fValue = fBoundaryVisitor.Prefactor()/(2.*KEMConstants::Eps0); + } } } } diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/cl/kEMField_ElectrostaticRWGBoundaryIntegrals.cl b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/cl/kEMField_ElectrostaticRWGBoundaryIntegrals.cl index 8fef501bc..eeaa61d28 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/cl/kEMField_ElectrostaticRWGBoundaryIntegrals.cl +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/cl/kEMField_ElectrostaticRWGBoundaryIntegrals.cl @@ -137,19 +137,22 @@ CL_TYPE BI_BoundaryIntegral(int iBoundary, #ifdef NEUMANNBOUNDARY else // NEUMANN { - eField = EBI_EField(P_target,shapeType_source,data_source); - BI_Centroid(&P_source[0],shapeType_source,data_source); - BI_Normal(&N_target[0],shapeType_target,data_target); - - val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; - dist2 = ((P_target[0]-P_source[0])*(P_target[0]-P_source[0]) + - (P_target[1]-P_source[1])*(P_target[1]-P_source[1]) + - (P_target[2]-P_source[2])*(P_target[2]-P_source[2])); - if (dist2<1.e-24) - { - val = val*((1. + boundaryData[iBoundary*BOUNDARYSIZE])/ - (1. - boundaryData[iBoundary*BOUNDARYSIZE])); - } + BI_Centroid(&P_source[0],shapeType_source,data_source); + BI_Normal(&N_target[0],shapeType_target,data_target); + dist2 = ((P_target[0]-P_source[0])*(P_target[0]-P_source[0]) + + (P_target[1]-P_source[1])*(P_target[1]-P_source[1]) + + (P_target[2]-P_source[2])*(P_target[2]-P_source[2])); + + if( dist2 >= 1.e-24) { + eField = EBI_EField(P_target,shapeType_source,data_source); + val = eField.x*N_target[0] + eField.y*N_target[1] + eField.z*N_target[2]; + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axially symmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + val = ((1. + boundaryData[iBoundary*BOUNDARYSIZE])/(1. - boundaryData[iBoundary*BOUNDARYSIZE]))/(2.*M_EPS0); + } } #endif return val; diff --git a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/include/KOpenCLElectrostaticRWGBoundaryIntegrator.hh b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/include/KOpenCLElectrostaticRWGBoundaryIntegrator.hh index 5baa76ef6..9391b9fa6 100644 --- a/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/include/KOpenCLElectrostaticRWGBoundaryIntegrator.hh +++ b/KEMField/Source/Plugins/OpenCL/BoundaryIntegrals/RWG/include/KOpenCLElectrostaticRWGBoundaryIntegrator.hh @@ -48,9 +48,9 @@ namespace KEMField template double Potential(const SourceShape*, const KPosition&) const; template - KEMThreeVector ElectricField(const SourceShape*, const KPosition&) const; + KThreeVector ElectricField(const SourceShape*, const KPosition&) const; template - std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; + std::pair ElectricFieldAndPotential(const SourceShape*, const KPosition&) const; std::string OpenCLFile() const { return "kEMField_ElectrostaticRWGBoundaryIntegrals.cl"; } @@ -157,7 +157,7 @@ namespace KEMField } template - KEMThreeVector KOpenCLElectrostaticRWGBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const + KThreeVector KOpenCLElectrostaticRWGBoundaryIntegrator::ElectricField(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -188,11 +188,11 @@ namespace KEMField sizeof(CL_TYPE4), &eField); - return KEMThreeVector(eField.s[0],eField.s[1],eField.s[2]); + return KThreeVector(eField.s[0],eField.s[1],eField.s[2]); } template - std::pair KOpenCLElectrostaticRWGBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const + std::pair KOpenCLElectrostaticRWGBoundaryIntegrator::ElectricFieldAndPotential(const SourceShape* source, const KPosition& aPosition) const { StreamSourceToBuffer(source); @@ -223,7 +223,7 @@ namespace KEMField sizeof(CL_TYPE4), &eFieldAndPhi); - return std::make_pair( KEMThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); + return std::make_pair( KThreeVector(eFieldAndPhi.s[0],eFieldAndPhi.s[1],eFieldAndPhi.s[2]), eFieldAndPhi.s[3] ); } template @@ -235,13 +235,18 @@ namespace KEMField } else { - KEMThreeVector field = this->ElectricField(&source, - fTarget->GetShape()->Centroid()); - fValue = field.Dot(fTarget->GetShape()->Normal()); - double dist = (source.Centroid() - - fTarget->GetShape()->Centroid()).Magnitude(); - if (dist<1.e-12) - fValue *= fBoundaryVisitor.Prefactor(); + double dist = (source.Centroid() - fTarget->GetShape()->Centroid()).Magnitude(); + + if( dist>=1.e-12 ) { + KThreeVector field = this->ElectricField(&source,fTarget->GetShape()->Centroid()); + fValue = field.Dot(fTarget->GetShape()->Normal()); + } else { + // For planar Neumann elements (here: triangles and rectangles) the following formula + // is valid and incorporates already the electric field 1./(2.*Eps0). + // In case of conical (axialsymmetric) Neumann elements this formula has to be modified. + // Ferenc Glueck and Daniel Hilk, March 27th 2018 + fValue = fBoundaryVisitor.Prefactor()/(2.*KEMConstants::Eps0); + } } } } diff --git a/KEMField/Source/Plugins/OpenCL/CMakeLists.txt b/KEMField/Source/Plugins/OpenCL/CMakeLists.txt index 78032b84f..a0ab2fd08 100644 --- a/KEMField/Source/Plugins/OpenCL/CMakeLists.txt +++ b/KEMField/Source/Plugins/OpenCL/CMakeLists.txt @@ -5,91 +5,87 @@ #is not yet activated. This is because on certain systems we need to specify #the platform id before enabling OpenCL so that header file generator #compiles and runs correctly. -set(@PROJECT_NAME@_OPENCL_PLATFORM "0" CACHE STRING "OpenCL platform ID number.") -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_PLATFORM) -add_cflag(KEMFIELD_OPENCL_PLATFORM=${@PROJECT_NAME@_OPENCL_PLATFORM}) - -set(@PROJECT_NAME@_OPENCL_DEVICE_TYPE "0" CACHE STRING "OpenCL device type; GPU=0, CPU=1, Accelerator=2.") -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_DEVICE_TYPE) -add_cflag(KEMFIELD_OPENCL_DEVICE_TYPE=${@PROJECT_NAME@_OPENCL_DEVICE_TYPE}) - -cmake_dependent_option (@PROJECT_NAME@_OPENCL_USE_DEPRECATED_API "Use deprecated OpenCL 1.1 API" OFF - @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_USE_DEPRECATED_API) -if (@PROJECT_NAME@_OPENCL_USE_DEPRECATED_API) - set (@PROJECT_NAME@_OPENCL_CFLAGS ${@PROJECT_NAME@_OPENCL_CFLAGS} -DCL_USE_DEPRECATED_OPENCL_1_1_APIS) +set(${PROJECT_NAME}_OPENCL_PLATFORM "0" CACHE STRING "OpenCL platform ID number.") +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_PLATFORM) +add_cflag(KEMFIELD_OPENCL_PLATFORM=${${PROJECT_NAME}_OPENCL_PLATFORM}) + +set(${PROJECT_NAME}_OPENCL_DEVICE_TYPE "0" CACHE STRING "OpenCL device type; GPU=0, CPU=1, Accelerator=2.") +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_DEVICE_TYPE) +add_cflag(KEMFIELD_OPENCL_DEVICE_TYPE=${${PROJECT_NAME}_OPENCL_DEVICE_TYPE}) + +set(${PROJECT_NAME}_OPENCL_FASTDIELECTRICS "0" CACHE STRING "Choose the check method of Neumann boundary elements in Robin Hood; 0 (check interval equal to Dirichlet elements), 1 (decrease checked accuracy of Neumann elements by 1/20), 2 (counter technique with the function RH_BoundaryRatioExceeded)") +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_FASTDIELECTRICS) +add_cflag(KEMFIELD_FASTDIELECTRICS_VALUE=${${PROJECT_NAME}_OPENCL_FASTDIELECTRICS}) + +cmake_dependent_option (${PROJECT_NAME}_OPENCL_USE_DEPRECATED_API "Use deprecated OpenCL 1.1 API" OFF + ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_USE_DEPRECATED_API) +if (${PROJECT_NAME}_OPENCL_USE_DEPRECATED_API) + set (${PROJECT_NAME}_OPENCL_CFLAGS ${${PROJECT_NAME}_OPENCL_CFLAGS} -DCL_USE_DEPRECATED_OPENCL_1_1_APIS) add_cflag (CL_USE_DEPRECATED_OPENCL_1_1_APIS) -endif (@PROJECT_NAME@_OPENCL_USE_DEPRECATED_API) +endif (${PROJECT_NAME}_OPENCL_USE_DEPRECATED_API) -cmake_dependent_option (@PROJECT_NAME@_OPENCL_USE_CL_VECTOR "Use deprecated cl::vector in place of std::vector" OFF - @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_USE_CL_VECTOR) -if (@PROJECT_NAME@_OPENCL_USE_CL_VECTOR) - set (@PROJECT_NAME@_OPENCL_CFLAGS ${@PROJECT_NAME@_OPENCL_CFLAGS} -DKEMFIELD_USE_CL_VECTOR) +cmake_dependent_option (${PROJECT_NAME}_OPENCL_USE_CL_VECTOR "Use deprecated cl::vector in place of std::vector" OFF + ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_USE_CL_VECTOR) +if (${PROJECT_NAME}_OPENCL_USE_CL_VECTOR) + set (${PROJECT_NAME}_OPENCL_CFLAGS ${${PROJECT_NAME}_OPENCL_CFLAGS} -DKEMFIELD_USE_CL_VECTOR) add_cflag (KEMFIELD_USE_CL_VECTOR) -endif (@PROJECT_NAME@_OPENCL_USE_CL_VECTOR) +endif (${PROJECT_NAME}_OPENCL_USE_CL_VECTOR) -cmake_dependent_option (@PROJECT_NAME@_OPENCL_FFT_CONST_MEM "Enable use of OpenCL device constant memory by FFT kernel." ON - @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_FFT_CONST_MEM) -if (@PROJECT_NAME@_OPENCL_FFT_CONST_MEM) - set (@PROJECT_NAME@_OPENCL_CFLAGS ${@PROJECT_NAME@_OPENCL_CFLAGS} -DKEMFIELD_OPENCL_FFT_CONST_MEM) +cmake_dependent_option (${PROJECT_NAME}_OPENCL_FFT_CONST_MEM "Enable use of OpenCL device constant memory by FFT kernel." ON + ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_FFT_CONST_MEM) +if (${PROJECT_NAME}_OPENCL_FFT_CONST_MEM) + set (${PROJECT_NAME}_OPENCL_CFLAGS ${${PROJECT_NAME}_OPENCL_CFLAGS} -DKEMFIELD_OPENCL_FFT_CONST_MEM) add_cflag (KEMFIELD_OPENCL_FFT_CONST_MEM) -endif (@PROJECT_NAME@_OPENCL_FFT_CONST_MEM) - -cmake_dependent_option (@PROJECT_NAME@_OPENCL_INTERNAL_1_1 "Use internally packaged OpenCL 1.1 headers" ON - @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_INTERNAL_1_1) -if (@PROJECT_NAME@_OPENCL_INTERNAL_1_1) - set (@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_STR \"${CMAKE_SOURCE_DIR}/@PROJECT_NAME@/opencl/1.1\") - string (REPLACE "\"" "" @PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_VAR ${@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_STR} ) - set (@PROJECT_NAME@_OPENCL_CFLAGS ${@PROJECT_NAME@_OPENCL_CFLAGS} -isystem ${@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_VAR}) -endif (@PROJECT_NAME@_OPENCL_INTERNAL_1_1) - -cmake_dependent_option (@PROJECT_NAME@_OPENCL_INTERNAL_1_2 "Use internally packaged OpenCL 1.2 headers" OFF - @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_INTERNAL_1_2) -if (@PROJECT_NAME@_OPENCL_INTERNAL_1_2) - set (@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_STR \"${CMAKE_SOURCE_DIR}/@PROJECT_NAME@/opencl/1.2\") - string (REPLACE "\"" "" @PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_VAR ${@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_STR} ) - set (@PROJECT_NAME@_OPENCL_CFLAGS ${@PROJECT_NAME@_OPENCL_CFLAGS} -isystem ${@PROJECT_NAME@_OPENCL_TEMP_INCLUDE_DIR_VAR}) -endif (@PROJECT_NAME@_OPENCL_INTERNAL_1_2) - -cmake_dependent_option (@PROJECT_NAME@_OPENCL_FASTRWG "Activate the fast evaluation of electrostatic boundary integrals in RWG basis if no field point has to be computed on any surface." OFF @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_FASTRWG) -if (@PROJECT_NAME@_OPENCL_FASTRWG) +endif (${PROJECT_NAME}_OPENCL_FFT_CONST_MEM) + +cmake_dependent_option (${PROJECT_NAME}_OPENCL_INTERNAL_1_1 "Use internally packaged OpenCL 1.1 headers" ON + ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_INTERNAL_1_1) +if (${PROJECT_NAME}_OPENCL_INTERNAL_1_1) + set (${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_STR \"${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/opencl/1.1\") + string (REPLACE "\"" "" ${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_VAR ${${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_STR} ) + set (${PROJECT_NAME}_OPENCL_CFLAGS ${${PROJECT_NAME}_OPENCL_CFLAGS} -isystem ${${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_VAR}) +endif (${PROJECT_NAME}_OPENCL_INTERNAL_1_1) + +cmake_dependent_option (${PROJECT_NAME}_OPENCL_INTERNAL_1_2 "Use internally packaged OpenCL 1.2 headers" OFF + ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_INTERNAL_1_2) +if (${PROJECT_NAME}_OPENCL_INTERNAL_1_2) + set (${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_STR \"${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/opencl/1.2\") + string (REPLACE "\"" "" ${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_VAR ${${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_STR} ) + set (${PROJECT_NAME}_OPENCL_CFLAGS ${${PROJECT_NAME}_OPENCL_CFLAGS} -isystem ${${PROJECT_NAME}_OPENCL_TEMP_INCLUDE_DIR_VAR}) +endif (${PROJECT_NAME}_OPENCL_INTERNAL_1_2) + +cmake_dependent_option (${PROJECT_NAME}_OPENCL_FASTRWG "Activate the fast evaluation of electrostatic boundary integrals in RWG basis if no field point has to be computed on any surface." OFF ${PROJECT_NAME}_USE_OPENCL OFF) +mark_as_advanced(FORCE ${PROJECT_NAME}_OPENCL_FASTRWG) +if (${PROJECT_NAME}_OPENCL_FASTRWG) add_cflag(KEMFIELD_FASTRWG_VALUE=1) -else (@PROJECT_NAME@_OPENCL_FASTRWG) - add_cflag(KEMFIELD_FASTRWG_VALUE=0) -endif (@PROJECT_NAME@_OPENCL_FASTRWG) +else (${PROJECT_NAME}_OPENCL_FASTRWG) + add_cflag(KEMFIELD_FASTRWG_VALUE=0) +endif (${PROJECT_NAME}_OPENCL_FASTRWG) -cmake_dependent_option (@PROJECT_NAME@_OPENCL_FASTDIELECTRICS "Enable the fast computation of Neumann boundary elements through the function RH_BoundaryRatioExceeded" OFF @PROJECT_NAME@_USE_OPENCL OFF) -mark_as_advanced(FORCE @PROJECT_NAME@_OPENCL_FASTDIELECTRICS) -if (@PROJECT_NAME@_OPENCL_FASTDIELECTRICS) - add_cflag(KEMFIELD_FASTDIELECTRICS_VALUE=1) -else (@PROJECT_NAME@_OPENCL_FASTDIELECTRICS) - add_cflag(KEMFIELD_FASTDIELECTRICS_VALUE=0) -endif (@PROJECT_NAME@_OPENCL_FASTDIELECTRICS) - -option (@PROJECT_NAME@_USE_OPENCL "Use OpenCL via C++ wrapper API." OFF) -if (@PROJECT_NAME@_USE_OPENCL) +option (${PROJECT_NAME}_USE_OPENCL "Use OpenCL via C++ wrapper API." OFF) +if (${PROJECT_NAME}_USE_OPENCL) # force deactivation of FFTW because it permutes FFT outputs in a different way - # than the native FFT, which leades to incorrect fast multipole response functions + # than the native FFT, which leads to incorrect fast multipole response functions set( KEMField_USE_FFTW OFF CACHE BOOL "(Required)" FORCE) find_package (OpenCL REQUIRED) kasper_external_include_directories(${OPENCL_INCLUDE_DIRS}) - if(@PROJECT_NAME@_OPENCL_INTERNAL_1_1) - kasper_internal_include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/@PROJECT_NAME@/opencl/1.1) - endif(@PROJECT_NAME@_OPENCL_INTERNAL_1_1) + if(${PROJECT_NAME}_OPENCL_INTERNAL_1_1) + kasper_internal_include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/opencl/1.1) + endif(${PROJECT_NAME}_OPENCL_INTERNAL_1_1) - if(@PROJECT_NAME@_OPENCL_INTERNAL_1_2) - kasper_internal_include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/@PROJECT_NAME@/opencl/1.2) - endif(@PROJECT_NAME@_OPENCL_INTERNAL_1_2) + if(${PROJECT_NAME}_OPENCL_INTERNAL_1_2) + kasper_internal_include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/opencl/1.2) + endif(${PROJECT_NAME}_OPENCL_INTERNAL_1_2) add_cflag (KEMFIELD_USE_OPENCL) @@ -98,21 +94,21 @@ if (@PROJECT_NAME@_USE_OPENCL) if (APPLE) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -D KEMFIELD_OPENCL_PLATFORM=${KEMField_OPENCL_PLATFORM} - -D KEMFIELD_OPENCL_DEVICE_TYPE=${@PROJECT_NAME@_OPENCL_DEVICE_TYPE} + -D KEMFIELD_OPENCL_DEVICE_TYPE=${${PROJECT_NAME}_OPENCL_DEVICE_TYPE} -o GenerateOpenCLHeader -I${OPENCL_INCLUDE_DIRS} - ${@PROJECT_NAME@_OPENCL_CFLAGS} + ${${PROJECT_NAME}_OPENCL_CFLAGS} -framework OpenCL ${SOURCE}/Plugins/OpenCL/Core/src/GenerateOpenCLHeader.cc WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) else (APPLE) execute_process(COMMAND ${CMAKE_CXX_COMPILER} - -D KEMFIELD_OPENCL_PLATFORM=${@PROJECT_NAME@_OPENCL_PLATFORM} - -D KEMFIELD_OPENCL_DEVICE_TYPE=${@PROJECT_NAME@_OPENCL_DEVICE_TYPE} + -D KEMFIELD_OPENCL_PLATFORM=${${PROJECT_NAME}_OPENCL_PLATFORM} + -D KEMFIELD_OPENCL_DEVICE_TYPE=${${PROJECT_NAME}_OPENCL_DEVICE_TYPE} -o GenerateOpenCLHeader -I${OPENCL_INCLUDE_DIRS} - ${@PROJECT_NAME@_OPENCL_CFLAGS} + ${${PROJECT_NAME}_OPENCL_CFLAGS} ${SOURCE}/Plugins/OpenCL/Core/src/GenerateOpenCLHeader.cc -L${OPENCL_LIBDIR} ${OPENCL_LIB_FLAG} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) @@ -120,7 +116,7 @@ if (@PROJECT_NAME@_USE_OPENCL) endif (APPLE) execute_process(COMMAND ./GenerateOpenCLHeader - OUTPUT_FILE ${CMAKE_BINARY_DIR}/@PROJECT_NAME@/kEMField_opencl_defines.h + OUTPUT_FILE ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/kEMField_opencl_defines.h WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE USE_DOUBLE_PRECISION_GPU) @@ -201,12 +197,12 @@ if (@PROJECT_NAME@_USE_OPENCL) ${CMAKE_CURRENT_SOURCE_DIR}/FastMultipole/Tree/include/KFMScalarMomentRemoteToRemoteConverter_OpenCL.hh ) - if (@PROJECT_NAME@_USE_MPI) + if (${PROJECT_NAME}_USE_MPI) list (APPEND OPENCLPLUGIN_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/LinearAlgebra/include/KRobinHood_MPI_OpenCL.hh #${CMAKE_CURRENT_SOURCE_DIR}/FastMultipole/Electrostatics/include/KFMElectrostaticSparseBoundaryIntegralShellMatrix_MPI_OpenCL.hh ) - endif (@PROJECT_NAME@_USE_MPI) + endif (${PROJECT_NAME}_USE_MPI) set (OPENCLPLUGIN_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/Core/src/KOpenCLAction.cc @@ -240,11 +236,11 @@ if (@PROJECT_NAME@_USE_OPENCL) set_property( SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/Core/src/KOpenCLInterface.cc - APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_KERNEL_DIR="${@PROJECT_NAME@_DATA_INSTALL_DIR}" + APPEND PROPERTY COMPILE_DEFINITIONS DEFAULT_KERNEL_DIR="${${PROJECT_NAME}_DATA_INSTALL_DIR}" ) set (OPENCLPLUGIN_CLFILES - ${CMAKE_BINARY_DIR}/@PROJECT_NAME@/kEMField_opencl_defines.h + ${CMAKE_BINARY_DIR}/${PROJECT_NAME}/kEMField_opencl_defines.h # ${CMAKE_CURRENT_SOURCE_DIR}/Math/cl/kEMField_GaussianQuadrature.cl ${CMAKE_CURRENT_SOURCE_DIR}/Math/cl/kEMField_GaussianCubature.cl @@ -356,7 +352,7 @@ if (@PROJECT_NAME@_USE_OPENCL) # Generate GPU-specific headers for OpenCL implementation of KEMField install ( FILES ${OPENCLPLUGIN_CLFILES} - DESTINATION ${@PROJECT_NAME@_DATA_INSTALL_DIR} + DESTINATION ${${PROJECT_NAME}_DATA_INSTALL_DIR} ) -endif (@PROJECT_NAME@_USE_OPENCL) +endif (${PROJECT_NAME}_USE_OPENCL) diff --git a/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/include/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.hh b/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/include/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.hh index 30de737f3..bc4f103a9 100644 --- a/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/include/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.hh +++ b/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/include/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.hh @@ -36,7 +36,7 @@ class KFMElectrostaticFastMultipoleFieldSolver_OpenCL //computes the potential and field at a given point double Potential(const KPosition& P) const; - KEMThreeVector ElectricField(const KPosition& P) const; + KThreeVector ElectricField(const KPosition& P) const; //for debugging and information purposes int GetSubsetSize(const KPosition& P) const {SetPoint(P); return fSubsetSize;}; diff --git a/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/src/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.cc b/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/src/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.cc index 5fd3b8c8e..32bfa57d8 100644 --- a/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/src/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.cc +++ b/KEMField/Source/Plugins/OpenCL/FastMultipole/Electrostatics/src/KFMElectrostaticFastMultipoleFieldSolver_OpenCL.cc @@ -72,14 +72,14 @@ KFMElectrostaticFastMultipoleFieldSolver_OpenCL::Potential(const KPosition& P) c } } -KEMThreeVector +KThreeVector KFMElectrostaticFastMultipoleFieldSolver_OpenCL::ElectricField(const KPosition& P) const { SetPoint(P); if(!fFallback) { - KEMThreeVector f; + KThreeVector f; double fast_f[3]; if(fSubsetSize != 0){fDirectFieldSolver->DispatchElectricField(fDirectCallIDs, fSubsetSize, P); } fFastFieldSolver.ElectricField(P, fast_f); diff --git a/KEMField/Source/Plugins/OpenCL/FieldSolvers/Integrating/include/KOpenCLElectrostaticIntegratingFieldSolver.hh b/KEMField/Source/Plugins/OpenCL/FieldSolvers/Integrating/include/KOpenCLElectrostaticIntegratingFieldSolver.hh index 132ba982d..79b15589e 100644 --- a/KEMField/Source/Plugins/OpenCL/FieldSolvers/Integrating/include/KOpenCLElectrostaticIntegratingFieldSolver.hh +++ b/KEMField/Source/Plugins/OpenCL/FieldSolvers/Integrating/include/KOpenCLElectrostaticIntegratingFieldSolver.hh @@ -40,14 +40,14 @@ namespace KEMField void AssignBuffers() const; double Potential(const KPosition& aPosition) const; - KEMThreeVector ElectricField(const KPosition& aPosition) const; - std::pair ElectricFieldAndPotential(const KPosition& aPosition) const; + KThreeVector ElectricField(const KPosition& aPosition) const; + std::pair ElectricFieldAndPotential(const KPosition& aPosition) const; //////////////////////////////////////////////////////////////////////////// //sub-set potential/field calls double Potential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; - KEMThreeVector ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; - std::pair ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; + KThreeVector ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; + std::pair ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; //these methods allow us to dispatch a calculation to the GPU and retrieve the values later //this is useful so that we can do other work while waiting for the results @@ -55,8 +55,8 @@ namespace KEMField void DispatchElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; void DispatchElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const; double RetrievePotential() const; - KEMThreeVector RetrieveElectricField() const; - std::pair RetrieveElectricFieldAndPotential() const; + KThreeVector RetrieveElectricField() const; + std::pair RetrieveElectricFieldAndPotential() const; //////////////////////////////////////////////////////////////////////////// @@ -111,8 +111,8 @@ namespace KEMField mutable unsigned int fCachedNDummy; mutable unsigned int fCachedNWorkgroups; mutable double fCachedSubsetPotential; - mutable KEMThreeVector fCachedSubsetField; - mutable std::pair fCachedSubsetFieldAndPotential; + mutable KThreeVector fCachedSubsetField; + mutable std::pair fCachedSubsetFieldAndPotential; mutable unsigned int fCachedSubsetSize; mutable const unsigned int* fCachedSurfaceIndexSet; @@ -453,7 +453,7 @@ namespace KEMField } template - KEMThreeVector KIntegratingFieldSolver::ElectricField(const KPosition& aPosition) const + KThreeVector KIntegratingFieldSolver::ElectricField(const KPosition& aPosition) const { CL_TYPE P[3] = {aPosition[0],aPosition[1],aPosition[2]}; @@ -470,7 +470,7 @@ namespace KEMField *fGlobalRange, *fLocalRange); - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); KOpenCLInterface::GetInstance()->GetQueue(). enqueueReadBuffer(*fBufferElectricField, @@ -496,7 +496,7 @@ namespace KEMField } template - std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const KPosition& aPosition) const + std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const KPosition& aPosition) const { CL_TYPE P[3] = {aPosition[0],aPosition[1],aPosition[2]}; @@ -513,7 +513,7 @@ namespace KEMField *fGlobalRange, *fLocalRange); - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); CL_TYPE potential = 0.; KOpenCLInterface::GetInstance()->GetQueue(). @@ -623,7 +623,7 @@ namespace KEMField } template - KEMThreeVector KIntegratingFieldSolver::ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const + KThreeVector KIntegratingFieldSolver::ElectricField(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const { CL_TYPE P[3] = {aPosition[0],aPosition[1],aPosition[2]}; @@ -665,7 +665,7 @@ namespace KEMField global, local); - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); CL_TYPE potential = 0.; cl::Event event; @@ -704,7 +704,7 @@ namespace KEMField } template - std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const + std::pair KIntegratingFieldSolver::ElectricFieldAndPotential(const unsigned int* SurfaceIndexSet, unsigned int SetSize, const KPosition& aPosition) const { CL_TYPE P[3] = {aPosition[0],aPosition[1],aPosition[2]}; @@ -746,7 +746,7 @@ namespace KEMField global, local); - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); CL_TYPE potential = 0.; cl::Event event; @@ -1025,11 +1025,11 @@ namespace KEMField } template - KEMThreeVector KIntegratingFieldSolver::RetrieveElectricField() const + KThreeVector KIntegratingFieldSolver::RetrieveElectricField() const { if(fCallDevice) { - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); cl::Event event; KOpenCLInterface::GetInstance()->GetQueue(). @@ -1066,11 +1066,11 @@ namespace KEMField } template - std::pair KIntegratingFieldSolver::RetrieveElectricFieldAndPotential() const + std::pair KIntegratingFieldSolver::RetrieveElectricFieldAndPotential() const { if(fCallDevice) { - KEMThreeVector eField(0.,0.,0.); + KThreeVector eField(0.,0.,0.); CL_TYPE potential = 0.; cl::Event event; diff --git a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/cl/kEMField_RobinHood_kernel.cl b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/cl/kEMField_RobinHood_kernel.cl index ea6634af3..68d167857 100644 --- a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/cl/kEMField_RobinHood_kernel.cl +++ b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/cl/kEMField_RobinHood_kernel.cl @@ -8,12 +8,11 @@ //______________________________________________________________________________ int RH_BoundaryRatioExceeded(int iElement, - __global const int* boundaryInfo, - __global const int* counter) + __global const int* boundaryInfo, + __global const int* counter) { int return_val = 0; -#if KEMFIELD_OCLFASTDIELECTRICS==1 #ifdef NEUMANNBOUNDARY int iBoundary = BI_GetBoundaryForElement(iElement,boundaryInfo); @@ -31,17 +30,16 @@ int RH_BoundaryRatioExceeded(int iElement, CL_TYPE ratio_geometric = 0.; ratio_called = (convert_float(counter[iBoundary])/ - convert_float(counter[BI_GetNumBoundaries(boundaryInfo)])); + convert_float(counter[BI_GetNumBoundaries(boundaryInfo)])); ratio_geometric =(convert_float(BI_GetBoundarySize(iBoundary,boundaryInfo))/ - convert_float(BI_GetNumElements(boundaryInfo))); + convert_float(BI_GetNumElements(boundaryInfo))); // this all must be negated if the residual is being checked! if (ratio_called>ratio_geometric && counter[BI_GetNumBoundaries(boundaryInfo)]%counter[BI_GetNumBoundaries(boundaryInfo)+1]!=0) return_val = 1; } #endif -#endif /* KEMFIELD_OCLDIELECTRICS */ return return_val; } @@ -86,12 +84,22 @@ __kernel void FindResidual(__global CL_TYPE* b_diff, if (b_iterative[iElement]<1.e10) { -#if KEMFIELD_OCLFASTDIELECTRICS==1 +#ifdef NEUMANNBOUNDARY +#if KEMFIELD_OCLNEUMANNCHECKMETHOD==1 + // Decrease checked accuracy of Neumann elements by 1/20 (idea by Ferenc Glueck) + int iBoundary = BI_GetBoundaryForElement(iElement,boundaryInfo); + if (BI_GetBoundaryType(iBoundary,boundaryInfo) == NEUMANNBOUNDARY) + b_diff[iElement] = 0.05 * (U_Target - b_iterative[iElement]); + else +#endif /* KEMFIELD_OCLNEUMANNCHECKMETHOD==1 */ +#if KEMFIELD_OCLNEUMANNCHECKMETHOD==2 + // Counter technique with the function RH_BoundaryRatioExceeded (by T.J. Corona) if (RH_BoundaryRatioExceeded(iElement,boundaryInfo,counter)) b_diff[iElement] = 0.; else -#endif /* KEMFIELD_OCLFASTDIELECTRICS */ - b_diff[iElement] = U_Target - b_iterative[iElement]; +#endif /* KEMFIELD_OCLNEUMANNCHECKMETHOD==2 */ +#endif + b_diff[iElement] = U_Target - b_iterative[iElement]; } else b_diff[iElement] = 0.; diff --git a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_MPI_OpenCL.hh b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_MPI_OpenCL.hh index 7241c0810..36e55b9b9 100644 --- a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_MPI_OpenCL.hh +++ b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_MPI_OpenCL.hh @@ -8,6 +8,9 @@ #include "KMPIInterface.hh" +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + namespace KEMField { template @@ -141,7 +144,7 @@ namespace KEMField { InitializeMPIStructs(Type2Type()); std::stringstream options; - options << " -DKEMFIELD_OCLFASTDIELECTRICS=" << KEMFIELD_FASTDIELECTRICS_VALUE; + options << " -DKEMFIELD_OCLNEUMANNCHECKMETHOD=" << TOSTRING(KEMFIELD_FASTDIELECTRICS_VALUE); fOpenCLFlags = options.str(); KOpenCLAction::Initialize(); @@ -302,8 +305,13 @@ namespace KEMField fCLNWarps = new cl_int[1]; fCLNWarps[0] = fNWorkgroups; - fCLCounter = new cl_int[1]; - fCLCounter[0] = fData.GetNBufferedElements(); + + fCLCounter = new cl_int[fData.GetNBufferedElements()+2]; + for (unsigned int i=0;iGetContext(), CL_MEM_READ_WRITE, - sizeof(cl_int)); + sizeof(cl_int)*(fData.GetNBufferedElements()+2)); // Copy lists to the memory buffers KOpenCLInterface::GetInstance()-> @@ -434,7 +442,7 @@ namespace KEMField GetQueue().enqueueWriteBuffer(*fBufferCounter, CL_TRUE, 0, - sizeof(cl_int), + sizeof(cl_int)*(fData.GetNBufferedElements()+2), fCLCounter); fInitializeVectorApproximationKernel->setArg(0,*container.GetBoundaryInfo()); diff --git a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_OpenCL.hh b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_OpenCL.hh index 1985b29bf..75399860b 100644 --- a/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_OpenCL.hh +++ b/KEMField/Source/Plugins/OpenCL/LinearAlgebra/include/KRobinHood_OpenCL.hh @@ -8,6 +8,9 @@ #include "KOpenCLAction.hh" #include "KOpenCLBoundaryIntegralMatrix.hh" +#define STRINGIFY(x) #x +#define TOSTRING(x) STRINGIFY(x) + namespace KEMField { template @@ -95,7 +98,7 @@ namespace KEMField KRobinHood_OpenCL::KRobinHood_OpenCL(const Matrix& A, Vector& x, const Vector& b) : KOpenCLAction((dynamic_cast(A)).GetData()), fA(A), fX(x), fB(b), fInitializeVectorApproximationKernel(NULL), fFindResidualKernel(NULL), fFindResidualNormKernel(NULL), fCompleteResidualNormalizationKernel(NULL), fIdentifyLargestResidualElementKernel(NULL), fCompleteLargestResidualIdentificationKernel(NULL), fComputeCorrectionKernel(NULL), fUpdateSolutionApproximationKernel(NULL), fUpdateVectorApproximationKernel(NULL), fBufferResidual(NULL), fBufferB_iterative(NULL), fBufferCorrection(NULL), fBufferPartialMaxResidualIndex(NULL), fBufferMaxResidualIndex(NULL), fBufferPartialResidualNorm(NULL), fBufferResidualNorm(NULL), fBufferNWarps(NULL), fBufferCounter(NULL), fCLResidual(NULL), fCLB_iterative(NULL), fCLCorrection(NULL), fCLPartialMaxResidualIndex(NULL), fCLMaxResidualIndex(NULL), fCLPartialResidualNorm(NULL), fCLResidualNorm(NULL), fCLNWarps(NULL), fCLCounter(NULL), fReadResidual(false) { std::stringstream options; - options << " -DKEMFIELD_OCLFASTDIELECTRICS=" << KEMFIELD_FASTDIELECTRICS_VALUE; /* variable defined via cmake */ + options << " -DKEMFIELD_OCLNEUMANNCHECKMETHOD=" << TOSTRING(KEMFIELD_FASTDIELECTRICS_VALUE); /* variable defined via cmake */ fOpenCLFlags = options.str(); KOpenCLAction::Initialize(); @@ -243,8 +246,13 @@ namespace KEMField fCLNWarps = new cl_int[1]; fCLNWarps[0] = fData.GetNBufferedElements()/fNLocal; - fCLCounter = new cl_int[1]; - fCLCounter[0] = fData.GetNBufferedElements(); + + fCLCounter = new cl_int[fData.GetNBufferedElements()+2]; + for (unsigned int i=0;iGetContext(), CL_MEM_READ_WRITE, - sizeof(cl_int)); + sizeof(cl_int)*(fData.GetNBufferedElements()+2)); // Copy lists to the memory buffers KOpenCLInterface::GetInstance()-> @@ -354,7 +362,7 @@ namespace KEMField GetQueue().enqueueWriteBuffer(*fBufferCounter, CL_TRUE, 0, - sizeof(cl_int), + sizeof(cl_int)*(fData.GetNBufferedElements()+2), fCLCounter); fGlobalRange = new cl::NDRange(fData.GetNBufferedElements()); diff --git a/KEMField/Source/Plugins/OpenCL/Surfaces/cl/kEMField_SolidAngle.cl b/KEMField/Source/Plugins/OpenCL/Surfaces/cl/kEMField_SolidAngle.cl index c480558a3..8f06dafbd 100644 --- a/KEMField/Source/Plugins/OpenCL/Surfaces/cl/kEMField_SolidAngle.cl +++ b/KEMField/Source/Plugins/OpenCL/Surfaces/cl/kEMField_SolidAngle.cl @@ -8,7 +8,7 @@ // Functions for computing solid angle from Euler-Eriksson's formula as described in paper PIER 63, 243-278, 2006 // Author: Daniel Hilk -#define SOLIDANGLEMINDIST 1.e-15 /* for check if field point is on surface */ +#define SOLIDANGLEMINDIST 1.e-12 /* for check if field point is on surface */ //______________________________________________________________________________ diff --git a/KEMField/Source/Plugins/PETSc/CMakeLists.txt b/KEMField/Source/Plugins/PETSc/CMakeLists.txt index 4de86158c..fd208818b 100644 --- a/KEMField/Source/Plugins/PETSc/CMakeLists.txt +++ b/KEMField/Source/Plugins/PETSc/CMakeLists.txt @@ -1,14 +1,14 @@ # CMakeLists for KEMField/Plugins/PETSc # T.J. Corona -cmake_dependent_option (@PROJECT_NAME@_USE_PETSc "Use PETSc for charge density computation" OFF @PROJECT_NAME@_USE_MPI OFF) +cmake_dependent_option (${PROJECT_NAME}_USE_PETSc "Use PETSc for charge density computation" OFF ${PROJECT_NAME}_USE_MPI OFF) -if (NOT @PROJECT_NAME@_USE_MPI) - set (@PROJECT_NAME@_USE_PETSc OFF) - set (@PROJECT_NAME@_USE_PETSc ${@PROJECT_NAME@_USE_PETSc} PARENT_SCOPE) -endif (NOT @PROJECT_NAME@_USE_MPI) +if (NOT ${PROJECT_NAME}_USE_MPI) + set (${PROJECT_NAME}_USE_PETSc OFF) + set (${PROJECT_NAME}_USE_PETSc ${${PROJECT_NAME}_USE_PETSc} PARENT_SCOPE) +endif (NOT ${PROJECT_NAME}_USE_MPI) -if (@PROJECT_NAME@_USE_PETSc) +if (${PROJECT_NAME}_USE_PETSc) find_package (PETSc REQUIRED) kasper_external_include_directories (${PETSC_INCLUDES}) @@ -34,5 +34,4 @@ if (@PROJECT_NAME@_USE_PETSc) kasper_install_headers (${PETSCPLUGIN_HEADERFILES}) kasper_install_libraries (KEMPETScPlugin) -endif (@PROJECT_NAME@_USE_PETSc) - +endif (${PROJECT_NAME}_USE_PETSc) diff --git a/KEMField/Source/Plugins/Root/CMakeLists.txt b/KEMField/Source/Plugins/Root/CMakeLists.txt index 633fd43a2..1cbe28d04 100644 --- a/KEMField/Source/Plugins/Root/CMakeLists.txt +++ b/KEMField/Source/Plugins/Root/CMakeLists.txt @@ -1,7 +1,7 @@ # CMakeLists for KEMField/Plugins/Root # Author: T.J. Corona -if (@PROJECT_NAME@_USE_ROOT) +if (${PROJECT_NAME}_USE_ROOT) kasper_external_include_directories (${ROOT_INCLUDE_DIRS}) add_cflag (KEMFIELD_USE_ROOT) @@ -10,7 +10,7 @@ if (@PROJECT_NAME@_USE_ROOT) set (KEMROOT_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMElectricFieldPointsRootFile.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMRootFieldCanvas.hh - ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMRootSVDSolver.hh + ${CMAKE_CURRENT_SOURCE_DIR}/include/KEMRootSVDSolver.hh ) set (KEMROOT_SOURCEFILES @@ -21,10 +21,9 @@ if (@PROJECT_NAME@_USE_ROOT) add_library (KEMRootPlugin SHARED ${KEMROOT_SOURCEFILES}) target_link_libraries (KEMRootPlugin KEMVisualization - KEMMath KEMCore ${Kommon_LIBRARIES} ${GSL_LIBRARIES} - ${ROOT_LIBRARIES} ) + KEMMath KEMCore ${Kommon_LIBRARIES} ${KGeoBag_LIBRARIES} ${GSL_LIBRARIES} ${ROOT_LIBRARIES} ) kasper_install_headers (${KEMROOT_HEADERFILES}) kasper_install_libraries (KEMRootPlugin) -endif (@PROJECT_NAME@_USE_ROOT) +endif (${PROJECT_NAME}_USE_ROOT) diff --git a/KEMField/Source/Plugins/Root/include/KEMElectricFieldPointsRootFile.hh b/KEMField/Source/Plugins/Root/include/KEMElectricFieldPointsRootFile.hh index bd929e054..a5122b87c 100644 --- a/KEMField/Source/Plugins/Root/include/KEMElectricFieldPointsRootFile.hh +++ b/KEMField/Source/Plugins/Root/include/KEMElectricFieldPointsRootFile.hh @@ -9,9 +9,10 @@ #define KEMELECTRICFIELDPOINTSROOTFILE_HH_ #include + +#include "KThreeVector_KEMField.hh" #include "TFile.h" #include "TTree.h" -#include "KEMThreeVector.hh" namespace KEMField { diff --git a/KEMField/Source/Plugins/VTK/CMakeLists.txt b/KEMField/Source/Plugins/VTK/CMakeLists.txt index d4629863f..d720c7b96 100644 --- a/KEMField/Source/Plugins/VTK/CMakeLists.txt +++ b/KEMField/Source/Plugins/VTK/CMakeLists.txt @@ -1,7 +1,7 @@ # CMakeLists for KEMField/Plugins/VTK # Author: T.J. Corona -if (@PROJECT_NAME@_USE_VTK) +if (${PROJECT_NAME}_USE_VTK) add_cflag (KEMFIELD_USE_VTK) kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -37,6 +37,8 @@ if (@PROJECT_NAME@_USE_VTK) KEMVisualization KFMCore KFMElectrostatics + ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} ${GSL_LIBRARIES} ${OPENCL_LIBRARIES} ${VTK_LIBRARIES} @@ -48,4 +50,4 @@ if (@PROJECT_NAME@_USE_VTK) kasper_install_headers (${VTKPLUGIN_HEADERFILES}) kasper_install_libraries (KEMVTKPlugin) -endif (@PROJECT_NAME@_USE_VTK) +endif (${PROJECT_NAME}_USE_VTK) diff --git a/KEMField/Source/Plugins/VTK/include/KEMVTKViewer.hh b/KEMField/Source/Plugins/VTK/include/KEMVTKViewer.hh index f531a5642..1e4e19b16 100644 --- a/KEMField/Source/Plugins/VTK/include/KEMVTKViewer.hh +++ b/KEMField/Source/Plugins/VTK/include/KEMVTKViewer.hh @@ -36,11 +36,11 @@ #include #include +#include "KThreeVector_KEMField.hh" #include "KTypeManipulation.hh" #include "KSurfaceContainer.hh" -#include "KEMThreeVector.hh" namespace KEMField { @@ -151,8 +151,8 @@ namespace KEMField void AddIfNeumannBoundary(Int2Type); - double TriangleAspectRatio(KEMThreeVector P0, KEMThreeVector P1, KEMThreeVector P2); - double RectangleAspectRatio(KEMThreeVector P0, KEMThreeVector P1, KEMThreeVector P2, KEMThreeVector P3); + double TriangleAspectRatio(KThreeVector P0, KThreeVector P1, KThreeVector P2); + double RectangleAspectRatio(KThreeVector P0, KThreeVector P1, KThreeVector P2, KThreeVector P3); vtkSmartPointer fPoints; vtkSmartPointer fCells; @@ -268,21 +268,21 @@ namespace KEMField double length = (s->at(i)->GetP0()-s->at(i)->GetP1()).Magnitude(); - KEMThreeVector tmp1,tmp2; + KThreeVector tmp1,tmp2; for (unsigned int m=0;m<3;m++) { tmp1[m] = (s->at(i)->GetP1()[m]-s->at(i)->GetP0()[m])/length; tmp2[m] = (s->at(i)->GetP1()[(m+1)%3]-s->at(i)->GetP0()[(m+1)%3])/length; } - KEMThreeVector norm1,norm2; + KThreeVector norm1,norm2; for (unsigned int m=0;m<3;m++) norm1[m] = tmp1[(m+1)%3]*tmp2[(m+2)%3]-tmp1[(m+2)%3]*tmp2[(m+1)%3]; for (unsigned int m=0;m<3;m++) norm2[m] = (tmp1[(m+1)%3]*norm1[(m+2)%3] - tmp1[(m+2)%3]*norm1[(m+1)%3]); - KEMThreeVector p0,p1,p2,p3; + KThreeVector p0,p1,p2,p3; for (unsigned int k=0;kat(i)->GetP1()[2]; r[1] = sqrt(s->at(i)->GetP1()[0]*s->at(i)->GetP1()[0]+s->at(i)->GetP1()[1]*s->at(i)->GetP1()[1]); - KEMThreeVector p[2][2]; + KThreeVector p[2][2]; for (unsigned int k=0;kGetP0()-s->GetP1()).Magnitude(); - KEMThreeVector tmp1,tmp2; + KThreeVector tmp1,tmp2; for (unsigned int m=0;m<3;m++) { tmp1[m] = (s->GetP1()[m]-s->GetP0()[m])/length; tmp2[m] = (s->GetP1()[(m+1)%3]-s->GetP0()[(m+1)%3])/length; } - KEMThreeVector norm1,norm2; + KThreeVector norm1,norm2; for (unsigned int m=0;m<3;m++) norm1[m] = tmp1[(m+1)%3]*tmp2[(m+2)%3]-tmp1[(m+2)%3]*tmp2[(m+1)%3]; for (unsigned int m=0;m<3;m++) norm2[m] = (tmp1[(m+1)%3]*norm1[(m+2)%3] - tmp1[(m+2)%3]*norm1[(m+1)%3]); - KEMThreeVector p0,p1,p2,p3; + KThreeVector p0,p1,p2,p3; for (unsigned int k=0;kGetP1()[2]; r[1] = sqrt(s->GetP1()[0]*s->GetP1()[0]+s->GetP1()[1]*s->GetP1()[1]); - KEMThreeVector p[2][2]; + KThreeVector p[2][2]; for (unsigned int k=0;k b ) { max = a; - PA = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); - PB = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); - PC = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PA = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PB = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PC = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); } else { max = b; - PA = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); - PB = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); - PC = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PA = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PB = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PC = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); } if( c > max ) { max = c; - PA = KEMThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); - PB = KEMThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); - PC = KEMThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); + PA = KThreeVector( P0[ 0 ], P0[ 1 ], P0[ 2 ] ); + PB = KThreeVector( P1[ 0 ], P1[ 1 ], P1[ 2 ] ); + PC = KThreeVector( P2[ 0 ], P2[ 1 ], P2[ 2 ] ); } //the line pointing along v is the y-axis @@ -664,10 +664,10 @@ namespace KEMField } - double KEMVTKViewer::RectangleAspectRatio(KEMThreeVector P0, KEMThreeVector P1, KEMThreeVector P2, KEMThreeVector P3) + double KEMVTKViewer::RectangleAspectRatio(KThreeVector P0, KThreeVector P1, KThreeVector P2, KThreeVector P3) { //figure out which vertices make the sides - KEMThreeVector p[4]; + KThreeVector p[4]; p[0] = P0; p[1] = P1; p[2] = P2; diff --git a/KEMField/Source/Plugins/VTK/include/KFMVTKElectrostaticTreeViewer.hh b/KEMField/Source/Plugins/VTK/include/KFMVTKElectrostaticTreeViewer.hh index c697e6d47..d88e3f564 100644 --- a/KEMField/Source/Plugins/VTK/include/KFMVTKElectrostaticTreeViewer.hh +++ b/KEMField/Source/Plugins/VTK/include/KFMVTKElectrostaticTreeViewer.hh @@ -41,8 +41,7 @@ #include #include - -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" #include "KFMElectrostaticNode.hh" #include "KFMElectrostaticTree.hh" diff --git a/KEMField/Source/Plugins/VTKPart2/CMakeLists.txt b/KEMField/Source/Plugins/VTKPart2/CMakeLists.txt index 93bba7983..06b20f36e 100644 --- a/KEMField/Source/Plugins/VTKPart2/CMakeLists.txt +++ b/KEMField/Source/Plugins/VTKPart2/CMakeLists.txt @@ -14,12 +14,12 @@ set( VTK-PART2_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KVTKViewerAsBoundaryFieldVisitor.hh ) -if( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG) +if( ${PROJECT_NAME}_USE_VTK ) list( APPEND VTK-PART2_HEADERFILES ${CMAKE_CURRENT_SOURCE_DIR}/include/KElectrostaticPotentialmap.hh ${CMAKE_CURRENT_SOURCE_DIR}/include/KMagnetostaticFieldmap.hh ) -endif( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG) +endif( ${PROJECT_NAME}_USE_VTK ) #source files @@ -27,12 +27,12 @@ set( VTK-PART2_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KVTKViewerAsBoundaryFieldVisitor.cc ) -if( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG) +if( ${PROJECT_NAME}_USE_VTK ) list( APPEND VTK-PART2_SOURCEFILES ${CMAKE_CURRENT_SOURCE_DIR}/src/KElectrostaticPotentialmap.cc ${CMAKE_CURRENT_SOURCE_DIR}/src/KMagnetostaticFieldmap.cc ) -endif( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG) +endif( ${PROJECT_NAME}_USE_VTK ) #link libraries @@ -40,23 +40,21 @@ set( VTK-PART2_LINK_LIBRARIES KEMFieldsElectric KEMFieldsMagnetic ) -if( @PROJECT_NAME@_USE_VTK ) +if( ${PROJECT_NAME}_USE_VTK ) list( APPEND VTK-PART2_LINK_LIBRARIES KEMVTKPlugin ) -endif( @PROJECT_NAME@_USE_VTK ) +endif( ${PROJECT_NAME}_USE_VTK ) -if( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG ) +if( ${PROJECT_NAME}_USE_VTK ) list( APPEND VTK-PART2_LINK_LIBRARIES - ${KGEOBAG_LIBRARIES} - KGeoBagMath - KGeoBagCore - Kommon - ${VTK_LIBRARIES} + ${Kommon_LIBRARIES} + ${KGeoBag_LIBRARIES} + ${VTK_LIBRARIES} ) -endif( @PROJECT_NAME@_USE_VTK AND @PROJECT_NAME@_USE_KGEOBAG ) +endif( ${PROJECT_NAME}_USE_VTK ) add_library (KEMVTKPart2 SHARED ${VTK-PART2_SOURCEFILES} diff --git a/KEMField/Source/Plugins/VTKPart2/include/KElectrostaticPotentialmap.hh b/KEMField/Source/Plugins/VTKPart2/include/KElectrostaticPotentialmap.hh index 736934d1a..9f358f2c2 100644 --- a/KEMField/Source/Plugins/VTKPart2/include/KElectrostaticPotentialmap.hh +++ b/KEMField/Source/Plugins/VTKPart2/include/KElectrostaticPotentialmap.hh @@ -5,13 +5,13 @@ * Author: Jan Behrens */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KELECTROSTATICPOTENTIALMAP_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KELECTROSTATICPOTENTIALMAP_HH_ +#ifndef KELECTROSTATICPOTENTIALMAP_HH_ +#define KELECTROSTATICPOTENTIALMAP_HH_ /** * This implements a simplistic potential map interface into Kassiopeia. * - * It is inteded to provide a simple method to speed up tracking, + * It is intended to provide a simple method to speed up tracking, * without the need to take care about lots of parameters. * A much more advanced method would be FFTM/FMM, which is also * available in the current version of Kassiopeia. @@ -124,16 +124,16 @@ #include "KElectrostaticField.hh" #include +#include #include "KMPIEnvironment.hh" -#include "KEMThreeVector.hh" - #include "KGCore.hh" #include #include #include #include +#include "KThreeVector_KEMField.hh" namespace KEMField { @@ -148,7 +148,7 @@ namespace KEMField { public: virtual bool GetPotential( const KPosition& aSamplePoint, const double& aSampleTime, double& aPotential ) const; - virtual bool GetField( const KPosition& aSamplePoint, const double& aSampleTime, KEMThreeVector& aField ) const; + virtual bool GetField( const KPosition& aSamplePoint, const double& aSampleTime, KThreeVector& aField ) const; protected: vtkImageData *fImageData; @@ -197,14 +197,14 @@ namespace KEMField { private: virtual double PotentialCore(const KPosition& P ) const; - virtual KEMThreeVector ElectricFieldCore(const KPosition& P) const; + virtual KThreeVector ElectricFieldCore(const KPosition& P) const; virtual void InitializeCore(); private: std::string fDirectory; std::string fFile; int fInterpolation; - KSmartPointer fPotentialMap; + std::shared_ptr fPotentialMap; }; //////////////////////////////////////////////////////////////////// @@ -228,7 +228,7 @@ namespace KEMField { { fCenter = aCenter; } - void SetLength( KEMThreeVector aLength ) + void SetLength( KThreeVector aLength ) { fLength = aLength; } @@ -292,7 +292,7 @@ namespace KEMField { std::string fFile; std::string fName; KPosition fCenter; - KEMThreeVector fLength; + KThreeVector fLength; bool fMirrorX, fMirrorY, fMirrorZ; double fSpacing; KElectrostaticField *fElectricField; @@ -306,4 +306,4 @@ namespace KEMField { } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KELECTROSTATICPOTENTIALMAP_HH_ */ +#endif /* KELECTROSTATICPOTENTIALMAP_HH_ */ diff --git a/KEMField/Source/Plugins/VTKPart2/include/KMagnetostaticFieldmap.hh b/KEMField/Source/Plugins/VTKPart2/include/KMagnetostaticFieldmap.hh index ed3c776ce..67f67fe35 100644 --- a/KEMField/Source/Plugins/VTKPart2/include/KMagnetostaticFieldmap.hh +++ b/KEMField/Source/Plugins/VTKPart2/include/KMagnetostaticFieldmap.hh @@ -5,15 +5,15 @@ * Author: Jan Behrens */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KMAGNETOSTATICPOTENTIALMAP_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KMAGNETOSTATICPOTENTIALMAP_HH_ +#ifndef KMAGNETOSTATICPOTENTIALMAP_HH_ +#define KMAGNETOSTATICPOTENTIALMAP_HH_ /** * (Note: this text refers to electric maps, but magnetic maps are similar.) * * This implements a simplistic potential map interface into Kassiopeia. * - * It is inteded to provide a simple method to speed up tracking, + * It is intended to provide a simple method to speed up tracking, * without the need to take care about lots of parameters. * A much more advanced method would be FFTM/FMM, which is also * available in the current version of Kassiopeia. @@ -126,16 +126,16 @@ #include "KMagnetostaticField.hh" #include +#include #include "KMPIEnvironment.hh" -#include "KEMThreeVector.hh" - #include "KGCore.hh" #include #include #include #include +#include "KThreeVector_KEMField.hh" namespace KEMField { @@ -149,7 +149,8 @@ namespace KEMField { virtual bool GetValue( const std::string& array, const KPosition& aSamplePoint, double *aValue ) const; public: - virtual bool GetField( const KPosition& aSamplePoint, const double& aSampleTime, KEMThreeVector& aField ) const; + virtual bool GetField( const KPosition& aSamplePoint, const double& aSampleTime, KThreeVector& aField ) const; + virtual bool GetGradient( const KPosition& aSamplePoint, const double& aSampleTime, KGradient& aGradient ) const; protected: vtkImageData *fImageData; @@ -197,8 +198,8 @@ namespace KEMField { void SetInterpolation( const std::string& aMode ); private: - virtual KEMThreeVector MagneticPotentialCore(const KPosition& P) const; - virtual KEMThreeVector MagneticFieldCore(const KPosition& P) const; + virtual KThreeVector MagneticPotentialCore(const KPosition& P) const; + virtual KThreeVector MagneticFieldCore(const KPosition& P) const; virtual KGradient MagneticGradientCore(const KPosition& P) const; virtual void InitializeCore(); @@ -206,7 +207,7 @@ namespace KEMField { std::string fDirectory; std::string fFile; int fInterpolation; - KSmartPointer fFieldMap; + std::shared_ptr fFieldMap; }; //////////////////////////////////////////////////////////////////// @@ -230,7 +231,7 @@ namespace KEMField { { fCenter = aCenter; } - void SetLength( KEMThreeVector aLength ) + void SetLength( KThreeVector aLength ) { fLength = aLength; } @@ -294,7 +295,7 @@ namespace KEMField { std::string fFile; std::string fName; KPosition fCenter; - KEMThreeVector fLength; + KThreeVector fLength; bool fMirrorX, fMirrorY, fMirrorZ; double fSpacing; KMagnetostaticField *fMagneticField; @@ -307,4 +308,4 @@ namespace KEMField { } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KMAGNETOSTATICPOTENTIALMAP_HH_ */ +#endif /* KMAGNETOSTATICPOTENTIALMAP_HH_ */ diff --git a/KEMField/Source/Plugins/VTKPart2/include/KVTKViewerAsBoundaryFieldVisitor.hh b/KEMField/Source/Plugins/VTKPart2/include/KVTKViewerAsBoundaryFieldVisitor.hh index 89071abc4..ecfcac4b7 100644 --- a/KEMField/Source/Plugins/VTKPart2/include/KVTKViewerAsBoundaryFieldVisitor.hh +++ b/KEMField/Source/Plugins/VTKPart2/include/KVTKViewerAsBoundaryFieldVisitor.hh @@ -5,8 +5,8 @@ * Author: wolfgang */ -#ifndef KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ -#define KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ +#ifndef KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ +#define KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ #include "KElectrostaticBoundaryField.hh" @@ -56,4 +56,4 @@ private: } /* namespace KEMField */ -#endif /* KEMFIELD_SOURCE_2_0_PLUGINS_VTK_INCLUDE_KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ */ +#endif /* KVTKVIEWERASBOUNDARYFIELDVISITOR_HH_ */ diff --git a/KEMField/Source/Plugins/VTKPart2/src/KElectrostaticPotentialmap.cc b/KEMField/Source/Plugins/VTKPart2/src/KElectrostaticPotentialmap.cc index 698674855..3f24b4bae 100644 --- a/KEMField/Source/Plugins/VTKPart2/src/KElectrostaticPotentialmap.cc +++ b/KEMField/Source/Plugins/VTKPart2/src/KElectrostaticPotentialmap.cc @@ -9,7 +9,6 @@ #include "KFile.h" #include "KEMFileInterface.hh" -#include "KEMVectorConverters.hh" #include "KEMCout.hh" #include "KEMSimpleException.hh" @@ -71,7 +70,7 @@ bool KPotentialMapVTK::GetPotential( const KPosition& aSamplePoint, const double return false; } -bool KPotentialMapVTK::GetField( const KPosition& aSamplePoint, const double& /*aSampleTime*/, KEMThreeVector& aField ) const +bool KPotentialMapVTK::GetField( const KPosition& aSamplePoint, const double& /*aSampleTime*/, KThreeVector& aField ) const { //fieldmsg_debug( "sampling electric field at point " << aSamplePoint << eom); @@ -109,16 +108,16 @@ bool KLinearInterpolationPotentialMapVTK::GetValue( const string& array, const K { 0, 1, 1 }, // c011 { 1, 1, 1 }, // c111 }; - static KEMThreeVector vertices[8]; + static KThreeVector vertices[8]; static double values[3][8]; // always allocate for vectors even if we have scalars (to be safe) - note that array ordering is swapped double *spacing = fImageData->GetSpacing(); //compute corner point of mesh cell aSamplePoint belongs to - KEMThreeVector start_point = KEMThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); + KThreeVector start_point = KThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); for ( int i = 0; i < 8; i++ ) { // first compute the coordinates of the surrounding mesh points ... - KEMThreeVector point = start_point + KEMThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); + KThreeVector point = start_point + KThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); vtkIdType corner = fImageData->FindPoint( (double*)(point.Components()) ); if (corner < 0) return false; @@ -247,16 +246,16 @@ bool KCubicInterpolationPotentialMapVTK::GetValue( const string& array, const KP { 2, 2, 1 }, { 2, 2, 2 }, }; - static KEMThreeVector vertices[64]; + static KThreeVector vertices[64]; static double values[3][64]; // always allocate for vectors even if we have scalars (to be safe) - note that array ordering is swapped double *spacing = fImageData->GetSpacing(); //compute corner point of mesh cell aSamplePoint belongs to - KEMThreeVector start_point = KEMThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); + KThreeVector start_point = KThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); for ( int i = 0; i < 64; i++ ) { // first compute the coordinates of the surrounding mesh points ... - KEMThreeVector point = start_point + KEMThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); + KThreeVector point = start_point + KThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); vtkIdType corner = fImageData->FindPoint( (double*)(point.Components()) ); if (corner < 0) return false; @@ -325,9 +324,9 @@ double KElectrostaticPotentialmap::PotentialCore( const KPosition& P) const return tPotential; } -KEMThreeVector KElectrostaticPotentialmap::ElectricFieldCore( const KPosition& P) const +KThreeVector KElectrostaticPotentialmap::ElectricFieldCore( const KPosition& P) const { - KEMThreeVector tField; + KThreeVector tField; tField.SetComponents(0.,0.,0.); double aRandomTime = 0; if (! fPotentialMap->GetField( P, aRandomTime, tField )) @@ -369,13 +368,13 @@ void KElectrostaticPotentialmap::InitializeCore() switch ( fInterpolation ) { case 0: - fPotentialMap = new KPotentialMapVTK( filename ); + fPotentialMap = std::make_shared< KPotentialMapVTK >( filename ); break; case 1: - fPotentialMap = new KLinearInterpolationPotentialMapVTK( filename ); + fPotentialMap = std::make_shared< KLinearInterpolationPotentialMapVTK >( filename ); break; case 3: - fPotentialMap = new KCubicInterpolationPotentialMapVTK( filename ); + fPotentialMap = std::make_shared< KCubicInterpolationPotentialMapVTK >( filename ); break; default: throw KEMSimpleException( "interpolation mode " + std::to_string(fInterpolation) + " is not implemented"); @@ -414,7 +413,7 @@ bool KElectrostaticPotentialmapCalculator::CheckPosition( const KPosition& aPosi for ( auto tSpaceIt = fSpaces.begin(); tSpaceIt != fSpaces.end(); ++tSpaceIt ) { const KGeoBag::KGSpace *tSpace = (*tSpaceIt); - if ( tSpace->Outside( KEM2KThreeVector(aPosition) ) == false ) + if ( tSpace->Outside( aPosition ) == false ) return true; } return false; @@ -451,8 +450,8 @@ void KElectrostaticPotentialmapCalculator::Prepare() return; } - KEMThreeVector tGridDims = KEMThreeVector( 1 + fLength[0]/fSpacing, 1 + fLength[1]/fSpacing, 1 + fLength[2]/fSpacing ); - KEMThreeVector tGridOrigin = fCenter - 0.5*fLength; + KThreeVector tGridDims = KThreeVector( 1 + fLength[0]/fSpacing, 1 + fLength[1]/fSpacing, 1 + fLength[2]/fSpacing ); + KThreeVector tGridOrigin = fCenter - 0.5*fLength; if ((ceil(tGridDims[0]) <= 0) || (ceil(tGridDims[1]) <= 0) || (ceil(tGridDims[2]) <= 0)) { @@ -585,7 +584,7 @@ void KElectrostaticPotentialmapCalculator::Execute() if (! tHasValue) { - tPotential = fElectricField->Potential(KEMThreeVector(tPoint)); + tPotential = fElectricField->Potential(KThreeVector(tPoint)); } fPotentialData->SetTuple1(i, tPotential); @@ -620,7 +619,7 @@ void KElectrostaticPotentialmapCalculator::Execute() continue; bool tHasValue = false; - KEMThreeVector tField; + KThreeVector tField; if (fMirrorX || fMirrorY || fMirrorZ) { diff --git a/KEMField/Source/Plugins/VTKPart2/src/KMagnetostaticFieldmap.cc b/KEMField/Source/Plugins/VTKPart2/src/KMagnetostaticFieldmap.cc index a351af45a..19f5046dc 100644 --- a/KEMField/Source/Plugins/VTKPart2/src/KMagnetostaticFieldmap.cc +++ b/KEMField/Source/Plugins/VTKPart2/src/KMagnetostaticFieldmap.cc @@ -9,7 +9,6 @@ #include "KFile.h" #include "KEMFileInterface.hh" -#include "KEMVectorConverters.hh" #include "KEMCout.hh" #include "KEMSimpleException.hh" @@ -58,7 +57,7 @@ bool KMagfieldMapVTK::GetValue( const string& array, const KPosition& aSamplePoi return true; } -bool KMagfieldMapVTK::GetField( const KPosition& aSamplePoint, const double& /*aSampleTime*/, KEMThreeVector& aField ) const +bool KMagfieldMapVTK::GetField( const KPosition& aSamplePoint, const double& /*aSampleTime*/, KThreeVector& aField ) const { //fieldmsg_debug( "sampling magnetic field at point " << aSamplePoint << eom); @@ -71,6 +70,19 @@ bool KMagfieldMapVTK::GetField( const KPosition& aSamplePoint, const double& /*a return false; } +bool KMagfieldMapVTK::GetGradient( const KPosition& aSamplePoint, const double& /*aSampleTime*/, KGradient& aGradient ) const +{ + //fieldmsg_debug( "sampling magnetic gradient at point " << aSamplePoint << eom); + + double value[9]; + if ( GetValue( "magnetic gradient", aSamplePoint, value ) ) + { + aGradient.SetComponents( value ); + return true; + } + return false; +} + KLinearInterpolationMagfieldMapVTK::KLinearInterpolationMagfieldMapVTK( const string& aFilename ) : KMagfieldMapVTK( aFilename ) { @@ -96,16 +108,16 @@ bool KLinearInterpolationMagfieldMapVTK::GetValue( const string& array, const KP { 0, 1, 1 }, // c011 { 1, 1, 1 }, // c111 }; - static KEMThreeVector vertices[8]; - static double values[3][8]; // always allocate for vectors even if we have scalars (to be safe) - note that array ordering is swapped + static KThreeVector vertices[8]; + static double values[9][8]; // always allocate for matrices even if we have scalars (to be safe) - note that array ordering is swapped double *spacing = fImageData->GetSpacing(); //compute corner point of mesh cell aSamplePoint belongs to - KEMThreeVector start_point = KEMThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); + KThreeVector start_point = KThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); for ( int i = 0; i < 8; i++ ) { // first compute the coordinates of the surrounding mesh points ... - KEMThreeVector point = start_point + KEMThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); + KThreeVector point = start_point + KThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); vtkIdType corner = fImageData->FindPoint( (double*)(point.Components()) ); if (corner < 0) return false; @@ -234,16 +246,16 @@ bool KCubicInterpolationMagfieldMapVTK::GetValue( const string& array, const KPo { 2, 2, 1 }, { 2, 2, 2 }, }; - static KEMThreeVector vertices[64]; - static double values[3][64]; // always allocate for vectors even if we have scalars (to be safe) - note that array ordering is swapped + static KThreeVector vertices[64]; + static double values[9][64]; // always allocate for matrices even if we have scalars (to be safe) - note that array ordering is swapped double *spacing = fImageData->GetSpacing(); //compute corner point of mesh cell aSamplePoint belongs to - KEMThreeVector start_point = KEMThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); + KThreeVector start_point = KThreeVector(floor(aSamplePoint.X()/spacing[0])*spacing[0], floor(aSamplePoint.Y()/spacing[1])*spacing[1], floor(aSamplePoint.Z()/spacing[2])*spacing[2]); for ( int i = 0; i < 64; i++ ) { // first compute the coordinates of the surrounding mesh points ... - KEMThreeVector point = start_point + KEMThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); + KThreeVector point = start_point + KThreeVector(map[i][0]*spacing[0], map[i][1]*spacing[1], map[i][2]*spacing[2] ); vtkIdType corner = fImageData->FindPoint( (double*)(point.Components()) ); if (corner < 0) return false; @@ -302,16 +314,16 @@ KMagnetostaticFieldmap::~KMagnetostaticFieldmap() { } -KEMThreeVector KMagnetostaticFieldmap::MagneticPotentialCore( const KPosition& /*P*/) const +KThreeVector KMagnetostaticFieldmap::MagneticPotentialCore( const KPosition& /*P*/) const { - KEMThreeVector tPotential; + KThreeVector tPotential; tPotential.SetComponents(0.,0.,0.); return tPotential; } -KEMThreeVector KMagnetostaticFieldmap::MagneticFieldCore( const KPosition& P) const +KThreeVector KMagnetostaticFieldmap::MagneticFieldCore( const KPosition& P) const { - KEMThreeVector tField; + KThreeVector tField; tField.SetComponents(0.,0.,0.); double aRandomTime = 0; if (! fFieldMap->GetField( P, aRandomTime, tField )) @@ -320,9 +332,13 @@ KEMThreeVector KMagnetostaticFieldmap::MagneticFieldCore( const KPosition& P) co return tField; } -KGradient KMagnetostaticFieldmap::MagneticGradientCore( const KPosition& /*P*/) const +KGradient KMagnetostaticFieldmap::MagneticGradientCore( const KPosition& P) const { KGradient tGradient(KGradient::sZero); + double aRandomTime = 0; + if (! fFieldMap->GetGradient( P, aRandomTime, tGradient )) + cout << "WARNING: could not compute magnetic gradient at sample point " << P << endl; + return tGradient; } @@ -359,13 +375,13 @@ void KMagnetostaticFieldmap::InitializeCore() switch ( fInterpolation ) { case 0: - fFieldMap = new KMagfieldMapVTK( filename ); + fFieldMap = std::make_shared< KMagfieldMapVTK >( filename ); break; case 1: - fFieldMap = new KLinearInterpolationMagfieldMapVTK( filename ); + fFieldMap = std::make_shared< KLinearInterpolationMagfieldMapVTK >( filename ); break; case 3: - fFieldMap = new KCubicInterpolationMagfieldMapVTK( filename ); + fFieldMap = std::make_shared< KCubicInterpolationMagfieldMapVTK >( filename ); break; default: throw KEMSimpleException( "interpolation mode " + std::to_string(fInterpolation) + " is not implemented"); @@ -404,7 +420,7 @@ bool KMagnetostaticFieldmapCalculator::CheckPosition( const KPosition& aPosition for ( auto tSpaceIt = fSpaces.begin(); tSpaceIt != fSpaces.end(); ++tSpaceIt ) { const KGeoBag::KGSpace *tSpace = (*tSpaceIt); - if ( tSpace->Outside( KEM2KThreeVector(aPosition) ) == false ) + if ( tSpace->Outside( aPosition ) == false ) return true; } return false; @@ -441,8 +457,8 @@ void KMagnetostaticFieldmapCalculator::Prepare() return; } - KEMThreeVector tGridDims = KEMThreeVector( 1 + fLength[0]/fSpacing, 1 + fLength[1]/fSpacing, 1 + fLength[2]/fSpacing ); - KEMThreeVector tGridOrigin = fCenter - 0.5*fLength; + KThreeVector tGridDims = KThreeVector( 1 + fLength[0]/fSpacing, 1 + fLength[1]/fSpacing, 1 + fLength[2]/fSpacing ); + KThreeVector tGridOrigin = fCenter - 0.5*fLength; if ((ceil(tGridDims[0]) <= 0) || (ceil(tGridDims[1]) <= 0) || (ceil(tGridDims[2]) <= 0)) { @@ -541,7 +557,7 @@ void KMagnetostaticFieldmapCalculator::Execute() continue; bool tHasValue = false; - KEMThreeVector tField; + KThreeVector tField; if (fMirrorX || fMirrorY || fMirrorZ) { diff --git a/KEMField/Source/Surfaces/CMakeLists.txt b/KEMField/Source/Surfaces/CMakeLists.txt index ff9bda0a4..3a2ef7728 100644 --- a/KEMField/Source/Surfaces/CMakeLists.txt +++ b/KEMField/Source/Surfaces/CMakeLists.txt @@ -1,4 +1,4 @@ -# CMakeLists for KEMField/Surfaces +# CMakeLists for KEMField/Geometry/Surfaces # Author: T.J. Corona kasper_internal_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -44,7 +44,7 @@ set (SURFACES_SOURCEFILES ################################################## add_library (KEMSurfaces SHARED ${SURFACES_SOURCEFILES}) -target_link_libraries (KEMSurfaces KEMCore KEMMath KEMIO) +target_link_libraries (KEMSurfaces KEMCore KEMMath KEMIO ${Kommon_LIBRARIES} ${KGeoBag_LIBRARIES}) kasper_install_headers (${SURFACES_HEADERFILES}) kasper_install_libraries (KEMSurfaces) diff --git a/KEMField/Source/Surfaces/include/KConicSection.hh b/KEMField/Source/Surfaces/include/KConicSection.hh index 597a7828a..6426332e0 100644 --- a/KEMField/Source/Surfaces/include/KConicSection.hh +++ b/KEMField/Source/Surfaces/include/KConicSection.hh @@ -1,9 +1,8 @@ #ifndef KCONICSECTION_DEF #define KCONICSECTION_DEF -#include "KShape.hh" - -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KShape.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KElectromagneticBasis.hh b/KEMField/Source/Surfaces/include/KElectromagneticBasis.hh index f3df86c90..eb5edf2d5 100644 --- a/KEMField/Source/Surfaces/include/KElectromagneticBasis.hh +++ b/KEMField/Source/Surfaces/include/KElectromagneticBasis.hh @@ -4,7 +4,7 @@ #include #include -#include "KBasis.hh" +#include "../../../Surfaces/include/KBasis.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KElectrostaticBasis.hh b/KEMField/Source/Surfaces/include/KElectrostaticBasis.hh index 896112a03..efee963b7 100644 --- a/KEMField/Source/Surfaces/include/KElectrostaticBasis.hh +++ b/KEMField/Source/Surfaces/include/KElectrostaticBasis.hh @@ -3,7 +3,7 @@ #include -#include "KBasis.hh" +#include "../../../Surfaces/include/KBasis.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KLineSegment.hh b/KEMField/Source/Surfaces/include/KLineSegment.hh index 5dd26a249..f114560cd 100644 --- a/KEMField/Source/Surfaces/include/KLineSegment.hh +++ b/KEMField/Source/Surfaces/include/KLineSegment.hh @@ -1,9 +1,8 @@ #ifndef KLINESEGMENT_DEF #define KLINESEGMENT_DEF -#include "KShape.hh" - -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KShape.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KMagnetostaticBasis.hh b/KEMField/Source/Surfaces/include/KMagnetostaticBasis.hh index fc84c5d83..a740e190b 100644 --- a/KEMField/Source/Surfaces/include/KMagnetostaticBasis.hh +++ b/KEMField/Source/Surfaces/include/KMagnetostaticBasis.hh @@ -3,7 +3,7 @@ #include -#include "KBasis.hh" +#include "../../../Surfaces/include/KBasis.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KOrderedSurfaceContainer.hh b/KEMField/Source/Surfaces/include/KOrderedSurfaceContainer.hh index 450f90147..6902eec7d 100644 --- a/KEMField/Source/Surfaces/include/KOrderedSurfaceContainer.hh +++ b/KEMField/Source/Surfaces/include/KOrderedSurfaceContainer.hh @@ -4,8 +4,8 @@ #include #include -#include "KSurfaceContainer.hh" -#include "KSurfaceOrderingPredicate.hh" +#include "../../../Surfaces/include/KSurfaceContainer.hh" +#include "../../../Surfaces/include/KSurfaceOrderingPredicate.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KRectangle.hh b/KEMField/Source/Surfaces/include/KRectangle.hh index 6c0e4741f..ea0dc5672 100644 --- a/KEMField/Source/Surfaces/include/KRectangle.hh +++ b/KEMField/Source/Surfaces/include/KRectangle.hh @@ -1,9 +1,8 @@ #ifndef KRECTANGLE_DEF #define KRECTANGLE_DEF -#include "KShape.hh" - -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KShape.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KRing.hh b/KEMField/Source/Surfaces/include/KRing.hh index 569095580..417f2308d 100644 --- a/KEMField/Source/Surfaces/include/KRing.hh +++ b/KEMField/Source/Surfaces/include/KRing.hh @@ -1,9 +1,8 @@ #ifndef KRING_DEF #define KRING_DEF -#include "KShape.hh" - -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KShape.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KShape.hh b/KEMField/Source/Surfaces/include/KShape.hh index 1c85f406d..5aeedd56d 100644 --- a/KEMField/Source/Surfaces/include/KShape.hh +++ b/KEMField/Source/Surfaces/include/KShape.hh @@ -3,7 +3,7 @@ #include -#include "KEMThreeVector.hh" +#include "KThreeVector_KEMField.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KSolidAngle.hh b/KEMField/Source/Surfaces/include/KSolidAngle.hh index ac87677d9..ae6281245 100644 --- a/KEMField/Source/Surfaces/include/KSolidAngle.hh +++ b/KEMField/Source/Surfaces/include/KSolidAngle.hh @@ -1,12 +1,13 @@ #ifndef KSOLIDANGLE_H_ #define KSOLIDANGLE_H_ -#include "KSurface.hh" -#include "KEMThreeVector.hh" #include "KEMConstants.hh" #include +#include "KSurface.hh" +#include "KThreeVector_KEMField.hh" + #define POW2(x) ((x)*(x)) namespace KEMField @@ -17,7 +18,7 @@ namespace KEMField * * @brief A class for computing solid angles from Euler-Eriksson's formula as described in paper PIER 63, 243-278, 2006 * - * @author D. Hilk + * @author Daniel Hilk */ class KSolidAngle @@ -32,7 +33,7 @@ public: double SolidAngleRectangleAsArray( const double* data, const double* P ) const; private: - const double fMinDistance = 1.e-15; /* for check if field point is on surface */ + const double fMinDistance = 1.e-12; /* for check if field point is on surface */ }; diff --git a/KEMField/Source/Surfaces/include/KSortedSurfaceContainer.hh b/KEMField/Source/Surfaces/include/KSortedSurfaceContainer.hh index a4cf8ce7e..916048c32 100644 --- a/KEMField/Source/Surfaces/include/KSortedSurfaceContainer.hh +++ b/KEMField/Source/Surfaces/include/KSortedSurfaceContainer.hh @@ -1,7 +1,7 @@ #ifndef KSORTEDSURFACECONTAINER_DEF #define KSORTEDSURFACECONTAINER_DEF -#include "KSurfaceContainer.hh" +#include "../../../Surfaces/include/KSurfaceContainer.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KSurface.hh b/KEMField/Source/Surfaces/include/KSurface.hh index 3aea39a72..90836aed4 100644 --- a/KEMField/Source/Surfaces/include/KSurface.hh +++ b/KEMField/Source/Surfaces/include/KSurface.hh @@ -4,9 +4,9 @@ #include #include -#include "KSurfaceID.hh" -#include "KSurfacePrimitive.hh" -#include "KSurfaceVisitors.hh" +#include "../../../Surfaces/include/KSurfaceID.hh" +#include "../../../Surfaces/include/KSurfacePrimitive.hh" +#include "../../../Surfaces/include/KSurfaceVisitors.hh" namespace KEMField { @@ -108,7 +108,7 @@ namespace KEMField } } -#include "KSurfaceAction.hh" +#include "../../../Surfaces/include/KSurfaceAction.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KSurfaceAction.hh b/KEMField/Source/Surfaces/include/KSurfaceAction.hh index de9c92707..ca255b612 100644 --- a/KEMField/Source/Surfaces/include/KSurfaceAction.hh +++ b/KEMField/Source/Surfaces/include/KSurfaceAction.hh @@ -1,3 +1,4 @@ + #ifndef KSURFACE_DEF #error "Do not include KSurfaceAction.hh directly. Include KSurface.hh instead." #endif @@ -8,8 +9,8 @@ #include "KTypeManipulation.hh" #include "KFundamentalTypeCounter.hh" -#include "KSurfaceID.hh" -#include "KSurfaceTypes.hh" +#include "../../../Surfaces/include/KSurfaceID.hh" +#include "../../../Surfaces/include/KSurfaceTypes.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KSurfaceContainer.hh b/KEMField/Source/Surfaces/include/KSurfaceContainer.hh index 876a9f4af..30e8fe2a0 100644 --- a/KEMField/Source/Surfaces/include/KSurfaceContainer.hh +++ b/KEMField/Source/Surfaces/include/KSurfaceContainer.hh @@ -3,7 +3,7 @@ #include -#include "KSurface.hh" +#include "../../../Surfaces/include/KSurface.hh" #include "KSmartPointer.hh" namespace KEMField diff --git a/KEMField/Source/Surfaces/include/KSurfaceOrderingPredicate.hh b/KEMField/Source/Surfaces/include/KSurfaceOrderingPredicate.hh index 125e242ff..efc592416 100644 --- a/KEMField/Source/Surfaces/include/KSurfaceOrderingPredicate.hh +++ b/KEMField/Source/Surfaces/include/KSurfaceOrderingPredicate.hh @@ -1,8 +1,8 @@ #ifndef KSurfaceOrderingPredicate_HH__ #define KSurfaceOrderingPredicate_HH__ -#include "KSurfaceVisitors.hh" -#include "KSurfaceContainer.hh" +#include "../../../Surfaces/include/KSurfaceContainer.hh" +#include "../../../Surfaces/include/KSurfaceVisitors.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/include/KSurfaceTypes.hh b/KEMField/Source/Surfaces/include/KSurfaceTypes.hh index 1fb5a644d..bbb9e4cc5 100644 --- a/KEMField/Source/Surfaces/include/KSurfaceTypes.hh +++ b/KEMField/Source/Surfaces/include/KSurfaceTypes.hh @@ -78,19 +78,19 @@ namespace KEMField typedef NoDuplicates::Result KShapeTypes; } -#include "KSurfaceVisitors.hh" +#include "../../../Surfaces/include/KSurfaceVisitors.hh" -#include "KElectrostaticBasis.hh" -#include "KMagnetostaticBasis.hh" -#include "KElectromagneticBasis.hh" +#include "../../../Surfaces/include/KElectrostaticBasis.hh" +#include "../../../Surfaces/include/KMagnetostaticBasis.hh" +#include "../../../Surfaces/include/KElectromagneticBasis.hh" -#include "KBoundary.hh" +#include "../../../Surfaces/include/KBoundary.hh" -#include "KTriangle.hh" -#include "KRectangle.hh" -#include "KLineSegment.hh" -#include "KConicSection.hh" -#include "KRing.hh" -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KTriangle.hh" +#include "../../../Surfaces/include/KRectangle.hh" +#include "../../../Surfaces/include/KLineSegment.hh" +#include "../../../Surfaces/include/KConicSection.hh" +#include "../../../Surfaces/include/KRing.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" #endif /* KSURFACETYPES_DEF */ diff --git a/KEMField/Source/Surfaces/include/KSurfaceVisitors.hh b/KEMField/Source/Surfaces/include/KSurfaceVisitors.hh index b033fbfdc..deb662b91 100644 --- a/KEMField/Source/Surfaces/include/KSurfaceVisitors.hh +++ b/KEMField/Source/Surfaces/include/KSurfaceVisitors.hh @@ -1,8 +1,7 @@ #ifndef KSURFACEVISITORS_DEF #define KSURFACEVISITORS_DEF -#include "KSurfaceTypes.hh" - +#include "../../../Surfaces/include/KSurfaceTypes.hh" #include "KTypelistVisitor.hh" namespace KEMField diff --git a/KEMField/Source/Surfaces/include/KSymmetryGroup.hh b/KEMField/Source/Surfaces/include/KSymmetryGroup.hh index 55af390bd..bf13dec47 100644 --- a/KEMField/Source/Surfaces/include/KSymmetryGroup.hh +++ b/KEMField/Source/Surfaces/include/KSymmetryGroup.hh @@ -3,9 +3,9 @@ #include +#include "../../../Surfaces/include/KShape.hh" #include "KEMConstants.hh" -#include "KShape.hh" #include "KEMTransformation.hh" namespace KEMField @@ -64,8 +64,8 @@ namespace KEMField ShapePolicy* NewElement(); - void AddReflectionThroughPlane(const KEMThreeVector& planePosition, const KEMThreeVector& planeNormal); - void AddRotationsAboutAxis(const KEMThreeVector& axisPosition, const KEMThreeVector& axisDirection, unsigned int nRepeatedElements); + void AddReflectionThroughPlane(const KThreeVector& planePosition, const KThreeVector& planeNormal); + void AddRotationsAboutAxis(const KThreeVector& axisPosition, const KThreeVector& axisDirection, unsigned int nRepeatedElements); unsigned int NumberOfReflections() const { return fNReflections; } unsigned int NumberOfRotatedElements() const { return fNRotations; } @@ -151,7 +151,7 @@ namespace KEMField } template - void KSymmetryGroup::AddReflectionThroughPlane(const KEMThreeVector& planePosition, const KEMThreeVector& planeNormal) + void KSymmetryGroup::AddReflectionThroughPlane(const KThreeVector& planePosition, const KThreeVector& planeNormal) { fNReflections++; @@ -169,7 +169,7 @@ namespace KEMField } template - void KSymmetryGroup::AddRotationsAboutAxis(const KEMThreeVector& axisPosition, const KEMThreeVector& axisDirection, unsigned int nRepeatedElements) + void KSymmetryGroup::AddRotationsAboutAxis(const KThreeVector& axisPosition, const KThreeVector& axisDirection, unsigned int nRepeatedElements) { if (fNRotations) fOther = true; diff --git a/KEMField/Source/Surfaces/include/KTriangle.hh b/KEMField/Source/Surfaces/include/KTriangle.hh index 237d683f2..7ab16ba72 100644 --- a/KEMField/Source/Surfaces/include/KTriangle.hh +++ b/KEMField/Source/Surfaces/include/KTriangle.hh @@ -1,9 +1,8 @@ #ifndef KTRIANGLE_DEF #define KTRIANGLE_DEF -#include "KShape.hh" - -#include "KSymmetryGroup.hh" +#include "../../../Surfaces/include/KShape.hh" +#include "../../../Surfaces/include/KSymmetryGroup.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/src/KConicSection.cc b/KEMField/Source/Surfaces/src/KConicSection.cc index c129c53f3..0e6c1aa66 100644 --- a/KEMField/Source/Surfaces/src/KConicSection.cc +++ b/KEMField/Source/Surfaces/src/KConicSection.cc @@ -1,4 +1,4 @@ -#include "KConicSection.hh" +#include "../../../Surfaces/include/KConicSection.hh" #include "KEMConstants.hh" diff --git a/KEMField/Source/Surfaces/src/KLineSegment.cc b/KEMField/Source/Surfaces/src/KLineSegment.cc index 0df3f2cca..7c9450061 100644 --- a/KEMField/Source/Surfaces/src/KLineSegment.cc +++ b/KEMField/Source/Surfaces/src/KLineSegment.cc @@ -1,4 +1,4 @@ -#include "KLineSegment.hh" +#include "../../../Surfaces/include/KLineSegment.hh" #include diff --git a/KEMField/Source/Surfaces/src/KOrderedSurfaceContainer.cc b/KEMField/Source/Surfaces/src/KOrderedSurfaceContainer.cc index 3ea27f0e7..a2c7399ff 100644 --- a/KEMField/Source/Surfaces/src/KOrderedSurfaceContainer.cc +++ b/KEMField/Source/Surfaces/src/KOrderedSurfaceContainer.cc @@ -1,4 +1,4 @@ -#include "KOrderedSurfaceContainer.hh" +#include "../../../Surfaces/include/KOrderedSurfaceContainer.hh" #include diff --git a/KEMField/Source/Surfaces/src/KRectangle.cc b/KEMField/Source/Surfaces/src/KRectangle.cc index 33cbca7c1..d1b44ae7a 100644 --- a/KEMField/Source/Surfaces/src/KRectangle.cc +++ b/KEMField/Source/Surfaces/src/KRectangle.cc @@ -1,4 +1,4 @@ -#include "KRectangle.hh" +#include "../../../Surfaces/include/KRectangle.hh" #include diff --git a/KEMField/Source/Surfaces/src/KRing.cc b/KEMField/Source/Surfaces/src/KRing.cc index 300f75920..e673afac1 100644 --- a/KEMField/Source/Surfaces/src/KRing.cc +++ b/KEMField/Source/Surfaces/src/KRing.cc @@ -1,6 +1,6 @@ -#include "KRing.hh" -#include "KSurfaceVisitors.hh" +#include "../../../Surfaces/include/KRing.hh" +#include "../../../Surfaces/include/KSurfaceVisitors.hh" #include "KEMConstants.hh" namespace KEMField diff --git a/KEMField/Source/Surfaces/src/KSortedSurfaceContainer.cc b/KEMField/Source/Surfaces/src/KSortedSurfaceContainer.cc index 7f8fccabe..5d247f365 100644 --- a/KEMField/Source/Surfaces/src/KSortedSurfaceContainer.cc +++ b/KEMField/Source/Surfaces/src/KSortedSurfaceContainer.cc @@ -1,4 +1,4 @@ -#include "KSortedSurfaceContainer.hh" +#include "../../../Surfaces/include/KSortedSurfaceContainer.hh" #include diff --git a/KEMField/Source/Surfaces/src/KSurface.cc b/KEMField/Source/Surfaces/src/KSurface.cc index 428016b41..a9c148e2a 100644 --- a/KEMField/Source/Surfaces/src/KSurface.cc +++ b/KEMField/Source/Surfaces/src/KSurface.cc @@ -1,4 +1,4 @@ -#include "KSurface.hh" +#include "../../../Surfaces/include/KSurface.hh" #include "KDataComparator.hh" diff --git a/KEMField/Source/Surfaces/src/KSurfaceContainer.cc b/KEMField/Source/Surfaces/src/KSurfaceContainer.cc index 6e3ee06bf..9dcaa0fe4 100644 --- a/KEMField/Source/Surfaces/src/KSurfaceContainer.cc +++ b/KEMField/Source/Surfaces/src/KSurfaceContainer.cc @@ -1,4 +1,4 @@ -#include "KSurfaceContainer.hh" +#include "../../../Surfaces/include/KSurfaceContainer.hh" namespace KEMField { diff --git a/KEMField/Source/Surfaces/src/KTriangle.cc b/KEMField/Source/Surfaces/src/KTriangle.cc index 888b42517..cc111ef69 100644 --- a/KEMField/Source/Surfaces/src/KTriangle.cc +++ b/KEMField/Source/Surfaces/src/KTriangle.cc @@ -1,5 +1,6 @@ -#include "KTriangle.hh" -#include "KSurfaceVisitors.hh" +#include "../../../Surfaces/include/KTriangle.hh" + +#include "../../../Surfaces/include/KSurfaceVisitors.hh" namespace KEMField { diff --git a/KEMField/Source/XML/CMakeLists.txt b/KEMField/Source/XML/CMakeLists.txt index a4fe48173..6b8496b1e 100644 --- a/KEMField/Source/XML/CMakeLists.txt +++ b/KEMField/Source/XML/CMakeLists.txt @@ -1,7 +1,7 @@ -# CMakeLists for KEMField/Source/2.0/XML +# CMakeLists for KEMField/Source/XML + +kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/ElectricFields.xml) +kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/MagneticFields.xml) +kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/ElectricFieldExplicitSuperposition.xml) +kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/ElectricFieldDiscreteAxial.xml) -if (@PROJECT_NAME@_USE_KOMMON_BINDINGS) - kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/ElectricFields.xml) - kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/MagneticFields.xml) - kasper_install_config_subdir(Complete ${CMAKE_CURRENT_SOURCE_DIR}/Complete/ElectricFieldExplicitSuperposition.xml) -endif( @PROJECT_NAME@_USE_KOMMON_BINDINGS) \ No newline at end of file diff --git a/KEMField/Source/XML/Complete/ElectricFieldDiscreteAxial.xml b/KEMField/Source/XML/Complete/ElectricFieldDiscreteAxial.xml new file mode 100644 index 000000000..9cfa93a91 --- /dev/null +++ b/KEMField/Source/XML/Complete/ElectricFieldDiscreteAxial.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KEMField/Source/XML/Complete/ElectricFields.xml b/KEMField/Source/XML/Complete/ElectricFields.xml index a2ae785fe..cb0fdf61d 100644 --- a/KEMField/Source/XML/Complete/ElectricFields.xml +++ b/KEMField/Source/XML/Complete/ElectricFields.xml @@ -1,4 +1,4 @@ - + diff --git a/KEMField/Source/XML/Complete/MagneticFields.xml b/KEMField/Source/XML/Complete/MagneticFields.xml index 7eb921731..35294eec9 100644 --- a/KEMField/Source/XML/Complete/MagneticFields.xml +++ b/KEMField/Source/XML/Complete/MagneticFields.xml @@ -1,4 +1,4 @@ - + diff --git a/KEMField/data/CMakeLists.txt b/KEMField/data/CMakeLists.txt index 28b9beab6..94714f328 100644 --- a/KEMField/data/CMakeLists.txt +++ b/KEMField/data/CMakeLists.txt @@ -2,6 +2,6 @@ # T.J. Corona install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/input_files/sphericalCapacitorFiles - DESTINATION ${${PROJECT_NAME}_CONFIG_INSTALL_DIR} + DESTINATION ${${PROJECT_NAME}_DATA_INSTALL_DIR} PATTERN "*.gitignore" EXCLUDE ) diff --git a/KGeoBag/CMakeLists.txt b/KGeoBag/CMakeLists.txt index 199390579..7657e7ac2 100644 --- a/KGeoBag/CMakeLists.txt +++ b/KGeoBag/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required( VERSION ${CMAKE_MINIMUM_VERSION} ) # KGeoBag version set( MODULE_VERSION_MAJOR 3 ) -set( MODULE_VERSION_MINOR 0 ) +set( MODULE_VERSION_MINOR 6 ) set( MODULE_VERSION_PATCH 0 ) set( MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_PATCH}" ) diff --git a/KGeoBag/Source/Bindings/CMakeLists.txt b/KGeoBag/Source/Bindings/CMakeLists.txt index c9d8ecdd4..d3133f5e8 100644 --- a/KGeoBag/Source/Bindings/CMakeLists.txt +++ b/KGeoBag/Source/Bindings/CMakeLists.txt @@ -17,6 +17,10 @@ set( BINDINGS_HEADER_FILES Shapes/Complex/Include/KGRodBuilder.hh Shapes/Complex/Include/KGRotatedObjectBuilder.hh Shapes/Complex/Include/KGComplexAnnulusBuilder.hh + Shapes/Complex/Include/KGLinearWireGridBuilder.hh + Shapes/Complex/Include/KGQuadraticWireGridBuilder.hh + Shapes/Complex/Include/KGCircleWireBuilder.hh + Shapes/Complex/Include/KGCircularWirePinsBuilder.hh # planar paths Shapes/PlanarShapes/Include/KGPlanarLineSegmentBuilder.hh @@ -131,6 +135,10 @@ set( BINDINGS_SOURCE_FILES Shapes/Complex/Source/KGRodBuilder.cc Shapes/Complex/Source/KGRotatedObjectBuilder.cc Shapes/Complex/Source/KGComplexAnnulusBuilder.cc + Shapes/Complex/Source/KGLinearWireGridBuilder.cc + Shapes/Complex/Source/KGQuadraticWireGridBuilder.cc + Shapes/Complex/Source/KGCircleWireBuilder.cc + Shapes/Complex/Source/KGCircularWirePinsBuilder.cc # planar paths Shapes/PlanarShapes/Source/KGPlanarLineSegmentBuilder.cc diff --git a/KGeoBag/Source/Bindings/Core/Include/KGInterfaceBuilder.hh b/KGeoBag/Source/Bindings/Core/Include/KGInterfaceBuilder.hh index 96178ed1b..55d5b66a2 100644 --- a/KGeoBag/Source/Bindings/Core/Include/KGInterfaceBuilder.hh +++ b/KGeoBag/Source/Bindings/Core/Include/KGInterfaceBuilder.hh @@ -49,7 +49,7 @@ namespace katrin KGSurface* tSurface = new KGSurface(); tSurface->SetName( tArea->GetName() ); tSurface->SetTags( tArea->GetTags() ); - tSurface->Area( tArea ); + tSurface->Area( std::shared_ptr(tArea) ); fObject->InstallSurface( tSurface ); return true; } @@ -65,7 +65,7 @@ namespace katrin KGSpace* tSpace = new KGSpace(); tSpace->SetName( tVolume->GetName() ); tSpace->SetTags( tVolume->GetTags() ); - tSpace->Volume( tVolume ); + tSpace->Volume( std::shared_ptr(tVolume) ); fObject->InstallSpace( tSpace ); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGBeamBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGBeamBuilder.hh index 9c1c71fad..ae0372fc3 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGBeamBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGBeamBuilder.hh @@ -120,7 +120,7 @@ namespace katrin KGBeam* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGBeam > smartPtr(object); + std::shared_ptr< KGBeam > smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -149,7 +149,7 @@ namespace katrin KGBeam* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGBeam > smartPtr(object); + std::shared_ptr< KGBeam > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircleWireBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircleWireBuilder.hh new file mode 100644 index 000000000..492b0981f --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircleWireBuilder.hh @@ -0,0 +1,98 @@ +#ifndef KGCIRCLEWIREBUILDER_HH_ +#define KGCIRCLEWIREBUILDER_HH_ + +#include "KComplexElement.hh" + +#include "KGWrappedSurface.hh" +#include "KGWrappedSpace.hh" +#include "KGCircleWire.hh" + +using namespace KGeoBag; + +namespace katrin +{ + typedef KComplexElement KGCircleWireBuilder; + + template<> + inline bool KGCircleWireBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "radius") + { + anAttribute->CopyTo(fObject, &KGCircleWire::SetR); + return true; + } + + if (anAttribute->GetName() == "diameter") + { + anAttribute->CopyTo(fObject, &KGCircleWire::SetDiameter); + return true; + } + if (anAttribute->GetName() == "mesh_count") + { + anAttribute->CopyTo(fObject, &KGCircleWire::SetNDisc); + return true; + } + + return false; + } + + typedef KComplexElement > KGCircleWireSurfaceBuilder; + + template<> + inline bool KGCircleWireSurfaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSurface< KGCircleWire >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGCircleWireSurfaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "circle_wire") + { + KGCircleWire* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGCircleWire > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + + + typedef KComplexElement > KGCircleWireSpaceBuilder; + + template<> + inline bool KGCircleWireSpaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSpace< KGCircleWire >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGCircleWireSpaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "circle_wire") + { + KGCircleWire* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGCircleWire > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + +} + +#endif diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircularWirePinsBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircularWirePinsBuilder.hh new file mode 100644 index 000000000..75bf42455 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGCircularWirePinsBuilder.hh @@ -0,0 +1,117 @@ +#ifndef KGCIRCULARWIREPINSBUILDER_HH_ +#define KGCIRCULARWIREPINSBUILDER_HH_ + +#include "KComplexElement.hh" + +#include "KGWrappedSurface.hh" +#include "KGWrappedSpace.hh" +#include "KGCircularWirePins.hh" + +using namespace KGeoBag; + +namespace katrin +{ + typedef KComplexElement KGCircularWirePinsBuilder; + + template<> + inline bool KGCircularWirePinsBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "inner_radius") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetR1); + return true; + } + if (anAttribute->GetName() == "outer_radius") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetR2); + return true; + } + if (anAttribute->GetName() == "n_pins") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetNPins); + return true; + } + if (anAttribute->GetName() == "diameter") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetDiameter); + return true; + } + if (anAttribute->GetName() == "rotation_angle") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetRotationAngle); + return true; + } + if (anAttribute->GetName() == "mesh_power") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetNDiscPower); + return true; + } + if (anAttribute->GetName() == "mesh_count") + { + anAttribute->CopyTo(fObject, &KGCircularWirePins::SetNDisc); + return true; + } + + return false; + } + + typedef KComplexElement > KGCircularWirePinsSurfaceBuilder; + + template<> + inline bool KGCircularWirePinsSurfaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSurface< KGCircularWirePins >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGCircularWirePinsSurfaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "circular_wire_pins") + { + KGCircularWirePins* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGCircularWirePins > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + + + typedef KComplexElement > KGCircularWirePinsSpaceBuilder; + + template<> + inline bool KGCircularWirePinsSpaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSpace< KGCircularWirePins >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGCircularWirePinsSpaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "circular_wire_pins") + { + KGCircularWirePins* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGCircularWirePins > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + +} + +#endif diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGComplexAnnulusBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGComplexAnnulusBuilder.hh index e7dbd7463..47f739dc5 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGComplexAnnulusBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGComplexAnnulusBuilder.hh @@ -99,7 +99,7 @@ namespace katrin { KGComplexAnnulus* object = NULL; anElement->ReleaseTo(object); - KSmartPointer< KGComplexAnnulus > smartPtr(object); + std::shared_ptr< KGComplexAnnulus > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicSectPortHousingBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicSectPortHousingBuilder.hh index fe7962f32..98bd6be09 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicSectPortHousingBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicSectPortHousingBuilder.hh @@ -212,7 +212,7 @@ namespace katrin { KGConicSectPortHousing* object = NULL; anElement->ReleaseTo(object); - KSmartPointer< KGConicSectPortHousing > smartPtr(object); + std::shared_ptr< KGConicSectPortHousing > smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -240,7 +240,7 @@ namespace katrin { KGConicSectPortHousing* object = NULL; anElement->ReleaseTo(object); - KSmartPointer< KGConicSectPortHousing > smartPtr(object); + std::shared_ptr< KGConicSectPortHousing > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicalWireArrayBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicalWireArrayBuilder.hh index 540fc3410..858f49b7f 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicalWireArrayBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGConicalWireArrayBuilder.hh @@ -85,7 +85,7 @@ namespace katrin KGConicalWireArray* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGConicalWireArray > smartPtr(object); + std::shared_ptr< KGConicalWireArray > smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -114,7 +114,7 @@ namespace katrin KGConicalWireArray* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGConicalWireArray > smartPtr(object); + std::shared_ptr< KGConicalWireArray > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGExtrudedObjectBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGExtrudedObjectBuilder.hh index 229ded2a5..6c476f9c5 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGExtrudedObjectBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGExtrudedObjectBuilder.hh @@ -190,7 +190,7 @@ namespace katrin KGExtrudedObject* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer smartPtr(object); + std::shared_ptr smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -219,7 +219,7 @@ namespace katrin KGExtrudedObject* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer smartPtr(object); + std::shared_ptr smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGLinearWireGridBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGLinearWireGridBuilder.hh new file mode 100644 index 000000000..42f0a44e1 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGLinearWireGridBuilder.hh @@ -0,0 +1,111 @@ +#ifndef KGLINEARWIREGRIDBUILDER_HH_ +#define KGLINEARWIREGRIDBUILDER_HH_ + +#include "KComplexElement.hh" + +#include "KGWrappedSurface.hh" +#include "KGWrappedSpace.hh" +#include "KGLinearWireGrid.hh" + +using namespace KGeoBag; + +namespace katrin +{ + typedef KComplexElement KGLinearWireGridBuilder; + + template<> + inline bool KGLinearWireGridBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "radius") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetR); + return true; + } + if (anAttribute->GetName() == "pitch") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetPitch); + return true; + } + if (anAttribute->GetName() == "diameter") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetDiameter); + return true; + } + if (anAttribute->GetName() == "longitudinal_mesh_count") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetNDisc); + return true; + } + if (anAttribute->GetName() == "longitudinal_mesh_power") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetNDiscPower); + return true; + } + if (anAttribute->GetName() == "add_outer_circle") + { + anAttribute->CopyTo(fObject, &KGLinearWireGrid::SetOuterCircle); + return true; + } + return false; + } + + typedef KComplexElement > KGLinearWireGridSurfaceBuilder; + + template<> + inline bool KGLinearWireGridSurfaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSurface< KGLinearWireGrid >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGLinearWireGridSurfaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "linear_wire_grid") + { + KGLinearWireGrid* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGLinearWireGrid > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + + + typedef KComplexElement > KGLinearWireGridSpaceBuilder; + + template<> + inline bool KGLinearWireGridSpaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSpace< KGLinearWireGrid >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGLinearWireGridSpaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "linear_wire_grid") + { + KGLinearWireGrid* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGLinearWireGrid > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + +} + +#endif diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGPortHousingBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGPortHousingBuilder.hh index b246566a8..c58e9e266 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGPortHousingBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGPortHousingBuilder.hh @@ -217,7 +217,7 @@ namespace katrin { KGPortHousing* object = NULL; anElement->ReleaseTo(object); - KSmartPointer< KGPortHousing > smartPtr(object); + std::shared_ptr< KGPortHousing > smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -245,7 +245,7 @@ namespace katrin { KGPortHousing* object = NULL; anElement->ReleaseTo(object); - KSmartPointer< KGPortHousing > smartPtr(object); + std::shared_ptr< KGPortHousing > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGQuadraticWireGridBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGQuadraticWireGridBuilder.hh new file mode 100644 index 000000000..9c65bf698 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGQuadraticWireGridBuilder.hh @@ -0,0 +1,106 @@ +#ifndef KGQUADRATICWIREGRIDBUILDER_HH_ +#define KGQUADRATICWIREGRIDBUILDER_HH_ + +#include "KComplexElement.hh" + +#include "KGWrappedSurface.hh" +#include "KGWrappedSpace.hh" +#include "KGQuadraticWireGrid.hh" + +using namespace KGeoBag; + +namespace katrin +{ + typedef KComplexElement KGQuadraticWireGridBuilder; + + template<> + inline bool KGQuadraticWireGridBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "radius") + { + anAttribute->CopyTo(fObject, &KGQuadraticWireGrid::SetR); + return true; + } + if (anAttribute->GetName() == "pitch") + { + anAttribute->CopyTo(fObject, &KGQuadraticWireGrid::SetPitch); + return true; + } + if (anAttribute->GetName() == "diameter") + { + anAttribute->CopyTo(fObject, &KGQuadraticWireGrid::SetDiameter); + return true; + } + if (anAttribute->GetName() == "mesh_count_per_pitch") + { + anAttribute->CopyTo(fObject, &KGQuadraticWireGrid::SetNDiscPerPitch); + return true; + } + if (anAttribute->GetName() == "add_outer_circle") + { + anAttribute->CopyTo(fObject, &KGQuadraticWireGrid::SetOuterCircle); + return true; + } + return false; + } + + typedef KComplexElement > KGQuadraticWireGridSurfaceBuilder; + + template<> + inline bool KGQuadraticWireGridSurfaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSurface< KGQuadraticWireGrid >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGQuadraticWireGridSurfaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "quadratic_wire_grid") + { + KGQuadraticWireGrid* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGQuadraticWireGrid > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + + + typedef KComplexElement > KGQuadraticWireGridSpaceBuilder; + + template<> + inline bool KGQuadraticWireGridSpaceBuilder::AddAttribute(KContainer* anAttribute) + { + if (anAttribute->GetName() == "name") + { + anAttribute->CopyTo(fObject, &KGWrappedSpace< KGQuadraticWireGrid >::SetName); + return true; + } + return false; + } + + template<> + inline bool KGQuadraticWireGridSpaceBuilder::AddElement(KContainer* anElement) + { + if (anElement->GetName() == "quadratic_wire_grid") + { + KGQuadraticWireGrid* object = NULL; + anElement->ReleaseTo(object); + object->Initialize(); + std::shared_ptr< KGQuadraticWireGrid > smartPtr(object); + fObject->SetObject(smartPtr); + return true; + } + return false; + } + +} + +#endif diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRodBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRodBuilder.hh index 1506e9047..4854ebeee 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRodBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRodBuilder.hh @@ -98,7 +98,7 @@ namespace katrin KGRod* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGRod > smartPtr(object); + std::shared_ptr< KGRod > smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -127,7 +127,7 @@ namespace katrin KGRod* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer< KGRod > smartPtr(object); + std::shared_ptr< KGRod > smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRotatedObjectBuilder.hh b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRotatedObjectBuilder.hh index a705abae7..d5b07c59e 100644 --- a/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRotatedObjectBuilder.hh +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Include/KGRotatedObjectBuilder.hh @@ -170,7 +170,7 @@ namespace katrin KGRotatedObject* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer smartPtr(object); + std::shared_ptr smartPtr(object); fObject->SetObject(smartPtr); return true; } @@ -199,7 +199,7 @@ namespace katrin KGRotatedObject* object = NULL; anElement->ReleaseTo(object); object->Initialize(); - KSmartPointer smartPtr(object); + std::shared_ptr smartPtr(object); fObject->SetObject(smartPtr); return true; } diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircleWireBuilder.cc b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircleWireBuilder.cc new file mode 100644 index 000000000..c4ba75993 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircleWireBuilder.cc @@ -0,0 +1,29 @@ +#include "KGCircleWireBuilder.hh" +#include "KGInterfaceBuilder.hh" + +using namespace std; +using namespace KGeoBag; + +namespace katrin +{ + + STATICINT sKGCircleWireBuilderStructure = + KGCircleWireBuilder::Attribute("radius") + + KGCircleWireBuilder::Attribute("diameter") + + KGCircleWireBuilder::Attribute("mesh_count"); + + STATICINT sKGCircleWireSurfaceBuilderStructure = + KGCircleWireSurfaceBuilder::Attribute("name") + + KGCircleWireSurfaceBuilder::ComplexElement("circle_wire"); + + STATICINT sKGCircleWireSurfaceBuilder = + KGInterfaceBuilder::ComplexElement >("circle_wire_surface"); + + STATICINT sKGCircleWireSpaceBuilderStructure = + KGCircleWireSpaceBuilder::Attribute("name") + + KGCircleWireSpaceBuilder::ComplexElement("circle_wire"); + + STATICINT sKGCircleWireSpaceBuilder = + KGInterfaceBuilder::ComplexElement >("circle_wire_space"); + +} diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircularWirePinsBuilder.cc b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircularWirePinsBuilder.cc new file mode 100644 index 000000000..ea9695bcb --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGCircularWirePinsBuilder.cc @@ -0,0 +1,33 @@ +#include "KGCircularWirePinsBuilder.hh" +#include "KGInterfaceBuilder.hh" + +using namespace std; +using namespace KGeoBag; + +namespace katrin +{ + +STATICINT sKGCircularWirePinsBuilderStructure = + KGCircularWirePinsBuilder::Attribute("inner_radius") + + KGCircularWirePinsBuilder::Attribute("outer_radius") + + KGCircularWirePinsBuilder::Attribute("n_pins") + + KGCircularWirePinsBuilder::Attribute("diameter") + + KGCircularWirePinsBuilder::Attribute("rotation_angle") + + KGCircularWirePinsBuilder::Attribute("mesh_count") + + KGCircularWirePinsBuilder::Attribute("mesh_power"); + + STATICINT sKGCircularWirePinsSurfaceBuilderStructure = + KGCircularWirePinsSurfaceBuilder::Attribute("name") + + KGCircularWirePinsSurfaceBuilder::ComplexElement("circular_wire_pins"); + + STATICINT sKGCircularWirePinsSurfaceBuilder = + KGInterfaceBuilder::ComplexElement >("circular_wire_pins_surface"); + + STATICINT sKGCircleWireSpaceBuilderStructure = + KGCircularWirePinsSpaceBuilder::Attribute("name") + + KGCircularWirePinsSpaceBuilder::ComplexElement("circular_wire_pins"); + + STATICINT sKGCircularWirePinsSpaceBuilder = + KGInterfaceBuilder::ComplexElement >("circular_wire_pins_space"); + +} diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGLinearWireGridBuilder.cc b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGLinearWireGridBuilder.cc new file mode 100644 index 000000000..feaefc7c2 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGLinearWireGridBuilder.cc @@ -0,0 +1,32 @@ +#include "KGLinearWireGridBuilder.hh" +#include "KGInterfaceBuilder.hh" + +using namespace std; +using namespace KGeoBag; + +namespace katrin +{ + + STATICINT sKGLinearWireGridBuilderStructure = + KGLinearWireGridBuilder::Attribute("radius") + + KGLinearWireGridBuilder::Attribute("pitch") + + KGLinearWireGridBuilder::Attribute("diameter") + + KGLinearWireGridBuilder::Attribute("longitudinal_mesh_count") + + KGLinearWireGridBuilder::Attribute("longitudinal_mesh_power") + + KGLinearWireGridBuilder::Attribute("add_outer_circle"); + + STATICINT sKGLinearWireGridSurfaceBuilderStructure = + KGLinearWireGridSurfaceBuilder::Attribute("name") + + KGLinearWireGridSurfaceBuilder::ComplexElement("linear_wire_grid"); + + STATICINT sKGLinearWireGridSurfaceBuilder = + KGInterfaceBuilder::ComplexElement >("linear_wire_grid_surface"); + + STATICINT sKGLinearWireGridSpaceBuilderStructure = + KGLinearWireGridSpaceBuilder::Attribute("name") + + KGLinearWireGridSpaceBuilder::ComplexElement("linear_wire_grid"); + + STATICINT sKGLinearWireGridSpaceBuilder = + KGInterfaceBuilder::ComplexElement >("linear_wire_grid_space"); + +} diff --git a/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGQuadraticWireGridBuilder.cc b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGQuadraticWireGridBuilder.cc new file mode 100644 index 000000000..eedd8fc50 --- /dev/null +++ b/KGeoBag/Source/Bindings/Shapes/Complex/Source/KGQuadraticWireGridBuilder.cc @@ -0,0 +1,31 @@ +#include "KGQuadraticWireGridBuilder.hh" +#include "KGInterfaceBuilder.hh" + +using namespace std; +using namespace KGeoBag; + +namespace katrin +{ + + STATICINT sKGQuadraticWireGridBuilderStructure = + KGQuadraticWireGridBuilder::Attribute("radius") + + KGQuadraticWireGridBuilder::Attribute("pitch") + + KGQuadraticWireGridBuilder::Attribute("diameter") + + KGQuadraticWireGridBuilder::Attribute("mesh_count_per_pitch") + + KGQuadraticWireGridBuilder::Attribute("add_outer_circle"); + + STATICINT sKGQuadraticWireGridSurfaceBuilderStructure = + KGQuadraticWireGridSurfaceBuilder::Attribute("name") + + KGQuadraticWireGridSurfaceBuilder::ComplexElement("quadratic_wire_grid"); + + STATICINT sKGQuadraticWireGridSurfaceBuilder = + KGInterfaceBuilder::ComplexElement >("quadratic_wire_grid_surface"); + + STATICINT sKGQuadraticWireGridSpaceBuilderStructure = + KGQuadraticWireGridSpaceBuilder::Attribute("name") + + KGQuadraticWireGridSpaceBuilder::ComplexElement("quadratic_wire_grid"); + + STATICINT sKGQuadraticWireGridSpaceBuilder = + KGInterfaceBuilder::ComplexElement >("quadratic_wire_grid_space"); + +} diff --git a/KGeoBag/Source/Core/CMakeLists.txt b/KGeoBag/Source/Core/CMakeLists.txt index e134ab675..080b95a05 100644 --- a/KGeoBag/Source/Core/CMakeLists.txt +++ b/KGeoBag/Source/Core/CMakeLists.txt @@ -3,6 +3,7 @@ set( CORE_HEADER_FILES Include/KGCoreMessage.hh Include/KGCore.hh Include/KGVisitor.hh + Include/KGBoundary.hh Include/KGArea.hh Include/KGVolume.hh Include/KGSurface.hh @@ -19,6 +20,7 @@ set( CORE_HEADER_FILES set( CORE_SOURCE_FILES Source/KGCoreMessage.cc Source/KGVisitor.cc + Source/KGBoundary.cc Source/KGArea.cc Source/KGVolume.cc Source/KGSurface.cc diff --git a/KGeoBag/Source/Core/Include/KGArea.hh b/KGeoBag/Source/Core/Include/KGArea.hh index 5873e5ede..802b5d93b 100644 --- a/KGeoBag/Source/Core/Include/KGArea.hh +++ b/KGeoBag/Source/Core/Include/KGArea.hh @@ -1,6 +1,8 @@ #ifndef KGAREA_HH_ #define KGAREA_HH_ +#include "KGBoundary.hh" + #include "KTwoVector.hh" #include "KThreeVector.hh" #include "KTransformation.hh" @@ -14,16 +16,12 @@ using katrin::KTagged; #include "KConst.h" using katrin::KConst; -#include "KSmartPointer.h" -using katrin::KSmartPointer; - #include namespace KGeoBag { - class KGArea : - public KTagged + public KGBoundary { public: class Visitor { diff --git a/KGeoBag/Source/Core/Include/KGBoundary.hh b/KGeoBag/Source/Core/Include/KGBoundary.hh new file mode 100644 index 000000000..143a93c4d --- /dev/null +++ b/KGeoBag/Source/Core/Include/KGBoundary.hh @@ -0,0 +1,35 @@ +#ifndef KGBOUNDARY_HH_ +#define KGBOUNDARY_HH_ + +#include "KGVisitor.hh" + +#include "KTagged.h" +using katrin::KTagged; + +namespace KGeoBag +{ + class KGBoundary : + public KTagged + { + public: + class Visitor { + public: + Visitor() {} + virtual ~Visitor() {} + }; + + public: + KGBoundary(); + KGBoundary( const KGBoundary& aBoundary ); + virtual ~KGBoundary(); + + public: + void Accept( KGVisitor* aVisitor ); + + protected: + mutable bool fInitialized; + }; + +} + +#endif diff --git a/KGeoBag/Source/Core/Include/KGSpace.hh b/KGeoBag/Source/Core/Include/KGSpace.hh index 2255de93f..b9ec5e27c 100644 --- a/KGeoBag/Source/Core/Include/KGSpace.hh +++ b/KGeoBag/Source/Core/Include/KGSpace.hh @@ -108,15 +108,15 @@ namespace KGeoBag //********* public: - void Volume( const KSmartPointer< KGVolume >& anVolume ); - const KSmartPointer< KGVolume >& Volume() const; + void Volume( const std::shared_ptr< KGVolume >& anVolume ); + const std::shared_ptr< KGVolume >& Volume() const; bool Outside( const KThreeVector& aPoint ) const; KThreeVector Point( const KThreeVector& aPoint ) const; KThreeVector Normal( const KThreeVector& aPoint ) const; private: - KSmartPointer< KGVolume > fVolume; + std::shared_ptr< KGVolume > fVolume; }; } diff --git a/KGeoBag/Source/Core/Include/KGSurface.hh b/KGeoBag/Source/Core/Include/KGSurface.hh index d3e1226cd..489fc98c2 100644 --- a/KGeoBag/Source/Core/Include/KGSurface.hh +++ b/KGeoBag/Source/Core/Include/KGSurface.hh @@ -97,15 +97,15 @@ namespace KGeoBag //********* public: - void Area( const KSmartPointer< KGArea >& anArea ); - const KSmartPointer< KGArea >& Area() const; + void Area( const std::shared_ptr< KGArea >& anArea ); + const std::shared_ptr< KGArea >& Area() const; bool Above( const KThreeVector& aPoint ) const; KThreeVector Point( const KThreeVector& aPoint ) const; KThreeVector Normal( const KThreeVector& aPoint ) const; private: - KSmartPointer< KGArea > fArea; + std::shared_ptr< KGArea > fArea; }; } diff --git a/KGeoBag/Source/Core/Include/KGVolume.hh b/KGeoBag/Source/Core/Include/KGVolume.hh index 528367fe8..c69b3f80a 100644 --- a/KGeoBag/Source/Core/Include/KGVolume.hh +++ b/KGeoBag/Source/Core/Include/KGVolume.hh @@ -4,6 +4,7 @@ #include "KGArea.hh" #include +#include namespace KGeoBag { @@ -20,7 +21,7 @@ namespace KGeoBag }; public: - typedef KSmartPointer< KGArea > BoundaryPointer; + typedef std::shared_ptr< KGBoundary > BoundaryPointer; typedef std::vector< BoundaryPointer > BoundaryContainer; typedef BoundaryContainer::iterator BoundaryIt; typedef BoundaryContainer::const_iterator BoundaryCIt; diff --git a/KGeoBag/Source/Core/Source/KGArea.cc b/KGeoBag/Source/Core/Source/KGArea.cc index 26c61352d..ede5df62c 100644 --- a/KGeoBag/Source/Core/Source/KGArea.cc +++ b/KGeoBag/Source/Core/Source/KGArea.cc @@ -2,13 +2,12 @@ namespace KGeoBag { - KGArea::KGArea() : fInitialized( false ) { } KGArea::KGArea( const KGArea& aCopy ) : - KTagged(), + KGBoundary(), fInitialized( aCopy.fInitialized ) { } diff --git a/KGeoBag/Source/Core/Source/KGBoundary.cc b/KGeoBag/Source/Core/Source/KGBoundary.cc new file mode 100644 index 000000000..99a9ca9d4 --- /dev/null +++ b/KGeoBag/Source/Core/Source/KGBoundary.cc @@ -0,0 +1,21 @@ +#include "KGBoundary.hh" + +namespace KGeoBag +{ + KGBoundary::KGBoundary() : + fInitialized( false ) + { + } + KGBoundary::KGBoundary( const KGBoundary& aCopy ) : + KTagged(), + fInitialized( aCopy.fInitialized ) + { + } + KGBoundary::~KGBoundary() + { + } + + void KGBoundary::Accept( KGVisitor* /*aVisitor*/ ) + { + } +} diff --git a/KGeoBag/Source/Core/Source/KGSpace.cc b/KGeoBag/Source/Core/Source/KGSpace.cc index eccbbb328..bd28c30a7 100644 --- a/KGeoBag/Source/Core/Source/KGSpace.cc +++ b/KGeoBag/Source/Core/Source/KGSpace.cc @@ -39,7 +39,7 @@ namespace KGeoBag fZAxis( KThreeVector::sZUnit ), fVolume() { - Volume( aVolume ); + Volume( std::shared_ptr(aVolume) ); } KGSpace::~KGSpace() { @@ -232,7 +232,7 @@ namespace KGeoBag KGSpace* tClone = new KGSpace(); //copy name - tClone->fName = fName; + tClone->SetName(this->GetName()); //copy tags tClone->fTags = fTags; @@ -272,7 +272,7 @@ namespace KGeoBag KGSpace* tClone = new KGSpace(); //copy name - tClone->fName = fName; + tClone->SetName(this->GetName()); //copy tags tClone->fTags = fTags; @@ -352,7 +352,7 @@ namespace KGeoBag } //visit the volume - if( fVolume.Null() == false ) + if( fVolume ) { fVolume->Accept( aVisitor ); } @@ -382,7 +382,7 @@ namespace KGeoBag } //visit the volume - if( fVolume.Null() == false ) + if( fVolume ) { fVolume->Accept( aVisitor ); } @@ -421,7 +421,7 @@ namespace KGeoBag //navigable //********* - void KGSpace::Volume( const KSmartPointer< KGVolume >& aVolume ) + void KGSpace::Volume( const std::shared_ptr< KGVolume >& aVolume ) { //clear out old boundaries KGSurface* tBoundary; @@ -434,13 +434,13 @@ namespace KGeoBag } //put in new boundaries - vector< KSmartPointer< KGArea > >::const_iterator tAreaIt; + vector< std::shared_ptr< KGBoundary > >::const_iterator tAreaIt; for( tAreaIt = aVolume->Boundaries().begin(); tAreaIt != aVolume->Boundaries().end(); tAreaIt++ ) { tBoundary = new KGSurface(); tBoundary->SetName( (*tAreaIt)->GetName() ); tBoundary->SetTags( (*tAreaIt)->GetTags() ); - tBoundary->Area( *tAreaIt ); + tBoundary->Area( std::static_pointer_cast(*tAreaIt) ); // FIXME this code looks ugly AddBoundary( tBoundary ); } @@ -449,14 +449,14 @@ namespace KGeoBag return; } - const KSmartPointer< KGVolume >& KGSpace::Volume() const + const std::shared_ptr< KGVolume >& KGSpace::Volume() const { return fVolume; } bool KGSpace::Outside( const KThreeVector& aQueryPoint ) const { - if( fVolume.Null() == false ) + if( fVolume ) { KThreeVector tLocalQueryPoint; @@ -483,7 +483,7 @@ namespace KGeoBag } KThreeVector KGSpace::Point( const KThreeVector& aQueryPoint ) const { - if( fVolume.Null() == false ) + if( fVolume ) { KThreeVector tLocalQueryPoint; KThreeVector tLocalNearestPoint; @@ -542,7 +542,7 @@ namespace KGeoBag } KThreeVector KGSpace::Normal( const KThreeVector& aQueryPoint ) const { - if( fVolume.Null() == false ) + if( fVolume ) { KThreeVector tLocalQueryPoint; KThreeVector tLocalNearestNormal; diff --git a/KGeoBag/Source/Core/Source/KGSurface.cc b/KGeoBag/Source/Core/Source/KGSurface.cc index 46b2b8a35..7824d8533 100644 --- a/KGeoBag/Source/Core/Source/KGSurface.cc +++ b/KGeoBag/Source/Core/Source/KGSurface.cc @@ -137,7 +137,7 @@ namespace KGeoBag KGSurface* tClone = new KGSurface(); //copy name - tClone->fName = fName; + tClone->SetName(this->GetName()); //copy tags tClone->fTags = fTags; @@ -189,7 +189,7 @@ namespace KGeoBag } //visit area - if( fArea.Null() == false ) + if( fArea ) { fArea->Accept( aVisitor ); } @@ -201,19 +201,19 @@ namespace KGeoBag //navigable //********* - void KGSurface::Area( const KSmartPointer< KGArea >& anArea ) + void KGSurface::Area( const std::shared_ptr< KGArea >& anArea ) { fArea = anArea; return; } - const KSmartPointer< KGArea >& KGSurface::Area() const + const std::shared_ptr< KGArea >& KGSurface::Area() const { return fArea; } bool KGSurface::Above( const KThreeVector& aQueryPoint ) const { - if( fArea.Null() == false ) + if( fArea ) { KThreeVector tLocalQueryPoint; @@ -227,7 +227,7 @@ namespace KGeoBag } KThreeVector KGSurface::Point( const KThreeVector& aQueryPoint ) const { - if( fArea.Null() == false ) + if( fArea ) { KThreeVector tLocalQueryPoint; KThreeVector tLocalNearestPoint; @@ -249,7 +249,7 @@ namespace KGeoBag } KThreeVector KGSurface::Normal( const KThreeVector& aQueryPoint ) const { - if( fArea.Null() == false ) + if( fArea ) { KThreeVector tLocalQueryPoint; KThreeVector tLocalNearestNormal; diff --git a/KGeoBag/Source/Extensions/Deformation/Include/KGDeformed.hh b/KGeoBag/Source/Extensions/Deformation/Include/KGDeformed.hh index b1c9d8906..e54bea961 100644 --- a/KGeoBag/Source/Extensions/Deformation/Include/KGDeformed.hh +++ b/KGeoBag/Source/Extensions/Deformation/Include/KGDeformed.hh @@ -1,8 +1,6 @@ #ifndef KGDEFORMED_HH_ #define KGDEFORMED_HH_ -#include "KSmartPointer.h" - #include "KGCore.hh" #include "KGDeformation.hh" @@ -11,7 +9,7 @@ namespace KGeoBag class KGDeformedObject { public: - typedef KSmartPointer KGDeformationPtr; + typedef std::shared_ptr KGDeformationPtr; KGDeformedObject(KGSurface*) {} KGDeformedObject(KGSpace*) {} @@ -25,7 +23,7 @@ namespace KGeoBag private: KGDeformationPtr fDeformation; - }; + }; class KGDeformed { diff --git a/KGeoBag/Source/Extensions/Deformation/Include/KGMeshDeformer.hh b/KGeoBag/Source/Extensions/Deformation/Include/KGMeshDeformer.hh index fdfcad30d..cb599df33 100644 --- a/KGeoBag/Source/Extensions/Deformation/Include/KGMeshDeformer.hh +++ b/KGeoBag/Source/Extensions/Deformation/Include/KGMeshDeformer.hh @@ -34,7 +34,7 @@ namespace KGeoBag void AddDeformed(KGMeshTriangle* t); void AddDeformed(KGMeshWire* w); - KSmartPointer fDeformation; + std::shared_ptr fDeformation; KGMeshElementVector fDeformedVector; }; } diff --git a/KGeoBag/Source/Extensions/Deformation/Source/KGDeformed.cc b/KGeoBag/Source/Extensions/Deformation/Source/KGDeformed.cc index 8b824bf2f..f46b07ab3 100644 --- a/KGeoBag/Source/Extensions/Deformation/Source/KGDeformed.cc +++ b/KGeoBag/Source/Extensions/Deformation/Source/KGDeformed.cc @@ -2,12 +2,12 @@ namespace KGeoBag { - void KGDeformedObject::SetDeformation(KSmartPointer deformation) + void KGDeformedObject::SetDeformation(std::shared_ptr deformation) { fDeformation = deformation; } - KSmartPointer KGDeformedObject::GetDeformation() const + std::shared_ptr KGDeformedObject::GetDeformation() const { return fDeformation; } diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/CMakeLists.txt b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/CMakeLists.txt index d7a358cf6..c0dbb3029 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/CMakeLists.txt +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/CMakeLists.txt @@ -1,5 +1,6 @@ # headers set( DISCRETEROTATIONALMESH_HEADER_FILES + Include/KGDiscreteRotationalAreaMesher.hh Include/KGDiscreteRotationalMeshMessage.hh Include/KGDiscreteRotationalMeshElement.hh Include/KGDiscreteRotationalMesh.hh diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Include/KGConicalWireArrayDiscreteRotationalMesher.hh b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Include/KGConicalWireArrayDiscreteRotationalMesher.hh index ece957105..4d29a7b9f 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Include/KGConicalWireArrayDiscreteRotationalMesher.hh +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Include/KGConicalWireArrayDiscreteRotationalMesher.hh @@ -12,10 +12,7 @@ namespace KGeoBag public KGWrappedSurface::Visitor { public: - using KGDiscreteRotationalMesherBase::VisitExtendedSurface; - using KGDiscreteRotationalMesherBase::VisitExtendedSpace; - public: KGConicalWireArrayDiscreteRotationalMesher() { } @@ -23,7 +20,7 @@ namespace KGeoBag { } - protected: + public: void VisitWrappedSurface(KGWrappedSurface< KGConicalWireArray >* conicalWireArraySurface); }; diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Source/KGConicalWireArrayDiscreteRotationalMesher.cc b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Source/KGConicalWireArrayDiscreteRotationalMesher.cc index 4414c22d2..a1a5bb481 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Source/KGConicalWireArrayDiscreteRotationalMesher.cc +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Complex/Source/KGConicalWireArrayDiscreteRotationalMesher.cc @@ -9,43 +9,39 @@ namespace KGeoBag void KGConicalWireArrayDiscreteRotationalMesher::VisitWrappedSurface(KGWrappedSurface< KGConicalWireArray >* conicalWireArraySurface) { KTransformation transform; - transform.SetRotationAxisAngle(conicalWireArraySurface->GetObject()->GetThetaStart(),0.,0.); + transform.SetRotationAxisAngle( conicalWireArraySurface->GetObject()->GetThetaStart(), 0., 0. ); - std::vector segments(conicalWireArraySurface->GetObject()->GetNDisc(),0.); + const double wireLength = conicalWireArraySurface->GetObject()->GetLength(); + const unsigned int wireCount = conicalWireArraySurface->GetObject()->GetNWires(); + const double wireR1 = conicalWireArraySurface->GetObject()->GetR1(); + const double wireZ1 = conicalWireArraySurface->GetObject()->GetZ1(); + const double wireR2 = conicalWireArraySurface->GetObject()->GetR2(); + const double wireZ2 = conicalWireArraySurface->GetObject()->GetZ2(); + const double wireDiameter = conicalWireArraySurface->GetObject()->GetDiameter(); - KGComplexMesher::DiscretizeInterval( - conicalWireArraySurface->GetObject()->GetLength(), - conicalWireArraySurface->GetObject()->GetNDisc(), - conicalWireArraySurface->GetObject()->GetNDiscPower(), - segments); + const double wireNDisc = conicalWireArraySurface->GetObject()->GetNDisc(); - KThreeVector start(conicalWireArraySurface->GetObject()->GetR1(), - 0., - conicalWireArraySurface->GetObject()->GetZ1()); + std::vector segments( wireNDisc, 0. ); + KGComplexMesher::DiscretizeInterval( wireLength, wireNDisc, conicalWireArraySurface->GetObject()->GetNDiscPower(), segments ); - KThreeVector end = start; + KThreeVector startPoint( wireR1, 0., wireZ1 ); + KThreeVector endPoint( wireR2, 0., wireZ2 ); - KThreeVector v1( conicalWireArraySurface->GetObject()->GetR1(), 0., conicalWireArraySurface->GetObject()->GetZ1()); - KThreeVector v2( conicalWireArraySurface->GetObject()->GetR2(), 0., conicalWireArraySurface->GetObject()->GetZ2()); - KThreeVector vd = v2-v1; - double dist = vd.Magnitude(); + KThreeVector distanceVector = endPoint - startPoint; + KThreeVector unitVector(distanceVector/distanceVector.Magnitude()); - KThreeVector unit(vd/dist); - - for (unsigned int i=0;iGetObject()->GetNDisc();i++) + for( unsigned int i=0; iGetObject()->GetDiameter()); + endPoint += segments[i]*unitVector; + KGMeshWire singleWire(startPoint, endPoint, wireDiameter ); singleWire.Transform(transform); KGDiscreteRotationalMeshWire* w = new KGDiscreteRotationalMeshWire(singleWire); - w->NumberOfElements(conicalWireArraySurface->GetObject()->GetNWires()); - fCurrentElements->push_back(w); + w->NumberOfElements( wireCount ); + GetCurrentElements()->push_back(w); + + startPoint = endPoint; } } } diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalAreaMesher.hh b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalAreaMesher.hh new file mode 100644 index 000000000..b912d5f47 --- /dev/null +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalAreaMesher.hh @@ -0,0 +1,29 @@ +/* + * KGDiscreteRotationalAreaMesher.hh + * + * Created on: 15.10.2015 + * Author: hilk + */ + +#ifndef KGEOBAG_KGDISCRETEROTATIONALAREAMESHER_HH_ +#define KGEOBAG_KGDISCRETEROTATIONALAREAMESHER_HH_ + + +#include "KGConicalWireArraySurface.hh" + + +namespace KGeoBag { + + class KGDiscreteRotationalAreaMesher : + public KGConicalWireArrayDiscreteRotationalMesher + { + public: + KGDiscreteRotationalAreaMesher(){}; + virtual ~KGDiscreteRotationalAreaMesher(){}; + + using KGConicalWireArrayDiscreteRotationalMesher::VisitWrappedSurface; + }; + +} + +#endif /* KGEOBAG_KGDISCRETEROTATIONALAREAMESHER_HH_ */ diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesher.hh b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesher.hh index b56116647..3a6836b79 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesher.hh +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesher.hh @@ -13,18 +13,15 @@ namespace KGeoBag class KGAxialMeshRing; class KGDiscreteRotationalMesher : - public KGExtendedSurface< KGAxialMesh >::Visitor, - public KGExtendedSpace< KGAxialMesh >::Visitor, - virtual public KGConicalWireArrayDiscreteRotationalMesher - { - public: - using KGDiscreteRotationalMesherBase::VisitExtendedSurface; - using KGDiscreteRotationalMesherBase::VisitExtendedSpace; - using KGConicalWireArrayDiscreteRotationalMesher::VisitWrappedSurface; + public KGSurface::Visitor, + public KGSpace::Visitor, + public KGVisitor - void VisitExtendedSurface( KGExtendedSurface< KGAxialMesh >* aSurface ); - void VisitExtendedSpace( KGExtendedSpace< KGAxialMesh >* aSpace ); + { + public: + virtual void VisitSurface( KGSurface* aSurface ); + virtual void VisitSpace( KGSpace* aSpace ); public: KGDiscreteRotationalMesher(); @@ -33,12 +30,18 @@ namespace KGeoBag void SetAxialAngle(double d) { fAxialAngle = d; } void SetAxialCount(unsigned int i) { fAxialCount = i; } + private: + void MeshAxialSurface( KGExtendedSurface< KGAxialMesh >* aSurface ); + void MeshAxialSpace( KGExtendedSpace< KGAxialMesh >* aSpace ); void AddAxialMeshElement(KGAxialMeshElement* e); void AddAxialMeshLoop(KGAxialMeshLoop* l); void AddAxialMeshRing(KGAxialMeshRing* r); + KGDiscreteRotationalMeshElementVector* fCurrentElements; + + double fAxialAngle; unsigned int fAxialCount; }; diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesherBase.hh b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesherBase.hh index 74c979989..5cefa6652 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesherBase.hh +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Include/KGDiscreteRotationalMesherBase.hh @@ -9,9 +9,7 @@ namespace KGeoBag { class KGDiscreteRotationalMesherBase : - public KGVisitor, - public KGExtendedSurface< KGDiscreteRotationalMesh >::Visitor, - public KGExtendedSpace< KGDiscreteRotationalMesh >::Visitor + public KGVisitor { protected: KGDiscreteRotationalMesherBase(); @@ -20,8 +18,8 @@ namespace KGeoBag virtual ~KGDiscreteRotationalMesherBase(); public: - virtual void VisitExtendedSurface( KGExtendedSurface< KGDiscreteRotationalMesh >* aSurface ); - virtual void VisitExtendedSpace( KGExtendedSpace< KGDiscreteRotationalMesh >* aSpace ); + void SetMeshElementOutput(KGDiscreteRotationalMeshElementVector* aMeshElementVector ); + KGDiscreteRotationalMeshElementVector* GetCurrentElements() const {return fCurrentElements;} protected: KGDiscreteRotationalMeshElementVector* fCurrentElements; diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesher.cc b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesher.cc index 047cf8527..1a9b4e556 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesher.cc +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesher.cc @@ -1,4 +1,7 @@ +#include + #include "KGDiscreteRotationalMesher.hh" +#include "KGDiscreteRotationalAreaMesher.hh" #include "KGAxialMeshLoop.hh" #include "KGAxialMeshRing.hh" @@ -7,21 +10,22 @@ namespace KGeoBag { KGDiscreteRotationalMesher::KGDiscreteRotationalMesher() : + fCurrentElements( NULL ), fAxialAngle(0.), - fAxialCount(8) + fAxialCount(100) { } KGDiscreteRotationalMesher::~KGDiscreteRotationalMesher() { } - void KGDiscreteRotationalMesher::VisitExtendedSurface( KGExtendedSurface< KGAxialMesh >* aSurface ) + void KGDiscreteRotationalMesher::MeshAxialSurface( KGExtendedSurface< KGAxialMesh >* aSurface ) { for (KGAxialMeshElementIt it = aSurface->Elements()->begin();it!=aSurface->Elements()->end();++it) AddAxialMeshElement(*it); } - void KGDiscreteRotationalMesher::VisitExtendedSpace( KGExtendedSpace< KGAxialMesh >* aSpace ) + void KGDiscreteRotationalMesher::MeshAxialSpace( KGExtendedSpace< KGAxialMesh >* aSpace ) { for (KGAxialMeshElementIt it = aSpace->Elements()->begin();it!=aSpace->Elements()->end();++it) AddAxialMeshElement(*it); @@ -40,25 +44,18 @@ namespace KGeoBag KTransformation transform; transform.SetRotationAxisAngle(fAxialAngle,0.,0.); - if (fabs(l->GetP0()[1]-l->GetP1()[1])>1.e-10) - { - double tmp = 1.; - if (l->GetP1()[0] < l->GetP0()[0]) - tmp = -1.; - - KGMeshTriangle singleTriangle1((l->GetP1()-l->GetP0()).Magnitude(), - 2.*KConst::Pi()*l->GetP0()[1]/fAxialCount, - KThreeVector(l->GetP0()[1],0.,l->GetP0()[0]), - KThreeVector(l->GetP1()[1]-l->GetP0()[1],0.,tmp).Unit(), - KThreeVector(0.,1.,0.)); - - KGMeshTriangle singleTriangle2((l->GetP1()-l->GetP0()).Magnitude(), - 2.*KConst::Pi()*l->GetP1()[1]/fAxialCount, - KThreeVector(l->GetP1()[1]*cos(2.*KConst::Pi()/fAxialCount), - l->GetP1()[1]*sin(2.*KConst::Pi()/fAxialCount), - l->GetP1()[0]), - KThreeVector(l->GetP0()[1]-l->GetP1()[1],0.,tmp).Unit(), - KThreeVector(0.,-1.,0.)); + if( fabs( (l->GetP0()[1]) - (l->GetP1()[1]) ) > 1.e-10 ) { + + KThreeVector P00( (l->GetP0()[1]), 0., l->GetP0()[0] ); + KThreeVector P01( (l->GetP0()[1])*cos(2.*KConst::Pi()/fAxialCount), (l->GetP0()[1])*sin(2.*KConst::Pi()/fAxialCount), l->GetP0()[0] ); + + KThreeVector P10( (l->GetP1()[1]), 0., l->GetP1()[0] ); + KThreeVector P11( (l->GetP1()[1])*cos(2.*KConst::Pi()/fAxialCount), (l->GetP1()[1])*sin(2.*KConst::Pi()/fAxialCount), l->GetP1()[0] ); + + + KGMeshTriangle singleTriangle1( P00,P01,P11 ); + KGMeshTriangle singleTriangle2( P10,P00,P11 ); + singleTriangle1.Transform(transform); singleTriangle2.Transform(transform); @@ -71,22 +68,52 @@ namespace KGeoBag } else { - double tmp = 1.; - if (l->GetP1()[0] < l->GetP0()[0]) - tmp = -1.; - - KGMeshRectangle singleRectangle(fabs(l->GetP1()[0] - l->GetP0()[0]), - 2.*KConst::Pi()*l->GetP0()[1]/fAxialCount, - KThreeVector(l->GetP0()[1],0.,l->GetP0()[0]), - KThreeVector(0.,0.,tmp), - KThreeVector(0.,1.,0.)); - singleRectangle.Transform(transform); - KGDiscreteRotationalMeshRectangle* r = new KGDiscreteRotationalMeshRectangle(singleRectangle); - r->NumberOfElements(fAxialCount); - fCurrentElements->push_back(r); + KThreeVector P0( (l->GetP0()[1]), 0., l->GetP0()[0] ); + KThreeVector P1( (l->GetP0()[1])*cos(2.*KConst::Pi()/fAxialCount), (l->GetP0()[1])*sin(2.*KConst::Pi()/fAxialCount), l->GetP0()[0] ); + + KGMeshRectangle singleRectangle(fabs(l->GetP1()[0]-l->GetP0()[0]),(P1-P0).Magnitude(),P0,KThreeVector(0.,0.,1.),(P1-P0).Unit() ); + + singleRectangle.Transform(transform); + KGDiscreteRotationalMeshRectangle* r = new KGDiscreteRotationalMeshRectangle(singleRectangle); + r->NumberOfElements(fAxialCount); + fCurrentElements->push_back(r); } } + void KGDiscreteRotationalMesher::VisitSurface(KGSurface* aSurface) + { + KGExtendedSurface* discRotMesh = aSurface->AsExtension(); + if( !discRotMesh ) + std::cerr << "KGDiscreteRotationalMesh assumes that extension is already present.\n"; + + fCurrentElements = discRotMesh->Elements(); + + KGExtendedSurface* axialMesh = aSurface->AsExtension(); + if( axialMesh ) + MeshAxialSurface( axialMesh ); + else { + KGDiscreteRotationalAreaMesher* areaMesher = new KGDiscreteRotationalAreaMesher(); + areaMesher->SetMeshElementOutput( fCurrentElements ); + aSurface->AcceptNode( areaMesher ); + delete areaMesher; + } + + } + + void KGDiscreteRotationalMesher::VisitSpace(KGSpace* aSpace) + { + KGExtendedSpace* discRotMesh = aSpace->AsExtension(); + if( !discRotMesh ) + std::cerr << "KGDiscreteRotationalMesh assumes that extension is already present.\n"; + + fCurrentElements = discRotMesh->Elements(); + + KGExtendedSpace* axialMesh = aSpace->AsExtension(); + if( axialMesh ) + MeshAxialSpace( axialMesh ); + } + + void KGDiscreteRotationalMesher::AddAxialMeshRing(KGAxialMeshRing* r) { KTransformation transform; diff --git a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesherBase.cc b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesherBase.cc index aa58a12b1..66cde65bf 100644 --- a/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesherBase.cc +++ b/KGeoBag/Source/Extensions/DiscreteRotationalMesh/Source/KGDiscreteRotationalMesherBase.cc @@ -11,15 +11,10 @@ namespace KGeoBag { } - void KGDiscreteRotationalMesherBase::VisitExtendedSurface( KGExtendedSurface< KGDiscreteRotationalMesh >* aSurface ) - { - fCurrentElements = aSurface->Elements(); - return; - } + void KGDiscreteRotationalMesherBase::SetMeshElementOutput( KGDiscreteRotationalMeshElementVector* aMeshElementVector) - void KGDiscreteRotationalMesherBase::VisitExtendedSpace( KGExtendedSpace< KGDiscreteRotationalMesh >* aSpace ) { - fCurrentElements = aSpace->Elements(); + fCurrentElements = aMeshElementVector; return; } diff --git a/KGeoBag/Source/Extensions/Mesh/CMakeLists.txt b/KGeoBag/Source/Extensions/Mesh/CMakeLists.txt index fa7798ff7..813e544f4 100644 --- a/KGeoBag/Source/Extensions/Mesh/CMakeLists.txt +++ b/KGeoBag/Source/Extensions/Mesh/CMakeLists.txt @@ -21,6 +21,10 @@ set( MESH_HEADER_FILES Complex/Include/KGConicSectPortHousingSurfaceMesher.hh Complex/Include/KGRodSurfaceMesher.hh Complex/Include/KGBeamSurfaceMesher.hh + Complex/Include/KGLinearWireGridMesher.hh + Complex/Include/KGQuadraticWireGridMesher.hh + Complex/Include/KGCircleWireMesher.hh + Complex/Include/KGCircularWirePinsMesher.hh Simple/Include/KGSimpleMesher.hh Simple/Include/KGFlattenedCircleSurfaceMesher.hh @@ -87,6 +91,10 @@ set( MESH_SOURCE_FILES Complex/Source/KGConicSectPortHousingSurfaceMesher.cc Complex/Source/KGRodSurfaceMesher.cc Complex/Source/KGBeamSurfaceMesher.cc + Complex/Source/KGLinearWireGridMesher.cc + Complex/Source/KGQuadraticWireGridMesher.cc + Complex/Source/KGCircleWireMesher.cc + Complex/Source/KGCircularWirePinsMesher.cc Simple/Source/KGSimpleMesher.cc Simple/Source/KGFlattenedCircleSurfaceMesher.cc diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircleWireMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircleWireMesher.hh new file mode 100644 index 000000000..599dc6f90 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircleWireMesher.hh @@ -0,0 +1,32 @@ +#ifndef KGeoBag_KGCircleWireMesher_hh_ +#define KGeoBag_KGCircleWireMesher_hh_ + +#include "KGCircleWireSurface.hh" + +#include "KGComplexMesher.hh" + +namespace KGeoBag +{ + class KGCircleWireMesher : + virtual public KGComplexMesher, + public KGWrappedSurface::Visitor + { + public: + using KGMesherBase::VisitExtendedSurface; + using KGMesherBase::VisitExtendedSpace; + + public: + KGCircleWireMesher() + { + } + virtual ~KGCircleWireMesher() + { + } + + protected: + void VisitWrappedSurface(KGWrappedSurface< KGCircleWire >* circleWireSurface); + }; + +} + +#endif diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircularWirePinsMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircularWirePinsMesher.hh new file mode 100644 index 000000000..da7e7bd12 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGCircularWirePinsMesher.hh @@ -0,0 +1,31 @@ +#ifndef KGeoBag_KGCircularWirePinsMesher_hh_ +#define KGeoBag_KGCircularWirePinsMesher_hh_ + +#include "KGCircularWirePinsSurface.hh" +#include "KGComplexMesher.hh" + +namespace KGeoBag +{ + class KGCircularWirePinsMesher : + virtual public KGComplexMesher, + public KGWrappedSurface::Visitor + { + public: + using KGMesherBase::VisitExtendedSurface; + using KGMesherBase::VisitExtendedSpace; + + public: + KGCircularWirePinsMesher() + { + } + virtual ~KGCircularWirePinsMesher() + { + } + + protected: + void VisitWrappedSurface(KGWrappedSurface< KGCircularWirePins >* circularWirePinsSurface); + }; + +} + +#endif diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGConicSectPortHousingSurfaceMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGConicSectPortHousingSurfaceMesher.hh index c04ca7385..e70052a22 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGConicSectPortHousingSurfaceMesher.hh +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGConicSectPortHousingSurfaceMesher.hh @@ -110,7 +110,7 @@ namespace KGeoBag bool LengthsIntersect( double x1min, double x1max, double x2min, double x2max ); - KSmartPointer< KGConicSectPortHousing > fConicSectPortHousing; + std::shared_ptr< KGConicSectPortHousing > fConicSectPortHousing; }; } diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGLinearWireGridMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGLinearWireGridMesher.hh new file mode 100644 index 000000000..d38e32570 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGLinearWireGridMesher.hh @@ -0,0 +1,32 @@ +#ifndef KGeoBag_KGLinearWireGridMesher_hh_ +#define KGeoBag_KGLinearWireGridMesher_hh_ + +#include "KGLinearWireGridSurface.hh" + +#include "KGComplexMesher.hh" + +namespace KGeoBag +{ + class KGLinearWireGridMesher : + virtual public KGComplexMesher, + public KGWrappedSurface::Visitor + { + public: + using KGMesherBase::VisitExtendedSurface; + using KGMesherBase::VisitExtendedSpace; + + public: + KGLinearWireGridMesher() + { + } + virtual ~KGLinearWireGridMesher() + { + } + + protected: + void VisitWrappedSurface(KGWrappedSurface< KGLinearWireGrid >* linearWireGridSurface); + }; + +} + +#endif diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGPortHousingSurfaceMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGPortHousingSurfaceMesher.hh index c616680f3..9e603f2df 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGPortHousingSurfaceMesher.hh +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGPortHousingSurfaceMesher.hh @@ -116,7 +116,7 @@ namespace KGeoBag bool ChordsIntersect( double theta1min, double theta1max, double theta2min, double theta2max ); bool LengthsIntersect( double x1min, double x1max, double x2min, double x2max ); - KSmartPointer< KGPortHousing > fPortHousing; + std::shared_ptr< KGPortHousing > fPortHousing; }; } diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGQuadraticWireGridMesher.hh b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGQuadraticWireGridMesher.hh new file mode 100644 index 000000000..786485ad8 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Include/KGQuadraticWireGridMesher.hh @@ -0,0 +1,32 @@ +#ifndef KGeoBag_KGQuadraticWireGridMesher_hh_ +#define KGeoBag_KGQuadraticWireGridMesher_hh_ + +#include "KGQuadraticWireGridSurface.hh" + +#include "KGComplexMesher.hh" + +namespace KGeoBag +{ + class KGQuadraticWireGridMesher : + virtual public KGComplexMesher, + public KGWrappedSurface::Visitor + { + public: + using KGMesherBase::VisitExtendedSurface; + using KGMesherBase::VisitExtendedSpace; + + public: + KGQuadraticWireGridMesher() + { + } + virtual ~KGQuadraticWireGridMesher() + { + } + + protected: + void VisitWrappedSurface(KGWrappedSurface< KGQuadraticWireGrid >* quadraticWireGridSurface); + }; + +} + +#endif diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGBeamSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGBeamSurfaceMesher.cc index 457ae89b7..fc6d3eee4 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGBeamSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGBeamSurfaceMesher.cc @@ -10,7 +10,7 @@ namespace KGeoBag void KGBeamSurfaceMesher::VisitWrappedSurface( KGBeamSurface* beamSurface ) { - KSmartPointer < KGBeam > beam = beamSurface->GetObject(); + std::shared_ptr < KGBeam > beam = beamSurface->GetObject(); KThreeVector p1, p2, p3, p4; KThreeVector n12, n14, n23, n34; diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircleWireMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircleWireMesher.cc new file mode 100644 index 000000000..a8ad73064 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircleWireMesher.cc @@ -0,0 +1,38 @@ +#include "KGCircleWireMesher.hh" + +#include "KGMeshElement.hh" + +namespace KGeoBag +{ + void KGCircleWireMesher::VisitWrappedSurface( + KGWrappedSurface* circleWireSurface) { + + // fetch needed variables + const unsigned int nDisc = circleWireSurface->GetObject()->GetNDisc(); + const double rCircle = circleWireSurface->GetObject()->GetR(); + const double wireDiameter = circleWireSurface->GetObject()->GetDiameter(); + + // discretize circle: calculate angle to mesh polygon + const double circleAngle = 2 * KConst::Pi() / nDisc; + KThreeVector startPointCircle, endPointCircle; + + startPointCircle.SetComponents(rCircle * cos(circleAngle), + rCircle * sin(circleAngle), 0.); + + for (unsigned int circleIt = 0; circleIt < nDisc; circleIt++) { + endPointCircle.SetComponents( + rCircle * cos((circleIt + 2) * circleAngle), + rCircle * sin((circleIt + 2) * circleAngle), 0.); + + // add element + KGMeshWire singleWireCircle(startPointCircle, endPointCircle, + wireDiameter); + KGMeshWire* circle = new KGMeshWire(singleWireCircle); + AddElement(circle); + + startPointCircle = endPointCircle; + + } /* for loop circle segments */ + + }/* VisitWrappedSurface*/ +} /* namespace */ diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircularWirePinsMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircularWirePinsMesher.cc new file mode 100644 index 000000000..aec9b7b53 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGCircularWirePinsMesher.cc @@ -0,0 +1,57 @@ +#include "KGCircularWirePinsMesher.hh" + +#include "KGMeshElement.hh" + +#include "KGCoreMessage.hh" + +namespace KGeoBag +{ + void KGCircularWirePinsMesher::VisitWrappedSurface( KGWrappedSurface* circularWirePinsSurface) + { + // fetch needed variables + const double r1 = circularWirePinsSurface->GetObject()->GetR1(); + const double r2 = circularWirePinsSurface->GetObject()->GetR2(); + const unsigned int nPins = circularWirePinsSurface->GetObject()->GetNPins(); + const double wireDiameter = circularWirePinsSurface->GetObject()->GetDiameter(); + const double theta = circularWirePinsSurface->GetObject()->GetRotationAngle(); + const unsigned int nDisc = circularWirePinsSurface->GetObject()->GetNDisc(); + const double nDiscPower = circularWirePinsSurface->GetObject()->GetNDiscPower(); + + // angle between pins and length of pin + const double pinAngle = 2. * KConst::Pi() / nPins; + const double lengthOfPin = r2-r1; + + // Iteration over pins + for( unsigned int pinIt = 0; pinIt < nPins; pinIt++ ) + { + // Discretize pins + std::vector segments( nDisc, 0. ); + KGComplexMesher::DiscretizeInterval( lengthOfPin, nDisc, nDiscPower, segments ); + + double rInner( r1 ); + double rOuter( rInner ); + const double thetaRadiant = 2. * KConst::Pi() * theta/360.; + + KThreeVector startPointPin, endPointPin; + startPointPin.SetComponents(rInner * cos((pinIt*pinAngle) + thetaRadiant), rInner * sin((pinIt*pinAngle) + thetaRadiant), 0.); + + // Iteration over segment length + for( unsigned int i=0; i= rInner ) AddElement(w); + startPointPin = endPointPin; + rInner = rOuter; + } /*for segment iteration */ + + } /* for pin iteration */ + + + + }/* VisitWrappedSurface */ +} /* namespace */ diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicSectPortHousingSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicSectPortHousingSurfaceMesher.cc index f10b82a93..ae6777888 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicSectPortHousingSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicSectPortHousingSurfaceMesher.cc @@ -804,8 +804,6 @@ namespace KGeoBag dz.empty(); dz.resize( 2 * paraxialPort->GetCylDisc() ); DiscretizeInterval( 2. * (paraxialPort->GetSymmetricLength() - paraxialPort->GetAsymmetricLength() / 2.), 2 * paraxialPort->GetCylDisc(), 1.25, dz ); - -// double theta = 0; // TODO: WHAT IS THIS VARIABLE FOR? double z = z_high[ 0 ]; double z_last = z_high[ 0 ]; @@ -824,8 +822,6 @@ namespace KGeoBag for( int j = 1; j <= paraxialPort->GetPolySub(); j++ ) { -// theta = fmod( paraxialPort->GetBoxTheta() + 2. * M_PI * ((double) i) / paraxialPort->GetPolySub(), 2. * M_PI ); // TODO: WHAT IS THIS VARIABLE FOR? - Circle_coord( (j - 1) % paraxialPort->GetPolySub(), paraxialPort->GetRSub(), p0 ); p0[ 2 ] = z_last; diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicalWireArrayMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicalWireArrayMesher.cc index 837a7d69b..4ec9caee8 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicalWireArrayMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGConicalWireArrayMesher.cc @@ -9,42 +9,47 @@ namespace KGeoBag void KGConicalWireArrayMesher::VisitWrappedSurface(KGWrappedSurface< KGConicalWireArray >* conicalWireArraySurface) { KTransformation transform; - transform.SetRotationAxisAngle(conicalWireArraySurface->GetObject()->GetThetaStart(),0.,0.); + transform.SetRotationAxisAngle( conicalWireArraySurface->GetObject()->GetThetaStart(), 0., 0. ); - double tAngleStep = 2*KConst::Pi()/conicalWireArraySurface->GetObject()->GetNWires(); - unsigned int tAngleIt( 0 ), tLongitudinalDiscIt( 0 ); + const double wireLength = conicalWireArraySurface->GetObject()->GetLength(); + const unsigned int wireCount = conicalWireArraySurface->GetObject()->GetNWires(); + const double wireR1 = conicalWireArraySurface->GetObject()->GetR1(); + const double wireZ1 = conicalWireArraySurface->GetObject()->GetZ1(); + const double wireR2 = conicalWireArraySurface->GetObject()->GetR2(); + const double wireZ2 = conicalWireArraySurface->GetObject()->GetZ2(); + const double wireDiameter = conicalWireArraySurface->GetObject()->GetDiameter(); + + const double wireNDisc = conicalWireArraySurface->GetObject()->GetNDisc(); - std::vector segments( conicalWireArraySurface->GetObject()->GetNDisc(), 0. ); + double tAngleStep = 2*KConst::Pi()/wireCount; + unsigned int tAngleIt( 0 ), tLongitudinalDiscIt( 0 ); - KGComplexMesher::DiscretizeInterval( - conicalWireArraySurface->GetObject()->GetLength(), - conicalWireArraySurface->GetObject()->GetNDisc(), - conicalWireArraySurface->GetObject()->GetNDiscPower(), - segments); + std::vector segments( wireNDisc, 0. ); + KGComplexMesher::DiscretizeInterval( wireLength, wireNDisc, conicalWireArraySurface->GetObject()->GetNDiscPower(), segments); KThreeVector startPoint, endPoint, v1, v2, distanceVector, unitVector; - for( tAngleIt=0; tAngleItGetObject()->GetNWires(); tAngleIt++ ) + for( tAngleIt=0; tAngleItGetObject()->GetR1()*cos(tAngleStep*tAngleIt), - conicalWireArraySurface->GetObject()->GetR1()*sin(tAngleStep*tAngleIt), - conicalWireArraySurface->GetObject()->GetZ1()); - endPoint.SetComponents( conicalWireArraySurface->GetObject()->GetR2()*cos(tAngleStep*tAngleIt), - conicalWireArraySurface->GetObject()->GetR2()*sin(tAngleStep*tAngleIt), - conicalWireArraySurface->GetObject()->GetZ2()); + startPoint.SetComponents( wireR1*cos(tAngleStep*tAngleIt), wireR1*sin(tAngleStep*tAngleIt), wireZ1 ); + endPoint.SetComponents( wireR2*cos(tAngleStep*tAngleIt), wireR2*sin(tAngleStep*tAngleIt), wireZ2 ); distanceVector = endPoint - startPoint; unitVector.SetComponents( distanceVector/distanceVector.Magnitude() ); + // setting end point to start point, information on end point and wire direction is incorporated in unit vector endPoint = startPoint; - for( tLongitudinalDiscIt=0; tLongitudinalDiscItGetObject()->GetNDisc(); tLongitudinalDiscIt++ ) + for( tLongitudinalDiscIt=0; tLongitudinalDiscItGetObject()->GetDiameter()); + + KGMeshWire singleWire( startPoint, endPoint, wireDiameter ); singleWire.Transform(transform); + KGMeshWire* w = new KGMeshWire(singleWire); AddElement(w); + startPoint = endPoint; } } diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGLinearWireGridMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGLinearWireGridMesher.cc new file mode 100644 index 000000000..aa267c522 --- /dev/null +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGLinearWireGridMesher.cc @@ -0,0 +1,141 @@ +#include "KGLinearWireGridMesher.hh" + +#include "KGMeshElement.hh" + +#define POW2(x) ((x)*(x)) + +namespace KGeoBag +{ + void KGLinearWireGridMesher::VisitWrappedSurface(KGWrappedSurface< KGLinearWireGrid >* linearWireGridSurface) + { + // Mesher for linear wire grid in xy-plane and center (0,0,0) by default + // Wires are meshed in parallel to the x-axis from y<0 to y>0 + // At y=0 a wire is set in each case + // The last wire has the maximal distance of pitch/2 + // => Diameter is assumed to be small versus pitch and consequently ignored + + // no. of parallel wires at y>0 (or y<0), round down + + const unsigned int nWires = static_cast(linearWireGridSurface->GetObject()->GetR()/linearWireGridSurface->GetObject()->GetPitch()); + + // discretized parts at y=0 + + const int nDisc = linearWireGridSurface->GetObject()->GetNDisc(); + const double nDiscPower = linearWireGridSurface->GetObject()->GetNDiscPower(); + + const double rCircle = linearWireGridSurface->GetObject()->GetR(); + const double wireDiameter = linearWireGridSurface->GetObject()->GetDiameter(); + const double wirePitch = linearWireGridSurface->GetObject()->GetPitch(); + const double maxR = rCircle - wireDiameter; + + // std::cout << "nDisc, nDiscPower, maxR, wireDiameter, wirePitch\n"; + // std::cout << nDisc << "\t" << nDiscPower<< "\t" << maxR<< "\t" << wireDiameter<< "\t" << wirePitch << std::endl; + + // draw wire at y=0 + + std::vector segments( nDisc, 0. ); // -R -> +R + KGComplexMesher::DiscretizeInterval( + 2.*maxR, + nDisc, + nDiscPower, + segments ); + + KThreeVector startPoint, endPoint; + startPoint.SetComponents( -maxR, 0., 0.); + + double minimumSegment = maxR; + + for( unsigned int i=0; i* quadraticWireGridSurface ) + { + // fetch needed variables + const unsigned int nDiscPerPitch = quadraticWireGridSurface->GetObject()->GetNDiscPerPitch(); + const double wirePitch = quadraticWireGridSurface->GetObject()->GetPitch(); + const double rCircle = quadraticWireGridSurface->GetObject()->GetR(); + const double wireDiameter = quadraticWireGridSurface->GetObject()->GetDiameter(); + + // radius of the circular wires + const double maxR = rCircle - wireDiameter; + + // no. of parallel wires at y>0 (or y<0), round down + const unsigned int nWires = static_cast(rCircle / wirePitch); + + // length of single segment + const double segmentLength = wirePitch / nDiscPerPitch; + + // draw wire at y=0 and perpendicular, begin to mesh elements at point 0.,0.,0. + + // discretized parts at x, y=0 + KThreeVector startPointYP, endPointYP; + KThreeVector startPointXP, endPointXP; + KThreeVector startPointYN, endPointYN; + KThreeVector startPointXN, endPointXN; + startPointYP.SetComponents(0., 0., 0.); + startPointXP.SetComponents(0., 0., 0.); + startPointYN.SetComponents(0., 0., 0.); + startPointXN.SetComponents(0., 0., 0.); + + // number of segments for wire at y = 0 and perpendicular + unsigned int numberOfSegments = static_cast(maxR + / segmentLength); + + for (unsigned int i = 0; i < numberOfSegments; i++) { + + // mesh wires beginning from 0.,0.,0. + endPointYP.SetComponents(startPointYP.GetX() + segmentLength, 0., 0.); + endPointXP.SetComponents(0., startPointXP.GetY() + segmentLength, 0.); + endPointYN.SetComponents(startPointYN.GetX() - segmentLength, 0., 0.); + endPointXN.SetComponents(0., startPointXN.GetY() - segmentLength, 0.); + + KGMeshWire singleWireYP(startPointYP, endPointYP, wireDiameter); + KGMeshWire* wYP = new KGMeshWire(singleWireYP); + AddElement(wYP); + + KGMeshWire singleWireXP(startPointXP, endPointXP, wireDiameter); + KGMeshWire* wXP = new KGMeshWire(singleWireXP); + AddElement(wXP); + + KGMeshWire singleWireYN(startPointYN, endPointYN, wireDiameter); + KGMeshWire* wYN = new KGMeshWire(singleWireYN); + AddElement(wYN); + + KGMeshWire singleWireXN(startPointXN, endPointXN, wireDiameter); + KGMeshWire* wXN = new KGMeshWire(singleWireXN); + AddElement(wXN); + + startPointYP = endPointYP; + startPointXP = endPointXP; + startPointYN = endPointYN; + startPointXN = endPointXN; + } + + // circular segments + + KThreeVector startPointYPP, endPointYPP; + KThreeVector startPointYNP, endPointYNP; + KThreeVector startPointXPP, endPointXPP; + KThreeVector startPointXNP, endPointXNP; + KThreeVector startPointYPN, endPointYPN; + KThreeVector startPointYNN, endPointYNN; + KThreeVector startPointXPN, endPointXPN; + KThreeVector startPointXNN, endPointXNN; + + for (unsigned int nWire = 1; nWire <= nWires; nWire++) { + + // calculate length and coordinates for the wires y<0,y>0 (and perpendicular wires) + double yIt = (nWire * wirePitch); + double height = maxR - yIt; + double xLengthIt = 2. * sqrt(2. * maxR * height - POW2(height)); + + // calculate number of segments for the wires + unsigned int numberOfSegments = static_cast(0.5 + * xLengthIt / segmentLength); + + // start points for y<0, y>0 and perpendicular + + startPointYPP.SetComponents(0., yIt, 0.); + startPointYNP.SetComponents(0., -yIt, 0.); + startPointXPP.SetComponents(yIt, 0., 0.); + startPointXNP.SetComponents(-yIt, 0., 0.); + startPointYPN.SetComponents(0., yIt, 0.); + startPointYNN.SetComponents(0., -yIt, 0.); + startPointXPN.SetComponents(yIt, 0., 0.); + startPointXNN.SetComponents(-yIt, 0., 0.); + + // iteration over segment vector + for (unsigned int xIt = 0; xIt < numberOfSegments; xIt++) { + + // draw wire at y>0, x>0 (iteration over segments) + endPointYPP.SetComponents(startPointYPP.GetX() + segmentLength, yIt, + 0.); + + // draw wire at y>0, x<0 (iteration over segments) + endPointYPN.SetComponents(startPointYPN.GetX() - segmentLength, yIt, + 0.); + + // draw wire at y<0, x>0 (iteration over segments) + endPointYNP.SetComponents(startPointYNP.GetX() + segmentLength, + -yIt, 0.); + + // draw wire at y<0, x<0 (iteration over segments) + endPointYNN.SetComponents(startPointYNN.GetX() - segmentLength, + -yIt, 0.); + + // draw perpendicular wires + endPointXPP.SetComponents(yIt, startPointXPP.GetY() + segmentLength, + 0.); + endPointXPN.SetComponents(yIt, startPointXPN.GetY() - segmentLength, + 0.); + endPointXNP.SetComponents(-yIt, + startPointXNP.GetY() + segmentLength, 0.); + endPointXNN.SetComponents(-yIt, + startPointXNN.GetY() - segmentLength, 0.); + + // add elements if height > wirePitch/2 to avoid wires with length = 0 + if (height > (wirePitch / 2.)) { + KGMeshWire singleWireYPP(startPointYPP, endPointYPP, + wireDiameter); + KGMeshWire* wYPP = new KGMeshWire(singleWireYPP); + AddElement(wYPP); + startPointYPP = endPointYPP; + + KGMeshWire singleWireYPN(startPointYPN, endPointYPN, + wireDiameter); + KGMeshWire* wYPN = new KGMeshWire(singleWireYPN); + AddElement(wYPN); + startPointYPN = endPointYPN; + + KGMeshWire singleWireYNP(startPointYNP, endPointYNP, + wireDiameter); + KGMeshWire* wYNP = new KGMeshWire(singleWireYNP); + AddElement(wYNP); + startPointYNP = endPointYNP; + + KGMeshWire singleWireYNN(startPointYNN, endPointYNN, + wireDiameter); + KGMeshWire* wYNN = new KGMeshWire(singleWireYNN); + AddElement(wYNN); + startPointYNN = endPointYNN; + + KGMeshWire singleWireXPP(startPointXPP, endPointXPP, + wireDiameter); + KGMeshWire* wXPP = new KGMeshWire(singleWireXPP); + AddElement(wXPP); + startPointXPP = endPointXPP; + + KGMeshWire singleWireXPN(startPointXPN, endPointXPN, + wireDiameter); + KGMeshWire* wXPN = new KGMeshWire(singleWireXPN); + AddElement(wXPN); + startPointXPN = endPointXPN; + + KGMeshWire singleWireXNP(startPointXNP, endPointXNP, + wireDiameter); + KGMeshWire* wXNP = new KGMeshWire(singleWireXNP); + AddElement(wXNP); + startPointXNP = endPointXNP; + + KGMeshWire singleWireXNN(startPointXNN, endPointXNN, + wireDiameter); + KGMeshWire* wXNN = new KGMeshWire(singleWireXNN); + AddElement(wXNN); + startPointXNN = endPointXNN; + } + + } /* for loop xSegment */ + } /* for loop nWire */ + + const bool OuterCircle = quadraticWireGridSurface->GetObject()->GetOuterCircle(); + + // draw outer circle with wire elements + if (OuterCircle) { + // number of elements + unsigned int circleSegmentsIt = static_cast(2 + * KConst::Pi() * rCircle / segmentLength); + + // discretize circle + const double circleAngle = 2 * KConst::Pi() / circleSegmentsIt; + KThreeVector startPointCircle, endPointCircle; + + startPointCircle.SetComponents(rCircle * cos(circleAngle), + rCircle * sin(circleAngle), 0.); + + for (unsigned int circleIt = 0; circleIt < circleSegmentsIt; + circleIt++) { + endPointCircle.SetComponents( + rCircle * cos((circleIt + 2) * circleAngle), + rCircle * sin((circleIt + 2) * circleAngle), 0.); + + // add element + KGMeshWire singleWireCircle(startPointCircle, endPointCircle, wireDiameter); + KGMeshWire* circle = new KGMeshWire(singleWireCircle); + AddElement(circle); + startPointCircle = endPointCircle; + + } /* for loop circle segments */ + + } /*if OuterCircle */ + + }/* VisitWrappedSurface*/ +} /* namespace */ diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRodSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRodSurfaceMesher.cc index 3a623a4d1..2a8f97d2e 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRodSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRodSurfaceMesher.cc @@ -11,7 +11,7 @@ namespace KGeoBag { void KGRodSurfaceMesher::VisitWrappedSurface( KGWrappedSurface< KGRod >* rodSurface ) { - KSmartPointer< KGRod > rod = rodSurface->GetObject(); + std::shared_ptr< KGRod > rod = rodSurface->GetObject(); // First, we compute the total length of the rod double total_length = 0; diff --git a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRotatedSurfaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRotatedSurfaceMesher.cc index b1bc9ee8d..58cc794e2 100644 --- a/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRotatedSurfaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Complex/Source/KGRotatedSurfaceMesher.cc @@ -6,7 +6,7 @@ namespace KGeoBag { void KGRotatedSurfaceMesher::VisitWrappedSurface( KGWrappedSurface< KGRotatedObject >* rotatedSurface ) { - KSmartPointer< KGRotatedObject > rotatedObject = rotatedSurface->GetObject(); + std::shared_ptr< KGRotatedObject > rotatedObject = rotatedSurface->GetObject(); double length = 0.; diff --git a/KGeoBag/Source/Extensions/Mesh/Include/KGMesher.hh b/KGeoBag/Source/Extensions/Mesh/Include/KGMesher.hh index 0e2ee4107..97cc59690 100644 --- a/KGeoBag/Source/Extensions/Mesh/Include/KGMesher.hh +++ b/KGeoBag/Source/Extensions/Mesh/Include/KGMesher.hh @@ -12,6 +12,10 @@ #include "KGPortHousingSurfaceMesher.hh" #include "KGRodSurfaceMesher.hh" #include "KGRotatedSurfaceMesher.hh" +#include "KGLinearWireGridMesher.hh" +#include "KGQuadraticWireGridMesher.hh" +#include "KGCircleWireMesher.hh" +#include "KGCircularWirePinsMesher.hh" #include "KGFlattenedCircleSurfaceMesher.hh" #include "KGFlattenedPolyLoopSurfaceMesher.hh" @@ -57,6 +61,10 @@ namespace KGeoBag virtual public KGRotatedPolyLineSurfaceMesher, virtual public KGRotatedCircleSurfaceMesher, virtual public KGRotatedPolyLoopSurfaceMesher, + virtual public KGLinearWireGridMesher, + virtual public KGQuadraticWireGridMesher, + virtual public KGCircleWireMesher, + virtual public KGCircularWirePinsMesher, virtual public KGShellLineSegmentSurfaceMesher, virtual public KGShellArcSegmentSurfaceMesher, virtual public KGShellPolyLineSurfaceMesher, @@ -88,6 +96,10 @@ namespace KGeoBag using KGConicalWireArrayMesher::VisitWrappedSurface; using KGPortHousingSurfaceMesher::VisitWrappedSurface; using KGConicSectPortHousingSurfaceMesher::VisitWrappedSurface; + using KGLinearWireGridMesher::VisitWrappedSurface; + using KGQuadraticWireGridMesher::VisitWrappedSurface; + using KGCircleWireMesher::VisitWrappedSurface; + using KGCircularWirePinsMesher::VisitWrappedSurface; using KGFlattenedCircleSurfaceMesher::VisitFlattenedClosedPathSurface; using KGFlattenedPolyLoopSurfaceMesher::VisitFlattenedClosedPathSurface; diff --git a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedArcSegmentSpaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedArcSegmentSpaceMesher.cc index f89563191..433b73c32 100644 --- a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedArcSegmentSpaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedArcSegmentSpaceMesher.cc @@ -27,7 +27,7 @@ namespace KGeoBag //surgery KThreeVector tStartApex; - if( aRotatedArcSegmentSpace->StartPath().Null() == false ) + if( aRotatedArcSegmentSpace->StartPath() ) { //create start circle points ClosedPoints tStartCirclePoints; @@ -52,7 +52,7 @@ namespace KGeoBag } KThreeVector tEndApex; - if( aRotatedArcSegmentSpace->EndPath().Null() == false ) + if( aRotatedArcSegmentSpace->EndPath() ) { //create end circle points ClosedPoints tEndCirclePoints; diff --git a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedLineSegmentSpaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedLineSegmentSpaceMesher.cc index 87804f69a..1480661a6 100644 --- a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedLineSegmentSpaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedLineSegmentSpaceMesher.cc @@ -27,7 +27,7 @@ namespace KGeoBag //surgery KThreeVector tStartApex; - if( aRotatedLineSegmentSpace->StartPath().Null() == false ) + if( aRotatedLineSegmentSpace->StartPath() ) { //create start circle points ClosedPoints tStartCirclePoints; @@ -52,7 +52,7 @@ namespace KGeoBag } KThreeVector tEndApex; - if( aRotatedLineSegmentSpace->EndPath().Null() == false ) + if( aRotatedLineSegmentSpace->EndPath() ) { //create end circle points ClosedPoints tEndCirclePoints; diff --git a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedPolyLineSpaceMesher.cc b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedPolyLineSpaceMesher.cc index 5a9404e51..091d317a2 100644 --- a/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedPolyLineSpaceMesher.cc +++ b/KGeoBag/Source/Extensions/Mesh/Simple/Source/KGRotatedPolyLineSpaceMesher.cc @@ -27,7 +27,7 @@ namespace KGeoBag //surgery KThreeVector tStartApex; - if( aRotatedPolyLineSpace->StartPath().Null() == false ) + if( aRotatedPolyLineSpace->StartPath() ) { //create start circle points ClosedPoints tStartCirclePoints; @@ -52,7 +52,7 @@ namespace KGeoBag } KThreeVector tEndApex; - if( aRotatedPolyLineSpace->EndPath().Null() == false ) + if( aRotatedPolyLineSpace->EndPath() ) { //create end circle points ClosedPoints tEndCirclePoints; diff --git a/KGeoBag/Source/Extensions/Mesh/Source/KGMeshWire.cc b/KGeoBag/Source/Extensions/Mesh/Source/KGMeshWire.cc index a1afcf57c..379810ba2 100644 --- a/KGeoBag/Source/Extensions/Mesh/Source/KGMeshWire.cc +++ b/KGeoBag/Source/Extensions/Mesh/Source/KGMeshWire.cc @@ -40,7 +40,7 @@ namespace KGeoBag //here we fudge things by making - //the assumption that the diameter is neglible + //the assumption that the diameter is negligible //compared to the length of the wire //(true nearest distance should be to a cylinder, rather than a line segment) diff --git a/KGeoBag/Source/Extensions/Random/Source/KGCutConeSurfaceRandom.cc b/KGeoBag/Source/Extensions/Random/Source/KGCutConeSurfaceRandom.cc index d7aefb36b..9d056f22d 100644 --- a/KGeoBag/Source/Extensions/Random/Source/KGCutConeSurfaceRandom.cc +++ b/KGeoBag/Source/Extensions/Random/Source/KGCutConeSurfaceRandom.cc @@ -15,18 +15,15 @@ void KGeoBag::KGCutConeSurfaceRandom::VisitCutConeSurface(KGeoBag::KGCutConeSurf double z1 = aCutConeSurface->Z1(); double z2 = aCutConeSurface->Z2(); - double SmallRadius, SmallRadiusPosition, LargeRadius;//, LargeRadiusPosition; // TODO: WHAT IS THIS CODE FOR? - + double SmallRadius, SmallRadiusPosition, LargeRadius; if(r1 < r2){ SmallRadius = r1; SmallRadiusPosition = z1; LargeRadius = r2; -// LargeRadiusPosition = z2; // TODO: WHAT IS THIS CODE FOR? } else{ SmallRadius = r2; SmallRadiusPosition = z2; LargeRadius = r1; -// LargeRadiusPosition = z1; // TODO: WHAT IS THIS CODE FOR? } double ConeLength = z2-z1; diff --git a/KGeoBag/Source/Extensions/Random/Source/KGCylinderSurfaceRandom.cc b/KGeoBag/Source/Extensions/Random/Source/KGCylinderSurfaceRandom.cc index ee4cd2d66..2e45d9c10 100644 --- a/KGeoBag/Source/Extensions/Random/Source/KGCylinderSurfaceRandom.cc +++ b/KGeoBag/Source/Extensions/Random/Source/KGCylinderSurfaceRandom.cc @@ -10,13 +10,6 @@ void KGeoBag::KGCylinderSurfaceRandom::VisitCylinderSurface(KGeoBag::KGCylinderSurface* aCylinderSpace) { KThreeVector point; - // Decide, on which area the point have to be -// double face = KConst::Pi() * aCylinderSpace->R() * aCylinderSpace->R(); -// double curvedSurfaceArea = 2 * KConst::Pi() * aCylinderSpace->R() -// * abs(aCylinderSpace->Z1() - aCylinderSpace->Z2()); - -// double total = 2 * face + curvedSurfaceArea; -// double decision = Uniform(0, total); TODO: SIDES OR NO SIDES? double phi = Uniform(0, 2 * KConst::Pi()); diff --git a/KGeoBag/Source/Extensions/Random/Source/KGRotatedSurfaceRandom.cc b/KGeoBag/Source/Extensions/Random/Source/KGRotatedSurfaceRandom.cc index 33e3c7085..14341b3b3 100644 --- a/KGeoBag/Source/Extensions/Random/Source/KGRotatedSurfaceRandom.cc +++ b/KGeoBag/Source/Extensions/Random/Source/KGRotatedSurfaceRandom.cc @@ -5,7 +5,7 @@ namespace KGeoBag void KGRotatedSurfaceRandom::VisitWrappedSurface(KGRotatedSurface* rotatedSurface) { KThreeVector random; - KSmartPointer rotatedObject = rotatedSurface->GetObject(); + std::shared_ptr rotatedObject = rotatedSurface->GetObject(); double area = rotatedObject->Area(); double sample = Uniform(0.,area); diff --git a/KGeoBag/Source/Math/2DUtility/Source/KG2DArc.cc b/KGeoBag/Source/Math/2DUtility/Source/KG2DArc.cc index 0bbf5d8bd..8926c4822 100644 --- a/KGeoBag/Source/Math/2DUtility/Source/KG2DArc.cc +++ b/KGeoBag/Source/Math/2DUtility/Source/KG2DArc.cc @@ -452,10 +452,6 @@ KG2DArc::NearestIntersection( const KG2DArc* arc, int& flag, std::vectorGetRadius(); KTwoVector del = c - fCenter; double d = del.Magnitude(); -// bool same_ori = false; //TODO: WHAT IS THIS CODE FOR? -// if( arc->IsCCW() && fIsCCW ){same_ori = true;} -// if( !arc->IsCCW() && !fIsCCW ){same_ori = true;} - if(d > r + fRadius) { diff --git a/KGeoBag/Source/Math/2DUtility/Source/KG2DLineSegment.cc b/KGeoBag/Source/Math/2DUtility/Source/KG2DLineSegment.cc index be63b6535..805501cc2 100644 --- a/KGeoBag/Source/Math/2DUtility/Source/KG2DLineSegment.cc +++ b/KGeoBag/Source/Math/2DUtility/Source/KG2DLineSegment.cc @@ -175,8 +175,6 @@ KG2DLineSegment::NearestIntersection( const KTwoVector& aStart, const KTwoVector double p4dist = (anEnd - fP1)*fUnit; double p3dist = (aStart - fP1)*fUnit; -// bool isRight = false; // TODO: WHAT IS THIS CODE FOR? -// if(p4dist > p3dist){isRight = true;} double overlap[2]; int overlap_status; diff --git a/KGeoBag/Source/Math/Include/KRotation.hh b/KGeoBag/Source/Math/Include/KRotation.hh index c8ffa19ee..3994fff7e 100644 --- a/KGeoBag/Source/Math/Include/KRotation.hh +++ b/KGeoBag/Source/Math/Include/KRotation.hh @@ -21,9 +21,15 @@ namespace KGeoBag void SetIdentity(); void SetAxisAngle( const KThreeVector& anAxis, const double& anAngle ); + void SetAxisAngleInDegrees( const KThreeVector& anAxis, const double& anAngle ); void SetEulerAngles( const double& anAlpha, const double& aBeta, const double& aGamma ); + void SetEulerAnglesInDegrees( const double& anAlpha, const double& aBeta, const double& aGamma ); void SetEulerAngles( const vector& anArray ); + void SetEulerAnglesInDegrees( const vector& anArray ); void SetEulerZYZAngles( const double& anAlpha, const double& aBeta, const double& aGamma ); + void SetEulerZYZAnglesInDegrees( const double& anAlpha, const double& aBeta, const double& aGamma ); + void SetEulerZYZAngles( const vector& anArray ); + void SetEulerZYZAnglesInDegrees( const vector& anArray ); void SetRotatedFrame( const KThreeVector& x, const KThreeVector& y, const KThreeVector& z ); }; diff --git a/KGeoBag/Source/Math/Include/KThreeMatrix.hh b/KGeoBag/Source/Math/Include/KThreeMatrix.hh index fcfd75980..3d7c78cf9 100644 --- a/KGeoBag/Source/Math/Include/KThreeMatrix.hh +++ b/KGeoBag/Source/Math/Include/KThreeMatrix.hh @@ -8,6 +8,14 @@ namespace KGeoBag { +/** +* @class KThreeMatrix +* +* @brief A three by three matrix. +* +* @author D.L. Furse +*/ + class KThreeMatrix { public: @@ -18,7 +26,9 @@ namespace KGeoBag public: KThreeMatrix(); - virtual ~KThreeMatrix(); + virtual ~KThreeMatrix() = default; + + static std::string Name() { return "KThreeMatrix"; } //assignment @@ -28,6 +38,9 @@ namespace KGeoBag KThreeMatrix( const double anArray[ 9 ] ); KThreeMatrix& operator=( const double anArray[ 9 ] ); + explicit KThreeMatrix( const double& aValue ); + KThreeMatrix& operator=( const double& aValue ); + KThreeMatrix( const double& anXX, const double& anXY, const double& anXZ, const double& aYX, const double& aYY, const double& aYZ, const double& aZX, const double& aZY, const double& aZZ ); void SetComponents( const double& anXX, const double& anXY, const double& anXZ, const double& aYX, const double& aYY, const double& aYZ, const double& aZX, const double& aZY, const double& aZZ ); void SetComponents( const double anArray[ 9 ] ); @@ -49,6 +62,9 @@ namespace KGeoBag //properties KThreeMatrix Inverse() const; + KThreeMatrix Transpose() const; + KThreeMatrix Multiply(const KThreeMatrix&) const; + KThreeMatrix MultiplyTranspose(const KThreeMatrix&) const; double Determinant() const; double Trace() const; @@ -118,6 +134,37 @@ namespace KGeoBag return *this; } + inline KThreeMatrix::KThreeMatrix( const double& aValue ) + { + fData[0] = aValue; + fData[1] = aValue; + fData[2] = aValue; + + fData[3] = aValue; + fData[4] = aValue; + fData[5] = aValue; + + fData[6] = aValue; + fData[7] = aValue; + fData[8] = aValue; + } + inline KThreeMatrix& KThreeMatrix::operator=( const double& aValue ) + { + fData[0] = aValue; + fData[1] = aValue; + fData[2] = aValue; + + fData[3] = aValue; + fData[4] = aValue; + fData[5] = aValue; + + fData[6] = aValue; + fData[7] = aValue; + fData[8] = aValue; + + return *this; + } + inline KThreeMatrix::KThreeMatrix( const double& anXX, const double& anXY, const double& anXZ, const double& aYX, const double& aYY, const double& aYZ, const double& aZX, const double& aZY, const double& aZZ ) { fData[0] = anXX; @@ -222,6 +269,37 @@ namespace KGeoBag return KThreeMatrix( 0., 0., 0., 0., 0., 0., 0., 0., 0. ); } } + inline KThreeMatrix KThreeMatrix::Transpose() const + { + return KThreeMatrix(fData[0],fData[3],fData[6],fData[1],fData[4],fData[7],fData[2],fData[5],fData[8]); + } + inline KThreeMatrix KThreeMatrix::Multiply(const KThreeMatrix& b) const + { + const KThreeMatrix& a = *this; + return KThreeMatrix(a[0]*b[0] + a[1]*b[3] + a[2]*b[6], + a[0]*b[1] + a[1]*b[4] + a[2]*b[7], + a[0]*b[2] + a[1]*b[5] + a[2]*b[8], + a[3]*b[0] + a[4]*b[3] + a[5]*b[6], + a[3]*b[1] + a[4]*b[4] + a[5]*b[7], + a[3]*b[2] + a[4]*b[5] + a[5]*b[8], + a[6]*b[0] + a[7]*b[3] + a[8]*b[6], + a[6]*b[1] + a[7]*b[4] + a[8]*b[7], + a[6]*b[2] + a[7]*b[5] + a[8]*b[8]); + } + inline KThreeMatrix KThreeMatrix::MultiplyTranspose(const KThreeMatrix& b) const + { + // return a x b^{T} + const KThreeMatrix& a = *this; + return KThreeMatrix(a[0]*b[0] + a[1]*b[1] + a[2]*b[2], + a[0]*b[3] + a[1]*b[4] + a[2]*b[5], + a[0]*b[6] + a[1]*b[7] + a[2]*b[8], + a[3]*b[0] + a[4]*b[1] + a[5]*b[2], + a[3]*b[3] + a[4]*b[4] + a[5]*b[5], + a[3]*b[6] + a[4]*b[7] + a[5]*b[8], + a[6]*b[0] + a[7]*b[1] + a[8]*b[2], + a[6]*b[3] + a[7]*b[4] + a[8]*b[5], + a[6]*b[6] + a[7]*b[7] + a[8]*b[8]); + } inline double KThreeMatrix::Determinant() const { return (-fData[2] * fData[4] * fData[6] + fData[1] * fData[5] * fData[6] + fData[2] * fData[3] * fData[7] - fData[0] * fData[5] * fData[7] - fData[1] * fData[3] * fData[8] + fData[0] * fData[4] * fData[8]); diff --git a/KGeoBag/Source/Math/Include/KThreeVector.hh b/KGeoBag/Source/Math/Include/KThreeVector.hh index c5ab58592..6c5bcb5ed 100644 --- a/KGeoBag/Source/Math/Include/KThreeVector.hh +++ b/KGeoBag/Source/Math/Include/KThreeVector.hh @@ -3,9 +3,9 @@ #include "KTwoVector.hh" -#include +#include "KConst.h" using katrin::KConst; -#include +#include "KHash.h" #include using std::istream; @@ -34,7 +34,9 @@ namespace KGeoBag public: KThreeVector(); - ~KThreeVector(); + virtual ~KThreeVector() = default; + + static std::string Name() { return "KThreeVector"; } //assignment @@ -100,6 +102,10 @@ namespace KGeoBag double AzimuthalAngle() const; double PolarAngleInDegrees() const; double AzimuthalAngleInDegrees() const; + KThreeVector Abs() const; + KThreeVector Pow( const double& anExponent = 2 ) const; + KThreeVector Sqr() const; + KThreeVector Sqrt() const; KThreeVector Unit() const; KThreeVector Orthogonal() const; KThreeVector Cross( const KThreeVector& aVector ) const; @@ -325,6 +331,22 @@ inline double KThreeVector::AzimuthalAngleInDegrees() const return AzimuthalAngle() * 180. / KConst::Pi(); } +inline KThreeVector KThreeVector::Abs() const +{ + return KThreeVector( std::fabs(fData[ 0 ]), std::fabs(fData[ 1 ]), std::fabs(fData[ 2 ]) ); +} +inline KThreeVector KThreeVector::Pow( const double& anExponent ) const +{ + return KThreeVector( std::pow(fData[ 0 ], anExponent), std::pow(fData[ 1 ], anExponent), std::pow(fData[ 2 ], anExponent) ); +} +inline KThreeVector KThreeVector::Sqr() const +{ + return KThreeVector( fData[ 0 ]*fData[ 0 ], fData[ 1 ]*fData[ 1 ], fData[ 2 ]*fData[ 2 ] ); +} +inline KThreeVector KThreeVector::Sqrt() const +{ + return KThreeVector( std::sqrt(fData[ 0 ]), std::sqrt(fData[ 1 ]), std::sqrt(fData[ 2 ]) ); +} inline KThreeVector KThreeVector::Unit() const { const double tMagnitude = Magnitude(); diff --git a/KGeoBag/Source/Math/Include/KTwoMatrix.hh b/KGeoBag/Source/Math/Include/KTwoMatrix.hh index 5f2340007..de02220fb 100644 --- a/KGeoBag/Source/Math/Include/KTwoMatrix.hh +++ b/KGeoBag/Source/Math/Include/KTwoMatrix.hh @@ -13,7 +13,7 @@ namespace KGeoBag public: KTwoMatrix(); KTwoMatrix( const double& anXX, const double& anXY, const double& aYX, const double& aYY ); - virtual ~KTwoMatrix(); + virtual ~KTwoMatrix() = default; //assignment @@ -97,7 +97,7 @@ namespace KGeoBag inline KTwoMatrix::KTwoMatrix( const vector& anArray ) { assert( anArray.size() == 4 ); - + fData[0] = anArray[0]; fData[1] = anArray[1]; diff --git a/KGeoBag/Source/Math/Include/KTwoVector.hh b/KGeoBag/Source/Math/Include/KTwoVector.hh index e631e23fb..ffbe00b65 100644 --- a/KGeoBag/Source/Math/Include/KTwoVector.hh +++ b/KGeoBag/Source/Math/Include/KTwoVector.hh @@ -33,7 +33,7 @@ namespace KGeoBag public: KTwoVector(); - ~KTwoVector(); + virtual ~KTwoVector() = default; //assignment diff --git a/KGeoBag/Source/Math/Source/KRotation.cc b/KGeoBag/Source/Math/Source/KRotation.cc index 8df379197..9c59441c8 100644 --- a/KGeoBag/Source/Math/Source/KRotation.cc +++ b/KGeoBag/Source/Math/Source/KRotation.cc @@ -52,6 +52,7 @@ namespace KGeoBag return; } + void KRotation::SetAxisAngle( const KThreeVector& tAxis, const double& anAngle ) { double tSine = sin( anAngle ); @@ -72,6 +73,11 @@ namespace KGeoBag return; } + void KRotation::SetAxisAngleInDegrees( const KThreeVector& tAxis, const double& anAngle ) + { + SetAxisAngle( tAxis, KConst::Pi() / 180. * anAngle ); + } + void KRotation::SetEulerAngles( const double& anAlpha, const double& aBeta, const double& aGamma ) { double tSineAlpha = sin( anAlpha ); @@ -95,36 +101,61 @@ namespace KGeoBag return; } + void KRotation::SetEulerAnglesInDegrees( const double& anAlpha, const double& aBeta, const double& aGamma ) + { + SetEulerAngles( KConst::Pi() / 180. * anAlpha, KConst::Pi() / 180. * aBeta, KConst::Pi() / 180. * aGamma ); + } + void KRotation::SetEulerAngles( const vector& anArray ) { assert(anArray.size() == 3); SetEulerAngles( anArray[0], anArray[1], anArray[2] ); } + void KRotation::SetEulerAnglesInDegrees( const vector& anArray ) + { + assert(anArray.size() == 3); + SetEulerAnglesInDegrees( anArray[0], anArray[1], anArray[2] ); + } void KRotation::SetEulerZYZAngles( const double& anAlpha, const double& aBeta, const double& aGamma ) - { - // Euler Rotation in z,y',z'' convention - double tSineAlpha = sin( anAlpha ); - double tCosineAlpha = cos( anAlpha ); - double tSineBeta = sin( aBeta ); - double tCosineBeta = cos( aBeta ); - double tSineGamma = sin( aGamma ); - double tCosineGamma = cos( aGamma ); - - fData[0] = - tSineAlpha * tSineGamma + tCosineAlpha * tCosineBeta * tCosineGamma; - fData[1] = - tSineAlpha * tCosineGamma - tCosineAlpha * tCosineBeta * tSineGamma; - fData[2] = tCosineAlpha * tSineBeta; - - fData[3] = tCosineAlpha * tSineGamma + tSineAlpha * tCosineBeta * tCosineGamma; - fData[4] = tCosineAlpha * tCosineGamma - tSineAlpha * tCosineBeta * tSineGamma; - fData[5] = tSineAlpha * tSineBeta; - - fData[6] = - tSineBeta * tCosineGamma; - fData[7] = tSineBeta * tSineGamma; - fData[8] = tCosineBeta; - - return; - } + { + // Euler Rotation in z,y',z'' convention + double tSineAlpha = sin( anAlpha ); + double tCosineAlpha = cos( anAlpha ); + double tSineBeta = sin( aBeta ); + double tCosineBeta = cos( aBeta ); + double tSineGamma = sin( aGamma ); + double tCosineGamma = cos( aGamma ); + + fData[0] = - tSineAlpha * tSineGamma + tCosineAlpha * tCosineBeta * tCosineGamma; + fData[1] = - tSineAlpha * tCosineGamma - tCosineAlpha * tCosineBeta * tSineGamma; + fData[2] = tCosineAlpha * tSineBeta; + + fData[3] = tCosineAlpha * tSineGamma + tSineAlpha * tCosineBeta * tCosineGamma; + fData[4] = tCosineAlpha * tCosineGamma - tSineAlpha * tCosineBeta * tSineGamma; + fData[5] = tSineAlpha * tSineBeta; + + fData[6] = - tSineBeta * tCosineGamma; + fData[7] = tSineBeta * tSineGamma; + fData[8] = tCosineBeta; + + return; + } + void KRotation::SetEulerZYZAnglesInDegrees( const double& anAlpha, const double& aBeta, const double& aGamma ) + { + SetEulerZYZAngles( KConst::Pi() / 180. * anAlpha, KConst::Pi() / 180. * aBeta, KConst::Pi() / 180. * aGamma ); + } + + void KRotation::SetEulerZYZAngles( const vector& anArray ) + { + assert(anArray.size() == 3); + SetEulerZYZAngles( anArray[0], anArray[1], anArray[2] ); + } + void KRotation::SetEulerZYZAnglesInDegrees( const vector& anArray ) + { + assert(anArray.size() == 3); + SetEulerZYZAnglesInDegrees( anArray[0], anArray[1], anArray[2] ); + } void KRotation::SetRotatedFrame( const KThreeVector& x, const KThreeVector& y, const KThreeVector& z ) { diff --git a/KGeoBag/Source/Math/Source/KThreeMatrix.cc b/KGeoBag/Source/Math/Source/KThreeMatrix.cc index 78c68cfda..1cea85f05 100644 --- a/KGeoBag/Source/Math/Source/KThreeMatrix.cc +++ b/KGeoBag/Source/Math/Source/KThreeMatrix.cc @@ -28,8 +28,5 @@ namespace KGeoBag fData[7] = 0.; fData[8] = 0.; } - KThreeMatrix::~KThreeMatrix() - { - } } diff --git a/KGeoBag/Source/Math/Source/KThreeVector.cc b/KGeoBag/Source/Math/Source/KThreeVector.cc index ca25dd247..bc6d63c4e 100644 --- a/KGeoBag/Source/Math/Source/KThreeVector.cc +++ b/KGeoBag/Source/Math/Source/KThreeVector.cc @@ -16,8 +16,5 @@ namespace KGeoBag fData[1] = 0.; fData[2] = 0.; } - KThreeVector::~KThreeVector() - { - } } diff --git a/KGeoBag/Source/Math/Source/KTwoMatrix.cc b/KGeoBag/Source/Math/Source/KTwoMatrix.cc index aa385fbf1..3dd069fea 100644 --- a/KGeoBag/Source/Math/Source/KTwoMatrix.cc +++ b/KGeoBag/Source/Math/Source/KTwoMatrix.cc @@ -11,8 +11,5 @@ namespace KGeoBag fData[2] = 0.; fData[3] = 0.; } - KTwoMatrix::~KTwoMatrix() - { - } } diff --git a/KGeoBag/Source/Math/Source/KTwoVector.cc b/KGeoBag/Source/Math/Source/KTwoVector.cc index a51a1e328..f8f25a46f 100644 --- a/KGeoBag/Source/Math/Source/KTwoVector.cc +++ b/KGeoBag/Source/Math/Source/KTwoVector.cc @@ -17,8 +17,5 @@ namespace KGeoBag fData[0] = 0.; fData[1] = 0.; } - KTwoVector::~KTwoVector() - { - } } diff --git a/KGeoBag/Source/Math/SpaceTree/Include/KGPoint.hh b/KGeoBag/Source/Math/SpaceTree/Include/KGPoint.hh index ea62ca86e..2aa5f56ac 100644 --- a/KGeoBag/Source/Math/SpaceTree/Include/KGPoint.hh +++ b/KGeoBag/Source/Math/SpaceTree/Include/KGPoint.hh @@ -120,7 +120,7 @@ inline double operator*( const KGPoint& aLeft, const KGPoint& aRight } template -inline KGPoint operator*( register double aScalar, const KGPoint& aVector ) +inline KGPoint operator*( double aScalar, const KGPoint& aVector ) { KGPoint aResult( aVector ); for (size_t i=0; i operator*( register double aScalar, const KGPoint& a } template -inline KGPoint operator*( const KGPoint& aVector, register double aScalar ) +inline KGPoint operator*( const KGPoint& aVector, double aScalar ) { KGPoint aResult( aVector ); for (size_t i=0; i operator*( const KGPoint& aVector, register double aS } template -inline KGPoint& operator*=( KGPoint& aVector, register double aScalar ) +inline KGPoint& operator*=( KGPoint& aVector, double aScalar ) { for (size_t i=0; i& operator*=( KGPoint& aVector, register double aScala } template -inline KGPoint operator/( const KGPoint& aVector, register double aScalar ) +inline KGPoint operator/( const KGPoint& aVector, double aScalar ) { KGPoint aResult( aVector ); for (size_t i=0; i operator/( const KGPoint& aVector, register double aS } template -inline KGPoint& operator/=( KGPoint& aVector, register double aScalar ) +inline KGPoint& operator/=( KGPoint& aVector, double aScalar ) { for (size_t i=0; i #include +#include "KGBoundary.hh" #include "KGCoordinateTransform.hh" namespace KGeoBag { - class KGBeam + class KGBeam : public KGBoundary { /* A class describing a straight beam-like object. The ends of the beam do diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircleWire.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWire.hh new file mode 100644 index 000000000..78a487d61 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWire.hh @@ -0,0 +1,73 @@ +#ifndef KGCIRCLEWIRE_DEF +#define KGCIRCLEWIRE_DEF + +#include +#include +#include +#include + +#include "KGBoundary.hh" + +namespace KGeoBag { + +class KGCircleWire : public KGBoundary +{ + /* + A class describing a wire circle with a flat section profile + */ +public: + KGCircleWire() { + } + KGCircleWire(double r, double diameter, unsigned int nDisc) : + fR(r), fDiameter(diameter), fNDisc(nDisc) { + } + + virtual ~KGCircleWire() { + } + + static std::string Name() { + return "circle_wire"; + } + + virtual KGCircleWire* Clone() const; + + virtual void Initialize() const { + } + + bool ContainsPoint(const double* P) const; + double DistanceTo(const double* P, double* P_in = NULL, double* P_norm = + NULL) const; + + double GetLength() const; + double Area() const; + double Volume() const; + + void SetR(double d) { + fR = d; + } + void SetDiameter(double d) { + fDiameter = d; + } + void SetNDisc(unsigned int d) { + fNDisc = d; + } + + double GetR() const { + return fR; + } + double GetDiameter() const { + return fDiameter; + } + unsigned int GetNDisc() const { + return fNDisc; + } + +private: + + double fR; + double fDiameter; + unsigned int fNDisc; +}; +} + +#endif /* KGWIRECIRCLE_DEF */ diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSpace.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSpace.hh new file mode 100644 index 000000000..a17200783 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSpace.hh @@ -0,0 +1,15 @@ +#ifndef KGCIRCLEWIRESPACE_HH_ +#define KGCIRCLEWIRESPACE_HH_ + +#include "KGWrappedSpace.hh" + +#include "KGCircleWire.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSpace< KGCircleWire > KGCircleWireSpace; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSurface.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSurface.hh new file mode 100644 index 000000000..26ffba275 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircleWireSurface.hh @@ -0,0 +1,15 @@ +#ifndef KGCIRCLEWIRESURFACE_HH_ +#define KGCIRCLEWIRESURFACE_HH_ + +#include "KGWrappedSurface.hh" + +#include "KGCircleWire.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSurface< KGCircleWire > KGCircleWireSurface; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePins.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePins.hh new file mode 100644 index 000000000..f93076afb --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePins.hh @@ -0,0 +1,114 @@ +#ifndef KGCIRCULARWIREPINS_DEF +#define KGCIRCULARWIREPINS_DEF + +#include +#include +#include +#include + +#include "KGBoundary.hh" + +namespace KGeoBag +{ + +class KGCircularWirePins : public KGBoundary +{ + /* + A class describing circular wire pins with a flat section profile + */ +public: + KGCircularWirePins() { + } + KGCircularWirePins(double r1, + double r2, + unsigned int nPins, + double diameter, + double rotationAngle, + unsigned int nDisc, + unsigned int nDiscPower) : fR1(r1), + fR2(r2), + fNPins(nPins), + fDiameter(diameter), + fRotationAngle(rotationAngle), + fNDisc(nDisc), + fNDiscPower(nDiscPower) + { + } + + virtual ~KGCircularWirePins() { + } + + static std::string Name() { + return "circular_wire_pins"; + } + + virtual KGCircularWirePins* Clone() const; + + virtual void Initialize() const { + } + + bool ContainsPoint(const double* P) const; + double DistanceTo(const double* P, double* P_in = NULL, double* P_norm = + NULL) const; + + double GetLength() const; + double Area() const; + double Volume() const; + + void SetR1(double d) { + fR1 = d; + } + void SetR2(double d) { + fR2 = d; + } + void SetNPins(unsigned int d) { + fNPins = d; + } + void SetDiameter(double d) { + fDiameter = d; + } + void SetRotationAngle(double d) { + fRotationAngle = d; + } + void SetNDisc(unsigned int d) { + fNDisc = d; + } + void SetNDiscPower(double d) { + fNDiscPower = d; + } + + double GetR1() const { + return fR1; + } + double GetR2() const { + return fR2; + } + unsigned int GetNPins() const { + return fNPins; + } + double GetDiameter() const { + return fDiameter; + } + double GetRotationAngle() const { + return fRotationAngle; + } + unsigned int GetNDisc() const { + return fNDisc; + } + double GetNDiscPower() const { + return fNDiscPower; + } + +private: + + double fR1; + double fR2; + unsigned int fNPins; + double fDiameter; + double fRotationAngle; + unsigned int fNDisc; + double fNDiscPower; +}; +} + +#endif /* KGCIRCULARWIREPINS_DEF */ diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSpace.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSpace.hh new file mode 100644 index 000000000..243ee009c --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSpace.hh @@ -0,0 +1,15 @@ +#ifndef KGCIRCULARWIREPINSSPACE_HH_ +#define KGCIRCULARWIREPINSSPACE_HH_ + +#include "KGCircularWirePins.hh" +#include "KGWrappedSpace.hh" + + +namespace KGeoBag +{ + + typedef KGWrappedSpace< KGCircularWirePins > KGCircularWirePinsSpace; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSurface.hh b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSurface.hh new file mode 100644 index 000000000..ca98fe05f --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGCircularWirePinsSurface.hh @@ -0,0 +1,15 @@ +#ifndef KGCIRCULARWIREPINSSURFACE_HH_ +#define KGCIRCULARWIREPINSSURFACE_HH_ + +#include "KGCircularWirePins.hh" +#include "KGWrappedSurface.hh" + + +namespace KGeoBag +{ + + typedef KGWrappedSurface< KGCircularWirePins > KGCircularWirePinsSurface; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGConicSectPortHousing.hh b/KGeoBag/Source/Shapes/Complex/Include/KGConicSectPortHousing.hh index 3000b9db2..b06467953 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGConicSectPortHousing.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGConicSectPortHousing.hh @@ -3,11 +3,12 @@ #include +#include "KGBoundary.hh" #include "KGCoordinateTransform.hh" namespace KGeoBag { - class KGConicSectPortHousing + class KGConicSectPortHousing : public KGBoundary { public: KGConicSectPortHousing() {} diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGConicalWireArray.hh b/KGeoBag/Source/Shapes/Complex/Include/KGConicalWireArray.hh index 56bda7d23..1bf183d86 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGConicalWireArray.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGConicalWireArray.hh @@ -6,9 +6,11 @@ #include #include +#include "KGBoundary.hh" + namespace KGeoBag { - class KGConicalWireArray + class KGConicalWireArray : public KGBoundary { /* A class describing a wire array with a conic section profile diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGExtrudedObject.hh b/KGeoBag/Source/Shapes/Complex/Include/KGExtrudedObject.hh index a1c2be509..483736615 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGExtrudedObject.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGExtrudedObject.hh @@ -6,9 +6,11 @@ #include #include +#include "KGBoundary.hh" + namespace KGeoBag { - class KGExtrudedObject + class KGExtrudedObject : public KGBoundary { public: KGExtrudedObject() : fZMin(0.), diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGrid.hh b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGrid.hh new file mode 100644 index 000000000..69a208c72 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGrid.hh @@ -0,0 +1,74 @@ +#ifndef KGLINEARWIREGRID_DEF +#define KGLINEARWIREGRID_DEF + +#include +#include +#include +#include + +#include "KGBoundary.hh" + +namespace KGeoBag +{ + class KGLinearWireGrid : public KGBoundary + { + /* + A class describing a wire grid with a flat section profile + */ + public: + KGLinearWireGrid() {} + KGLinearWireGrid(double r, + double pitch, + double diameter, + unsigned int nDisc, + double nDiscPower, + bool outerCircle) : fR(r), + fPitch(pitch), + fDiameter(diameter), + fNDisc(nDisc), + fNDiscPower(nDiscPower), + fOuterCircle(outerCircle){} + + virtual ~KGLinearWireGrid() {} + + static std::string Name() { return "linear_wire_grid"; } + + virtual KGLinearWireGrid* Clone() const; + + virtual void Initialize() const {} + + bool ContainsPoint(const double* P) const; + double DistanceTo(const double* P, + double* P_in=NULL, + double* P_norm=NULL) const; + + double GetLength() const; + double Area() const; + double Volume() const; + + void SetR (double d) { fR = d; } + void SetPitch (double d) { fPitch = d; } + void SetDiameter(double d) { fDiameter = d; } + void SetNDisc(unsigned int d) { fNDisc = d; } + void SetNDiscPower(double d) { fNDiscPower = d; } + void SetOuterCircle( bool b ) { fOuterCircle = b; } + + double GetR() const { return fR;} + double GetPitch() const { return fPitch; } + double GetDiameter() const { return fDiameter; } + unsigned int GetNDisc() const { return fNDisc; } + double GetNDiscPower() const { return fNDiscPower; } + bool GetOuterCircle() const { return fOuterCircle; } + + private: + + double fR; + double fPitch; + double fDiameter; + unsigned int fNDisc; + double fNDiscPower; + bool fOuterCircle; + }; +} + +#endif /* KGLINEARWIREGRID_DEF */ diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSpace.hh b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSpace.hh new file mode 100644 index 000000000..a0b8d4b3a --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSpace.hh @@ -0,0 +1,15 @@ +#ifndef KGLINEARWIREGRIDSPACE_HH_ +#define KGLINEARWIREGRIDSPACE_HH_ + +#include "KGWrappedSpace.hh" + +#include "KGLinearWireGrid.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSpace< KGLinearWireGrid > KGLinearWireGridSpace; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSurface.hh b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSurface.hh new file mode 100644 index 000000000..3707c4c90 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGLinearWireGridSurface.hh @@ -0,0 +1,15 @@ +#ifndef KGLINEARWIREGRIDSURFACE_HH_ +#define KGLINEARWIREGRIDSURFACE_HH_ + +#include "KGWrappedSurface.hh" + +#include "KGLinearWireGrid.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSurface< KGLinearWireGrid > KGLinearWireGridSurface; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGPortHousing.hh b/KGeoBag/Source/Shapes/Complex/Include/KGPortHousing.hh index 6b621eabf..dca8a7fcf 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGPortHousing.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGPortHousing.hh @@ -3,11 +3,12 @@ #include +#include "KGBoundary.hh" #include "KGCoordinateTransform.hh" namespace KGeoBag { - class KGPortHousing + class KGPortHousing : public KGBoundary { public: KGPortHousing() : fCoordTransform(NULL) {} diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGrid.hh b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGrid.hh new file mode 100644 index 000000000..e0d667841 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGrid.hh @@ -0,0 +1,69 @@ +#ifndef KGQUADRATICWIREGRID_DEF +#define KGQUADRATICWIREGRID_DEF + +#include +#include +#include +#include + +#include "KGBoundary.hh" + +namespace KGeoBag +{ + class KGQuadraticWireGrid : public KGBoundary + { + /* + A class describing a wire grid with a flat section profile + */ + public: + KGQuadraticWireGrid() {} + KGQuadraticWireGrid(double r, + double pitch, + double diameter, + unsigned int nDiscPerPitch, + bool outerCircle) : fR(r), + fPitch(pitch), + fDiameter(diameter), + fNDiscPerPitch(nDiscPerPitch), + fOuterCircle(outerCircle){} + + virtual ~KGQuadraticWireGrid() {} + + static std::string Name() { return "quadratric_wire_grid"; } + + virtual KGQuadraticWireGrid* Clone() const; + + virtual void Initialize() const {} + + bool ContainsPoint(const double* P) const; + double DistanceTo(const double* P, + double* P_in=NULL, + double* P_norm=NULL) const; + + double GetLength() const; + double Area() const; + double Volume() const; + + void SetR (double d) { fR = d; } + void SetPitch (double d) { fPitch = d; } + void SetDiameter(double d) { fDiameter = d; } + void SetNDiscPerPitch(unsigned int d) { fNDiscPerPitch = d; } + void SetOuterCircle( bool b ) { fOuterCircle = b; } + + double GetR() const { return fR;} + double GetPitch() const { return fPitch; } + double GetDiameter() const { return fDiameter; } + unsigned int GetNDiscPerPitch() const { return fNDiscPerPitch; } + bool GetOuterCircle() const { return fOuterCircle; } + + private: + + double fR; + double fPitch; + double fDiameter; + unsigned int fNDiscPerPitch; + bool fOuterCircle; + }; +} + +#endif /* KGQUDRATICRWIREGRID_DEF */ diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSpace.hh b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSpace.hh new file mode 100644 index 000000000..b54d1dee2 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSpace.hh @@ -0,0 +1,15 @@ +#ifndef KGQUADRATICWIREGRIDSPACE_HH_ +#define KGQUADRATICWIREGRIDSPACE_HH_ + +#include "KGWrappedSpace.hh" + +#include "KGQuadraticWireGrid.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSpace< KGQuadraticWireGrid > KGQuadraticWireGridSpace; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSurface.hh b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSurface.hh new file mode 100644 index 000000000..d4f7a486c --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Include/KGQuadraticWireGridSurface.hh @@ -0,0 +1,15 @@ +#ifndef KGQUADRATICWIREGRIDSURFACE_HH_ +#define KGQUADRATICWIREGRIDSURFACE_HH_ + +#include "KGWrappedSurface.hh" + +#include "KGQuadraticWireGrid.hh" + +namespace KGeoBag +{ + + typedef KGWrappedSurface< KGQuadraticWireGrid > KGQuadraticWireGridSurface; + +} + +#endif diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGRod.hh b/KGeoBag/Source/Shapes/Complex/Include/KGRod.hh index 61267b1e5..0a329b1f3 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGRod.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGRod.hh @@ -6,9 +6,11 @@ #include #include +#include "KGBoundary.hh" + namespace KGeoBag { - class KGRod + class KGRod : public KGBoundary { /* A class describing a rod. The rod can be bent into arbitrary shapes, as diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGRotatedObject.hh b/KGeoBag/Source/Shapes/Complex/Include/KGRotatedObject.hh index f7b471d49..3ff2d3e7d 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGRotatedObject.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGRotatedObject.hh @@ -6,10 +6,12 @@ #include #include +#include "KGBoundary.hh" + namespace KGeoBag { - class KGRotatedObject + class KGRotatedObject : public KGBoundary { public: KGRotatedObject() : fNPolyBegin(0), @@ -241,7 +243,7 @@ namespace KGeoBag // discretization number about the z-axis for the first opening unsigned int fNPolyBegin; // discretization number about the z-axis for the second opening - unsigned int fNPolyEnd; + unsigned int fNPolyEnd; // # of segments that comprise the 2-D image unsigned int fNSegments; diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSpace.hh b/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSpace.hh index 5b418377f..f2bdad825 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSpace.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSpace.hh @@ -25,13 +25,13 @@ namespace KGeoBag public: KGWrappedSpace(); KGWrappedSpace(XObject* anObject); - KGWrappedSpace(const KSmartPointer& anObject); + KGWrappedSpace(const std::shared_ptr& anObject); KGWrappedSpace(const KGWrappedSpace& aCopy); virtual ~KGWrappedSpace(); public: - void SetObject(KSmartPointer anObject); - KSmartPointer GetObject() const; + void SetObject(std::shared_ptr anObject); + std::shared_ptr GetObject() const; public: virtual void VolumeInitialize(BoundaryContainer& aBoundaryContainer) const; @@ -41,7 +41,7 @@ namespace KGeoBag virtual KThreeVector VolumeNormal(const KThreeVector& aPoint) const; protected: - KSmartPointer fObject; + std::shared_ptr fObject; }; template @@ -57,7 +57,7 @@ namespace KGeoBag } template - KGWrappedSpace::KGWrappedSpace(const KSmartPointer& anObject) : KGVolume() + KGWrappedSpace::KGWrappedSpace(const std::shared_ptr& anObject) : KGVolume() { fObject = anObject; } @@ -75,14 +75,14 @@ namespace KGeoBag } template - void KGWrappedSpace::SetObject(KSmartPointer anObject) + void KGWrappedSpace::SetObject(std::shared_ptr anObject) { fObject = anObject; return; } template - KSmartPointer KGWrappedSpace::GetObject() const + std::shared_ptr KGWrappedSpace::GetObject() const { return fObject; } @@ -91,8 +91,7 @@ namespace KGeoBag void KGWrappedSpace::VolumeInitialize(BoundaryContainer& aBoundaryContainer) const { fObject->Initialize(); - KGWrappedSurface* tSurface = - new KGWrappedSurface(fObject); + auto tSurface = std::shared_ptr(fObject); aBoundaryContainer.push_back(tSurface); return; } diff --git a/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSurface.hh b/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSurface.hh index 6cf874166..bbd03328c 100644 --- a/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSurface.hh +++ b/KGeoBag/Source/Shapes/Complex/Include/KGWrappedSurface.hh @@ -21,14 +21,14 @@ namespace KGeoBag public: KGWrappedSurface(); KGWrappedSurface(XObject* anObject); - KGWrappedSurface(const KSmartPointer& anObject); + KGWrappedSurface(const std::shared_ptr& anObject); KGWrappedSurface(const KGWrappedSurface& aCopy); virtual ~KGWrappedSurface(); public: - void SetObject(KSmartPointer anObject); - KSmartPointer GetObject(); - const KSmartPointer GetObject() const; + void SetObject(std::shared_ptr anObject); + std::shared_ptr GetObject(); + const std::shared_ptr GetObject() const; public: virtual void AreaInitialize() const; @@ -38,7 +38,7 @@ namespace KGeoBag virtual KThreeVector AreaNormal(const KThreeVector& aPoint) const; protected: - mutable KSmartPointer fObject; + mutable std::shared_ptr fObject; }; template @@ -55,7 +55,7 @@ namespace KGeoBag } template - KGWrappedSurface::KGWrappedSurface(const KSmartPointer& anObject) + KGWrappedSurface::KGWrappedSurface(const std::shared_ptr& anObject) : KGArea() { fObject = anObject; @@ -74,20 +74,20 @@ namespace KGeoBag } template - void KGWrappedSurface::SetObject(KSmartPointer anObject) + void KGWrappedSurface::SetObject(std::shared_ptr anObject) { fObject = anObject; return; } template - KSmartPointer KGWrappedSurface::GetObject() + std::shared_ptr KGWrappedSurface::GetObject() { return fObject; } template - const KSmartPointer KGWrappedSurface::GetObject() const + const std::shared_ptr KGWrappedSurface::GetObject() const { return fObject; } diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGCircleWire.cc b/KGeoBag/Source/Shapes/Complex/Source/KGCircleWire.cc new file mode 100644 index 000000000..32894c2d1 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Source/KGCircleWire.cc @@ -0,0 +1,54 @@ +#include "KGCircleWire.hh" + +#include "KGExtrudedObject.hh" + +namespace KGeoBag +{ + + KGCircleWire* KGCircleWire::Clone() const + { + KGCircleWire* w = new KGCircleWire(); + + w->fR = fR; + w->fDiameter = fDiameter; + w->fNDisc = fNDisc; + + return w; + } + + double KGCircleWire::GetLength() const + { + // TODO + return 0.; + } + + + double KGCircleWire::Area() const + { + // TODO + return 0.; + } + + double KGCircleWire::Volume() const + { + // TODO + return 0.; + } + + bool KGCircleWire::ContainsPoint(const double* P) const + { + // TODO + (void) P; + return true; + } + + double KGCircleWire::DistanceTo(const double* P,double* P_in,double* P_norm) const + { + // TODO + (void) P; + (void) P_in; + (void) P_norm; + return 0.; + } + +} diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGCircularWirePins.cc b/KGeoBag/Source/Shapes/Complex/Source/KGCircularWirePins.cc new file mode 100644 index 000000000..233d6c298 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Source/KGCircularWirePins.cc @@ -0,0 +1,58 @@ +#include "KGCircularWirePins.hh" + +#include "KGExtrudedObject.hh" + +namespace KGeoBag +{ + + KGCircularWirePins* KGCircularWirePins::Clone() const + { + KGCircularWirePins* w = new KGCircularWirePins(); + + w->fR1 = fR1; + w->fR2 = fR2; + w->fNPins = fNPins; + w->fDiameter = fDiameter; + w->fRotationAngle = fRotationAngle; + w->fNDisc = fNDisc; + w->fNDiscPower = fNDiscPower; + + return w; + } + + double KGCircularWirePins::GetLength() const + { + // TODO + return 0.; + } + + + double KGCircularWirePins::Area() const + { + // TODO + return 0.; + } + + double KGCircularWirePins::Volume() const + { + // TODO + return 0.; + } + + bool KGCircularWirePins::ContainsPoint(const double* P) const + { + // TODO + (void) P; + return true; + } + + double KGCircularWirePins::DistanceTo(const double* P,double* P_in,double* P_norm) const + { + // TODO + (void) P; + (void) P_in; + (void) P_norm; + return 0.; + } + +} diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGConicSectPortHousingSpace.cc b/KGeoBag/Source/Shapes/Complex/Source/KGConicSectPortHousingSpace.cc index 786ee0807..fc141efb4 100644 --- a/KGeoBag/Source/Shapes/Complex/Source/KGConicSectPortHousingSpace.cc +++ b/KGeoBag/Source/Shapes/Complex/Source/KGConicSectPortHousingSpace.cc @@ -10,12 +10,11 @@ namespace KGeoBag { fObject->Initialize(); - KGConicSectPortHousingSurface* tSurface = - new KGConicSectPortHousingSurface(fObject); + auto tSurface = std::make_shared(fObject); aBoundaryContainer.push_back( tSurface ); { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(0.,0.,fObject->GetZAMain())); disk->SetNormal(KThreeVector(0.,0.,-1.)); disk->SetRadius(fObject->GetRAMain()); @@ -23,7 +22,7 @@ namespace KGeoBag } { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(0.,0.,fObject->GetZBMain())); disk->SetNormal(KThreeVector(0.,0.,1.)); disk->SetRadius(fObject->GetRBMain()); @@ -37,28 +36,28 @@ namespace KGeoBag if (const KGConicSectPortHousing::OrthogonalPort* o = dynamic_cast(p)) { - KGDisk* disk = new KGDisk(); - disk->SetP0(KThreeVector(o->GetASub(0), - o->GetASub(1), - o->GetASub(2))); - double normal_local[3] = {0.,0.,1.}; - double normal_global[3]; - o->GetCoordinateTransform()->ConvertToGlobalCoords(normal_local,normal_global,true); - KThreeVector n(normal_global[0],normal_global[1],normal_global[2]); - disk->SetNormal(n.Unit()); - disk->SetRadius(o->GetRSub()); - aBoundaryContainer.push_back(disk); + auto disk = std::make_shared(); + disk->SetP0(KThreeVector(o->GetASub(0), + o->GetASub(1), + o->GetASub(2))); + double normal_local[3] = {0.,0.,1.}; + double normal_global[3]; + o->GetCoordinateTransform()->ConvertToGlobalCoords(normal_local,normal_global,true); + KThreeVector n(normal_global[0],normal_global[1],normal_global[2]); + disk->SetNormal(n.Unit()); + disk->SetRadius(o->GetRSub()); + aBoundaryContainer.push_back(disk); } else if (const KGConicSectPortHousing::ParaxialPort* c = dynamic_cast(p)) { - KGDisk* disk = new KGDisk(); - disk->SetP0(KThreeVector(c->GetASub(0), - c->GetASub(1), - c->GetASub(2))); - disk->SetNormal(KThreeVector(0.,0.,(c->IsUpstream() ? -1. : 1.))); - disk->SetRadius(c->GetRSub()); - aBoundaryContainer.push_back(disk); + auto disk = std::make_shared(); + disk->SetP0(KThreeVector(c->GetASub(0), + c->GetASub(1), + c->GetASub(2))); + disk->SetNormal(KThreeVector(0.,0.,(c->IsUpstream() ? -1. : 1.))); + disk->SetRadius(c->GetRSub()); + aBoundaryContainer.push_back(disk); } } diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGConicalWireArray.cc b/KGeoBag/Source/Shapes/Complex/Source/KGConicalWireArray.cc index b947cb72c..40d18b15c 100644 --- a/KGeoBag/Source/Shapes/Complex/Source/KGConicalWireArray.cc +++ b/KGeoBag/Source/Shapes/Complex/Source/KGConicalWireArray.cc @@ -59,8 +59,6 @@ namespace KGeoBag double p_theta = KGExtrudedObject::Theta(P[0],P[1]); double p_z = P[2]; - bool withinZ = true; - (void) withinZ; //remove compiler warning double w_z = P[2]; double z_limits[2] = {fZ1,fZ2}; double d_theta[2] = {2.*M_PI*fR1/fNWires,2.*M_PI*fR2/fNWires}; @@ -75,12 +73,10 @@ namespace KGeoBag if (w_z < z_limits[0]) { w_z = z_limits[0]; - withinZ = false; } if (w_z > z_limits[1]) { w_z = z_limits[1]; - withinZ = false; } bool withinR = false; diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGLinearWireGrid.cc b/KGeoBag/Source/Shapes/Complex/Source/KGLinearWireGrid.cc new file mode 100644 index 000000000..da7e75c51 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Source/KGLinearWireGrid.cc @@ -0,0 +1,57 @@ +#include "KGLinearWireGrid.hh" + +#include "KGExtrudedObject.hh" + +namespace KGeoBag +{ + + KGLinearWireGrid* KGLinearWireGrid::Clone() const + { + KGLinearWireGrid* w = new KGLinearWireGrid(); + + w->fR = fR; + w->fPitch = fPitch; + w->fDiameter = fDiameter; + w->fNDisc = fNDisc; + w->fNDiscPower = fNDiscPower; + w->fOuterCircle = fOuterCircle; + + return w; + } + + double KGLinearWireGrid::GetLength() const + { + // TODO + return 0.; + } + + + double KGLinearWireGrid::Area() const + { + // TODO + return 0.; + } + + double KGLinearWireGrid::Volume() const + { + // TODO + return 0.; + } + + bool KGLinearWireGrid::ContainsPoint(const double* P) const + { + // TODO + (void) P; + return true; + } + + double KGLinearWireGrid::DistanceTo(const double* P,double* P_in,double* P_norm) const + { + // TODO + (void) P; + (void) P_in; + (void) P_norm; + return 0.; + } + +} diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGPortHousingSpace.cc b/KGeoBag/Source/Shapes/Complex/Source/KGPortHousingSpace.cc index 1e9c4b35c..0f381c7e7 100644 --- a/KGeoBag/Source/Shapes/Complex/Source/KGPortHousingSpace.cc +++ b/KGeoBag/Source/Shapes/Complex/Source/KGPortHousingSpace.cc @@ -11,7 +11,7 @@ namespace KGeoBag { fObject->Initialize(); - KGPortHousingSurface* tSurface = new KGPortHousingSurface(fObject); + auto tSurface = std::make_shared(fObject); aBoundaryContainer.push_back( tSurface ); double normal_local[3] = {0.,0.,1.}; @@ -21,7 +21,7 @@ namespace KGeoBag n = n.Unit(); { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(fObject->GetAMain(0), fObject->GetAMain(1), fObject->GetAMain(2))); @@ -31,7 +31,7 @@ namespace KGeoBag } { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(fObject->GetBMain(0), fObject->GetBMain(1), fObject->GetBMain(2))); @@ -57,13 +57,13 @@ namespace KGeoBag r->GetASub(1) - .5*b, r->GetASub(2)); - KGRectangle* rect = new KGRectangle(a,b,p0,n1,n2); + auto rect = std::make_shared(a,b,p0,n1,n2); aBoundaryContainer.push_back(rect); } else if (const KGPortHousing::CircularPort* c = dynamic_cast(p)) { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(c->GetASub(0), c->GetASub(1), c->GetASub(2))); diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGQuadraticWireGrid.cc b/KGeoBag/Source/Shapes/Complex/Source/KGQuadraticWireGrid.cc new file mode 100644 index 000000000..eef68f6f7 --- /dev/null +++ b/KGeoBag/Source/Shapes/Complex/Source/KGQuadraticWireGrid.cc @@ -0,0 +1,56 @@ +#include "KGQuadraticWireGrid.hh" + +#include "KGExtrudedObject.hh" + +namespace KGeoBag +{ + + KGQuadraticWireGrid* KGQuadraticWireGrid::Clone() const + { + KGQuadraticWireGrid* w = new KGQuadraticWireGrid(); + + w->fR = fR; + w->fPitch = fPitch; + w->fDiameter = fDiameter; + w->fNDiscPerPitch = fNDiscPerPitch; + w->fOuterCircle = fOuterCircle; + + return w; + } + + double KGQuadraticWireGrid::GetLength() const + { + // TODO + return 0.; + } + + + double KGQuadraticWireGrid::Area() const + { + // TODO + return 0.; + } + + double KGQuadraticWireGrid::Volume() const + { + // TODO + return 0.; + } + + bool KGQuadraticWireGrid::ContainsPoint(const double* P) const + { + // TODO + (void) P; + return true; + } + + double KGQuadraticWireGrid::DistanceTo(const double* P,double* P_in,double* P_norm) const + { + // TODO + (void) P; + (void) P_in; + (void) P_norm; + return 0.; + } + +} diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGRotatedObject.cc b/KGeoBag/Source/Shapes/Complex/Source/KGRotatedObject.cc index a81ea1564..f455d83cb 100644 --- a/KGeoBag/Source/Shapes/Complex/Source/KGRotatedObject.cc +++ b/KGeoBag/Source/Shapes/Complex/Source/KGRotatedObject.cc @@ -515,18 +515,14 @@ namespace KGeoBag bool KGRotatedObject::Arc::ContainsPoint(const double* P) const { double zmax = fP2[0]; -// double rmax = fP2[1]; //TODO: WHAT IS THIS VARIABLE FOR? double zmin = fP1[0]; -// double rmin = fP1[1]; //TODO: WHAT IS THIS VARIABLE FOR? bool arcOpensUp = (fPhiBoundary>0 && fPhiBoundary < M_PI); if (zmax zmax) diff --git a/KGeoBag/Source/Shapes/Complex/Source/KGRotatedSpace.cc b/KGeoBag/Source/Shapes/Complex/Source/KGRotatedSpace.cc index 234e45438..2796ecdf0 100644 --- a/KGeoBag/Source/Shapes/Complex/Source/KGRotatedSpace.cc +++ b/KGeoBag/Source/Shapes/Complex/Source/KGRotatedSpace.cc @@ -10,12 +10,12 @@ namespace KGeoBag { fObject->Initialize(); - KGRotatedSurface* tSurface = new KGRotatedSurface(fObject); + auto tSurface = std::make_shared(fObject); aBoundaryContainer.push_back( tSurface ); if (fObject->GetStartPoint(1) > 1.e-8) { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(0.,0.,fObject->GetStartPoint(0))); disk->SetNormal(KThreeVector(0.,0.,-1.)); disk->SetRadius(fObject->GetStartPoint(1)); @@ -25,7 +25,7 @@ namespace KGeoBag if (fObject->GetEndPoint(1) > 1.e-8) { - KGDisk* disk = new KGDisk(); + auto disk = std::make_shared(); disk->SetP0(KThreeVector(0.,0.,fObject->GetEndPoint(0))); disk->SetNormal(KThreeVector(0.,0.,1.)); disk->SetRadius(fObject->GetEndPoint(1)); diff --git a/KGeoBag/Source/Shapes/ExtrudedAreas/Include/KGExtrudedPathSurface.hh b/KGeoBag/Source/Shapes/ExtrudedAreas/Include/KGExtrudedPathSurface.hh index cc68c5e17..60e373f37 100644 --- a/KGeoBag/Source/Shapes/ExtrudedAreas/Include/KGExtrudedPathSurface.hh +++ b/KGeoBag/Source/Shapes/ExtrudedAreas/Include/KGExtrudedPathSurface.hh @@ -5,6 +5,8 @@ #include "KGPlanarPath.hh" #include "KGShapeMessage.hh" +#include + namespace KGeoBag { @@ -44,7 +46,7 @@ namespace KGeoBag fExtrudedMeshPower( aCopy.fExtrudedMeshPower ) { } - KGExtrudedPathSurface( const KSmartPointer< XPathType >& aPath ) : + KGExtrudedPathSurface( const std::shared_ptr< XPathType >& aPath ) : KGArea(), fPath( aPath ), fSign( 1. ), @@ -59,11 +61,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } @@ -119,7 +121,7 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable double fSign; mutable double fZMin; mutable double fZMax; diff --git a/KGeoBag/Source/Shapes/ExtrudedVolumes/Include/KGExtrudedClosedPathSpace.hh b/KGeoBag/Source/Shapes/ExtrudedVolumes/Include/KGExtrudedClosedPathSpace.hh index ba66ca333..6e132bfe5 100644 --- a/KGeoBag/Source/Shapes/ExtrudedVolumes/Include/KGExtrudedClosedPathSpace.hh +++ b/KGeoBag/Source/Shapes/ExtrudedVolumes/Include/KGExtrudedClosedPathSpace.hh @@ -48,7 +48,7 @@ namespace KGeoBag fFlattenedMeshPower( aCopy.fFlattenedMeshPower ) { } - KGExtrudedClosedPathSpace( const KSmartPointer< XPathType >& aPath ) : + KGExtrudedClosedPathSpace( const std::shared_ptr< XPathType >& aPath ) : KGVolume(), fPath( aPath ), fZMin( 0. ), @@ -64,11 +64,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } @@ -134,7 +134,7 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable double fZMin; mutable double fZMax; mutable unsigned int fExtrudedMeshCount; @@ -145,19 +145,19 @@ namespace KGeoBag public: virtual void VolumeInitialize( BoundaryContainer& aBoundaryContainer ) const { - KGFlattenedClosedPathSurface< XPathType >* tTop = new KGFlattenedClosedPathSurface< XPathType >( fPath ); + auto tTop = std::make_shared>( fPath ); tTop->Z( fZMax ); tTop->FlattenedMeshCount( fFlattenedMeshCount ); tTop->FlattenedMeshPower( fFlattenedMeshPower ); tTop->SetName( "top" ); aBoundaryContainer.push_back( tTop ); - KGExtrudedPathSurface< XPathType >* tJacket = new KGExtrudedPathSurface< XPathType >( fPath ); + auto tJacket = std::make_shared>( fPath ); tJacket->ExtrudedMeshCount( fExtrudedMeshCount ); tJacket->SetName( "jacket" ); aBoundaryContainer.push_back( tJacket ); - KGFlattenedClosedPathSurface< XPathType >* tBottom = new KGFlattenedClosedPathSurface< XPathType >( fPath ); + auto tBottom = std::make_shared>( fPath ); tBottom->Z( fZMin ); tBottom->FlattenedMeshCount( fFlattenedMeshCount ); tBottom->FlattenedMeshPower( fFlattenedMeshPower ); diff --git a/KGeoBag/Source/Shapes/FlattenedAreas/Include/KGFlattenedClosedPathSurface.hh b/KGeoBag/Source/Shapes/FlattenedAreas/Include/KGFlattenedClosedPathSurface.hh index 80a824915..f5c944b70 100644 --- a/KGeoBag/Source/Shapes/FlattenedAreas/Include/KGFlattenedClosedPathSurface.hh +++ b/KGeoBag/Source/Shapes/FlattenedAreas/Include/KGFlattenedClosedPathSurface.hh @@ -5,6 +5,8 @@ #include "KGPlanarClosedPath.hh" #include "KGShapeMessage.hh" +#include + namespace KGeoBag { @@ -42,7 +44,7 @@ namespace KGeoBag fFlattenedMeshPower( aCopy.fFlattenedMeshPower ) { } - KGFlattenedClosedPathSurface( const KSmartPointer< XPathType >& aPath ) : + KGFlattenedClosedPathSurface( const std::shared_ptr< XPathType >& aPath ) : KGArea(), fPath( aPath ), fZ( 0. ), @@ -56,11 +58,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } @@ -106,7 +108,7 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable double fZ; mutable double fSign; mutable unsigned int fFlattenedMeshCount; diff --git a/KGeoBag/Source/Shapes/PlanarShapes/Include/KGPlanarPath.hh b/KGeoBag/Source/Shapes/PlanarShapes/Include/KGPlanarPath.hh index a197823c2..3e8947c26 100644 --- a/KGeoBag/Source/Shapes/PlanarShapes/Include/KGPlanarPath.hh +++ b/KGeoBag/Source/Shapes/PlanarShapes/Include/KGPlanarPath.hh @@ -3,9 +3,6 @@ #include "KTwoVector.hh" -#include "KSmartPointer.h" -using katrin::KSmartPointer; - #include using std::deque; diff --git a/KGeoBag/Source/Shapes/RotatedAreas/Include/KGRotatedPathSurface.hh b/KGeoBag/Source/Shapes/RotatedAreas/Include/KGRotatedPathSurface.hh index f2231234e..05fb9f54d 100644 --- a/KGeoBag/Source/Shapes/RotatedAreas/Include/KGRotatedPathSurface.hh +++ b/KGeoBag/Source/Shapes/RotatedAreas/Include/KGRotatedPathSurface.hh @@ -5,6 +5,8 @@ #include "KGPlanarPath.hh" #include "KGShapeMessage.hh" +#include + namespace KGeoBag { @@ -38,7 +40,7 @@ namespace KGeoBag fRotatedMeshCount( aCopy.fRotatedMeshCount ) { } - KGRotatedPathSurface( KSmartPointer< XPathType > aPath ) : + KGRotatedPathSurface( std::shared_ptr< XPathType > aPath ) : KGArea(), fPath( aPath ), fSign( 1. ), @@ -50,11 +52,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } @@ -79,7 +81,7 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable double fSign; mutable unsigned int fRotatedMeshCount; diff --git a/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedClosedPathSpace.hh b/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedClosedPathSpace.hh index bbebf8881..fadb4d33e 100644 --- a/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedClosedPathSpace.hh +++ b/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedClosedPathSpace.hh @@ -37,7 +37,7 @@ namespace KGeoBag fRotatedMeshCount( aCopy.fRotatedMeshCount ) { } - KGRotatedClosedPathSpace( const KSmartPointer< XPathType >& aPath ) : + KGRotatedClosedPathSpace( const std::shared_ptr< XPathType >& aPath ) : KGVolume(), fPath( aPath ), fRotatedMeshCount( 64 ) @@ -48,11 +48,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType > Path() + std::shared_ptr< XPathType > Path() { return fPath; } - const KSmartPointer< XPathType > Path() const + const std::shared_ptr< XPathType > Path() const { return fPath; } @@ -68,13 +68,13 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable unsigned int fRotatedMeshCount; public: virtual void VolumeInitialize( BoundaryContainer& aBoundaryContainer ) const { - KGRotatedPathSurface< XPathType >* tJacket = new KGRotatedPathSurface< XPathType >( fPath ); + auto tJacket = std::make_shared>( fPath ); tJacket->RotatedMeshCount( fRotatedMeshCount ); tJacket->SetName( "jacket" ); aBoundaryContainer.push_back( tJacket ); diff --git a/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedOpenPathSpace.hh b/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedOpenPathSpace.hh index 61bd38586..1c2f1b52a 100644 --- a/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedOpenPathSpace.hh +++ b/KGeoBag/Source/Shapes/RotatedVolumes/Include/KGRotatedOpenPathSpace.hh @@ -8,6 +8,7 @@ #include "KGShapeMessage.hh" #include +#include namespace KGeoBag { @@ -50,7 +51,7 @@ namespace KGeoBag fFlattenedMeshPower( aCopy.fFlattenedMeshPower ) { } - KGRotatedOpenPathSpace( const KSmartPointer< XPathType >& aPath ) : + KGRotatedOpenPathSpace( const std::shared_ptr< XPathType >& aPath ) : KGVolume(), fPath( aPath ), fTopPath( new KGPlanarCircle() ), @@ -66,20 +67,20 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } - const KSmartPointer< KGPlanarCircle >& StartPath() const + const std::shared_ptr< KGPlanarCircle >& StartPath() const { return fTopPath; } - const KSmartPointer< KGPlanarCircle >& EndPath() const + const std::shared_ptr< KGPlanarCircle >& EndPath() const { return fBottomPath; } @@ -125,9 +126,9 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; - mutable KSmartPointer< KGPlanarCircle > fTopPath; - mutable KSmartPointer< KGPlanarCircle > fBottomPath; + mutable std::shared_ptr< XPathType > fPath; + mutable std::shared_ptr< KGPlanarCircle > fTopPath; + mutable std::shared_ptr< KGPlanarCircle > fBottomPath; mutable double fSign; mutable unsigned int fRotatedMeshCount; mutable unsigned int fFlattenedMeshCount; @@ -141,7 +142,7 @@ namespace KGeoBag fTopPath->Radius( fPath->Start().Y() ); fTopPath->MeshCount( fRotatedMeshCount ); - KGFlattenedCircleSurface* tTop = new KGFlattenedCircleSurface( fTopPath ); + auto tTop = std::make_shared( fTopPath ); tTop->Sign( 1. ); tTop->Z( fPath->Start().X() ); tTop->FlattenedMeshCount( fFlattenedMeshCount ); @@ -149,7 +150,7 @@ namespace KGeoBag tTop->SetName( "top" ); aBoundaryContainer.push_back( tTop ); - KGRotatedPathSurface< XPathType >* tJacket = new KGRotatedPathSurface< XPathType >( fPath ); + auto tJacket = std::make_shared>( fPath ); tJacket->RotatedMeshCount( fRotatedMeshCount ); tJacket->SetName( "jacket" ); aBoundaryContainer.push_back( tJacket ); @@ -159,7 +160,7 @@ namespace KGeoBag fBottomPath->Radius( fPath->End().Y() ); fBottomPath->MeshCount( fRotatedMeshCount ); - KGFlattenedCircleSurface* tBottom = new KGFlattenedCircleSurface( fBottomPath ); + auto tBottom = std::make_shared( fBottomPath ); tBottom->Sign( -1. ); tBottom->Z( fPath->End().X() ); tBottom->FlattenedMeshCount( fFlattenedMeshCount ); diff --git a/KGeoBag/Source/Shapes/ShellAreas/Include/KGShellPathSurface.hh b/KGeoBag/Source/Shapes/ShellAreas/Include/KGShellPathSurface.hh index 16b2cfe50..34fe512e8 100644 --- a/KGeoBag/Source/Shapes/ShellAreas/Include/KGShellPathSurface.hh +++ b/KGeoBag/Source/Shapes/ShellAreas/Include/KGShellPathSurface.hh @@ -5,6 +5,8 @@ #include "KGPlanarPath.hh" #include "KGShapeMessage.hh" +#include + namespace KGeoBag { @@ -44,7 +46,7 @@ namespace KGeoBag fAngleStop(aCopy.fAngleStop) { } - KGShellPathSurface( KSmartPointer< XPathType > aPath ) : + KGShellPathSurface( std::shared_ptr< XPathType > aPath ) : KGArea(), fPath( aPath ), fSign( 1. ), @@ -59,11 +61,11 @@ namespace KGeoBag } public: - KSmartPointer< XPathType >& Path() + std::shared_ptr< XPathType >& Path() { return fPath; } - const KSmartPointer< XPathType >& Path() const + const std::shared_ptr< XPathType >& Path() const { return fPath; } @@ -116,7 +118,7 @@ namespace KGeoBag } protected: - mutable KSmartPointer< XPathType > fPath; + mutable std::shared_ptr< XPathType > fPath; mutable double fSign; mutable unsigned int fShellMeshCount; mutable double fShellMeshPower; diff --git a/KGeoBag/Source/Test/Discretization/TestCylinderDiscretization.cc b/KGeoBag/Source/Test/Discretization/TestCylinderDiscretization.cc index cef917266..15ef25754 100644 --- a/KGeoBag/Source/Test/Discretization/TestCylinderDiscretization.cc +++ b/KGeoBag/Source/Test/Discretization/TestCylinderDiscretization.cc @@ -62,7 +62,7 @@ int main(int /*argc*/, char** /*argv*/) surface->MakeExtension(); surface->AsExtension()-> - SetDeformation(KSmartPointer(deformation)); + SetDeformation(std::shared_ptr(deformation)); // Construct the discretizer KGCylinderMesher* cylinderDisc = new KGCylinderMesher(); diff --git a/KGeoBag/Source/Visualization/CMakeLists.txt b/KGeoBag/Source/Visualization/CMakeLists.txt index 88649f067..bb6955f38 100644 --- a/KGeoBag/Source/Visualization/CMakeLists.txt +++ b/KGeoBag/Source/Visualization/CMakeLists.txt @@ -105,7 +105,7 @@ if( KGeoBag_USE_ROOT ) ) # external - find_package( ROOT 5.24.0 REQUIRED ) +# find_package( ROOT 5.24.0 REQUIRED ) kasper_external_include_directories( ${ROOT_INCLUDE_DIR} ) diff --git a/KGeoBag/Source/Visualization/Root/Include/KGROOTGeometryPainter.hh b/KGeoBag/Source/Visualization/Root/Include/KGROOTGeometryPainter.hh index d2cd1b375..6a46add19 100644 --- a/KGeoBag/Source/Visualization/Root/Include/KGROOTGeometryPainter.hh +++ b/KGeoBag/Source/Visualization/Root/Include/KGROOTGeometryPainter.hh @@ -389,8 +389,8 @@ namespace KGeoBag void ClosedPointsToMainPortMesh(const double* PointA, const double* PointB, const double aRadius, PortMesh& aMesh); void ClosedPointsToSubPortMesh(const KGPortHousing::CircularPort* aCircularPort, PortMesh& aMesh); void ClosedPointsToBeamMesh(const vector> aStartCoord, const vector> aEndCoord, BeamMesh& aMesh); - void ClosedPointsToFlatMesh(const KSmartPointer aComplexAnnulus, FlatMesh& aMesh); - void ClosedPointsToRingMesh(const KSmartPointer aComplexAnnulus, RingMesh& aMesh); + void ClosedPointsToFlatMesh(const std::shared_ptr aComplexAnnulus, FlatMesh& aMesh); + void ClosedPointsToRingMesh(const std::shared_ptr aComplexAnnulus, RingMesh& aMesh); diff --git a/KGeoBag/Source/Visualization/Root/Source/KGROOTGeometryPainter.cc b/KGeoBag/Source/Visualization/Root/Source/KGROOTGeometryPainter.cc index 8b55c8416..ebe11b371 100644 --- a/KGeoBag/Source/Visualization/Root/Source/KGROOTGeometryPainter.cc +++ b/KGeoBag/Source/Visualization/Root/Source/KGROOTGeometryPainter.cc @@ -883,7 +883,7 @@ namespace KGeoBag void KGROOTGeometryPainter::VisitWrappedSurface( KGWrappedSurface* aPortHousingSurface) { - KSmartPointer< KGPortHousing > fPortHousing = aPortHousingSurface ->GetObject(); + std::shared_ptr< KGPortHousing > fPortHousing = aPortHousingSurface ->GetObject(); //First we compute the main cylinder. PortMesh tMainPortMesh; @@ -985,7 +985,7 @@ namespace KGeoBag void KGROOTGeometryPainter::VisitWrappedSurface( KGWrappedSurface* aBeamSurface){ - KSmartPointer fBeam = aBeamSurface->GetObject(); + std::shared_ptr fBeam = aBeamSurface->GetObject(); vector> tStartCoord = fBeam->GetStartCoords(); vector> tEndCoord = fBeam -> GetEndCoords(); @@ -1028,7 +1028,7 @@ namespace KGeoBag } void KGROOTGeometryPainter::VisitWrappedSurface(KGWrappedSurface* aComplexAnnulus) { - KSmartPointer fComplexAnnulus = aComplexAnnulus->GetObject(); + std::shared_ptr fComplexAnnulus = aComplexAnnulus->GetObject(); //Meshing the main circle @@ -1835,7 +1835,7 @@ namespace KGeoBag return; } - void KGROOTGeometryPainter::ClosedPointsToFlatMesh(const KSmartPointer aComplexAnnulus, FlatMesh& aMesh) + void KGROOTGeometryPainter::ClosedPointsToFlatMesh(const std::shared_ptr aComplexAnnulus, FlatMesh& aMesh) { unsigned int tArc = fCurrentData->GetArc(); @@ -1864,7 +1864,7 @@ namespace KGeoBag return; } - void KGROOTGeometryPainter::ClosedPointsToRingMesh(const KSmartPointer aComplexAnnulus, RingMesh& aMesh) + void KGROOTGeometryPainter::ClosedPointsToRingMesh(const std::shared_ptr aComplexAnnulus, RingMesh& aMesh) { unsigned int tArc = fCurrentData->GetArc(); diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKDistanceTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKDistanceTester.cc index 0a1db7440..8af991804 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKDistanceTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKDistanceTester.cc @@ -116,7 +116,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk distance tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKMeshIntersectionTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKMeshIntersectionTester.cc index 3ee94df2a..c83bac029 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKMeshIntersectionTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKMeshIntersectionTester.cc @@ -180,7 +180,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk mesh intersection tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKNormalTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKNormalTester.cc index cb78bdac3..de4f50f66 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKNormalTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKNormalTester.cc @@ -160,7 +160,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk normal tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKOutsideTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKOutsideTester.cc index 63be1b7fc..0b488e207 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKOutsideTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKOutsideTester.cc @@ -129,7 +129,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk outside tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKPointTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKPointTester.cc index 303c76499..eaa5b8f83 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKPointTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKPointTester.cc @@ -134,7 +134,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk point tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKRandomPointTester.cc b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKRandomPointTester.cc index 24d784570..1306f56bc 100644 --- a/KGeoBag/Source/Visualization/Vtk/Source/KGVTKRandomPointTester.cc +++ b/KGeoBag/Source/Visualization/Vtk/Source/KGVTKRandomPointTester.cc @@ -83,7 +83,7 @@ namespace KGeoBag { if( fWriteEnabled == true ) { - string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + fName + string( ".vtp" ); + string tFileName = string( OUTPUT_DEFAULT_DIR ) + string( "/" ) + GetName() + string( ".vtp" ); vismsg( eNormal ) << "vtk normal tester <" << GetName() << "> is writing <" << fPolyData->GetNumberOfCells() << "> cells to file <" << tFileName << ">" << eom; diff --git a/KGeoBag/Source/XML/Examples/ComplexShapes.xml b/KGeoBag/Source/XML/Examples/ComplexShapes.xml index 1d38c7bbb..6be4691df 100644 --- a/KGeoBag/Source/XML/Examples/ComplexShapes.xml +++ b/KGeoBag/Source/XML/Examples/ComplexShapes.xml @@ -97,6 +97,47 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Kassiopeia/Applications/Examples/Source/TrackMagneticTransitionCheck.cxx b/Kassiopeia/Applications/Examples/Source/TrackMagneticTransitionCheck.cxx index 035352f59..0e02bbf6f 100644 --- a/Kassiopeia/Applications/Examples/Source/TrackMagneticTransitionCheck.cxx +++ b/Kassiopeia/Applications/Examples/Source/TrackMagneticTransitionCheck.cxx @@ -2,7 +2,7 @@ #include "TGraph.h" #include "TApplication.h" #include "TCanvas.h" -#include +#include "KConst.h" #include #include #include diff --git a/Kassiopeia/Applications/Simulation/Source/Kassiopeia.cxx b/Kassiopeia/Applications/Simulation/Source/Kassiopeia.cxx index f101143e9..534388836 100644 --- a/Kassiopeia/Applications/Simulation/Source/Kassiopeia.cxx +++ b/Kassiopeia/Applications/Simulation/Source/Kassiopeia.cxx @@ -1,5 +1,5 @@ -#include -#include +#include "KSSimulation.h" +#include "KSRoot.h" #include "KMessage.h" #include "KTextFile.h" diff --git a/Kassiopeia/Applications/Validation/Source/TestZonalHarmonicsConvergence.cxx b/Kassiopeia/Applications/Validation/Source/TestZonalHarmonicsConvergence.cxx index fbfc93611..9a301347b 100644 --- a/Kassiopeia/Applications/Validation/Source/TestZonalHarmonicsConvergence.cxx +++ b/Kassiopeia/Applications/Validation/Source/TestZonalHarmonicsConvergence.cxx @@ -10,7 +10,7 @@ #include "KElectromagnetContainer.hh" #include "KToolbox.h" -#include "KElectrostaticBoundaryFieldWithKGeoBag.hh" +#include "KGElectrostaticBoundaryField.hh" #include "KElectricZHFieldSolver.hh" #include "KSMainMessage.h" #include "KConst.h" @@ -78,8 +78,8 @@ int main( int anArgc, char** anArgv ) // TGraph tMagStrengthGraph; - KElectrostaticBoundaryFieldWithKGeoBag* tElField = - KToolbox::GetInstance().Get( tElFieldName ); + KGElectrostaticBoundaryField* tElField = + KToolbox::GetInstance().Get( tElFieldName ); tElField->Initialize(); // KStaticElectromagnetField* tMagField = diff --git a/Kassiopeia/Bindings/CMakeLists.txt b/Kassiopeia/Bindings/CMakeLists.txt index 8ff349586..3f0e03c09 100644 --- a/Kassiopeia/Bindings/CMakeLists.txt +++ b/Kassiopeia/Bindings/CMakeLists.txt @@ -60,6 +60,7 @@ set( BINDINGS_HEADER_FILES Generators/Include/KSGenDirectionSphericalCompositeBuilder.h Generators/Include/KSGenDirectionSurfaceCompositeBuilder.h Generators/Include/KSGenSpinCompositeBuilder.h + Generators/Include/KSGenSpinRelativeCompositeBuilder.h Generators/Include/KSGenTimeCompositeBuilder.h Generators/Include/KSGenGeneratorCompositeBuilder.h @@ -118,6 +119,8 @@ set( BINDINGS_HEADER_FILES Interactions/Include/KSIntCalculatorKESSBuilder.h Interactions/Include/KSIntScatteringBuilder.h Interactions/Include/KSIntSpinFlipBuilder.h + Interactions/Include/KSIntSpinFlipPulseBuilder.h + Interactions/Include/KSIntSpinRotateYPulseBuilder.h Interactions/Include/KSIntDecayBuilder.h Interactions/Include/KSIntSurfaceSpecularBuilder.h Interactions/Include/KSIntSurfaceUCNBuilder.h @@ -150,6 +153,8 @@ set( BINDINGS_HEADER_FILES Terminators/Include/KSTermMinLongEnergyBuilder.h Terminators/Include/KSTermMaxLongEnergyBuilder.h Terminators/Include/KSTermMaxTimeBuilder.h + Terminators/Include/KSTermMaxTotalTimeBuilder.h + Terminators/Include/KSTermMaxStepTimeBuilder.h Terminators/Include/KSTermMaxLengthBuilder.h Terminators/Include/KSTermMaxStepsBuilder.h Terminators/Include/KSTermTrappedBuilder.h @@ -191,6 +196,7 @@ if( Kassiopeia_USE_ROOT ) Generators/Include/KSGenGeneratorSimulationBuilder.h Writers/Include/KSWriteROOTBuilder.h Writers/Include/KSWriteROOTConditionOutputBuilder.h + Writers/Include/KSWriteROOTConditionPeriodicBuilder.h Writers/Include/KSWriteROOTConditionTerminatorBuilder.h Writers/Include/KSWriteROOTConditionStepBuilder.h Visualization/Include/KSROOTTrackPainterBuilder.h @@ -274,6 +280,7 @@ set( BINDINGS_SOURCE_FILES Generators/Source/KSGenDirectionSphericalCompositeBuilder.cxx Generators/Source/KSGenDirectionSurfaceCompositeBuilder.cxx Generators/Source/KSGenSpinCompositeBuilder.cxx + Generators/Source/KSGenSpinRelativeCompositeBuilder.cxx Generators/Source/KSGenTimeCompositeBuilder.cxx Generators/Source/KSGenGeneratorCompositeBuilder.cxx @@ -331,6 +338,8 @@ set( BINDINGS_SOURCE_FILES Interactions/Source/KSIntCalculatorKESSBuilder.cxx Interactions/Source/KSIntScatteringBuilder.cxx Interactions/Source/KSIntSpinFlipBuilder.cxx + Interactions/Source/KSIntSpinFlipPulseBuilder.cxx + Interactions/Source/KSIntSpinRotateYPulseBuilder.cxx Interactions/Source/KSIntDecayBuilder.cxx Interactions/Source/KSIntSurfaceSpecularBuilder.cxx Interactions/Source/KSIntSurfaceUCNBuilder.cxx @@ -363,6 +372,8 @@ set( BINDINGS_SOURCE_FILES Terminators/Source/KSTermMinLongEnergyBuilder.cxx Terminators/Source/KSTermMaxLongEnergyBuilder.cxx Terminators/Source/KSTermMaxTimeBuilder.cxx + Terminators/Source/KSTermMaxTotalTimeBuilder.cxx + Terminators/Source/KSTermMaxStepTimeBuilder.cxx Terminators/Source/KSTermMaxLengthBuilder.cxx Terminators/Source/KSTermMaxStepsBuilder.cxx Terminators/Source/KSTermTrappedBuilder.cxx @@ -404,6 +415,7 @@ if( Kassiopeia_USE_ROOT ) Generators/Source/KSGenGeneratorSimulationBuilder.cxx Writers/Source/KSWriteROOTBuilder.cxx Writers/Source/KSWriteROOTConditionOutputBuilder.cxx + Writers/Source/KSWriteROOTConditionPeriodicBuilder.cxx Writers/Source/KSWriteROOTConditionTerminatorBuilder.cxx Writers/Source/KSWriteROOTConditionStepBuilder.cxx Visualization/Source/KSROOTTrackPainterBuilder.cxx diff --git a/Kassiopeia/Bindings/Fields/Source/KSFieldKEMFieldObjectsBuilder.cxx b/Kassiopeia/Bindings/Fields/Source/KSFieldKEMFieldObjectsBuilder.cxx index 033fbf26b..377d464e4 100644 --- a/Kassiopeia/Bindings/Fields/Source/KSFieldKEMFieldObjectsBuilder.cxx +++ b/Kassiopeia/Bindings/Fields/Source/KSFieldKEMFieldObjectsBuilder.cxx @@ -33,7 +33,7 @@ STATICINT sKSRootConstant = // electric fields KSRootBuilder::ComplexElement< KElectrostaticConstantField >( "ksfield_electric_constant" ) + KSRootBuilder::ComplexElement< KElectricQuadrupoleField >( "ksfield_electric_quadrupole" ) + - KSRootBuilder::ComplexElement< KElectrostaticBoundaryFieldWithKGeoBag >( "ksfield_electrostatic" ) + + KSRootBuilder::ComplexElement< KGElectrostaticBoundaryField >( "ksfield_electrostatic" ) + KSRootBuilder::ComplexElement< KRampedElectricField >( "ksfield_electric_ramped" ) + KSRootBuilder::ComplexElement< KRampedElectric2Field >( "ksfield_electric_ramped_2fields") + #ifdef Kassiopeia_USE_VTK @@ -51,6 +51,6 @@ STATICINT sKSRootConstant = KSRootBuilder::ComplexElement< KMagnetostaticFieldmap >( "ksfield_magnetic_fieldmap" ) + KSRootBuilder::ComplexElement< KMagnetostaticFieldmapCalculator >( "ksfield_magnetic_fieldmap_calculator" ) + #endif - KSRootBuilder::ComplexElement< KStaticElectromagnetFieldWithKGeoBag >( "ksfield_electromagnet"); + KSRootBuilder::ComplexElement< KGStaticElectromagnetField >( "ksfield_electromagnet"); } /* namespace katrin */ diff --git a/Kassiopeia/Bindings/Generators/Include/KSGenSpinRelativeCompositeBuilder.h b/Kassiopeia/Bindings/Generators/Include/KSGenSpinRelativeCompositeBuilder.h new file mode 100644 index 000000000..d55ab47d8 --- /dev/null +++ b/Kassiopeia/Bindings/Generators/Include/KSGenSpinRelativeCompositeBuilder.h @@ -0,0 +1,55 @@ +#ifndef Kassiopeia_KSGenSpinRelativeCompositeBuilder_h_ +#define Kassiopeia_KSGenSpinRelativeCompositeBuilder_h_ + +#include "KComplexElement.hh" +#include "KSGenSpinRelativeComposite.h" +#include "KToolbox.h" +#include "KGCore.hh" + +using namespace Kassiopeia; +using namespace KGeoBag; +namespace katrin +{ + + typedef KComplexElement< KSGenSpinRelativeComposite > KSGenSpinRelativeCompositeBuilder; + + template< > + inline bool KSGenSpinRelativeCompositeBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + aContainer->CopyTo( fObject, &KNamed::SetName ); + return true; + } + if( aContainer->GetName() == "theta" ) + { + fObject->SetThetaValue( KToolbox::GetInstance().Get< KSGenValue >( aContainer->AsReference< std::string >() ) ); + return true; + } + if( aContainer->GetName() == "phi" ) + { + fObject->SetPhiValue( KToolbox::GetInstance().Get< KSGenValue >( aContainer->AsReference< std::string >() ) ); + return true; + } + return false; + } + + template< > + inline bool KSGenSpinRelativeCompositeBuilder::AddElement( KContainer* aContainer ) + { + if( aContainer->GetName().substr( 0, 5 ) == "theta" ) + { + aContainer->ReleaseTo( fObject, &KSGenSpinRelativeComposite::SetThetaValue ); + return true; + } + if( aContainer->GetName().substr( 0, 3 ) == "phi" ) + { + aContainer->ReleaseTo( fObject, &KSGenSpinRelativeComposite::SetPhiValue ); + return true; + } + return false; + } + +} + +#endif diff --git a/Kassiopeia/Bindings/Generators/Source/KSGenGeneratorCompositeBuilder.cxx b/Kassiopeia/Bindings/Generators/Source/KSGenGeneratorCompositeBuilder.cxx index 6cced2bbd..d583c8cca 100644 --- a/Kassiopeia/Bindings/Generators/Source/KSGenGeneratorCompositeBuilder.cxx +++ b/Kassiopeia/Bindings/Generators/Source/KSGenGeneratorCompositeBuilder.cxx @@ -21,6 +21,7 @@ #include "KSGenDirectionSphericalCompositeBuilder.h" #include "KSGenDirectionSurfaceCompositeBuilder.h" #include "KSGenSpinCompositeBuilder.h" +#include "KSGenSpinRelativeCompositeBuilder.h" #include "KSGenPositionMaskBuilder.h" #include "KSGenTimeCompositeBuilder.h" #include "KSGenValueFixBuilder.h" @@ -76,6 +77,7 @@ namespace katrin KSGenGeneratorCompositeBuilder::ComplexElement< KSGenDirectionSphericalComposite >( "direction_spherical_composite" ) + KSGenGeneratorCompositeBuilder::ComplexElement< KSGenDirectionSurfaceComposite >( "direction_surface_composite" ) + KSGenGeneratorCompositeBuilder::ComplexElement< KSGenSpinComposite >( "spin_composite" ) + + KSGenGeneratorCompositeBuilder::ComplexElement< KSGenSpinRelativeComposite >( "spin_relative_composite" ) + KSGenGeneratorCompositeBuilder::ComplexElement< KSGenTimeComposite >( "time_composite" )+ KSGenGeneratorCompositeBuilder::ComplexElement< KSGenValueFix >( "pid_fix" )+ KSGenGeneratorCompositeBuilder::ComplexElement< KSGenValueGauss >( "pid_gauss" )+ diff --git a/Kassiopeia/Bindings/Generators/Source/KSGenSpinRelativeCompositeBuilder.cxx b/Kassiopeia/Bindings/Generators/Source/KSGenSpinRelativeCompositeBuilder.cxx new file mode 100644 index 000000000..9e1b6355f --- /dev/null +++ b/Kassiopeia/Bindings/Generators/Source/KSGenSpinRelativeCompositeBuilder.cxx @@ -0,0 +1,60 @@ +#include "KSGenSpinRelativeCompositeBuilder.h" +#include "KSGenValueFixBuilder.h" +#include "KSGenValueSetBuilder.h" +#include "KSGenValueListBuilder.h" +#include "KSGenValueUniformBuilder.h" +#include "KSGenValueGaussBuilder.h" +#include "KSGenValueGeneralizedGaussBuilder.h" +#include "KSGenValueAngleCosineBuilder.h" +#include "KSGenValueAngleSphericalBuilder.h" +#include "KSRootBuilder.h" + +#ifdef Kassiopeia_USE_ROOT +#include "KSGenValueFormulaBuilder.h" +#include "KSGenValueHistogramBuilder.h" +#endif + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSGenSpinRelativeCompositeBuilder::~KComplexElement() + { + } + + STATICINT sKSGenSpinRelativeCompositeStructure = + KSGenSpinRelativeCompositeBuilder::Attribute< string >( "name" ) + + KSGenSpinRelativeCompositeBuilder::Attribute< string >( "theta" ) + + KSGenSpinRelativeCompositeBuilder::Attribute< string >( "phi" ) + + KSGenSpinRelativeCompositeBuilder::Attribute< string >( "surface" ) + + KSGenSpinRelativeCompositeBuilder::Attribute< string >( "space" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueFix >( "theta_fix" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueSet >( "theta_set" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueList >( "theta_list" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueUniform >( "theta_uniform" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueGauss >( "theta_gauss" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueGeneralizedGauss >( "theta_generalized_gauss" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueAngleCosine >( "theta_cosine" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueAngleSpherical >( "theta_spherical" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueFix >( "phi_fix" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueSet >( "phi_set" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueList >( "phi_list" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueUniform >( "phi_uniform" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueGauss >( "phi_gauss" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueGeneralizedGauss >( "phi_generalized_gauss" ); + + STATICINT sKSGenSpinRelativeComposite = + KSRootBuilder::ComplexElement< KSGenSpinRelativeComposite >( "ksgen_spin_composite_relative" ); + +#ifdef Kassiopeia_USE_ROOT + STATICINT sKSGenSpinRelativeCompositeStructureROOT = + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueFormula >( "theta_formula" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueHistogram >( "theta_histogram" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueFormula >( "phi_formula" ) + + KSGenSpinRelativeCompositeBuilder::ComplexElement< KSGenValueHistogram >( "phi_histogram" ); +#endif + +} diff --git a/Kassiopeia/Bindings/Interactions/Include/KSIntCalculatorIonBuilder.h b/Kassiopeia/Bindings/Interactions/Include/KSIntCalculatorIonBuilder.h index e043e3c9c..c0095779d 100644 --- a/Kassiopeia/Bindings/Interactions/Include/KSIntCalculatorIonBuilder.h +++ b/Kassiopeia/Bindings/Interactions/Include/KSIntCalculatorIonBuilder.h @@ -24,8 +24,8 @@ namespace katrin { aContainer->CopyTo( fObject, &KSIntCalculatorIon::SetGas ); - if (fObject->GetGas().compare("H_2") != 0) { - intmsg(eError) << "\"" << fObject->GetGas() << "\" is not available for ion scattering! Available gases: \"H_2\"" << eom; + if ( (fObject->GetGas().compare("H_2")!=0) && (fObject->GetGas().compare("H2O")!=0) ) { + intmsg(eError) << "\"" << fObject->GetGas() << "\" is not available for ion scattering! Available gases: \"H_2\", \"H2O\"" << eom; return false; } @@ -33,10 +33,12 @@ namespace katrin else { intmsg(eWarning) << "H_2 ionization only available for the following ions and energies:" << eom; - intmsg(eWarning) << " H^+, D^+, T^+: 75 eV < E < 100 keV" << eom; - intmsg(eWarning) << " H_2^+, D_2^+, T_2^+: 31.6 eV < E < 100 keV" << eom; - intmsg(eWarning) << " H_3^+, D_3^+, T_3^+: 75 eV < E < 100 keV" << eom; - intmsg(eWarning) << " H^-, D^-, T^-: 2.37 eV < E < 50 keV" << eom; + intmsg(eWarning) << " H^+, D^+, T^+: 20 eV < E < 100 keV" << eom; + intmsg(eWarning) << " H_2^+, D_2^+, T_2^+: 30 eV < E < 100 keV" << eom; + intmsg(eWarning) << " H_3^+, D_3^+, T_3^+: 36 eV < E < 100 keV" << eom; + + intmsg(eWarning) << "H2O ionization only available for the following ions and energies:" << eom; + intmsg(eWarning) << " H^+, D^+, T^+: 100 eV < E < 5 MeV" << eom; return true; } diff --git a/Kassiopeia/Bindings/Interactions/Include/KSIntSpinFlipPulseBuilder.h b/Kassiopeia/Bindings/Interactions/Include/KSIntSpinFlipPulseBuilder.h new file mode 100644 index 000000000..965679b3b --- /dev/null +++ b/Kassiopeia/Bindings/Interactions/Include/KSIntSpinFlipPulseBuilder.h @@ -0,0 +1,32 @@ +#ifndef Kassiopeia_KSIntSpinFlipPulseBuilder_h_ +#define Kassiopeia_KSIntSpinFlipPulseBuilder_h_ + +#include "KComplexElement.hh" +#include "KSIntSpinFlipPulse.h" +#include "KToolbox.h" + +using namespace Kassiopeia; +namespace katrin +{ + + typedef KComplexElement< KSIntSpinFlipPulse > KSIntSpinFlipPulseBuilder; + + template< > + inline bool KSIntSpinFlipPulseBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + aContainer->CopyTo( fObject, &KNamed::SetName ); + return true; + } + if( aContainer->GetName() == "time" ) + { + aContainer->CopyTo( fObject, &KSIntSpinFlipPulse::SetTime ); + return true; + } + return false; + } + +} + +#endif diff --git a/Kassiopeia/Bindings/Interactions/Include/KSIntSpinRotateYPulseBuilder.h b/Kassiopeia/Bindings/Interactions/Include/KSIntSpinRotateYPulseBuilder.h new file mode 100644 index 000000000..b6c6f0279 --- /dev/null +++ b/Kassiopeia/Bindings/Interactions/Include/KSIntSpinRotateYPulseBuilder.h @@ -0,0 +1,42 @@ +#ifndef Kassiopeia_KSIntSpinRotateYPulseBuilder_h_ +#define Kassiopeia_KSIntSpinRotateYPulseBuilder_h_ + +#include "KComplexElement.hh" +#include "KSIntSpinRotateYPulse.h" +#include "KToolbox.h" + +using namespace Kassiopeia; +namespace katrin +{ + + typedef KComplexElement< KSIntSpinRotateYPulse > KSIntSpinRotateYPulseBuilder; + + template< > + inline bool KSIntSpinRotateYPulseBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + aContainer->CopyTo( fObject, &KNamed::SetName ); + return true; + } + if( aContainer->GetName() == "time" ) + { + aContainer->CopyTo( fObject, &KSIntSpinRotateYPulse::SetTime ); + return true; + } + if( aContainer->GetName() == "angle" ) + { + aContainer->CopyTo( fObject, &KSIntSpinRotateYPulse::SetAngle ); + return true; + } + if( aContainer->GetName() == "is_adiabatic" ) + { + aContainer->CopyTo( fObject, &KSIntSpinRotateYPulse::SetIsAdiabatic ); + return true; + } + return false; + } + +} + +#endif diff --git a/Kassiopeia/Bindings/Interactions/Include/KSIntSurfaceUCNBuilder.h b/Kassiopeia/Bindings/Interactions/Include/KSIntSurfaceUCNBuilder.h index c0f12d2e9..5376144cc 100644 --- a/Kassiopeia/Bindings/Interactions/Include/KSIntSurfaceUCNBuilder.h +++ b/Kassiopeia/Bindings/Interactions/Include/KSIntSurfaceUCNBuilder.h @@ -18,14 +18,24 @@ namespace katrin aContainer->CopyTo( fObject, &KNamed::SetName ); return true; } - if( aContainer->GetName() == "transmission_probability" ) + if( aContainer->GetName() == "eta" ) { - aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetProbability ); + aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetEta ); return true; } - if( aContainer->GetName() == "spin_flip_probability" ) + if( aContainer->GetName() == "alpha" ) { - aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetSpinFlipProbability ); + aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetAlpha ); + return true; + } + if( aContainer->GetName() == "real_optical_potential" ) + { + aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetRealOpticalPotential ); + return true; + } + if( aContainer->GetName() == "correlation_length" ) + { + aContainer->CopyTo( fObject, &KSIntSurfaceUCN::SetCorrelationLength ); return true; } return false; diff --git a/Kassiopeia/Bindings/Interactions/Source/KSIntSpinFlipPulseBuilder.cxx b/Kassiopeia/Bindings/Interactions/Source/KSIntSpinFlipPulseBuilder.cxx new file mode 100644 index 000000000..dc33a90f3 --- /dev/null +++ b/Kassiopeia/Bindings/Interactions/Source/KSIntSpinFlipPulseBuilder.cxx @@ -0,0 +1,22 @@ +#include "KSIntSpinFlipPulseBuilder.h" +#include "KSRootBuilder.h" + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSIntSpinFlipPulseBuilder::~KComplexElement() + { + } + + STATICINT sKSIntSpinFlipPulseStructure = + KSIntSpinFlipPulseBuilder::Attribute< string >( "name" ) + + KSIntSpinFlipPulseBuilder::Attribute< double >( "time" ); + + STATICINT sKSIntSpinFlipPulse = + KSRootBuilder::ComplexElement< KSIntSpinFlipPulse >( "ksint_spin_flip_pulse" ); + +} diff --git a/Kassiopeia/Bindings/Interactions/Source/KSIntSpinRotateYPulseBuilder.cxx b/Kassiopeia/Bindings/Interactions/Source/KSIntSpinRotateYPulseBuilder.cxx new file mode 100644 index 000000000..8b43026ca --- /dev/null +++ b/Kassiopeia/Bindings/Interactions/Source/KSIntSpinRotateYPulseBuilder.cxx @@ -0,0 +1,24 @@ +#include "KSIntSpinRotateYPulseBuilder.h" +#include "KSRootBuilder.h" + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSIntSpinRotateYPulseBuilder::~KComplexElement() + { + } + + STATICINT sKSIntSpinRotateYPulseStructure = + KSIntSpinRotateYPulseBuilder::Attribute< string >( "name" ) + + KSIntSpinRotateYPulseBuilder::Attribute< double >( "time" ) + + KSIntSpinRotateYPulseBuilder::Attribute< double >( "angle" ) + + KSIntSpinRotateYPulseBuilder::Attribute< bool >( "is_adiabatic" ); + + STATICINT sKSIntSpinRotateYPulse = + KSRootBuilder::ComplexElement< KSIntSpinRotateYPulse >( "ksint_spin_rotate_y_pulse" ); + +} diff --git a/Kassiopeia/Bindings/Interactions/Source/KSIntSurfaceUCNBuilder.cxx b/Kassiopeia/Bindings/Interactions/Source/KSIntSurfaceUCNBuilder.cxx index c7ab0836e..06cade9be 100644 --- a/Kassiopeia/Bindings/Interactions/Source/KSIntSurfaceUCNBuilder.cxx +++ b/Kassiopeia/Bindings/Interactions/Source/KSIntSurfaceUCNBuilder.cxx @@ -14,8 +14,10 @@ namespace katrin STATICINT sKSIntSurfaceUCNStructure = KSIntSurfaceUCNBuilder::Attribute< string >( "name" ) + - KSIntSurfaceUCNBuilder::Attribute< double >( "spin_flip_probability" ) + - KSIntSurfaceUCNBuilder::Attribute< double >( "transmission_probability" ); + KSIntSurfaceUCNBuilder::Attribute< double >( "eta" ) + + KSIntSurfaceUCNBuilder::Attribute< double >( "alpha" ) + + KSIntSurfaceUCNBuilder::Attribute< double >( "real_optical_potential" ) + + KSIntSurfaceUCNBuilder::Attribute< double >( "correlation_length" ); STATICINT sKSIntSurfaceUCNElement = KSRootBuilder::ComplexElement< KSIntSurfaceUCN >( "ksint_surface_UCN" ); diff --git a/Kassiopeia/Bindings/Terminators/Include/KSTermMaxStepTimeBuilder.h b/Kassiopeia/Bindings/Terminators/Include/KSTermMaxStepTimeBuilder.h new file mode 100644 index 000000000..9f898b0e0 --- /dev/null +++ b/Kassiopeia/Bindings/Terminators/Include/KSTermMaxStepTimeBuilder.h @@ -0,0 +1,31 @@ +#ifndef Kassiopeia_KSTermMaxStepTimeBuilder_h_ +#define Kassiopeia_KSTermMaxStepTimeBuilder_h_ + +#include "KComplexElement.hh" +#include "KSTermMaxStepTime.h" + +using namespace Kassiopeia; +namespace katrin +{ + + typedef KComplexElement< KSTermMaxStepTime > KSTermMaxStepTimeBuilder; + + template< > + inline bool KSTermMaxStepTimeBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + aContainer->CopyTo( fObject, &KNamed::SetName ); + return true; + } + if( aContainer->GetName() == "time" ) + { + aContainer->CopyTo( fObject, &KSTermMaxStepTime::SetTime ); + return true; + } + return false; + } + +} + +#endif diff --git a/Kassiopeia/Bindings/Terminators/Include/KSTermMaxTotalTimeBuilder.h b/Kassiopeia/Bindings/Terminators/Include/KSTermMaxTotalTimeBuilder.h new file mode 100644 index 000000000..f45bfdb18 --- /dev/null +++ b/Kassiopeia/Bindings/Terminators/Include/KSTermMaxTotalTimeBuilder.h @@ -0,0 +1,31 @@ +#ifndef Kassiopeia_KSTermMaxStepTimeBuilder_h_ +#define Kassiopeia_KSTermMaxStepTimeBuilder_h_ + +#include "KComplexElement.hh" +#include "KSTermMaxTotalTime.h" + +using namespace Kassiopeia; +namespace katrin +{ + + typedef KComplexElement< KSTermMaxTotalTime > KSTermMaxTotalTimeBuilder; + + template< > + inline bool KSTermMaxTotalTimeBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + aContainer->CopyTo( fObject, &KNamed::SetName ); + return true; + } + if( aContainer->GetName() == "time" ) + { + aContainer->CopyTo( fObject, &KSTermMaxTotalTime::SetTime ); + return true; + } + return false; + } + +} + +#endif diff --git a/Kassiopeia/Bindings/Terminators/Source/KSTermMaxStepTimeBuilder.cxx b/Kassiopeia/Bindings/Terminators/Source/KSTermMaxStepTimeBuilder.cxx new file mode 100644 index 000000000..06559f6e3 --- /dev/null +++ b/Kassiopeia/Bindings/Terminators/Source/KSTermMaxStepTimeBuilder.cxx @@ -0,0 +1,22 @@ +#include "KSTermMaxStepTimeBuilder.h" +#include "KSRootBuilder.h" + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSTermMaxStepTimeBuilder::~KComplexElement() + { + } + + STATICINT sKSTermMaxStepTimeStructure = + KSTermMaxStepTimeBuilder::Attribute< string >( "name" ) + + KSTermMaxStepTimeBuilder::Attribute< double >( "time" ); + + STATICINT sKSTermMaxStepTime = + KSRootBuilder::ComplexElement< KSTermMaxStepTime >( "ksterm_max_step_time" ); + +} diff --git a/Kassiopeia/Bindings/Terminators/Source/KSTermMaxTotalTimeBuilder.cxx b/Kassiopeia/Bindings/Terminators/Source/KSTermMaxTotalTimeBuilder.cxx new file mode 100644 index 000000000..461e8f758 --- /dev/null +++ b/Kassiopeia/Bindings/Terminators/Source/KSTermMaxTotalTimeBuilder.cxx @@ -0,0 +1,22 @@ +#include "KSTermMaxTotalTimeBuilder.h" +#include "KSRootBuilder.h" + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSTermMaxTotalTimeBuilder::~KComplexElement() + { + } + + STATICINT sKSTermMaxTotalTimeStructure = + KSTermMaxTotalTimeBuilder::Attribute< string >( "name" ) + + KSTermMaxTotalTimeBuilder::Attribute< double >( "time" ); + + STATICINT sKSTermMaxStepTime = + KSRootBuilder::ComplexElement< KSTermMaxTotalTime >( "ksterm_max_total_time" ); + +} diff --git a/Kassiopeia/Bindings/Terminators/Source/KSTermTrappedBuilder.cxx b/Kassiopeia/Bindings/Terminators/Source/KSTermTrappedBuilder.cxx index 42f155eda..2371aa0c5 100644 --- a/Kassiopeia/Bindings/Terminators/Source/KSTermTrappedBuilder.cxx +++ b/Kassiopeia/Bindings/Terminators/Source/KSTermTrappedBuilder.cxx @@ -14,7 +14,7 @@ namespace katrin STATICINT sKSTermTrappedStructure = KSTermTrappedBuilder::Attribute< string >( "name" ) + - KSTermTrappedBuilder::Attribute< unsigned int >( "max_turns" ); + KSTermTrappedBuilder::Attribute< int >( "max_turns" ); STATICINT sKSTermTrapped = KSRootBuilder::ComplexElement< KSTermTrapped >( "ksterm_trapped" ); diff --git a/Kassiopeia/Bindings/Writers/Include/KSWriteROOTConditionPeriodicBuilder.h b/Kassiopeia/Bindings/Writers/Include/KSWriteROOTConditionPeriodicBuilder.h new file mode 100644 index 000000000..8ac45d2f5 --- /dev/null +++ b/Kassiopeia/Bindings/Writers/Include/KSWriteROOTConditionPeriodicBuilder.h @@ -0,0 +1,255 @@ +#ifndef Kassiopeia_KSWriteROOTConditionPeriodicBuilder_h_ +#define Kassiopeia_KSWriteROOTConditionPeriodicBuilder_h_ + +#include "KComplexElement.hh" +#include "KSWriteROOTConditionPeriodic.h" +#include "KToolbox.h" +#include "KSComponentGroup.h" +#include + +using namespace Kassiopeia; +namespace katrin +{ + + class KSWriteROOTConditionPeriodicData + { + public: + std::string fName; + std::string fGroupName; + std::string fComponentName; + double fInitialMin; + double fInitialMax; + double fIncrement; + double fResetMin; + double fResetMax; + }; + + typedef KComplexElement< KSWriteROOTConditionPeriodicData > KSWriteROOTConditionPeriodicBuilder; + + template< > + inline bool KSWriteROOTConditionPeriodicBuilder::Begin() + { + fObject = new KSWriteROOTConditionPeriodicData; + fObject->fInitialMin = std::numeric_limits< double >::max(); //NOTE: defaults to always-off until reset + fObject->fInitialMax = -1.0*std::numeric_limits< double >::max(); + return true; + } + + template< > + inline bool KSWriteROOTConditionPeriodicBuilder::AddAttribute( KContainer* aContainer ) + { + if( aContainer->GetName() == "name" ) + { + std::string tName = aContainer->AsReference< std::string >(); + fObject->fName = tName; + return true; + } + if( aContainer->GetName() == "initial_min" ) + { + double tValue = aContainer->AsReference< double >(); + fObject->fInitialMin = tValue; + return true; + } + if( aContainer->GetName() == "initial_max" ) + { + double tValue = aContainer->AsReference< double >(); + fObject->fInitialMax = tValue; + return true; + } + if( aContainer->GetName() == "increment" ) + { + double tValue = aContainer->AsReference< double >(); + fObject->fIncrement = tValue; + return true; + } + if( aContainer->GetName() == "reset_min" ) + { + double tValue = aContainer->AsReference< double >(); + fObject->fResetMin = tValue; + return true; + } + if( aContainer->GetName() == "reset_max" ) + { + double tValue = aContainer->AsReference< double >(); + fObject->fResetMax = tValue; + return true; + } + if( aContainer->GetName() == "group" ) + { + std::string tName = aContainer->AsReference< std::string >(); + fObject->fGroupName = tName; + return true; + } + if( aContainer->GetName() == "parent" ) + { + std::string tName = aContainer->AsReference< std::string >(); + fObject->fComponentName = tName; + return true; + } + return false; + } + + template< > + inline bool KSWriteROOTConditionPeriodicBuilder::End() + { + KSComponent* tComponent = NULL; + if( fObject->fGroupName.empty() == false ) + { + KSComponentGroup* tComponentGroup = KToolbox::GetInstance().Get< KSComponentGroup >( fObject->fGroupName ); + for( unsigned int tIndex = 0; tIndex < tComponentGroup->ComponentCount(); tIndex++ ) + { + KSComponent* tGroupComponent = tComponentGroup->ComponentAt( tIndex ); + if( tGroupComponent->GetName() == fObject->fComponentName ) + { + tComponent = tGroupComponent; + break; + } + } + if( tComponent == NULL ) + { + objctmsg( eError ) << "write ROOT condition output builder could not find component <" << fObject->fComponentName << "> in group <" << fObject->fGroupName << ">" << eom; + return false; + } + } + else + { + tComponent = KToolbox::GetInstance().Get< KSComponent >( fObject->fComponentName ); + } + + + KSWriteROOTCondition* tCondition = NULL; + + if( tComponent->Is< unsigned short >() == true ) + { + KSWriteROOTConditionPeriodic< unsigned short >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< unsigned short >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< unsigned short >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< short >() == true ) + { + KSWriteROOTConditionPeriodic< short >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< short >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< short >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< unsigned int >() == true ) + { + KSWriteROOTConditionPeriodic< unsigned int >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< unsigned int >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< unsigned int >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< int >() == true ) + { + KSWriteROOTConditionPeriodic< int >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< int >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< int >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< unsigned long >() == true ) + { + KSWriteROOTConditionPeriodic< unsigned long >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< unsigned long >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< unsigned long >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< long >() == true ) + { + KSWriteROOTConditionPeriodic< long >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< long >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< long >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< float >() == true ) + { + KSWriteROOTConditionPeriodic< float >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< float >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< float >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + if( tComponent->Is< double >() == true ) + { + KSWriteROOTConditionPeriodic< double >* tWriteROOTConditionPeriodic = new KSWriteROOTConditionPeriodic< double >(); + tWriteROOTConditionPeriodic->SetName( fObject->fName ); + tWriteROOTConditionPeriodic->SetInitialMin( fObject->fInitialMin ); + tWriteROOTConditionPeriodic->SetInitialMax( fObject->fInitialMax ); + tWriteROOTConditionPeriodic->SetIncrement( fObject->fIncrement ); + tWriteROOTConditionPeriodic->SetResetMin( fObject->fResetMin ); + tWriteROOTConditionPeriodic->SetResetMax( fObject->fResetMax ); + tWriteROOTConditionPeriodic->SetValue( tComponent->As< double >() ); + tCondition = tWriteROOTConditionPeriodic; + delete fObject; + Set( tCondition ); + return true; + } + + objctmsg( eError ) << "component in write ROOT condition output builder is of non supported type " << eom; + return false; + } + +} +#endif diff --git a/Kassiopeia/Bindings/Writers/Source/KSWriteROOTConditionPeriodicBuilder.cxx b/Kassiopeia/Bindings/Writers/Source/KSWriteROOTConditionPeriodicBuilder.cxx new file mode 100644 index 000000000..825018d13 --- /dev/null +++ b/Kassiopeia/Bindings/Writers/Source/KSWriteROOTConditionPeriodicBuilder.cxx @@ -0,0 +1,30 @@ +#include "KSWriteROOTConditionPeriodicBuilder.h" +#include "KSRootBuilder.h" + +using namespace Kassiopeia; +using namespace std; + +namespace katrin +{ + + template< > + KSWriteROOTConditionPeriodicBuilder::~KComplexElement() + { + } + + STATICINT sKSWriteROOTConditionPeriodicStructure = + KSWriteROOTConditionPeriodicBuilder::Attribute< string >( "name" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< double >( "initial_min" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< double >( "initial_max" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< double >( "increment" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< double >( "reset_min" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< double >( "reset_max" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< string >( "group" ) + + KSWriteROOTConditionPeriodicBuilder::Attribute< string >( "parent" ); + + + + STATICINT sKSWriteROOTConditionPeriodic = + KSRootBuilder::ComplexElement< KSWriteROOTConditionPeriodicData >( "kswrite_root_condition_periodic" ); + +} diff --git a/Kassiopeia/CMakeLists.txt b/Kassiopeia/CMakeLists.txt index dd0d7f0bb..52d977664 100644 --- a/Kassiopeia/CMakeLists.txt +++ b/Kassiopeia/CMakeLists.txt @@ -7,12 +7,12 @@ cmake_minimum_required( VERSION ${CMAKE_MINIMUM_VERSION} ) if(POLICY CMP0053) - cmake_policy(SET CMP0053 OLD) + cmake_policy(SET CMP0053 NEW) endif() # Kassiopeia version set( MODULE_VERSION_MAJOR 3 ) -set( MODULE_VERSION_MINOR 5 ) +set( MODULE_VERSION_MINOR 6 ) set( MODULE_VERSION_PATCH 0 ) set( MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_PATCH}" ) @@ -38,7 +38,7 @@ kasper_module_paths( Kassiopeia ) # module debugging kasper_module_debug() if( Kassiopeia_ENABLE_DEBUG ) - dd_cflag( Kassiopeia_ENABLE_DEBUG ) + add_cflag( Kassiopeia_ENABLE_DEBUG ) endif() # external dependencies: boost diff --git a/Kassiopeia/Fields/Source/KSElectricKEMField.cxx b/Kassiopeia/Fields/Source/KSElectricKEMField.cxx index 0568a4b19..6418c2b67 100644 --- a/Kassiopeia/Fields/Source/KSElectricKEMField.cxx +++ b/Kassiopeia/Fields/Source/KSElectricKEMField.cxx @@ -6,7 +6,6 @@ */ #include "KSElectricKEMField.h" #include "KElectricField.hh" -#include "KEMVectorConverters.hh" using namespace KEMField; @@ -26,7 +25,7 @@ KSElectricKEMField::KSElectricKEMField(const KSElectricKEMField& aCopy) : KSElectricKEMField::KSElectricKEMField(KEMField::KElectricField* field) : KSComponent(),fField(field) { - fName = field->Name(); + SetName(field->Name()); } @@ -38,7 +37,7 @@ KSElectricKEMField* KSElectricKEMField::Clone() const void KSElectricKEMField::CalculatePotential( const KGeoBag::KThreeVector& aSamplePoint, const double& aSampleTime, double& aPotential) { - aPotential = fField->Potential(K2KEMThreeVector(aSamplePoint),aSampleTime); + aPotential = fField->Potential(aSamplePoint,aSampleTime); } void KSElectricKEMField::SetElectricField(KEMField::KElectricField* field) { @@ -53,16 +52,14 @@ const KEMField::KElectricField* KSElectricKEMField::getElectricField() void KSElectricKEMField::CalculateField( const KGeoBag::KThreeVector& aSamplePoint, const double& aSampleTime, KGeoBag::KThreeVector& aField) { - KEMThreeVector field = - fField->ElectricField(K2KEMThreeVector(aSamplePoint),aSampleTime); - aField = KEM2KThreeVector(field); + aField = fField->ElectricField(aSamplePoint,aSampleTime); } void KSElectricKEMField::CalculateFieldAndPotential( const KGeoBag::KThreeVector& aSamplePoint, const double& aSampleTime, KGeoBag::KThreeVector& aField, double& aPotential) { - std::pair potential_field_pair = fField->ElectricFieldAndPotential(K2KEMThreeVector(aSamplePoint),aSampleTime); + std::pair potential_field_pair = fField->ElectricFieldAndPotential(aSamplePoint,aSampleTime); aPotential = potential_field_pair.second; aField = potential_field_pair.first; } diff --git a/Kassiopeia/Fields/Source/KSExampleFields.cxx b/Kassiopeia/Fields/Source/KSExampleFields.cxx index 2ed617874..ddfb463e3 100644 --- a/Kassiopeia/Fields/Source/KSExampleFields.cxx +++ b/Kassiopeia/Fields/Source/KSExampleFields.cxx @@ -10,7 +10,6 @@ #include "KMagnetostaticConstantField.hh" #include "KSElectricKEMField.h" #include "KSMagneticKEMField.h" -#include "KEMVectorConverters.hh" using namespace KEMField; @@ -21,7 +20,7 @@ KSElectricField* MakeConstantElectricField( KGeoBag::KThreeVector field) { KElectrostaticConstantField* kemfield = new KElectrostaticConstantField(); - kemfield->SetField(K2KEMThreeVector(field)); + kemfield->SetField(field); KSElectricKEMField* kasfield = new KSElectricKEMField(); kasfield->SetElectricField(kemfield); @@ -32,7 +31,7 @@ KSMagneticField* MakeConstantMagneticField( KGeoBag::KThreeVector field) { KMagnetostaticConstantField* kemfield = new KMagnetostaticConstantField(); - kemfield->SetField(K2KEMThreeVector(field)); + kemfield->SetField(field); KSMagneticKEMField* kasfield = new KSMagneticKEMField(); kasfield->SetMagneticField(kemfield); diff --git a/Kassiopeia/Fields/Source/KSMagneticKEMField.cxx b/Kassiopeia/Fields/Source/KSMagneticKEMField.cxx index cc3afb9ba..5589ea58b 100644 --- a/Kassiopeia/Fields/Source/KSMagneticKEMField.cxx +++ b/Kassiopeia/Fields/Source/KSMagneticKEMField.cxx @@ -7,7 +7,6 @@ #include "KSMagneticKEMField.h" #include "KMagneticField.hh" -#include "KEMVectorConverters.hh" using namespace KEMField; @@ -27,7 +26,7 @@ KSMagneticKEMField::KSMagneticKEMField(const KSMagneticKEMField& aCopy) : KSMagneticKEMField::KSMagneticKEMField(KEMField::KMagneticField* field) : KSComponent(),fField(field) { - fName = field->Name(); + SetName(field->Name()); } @@ -50,26 +49,23 @@ const KEMField::KMagneticField* KSMagneticKEMField::getMagneticField() { void KSMagneticKEMField::CalculatePotential(const KThreeVector& aSamplePoint, const double& aSampleTime, KThreeVector& aPotential) { - KEMThreeVector potential = fField->MagneticPotential(K2KEMThreeVector(aSamplePoint),aSampleTime); - aPotential = KEM2KThreeVector(potential); + aPotential = fField->MagneticPotential(aSamplePoint,aSampleTime); } void KSMagneticKEMField::CalculateField(const KThreeVector& aSamplePoint, const double& aSampleTime, KThreeVector& aField) { - KEMThreeVector field = fField->MagneticField(K2KEMThreeVector(aSamplePoint),aSampleTime); - aField = KEM2KThreeVector(field); + aField = fField->MagneticField(aSamplePoint,aSampleTime); } void KSMagneticKEMField::CalculateGradient(const KThreeVector& aSamplePoint, const double& aSampleTime, KThreeMatrix& aGradient) { - KGradient gradient = fField->MagneticGradient(K2KEMThreeVector(aSamplePoint),aSampleTime); - aGradient = KEM2KThreeMatrix(gradient); + aGradient = fField->MagneticGradient(aSamplePoint,aSampleTime); } void KSMagneticKEMField::CalculateFieldAndGradient( const KThreeVector& aSamplePoint, const double& aSampleTime, KThreeVector& aField, KThreeMatrix& aGradient) { - std::pair field_gradient_pair = fField->MagneticFieldAndGradient(K2KEMThreeVector(aSamplePoint),aSampleTime); + std::pair field_gradient_pair = fField->MagneticFieldAndGradient(aSamplePoint,aSampleTime); aField = field_gradient_pair.first; aGradient = field_gradient_pair.second; } diff --git a/Kassiopeia/Generators/CMakeLists.txt b/Kassiopeia/Generators/CMakeLists.txt index f65e61130..a51147118 100644 --- a/Kassiopeia/Generators/CMakeLists.txt +++ b/Kassiopeia/Generators/CMakeLists.txt @@ -49,6 +49,7 @@ set( GENERATORS_HEADER_BASENAMES KSGenMomentumRectangularComposite.h KSGenSpinComposite.h + KSGenSpinRelativeComposite.h KSGenTimeComposite.h @@ -127,6 +128,7 @@ set( GENERATORS_SOURCE_BASENAMES KSGenMomentumRectangularComposite.cxx KSGenSpinComposite.cxx + KSGenSpinRelativeComposite.cxx KSGenTimeComposite.cxx diff --git a/Kassiopeia/Generators/Include/KSGenSpinRelativeComposite.h b/Kassiopeia/Generators/Include/KSGenSpinRelativeComposite.h new file mode 100644 index 000000000..8250f1833 --- /dev/null +++ b/Kassiopeia/Generators/Include/KSGenSpinRelativeComposite.h @@ -0,0 +1,40 @@ +#ifndef Kassiopeia_KSGenSpinRelativeComposite_h_ +#define Kassiopeia_KSGenSpinRelativeComposite_h_ + +#include "KSGenCreator.h" +#include "KSGenValue.h" + +namespace Kassiopeia +{ + + class KSGenSpinRelativeComposite : + public KSComponentTemplate< KSGenSpinRelativeComposite, KSGenCreator > + { + public: + KSGenSpinRelativeComposite(); + KSGenSpinRelativeComposite( const KSGenSpinRelativeComposite& aCopy ); + KSGenSpinRelativeComposite* Clone() const; + virtual ~KSGenSpinRelativeComposite(); + + public: + virtual void Dice( KSParticleQueue* aParticleList ); + + public: + void SetThetaValue( KSGenValue* anThetaValue ); + void ClearThetaValue( KSGenValue* anThetaValue ); + + void SetPhiValue( KSGenValue* aPhiValue ); + void ClearPhiValue( KSGenValue* aPhiValue ); + + private: + KSGenValue* fThetaValue; + KSGenValue* fPhiValue; + + protected: + void InitializeComponent(); + void DeinitializeComponent(); + }; + +} + +#endif diff --git a/Kassiopeia/Generators/Source/KSGenPositionMeshSurfaceRandom.cxx b/Kassiopeia/Generators/Source/KSGenPositionMeshSurfaceRandom.cxx index 93e100c8f..cb2999dab 100644 --- a/Kassiopeia/Generators/Source/KSGenPositionMeshSurfaceRandom.cxx +++ b/Kassiopeia/Generators/Source/KSGenPositionMeshSurfaceRandom.cxx @@ -145,6 +145,10 @@ namespace Kassiopeia tSysIt != fElementsystems.end(); ++tSysIt ) { + if ((tSysIt->second)==NULL) { + genmsg( eError ) << "Mesh has not been defined for all surfaces specified in KSGenPositionMeshSurfaceRandom" << eom; + } + for( KGeoBag::KGMeshElementCIt tElementIt = tSysIt->second->begin(); tElementIt != tSysIt->second->end(); ++tElementIt ) diff --git a/Kassiopeia/Generators/Source/KSGenSpinComposite.cxx b/Kassiopeia/Generators/Source/KSGenSpinComposite.cxx index ea1924b5b..d5828a514 100644 --- a/Kassiopeia/Generators/Source/KSGenSpinComposite.cxx +++ b/Kassiopeia/Generators/Source/KSGenSpinComposite.cxx @@ -67,18 +67,22 @@ namespace Kassiopeia KThreeVector LocalZ = tParticle->GetMagneticField() / tParticle->GetMagneticField().Magnitude(); KThreeVector LocalX ( LocalZ.Z() - LocalZ.Y(), LocalZ.X() - LocalZ.Z(), LocalZ.Y() - LocalZ.X() ); LocalX = LocalX / LocalX.Magnitude(); - - //std::cout << "B: " << tParticle->GetMagneticField() << "\t\tZ(b): " << LocalZ << "\t\tX(b): " << LocalX << "\n"; + KThreeVector LocalY = LocalZ.Cross( LocalX ); tParticle->SetAlignedSpin( tSpin.Dot( LocalZ ) / tSpin.Magnitude() ); if ( std::isnan( tParticle->GetAlignedSpin() ) ) { tParticle->SetAlignedSpin( 1. ); - //std::cout << "*fixed NaN m (in GSC); B: " << tParticle->GetMagneticField() << "\n"; } if (tParticle->GetAlignedSpin() < 0.99999 && tParticle->GetAlignedSpin() > -0.99999 ) { - tParticle->SetSpinAngle( acos( tSpin.Dot( LocalX ) / tSpin.Magnitude() / sqrt( 1 - tParticle->GetAlignedSpin() * tParticle->GetAlignedSpin() ) ) ); + if ( tSpin.Dot( LocalY ) > 0. ){ + tParticle->SetSpinAngle( acos( tSpin.Dot( LocalX ) / tSpin.Magnitude() / sqrt( 1 - tParticle->GetAlignedSpin() * tParticle->GetAlignedSpin() ) ) ); + } + else + { + tParticle->SetSpinAngle( KConst::Pi() + acos( tSpin.Dot( LocalX ) / tSpin.Magnitude() / sqrt( 1 - tParticle->GetAlignedSpin() * tParticle->GetAlignedSpin() ) ) ); + } } else { diff --git a/Kassiopeia/Generators/Source/KSGenSpinRelativeComposite.cxx b/Kassiopeia/Generators/Source/KSGenSpinRelativeComposite.cxx new file mode 100644 index 000000000..ebaf46fd8 --- /dev/null +++ b/Kassiopeia/Generators/Source/KSGenSpinRelativeComposite.cxx @@ -0,0 +1,160 @@ +#include "KSGenSpinRelativeComposite.h" +#include "KSGeneratorsMessage.h" + +#include + +namespace Kassiopeia +{ + + KSGenSpinRelativeComposite::KSGenSpinRelativeComposite() : + fThetaValue( NULL ), + fPhiValue( NULL ) + { + } + KSGenSpinRelativeComposite::KSGenSpinRelativeComposite( const KSGenSpinRelativeComposite& aCopy ) : + KSComponent(), + fThetaValue( aCopy.fThetaValue ), + fPhiValue( aCopy.fPhiValue ) + { + } + KSGenSpinRelativeComposite* KSGenSpinRelativeComposite::Clone() const + { + return new KSGenSpinRelativeComposite( *this ); + } + KSGenSpinRelativeComposite::~KSGenSpinRelativeComposite() + { + } + + void KSGenSpinRelativeComposite::Dice( KSParticleQueue* aPrimaries ) + { + if ( !fThetaValue || !fPhiValue ) + genmsg( eError ) << "theta or phi value undefined in composite direction creator <" << this->GetName() << ">" << eom; + + KThreeVector tSpin; + + KSParticle* tParticle; + KSParticleIt tParticleIt; + KSParticleQueue tParticles; + + double tThetaValue; + vector< double > tThetaValues; + vector< double >::iterator tThetaValueIt; + + double tPhiValue; + vector< double > tPhiValues; + vector< double >::iterator tPhiValueIt; + + fThetaValue->DiceValue( tThetaValues ); + fPhiValue->DiceValue( tPhiValues ); + + for( tThetaValueIt = tThetaValues.begin(); tThetaValueIt != tThetaValues.end(); tThetaValueIt++ ) + { + tThetaValue = (KConst::Pi() / 180.) * (*tThetaValueIt); + for( tPhiValueIt = tPhiValues.begin(); tPhiValueIt != tPhiValues.end(); tPhiValueIt++ ) + { + tPhiValue = (KConst::Pi() / 180.) * (*tPhiValueIt); + for( tParticleIt = aPrimaries->begin(); tParticleIt != aPrimaries->end(); tParticleIt++ ) + { + tParticle = new KSParticle( **tParticleIt ); + tParticle->SetAlignedSpin( cos( tThetaValue ) ); + if ( std::isnan( tParticle->GetAlignedSpin() ) ) + { + tParticle->SetAlignedSpin( 1. ); + } + if (tParticle->GetAlignedSpin() < 0.99999 && tParticle->GetAlignedSpin() > -0.99999 ) + { + tParticle->SetSpinAngle( tPhiValue ); + } + else + { + tParticle->SetSpinAngle( 0 ); + } + tParticle->RecalculateSpinGlobal(); + tParticles.push_back( tParticle ); + } + } + } + + for( tParticleIt = aPrimaries->begin(); tParticleIt != aPrimaries->end(); tParticleIt++ ) + { + tParticle = *tParticleIt; + delete tParticle; + } + + aPrimaries->assign( tParticles.begin(), tParticles.end() ); + + return; + } + + void KSGenSpinRelativeComposite::SetThetaValue( KSGenValue* anThetaValue ) + { + if( fThetaValue == NULL ) + { + fThetaValue = anThetaValue; + return; + } + genmsg( eError ) << "cannot set theta value <" << anThetaValue->GetName() << "> to composite spin creator <" << this->GetName() << ">" << eom; + return; + } + void KSGenSpinRelativeComposite::ClearThetaValue( KSGenValue* anThetaValue ) + { + if( fThetaValue == anThetaValue ) + { + fThetaValue = NULL; + return; + } + genmsg( eError ) << "cannot clear theta value <" << anThetaValue->GetName() << "> from composite spin creator <" << this->GetName() << ">" << eom; + return; + } + + void KSGenSpinRelativeComposite::SetPhiValue( KSGenValue* aPhiValue ) + { + if( fPhiValue == NULL ) + { + fPhiValue = aPhiValue; + return; + } + genmsg( eError ) << "cannot set phi value <" << aPhiValue->GetName() << "> to composite spin creator <" << this->GetName() << ">" << eom; + return; + } + void KSGenSpinRelativeComposite::ClearPhiValue( KSGenValue* anPhiValue ) + { + if( fPhiValue == anPhiValue ) + { + fPhiValue = NULL; + return; + } + genmsg( eError ) << "cannot clear phi value <" << anPhiValue->GetName() << "> from composite spin creator <" << this->GetName() << ">" << eom; + return; + } + + void KSGenSpinRelativeComposite::InitializeComponent() + { + if( fThetaValue != NULL ) + { + fThetaValue->Initialize(); + } + if( fPhiValue != NULL ) + { + fPhiValue->Initialize(); + } + return; + } + void KSGenSpinRelativeComposite::DeinitializeComponent() + { + if( fThetaValue != NULL ) + { + fThetaValue->Deinitialize(); + } + if( fPhiValue != NULL ) + { + fPhiValue->Deinitialize(); + } + return; + } + + STATICINT sKSGenDirectionSphericalCompositeDict = + KSDictionary< KSGenSpinRelativeComposite >::AddCommand( &KSGenSpinRelativeComposite::SetThetaValue, &KSGenSpinRelativeComposite::ClearThetaValue, "set_theta", "clear_theta" ) + + KSDictionary< KSGenSpinRelativeComposite >::AddCommand( &KSGenSpinRelativeComposite::SetPhiValue, &KSGenSpinRelativeComposite::ClearPhiValue, "set_phi", "clear_phi" ); + +} diff --git a/Kassiopeia/Generators/Source/KSGenValueAngleCosine.cxx b/Kassiopeia/Generators/Source/KSGenValueAngleCosine.cxx index 235f538f6..bc51d79ba 100644 --- a/Kassiopeia/Generators/Source/KSGenValueAngleCosine.cxx +++ b/Kassiopeia/Generators/Source/KSGenValueAngleCosine.cxx @@ -32,12 +32,14 @@ namespace Kassiopeia void KSGenValueAngleCosine::DiceValue( vector< double >& aDicedValues ) { - double tSinThetaMin = sin( (KConst::Pi() / 180.) * fAngleMin ); - double tSinThetaMax = sin( (KConst::Pi() / 180.) * fAngleMax ); - - double tSinTheta = KRandom::GetInstance().Uniform( tSinThetaMin, tSinThetaMax ); - double tAngle = acos( sqrt( 1. - tSinTheta*tSinTheta ) ); - + + double tsinThetaSquaredMin = pow(sin( (KConst::Pi() / 180.) * fAngleMin ),2); + double tsinThetaSquaredMax = pow(sin( (KConst::Pi() / 180.) * fAngleMax ),2); + + //Random generation follows Eq. 12 from J. Greenwood, Vacuum, 67 (2002), pp. 217-222 + double tsinThetaSquared = KRandom::GetInstance().Uniform( tsinThetaSquaredMin, tsinThetaSquaredMax ); + double tAngle = asin( sqrt(tsinThetaSquared) ); + aDicedValues.push_back( (180.0 / KConst::Pi()) * tAngle ); return; diff --git a/Kassiopeia/Interactions/CMakeLists.txt b/Kassiopeia/Interactions/CMakeLists.txt index 63510a03b..b60a87a9a 100644 --- a/Kassiopeia/Interactions/CMakeLists.txt +++ b/Kassiopeia/Interactions/CMakeLists.txt @@ -5,6 +5,8 @@ set( INTERACTIONS_HEADER_BASENAMES KSIntScattering.h KSIntSpinFlip.h + KSIntSpinFlipPulse.h + KSIntSpinRotateYPulse.h KSIntDecay.h KSIntDecayCalculator.h @@ -57,6 +59,8 @@ set( INTERACTIONS_SOURCE_BASENAMES KSIntScattering.cxx KSIntSpinFlip.cxx + KSIntSpinFlipPulse.cxx + KSIntSpinRotateYPulse.cxx KSIntDecay.cxx KSIntDecayCalculator.cxx diff --git a/Kassiopeia/Interactions/Include/KSIntCalculatorIon.h b/Kassiopeia/Interactions/Include/KSIntCalculatorIon.h index 6fadf91af..badeb454d 100644 --- a/Kassiopeia/Interactions/Include/KSIntCalculatorIon.h +++ b/Kassiopeia/Interactions/Include/KSIntCalculatorIon.h @@ -21,12 +21,13 @@ namespace Kassiopeia void CalculateCrossSection( const KSParticle& aParticle, double& aCrossSection ); void ExecuteInteraction( const KSParticle& anIncomingIon, KSParticle& anOutgoingIon, KSParticleQueue& aSecondaries ); void CalculateEnergyDifferentialCrossSection( const double anIncomingIonMass, const double anIncomingIonEnergy,const double aSecondaryElectronEnergy,double &aCrossSection); - + void CalculateAngleDifferentialCrossSection( const double aSecondaryElectronAngle,double &aCrossSection); + protected: + double Hplus_H2_crossSection(double aEnergy); double H2plus_H2_crossSection(double aEnergy); double H3plus_H2_crossSection(double aEnergy); - double Hminus_H2_crossSection(double aEnergy); double f1(double x,double c1,double c2); double f2(double x,double c1,double c2,double c3,double c4); @@ -35,10 +36,16 @@ namespace Kassiopeia double sigma2(double E1,double a1,double a2,double a3,double a4,double a5,double a6); double sigma6(double E1,double a1,double a2,double a3,double a4,double a5,double a6); double sigma10(double E1,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8); - double sigma11(double E1,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10); double E_1(double E,double E_threshold); + double Hplus_H2O_crossSection(double aEnergy); + + double sigmatot(double aEnergy, double A, double B, double C, double D); + double sigmalow(double x, double C, double D); + double sigmahigh(double x, double A, double B); + void CalculateSecondaryElectronEnergy( const double anIncomingIonMass, const double anIncomingIonEnergy,double& aSecondaryElectronEnergy); + void CalculateSecondaryElectronAngle( double& aSecondaryElectronEnergy); //For debugging purposes, moved to public: //void CalculateEnergyDifferentialCrossSection( const double anIncomingIonMass, const double anIncomingIonEnergy,const double aSecondaryElectronEnergy,double &aCrossSection); diff --git a/Kassiopeia/Interactions/Include/KSIntSpinFlipPulse.h b/Kassiopeia/Interactions/Include/KSIntSpinFlipPulse.h new file mode 100644 index 000000000..3000ca6db --- /dev/null +++ b/Kassiopeia/Interactions/Include/KSIntSpinFlipPulse.h @@ -0,0 +1,62 @@ +#ifndef Kassiopeia_KSIntSpinFlipPulse_h_ +#define Kassiopeia_KSIntSpinFlipPulse_h_ + +#include "KSSpaceInteraction.h" + +#include +using std::vector; + +namespace Kassiopeia +{ + + class KSIntSpinFlipPulse : + public KSComponentTemplate< KSIntSpinFlipPulse, KSSpaceInteraction > + { + public: + KSIntSpinFlipPulse(); + KSIntSpinFlipPulse( const KSIntSpinFlipPulse& aCopy ); + KSIntSpinFlipPulse* Clone() const; + virtual ~KSIntSpinFlipPulse(); + + public: + void CalculateInteraction( + const KSTrajectory& aTrajectory, + const KSParticle& aTrajectoryInitialParticle, + const KSParticle& aTrajectoryFinalParticle, + const KThreeVector& aTrajectoryCenter, + const double& aTrajectoryRadius, + const double& aTrajectoryTimeStep, + KSParticle& anInteractionParticle, + double& aTimeStep, + bool& aFlag + ); + + void ExecuteInteraction( + const KSParticle& anInteractionParticle, + KSParticle& aFinalParticle, + KSParticleQueue& aSecondaries + ) const; + + //*********** + //composition + //*********** + + public: + void SetTime( const double& aTime ); + + private: + mutable bool fDone; + double fTime; + + //************** + //initialization + //************** + + // protected: + // virtual void PushUpdateComponent(); + // virtual void PushDeupdateComponent(); + }; + +} + +#endif diff --git a/Kassiopeia/Interactions/Include/KSIntSpinRotateYPulse.h b/Kassiopeia/Interactions/Include/KSIntSpinRotateYPulse.h new file mode 100644 index 000000000..620863699 --- /dev/null +++ b/Kassiopeia/Interactions/Include/KSIntSpinRotateYPulse.h @@ -0,0 +1,66 @@ +#ifndef Kassiopeia_KSIntSpinRotateYPulse_h_ +#define Kassiopeia_KSIntSpinRotateYPulse_h_ + +#include "KSSpaceInteraction.h" + +#include +using std::vector; + +namespace Kassiopeia +{ + + class KSIntSpinRotateYPulse : + public KSComponentTemplate< KSIntSpinRotateYPulse, KSSpaceInteraction > + { + public: + KSIntSpinRotateYPulse(); + KSIntSpinRotateYPulse( const KSIntSpinRotateYPulse& aCopy ); + KSIntSpinRotateYPulse* Clone() const; + virtual ~KSIntSpinRotateYPulse(); + + public: + void CalculateInteraction( + const KSTrajectory& aTrajectory, + const KSParticle& aTrajectoryInitialParticle, + const KSParticle& aTrajectoryFinalParticle, + const KThreeVector& aTrajectoryCenter, + const double& aTrajectoryRadius, + const double& aTrajectoryTimeStep, + KSParticle& anInteractionParticle, + double& aTimeStep, + bool& aFlag + ); + + void ExecuteInteraction( + const KSParticle& anInteractionParticle, + KSParticle& aFinalParticle, + KSParticleQueue& aSecondaries + ) const; + + //*********** + //composition + //*********** + + public: + void SetTime( const double& aTime ); + void SetAngle( const double& anAngle ); + void SetIsAdiabatic( const bool& anIsAdiabatic ); + + private: + mutable bool fDone; + double fTime; + double fAngle; + bool fIsAdiabatic; + + //************** + //initialization + //************** + + // protected: + // virtual void PushUpdateComponent(); + // virtual void PushDeupdateComponent(); + }; + +} + +#endif diff --git a/Kassiopeia/Interactions/Include/KSIntSurfaceUCN.h b/Kassiopeia/Interactions/Include/KSIntSurfaceUCN.h index ba56fdb3c..f42536f86 100644 --- a/Kassiopeia/Interactions/Include/KSIntSurfaceUCN.h +++ b/Kassiopeia/Interactions/Include/KSIntSurfaceUCN.h @@ -4,6 +4,8 @@ #include "KSSurfaceInteraction.h" #include "KField.h" +#include "KMathBracketingSolver.h" +using katrin::KMathBracketingSolver; namespace Kassiopeia { @@ -25,8 +27,18 @@ namespace Kassiopeia void ExecuteTransmission( const KSParticle& anInitialParticle, KSParticle& aFinalParticle, KSParticleQueue& aSecondaries ); public: - K_SET_GET( double, Probability ) // transmission probability - K_SET_GET( double, SpinFlipProbability) + K_SET_GET( double, Eta ) // eta value (related to reflection probability) + K_SET_GET( double, Alpha) // alpha value (probability of spin sign flipping, so 1/2 of spin flip probability) + K_SET_GET( double, RealOpticalPotential ) + K_SET_GET( double, CorrelationLength ) // of the roughness + + private: + double fTanThetaIn; + double fExpThetaCoef; + + protected: + double ValueFunction( const double& aValue ) const; + KMathBracketingSolver fSolver; }; diff --git a/Kassiopeia/Interactions/Source/KSIntCalculatorArgon.cxx b/Kassiopeia/Interactions/Source/KSIntCalculatorArgon.cxx index 215382168..b32801512 100644 --- a/Kassiopeia/Interactions/Source/KSIntCalculatorArgon.cxx +++ b/Kassiopeia/Interactions/Source/KSIntCalculatorArgon.cxx @@ -936,7 +936,7 @@ bool KSIntCalculatorArgonTotalCrossSectionReader::Read() fData->clear(); int pos; - double value, secondValue; + double value, secondValue=0; bool secondValueReaded = false; char c; while( (*fStream) >> c ) diff --git a/Kassiopeia/Interactions/Source/KSIntCalculatorIon.cxx b/Kassiopeia/Interactions/Source/KSIntCalculatorIon.cxx index 2f4faf274..e16f5716e 100644 --- a/Kassiopeia/Interactions/Source/KSIntCalculatorIon.cxx +++ b/Kassiopeia/Interactions/Source/KSIntCalculatorIon.cxx @@ -10,13 +10,6 @@ using katrin::KConst; namespace Kassiopeia { - //Cross section data for hydrogen ions + H2 --> electron, taken from: - //TATSUO TABATA, TOSHIZO SHIRAI - //ANALYTIC CROSS SECTIONS FOR COLLISIONS OF H+, H2+, H3+, H, H2, AND H− WITH HYDROGEN MOLECULES - //Atomic Data and Nuclear Data Tables, Volume 76, Issue 1, 2000, Pages 1-25, ISSN 0092-640X - //http://dx.doi.org/10.1006/adnd.2000.0835 - //(http://www.sciencedirect.com/science/article/pii/S0092640X00908350) - KSIntCalculatorIon::KSIntCalculatorIon() : fGas( "H_2" ), E_Binding( KConst::BindingEnergy_H2() ) @@ -36,6 +29,9 @@ namespace Kassiopeia { } + // + // Total cross sections for ionization + // void KSIntCalculatorIon::CalculateCrossSection( const KSParticle& aParticle, double& aCrossSection ) { int aParticleID = aParticle.GetPID(); @@ -61,11 +57,6 @@ namespace Kassiopeia aCrossSection = H3plus_H2_crossSection(aEnergy); } - //H-,D-,T- - else if (aParticleID==99021||aParticleID==99051||aParticleID==99081) { - aCrossSection = Hminus_H2_crossSection(aEnergy); - } - else { aCrossSection = 0.; return; @@ -73,6 +64,17 @@ namespace Kassiopeia } + //Ionization of H2O + else if (fGas.compare("H2O") == 0) { + + E_Binding = KConst::BindingEnergy_H2O(); + + //H+ + if (aParticleID == 2212) { + aCrossSection = KSIntCalculatorIon::Hplus_H2O_crossSection(aEnergy); + } + } + //else if (fGas.compare("He") == 0) { //E_Binding = KConst::BindingEnergy_He; @@ -89,6 +91,165 @@ namespace Kassiopeia return; } + // + //Total ionization cross sections + // + //TATSUO TABATA, TOSHIZO SHIRAI + //ANALYTIC CROSS SECTIONS FOR COLLISIONS OF H+, H2+, H3+, H, H2, AND H− WITH HYDROGEN MOLECULES + //Atomic Data and Nuclear Data Tables, Volume 76, Issue 1, 2000, Pages 1-25, ISSN 0092-640X + //http://dx.doi.org/10.1006/adnd.2000.0835 + + // H^+ + H_2 -> e^- + //analytic expression #9 in TABATA SHIRAI (page 8-9) + double KSIntCalculatorIon::Hplus_H2_crossSection(double aEnergy) { + const double E_threshold = 2.0e-2; //keV + const double a1 = 1.864e-4; + const double a2 = 1.216; + const double a3 = 5.31e1; + const double a4 = 8.97e-1; + //const double E_min = 7.50e-2; + const double E_max = 1.00e+2; + double E1 = E_1(aEnergy,E_threshold); + double value = 0; + if( (aEnergy > E_threshold)&&(aEnergy < E_max)) { + value = sigma1(E1,a1,a2,a3,a4); + } + return value; + } + + // H_2^+ + H_2 -> e^- + //analytic expression #17 in TABATA SHIRAI (page 8-9) + double KSIntCalculatorIon::H2plus_H2_crossSection(double aEnergy) { + const double E_threshold = 3.0e-2; + const double a1 = 1.086e-3; + const double a2 = 1.153; + const double a3 = 1.24e+1; + const double a4 = -4.44e-1; + const double a5 = 5.96e+1; + const double a6 = 1.0; + //const double E_min = 3.16e-2; + const double E_max = 1.00e+2; + double E1 = E_1(aEnergy,E_threshold); + double value = 0; + if( (aEnergy > E_threshold)&&(aEnergy < E_max)) { + value = sigma6(E1,a1,a2,a3,a4,a5,a6); + } + return value; + } + + // H_3^+ + H_2 -> e^- + //analytic expression #24 in TABATA SHIRAI (page 8-9) + double KSIntCalculatorIon::H3plus_H2_crossSection(double aEnergy) { + const double E_threshold = 3.6e-2; + const double a1 = 2.63e-3; + const double a2 = 9.31e-1; + const double a3 = 4.05e-1; + const double a4 = 1.0; + const double a5 = 1.26e+2; + const double a6 = 2.13e+2; + //const double E_min = 7.50e-2; + const double E_max = 1.00e+2; + double E1 = E_1(aEnergy,E_threshold); + double value = 0; + if( (aEnergy > E_threshold)&&(aEnergy < E_max)) { + value = sigma2(E1,a1,a2,a3,a4,a5,a6); + } + return value; + } + + // + //Functions used in total cross sections from TABATA SHIRAI (page 3) + // + double KSIntCalculatorIon::f1(double x,double c1,double c2) { + double ERyd_keV = KConst::ERyd_eV()/1000; + double sigma0 = 1e-20; //m^2 + double value = sigma0*c1*pow((x/ERyd_keV),c2); + return value; + } + + double KSIntCalculatorIon::f2(double x,double c1,double c2,double c3,double c4) { + double value = f1(x,c1,c2)/(1+pow((x/c3),c2+c4)); + return value; + } + + double KSIntCalculatorIon::f3(double x,double c1,double c2,double c3,double c4,double c5,double c6) { + double value = f1(x,c1,c2)/(1+pow((x/c3),c2+c4)+pow((x/c5),c2+c6)); + return value; + } + + double KSIntCalculatorIon::sigma1(double E1,double a1,double a2,double a3,double a4) { + double value = f2(E1,a1,a2,a3,a4); + return value; + } + + double KSIntCalculatorIon::sigma2(double E1,double a1,double a2,double a3,double a4,double a5,double a6) { + double value = f2(E1,a1,a2,a3,a4)+a5*f2(E1/a6,a1,a2,a3,a4); + return value; + } + + double KSIntCalculatorIon::sigma6(double E1,double a1,double a2,double a3,double a4,double a5,double a6) { + double value = f3(E1,a1,a2,a3,a4,a5,a6); + return value; + } + + double KSIntCalculatorIon::sigma10(double E1,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8) { + double value = f3(E1,a1,a2,a3,a4,a5,a6)+a7*f3(E1/a8,a1,a2,a3,a4,a5,a6); + return value; + } + + //E is given in keV + double KSIntCalculatorIon::E_1(double E,double E_threshold) { + double value = E-E_threshold; + return value; + } + + // + // Total ionization cross section for H+ on H2O + // + //Taken from M. E. Rudd, T. V. Goffe, R. D. DuBois, and L. H. Toburen, + //Cross sections for ionization of water vapor by 7–4000-keV protons + //Phys. Rev. A 31, 492 – Published 1 January 1985 + //https://doi.org/10.1103/PhysRevA.31.492 + // + double KSIntCalculatorIon::Hplus_H2O_crossSection(double aEnergy) { + const double A = 2.98; + const double B = 4.42; + const double C = 1.48; + const double D = 0.75; + const double E_min = 100e-3; //From Geant4, see https://doi.org/10.1118/1.3476457 + const double E_max = 5000; + double value = 0; + if ((aEnergy > E_min) && (aEnergy < E_max)) { + value = sigmatot(aEnergy, A, B, C, D); + } + return value; + } + // + //Functions used in total cross sections for H2O from Rudd, 1985 + // + double KSIntCalculatorIon::sigmatot(double aEnergy, double A, double B, double C, + double D) { + double T = aEnergy/1836; + double R = KConst::ERyd_eV()/1000; //put in keV + double x = T/R; + double value = 1/(1/(sigmalow(x, C, D))+1/(sigmahigh(x, A, B))); + return value; + } + double KSIntCalculatorIon::sigmalow(double x, double C, double D) { + double value = 4 * KConst::Pi() * KConst::BohrRadiusSquared() * (C * pow(x, D)); + return value; + } + + double KSIntCalculatorIon::sigmahigh(double x, double A, double B) { + double value = 4 * KConst::Pi() * KConst::BohrRadiusSquared() * (A * log(1+x) + B)/x; + return value; + } + + + // + // Kinematics of the ionization + // + void KSIntCalculatorIon::ExecuteInteraction( const KSParticle& anIncomingIon, KSParticle& anOutgoingIon, KSParticleQueue& aSecondaries) { // incoming primary ion @@ -102,17 +263,36 @@ namespace Kassiopeia KSParticle* tSecondaryElectron = KSParticleFactory::GetInstance().StringCreate( "e-" ); //Set position (same as initial particle) tSecondaryElectron->SetPosition( tIncomingIonPosition ); + //Set momentum (same as initial particle) + tSecondaryElectron->SetMomentum( tIncomingIonMomentum ); //Set energy - double tSecondaryElectronEnergy; + double tSecondaryElectronEnergy = 0; CalculateSecondaryElectronEnergy(tIncomingIonMass,tIncomingIonEnergy,tSecondaryElectronEnergy); tSecondaryElectron->SetKineticEnergy_eV( tSecondaryElectronEnergy ); //Set angle (isotropic). Should be improved with distribution from the literature - double tTheta = acos( KRandom::GetInstance().Uniform( -1., 1. ) )*180/KConst::Pi(); - double tPhi = KRandom::GetInstance().Uniform( 0., 2. * KConst::Pi() )*180/KConst::Pi(); - tSecondaryElectron->SetPolarAngleToZ( tTheta ); - tSecondaryElectron->SetAzimuthalAngleToX( tPhi ); + //double tTheta = acos( KRandom::GetInstance().Uniform( -1., 1. ) )*180/KConst::Pi(); + //double tPhi = KRandom::GetInstance().Uniform( 0., 2. * KConst::Pi() )*180/KConst::Pi(); + //tSecondaryElectron->SetPolarAngleToZ( tTheta ); + //tSecondaryElectron->SetAzimuthalAngleToX( tPhi ); + //Set angle of secondary electron used differential cross section + double tPhi = KRandom::GetInstance().Uniform( 0., 2. * KConst::Pi() ); //radians + double tTheta = 0; + CalculateSecondaryElectronAngle(tTheta); //use diff. cross section + tTheta = tTheta*KConst::Pi()/180; //convert to radians + KThreeVector tSecondaryMomentum = tSecondaryElectron->GetMomentum(); + + //Correctly apply the angle in the incoming ion reference frame (code copied from KSIntCalculatorHydrogen.cxx) + KThreeVector tOrthogonalOne = tIncomingIonMomentum.Orthogonal(); + KThreeVector tOrthogonalTwo = tIncomingIonMomentum.Cross( tOrthogonalOne ); + tSecondaryMomentum = tSecondaryMomentum.Magnitude() * + ( sin( tTheta ) * (cos( tPhi ) * tOrthogonalOne.Unit() + sin( tPhi ) * tOrthogonalTwo.Unit()) + + cos( tTheta ) * tIncomingIonMomentum.Unit() + ); + tSecondaryElectron->SetMomentum( tSecondaryMomentum ); + + tSecondaryElectron->SetLabel( GetName() ); aSecondaries.push_back( tSecondaryElectron ); @@ -140,6 +320,9 @@ namespace Kassiopeia return; } + // + // Calculate the secondary (ionization) electron energy + // void KSIntCalculatorIon::CalculateSecondaryElectronEnergy( const double anIncomingIonMass, const double anIncomingIonEnergy,double& aSecondaryElectronEnergy) { double tSecondaryElectronEnergy; @@ -189,6 +372,7 @@ namespace Kassiopeia 2*( (sigma_max-sigma_min)*tSecondaryElectronEnergy/(anIncomingIonEnergy-I)+sigma_min), false,true );*/ + //If the random diff. cross section is less than the actual diff. cross section (i.e. it lies within the distribution), use the electron energy if ( tRandom < tCrossSection ) break; @@ -197,123 +381,100 @@ namespace Kassiopeia aSecondaryElectronEnergy = tSecondaryElectronEnergy; } - //Taken from - //M. E. Rudd, Differential cross sections for secondary electron production by proton impact, Phys. Rev. A 38, 6129, 1 December 1988 + // + //Differential cross section for secondary electron energy + // void KSIntCalculatorIon::CalculateEnergyDifferentialCrossSection( const double anIncomingIonMass, const double anIncomingIonEnergy, const double aSecondaryElectronEnergy, double &aCrossSection ) - { - //Assume ionization of H_2 - double A_1 = 0.80; - double B_1 = 2.9; - double C_1 = 0.86; - double D_1 = 1.48; - double E_1 = 7.0; - double A_2 = 1.06; - double B_2 = 4.2; - double C_2 = 1.39; - double D_2 = 0.48; - double alpha = 0.87; - double N = 2; //number of electrons in atomic subshell of target - double I = KConst::BindingEnergy_H2(); //Binding energy of target atom - - //Ionization of He - //if (fGas.compare("He") == 0) { - // Put in numbers from Rudd - //} - - double S = 4*KConst::Pi()*KConst::BohrRadiusSquared()*N*pow(KConst::ERyd_eV()/I,2); + { + // + // Ionization of H_2 and H2O by H^+ + // H^+ on H_2 data was applied to other hydrogen ions as well + // + //Taken from + //M. E. Rudd et al., Electron production in proton collisions with atoms and molecules: energy distributions, Rev. Mod. Phys. 64, 441, Published 1 April 1992 + //https://doi.org/10.1103/RevModPhys.64.441 + //See also M. E. Rudd, Differential cross sections for secondary electron production by proton impact, Phys. Rev. A 38, 6129, 1 December 1988 + //https://doi.org/10.1103/PhysRevA.38.6129 + // - double lambda = anIncomingIonMass/KConst::M_el_eV(); //ratio of incoming projectile mass and electron mass - double T = anIncomingIonEnergy/lambda; - double v = sqrt(T/I); //reduced initial velocity - double w = aSecondaryElectronEnergy / I; - aCrossSection = (S/I) * ( F_1(v,A_1,B_1,C_1,D_1,E_1) + F_2(v,A_2,B_2,C_2,D_2)*w ) * pow(1+w,-3) * pow(1+exp(alpha*(w-w_c(v,I))/v),-1); - } - - //Cross sections from TABATA SHIRAI (page 8-9) - double KSIntCalculatorIon::Hplus_H2_crossSection(double aEnergy) { - //analytic expression #9 in TABATA SHIRAI (page 8-9) - const double E_threshold = 2.0e-2; //keV - const double a1 = 1.864e-4; - const double a2 = 1.216; - const double a3 = 5.31e1; - const double a4 = 8.97e-1; - const double E_min = 7.50e-2; - const double E_max = 1.00e+2; - double E1 = E_1(aEnergy,E_threshold); - double value = 0; - if( (aEnergy > E_min)&&(aEnergy < E_max)) { - value = sigma1(E1,a1,a2,a3,a4); - } - return value; - } - - double KSIntCalculatorIon::H2plus_H2_crossSection(double aEnergy) { - //analytic expression #17 in TABATA SHIRAI (page 8-9) - const double E_threshold = 3.0e-2; - const double a1 = 1.086e-3; - const double a2 = 1.153; - const double a3 = 1.24e+1; - const double a4 = -4.44e-1; - const double a5 = 5.96e+1; - const double a6 = 1.0; - const double E_min = 3.16e-2; - const double E_max = 1.00e+2; - double E1 = E_1(aEnergy,E_threshold); - double value = 0; - if( (aEnergy > E_min)&&(aEnergy < E_max)) { - value = sigma6(E1,a1,a2,a3,a4,a5,a6); - } - return value; - } - - double KSIntCalculatorIon::H3plus_H2_crossSection(double aEnergy) { - //analytic expression #24 in TABATA SHIRAI (page 8-9) - const double E_threshold = 3.6e-2; - const double a1 = 2.63e-3; - const double a2 = 9.31e-1; - const double a3 = 4.05e-1; - const double a4 = 1.0; - const double a5 = 1.26e+2; - const double a6 = 2.13e+2; - const double E_min = 7.50e-2; - const double E_max = 1.00e+2; - double E1 = E_1(aEnergy,E_threshold); - double value = 0; - if( (aEnergy > E_min)&&(aEnergy < E_max)) { - value = sigma2(E1,a1,a2,a3,a4,a5,a6); + aCrossSection = 0; + + //for H2 + vector> shell_list = {{15.43,2}}; //list of I and N from Table 1a in Rudd 1992 + + //for H2O + if (fGas.compare("H2O") == 0) { + shell_list = {{12.61,2},{14.73,2},{18.55,2},{32.2,2},{539.7,2}}; //list of I and N from Table 1b in Rudd 1992 } - return value; - } - - double KSIntCalculatorIon::Hminus_H2_crossSection(double aEnergy) { - //analytic expression #47 in TABATA SHIRAI (page 8-9) - const double E_threshold = 2.25e-3; - const double a1 = 4.19e-2; - const double a2 = 1.89; - const double a3 = 1.78e-1; - const double a4 = -2.3e-1; - const double a5 = 1.04; - const double a6 = 8.7e-1; - const double a7 = 1.65e+1; - const double a8 = 1.088; - const double a9 = 5.33e-3; - const double a10 = 1.66e-1; - const double E_min = 2.37e-3; - const double E_max = 5.00e+1; - double E1 = E_1(aEnergy,E_threshold); - double value = 0; - if( (aEnergy > E_min)&&(aEnergy < E_max)) { - value = sigma11(E1,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); + + //iterate over shells + for (int s=0; s<(int)shell_list.size(); s++) { + + //for H2 + double A_1 = 0.96; + double B_1 = 2.6; + double C_1 = 0.38; + double D_1 = 0.23; + double E_1 = 2.2; + double A_2 = 1.04; + double B_2 = 5.9; + double C_2 = 1.15; + double D_2 = 0.20; + double alpha = 0.87; + + //for H2O + if (fGas.compare("H2O") == 0) { + if (s<3) { //for outer shells (I < 2 * 12.61) + A_1 = 0.97; + B_1 = 82.0; + C_1 = 0.40; + D_1 = -0.30; + E_1 = 0.38; + A_2 = 1.04; + B_2 = 17.3; + C_2 = 0.76; + D_2 = 0.04; + alpha = 0.64; + } else { //for inner shells (I > 2 * 12.61) + A_1 = 1.25; + B_1 = 0.50; + C_1 = 1.00; + D_1 = 1.00; + E_1 = 3.0; + A_2 = 1.10; + B_2 = 1.30; + C_2 = 1.00; + D_2 = 0.0; + alpha = 0.66; + } + } + double I = shell_list[s][0]; //Binding energy of target atom + double N = shell_list[s][1]; //Occupation number of electrons in atomic subshell of target + double S = 4*KConst::Pi()*KConst::BohrRadiusSquared()*N*pow(KConst::ERyd_eV()/I,2); + double lambda = anIncomingIonMass/KConst::M_el_kg(); //ratio of incoming projectile mass and electron mass + double T = anIncomingIonEnergy/lambda; + double v = sqrt(T/I); //reduced initial velocity + double w = aSecondaryElectronEnergy / I; + aCrossSection += (S/I) * ( F_1(v,A_1,B_1,C_1,D_1,E_1) + F_2(v,A_2,B_2,C_2,D_2)*w ) * pow(1+w,-3) * pow(1+exp(alpha*(w-w_c(v,I))/v),-1); } - return value; + + // For comparing with plots in Rudd 1992 paper + //double lambda = anIncomingIonMass/KConst::M_el_kg(); //ratio of incoming projectile mass and electron mass + //double T = anIncomingIonEnergy/lambda; + //double I_1 = shell_list[0][0]; + //double E = aSecondaryElectronEnergy + I_1; + //double Y = T/(4*KConst::Pi()*KConst::BohrRadiusSquared()) * pow(E/KConst::ERyd_eV(),2) * aCrossSection; + //aCrossSection = Y; + } - - //Functions used in differential cross sections from Rudd + // + //Functions used in Rudd 1988, Rudd 1992 + // double KSIntCalculatorIon::F_1(double v,double A_1,double B_1,double C_1,double D_1,double E_1) { double value = L_1(v,C_1,D_1,E_1)+H_1(v,A_1,B_1); return value; @@ -343,55 +504,102 @@ namespace Kassiopeia double value = 4*pow(v,2)-2*v-w_2; return value; } - - //Functions used in cross sections from TABATA SHIRAI (page 3) - double KSIntCalculatorIon::f1(double x,double c1,double c2) { - double ERyd_keV = KConst::ERyd_eV()/1000; - double sigma0 = 1e-20; //m^2 - double value = sigma0*c1*pow((x/ERyd_keV),c2); - return value; - } - double KSIntCalculatorIon::f2(double x,double c1,double c2,double c3,double c4) { - double value = f1(x,c1,c2)/(1+pow((x/c3),c2+c4)); - return value; - } - - double KSIntCalculatorIon::f3(double x,double c1,double c2,double c3,double c4,double c5,double c6) { - double value = f1(x,c1,c2)/(1+pow((x/c3),c2+c4)+pow((x/c5),c2+c6)); - return value; - } - - double KSIntCalculatorIon::sigma1(double E1,double a1,double a2,double a3,double a4) { - double value = f2(E1,a1,a2,a3,a4); - return value; - } - - double KSIntCalculatorIon::sigma2(double E1,double a1,double a2,double a3,double a4,double a5,double a6) { - double value = f2(E1,a1,a2,a3,a4)+a5*f2(E1/a6,a1,a2,a3,a4); - return value; - } - - double KSIntCalculatorIon::sigma6(double E1,double a1,double a2,double a3,double a4,double a5,double a6) { - double value = f3(E1,a1,a2,a3,a4,a5,a6); - return value; - } + // + // Calculate the secondary (ionization) electron angle + // + void KSIntCalculatorIon::CalculateSecondaryElectronAngle(double& aSecondaryElectronAngle) + { + double tSecondaryElectronAngle; + double tCrossSection = 0; + + //Diff. cross section for maximum possible secondary electron angle + double aSecondaryElectronMaxAngle = 180; + double sigma_max; + CalculateAngleDifferentialCrossSection( aSecondaryElectronMaxAngle, + sigma_max + ); + + //Diff. cross section for minimum possible secondary electron energy + double aSecondaryElectronMinAngle = 0; + double sigma_min; + CalculateAngleDifferentialCrossSection( aSecondaryElectronMinAngle, + sigma_min + ); + + //Rejection sampling + while ( true ) + { + //Randomly select a possible electron angle + tSecondaryElectronAngle = KRandom::GetInstance().Uniform( aSecondaryElectronMinAngle, + aSecondaryElectronMaxAngle, + false, true + ); + //Get the diff. cross section for this electron angle + CalculateAngleDifferentialCrossSection( tSecondaryElectronAngle, + tCrossSection + ); + //Randomly select a diff. cross section + double tRandom = KRandom::GetInstance().Uniform( 0., + sigma_min, + false,true + ); + + //If the random diff. cross section is less than the actual diff. cross section (i.e. it lies within the distribution), use the electron angle + if ( tRandom < tCrossSection ) + break; + } + + aSecondaryElectronAngle = tSecondaryElectronAngle; + } + + + // + //Differential cross section for secondary electron angle + // + void KSIntCalculatorIon::CalculateAngleDifferentialCrossSection(const double aSecondaryElectronAngle, + double &aCrossSection + ) + { + aCrossSection = 0; + + // + //for H^+ on H2 + // + //Fit from 20-keV datapoints from M. W. Gealy, G. W. Kerby, III, Y.-Y. Hsu, and M. E. Rudd + //Energy and angular distributions of electrons from ion impact on atomic and molecular hydrogen. I. 20–114-keV H+ + H2 + //Phys. Rev. A 51, 2247 – Published 1 March 1995 + //https://doi.org/10.1103/PhysRevA.51.2247 + + double p0 = 1.64084e-22; + double p1 = 2.92559e-20; + double p2 = 3.88393e+09; + double p3 = 0.747347; + double p4 = 2.80982e+06; + + aCrossSection = p0+(p1-p0)/pow(1+pow(aSecondaryElectronAngle/p2,p3),p4); //units of m^2 + + //for H2O + if (fGas.compare("H2O") == 0) { + + // + //for H^+ on H2O + // + //Fit from 15-keV ion, 10 eV electron datapoints from M. A. Bolorizadeh and M. E. Rudd + //Angular and energy dependence of cross sections for ejection of electrons from water vapor. II. 15–150-keV proton impact + //Phys. Rev. A 33, 888 – Published 1 February 1986 + //https://doi.org/10.1103/PhysRevA.33.888 + + double p0 = 8.17015e-23; + double p1 = 5.81827e-22; + double p2 = 359.014; + double p3 = 2.14706; + double p4 = 166.909; + + aCrossSection = p0+(p1-p0)/pow(1+pow(aSecondaryElectronAngle/p2,p3),p4); //units of m^2 - double KSIntCalculatorIon::sigma10(double E1,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8) { - double value = f3(E1,a1,a2,a3,a4,a5,a6)+a7*f3(E1/a8,a1,a2,a3,a4,a5,a6); - return value; - } - - double KSIntCalculatorIon::sigma11(double E1,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10) { - double value = f3(E1,a1,a2,a3,a4,a5,a6)+f2(E1,a7,a8,a9,a10); - return value; - } + } - //E is given in keV - double KSIntCalculatorIon::E_1(double E,double E_threshold) { - double value = E-E_threshold; - return value; - } - + } } diff --git a/Kassiopeia/Interactions/Source/KSIntCalculatorTritium.cxx b/Kassiopeia/Interactions/Source/KSIntCalculatorTritium.cxx index d907783f8..e72c93282 100644 --- a/Kassiopeia/Interactions/Source/KSIntCalculatorTritium.cxx +++ b/Kassiopeia/Interactions/Source/KSIntCalculatorTritium.cxx @@ -6,8 +6,8 @@ */ #include "KSIntCalculatorTritium.h" -#include -#include +#include "KRandom.h" +#include "KThreeVector.hh" using namespace std; using namespace katrin; diff --git a/Kassiopeia/Interactions/Source/KSIntSpinFlip.cxx b/Kassiopeia/Interactions/Source/KSIntSpinFlip.cxx index ddb6ead23..132d62261 100644 --- a/Kassiopeia/Interactions/Source/KSIntSpinFlip.cxx +++ b/Kassiopeia/Interactions/Source/KSIntSpinFlip.cxx @@ -15,26 +15,18 @@ namespace Kassiopeia KSIntSpinFlip::KSIntSpinFlip() { - //std::cout << "BUILT\n"; } KSIntSpinFlip::KSIntSpinFlip( const KSIntSpinFlip& aCopy ) : KSComponent(), KSComponentTemplate< KSIntSpinFlip, KSSpaceInteraction >( aCopy ) { - //std::cout << "BUILT\n"; } KSIntSpinFlip* KSIntSpinFlip::Clone() const { - //std::cout << "BUILT\n"; return new KSIntSpinFlip( *this ); } KSIntSpinFlip::~KSIntSpinFlip() { -// for( unsigned int tIndex = 0; tIndex < fCalculators.size(); tIndex++ ) -// { -// delete (fCalculators.at( tIndex )); -// } -// fCalculators.clear(); } void KSIntSpinFlip::CalculateTransitionRate( const KSParticle& aParticle, double& aTransitionRate ) @@ -48,10 +40,6 @@ namespace Kassiopeia * sin( KConst::Pi() * ( 1 - aParticle.GetAlignedSpin() ) ) * sin( KConst::Pi() * ( 1 - aParticle.GetAlignedSpin() ) ); aTransitionRate = std::fabs( CycleFlipProbability * aParticle.GetGyromagneticRatio() * aParticle.GetMagneticField().Magnitude() / 2 / KConst::Pi() ); - - //std::cout << "GradBMagnitude: " << GradBMagnitude << "\tGradBDirection: " << GradBDirection << "\nBDiretionDot: " << BDirectionDot << "\tCycleFlipProbability: " << CycleFlipProbability << "\n"; - //std::cout << "TransitionRate: " << aTransitionRate << "\n"; - //std::cout << "CALC RATE\n"; } void KSIntSpinFlip::CalculateInteraction( @@ -70,11 +58,9 @@ namespace Kassiopeia CalculateTransitionRate( aTrajectoryInitialParticle, TransitionRate ); double tProbability = KRandom::GetInstance().Uniform( 0., 1. ); double FlipTime = -1. * log( 1. - tProbability ) / TransitionRate; - //std::cout << "Flip Time: " << FlipTime << "\tTrajectoryTimeStep: " << aTrajectoryTimeStep << "\n"; if ( std::isnan( FlipTime ) ) { FlipTime = numeric_limits< double >::max(); - //std::cout << "nan\n"; } if( FlipTime > aTrajectoryTimeStep ) @@ -82,7 +68,6 @@ namespace Kassiopeia anInteractionParticle = aTrajectoryFinalParticle; aTimeStep = aTrajectoryTimeStep; aFlag = false; - //std::cout << "shouldn't flip\tTimeStep: " << aTimeStep << "\n"; } else { @@ -90,10 +75,7 @@ namespace Kassiopeia aTrajectory.ExecuteTrajectory( FlipTime, anInteractionParticle ); aTimeStep = FlipTime; aFlag = true; - //std::cout << "should flip\tTimeStep: " << aTimeStep << "\n"; } - - //std::cout << "CALC INT\n"; } void KSIntSpinFlip::ExecuteInteraction( const KSParticle& anInteractionParticle, KSParticle& aFinalParticle, KSParticleQueue& /*aSecondaries*/ ) const @@ -101,9 +83,6 @@ namespace Kassiopeia aFinalParticle = anInteractionParticle; aFinalParticle.SetAlignedSpin( -1 * aFinalParticle.GetAlignedSpin() ); aFinalParticle.SetSpinAngle( aFinalParticle.GetSpinAngle() + KConst::Pi() ); - - //std::cout << "Time: " << aFinalParticle.GetTime() << "\tPosition: " << aFinalParticle.GetPosition() << "\n"; - //std::cout << "FLIP\n"; } } diff --git a/Kassiopeia/Interactions/Source/KSIntSpinFlipPulse.cxx b/Kassiopeia/Interactions/Source/KSIntSpinFlipPulse.cxx new file mode 100644 index 000000000..d7776bb82 --- /dev/null +++ b/Kassiopeia/Interactions/Source/KSIntSpinFlipPulse.cxx @@ -0,0 +1,91 @@ +#include "KSIntSpinFlipPulse.h" +#include "KSInteractionsMessage.h" + +#include "KRandom.h" +using katrin::KRandom; + +namespace Kassiopeia +{ + + KSIntSpinFlipPulse::KSIntSpinFlipPulse() : + fDone( false ), + fTime( 0. ) + { + } + + KSIntSpinFlipPulse::KSIntSpinFlipPulse( const KSIntSpinFlipPulse& aCopy ) : + KSComponent(), + KSComponentTemplate< KSIntSpinFlipPulse, KSSpaceInteraction >( aCopy ), + fDone( aCopy.fDone ), + fTime ( aCopy.fTime ) + { + } + + KSIntSpinFlipPulse* KSIntSpinFlipPulse::Clone() const + { + return new KSIntSpinFlipPulse( *this ); + } + + KSIntSpinFlipPulse::~KSIntSpinFlipPulse() + { + } + + + void KSIntSpinFlipPulse::CalculateInteraction( + const KSTrajectory& /*aTrajectory*/, + const KSParticle& /*aTrajectoryInitialParticle*/, + const KSParticle& aTrajectoryFinalParticle, + const KThreeVector& /*aTrajectoryCenter*/, + const double& /*aTrajectoryRadius*/, + const double& /*aTrajectoryTimeStep*/, + KSParticle& anInteractionParticle, + double& /*aTimeStep*/, + bool& aFlag + ) + { + anInteractionParticle = aTrajectoryFinalParticle; + + // For some reason ths stops the interaction from working, and removing + // it doesn't seem to break anything. + // aTimeStep = aTrajectoryTimeStep; + + if ( aTrajectoryFinalParticle.GetTime() < fTime ) + { + aFlag = false; + fDone = false; + } + else if ( fDone ) + { + aFlag = false; + } + else + { + aFlag = true; + // fDone = true; Due to double precision errors in the time, this should occur on execution instead + } + + return; + } + + void KSIntSpinFlipPulse::ExecuteInteraction( const KSParticle& anInteractionParticle, + KSParticle& aFinalParticle, + KSParticleQueue& /*aSecondaries*/ ) const + { + + fDone = true; + + aFinalParticle = anInteractionParticle; + aFinalParticle.SetAlignedSpin( -1. * aFinalParticle.GetAlignedSpin() ); + aFinalParticle.SetSpinAngle( KConst::Pi() + aFinalParticle.GetSpinAngle() ); + aFinalParticle.RecalculateSpinGlobal(); + + return; + } + + void KSIntSpinFlipPulse::SetTime( const double& aTime ) + { + fTime = aTime; + return; + } + +} diff --git a/Kassiopeia/Interactions/Source/KSIntSpinRotateYPulse.cxx b/Kassiopeia/Interactions/Source/KSIntSpinRotateYPulse.cxx new file mode 100644 index 000000000..ada07f4fb --- /dev/null +++ b/Kassiopeia/Interactions/Source/KSIntSpinRotateYPulse.cxx @@ -0,0 +1,116 @@ +#include "KSIntSpinRotateYPulse.h" +#include "KSInteractionsMessage.h" + +#include "KRandom.h" +#include "KConst.h" +using katrin::KRandom; + +namespace Kassiopeia +{ + + KSIntSpinRotateYPulse::KSIntSpinRotateYPulse() : + fDone( false ), + fTime( 0. ), + fAngle( 0. ), + fIsAdiabatic( true ) // defaulting to true since I expect that to be the more common use case + { + } + + KSIntSpinRotateYPulse::KSIntSpinRotateYPulse( const KSIntSpinRotateYPulse& aCopy ) : + KSComponent(), + KSComponentTemplate< KSIntSpinRotateYPulse, KSSpaceInteraction >( aCopy ), + fDone( aCopy.fDone ), + fTime ( aCopy.fTime ), + fAngle ( aCopy.fAngle ), + fIsAdiabatic ( aCopy.fIsAdiabatic ) + { + } + + KSIntSpinRotateYPulse* KSIntSpinRotateYPulse::Clone() const + { + return new KSIntSpinRotateYPulse( *this ); + } + + KSIntSpinRotateYPulse::~KSIntSpinRotateYPulse() + { + } + + + void KSIntSpinRotateYPulse::CalculateInteraction( + const KSTrajectory& /*aTrajectory*/, + const KSParticle& aTrajectoryInitialParticle, + const KSParticle& aTrajectoryFinalParticle, + const KThreeVector& /*aTrajectoryCenter*/, + const double& /*aTrajectoryRadius*/, + const double& /*aTrajectoryTimeStep*/, + KSParticle& anInteractionParticle, + double& aTimeStep, + bool& aFlag + ) + { + anInteractionParticle = aTrajectoryFinalParticle; + + if ( aTrajectoryFinalParticle.GetTime() < fTime ) + { + aFlag = false; + fDone = false; + } + else if ( fDone ) + { + aFlag = false; + } + else + { + aFlag = true; + //fDone = true; //Due to double precision errors in the time, this should occur on execution instead + aTimeStep = 0.999 * ( fTime - aTrajectoryInitialParticle.GetTime() ); + } + + return; + } + + void KSIntSpinRotateYPulse::ExecuteInteraction( const KSParticle& anInteractionParticle, + KSParticle& aFinalParticle, + KSParticleQueue& /*aSecondaries*/ ) const + { + + aFinalParticle = anInteractionParticle; + + if (fDone){ // This is an awful hack, but is necessary for some reason + return; + } + fDone = true; + + if (fIsAdiabatic){ + aFinalParticle.RecalculateSpinGlobal(); + } + + double x = aFinalParticle.GetSpinX(); + double z = aFinalParticle.GetSpinZ(); + aFinalParticle.SetSpinX( x*cos( KConst::Pi() / 180 * fAngle ) + z*sin( KConst::Pi() / 180 * fAngle ) ); + aFinalParticle.SetSpinZ( z*cos( KConst::Pi() / 180 * fAngle ) - x*sin( KConst::Pi() / 180 * fAngle ) ); + + aFinalParticle.RecalculateSpinBody(); + + return; + } + + void KSIntSpinRotateYPulse::SetTime( const double& aTime ) + { + fTime = aTime; + return; + } + + void KSIntSpinRotateYPulse::SetAngle( const double& anAngle ) + { + fAngle = anAngle; + return; + } + + void KSIntSpinRotateYPulse::SetIsAdiabatic( const bool& anIsAdiabatic ) + { + fIsAdiabatic = anIsAdiabatic; + return; + } + +} diff --git a/Kassiopeia/Interactions/Source/KSIntSurfaceUCN.cxx b/Kassiopeia/Interactions/Source/KSIntSurfaceUCN.cxx index 23f61f8cf..1d0f2a438 100644 --- a/Kassiopeia/Interactions/Source/KSIntSurfaceUCN.cxx +++ b/Kassiopeia/Interactions/Source/KSIntSurfaceUCN.cxx @@ -5,18 +5,29 @@ #include "KRandom.h" using katrin::KRandom; +#include "KConst.h" +using katrin::KConst; + namespace Kassiopeia { KSIntSurfaceUCN::KSIntSurfaceUCN() : - fProbability( .0 ), - fSpinFlipProbability( 0. ) + fEta( 0. ), + fAlpha( 0. ), + fRealOpticalPotential( 0. ), + fCorrelationLength( 0. ), + fTanThetaIn( 0. ), + fExpThetaCoef( 0. ) { } KSIntSurfaceUCN::KSIntSurfaceUCN( const KSIntSurfaceUCN& aCopy ) : KSComponent(), - fProbability( aCopy.fProbability ), - fSpinFlipProbability( aCopy.fSpinFlipProbability ) + fEta( aCopy.fEta ), + fAlpha( aCopy.fAlpha ), + fRealOpticalPotential( aCopy.fRealOpticalPotential ), + fCorrelationLength( aCopy.fCorrelationLength ), + fTanThetaIn( aCopy.fTanThetaIn ), + fExpThetaCoef( aCopy.fExpThetaCoef ) { } KSIntSurfaceUCN* KSIntSurfaceUCN::Clone() const @@ -29,8 +40,30 @@ namespace Kassiopeia void KSIntSurfaceUCN::ExecuteInteraction( const KSParticle& anInitialParticle, KSParticle& aFinalParticle, KSParticleQueue& aQueue ) { + KThreeVector tNormal; + if( anInitialParticle.GetCurrentSurface() != NULL ) + { + tNormal = anInitialParticle.GetCurrentSurface()->Normal( anInitialParticle.GetPosition() ); + } + else if( anInitialParticle.GetCurrentSide() != NULL ) + { + tNormal = anInitialParticle.GetCurrentSide()->Normal( anInitialParticle.GetPosition() ); + } + else + { + intmsg( eError ) << "surface UCN interaction named <" << GetName() << "> was given a particle with neither a surface nor a side set" << eom; + return; + } + KThreeVector tInitialMomentum = anInitialParticle.GetMomentum(); + KThreeVector tInitialNormalMomentum = tInitialMomentum.Dot( tNormal ) * tNormal; + double Eperp = tInitialNormalMomentum * tInitialNormalMomentum / 2 / anInitialParticle.GetMass(); + + double pLoss = 2 * fEta * sqrt( Eperp / ( fRealOpticalPotential * KConst::Q() - Eperp ) ); + if( std::isnan(pLoss) ){ + pLoss = 1.; + } double tChoice = KRandom::GetInstance().Uniform( 0., 1. ); - if( tChoice < fProbability ) + if( tChoice < pLoss ) { ExecuteTransmission( anInitialParticle, aFinalParticle, aQueue ); } @@ -59,13 +92,15 @@ namespace Kassiopeia KThreeVector tInitialMomentum = anInitialParticle.GetMomentum(); KThreeVector tInitialNormalMomentum = tInitialMomentum.Dot( tNormal ) * tNormal; KThreeVector tInitialTangentMomentum = tInitialMomentum - tInitialNormalMomentum; + KThreeVector tInitialOrthogonalMomentum = tInitialTangentMomentum.Cross( + tInitialNormalMomentum.Unit()); - KThreeVector tSpin = aFinalParticle.GetSpin(); - double tAlignedSpin = aFinalParticle.GetAlignedSpin(); - double tSpinAngle = aFinalParticle.GetSpinAngle(); + KThreeVector tSpin = anInitialParticle.GetSpin(); + double tAlignedSpin = anInitialParticle.GetAlignedSpin(); + double tSpinAngle = anInitialParticle.GetSpinAngle(); double tChoice = KRandom::GetInstance().Uniform( 0., 1. ); - if( tChoice < 2*fSpinFlipProbability ) // there's a 50-50 chance of getting the old spin after measurement, hence the 2* + if( tChoice < 2*fAlpha ) // there's a 50-50 chance of getting the old spin after measurement, hence the 2* { bool done = false; while ( !done ){ @@ -82,8 +117,31 @@ namespace Kassiopeia } } + // calculate the new reflection direction + + double k = tInitialMomentum.Magnitude() / KConst::Hbar(); + double cosThetaIn = tInitialNormalMomentum.Magnitude() / tInitialMomentum.Magnitude(); + double sinThetaIn = tInitialTangentMomentum.Magnitude() / tInitialMomentum.Magnitude(); + fTanThetaIn = sinThetaIn / cosThetaIn; + double thetaIn = acos(cosThetaIn); + fExpThetaCoef = (fCorrelationLength * k) * (fCorrelationLength * k) * cosThetaIn * cosThetaIn / 2; + double expPhiCoef = (fCorrelationLength * k) * (fCorrelationLength * k) * sinThetaIn * sinThetaIn / 2; + + double phiOut = KRandom::GetInstance().Gauss( 0., sqrt(0.5/expPhiCoef) ); + + double deltaTheta = 0.; + double tValueMin = ValueFunction( -thetaIn ); + double tValueMax = ValueFunction( KConst::Pi()/2-thetaIn ); + double tValue = KRandom::GetInstance().Uniform( tValueMin, tValueMax ); + fSolver.Solve( KMathBracketingSolver::eBrent, this, &KSIntSurfaceUCN::ValueFunction, tValue, -thetaIn, KConst::Pi()/2-thetaIn, deltaTheta ); + double thetaOut = thetaIn + deltaTheta; + + KThreeVector tFinalMomentum = -tInitialMomentum.Magnitude()*tInitialNormalMomentum.Unit()*cos(thetaOut) + + tInitialMomentum.Magnitude()*tInitialTangentMomentum.Unit()*sin(thetaOut)*cos(phiOut) + + tInitialMomentum.Magnitude()*tInitialOrthogonalMomentum.Unit()*sin(thetaOut)*sin(phiOut); + aFinalParticle = anInitialParticle; - aFinalParticle.SetMomentum( tInitialTangentMomentum - tInitialNormalMomentum ); + aFinalParticle.SetMomentum(tFinalMomentum); // spin changes need to happen aftet SetMomentum to make Spin0 correct @@ -95,18 +153,13 @@ namespace Kassiopeia } void KSIntSurfaceUCN::ExecuteTransmission( const KSParticle& anInitialParticle, KSParticle& aFinalParticle, KSParticleQueue& ) { - - KThreeVector tSpin = aFinalParticle.GetSpin(); - double tAlignedSpin = aFinalParticle.GetAlignedSpin(); - double tSpinAngle = aFinalParticle.GetSpinAngle(); - aFinalParticle = anInitialParticle; - - aFinalParticle.SetInitialSpin( tSpin ); - aFinalParticle.SetAlignedSpin( tAlignedSpin ); - aFinalParticle.SetSpinAngle( tSpinAngle ); - return; } + double KSIntSurfaceUCN::ValueFunction( const double& aValue ) const + { + return fTanThetaIn*exp(-fExpThetaCoef*aValue*aValue)/2/sqrt(KConst::Pi()*fExpThetaCoef) + (1+erf(aValue*sqrt(fExpThetaCoef)))/2; + } + } diff --git a/Kassiopeia/Navigators/CMakeLists.txt b/Kassiopeia/Navigators/CMakeLists.txt index 7a5b46e57..d84b1f661 100644 --- a/Kassiopeia/Navigators/CMakeLists.txt +++ b/Kassiopeia/Navigators/CMakeLists.txt @@ -1,4 +1,4 @@ -set(KSNAV_CACHE_DIR "${@PROJECT_NAME@_CACHE_INSTALL_DIR}" CACHE STRING "Kassiopeia navigator cache directory") +set(KSNAV_CACHE_DIR "${${PROJECT_NAME}_CACHE_INSTALL_DIR}" CACHE STRING "Kassiopeia navigator cache directory") mark_as_advanced(FORCE KSNAV_CACHE_DIR) diff --git a/Kassiopeia/Operators/Include/KSParticle.h b/Kassiopeia/Operators/Include/KSParticle.h index 8965a3281..acab76015 100644 --- a/Kassiopeia/Operators/Include/KSParticle.h +++ b/Kassiopeia/Operators/Include/KSParticle.h @@ -470,6 +470,14 @@ namespace Kassiopeia mutable double fAlignedSpin; mutable double fSpinAngle; + //clock time (units are seconds) + + public: + const double& GetClockTime() const; + + protected: + mutable double fClockTime; + }; typedef std::deque< KSParticle* > KSParticleQueue; diff --git a/Kassiopeia/Operators/Source/KSParticle.cxx b/Kassiopeia/Operators/Source/KSParticle.cxx index 3d8784901..bd9c3fef9 100644 --- a/Kassiopeia/Operators/Source/KSParticle.cxx +++ b/Kassiopeia/Operators/Source/KSParticle.cxx @@ -2,9 +2,10 @@ #include "KSOperatorsMessage.h" #include "KSDictionary.h" -#include +#include "KConst.h" #include #include +#include using namespace std; using namespace katrin; @@ -503,7 +504,6 @@ namespace Kassiopeia void KSParticle::SetMagneticFieldCalculator( KSMagneticField* aMagFieldCalculator ) { fMagneticFieldCalculator = aMagFieldCalculator; - //RecalculateSpinBody(); return; } KSMagneticField* KSParticle::GetMagneticFieldCalculator() const @@ -1252,10 +1252,9 @@ namespace Kassiopeia void KSParticle::RecalculateSpinGlobal() const { - //std::cout << "RECALCULATING SPIN (global):\n\tInitial:\tm: " << fAlignedSpin << "\tphi: " << fSpinAngle << "\n"; - KThreeVector e3 = GetMagneticField() / GetMagneticField().Magnitude(); // = b - KThreeVector E1 ( e3.Z() - e3.Y(), e3.X() - e3.Z(), e3.Y() - e3.X() ); + // KThreeVector E1 ( e3.Z() - e3.Y(), e3.X() - e3.Z(), e3.Y() - e3.X() ); + KThreeVector E1 ( e3.Z() , 0. , -e3.X() ); KThreeVector e1 = E1 / E1.Magnitude(); KThreeVector e2 = e3.Cross( e1 ); @@ -1263,9 +1262,6 @@ namespace Kassiopeia fSpin0 = fVelocity.Dot( fSpin ) / KConst::C(); NormalizeSpin(); - - //std::cout << "\tFinal:\t\tspin0: " << fSpin0 << "\tspin: " << fSpin << "\n"; - } /////// @@ -1612,8 +1608,6 @@ namespace Kassiopeia { (this->*fGetMagneticFieldAction)(); - //RecalculateSpinBody(); - return fMagneticField; } @@ -1621,8 +1615,6 @@ namespace Kassiopeia { fMagneticField = aMagneticField; - //RecalculateSpinBody(); - oprmsg_debug( "KSParticle: [" << this << "] setting fMagneticField" << ret ); oprmsg_debug( "[" << fMagneticField[0] << ", " << fMagneticField[1] << ", " << fMagneticField[2] << "]" << eom ); @@ -1647,8 +1639,6 @@ namespace Kassiopeia fGetMagneticFieldAction = &KSParticle::DoNothing; } - //RecalculateSpinBody(); - return; } @@ -1698,8 +1688,6 @@ namespace Kassiopeia oprmsg_debug( "KSParticle: [" << this << "] setting fMagneticGradient" << eom ); oprmsg_debug( "[" << fMagneticGradient << "]" << eom ); - //RecalculateSpinBody(); - return; } @@ -2214,30 +2202,49 @@ namespace Kassiopeia void KSParticle::RecalculateSpinBody() const { - //std::cout << "RECALCULATING SPIN (body):\n\tInitial:\tspin0:\t" << fSpin0 << "\tspin: " << fSpin << "\n"; KThreeVector LocalZ = fMagneticField / fMagneticField.Magnitude(); - KThreeVector LocalX ( LocalZ.Z() - LocalZ.Y(), LocalZ.X() - LocalZ.Z(), LocalZ.Y() - LocalZ.X() ); + KThreeVector LocalX ( LocalZ.Z() , 0. , -LocalZ.X() ); LocalX = LocalX / LocalX.Magnitude(); fAlignedSpin = fSpin.Dot( LocalZ ) / fSpin.Magnitude(); if ( std::isnan( fAlignedSpin ) ) { fAlignedSpin = 1.; - //std::cout << "*fixed NaN m (in KSP); B: " << fMagneticField << "\n"; } if (fAlignedSpin < 0.99999 && fAlignedSpin > -0.99999 ) { - //std::cout << fSpin.Dot( LocalX ); fSpinAngle = acos( fSpin.Dot( LocalX ) / fSpin.Magnitude() / sqrt( 1 - fAlignedSpin * fAlignedSpin ) ); } else { - fSpinAngle = 0; + + KThreeVector LocalY = LocalZ.Cross( LocalX ); + if (fAlignedSpin < 0.99999 && fAlignedSpin > -0.99999 ) + { + if ( fSpin.Dot( LocalY ) > 0. ){ + fSpinAngle = acos( fSpin.Dot( LocalX ) / fSpin.Magnitude() / sqrt( 1 - GetAlignedSpin() * GetAlignedSpin() ) ); + } + else + { + fSpinAngle = 2*KConst::Pi() - acos( fSpin.Dot( LocalX ) / fSpin.Magnitude() / sqrt( 1 - GetAlignedSpin() * GetAlignedSpin() ) ); + } + } + else + { + fSpinAngle = 0; + } + } - //std::cout << "\tFinal:\t\tm: " << fAlignedSpin << "\tphi: " << fSpinAngle << "\n"; } + const double& KSParticle::GetClockTime() const + { + fClockTime = std::clock() / (double)CLOCKS_PER_SEC; + return fClockTime; + } + + STATICINT sKSParticleDict = KSDictionary< KSParticle >::AddComponent( &KSParticle::GetParentRunId, "parent_run_id" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetParentEventId, "parent_event_id" ) + @@ -2252,6 +2259,7 @@ namespace Kassiopeia KSDictionary< KSParticle >::AddComponent( &KSParticle::GetMainQuantumNumber, "n" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetSecondQuantumNumber, "l" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetTime, "time" ) + + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetClockTime, "clock_time" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetLength, "length" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetPosition, "position" ) + KSDictionary< KSParticle >::AddComponent( &KSParticle::GetMomentum, "momentum" ) + diff --git a/Kassiopeia/Python/CMakeLists.txt b/Kassiopeia/Python/CMakeLists.txt index b070497af..f7cc5e813 100644 --- a/Kassiopeia/Python/CMakeLists.txt +++ b/Kassiopeia/Python/CMakeLists.txt @@ -1,7 +1,7 @@ # $Id$ -set( TOOLS_PYTHON_SOURCES +set( KASSIOPEIA_PYTHON_SOURCES KassiopeiaReader.py ) -install(FILES ${TOOLS_PYTHON_SOURCES} DESTINATION ${LIB_INSTALL_DIR}/python) +install(FILES ${KASSIOPEIA_PYTHON_SOURCES} DESTINATION ${CMAKE_INSTALL_LIBDIR}/python) diff --git a/Kassiopeia/Python/KassiopeiaReader.py b/Kassiopeia/Python/KassiopeiaReader.py index a2e49c154..86402b5d2 100644 --- a/Kassiopeia/Python/KassiopeiaReader.py +++ b/Kassiopeia/Python/KassiopeiaReader.py @@ -296,6 +296,7 @@ def loadTree(self, treename='output_track_world'): raise AttributeError("TFile '%s' has no tree named '%s'" % (self.file.GetName(), treename)) self.tree = tree + self.leaves = {} for i in range(foliage.GetEntries()): leaf = foliage.At(i) name = leaf.GetName() diff --git a/Kassiopeia/Simulation/Include/KSEvent.h b/Kassiopeia/Simulation/Include/KSEvent.h index f1adcf529..e36a6b900 100644 --- a/Kassiopeia/Simulation/Include/KSEvent.h +++ b/Kassiopeia/Simulation/Include/KSEvent.h @@ -42,6 +42,7 @@ namespace Kassiopeia K_REFS( unsigned int, DiscreteSecondaries ) K_REFS( double, DiscreteEnergyChange ) K_REFS( double, DiscreteMomentumChange ) + K_REFS( unsigned int, NumberOfTurns ) //********* //generator diff --git a/Kassiopeia/Simulation/Include/KSRootSurfaceInteraction.h b/Kassiopeia/Simulation/Include/KSRootSurfaceInteraction.h index 0c280c5b5..c011a5363 100644 --- a/Kassiopeia/Simulation/Include/KSRootSurfaceInteraction.h +++ b/Kassiopeia/Simulation/Include/KSRootSurfaceInteraction.h @@ -54,4 +54,3 @@ namespace Kassiopeia } #endif - diff --git a/Kassiopeia/Simulation/Include/KSRun.h b/Kassiopeia/Simulation/Include/KSRun.h index 6ed2bd7e1..597595613 100644 --- a/Kassiopeia/Simulation/Include/KSRun.h +++ b/Kassiopeia/Simulation/Include/KSRun.h @@ -38,6 +38,7 @@ namespace Kassiopeia K_REFS( unsigned int, DiscreteSecondaries ) K_REFS( double, DiscreteEnergyChange ) K_REFS( double, DiscreteMomentumChange ) + K_REFS( unsigned int, NumberOfTurns ) }; } diff --git a/Kassiopeia/Simulation/Include/KSStep.h b/Kassiopeia/Simulation/Include/KSStep.h index 4d66ecdfe..3f40d8fee 100644 --- a/Kassiopeia/Simulation/Include/KSStep.h +++ b/Kassiopeia/Simulation/Include/KSStep.h @@ -43,6 +43,7 @@ namespace Kassiopeia K_REFS( unsigned int, DiscreteSecondaries ) K_REFS( double, DiscreteEnergyChange ) K_REFS( double, DiscreteMomentumChange ) + K_REFS( unsigned int, NumberOfTurns ) //******** //modifier diff --git a/Kassiopeia/Simulation/Include/KSTrack.h b/Kassiopeia/Simulation/Include/KSTrack.h index ccd2deb11..9768223fc 100644 --- a/Kassiopeia/Simulation/Include/KSTrack.h +++ b/Kassiopeia/Simulation/Include/KSTrack.h @@ -41,6 +41,7 @@ namespace Kassiopeia K_REFS( unsigned int, DiscreteSecondaries ) K_REFS( double, DiscreteEnergyChange ) K_REFS( double, DiscreteMomentumChange ) + K_REFS( unsigned int, NumberOfTurns ) K_REFS( std::string, CreatorName ) K_REFS( std::string, TerminatorName ) diff --git a/Kassiopeia/Simulation/Source/KSEvent.cxx b/Kassiopeia/Simulation/Source/KSEvent.cxx index 86d9f55f9..1d9724c41 100644 --- a/Kassiopeia/Simulation/Source/KSEvent.cxx +++ b/Kassiopeia/Simulation/Source/KSEvent.cxx @@ -16,6 +16,7 @@ namespace Kassiopeia fDiscreteSecondaries( 0 ), fDiscreteEnergyChange( 0. ), fDiscreteMomentumChange( 0. ), + fNumberOfTurns( 0 ), fGeneratorFlag( false ), fGeneratorName( "" ), fGeneratorPrimaries( 0 ), @@ -41,6 +42,7 @@ namespace Kassiopeia fDiscreteSecondaries( aCopy.fDiscreteSecondaries ), fDiscreteEnergyChange( aCopy.fDiscreteSecondaries ), fDiscreteMomentumChange( aCopy.fDiscreteMomentumChange ), + fNumberOfTurns( aCopy.fNumberOfTurns ), fGeneratorFlag( aCopy.fGeneratorFlag ), fGeneratorName( aCopy.fGeneratorName ), fGeneratorPrimaries( aCopy.fGeneratorPrimaries ), @@ -66,6 +68,7 @@ namespace Kassiopeia fDiscreteSecondaries = aCopy.fDiscreteSecondaries; fDiscreteEnergyChange = aCopy.fDiscreteEnergyChange; fDiscreteMomentumChange = aCopy.fDiscreteMomentumChange; + fNumberOfTurns = aCopy.fNumberOfTurns; fGeneratorFlag = aCopy.fGeneratorFlag; fGeneratorName = aCopy.fGeneratorName; fGeneratorPrimaries = aCopy.fGeneratorPrimaries; @@ -98,6 +101,7 @@ namespace Kassiopeia KSDictionary< KSEvent >::AddComponent( &KSEvent::GetDiscreteSecondaries, "discrete_secondaries" ) + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetDiscreteEnergyChange, "discrete_energy_change" ) + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetDiscreteMomentumChange, "discrete_momentum_change" ) + + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetNumberOfTurns, "number_of_turns" ) + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetGeneratorFlag, "generator_flag" ) + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetGeneratorName, "generator_name" ) + KSDictionary< KSEvent >::AddComponent( &KSEvent::GetGeneratorPrimaries, "generator_primaries" ) + diff --git a/Kassiopeia/Simulation/Source/KSRoot.cxx b/Kassiopeia/Simulation/Source/KSRoot.cxx index 7fdb02328..b786f20fa 100644 --- a/Kassiopeia/Simulation/Source/KSRoot.cxx +++ b/Kassiopeia/Simulation/Source/KSRoot.cxx @@ -391,6 +391,7 @@ namespace Kassiopeia fRun->DiscreteEnergyChange() = 0.; fRun->DiscreteMomentumChange() = 0.; fRun->DiscreteSecondaries() = 0; + fRun->NumberOfTurns() = 0; fRunIndex++; // send report @@ -429,6 +430,7 @@ namespace Kassiopeia fRun->DiscreteEnergyChange() += fEvent->DiscreteEnergyChange(); fRun->DiscreteMomentumChange() += fEvent->DiscreteMomentumChange(); fRun->DiscreteSecondaries() += fEvent->DiscreteSecondaries(); + fRun->NumberOfTurns() += fEvent->NumberOfTurns(); fRootRunModifier->ExecutePostRunModification(); } @@ -462,6 +464,7 @@ namespace Kassiopeia fEvent->DiscreteEnergyChange() = 0.; fEvent->DiscreteMomentumChange() = 0.; fEvent->DiscreteSecondaries() = 0; + fEvent->NumberOfTurns() = 0; fEventIndex++; //clear any internal trajectory state @@ -523,6 +526,7 @@ namespace Kassiopeia fEvent->DiscreteEnergyChange() += fTrack->DiscreteEnergyChange(); fEvent->DiscreteMomentumChange() += fTrack->DiscreteMomentumChange(); fEvent->DiscreteSecondaries() += fTrack->DiscreteSecondaries(); + fEvent->NumberOfTurns() += fTrack->NumberOfTurns(); } fRootEventModifier->ExecutePostEventModification(); @@ -555,6 +559,8 @@ namespace Kassiopeia fTrack->DiscreteEnergyChange() = 0.; fTrack->DiscreteMomentumChange() = 0.; fTrack->DiscreteSecondaries() = 0; + fTrack->NumberOfTurns() = 0; + fStopTrackSignal = false; fGSLErrorSignal = false; @@ -618,6 +624,7 @@ namespace Kassiopeia fTrack->DiscreteEnergyChange() += fStep->DiscreteEnergyChange(); fTrack->DiscreteMomentumChange() += fStep->DiscreteMomentumChange(); fTrack->DiscreteSecondaries() += fStep->DiscreteSecondaries(); + fTrack->NumberOfTurns() += fStep->NumberOfTurns(); } } @@ -671,6 +678,7 @@ namespace Kassiopeia fStep->DiscreteSecondaries() = 0; fStep->DiscreteEnergyChange() = 0.; fStep->DiscreteMomentumChange() = 0.; + fStep->NumberOfTurns() = 0; fStep->TerminatorFlag() = false; fStep->TerminatorName().clear(); @@ -719,6 +727,10 @@ namespace Kassiopeia stepmsg_debug( " initial particle electric field: <" << fStep->InitialParticle().GetElectricField().X() << "," << fStep->InitialParticle().GetElectricField().Y() << "," << fStep->InitialParticle().GetElectricField().Z() << ">" << eom ) stepmsg_debug( " initial particle magnetic field: <" << fStep->InitialParticle().GetMagneticField().X() << "," << fStep->InitialParticle().GetMagneticField().Y() << "," << fStep->InitialParticle().GetMagneticField().Z() << ">" << eom ) stepmsg_debug( " initial particle angle to magnetic field: <" << fStep->InitialParticle().GetPolarAngleToB() << ">" << eom ) + stepmsg_debug( " initial particle spin: " << fStep->InitialParticle().GetSpin() << eom ) + stepmsg_debug( " initial particle spin0: <" << fStep->InitialParticle().GetSpin0() << ">" << eom ) + stepmsg_debug( " initial particle aligned spin: <" << fStep->InitialParticle().GetAlignedSpin() << ">" << eom ) + stepmsg_debug( " initial particle spin angle: <" << fStep->InitialParticle().GetSpinAngle() << ">" << eom ) //clear any abort signals in root trajectory KSTrajectory::ClearAbort(); @@ -911,6 +923,14 @@ namespace Kassiopeia fRootTerminator->ExecuteTermination(); } + // check if particle has turned around + double tInitialDotProduct = fStep->InitialParticle().GetMagneticField().Dot( fStep->InitialParticle().GetMomentum() ); + double tFinalDotProduct = fStep->FinalParticle().GetMagneticField().Dot( fStep->FinalParticle().GetMomentum() ); + if( tInitialDotProduct * tFinalDotProduct < 0. ) + { + fStep->NumberOfTurns() += 1; + } + // label secondaries for( KSParticleIt tParticleIt = fStep->ParticleQueue().begin(); tParticleIt != fStep->ParticleQueue().end(); tParticleIt++ ) { @@ -933,6 +953,10 @@ namespace Kassiopeia stepmsg_debug( " final particle electric field: <" << fStep->FinalParticle().GetElectricField().X() << "," << fStep->FinalParticle().GetElectricField().Y() << "," << fStep->FinalParticle().GetElectricField().Z() << ">" << eom ) stepmsg_debug( " final particle magnetic field: <" << fStep->FinalParticle().GetMagneticField().X() << "," << fStep->FinalParticle().GetMagneticField().Y() << "," << fStep->FinalParticle().GetMagneticField().Z() << ">" << eom ) stepmsg_debug( " final particle angle to magnetic field: <" << fStep->FinalParticle().GetPolarAngleToB() << ">" << eom ) + stepmsg_debug( " final particle spin: " << fStep->FinalParticle().GetSpin() << eom ) + stepmsg_debug( " final particle spin0: <" << fStep->FinalParticle().GetSpin0() << ">" << eom ) + stepmsg_debug( " final particle aligned spin: <" << fStep->FinalParticle().GetAlignedSpin() << ">" << eom ) + stepmsg_debug( " final particle spin angle: <" << fStep->FinalParticle().GetSpinAngle() << ">" << eom ) //signal handler terminate particle if ( fStopRunSignal || fStopEventSignal || fStopTrackSignal ) diff --git a/Kassiopeia/Simulation/Source/KSRootSpaceInteraction.cxx b/Kassiopeia/Simulation/Source/KSRootSpaceInteraction.cxx index b551730fc..d95f0ef5b 100644 --- a/Kassiopeia/Simulation/Source/KSRootSpaceInteraction.cxx +++ b/Kassiopeia/Simulation/Source/KSRootSpaceInteraction.cxx @@ -139,6 +139,10 @@ namespace Kassiopeia intmsg_debug( " final particle electric field: <" << fInteractionParticle->GetElectricField().X() << "," << fInteractionParticle->GetElectricField().Y() << "," << fInteractionParticle->GetElectricField().Z() << ">" << eom ) intmsg_debug( " final particle magnetic field: <" << fInteractionParticle->GetMagneticField().X() << "," << fInteractionParticle->GetMagneticField().Y() << "," << fInteractionParticle->GetMagneticField().Z() << ">" << eom ) intmsg_debug( " final particle angle to magnetic field: <" << fInteractionParticle->GetPolarAngleToB() << ">" << eom ) + intmsg_debug( " final particle spin: " << fInteractionParticle->GetSpin() << eom ) + intmsg_debug( " final particle spin0: <" << fInteractionParticle->GetSpin0() << ">" << eom ) + intmsg_debug( " final particle aligned spin: <" << fInteractionParticle->GetAlignedSpin() << ">" << eom ) + intmsg_debug( " final particle spin angle: <" << fInteractionParticle->GetSpinAngle() << ">" << eom ) return; } @@ -167,6 +171,10 @@ namespace Kassiopeia intmsg_debug( " interaction particle electric field: <" << fInteractionParticle->GetElectricField().X() << "," << fInteractionParticle->GetElectricField().Y() << "," << fInteractionParticle->GetElectricField().Z() << ">" << eom ) intmsg_debug( " interaction particle magnetic field: <" << fInteractionParticle->GetMagneticField().X() << "," << fInteractionParticle->GetMagneticField().Y() << "," << fInteractionParticle->GetMagneticField().Z() << ">" << eom ) intmsg_debug( " interaction particle angle to magnetic field: <" << fInteractionParticle->GetPolarAngleToB() << ">" << eom ); + intmsg_debug( " interaction particle spin: " << fInteractionParticle->GetSpin() << eom ) + intmsg_debug( " interaction particle spin0: <" << fInteractionParticle->GetSpin0() << ">" << eom ) + intmsg_debug( " interaction particle aligned spin: <" << fInteractionParticle->GetAlignedSpin() << ">" << eom ) + intmsg_debug( " interaction particle spin angle: <" << fInteractionParticle->GetSpinAngle() << ">" << eom ) return; } @@ -205,6 +213,10 @@ namespace Kassiopeia intmsg_debug( " final particle electric field: <" << fFinalParticle->GetElectricField().X() << "," << fFinalParticle->GetElectricField().Y() << "," << fFinalParticle->GetElectricField().Z() << ">" << eom ) intmsg_debug( " final particle magnetic field: <" << fFinalParticle->GetMagneticField().X() << "," << fFinalParticle->GetMagneticField().Y() << "," << fFinalParticle->GetMagneticField().Z() << ">" << eom ) intmsg_debug( " final particle angle to magnetic field: <" << fFinalParticle->GetPolarAngleToB() << ">" << eom ); + intmsg_debug( " final particle spin: " << fFinalParticle->GetSpin() << eom ) + intmsg_debug( " final particle spin0: <" << fFinalParticle->GetSpin0() << ">" << eom ) + intmsg_debug( " final particle aligned spin: <" << fFinalParticle->GetAlignedSpin() << ">" << eom ) + intmsg_debug( " final particle spin angle: <" << fFinalParticle->GetSpinAngle() << ">" << eom ) return; } diff --git a/Kassiopeia/Simulation/Source/KSRootSpaceNavigator.cxx b/Kassiopeia/Simulation/Source/KSRootSpaceNavigator.cxx index 3899b86c4..669253fc4 100644 --- a/Kassiopeia/Simulation/Source/KSRootSpaceNavigator.cxx +++ b/Kassiopeia/Simulation/Source/KSRootSpaceNavigator.cxx @@ -161,6 +161,10 @@ namespace Kassiopeia navmsg_debug( " final particle electric field: <" << fNavigationParticle->GetElectricField().X() << "," << fNavigationParticle->GetElectricField().Y() << "," << fNavigationParticle->GetElectricField().Z() << ">" << eom ) navmsg_debug( " final particle magnetic field: <" << fNavigationParticle->GetMagneticField().X() << "," << fNavigationParticle->GetMagneticField().Y() << "," << fNavigationParticle->GetMagneticField().Z() << ">" << eom ) navmsg_debug( " final particle angle to magnetic field: <" << fNavigationParticle->GetPolarAngleToB() << ">" << eom ) + navmsg_debug( " final particle spin: " << fNavigationParticle->GetSpin() << eom ) + navmsg_debug( " final particle spin0: <" << fNavigationParticle->GetSpin0() << ">" << eom ) + navmsg_debug( " final particle aligned spin: <" << fNavigationParticle->GetAlignedSpin() << ">" << eom ) + navmsg_debug( " final particle spin angle: <" << fNavigationParticle->GetSpinAngle() << ">" << eom ) return; } @@ -200,13 +204,17 @@ namespace Kassiopeia navmsg_debug( " final particle electric field: <" << fFinalParticle->GetElectricField().X() << "," << fFinalParticle->GetElectricField().Y() << "," << fFinalParticle->GetElectricField().Z() << ">" << eom ) navmsg_debug( " final particle magnetic field: <" << fFinalParticle->GetMagneticField().X() << "," << fFinalParticle->GetMagneticField().Y() << "," << fFinalParticle->GetMagneticField().Z() << ">" << eom ) navmsg_debug( " final particle angle to magnetic field: <" << fFinalParticle->GetPolarAngleToB() << ">" << eom ) + navmsg_debug( " final particle spin: " << fFinalParticle->GetSpin() << eom ) + navmsg_debug( " final particle spin0: <" << fFinalParticle->GetSpin0() << ">" << eom ) + navmsg_debug( " final particle aligned spin: <" << fFinalParticle->GetAlignedSpin() << ">" << eom ) + navmsg_debug( " final particle spin angle: <" << fFinalParticle->GetSpinAngle() << ">" << eom ) return; } void KSRootSpaceNavigator::FinalizeNavigation() { - FinalizeNavigation( *fFinalParticle ); + FinalizeNavigation( *fFinalParticle ); return; } diff --git a/Kassiopeia/Simulation/Source/KSRootStepModifier.cxx b/Kassiopeia/Simulation/Source/KSRootStepModifier.cxx index 0a7487460..4652fb128 100644 --- a/Kassiopeia/Simulation/Source/KSRootStepModifier.cxx +++ b/Kassiopeia/Simulation/Source/KSRootStepModifier.cxx @@ -90,6 +90,10 @@ namespace Kassiopeia modmsg_debug( " modifier particle electric field: <" << fModifierParticle->GetElectricField().X() << "," << fModifierParticle->GetElectricField().Y() << "," << fModifierParticle->GetElectricField().Z() << ">" << eom ) modmsg_debug( " modifier particle magnetic field: <" << fModifierParticle->GetMagneticField().X() << "," << fModifierParticle->GetMagneticField().Y() << "," << fModifierParticle->GetMagneticField().Z() << ">" << eom ) modmsg_debug( " modifier particle angle to magnetic field: <" << fModifierParticle->GetPolarAngleToB() << ">" << eom ) + modmsg_debug( " modifier particle spin: " << fModifierParticle->GetSpin() << eom ) + modmsg_debug( " modifier particle spin0: <" << fModifierParticle->GetSpin0() << ">" << eom ) + modmsg_debug( " modifier particle aligned spin: <" << fModifierParticle->GetAlignedSpin() << ">" << eom ) + modmsg_debug( " modifier particle spin angle: <" << fModifierParticle->GetSpinAngle() << ">" << eom ) return false; //changes to inital particle state disabled } @@ -122,6 +126,10 @@ namespace Kassiopeia modmsg_debug( " modifier particle electric field: <" << fModifierParticle->GetElectricField().X() << "," << fModifierParticle->GetElectricField().Y() << "," << fModifierParticle->GetElectricField().Z() << ">" << eom ) modmsg_debug( " modifier particle magnetic field: <" << fModifierParticle->GetMagneticField().X() << "," << fModifierParticle->GetMagneticField().Y() << "," << fModifierParticle->GetMagneticField().Z() << ">" << eom ) modmsg_debug( " modifier particle angle to magnetic field: <" << fModifierParticle->GetPolarAngleToB() << ">" << eom ) + modmsg_debug( " modifier particle spin: " << fModifierParticle->GetSpin() << eom ) + modmsg_debug( " modifier particle spin0: <" << fModifierParticle->GetSpin0() << ">" << eom ) + modmsg_debug( " modifier particle aligned spin: <" << fModifierParticle->GetAlignedSpin() << ">" << eom ) + modmsg_debug( " modifier particle spin angle: <" << fModifierParticle->GetSpinAngle() << ">" << eom ) return false; //changes to initial particle state disabled } @@ -152,6 +160,10 @@ namespace Kassiopeia modmsg_debug( " final particle electric field: <" << fModifierParticle->GetElectricField().X() << "," << fModifierParticle->GetElectricField().Y() << "," << fModifierParticle->GetElectricField().Z() << ">" << eom ) modmsg_debug( " final particle magnetic field: <" << fModifierParticle->GetMagneticField().X() << "," << fModifierParticle->GetMagneticField().Y() << "," << fModifierParticle->GetMagneticField().Z() << ">" << eom ) modmsg_debug( " final particle angle to magnetic field: <" << fModifierParticle->GetPolarAngleToB() << ">" << eom ) + modmsg_debug( " final particle spin: " << fModifierParticle->GetSpin() << eom ) + modmsg_debug( " final particle spin0: <" << fModifierParticle->GetSpin0() << ">" << eom ) + modmsg_debug( " final particle aligned spin: <" << fModifierParticle->GetAlignedSpin() << ">" << eom ) + modmsg_debug( " final particle spin angle: <" << fModifierParticle->GetSpinAngle() << ">" << eom ) return hasChangedState; } diff --git a/Kassiopeia/Simulation/Source/KSRootSurfaceInteraction.cxx b/Kassiopeia/Simulation/Source/KSRootSurfaceInteraction.cxx index 11d293886..94f25ce6a 100644 --- a/Kassiopeia/Simulation/Source/KSRootSurfaceInteraction.cxx +++ b/Kassiopeia/Simulation/Source/KSRootSurfaceInteraction.cxx @@ -112,6 +112,10 @@ namespace Kassiopeia intmsg_debug( " interaction particle electric field: <" << fInteractionParticle->GetElectricField().X() << "," << fInteractionParticle->GetElectricField().Y() << "," << fInteractionParticle->GetElectricField().Z() << ">" << eom ); intmsg_debug( " interaction particle magnetic field: <" << fInteractionParticle->GetMagneticField().X() << "," << fInteractionParticle->GetMagneticField().Y() << "," << fInteractionParticle->GetMagneticField().Z() << ">" << eom ); intmsg_debug( " interaction particle angle to magnetic field: <" << fInteractionParticle->GetPolarAngleToB() << ">" << eom ); + intmsg_debug( " interaction particle spin: " << fInteractionParticle->GetSpin() << eom ); + intmsg_debug( " interaction particle spin0: <" << fInteractionParticle->GetSpin0() << ">" << eom ); + intmsg_debug( " interaction particle aligned spin: <" << fInteractionParticle->GetAlignedSpin() << ">" << eom ); + intmsg_debug( " interaction particle spin angle: <" << fInteractionParticle->GetSpinAngle() << ">" << eom ); return; } @@ -149,6 +153,10 @@ namespace Kassiopeia intmsg_debug( " interaction particle electric field: <" << fInteractionParticle->GetElectricField().X() << "," << fInteractionParticle->GetElectricField().Y() << "," << fInteractionParticle->GetElectricField().Z() << ">" << eom ); intmsg_debug( " interaction particle magnetic field: <" << fInteractionParticle->GetMagneticField().X() << "," << fInteractionParticle->GetMagneticField().Y() << "," << fInteractionParticle->GetMagneticField().Z() << ">" << eom ); intmsg_debug( " interaction particle angle to magnetic field: <" << fInteractionParticle->GetPolarAngleToB() << ">" << eom ); + intmsg_debug( " interaction particle spin: " << fInteractionParticle->GetSpin() << eom ); + intmsg_debug( " interaction particle spin0: <" << fInteractionParticle->GetSpin0() << ">" << eom ); + intmsg_debug( " interaction particle aligned spin: <" << fInteractionParticle->GetAlignedSpin() << ">" << eom ); + intmsg_debug( " interaction particle spin angle: <" << fInteractionParticle->GetSpinAngle() << ">" << eom ); return; } diff --git a/Kassiopeia/Simulation/Source/KSRootSurfaceNavigator.cxx b/Kassiopeia/Simulation/Source/KSRootSurfaceNavigator.cxx index eae0ce1a4..11417d953 100644 --- a/Kassiopeia/Simulation/Source/KSRootSurfaceNavigator.cxx +++ b/Kassiopeia/Simulation/Source/KSRootSurfaceNavigator.cxx @@ -124,6 +124,10 @@ namespace Kassiopeia navmsg_debug( " final particle electric field: <" << fFinalParticle->GetElectricField().X() << "," << fFinalParticle->GetElectricField().Y() << "," << fFinalParticle->GetElectricField().Z() << ">" << eom ); navmsg_debug( " final particle magnetic field: <" << fFinalParticle->GetMagneticField().X() << "," << fFinalParticle->GetMagneticField().Y() << "," << fFinalParticle->GetMagneticField().Z() << ">" << eom ); navmsg_debug( " final particle angle to magnetic field: <" << fFinalParticle->GetPolarAngleToB() << ">" << eom ); + navmsg_debug( " final particle spin: " << fFinalParticle->GetSpin() << eom ); + navmsg_debug( " final particle spin0: <" << fFinalParticle->GetSpin0() << ">" << eom ); + navmsg_debug( " final particle aligned spin: <" << fFinalParticle->GetAlignedSpin() << ">" << eom ); + navmsg_debug( " final particle spin angle: <" << fFinalParticle->GetSpinAngle() << ">" << eom ); return; } diff --git a/Kassiopeia/Simulation/Source/KSRootTerminator.cxx b/Kassiopeia/Simulation/Source/KSRootTerminator.cxx index ae7f3c9f8..0e56595b8 100644 --- a/Kassiopeia/Simulation/Source/KSRootTerminator.cxx +++ b/Kassiopeia/Simulation/Source/KSRootTerminator.cxx @@ -126,6 +126,10 @@ namespace Kassiopeia termmsg_debug( " terminator particle electric field: <" << fTerminatorParticle->GetElectricField().X() << "," << fTerminatorParticle->GetElectricField().Y() << "," << fTerminatorParticle->GetElectricField().Z() << ">" << eom ) termmsg_debug( " terminator particle magnetic field: <" << fTerminatorParticle->GetMagneticField().X() << "," << fTerminatorParticle->GetMagneticField().Y() << "," << fTerminatorParticle->GetMagneticField().Z() << ">" << eom ) termmsg_debug( " terminator particle angle to magnetic field: <" << fTerminatorParticle->GetPolarAngleToB() << ">" << eom ) + termmsg_debug( " terminator particle spin: " << fTerminatorParticle->GetSpin() << eom ) + termmsg_debug( " terminator particle spin0: <" << fTerminatorParticle->GetSpin0() << ">" << eom ) + termmsg_debug( " terminator particle aligned spin: <" << fTerminatorParticle->GetAlignedSpin() << ">" << eom ) + termmsg_debug( " terminator particle spin angle: <" << fTerminatorParticle->GetSpinAngle() << ">" << eom ) return; } @@ -154,6 +158,10 @@ namespace Kassiopeia termmsg_debug( " terminator particle electric field: <" << fTerminatorParticle->GetElectricField().X() << "," << fTerminatorParticle->GetElectricField().Y() << "," << fTerminatorParticle->GetElectricField().Z() << ">" << eom ) termmsg_debug( " terminator particle magnetic field: <" << fTerminatorParticle->GetMagneticField().X() << "," << fTerminatorParticle->GetMagneticField().Y() << "," << fTerminatorParticle->GetMagneticField().Z() << ">" << eom ) termmsg_debug( " terminator particle angle to magnetic field: <" << fTerminatorParticle->GetPolarAngleToB() << ">" << eom ) + termmsg_debug( " terminator particle spin: " << fTerminatorParticle->GetSpin() << eom ) + termmsg_debug( " terminator particle spin0: <" << fTerminatorParticle->GetSpin0() << ">" << eom ) + termmsg_debug( " terminator particle aligned spin: <" << fTerminatorParticle->GetAlignedSpin() << ">" << eom ) + termmsg_debug( " terminator particle spin angle: <" << fTerminatorParticle->GetSpinAngle() << ">" << eom ) return; } @@ -192,6 +200,10 @@ namespace Kassiopeia termmsg_debug( " final particle electric field: <" << fTerminatorParticle->GetElectricField().X() << "," << fTerminatorParticle->GetElectricField().Y() << "," << fTerminatorParticle->GetElectricField().Z() << ">" << eom ) termmsg_debug( " final particle magnetic field: <" << fTerminatorParticle->GetMagneticField().X() << "," << fTerminatorParticle->GetMagneticField().Y() << "," << fTerminatorParticle->GetMagneticField().Z() << ">" << eom ) termmsg_debug( " final particle angle to magnetic field: <" << fTerminatorParticle->GetPolarAngleToB() << ">" << eom ) + termmsg_debug( " final particle spin: " << fTerminatorParticle->GetSpin() << eom ) + termmsg_debug( " final particle spin0: <" << fTerminatorParticle->GetSpin0() << ">" << eom ) + termmsg_debug( " final particle aligned spin: <" << fTerminatorParticle->GetAlignedSpin() << ">" << eom ) + termmsg_debug( " final particle spin angle: <" << fTerminatorParticle->GetSpinAngle() << ">" << eom ) return; } diff --git a/Kassiopeia/Simulation/Source/KSRootTrajectory.cxx b/Kassiopeia/Simulation/Source/KSRootTrajectory.cxx index 7693a4b68..0e419e175 100644 --- a/Kassiopeia/Simulation/Source/KSRootTrajectory.cxx +++ b/Kassiopeia/Simulation/Source/KSRootTrajectory.cxx @@ -39,6 +39,7 @@ namespace Kassiopeia { trajmsg( eError ) << "<" << GetName() << "> cannot calculate trajectory with no trajectory set" << eom; } + fTrajectory->CalculateTrajectory( anInitialParticle, aFinalParticle, aCenter, aRadius, aTimeStep ); return; } @@ -120,6 +121,10 @@ namespace Kassiopeia trajmsg_debug( " trajectory particle electric field: <" << fTrajectoryParticle->GetElectricField().X() << "," << fTrajectoryParticle->GetElectricField().Y() << "," << fTrajectoryParticle->GetElectricField().Z() << ">" << eom ); trajmsg_debug( " trajectory particle magnetic field: <" << fTrajectoryParticle->GetMagneticField().X() << "," << fTrajectoryParticle->GetMagneticField().Y() << "," << fTrajectoryParticle->GetMagneticField().Z() << ">" << eom ); trajmsg_debug( " trajectory particle angle to magnetic field: <" << fTrajectoryParticle->GetPolarAngleToB() << ">" << eom ); + trajmsg_debug( " trajectory particle spin: " << fTrajectoryParticle->GetSpin() << eom ); + trajmsg_debug( " trajectory particle spin0: <" << fTrajectoryParticle->GetSpin0() << ">" << eom ); + trajmsg_debug( " trajectory particle aligned spin: <" << fTrajectoryParticle->GetAlignedSpin() << ">" << eom ); + trajmsg_debug( " trajectory particle spin angle: <" << fTrajectoryParticle->GetSpinAngle() << ">" << eom ); if( !( fTrajectoryParticle->GetPosition() == fTrajectoryParticle->GetPosition() ) ) { @@ -188,6 +193,10 @@ namespace Kassiopeia trajmsg_debug( " final particle electric field: <" << fFinalParticle->GetElectricField().X() << "," << fFinalParticle->GetElectricField().Y() << "," << fFinalParticle->GetElectricField().Z() << ">" << eom ); trajmsg_debug( " final particle magnetic field: <" << fFinalParticle->GetMagneticField().X() << "," << fFinalParticle->GetMagneticField().Y() << "," << fFinalParticle->GetMagneticField().Z() << ">" << eom ); trajmsg_debug( " final particle angle to magnetic field: <" << fFinalParticle->GetPolarAngleToB() << ">" << eom ); + trajmsg_debug( " final particle spin: " << fFinalParticle->GetSpin() << eom ); + trajmsg_debug( " final particle spin0: <" << fFinalParticle->GetSpin0() << ">" << eom ); + trajmsg_debug( " final particle aligned spin: <" << fFinalParticle->GetAlignedSpin() << ">" << eom ); + trajmsg_debug( " final particle spin angle: <" << fFinalParticle->GetSpinAngle() << ">" << eom ); return; } diff --git a/Kassiopeia/Simulation/Source/KSRun.cxx b/Kassiopeia/Simulation/Source/KSRun.cxx index 3c9f92e36..7bd090264 100644 --- a/Kassiopeia/Simulation/Source/KSRun.cxx +++ b/Kassiopeia/Simulation/Source/KSRun.cxx @@ -17,7 +17,8 @@ namespace Kassiopeia fContinuousMomentumChange( 0. ), fDiscreteSecondaries( 0 ), fDiscreteEnergyChange( 0. ), - fDiscreteMomentumChange( 0. ) + fDiscreteMomentumChange( 0. ), + fNumberOfTurns( 0 ) { } KSRun::KSRun( const KSRun& aCopy ) : @@ -33,7 +34,8 @@ namespace Kassiopeia fContinuousMomentumChange( aCopy.fContinuousMomentumChange ), fDiscreteSecondaries( aCopy.fDiscreteSecondaries ), fDiscreteEnergyChange( aCopy.fDiscreteSecondaries ), - fDiscreteMomentumChange( aCopy.fDiscreteMomentumChange ) + fDiscreteMomentumChange( aCopy.fDiscreteMomentumChange ), + fNumberOfTurns( aCopy.fNumberOfTurns ) { } KSRun& KSRun::operator=( const KSRun& aCopy ) @@ -50,6 +52,7 @@ namespace Kassiopeia fDiscreteSecondaries = aCopy.fDiscreteSecondaries; fDiscreteEnergyChange = aCopy.fDiscreteEnergyChange; fDiscreteMomentumChange = aCopy.fDiscreteMomentumChange; + fNumberOfTurns = aCopy.fNumberOfTurns; return *this; } KSRun* KSRun::Clone() const @@ -72,7 +75,8 @@ namespace Kassiopeia KSDictionary< KSRun >::AddComponent( &KSRun::GetContinuousMomentumChange, "continuous_momentum_change" ) + KSDictionary< KSRun >::AddComponent( &KSRun::GetDiscreteSecondaries, "discrete_secondaries" ) + KSDictionary< KSRun >::AddComponent( &KSRun::GetDiscreteEnergyChange, "discrete_energy_change" ) + - KSDictionary< KSRun >::AddComponent( &KSRun::GetDiscreteMomentumChange, "discrete_momentum_change" ); + KSDictionary< KSRun >::AddComponent( &KSRun::GetDiscreteMomentumChange, "discrete_momentum_change" ) + + KSDictionary< KSRun >::AddComponent( &KSRun::GetNumberOfTurns, "number_of_turns" ); } diff --git a/Kassiopeia/Simulation/Source/KSStep.cxx b/Kassiopeia/Simulation/Source/KSStep.cxx index 81d4e95c5..fa10c3af0 100644 --- a/Kassiopeia/Simulation/Source/KSStep.cxx +++ b/Kassiopeia/Simulation/Source/KSStep.cxx @@ -16,6 +16,7 @@ namespace Kassiopeia fDiscreteSecondaries( 0 ), fDiscreteEnergyChange( 0. ), fDiscreteMomentumChange( 0. ), + fNumberOfTurns( 0 ), fModifierName( "" ), fModifierFlag( false ), fTerminatorName( "" ), @@ -55,6 +56,7 @@ namespace Kassiopeia fDiscreteSecondaries( aCopy.fDiscreteSecondaries ), fDiscreteEnergyChange( aCopy.fDiscreteSecondaries ), fDiscreteMomentumChange( aCopy.fDiscreteMomentumChange ), + fNumberOfTurns( aCopy.fNumberOfTurns ), fModifierName( aCopy.fModifierName ), fModifierFlag( aCopy.fModifierFlag ), fTerminatorName( aCopy.fTerminatorName ), @@ -94,6 +96,7 @@ namespace Kassiopeia fDiscreteSecondaries = aCopy.fDiscreteSecondaries; fDiscreteEnergyChange = aCopy.fDiscreteEnergyChange; fDiscreteMomentumChange = aCopy.fDiscreteMomentumChange; + fNumberOfTurns = aCopy.fNumberOfTurns; fModifierName = aCopy.fModifierName; fModifierFlag = aCopy.fModifierFlag; fTerminatorName = aCopy.fTerminatorName; @@ -140,6 +143,7 @@ namespace Kassiopeia KSDictionary< KSStep >::AddComponent( &KSStep::GetDiscreteSecondaries, "discrete_secondaries" ) + KSDictionary< KSStep >::AddComponent( &KSStep::GetDiscreteEnergyChange, "discrete_energy_change" ) + KSDictionary< KSStep >::AddComponent( &KSStep::GetDiscreteMomentumChange, "discrete_momentum_change" ) + + KSDictionary< KSStep >::AddComponent( &KSStep::GetNumberOfTurns, "number_of_turns" ) + KSDictionary< KSStep >::AddComponent( &KSStep::GetModifierName, "modifier_name" ) + KSDictionary< KSStep >::AddComponent( &KSStep::GetModifierFlag, "modifier_flag" ) + KSDictionary< KSStep >::AddComponent( &KSStep::GetTerminatorName, "terminator_name" ) + diff --git a/Kassiopeia/Simulation/Source/KSTrack.cxx b/Kassiopeia/Simulation/Source/KSTrack.cxx index 178023c67..4f019965f 100644 --- a/Kassiopeia/Simulation/Source/KSTrack.cxx +++ b/Kassiopeia/Simulation/Source/KSTrack.cxx @@ -17,6 +17,7 @@ namespace Kassiopeia fDiscreteSecondaries( 0 ), fDiscreteEnergyChange( 0. ), fDiscreteMomentumChange( 0. ), + fNumberOfTurns( 0 ), fCreatorName( "" ), fTerminatorName( "" ), fInitialParticle(), @@ -37,6 +38,7 @@ namespace Kassiopeia fDiscreteSecondaries( aCopy.fDiscreteSecondaries ), fDiscreteEnergyChange( aCopy.fDiscreteSecondaries ), fDiscreteMomentumChange( aCopy.fDiscreteMomentumChange ), + fNumberOfTurns( aCopy.fNumberOfTurns ), fCreatorName( aCopy.fCreatorName ), fTerminatorName( aCopy.fTerminatorName ), fInitialParticle( aCopy.fInitialParticle ), @@ -57,6 +59,7 @@ namespace Kassiopeia fDiscreteSecondaries = aCopy.fDiscreteSecondaries; fDiscreteEnergyChange = aCopy.fDiscreteEnergyChange; fDiscreteMomentumChange = aCopy.fDiscreteMomentumChange; + fNumberOfTurns = aCopy.fNumberOfTurns; fCreatorName = aCopy.fCreatorName; fTerminatorName = aCopy.fTerminatorName; fInitialParticle = aCopy.fInitialParticle; @@ -84,6 +87,7 @@ namespace Kassiopeia KSDictionary< KSTrack >::AddComponent( &KSTrack::GetDiscreteSecondaries, "discrete_secondaries" ) + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetDiscreteEnergyChange, "discrete_energy_change" ) + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetDiscreteMomentumChange, "discrete_momentum_change" ) + + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetNumberOfTurns, "number_of_turns" ) + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetCreatorName, "creator_name" ) + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetTerminatorName, "terminator_name" ) + KSDictionary< KSTrack >::AddComponent( &KSTrack::GetInitialParticle, "initial_particle" ) + diff --git a/Kassiopeia/Terminators/CMakeLists.txt b/Kassiopeia/Terminators/CMakeLists.txt index 5f8530223..906a8484f 100644 --- a/Kassiopeia/Terminators/CMakeLists.txt +++ b/Kassiopeia/Terminators/CMakeLists.txt @@ -12,6 +12,8 @@ set( TERMINATORS_HEADER_BASENAMES KSTermMinLongEnergy.h KSTermMaxLongEnergy.h KSTermMaxTime.h + KSTermMaxTotalTime.h + KSTermMaxStepTime.h KSTermMaxLength.h KSTermMaxSteps.h KSTermTrapped.h @@ -42,6 +44,8 @@ set( TERMINATORS_SOURCE_BASENAMES KSTermMinLongEnergy.cxx KSTermMaxLongEnergy.cxx KSTermMaxTime.cxx + KSTermMaxTotalTime.cxx + KSTermMaxStepTime.cxx KSTermMaxLength.cxx KSTermMaxSteps.cxx KSTermTrapped.cxx diff --git a/Kassiopeia/Terminators/Include/KSTermMaxStepTime.h b/Kassiopeia/Terminators/Include/KSTermMaxStepTime.h new file mode 100644 index 000000000..4af7c7267 --- /dev/null +++ b/Kassiopeia/Terminators/Include/KSTermMaxStepTime.h @@ -0,0 +1,41 @@ +#ifndef Kassiopeia_KSTermMaxStepTime_h_ +#define Kassiopeia_KSTermMaxStepTime_h_ + +#include "KSTerminator.h" + +#include + +namespace Kassiopeia +{ + + class KSParticle; + + class KSTermMaxStepTime : + public KSComponentTemplate< KSTermMaxStepTime, KSTerminator > + { + public: + KSTermMaxStepTime(); + KSTermMaxStepTime( const KSTermMaxStepTime& aCopy ); + KSTermMaxStepTime* Clone() const; + virtual ~KSTermMaxStepTime(); + + public: + void CalculateTermination( const KSParticle& anInitialParticle, bool& aFlag ); + void ExecuteTermination( const KSParticle& anInitialParticle, KSParticle& aFinalParticle, KSParticleQueue& aParticleQueue ) const; + + public: + void SetTime( const double& aValue ); + + private: + double fTime; + std::clock_t fLastClock; + }; + + inline void KSTermMaxStepTime::SetTime( const double& aValue ) + { + fTime = aValue; + } + +} + +#endif diff --git a/Kassiopeia/Terminators/Include/KSTermMaxTotalTime.h b/Kassiopeia/Terminators/Include/KSTermMaxTotalTime.h new file mode 100644 index 000000000..cd7d9ec43 --- /dev/null +++ b/Kassiopeia/Terminators/Include/KSTermMaxTotalTime.h @@ -0,0 +1,40 @@ +#ifndef Kassiopeia_KSTermMaxTotalTime_h_ +#define Kassiopeia_KSTermMaxTotalTime_h_ + +#include "KSTerminator.h" + +#include + +namespace Kassiopeia +{ + + class KSParticle; + + class KSTermMaxTotalTime : + public KSComponentTemplate< KSTermMaxTotalTime, KSTerminator > + { + public: + KSTermMaxTotalTime(); + KSTermMaxTotalTime( const KSTermMaxTotalTime& aCopy ); + KSTermMaxTotalTime* Clone() const; + virtual ~KSTermMaxTotalTime(); + + public: + void CalculateTermination( const KSParticle& anInitialParticle, bool& aFlag ); + void ExecuteTermination( const KSParticle& anInitialParticle, KSParticle& aFinalParticle, KSParticleQueue& aParticleQueue ) const; + + public: + void SetTime( const double& aValue ); + + private: + double fTime; + }; + + inline void KSTermMaxTotalTime::SetTime( const double& aValue ) + { + fTime = aValue; + } + +} + +#endif diff --git a/Kassiopeia/Terminators/Source/KSTermMaxStepTime.cxx b/Kassiopeia/Terminators/Source/KSTermMaxStepTime.cxx new file mode 100644 index 000000000..610b898e3 --- /dev/null +++ b/Kassiopeia/Terminators/Source/KSTermMaxStepTime.cxx @@ -0,0 +1,47 @@ +#include "KSTermMaxStepTime.h" + +#include "KSTerminatorsMessage.h" + +#include "KSParticle.h" + +namespace Kassiopeia +{ + + KSTermMaxStepTime::KSTermMaxStepTime() : + fTime( 0. ), + fLastClock( 0 ) + { + } + KSTermMaxStepTime::KSTermMaxStepTime( const KSTermMaxStepTime& aCopy ) : + KSComponent(), + fTime( aCopy.fTime ), + fLastClock( aCopy.fLastClock ) + { + } + KSTermMaxStepTime* KSTermMaxStepTime::Clone() const + { + return new KSTermMaxStepTime( *this ); + } + KSTermMaxStepTime::~KSTermMaxStepTime() + { + } + + void KSTermMaxStepTime::CalculateTermination( const KSParticle& /*anInitialParticle*/, bool& aFlag ) + { + if (fTime < 0.) + termmsg( eError ) << "negative time defined in MaxStepTime terminator <" << this->GetName() << ">" << eom; + + std::clock_t tClock = std::clock(); + aFlag = (tClock - fLastClock) / (double)CLOCKS_PER_SEC > fTime ; + + fLastClock = tClock; + return; + } + void KSTermMaxStepTime::ExecuteTermination( const KSParticle&, KSParticle& aFinalParticle, KSParticleQueue& ) const + { + aFinalParticle.SetActive( false ); + aFinalParticle.SetLabel( GetName() ); + return; + } + +} diff --git a/Kassiopeia/Terminators/Source/KSTermMaxTotalTime.cxx b/Kassiopeia/Terminators/Source/KSTermMaxTotalTime.cxx new file mode 100644 index 000000000..6ee85785f --- /dev/null +++ b/Kassiopeia/Terminators/Source/KSTermMaxTotalTime.cxx @@ -0,0 +1,44 @@ +#include "KSTermMaxTotalTime.h" + +#include "KSTerminatorsMessage.h" + +#include "KSParticle.h" + +namespace Kassiopeia +{ + + KSTermMaxTotalTime::KSTermMaxTotalTime() : + fTime( 0. ) + { + } + KSTermMaxTotalTime::KSTermMaxTotalTime( const KSTermMaxTotalTime& aCopy ) : + KSComponent(), + fTime( aCopy.fTime ) + { + } + KSTermMaxTotalTime* KSTermMaxTotalTime::Clone() const + { + return new KSTermMaxTotalTime( *this ); + } + KSTermMaxTotalTime::~KSTermMaxTotalTime() + { + } + + void KSTermMaxTotalTime::CalculateTermination( const KSParticle& /*anInitialParticle*/, bool& aFlag ) + { + if (fTime < 0.) + termmsg( eError ) << "negative time defined in MaxStepTime terminator <" << this->GetName() << ">" << eom; + + std::clock_t tClock = std::clock(); + aFlag = tClock / (double)CLOCKS_PER_SEC > fTime ; + + return; + } + void KSTermMaxTotalTime::ExecuteTermination( const KSParticle&, KSParticle& aFinalParticle, KSParticleQueue& ) const + { + aFinalParticle.SetActive( false ); + aFinalParticle.SetLabel( GetName() ); + return; + } + +} diff --git a/Kassiopeia/Trajectories/Source/KSTrajAdiabaticSpinParticle.cxx b/Kassiopeia/Trajectories/Source/KSTrajAdiabaticSpinParticle.cxx index 2ba909eae..c7b860667 100644 --- a/Kassiopeia/Trajectories/Source/KSTrajAdiabaticSpinParticle.cxx +++ b/Kassiopeia/Trajectories/Source/KSTrajAdiabaticSpinParticle.cxx @@ -146,7 +146,7 @@ namespace Kassiopeia } aParticle.RecalculateMagneticField(); - aParticle.RecalculateSpinBody(); + aParticle.RecalculateSpinGlobal(); if( GetAlignedSpin() != aParticle.GetAlignedSpin() ) { @@ -157,7 +157,9 @@ namespace Kassiopeia if( GetSpinAngle() != aParticle.GetSpinAngle() ) { - fData[ 9 ] = std::fmod( fSpinAngle, 2*KConst::Pi() ); + fSpinAngle = aParticle.GetSpinAngle(); + + fData[ 9 ] = std::fmod( fSpinAngle, 2.*KConst::Pi() ); } FixSpin(); @@ -180,7 +182,7 @@ namespace Kassiopeia aParticle.SetTime( GetTime() ); aParticle.SetAlignedSpin( GetAlignedSpin() ); - aParticle.SetSpinAngle( std::fmod( GetSpinAngle(), 2*KConst::Pi() ) ); + aParticle.SetSpinAngle( std::fmod( GetSpinAngle(), 2.*KConst::Pi() ) ); if( fGetMagneticFieldPtr == &KSTrajAdiabaticSpinParticle::DoNothing ) { diff --git a/Kassiopeia/Trajectories/Source/KSTrajInterpolatorFast.cxx b/Kassiopeia/Trajectories/Source/KSTrajInterpolatorFast.cxx index 315af70fe..8358d0907 100644 --- a/Kassiopeia/Trajectories/Source/KSTrajInterpolatorFast.cxx +++ b/Kassiopeia/Trajectories/Source/KSTrajInterpolatorFast.cxx @@ -98,6 +98,7 @@ namespace Kassiopeia double tInterpolatedMomentumMagnitude = tInitialMomentumMagnitude + tFraction * (tFinalMomentumMagnitude - tInitialMomentumMagnitude); // does not interpolate spin + trajmsg( eWarning ) << "Fast interpolation does not interpolate spins." << eom; anIntermediateParticle = 0.; anIntermediateParticle[ 0 ] = tInterpolatedTime; @@ -145,6 +146,7 @@ namespace Kassiopeia double tInterpolatedMomentumMagnitude = tInitialMomentumMagnitude + tFraction * (tFinalMomentumMagnitude - tInitialMomentumMagnitude); // does not interpolate spin + trajmsg( eWarning ) << "Fast interpolation does not interpolate spins." << eom; anIntermediateParticle = 0.; anIntermediateParticle[ 0 ] = tInterpolatedTime; diff --git a/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx b/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx index a2fb37ab3..f87d2e7b1 100644 --- a/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx +++ b/Kassiopeia/Trajectories/Source/KSTrajTermPropagation.cxx @@ -43,6 +43,7 @@ namespace Kassiopeia KThreeVector MagneticMoment = aParticle.GetGyromagneticRatio() * aParticle.GetSpin() / aParticle.GetSpin().Magnitude() * aParticle.GetSpinMagnitude() * KConst::Hbar(); KThreeMatrix MagneticGradient = aParticle.GetMagneticGradient(); + double F1 = -MagneticMoment.X() * MagneticGradient[8] + MagneticMoment.Z() * MagneticGradient[2] - MagneticMoment.X() * MagneticGradient[4] + MagneticMoment.Y() * MagneticGradient[1]; double F2 = -MagneticMoment.Y() * MagneticGradient[0] + MagneticMoment.X() * MagneticGradient[3] - MagneticMoment.Y() * MagneticGradient[8] + MagneticMoment.Z() * MagneticGradient[5]; double F3 = -MagneticMoment.Z() * MagneticGradient[4] + MagneticMoment.Y() * MagneticGradient[7] - MagneticMoment.Z() * MagneticGradient[0] + MagneticMoment.X() * MagneticGradient[6]; @@ -118,63 +119,6 @@ namespace Kassiopeia return; } - // void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajExactSpinParticle& aParticle, KSTrajExactSpinDerivative& aDerivative ) const - // { - // double TempSN = std::sqrt( aParticle.GetSpin().MagnitudeSquared() - aParticle.GetSpin0() * aParticle.GetSpin0() ); - // - // KThreeVector tVelocity = fDirection * aParticle.GetVelocity(); - // - // KThreeVector MagneticMoment = aParticle.GetGyromagneticRatio() * aParticle.GetSpin() / aParticle.GetSpin().Magnitude() * aParticle.GetSpinMagnitude() * KConst::Hbar(); - // KThreeMatrix MagneticGradient = aParticle.GetMagneticGradient(); - // //double F1 = -MagneticMoment.X() * MagneticGradient[8] + MagneticMoment.Z() * MagneticGradient[2] - MagneticMoment.X() * MagneticGradient[4] + MagneticMoment.Y() * MagneticGradient[1]; - // //double F2 = -MagneticMoment.Y() * MagneticGradient[0] + MagneticMoment.X() * MagneticGradient[3] - MagneticMoment.Y() * MagneticGradient[8] + MagneticMoment.Z() * MagneticGradient[5]; - // //double F3 = -MagneticMoment.Z() * MagneticGradient[4] + MagneticMoment.Y() * MagneticGradient[7] - MagneticMoment.Z() * MagneticGradient[0] + MagneticMoment.X() * MagneticGradient[6]; - // double F1 = MagneticMoment.X() * MagneticGradient[0] + MagneticMoment.Y() * MagneticGradient[1] + MagneticMoment.Z() * MagneticGradient[2]; - // double F2 = MagneticMoment.X() * MagneticGradient[3] + MagneticMoment.Y() * MagneticGradient[4] + MagneticMoment.Z() * MagneticGradient[5]; - // double F3 = MagneticMoment.X() * MagneticGradient[6] + MagneticMoment.Y() * MagneticGradient[7] + MagneticMoment.Z() * MagneticGradient[8]; - // KThreeVector DipoleForce ( F1, F2, F3 ); - // - // KThreeVector tForce = aParticle.GetCharge() * (aParticle.GetElectricField() + tVelocity.Cross( aParticle.GetMagneticField() )) + DipoleForce; - // - // double SFU; - // { - // // FU - // double Temp0 = aParticle.GetLorentzFactor() * aParticle.GetElectricField().Dot( aParticle.GetVelocity() ); - // double Temp1 = aParticle.GetLorentzFactor() * ( aParticle.GetElectricField().X() * KConst::C() + aParticle.GetMagneticField().Z() * aParticle.GetVelocity().Y() * KConst::C() - aParticle.GetMagneticField().Y() * aParticle.GetVelocity().Z() * KConst::C() ); - // double Temp2 = aParticle.GetLorentzFactor() * ( aParticle.GetElectricField().Y() * KConst::C() - aParticle.GetMagneticField().Z() * aParticle.GetVelocity().X() * KConst::C() + aParticle.GetMagneticField().X() * aParticle.GetVelocity().Z() * KConst::C() ); - // double Temp3 = aParticle.GetLorentzFactor() * ( aParticle.GetElectricField().Z() * KConst::C() + aParticle.GetMagneticField().Y() * aParticle.GetVelocity().X() * KConst::C() - aParticle.GetMagneticField().X() * aParticle.GetVelocity().Y() * KConst::C() ); - // - // // SFU - // SFU = Temp0 * aParticle.GetSpin0() - Temp1 * aParticle.GetSpin().X() - Temp2 * aParticle.GetSpin().Y() - Temp3 * aParticle.GetSpin().Z(); - // } - // - // // FS - // double FS0 = aParticle.GetElectricField().Dot( aParticle.GetSpin() ); - // double Temp1 = aParticle.GetElectricField().X() * aParticle.GetSpin0() + aParticle.GetMagneticField().Z() * aParticle.GetSpin().Y() * KConst::C() - aParticle.GetMagneticField().Y() * aParticle.GetSpin().Z() * KConst::C(); - // double Temp2 = aParticle.GetElectricField().Y() * aParticle.GetSpin0() - aParticle.GetMagneticField().Z() * aParticle.GetSpin().X() * KConst::C() + aParticle.GetMagneticField().X() * aParticle.GetSpin().Z() * KConst::C(); - // double Temp3 = aParticle.GetElectricField().Z() * aParticle.GetSpin0() + aParticle.GetMagneticField().Y() * aParticle.GetSpin().X() * KConst::C() - aParticle.GetMagneticField().X() * aParticle.GetSpin().Y() * KConst::C(); - // KThreeVector FS ( Temp1, Temp2, Temp3 ); - // - // double SDU; - // { - // // dU/dtau - // double DU0 = aParticle.GetLorentzFactor() / aParticle.GetMass() / KConst::C() * aParticle.GetVelocity().Dot( tForce ); - // KThreeVector DU = aParticle.GetLorentzFactor() / aParticle.GetMass() * tForce; - // // SdU/dtau - // SDU = aParticle.GetSpin0() * DU0 - aParticle.GetSpin().Dot(DU); - // } - // - // double tOmega0 = -aParticle.GetGyromagneticRatio() / KConst::C() * ( FS0 + aParticle.GetLorentzFactor() / KConst::C() * SFU ) - aParticle.GetLorentzFactor() / KConst::C() * SDU; - // KThreeVector tOmega = -aParticle.GetGyromagneticRatio() / KConst::C() * ( FS - aParticle.GetLorentzFactor() * aParticle.GetVelocity() / KConst::C() / KConst::C() * SFU ) + aParticle.GetLorentzFactor() * aParticle.GetVelocity() / KConst::C() / KConst::C() * SDU; - // - // aDerivative.AddToVelocity( tVelocity ); - // aDerivative.AddToForce( tForce / TempSN ); - // aDerivative.AddToOmega0( tOmega0 / TempSN ); - // aDerivative.AddToOmega( tOmega / TempSN ); - // - // return; - // } - void KSTrajTermPropagation::Differentiate(double /*aTime*/, const KSTrajAdiabaticParticle& aParticle, KSTrajAdiabaticDerivative& aDerivative ) const { double tLongVelocity = fDirection * aParticle.GetLongVelocity(); @@ -208,27 +152,30 @@ namespace Kassiopeia { KThreeVector e3 = aParticle.GetMagneticField() / aParticle.GetMagneticField().Magnitude(); // = b - KThreeVector E1 ( e3.Z() - e3.Y(), e3.X() - e3.Z(), e3.Y() - e3.X() ); + KThreeVector E1 ( e3.Z(), 0. , -e3.X() ); KThreeVector e1 = E1 / E1.Magnitude(); KThreeVector e2 = e3.Cross( e1 ); - KThreeVector a = -1 * e1 * sin( aParticle.GetSpinAngle() ) + e2 * cos( aParticle.GetSpinAngle() ); + KThreeVector a = -1. * e1 * sin( aParticle.GetSpinAngle() ) + e2 * cos( aParticle.GetSpinAngle() ); KThreeVector c = e1 * cos( aParticle.GetSpinAngle() ) + e2 * sin( aParticle.GetSpinAngle() ); - KThreeVector GradBMagnitude = aParticle.GetMagneticGradient() * aParticle.GetMagneticField() / aParticle.GetMagneticField().Magnitude(); - KThreeMatrix GradBDirection = aParticle.GetMagneticGradient() / aParticle.GetMagneticField().Magnitude() - KThreeMatrix::OuterProduct( aParticle.GetMagneticField(), GradBMagnitude ) / aParticle.GetMagneticField().Magnitude() / aParticle.GetMagneticField().Magnitude(); - KThreeMatrix GradE1 ( GradBDirection[ 6 ] - GradBDirection[ 3 ], GradBDirection[ 7 ] - GradBDirection[ 4 ], GradBDirection[ 8 ] - GradBDirection[ 5 ], - GradBDirection[ 0 ] - GradBDirection[ 6 ], GradBDirection[ 1 ] - GradBDirection[ 7 ], GradBDirection[ 2 ] - GradBDirection[ 8 ], - GradBDirection[ 3 ] - GradBDirection[ 0 ], GradBDirection[ 4 ] - GradBDirection[ 1 ], GradBDirection[ 5 ] - GradBDirection[ 2 ] ); - KThreeVector GradE1Magnitude = GradE1 * E1 / E1.Magnitude(); + KThreeVector GradBMagnitude = aParticle.GetMagneticField() * aParticle.GetMagneticGradient() / aParticle.GetMagneticField().Magnitude(); + KThreeMatrix GradBDirection = aParticle.GetMagneticGradient() / aParticle.GetMagneticField().Magnitude() + - KThreeMatrix::OuterProduct( aParticle.GetMagneticField(), GradBMagnitude ) / aParticle.GetMagneticField().Magnitude() + / aParticle.GetMagneticField().Magnitude(); + KThreeMatrix GradE1 ( GradBDirection[ 6 ] , 0. , -GradBDirection[ 0 ] , + GradBDirection[ 7 ] , 0. , -GradBDirection[ 1 ] , + GradBDirection[ 8 ] , 0. , -GradBDirection[ 2 ] ); + KThreeVector GradE1Magnitude = E1 * GradE1 / E1.Magnitude(); KThreeMatrix Grade1 = GradE1 / E1.Magnitude() - KThreeMatrix::OuterProduct( E1, GradE1Magnitude ) / E1.Magnitude() / E1.Magnitude(); KThreeVector A = Grade1 * e2; KThreeVector tVelocity = fDirection * aParticle.GetVelocity(); KThreeVector tForce = aParticle.GetCharge() * (aParticle.GetElectricField() + tVelocity.Cross( aParticle.GetMagneticField() )) + aParticle.GetGyromagneticRatio() * aParticle.GetSpinMagnitude() * KConst::Hbar() * aParticle.GetAlignedSpin() * GradBMagnitude - + aParticle.GetMagneticField().Magnitude() * aParticle.GetGyromagneticRatio() * aParticle.GetSpinMagnitude() * KConst::Hbar() * sqrt( 1 - aParticle.GetAlignedSpin() * aParticle.GetAlignedSpin() ) * ( GradBDirection * c ); - double tMDot = aParticle.GetGyromagneticRatio() * aParticle.GetSpinMagnitude() * KConst::Hbar() * sqrt( 1 - aParticle.GetAlignedSpin() * aParticle.GetAlignedSpin() ) * tVelocity * GradBDirection * c; + + aParticle.GetMagneticField().Magnitude() * aParticle.GetGyromagneticRatio() * aParticle.GetSpinMagnitude() * KConst::Hbar() + * sqrt( 1 - aParticle.GetAlignedSpin() * aParticle.GetAlignedSpin() ) * ( GradBDirection * c ); + double tMDot = sqrt( 1 - aParticle.GetAlignedSpin() * aParticle.GetAlignedSpin() ) * tVelocity * GradBDirection * c; double tPhiDot = - aParticle.GetGyromagneticRatio() * aParticle.GetMagneticField().Magnitude() - aParticle.GetVelocity().Dot( A ) - aParticle.GetAlignedSpin() / sqrt( 1 - aParticle.GetAlignedSpin() * aParticle.GetAlignedSpin() ) * ( aParticle.GetVelocity() * GradBDirection * a ); diff --git a/Kassiopeia/Writers/CMakeLists.txt b/Kassiopeia/Writers/CMakeLists.txt index 94e1d5c40..8768f6e38 100644 --- a/Kassiopeia/Writers/CMakeLists.txt +++ b/Kassiopeia/Writers/CMakeLists.txt @@ -15,11 +15,12 @@ if( Kassiopeia_USE_ROOT ) KSWriteROOT.h KSWriteROOTCondition.h KSWriteROOTConditionOutput.h + KSWriteROOTConditionPeriodic.h KSWriteROOTConditionTerminator.h KSWriteROOTConditionStep.h ) endif( Kassiopeia_USE_ROOT ) -set( WRITERS_HEADER_PATH +set( WRITERS_HEADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Include ) foreach( BASENAME ${WRITERS_HEADER_BASENAMES} ) @@ -44,7 +45,7 @@ if( Kassiopeia_USE_ROOT ) KSWriteROOTCondition.cxx ) endif( Kassiopeia_USE_ROOT ) -set( WRITERS_SOURCE_PATH +set( WRITERS_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Source ) foreach( BASENAME ${WRITERS_SOURCE_BASENAMES} ) @@ -53,7 +54,7 @@ endforeach( BASENAME ) if( Kassiopeia_USE_VTK ) if( VTK_MAJOR_VERSION GREATER 5 ) - set_property( SOURCE ${WRITERS_SOURCE_FILENAMES} APPEND PROPERTY + set_property( SOURCE ${WRITERS_SOURCE_FILENAMES} APPEND PROPERTY COMPILE_DEFINITIONS VTK6 ) endif() endif( Kassiopeia_USE_VTK ) @@ -61,7 +62,7 @@ endif( Kassiopeia_USE_VTK ) # data files set( WRITERS_DATA_BASENAMES ) -set( WRITERS_DATA_PATH +set( WRITERS_DATA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Data ) foreach( BASENAME ${WRITERS_DATA_BASENAMES} ) diff --git a/Kassiopeia/Writers/Include/KSWriteROOTConditionPeriodic.h b/Kassiopeia/Writers/Include/KSWriteROOTConditionPeriodic.h new file mode 100644 index 000000000..7d8e5ced4 --- /dev/null +++ b/Kassiopeia/Writers/Include/KSWriteROOTConditionPeriodic.h @@ -0,0 +1,96 @@ +#ifndef Kassiopeia_KSWriteROOTConditionPeriodic_h_ +#define Kassiopeia_KSWriteROOTConditionPeriodic_h_ + +#include "KSComponent.h" +#include "KSWriteROOTCondition.h" +#include "KField.h" +#include + +namespace Kassiopeia +{ + + template< class XValueType > + class KSWriteROOTConditionPeriodic : + public KSComponentTemplate< KSWriteROOTConditionPeriodic, KSWriteROOTCondition > + { + public: + KSWriteROOTConditionPeriodic() : + fInitialMin( -1.0*std::numeric_limits< XValueType >::max() ), //NOTE: defaults to always-on after reset + fInitialMax( std::numeric_limits::max() ), + fIncrement( 0. ), + fResetMin( 0. ), + fResetMax( 0. ), + fComponent( 0 ), + fValue( 0 ), + fDone( false ), + fMinValue( std::numeric_limits< XValueType >::max() ), //NOTE: defaults to always-off until reset + fMaxValue( -1.0*std::numeric_limits::max() ) + { + } + KSWriteROOTConditionPeriodic( const KSWriteROOTConditionPeriodic& aCopy ) : + KSComponent(aCopy), + fInitialMin( aCopy.fInitialMin ), + fInitialMax( aCopy.fInitialMax ), + fIncrement( aCopy.fIncrement ), + fResetMin( aCopy.fResetMin ), + fResetMax( aCopy.fResetMax ), + fComponent( aCopy.fComponent ), + fValue( aCopy.fValue ), + fDone( aCopy.fDone ), + fMinValue( aCopy.fMinValue ), + fMaxValue( aCopy.fMaxValue ) + { + } + KSWriteROOTConditionPeriodic* Clone() const + { + return new KSWriteROOTConditionPeriodic( *this ); + } + virtual ~KSWriteROOTConditionPeriodic() + { + } + + void CalculateWriteCondition( bool& aFlag ) + { + if (*fValue >= fResetMin && *fValue <= fResetMax ) // NOTE: this needs to occur even before the first use + { + fDone = false; + fMinValue = fInitialMin; + fMaxValue = fInitialMax; + } + + if ( *fValue >= fMaxValue || *fValue <= fMinValue ) + { + aFlag = false; + return; + } + + aFlag = true; + + fDone = true; + + fMinValue = fMinValue + fIncrement; + fMaxValue = fMaxValue + fIncrement; + + return; + } + + + protected: + ;K_SET_GET(double, InitialMin); + ;K_SET_GET(double, InitialMax); + ;K_SET_GET(double, Increment); + ;K_SET_GET(double, ResetMin); + ;K_SET_GET(double, ResetMax); + ;K_SET_GET_PTR(KSComponent, Component); + ;K_SET_GET_PTR( XValueType, Value ); + + private: + bool fDone; + double fMinValue; + double fMaxValue; + + }; + +} + +#endif diff --git a/Kassiopeia/XML/CMakeLists.txt b/Kassiopeia/XML/CMakeLists.txt index 1765deb2c..5e6519a36 100644 --- a/Kassiopeia/XML/CMakeLists.txt +++ b/Kassiopeia/XML/CMakeLists.txt @@ -32,13 +32,13 @@ if( Kassiopeia_USE_VTK ) Examples/VTK/ToricTrapSimulation.xml Examples/VTK/PhotoMultiplierTubeSimulation.xml ) -else( Kassiopeia_USE_VTK ) - kasper_install_config_subdir( Examples - Examples/AnalyticSimulation.xml - Examples/QuadrupoleTrapSimulation.xml - Examples/DipoleTrapSimulation.xml - Examples/DipoleTrapMeshedSpaceSimulation.xml - Examples/ToricTrapSimulation.xml - Examples/PhotoMultiplierTubeSimulation.xml - ) endif( Kassiopeia_USE_VTK ) + +kasper_install_config_subdir( Examples + Examples/AnalyticSimulation.xml + Examples/QuadrupoleTrapSimulation.xml + Examples/DipoleTrapSimulation.xml + Examples/DipoleTrapMeshedSpaceSimulation.xml + Examples/ToricTrapSimulation.xml + Examples/PhotoMultiplierTubeSimulation.xml +) diff --git a/Kassiopeia/XML/Examples/QuadrupoleTrapSimulation.xml b/Kassiopeia/XML/Examples/QuadrupoleTrapSimulation.xml index e4892ca6f..66a411fe4 100644 --- a/Kassiopeia/XML/Examples/QuadrupoleTrapSimulation.xml +++ b/Kassiopeia/XML/Examples/QuadrupoleTrapSimulation.xml @@ -6,28 +6,28 @@ - + - + - + - - + + - - + + - - - - - - - + + + + + + + @@ -141,7 +141,7 @@ - + - + @@ -253,7 +253,7 @@ - + @@ -263,7 +263,7 @@ - + @@ -303,6 +303,7 @@ + @@ -329,6 +330,7 @@ + diff --git a/Kassiopeia/XML/Validation/TestDiscreteRotationalField.xml b/Kassiopeia/XML/Validation/TestDiscreteRotationalField.xml index 7e024c7e0..8dbb6dc34 100644 --- a/Kassiopeia/XML/Validation/TestDiscreteRotationalField.xml +++ b/Kassiopeia/XML/Validation/TestDiscreteRotationalField.xml @@ -2,7 +2,7 @@ - + @@ -11,6 +11,7 @@ + @@ -20,7 +21,6 @@ - @@ -40,7 +40,8 @@ - + + @@ -50,7 +51,8 @@ - + + @@ -110,22 +112,13 @@ - - - - - - - - - - - + - - - - - - - + diff --git a/Kassiopeia/XML/Validation/TestElectricFieldLines.xml b/Kassiopeia/XML/Validation/TestElectricFieldLines.xml index 874c55b7a..44b06244d 100644 --- a/Kassiopeia/XML/Validation/TestElectricFieldLines.xml +++ b/Kassiopeia/XML/Validation/TestElectricFieldLines.xml @@ -124,15 +124,17 @@ surfaces="world/platecap/#" symmetry="none" > - - diff --git a/Kommon/Boost/Utility/KStringUtils.h b/Kommon/Boost/Utility/KStringUtils.h index e2b8bc8be..e9805da81 100644 --- a/Kommon/Boost/Utility/KStringUtils.h +++ b/Kommon/Boost/Utility/KStringUtils.h @@ -9,7 +9,7 @@ #ifndef KSTRINGUTILS_H_ #define KSTRINGUTILS_H_ -#include +#include "KRandom.h" #include #include @@ -40,6 +40,9 @@ class KStringUtils static bool IsNumeric(const char& character); static bool IsNumeric(const std::string& string); + template< typename TargetT > + static bool Convert(const std::string& string, TargetT& result); + template static bool Equals(const Range1T &, const Range2T &); @@ -58,6 +61,10 @@ class KStringUtils template static bool IContainsOneOf(const Range1T &, std::initializer_list); + static std::string Trim(const std::string& input); + static std::string TrimLeft(const std::string& input); + static std::string TrimRight(const std::string& input); + template static std::ostream& Join(std::ostream& stream, const SequenceT& sequence, const SeparatorT& separator); @@ -111,6 +118,18 @@ inline bool KStringUtils::IsNumeric(const std::string& string) } } +template< typename TargetT > +inline bool KStringUtils::Convert(const std::string& string, TargetT& result) +{ + try { + result = boost::lexical_cast(string); + return true; + } + catch (boost::bad_lexical_cast&) { + return false; + } +} + template inline bool KStringUtils::Equals(const Range1T& r1, const Range2T& r2) { @@ -153,6 +172,21 @@ inline bool KStringUtils::IContainsOneOf(const Range1T& r1, std::initializer_lis return false; } +inline std::string KStringUtils::Trim(const std::string& input) +{ + return boost::algorithm::trim_copy(input); +} + +inline std::string KStringUtils::TrimLeft(const std::string& input) +{ + return boost::algorithm::trim_left_copy(input); +} + +inline std::string KStringUtils::TrimRight(const std::string& input) +{ + return boost::algorithm::trim_right_copy(input); +} + template inline std::ostream& KStringUtils::Join(std::ostream& stream, const SequenceT& sequence, const SeparatorT& separator) { diff --git a/Kommon/CMakeLists.txt b/Kommon/CMakeLists.txt index 641fd9dcf..611914de0 100644 --- a/Kommon/CMakeLists.txt +++ b/Kommon/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required( VERSION ${CMAKE_MINIMUM_VERSION} ) # Kommon version set( MODULE_VERSION_MAJOR 1 ) -set( MODULE_VERSION_MINOR 2 ) +set( MODULE_VERSION_MINOR 3 ) set( MODULE_VERSION_PATCH 0 ) set( MODULE_VERSION "${MODULE_VERSION_MAJOR}.${MODULE_VERSION_MINOR}.${MODULE_VERSION_PATCH}" ) @@ -29,21 +29,19 @@ kasper_module_debug() set(EXTERNAL_LIBRARIES) # external -option( Kommon_USE_Log4CXX "Enable advanced logging facilities, if LOG4CXX library is available." OFF ) +find_package( Log4CXX ) +if(LOG4CXX_FOUND) + option( Kommon_USE_Log4CXX "Enable advanced logging facilities, if LOG4CXX library is available." ON ) +endif() mark_as_advanced( CLEAR Kommon_USE_Log4CXX ) -set(LOG4CXX_FOUND FALSE) if(Kommon_USE_Log4CXX) - find_package( Log4CXX ) - - if( LOG4CXX_FOUND ) set(LOGGER_CONFIGURATION "${Kommon_CONFIG_INSTALL_DIR}/log4cxx.properties" ) set_source_files_properties(Core/Logging/KLogger.cxx PROPERTIES COMPILE_DEFINITIONS "LOG4CXX;LOGGER_CONFIGURATION=${LOGGER_CONFIGURATION}" ) kasper_external_include_directories( ${LOG4CXX_INCLUDE_DIR} ) list(APPEND EXTERNAL_LIBRARIES ${LOG4CXX_LIBRARY} ) - endif() endif() # to be populated by subdirectories diff --git a/Kommon/Core/CMakeLists.txt b/Kommon/Core/CMakeLists.txt index d7bb410bc..a002b5137 100644 --- a/Kommon/Core/CMakeLists.txt +++ b/Kommon/Core/CMakeLists.txt @@ -89,6 +89,8 @@ set(KOMMON_CORE_HEADER_FILES Utility/KMessageBuilder.h Utility/KNamedBuilder.h Utility/KProgressDisplay.h + Utility/PositiveValue.h + Utility/Printable.h Logging/KLogger.h ) @@ -135,9 +137,12 @@ set(KOMMON_CORE_SOURCE_FILES Utility/KToolbox.cxx Utility/KMessageBuilder.cxx Utility/KNamedBuilder.cxx + Utility/Printable.cxx Logging/KLogger.cxx ) +set_source_files_properties(Initialization/KVariant.cxx PROPERTIES COMPILE_FLAGS -D__GLIBCXX_USE_CXX11_ABI=0) + if( LOG4CXX_FOUND ) if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "DEBUG" OR CMAKE_BUILD_TYPE MATCHES "RELWITHDEBINFO" ) set (LEVEL "DEBUG") diff --git a/Kommon/Core/Initialization/KArgumentList.cxx b/Kommon/Core/Initialization/KArgumentList.cxx index 7bd2a5801..b678fa662 100644 --- a/Kommon/Core/Initialization/KArgumentList.cxx +++ b/Kommon/Core/Initialization/KArgumentList.cxx @@ -10,7 +10,7 @@ #include #include #include -#include +#include "KVariant.h" #include "KArgumentList.h" diff --git a/Kommon/Core/Initialization/KArgumentList.h b/Kommon/Core/Initialization/KArgumentList.h index 132d04c98..8a76d4ef2 100644 --- a/Kommon/Core/Initialization/KArgumentList.h +++ b/Kommon/Core/Initialization/KArgumentList.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include "KVariant.h" namespace katrin { diff --git a/Kommon/Core/Initialization/KAttributeBase.cc b/Kommon/Core/Initialization/KAttributeBase.cc index b73698d8c..2bf173a03 100644 --- a/Kommon/Core/Initialization/KAttributeBase.cc +++ b/Kommon/Core/Initialization/KAttributeBase.cc @@ -17,7 +17,7 @@ namespace katrin //add value to this element if( SetValue( aToken ) == false ) { - initmsg( eError ) << "element <" << fName << "> could not process value <" << aToken->GetValue() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> could not process value <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } @@ -26,7 +26,7 @@ namespace katrin } void KAttributeBase::ProcessToken( KErrorToken* aToken ) { - initmsg( eError ) << "element <" << fName << "> encountered an error <" << aToken->GetValue() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> encountered an error <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } diff --git a/Kommon/Core/Initialization/KElementBase.cc b/Kommon/Core/Initialization/KElementBase.cc index 13f2261e1..f69f96d04 100644 --- a/Kommon/Core/Initialization/KElementBase.cc +++ b/Kommon/Core/Initialization/KElementBase.cc @@ -26,7 +26,7 @@ namespace katrin KElementCIt It = fElements->find( aToken->GetValue() ); if( It == fElements->end() ) { - initmsg( eError ) << "nothing registered for element <" << aToken->GetValue() << "> in element <" << fName << ">" << ret; + initmsg( eError ) << "nothing registered for element <" << aToken->GetValue() << "> in element <" << GetName() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } @@ -63,7 +63,7 @@ namespace katrin KAttributeCIt It = fAttributes->find( aToken->GetValue() ); if( It == fAttributes->end() ) { - initmsg( eError ) << "nothing registered for attribute <" << aToken->GetValue() << "> in element <" << fName << ">" << ret; + initmsg( eError ) << "nothing registered for attribute <" << aToken->GetValue() << "> in element <" << GetName() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } @@ -92,7 +92,7 @@ namespace katrin //add attribute to this element if( AddAttribute( fChildAttribute ) == false ) { - initmsg( eError ) << "element <" << fName << "> could not process attribute <" << fChildAttribute->GetName() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> could not process attribute <" << fChildAttribute->GetName() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; } @@ -139,7 +139,7 @@ namespace katrin //add value to this element if( SetValue( aToken ) == false ) { - initmsg( eError ) << "element <" << fName << "> could not process value <" << aToken->GetValue() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> could not process value <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } @@ -166,7 +166,7 @@ namespace katrin //add child element to this element if( AddElement( fChildElement ) == false ) { - initmsg( eError ) << "element <" << fName << "> could not process element <" << aToken->GetValue() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> could not process element <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } @@ -190,7 +190,7 @@ namespace katrin { if( fElementDepth == 0 && fAttributeDepth == 0 ) { - initmsg( eError ) << "element <" << fName << "> encountered an error <" << aToken->GetValue() << ">" << ret; + initmsg( eError ) << "element <" << GetName() << "> encountered an error <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "> in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << "> at column <" << aToken->GetColumn() << ">" << eom; return; } diff --git a/Kommon/Core/Initialization/KIncludeProcessor.cc b/Kommon/Core/Initialization/KIncludeProcessor.cc index aca6ff6fe..bbe405eba 100644 --- a/Kommon/Core/Initialization/KIncludeProcessor.cc +++ b/Kommon/Core/Initialization/KIncludeProcessor.cc @@ -21,6 +21,7 @@ namespace katrin KProcessor(), fElementState( eElementInactive ), fAttributeState( eAttributeInactive ), + fOptionalFlag(false), fNames(), fPaths(), fBases(), @@ -88,6 +89,11 @@ namespace katrin fAttributeState = eBase; return; } + if( aToken->GetValue() == "optional" ) + { + fAttributeState = eOptionalFlag; + return; + } initmsg( eError ) << "got unknown attribute <" << aToken->GetValue() << ">" << ret; initmsg( eError ) << "in path <" << aToken->GetPath() << "in file <" << aToken->GetFile() << "> at line <" << aToken->GetLine() << ">, column <" << aToken->GetColumn() << ">" << eom; @@ -107,6 +113,7 @@ namespace katrin if( fElementState == eActive ) { + if( fAttributeState == eName ) { fNames.push_back( aToken->GetValue() ); @@ -127,6 +134,13 @@ namespace katrin fAttributeState = eAttributeComplete; return; } + + if( fAttributeState == eOptionalFlag ) + { + fOptionalFlag = aToken->GetValue(); + fAttributeState = eAttributeComplete; + return; + } } return; @@ -212,72 +226,80 @@ namespace katrin for( const string& base : fBases ) aFile->AddToBases( base ); - if( aFile->Open( KFile::eRead ) == false ) + bool HasFile = aFile->Open( KFile::eRead ); + if( HasFile == false ) { delete aFile; - vector::const_iterator It; - - initmsg( eError ) << "unable to open file with names <"; - It = fNames.begin(); - while( It != fNames.end() ) + if (fOptionalFlag == false) { - initmsg << *It; - It++; - if( It != fNames.end() ) + vector::const_iterator It; + + initmsg( eError ) << "unable to open file with names <"; + It = fNames.begin(); + while( It != fNames.end() ) { - initmsg << ","; + initmsg << *It; + It++; + if( It != fNames.end() ) + { + initmsg << ","; + } } - } - initmsg << "> and paths <"; - It = fPaths.begin(); - while( It != fPaths.end() ) - { - initmsg << *It; - It++; - if( It != fPaths.end() ) + initmsg << "> and paths <"; + It = fPaths.begin(); + while( It != fPaths.end() ) { - initmsg << ","; + initmsg << *It; + It++; + if( It != fPaths.end() ) + { + initmsg << ","; + } } - } - initmsg << "> and bases <"; - It = fBases.begin(); - while( It != fBases.end() ) - { - initmsg << *It; - It++; - if( It != fBases.end() ) + initmsg << "> and bases <"; + It = fBases.begin(); + while( It != fBases.end() ) { - initmsg << ","; + initmsg << *It; + It++; + if( It != fBases.end() ) + { + initmsg << ","; + } } + initmsg << ">" << eom; } - initmsg << ">" << eom; } fElementState = eElementInactive; + fOptionalFlag = false; fNames.clear(); fPaths.clear(); fBases.clear(); - std::string tFileName = aFile->GetName(); - if ( std::find( fIncludedPaths.begin(), fIncludedPaths.end(), tFileName ) != fIncludedPaths.end() ) + if( HasFile == true ) { - initmsg( eWarning ) << "skipping file <" << tFileName << "> since it was already included" << eom; - } - else - { - initmsg( eInfo ) << "including file <" << tFileName << ">" << eom; - fIncludedPaths.push_back( tFileName ); + std::string tFileName = aFile->GetName(); + if ( std::find( fIncludedPaths.begin(), fIncludedPaths.end(), tFileName ) != fIncludedPaths.end() ) + { + initmsg( eWarning ) << "skipping file <" << tFileName << "> since it was already included" << eom; + } + else + { + initmsg( eInfo ) << "including file <" << tFileName << ">" << eom; + fIncludedPaths.push_back( tFileName ); - KXMLTokenizer* aNewTokenizer = new KXMLTokenizer(); - aNewTokenizer->InsertBefore( GetFirstParent() ); - aNewTokenizer->ProcessFile( aFile ); - aNewTokenizer->Remove(); + KXMLTokenizer* aNewTokenizer = new KXMLTokenizer(); + aNewTokenizer->InsertBefore( GetFirstParent() ); + aNewTokenizer->ProcessFile( aFile ); + aNewTokenizer->Remove(); - delete aNewTokenizer; - } + delete aNewTokenizer; + } - delete aFile; + delete aFile; + } } return; diff --git a/Kommon/Core/Initialization/KIncludeProcessor.hh b/Kommon/Core/Initialization/KIncludeProcessor.hh index 29e368438..aeff0a08d 100644 --- a/Kommon/Core/Initialization/KIncludeProcessor.hh +++ b/Kommon/Core/Initialization/KIncludeProcessor.hh @@ -36,10 +36,12 @@ namespace katrin typedef enum { - eAttributeInactive, eName, ePath, eBase, eAttributeComplete + eAttributeInactive, eName, ePath, eBase, eOptionalFlag, eAttributeComplete } AttributeState; AttributeState fAttributeState; + bool fOptionalFlag; + std::vector< std::string > fNames; std::vector< std::string > fPaths; std::vector< std::string > fBases; diff --git a/Kommon/Core/Initialization/KToken.hh b/Kommon/Core/Initialization/KToken.hh index d27182330..17121c0f8 100644 --- a/Kommon/Core/Initialization/KToken.hh +++ b/Kommon/Core/Initialization/KToken.hh @@ -3,7 +3,7 @@ #include "KInitializationMessage.hh" -#include +#include "KStringUtils.h" #include #include diff --git a/Kommon/Core/Initialization/KVariant.cxx b/Kommon/Core/Initialization/KVariant.cxx index c8fb75346..98b96bba9 100644 --- a/Kommon/Core/Initialization/KVariant.cxx +++ b/Kommon/Core/Initialization/KVariant.cxx @@ -118,7 +118,7 @@ double KVariant::AsDouble(void) const << "bad type to convert to int: \"" << AsString() << "\""; } -std::string KVariant::AsString(void) const +std::string KVariant::AsString(int precision) const { if (fType == Type_String) { return *fPrimitive.fStringValue; @@ -135,7 +135,14 @@ std::string KVariant::AsString(void) const os << fPrimitive.fLongValue; } else if (fType == Type_Double) { - os << fPrimitive.fDoubleValue; + if (precision > 0) { + auto prev_precision = os.precision(precision); + os << fPrimitive.fDoubleValue; + os.precision(prev_precision); + } + else { + os << fPrimitive.fDoubleValue; + } } else { os << "Unknown@" << this; @@ -169,3 +176,26 @@ const KUnknown& KVariant::AsUnknown(void) const return *fPrimitive.fUnknownValue; } + +std::map KVariant::SplitBy(const std::string& Separator, std::vector DefaultValueList) const +{ + map Result; + for (unsigned i = 0; i < DefaultValueList.size(); i++) { + Result[i] = DefaultValueList[i]; + } + + std::string str = this->As(); + for (unsigned i = 0; ! str.empty(); i++) { + auto pos = str.find(Separator); + std::string v = str.substr(0, pos); + if (! v.empty()) { + Result[i] = KVariant(v); + } + if (pos == string::npos) { + break; + } + str = str.substr(pos + Separator.size()); + } + + return Result; +} diff --git a/Kommon/Core/Initialization/KVariant.h b/Kommon/Core/Initialization/KVariant.h index 245d25a2f..c49c455ef 100644 --- a/Kommon/Core/Initialization/KVariant.h +++ b/Kommon/Core/Initialization/KVariant.h @@ -6,6 +6,8 @@ #define KVariant_h__ #include +#include +#include #include #include #include "KException.h" @@ -60,7 +62,6 @@ class KVariant { inline void Assign(const KVariant& Value) ; public: template inline T As(void) const ; - inline KVariant Or(const KVariant& DefaultValue) const; inline operator bool() const ; inline operator int() const ; inline operator unsigned int() const ; @@ -80,11 +81,14 @@ class KVariant { inline bool IsString(void) const; inline bool IsUnknown(void) const; bool AsBool(void) const ; - long long AsLong(void) const ; - double AsDouble(void) const ; - std::string AsString(void) const; - KUnknown& AsUnknown(void) ; - const KUnknown& AsUnknown(void) const ; + long long AsLong(void) const; + double AsDouble(void) const; + std::string AsString(int precision=-1) const; + KUnknown& AsUnknown(void); + const KUnknown& AsUnknown(void) const; + public: + inline KVariant Or(const KVariant& DefaultValue) const; + std::map SplitBy(const std::string& Separator, std::vector DefaultValueList={}) const; private: enum TValueType { Type_Void, Type_Bool, Type_Long, Type_Double, Type_String, Type_Unknown @@ -366,16 +370,6 @@ inline T KVariant::As(void) const return katrin::KVariantDecoder::As(*this); } -inline KVariant KVariant::Or(const KVariant& DefaultValue) const -{ - if (fType == Type_Void) { - return DefaultValue; - } - else { - return *this; - } -} - KVariant::operator bool() const { return As(); @@ -462,6 +456,17 @@ bool KVariant::IsUnknown(void) const } +inline KVariant KVariant::Or(const KVariant& DefaultValue) const +{ + if (fType == Type_Void) { + return DefaultValue; + } + else { + return *this; + } +} + + inline std::ostream& operator<<(std::ostream& os, const KVariant& Value) { diff --git a/Kommon/Core/Utility/KApplicationRunnerBuilder.h b/Kommon/Core/Utility/KApplicationRunnerBuilder.h index 57298952c..b6d7d40d6 100644 --- a/Kommon/Core/Utility/KApplicationRunnerBuilder.h +++ b/Kommon/Core/Utility/KApplicationRunnerBuilder.h @@ -3,7 +3,7 @@ #include "KComplexElement.hh" #include "KApplicationRunner.h" -#include +#include "KNamedBuilder.h" #include "KToolbox.h" namespace katrin{ diff --git a/Kommon/Core/Utility/KConst.h b/Kommon/Core/Utility/KConst.h index 9ca00fc72..54fbdbbcc 100644 --- a/Kommon/Core/Utility/KConst.h +++ b/Kommon/Core/Utility/KConst.h @@ -255,6 +255,26 @@ class KConst return 2.0146503577 * AtomicMassUnit_eV(); } + constexpr static double M_D_kg() + { + return 2.0141017778 * AtomicMassUnit_kg(); + } //!< deuterium atom mass in kg + + constexpr static double M_D_eV() + { + return 2.0141017778 * AtomicMassUnit_eV(); + } //!< deuterium atom mass in eV/c^2 + + constexpr static double M_D2_kg() + { + return 4.0282035556 * AtomicMassUnit_kg(); + } //!< deuterium molecule mass in kg + + constexpr static double M_D2_eV() + { + return 4.0282035556 * AtomicMassUnit_eV(); + } //!< deuterium molecule mass in eV/c^2 + constexpr static double M_T_kg() { return 3.0160495 * AtomicMassUnit_kg(); @@ -310,7 +330,7 @@ class KConst constexpr static double BindingEnergy_H2() { - return 15.43; //eV + return 15.42593; //eV //Value from NIST Chemistry WebBook: http://webbook.nist.gov/cgi/cbook.cgi?ID=C1333740&Mask=20 } @@ -319,12 +339,23 @@ class KConst return 24.587387; //eV //Value from NIST Basic Atomic Spectroscopic Data Handbook: http://physics.nist.gov/PhysRefData/Handbook/Tables/heliumtable1.htm } + + constexpr static double BindingEnergy_H2O() + { + return 12.621; //eV + //Value from NIST Chemistry WebBook: https://webbook.nist.gov/cgi/cbook.cgi?ID=C7732185&Units=SI&Mask=20#Ion-Energetics + } constexpr static double Viscosity() { return 2.425E-6; } //!< tritium viscosity coefficient at T=30K [Pa s] (cite? Sharipov?) + constexpr static double DeuteriumViscosity() + { + return 2.084E-6; + } //!< deuterium viscosity coefficient at T=30K [Pa s] (https://doi.org/10.1063/1.555778, The Viscosity of Normal Deuterium in the Limit of Zero Density, Journal of Physical and Chemical Reference Data 16, 189 (1987) + //Silicon properties constexpr static double M_Si() { diff --git a/Kommon/Core/Utility/KMathIntegrator.h b/Kommon/Core/Utility/KMathIntegrator.h index aa6b46a58..87d5ece63 100644 --- a/Kommon/Core/Utility/KMathIntegrator.h +++ b/Kommon/Core/Utility/KMathIntegrator.h @@ -53,7 +53,7 @@ class KMathIntegrator : private XSamplingPolicy * @return */ template - XFloatT Integrate(XIntegrandType& func); + XFloatT Integrate(XIntegrandType&& func); /** * Perform the integration. @@ -62,7 +62,7 @@ class KMathIntegrator : private XSamplingPolicy * @return */ template - XFloatT Integrate(XIntegrandType& func, XFloatT xStart, XFloatT xEnd); + XFloatT Integrate(XIntegrandType&& func, XFloatT xStart, XFloatT xEnd); /** * Set the integration limits. @@ -113,13 +113,13 @@ class KMathIntegrator : private XSamplingPolicy void Reset(); template - XFloatT NextTrapezoid(XIntegrandType& integrand); + XFloatT NextTrapezoid(XIntegrandType&& integrand); template - XFloatT QTrap(XIntegrandType& integrand); + XFloatT QTrap(XIntegrandType&& integrand); template - XFloatT QSimp(XIntegrandType& integrand); + XFloatT QSimp(XIntegrandType&& integrand); template - XFloatT QRomb(XIntegrandType& integrand, const uint32_t K = 5); + XFloatT QRomb(XIntegrandType&& integrand, const uint32_t K = 5); XFloatT fXStart; XFloatT fXEnd; @@ -178,7 +178,7 @@ inline uint32_t KMathIntegrator::fourthRoot(uint32_t A template template -inline XFloatT KMathIntegrator::NextTrapezoid(XIntegrandType& integrand) { +inline XFloatT KMathIntegrator::NextTrapezoid(XIntegrandType&& integrand) { ++fIteration; if (fIteration == 1) { @@ -262,7 +262,7 @@ inline uint32_t KMathIntegrator::SetMaxSteps(int32_t m template template -inline XFloatT KMathIntegrator::Integrate(XIntegrandType& integrand) +inline XFloatT KMathIntegrator::Integrate(XIntegrandType&& integrand) { Reset(); @@ -287,7 +287,7 @@ inline XFloatT KMathIntegrator::Integrate(XIntegrandTy template template -inline XFloatT KMathIntegrator::Integrate(XIntegrandType& integrand, XFloatT xStart, XFloatT xEnd) +inline XFloatT KMathIntegrator::Integrate(XIntegrandType&& integrand, XFloatT xStart, XFloatT xEnd) { SetRange(xStart, xEnd); return Integrate(integrand); @@ -295,7 +295,7 @@ inline XFloatT KMathIntegrator::Integrate(XIntegrandTy template template -inline XFloatT KMathIntegrator::QTrap(XIntegrandType& integrand) +inline XFloatT KMathIntegrator::QTrap(XIntegrandType&& integrand) { /*Returns the integral of the function or functor func from a to b. The constants EPS can be set to the desired fractional accuracy and JMAX so that 2 to the power JMAX-1 is the maximum @@ -321,7 +321,7 @@ inline XFloatT KMathIntegrator::QTrap(XIntegrandType& template template -inline XFloatT KMathIntegrator::QSimp(XIntegrandType& integrand) +inline XFloatT KMathIntegrator::QSimp(XIntegrandType&& integrand) { /*Returns the integral of the function or functor func from a to b. The constants EPS can be set to the desired fractional accuracy and JMAX so that 2 to the power JMAX-1 is the maximum @@ -360,7 +360,7 @@ inline XFloatT KMathIntegrator::QSimp(XIntegrandType& template template -inline XFloatT KMathIntegrator::QRomb(XIntegrandType& integrand, const uint32_t K) +inline XFloatT KMathIntegrator::QRomb(XIntegrandType&& integrand, const uint32_t K) { /*Returns the integral of the function or functor func from a to b. Integration is performed by Romberg’s method of order 2K, where, e.g., K=2 is Simpson’s rule.*/ @@ -470,29 +470,21 @@ namespace policies { struct PlainSumming { - template - XFloatT SumSamplingPoints(uint32_t n, const XFloatT& xStart, const XFloatT& del, XIntegrandType& integrand) const + template + static Float SumSamplingPoints(uint32_t n, Float xStart, Float del, XIntegrandType&& integrand) { - XFloatT sum = 0.0; - for (uint32_t j = 0; j < n; j++) { - const XFloatT x = xStart + (XFloatT) j * del; - sum += integrand(x); - } + Sum sum = 0.0; + for (uint32_t j = 0; j < n; ++j) sum += integrand(xStart + j * del); return sum; } }; struct KahanSumming { - template - XFloatT SumSamplingPoints(uint32_t n, const XFloatT& xStart, const XFloatT& del, XIntegrandType& integrand) const + template + static Float SumSamplingPoints(uint32_t n, Float xStart, Float del, XIntegrandType&& integrand) { - KMathKahanSum sum; - for (uint32_t j = 0; j < n; j++) { - const XFloatT x = xStart + (XFloatT) j * del; - sum += integrand(x); - } - return sum; + return PlainSumming::SumSamplingPoints>(n, xStart, del, std::forward(integrand)); } }; diff --git a/Kommon/Core/Utility/KMathRegulaFalsi.h b/Kommon/Core/Utility/KMathRegulaFalsi.h index 2a93a0bb5..c5ba228c3 100644 --- a/Kommon/Core/Utility/KMathRegulaFalsi.h +++ b/Kommon/Core/Utility/KMathRegulaFalsi.h @@ -7,8 +7,8 @@ #ifndef KOMMON_CORE_UTILITY_KMATHREGULAFALSI_H_ #define KOMMON_CORE_UTILITY_KMATHREGULAFALSI_H_ -#include -#include +#include "KNumeric.h" +#include "KException.h" #include #include diff --git a/Kommon/Core/Utility/KNamed.cxx b/Kommon/Core/Utility/KNamed.cxx index ef5e39561..68f471cd5 100644 --- a/Kommon/Core/Utility/KNamed.cxx +++ b/Kommon/Core/Utility/KNamed.cxx @@ -11,8 +11,23 @@ namespace katrin fName( aNamed.fName ) { } - KNamed::~KNamed() + + bool KNamed::HasName( const std::string& aName ) const + { + return fName == aName; + } + void KNamed::SetName(std::string aName) + { + fName = std::move(aName); + } + const std::string& KNamed::GetName() const + { + return fName; + } + + void KNamed::Print(std::ostream& output) const { + output<<"<"<"; } } diff --git a/Kommon/Core/Utility/KNamed.h b/Kommon/Core/Utility/KNamed.h index b5b52e483..151679762 100644 --- a/Kommon/Core/Utility/KNamed.h +++ b/Kommon/Core/Utility/KNamed.h @@ -3,54 +3,26 @@ #include #include +#include "Printable.h" namespace katrin { - class KNamed + class KNamed : public Kommon::Printable { public: KNamed(); KNamed( const KNamed& aNamed ); - virtual ~KNamed(); - - //************** - //identification - //************** - - public: + virtual ~KNamed() = default; bool HasName( const std::string& aName ) const; const std::string& GetName() const; - void SetName( const std::string& aName ); + void SetName(std::string aName); + void Print(std::ostream& output) const; - protected: + private: std::string fName; }; - inline bool KNamed::HasName( const std::string& aName ) const - { - if( fName == aName ) - { - return true; - } - return false; - } - inline void KNamed::SetName( const std::string& aName ) - { - fName = aName; - return; - } - inline const std::string& KNamed::GetName() const - { - return fName; - } - - inline std::ostream& operator<<( std::ostream& aStream, const KNamed& aNamed ) - { - aStream << "<" << aNamed.GetName() << ">"; - return aStream; - } - } #endif diff --git a/Kommon/Core/Utility/KSmartPointer.h b/Kommon/Core/Utility/KSmartPointer.h index a6f198f8b..0aa666387 100644 --- a/Kommon/Core/Utility/KSmartPointer.h +++ b/Kommon/Core/Utility/KSmartPointer.h @@ -4,6 +4,8 @@ #include #include +#pragma message "KSmartPointer is deprecated! Use std::shared_ptr or std::unique_ptr instead." + namespace katrin { diff --git a/Kommon/Core/Utility/PositiveValue.h b/Kommon/Core/Utility/PositiveValue.h new file mode 100644 index 000000000..0a34ecd3d --- /dev/null +++ b/Kommon/Core/Utility/PositiveValue.h @@ -0,0 +1,133 @@ +#ifndef KOMMON_POSITIVE_VALUE_H +#define KOMMON_POSITIVE_VALUE_H + +/** + * @file PositiveValue.h + * @brief Inherit from this class to enforce positive values. Provide a Name implementation. + * @date 22.11.2018 + * @author Valerian Sibille + */ + +#include +#include +#include "KException.h" + +namespace katrin{ + +namespace Kommon{ + + template + class PositiveValue{ + + ValueType value; + + const Quantity& Derived() const; + Quantity& Derived(); + bool Invalid() const; + void ThrowIfInvalid() const; + public: + PositiveValue(); + explicit PositiveValue(ValueType value_); + operator ValueType() const; + void SetValue(ValueType value_); + Quantity& operator+=(const Quantity& other); + Quantity& operator+=(const ValueType& value_); + + protected: + ~PositiveValue() = default; + + }; + + template + std::istream& operator>>(std::istream& input, PositiveValue& positiveValue); + + // Class implementation + + template + const Quantity& PositiveValue::Derived() const{ + + return static_cast(*this); + + } + + template + Quantity& PositiveValue::Derived(){ + + return static_cast(*this); + + } + + template + bool PositiveValue::Invalid() const{ + + return value < 0; + + } + + template + void PositiveValue::ThrowIfInvalid() const{ + + if(Invalid()) throw KException()< + PositiveValue::PositiveValue():value(0.){ + + } + + template + PositiveValue::PositiveValue(ValueType value_):value(std::move(value_)){ + + ThrowIfInvalid(); + + } + + template + PositiveValue::operator ValueType() const{ + + return value; + + } + + template + void PositiveValue::SetValue(ValueType value_){ + + value = std::move(value_); + ThrowIfInvalid(); + + } + + template + Quantity& PositiveValue::operator+=(const Quantity& other){ + + value += other.value; + return Derived(); + + } + + template + Quantity& PositiveValue::operator+=(const ValueType& value_){ + + value += value_; + ThrowIfInvalid(); + return Derived(); + + } + + // Free operators' implementations + + template + std::istream& operator>>(std::istream& input, PositiveValue& positiveValue){ + + ValueType value; + input>>value; + positiveValue.SetValue(std::move(value)); + return input; + + }; + +} + +} + +#endif diff --git a/Kommon/Core/Utility/Printable.cxx b/Kommon/Core/Utility/Printable.cxx new file mode 100644 index 000000000..eb37e1270 --- /dev/null +++ b/Kommon/Core/Utility/Printable.cxx @@ -0,0 +1,17 @@ +#include "Printable.h" + +namespace katrin{ + +namespace Kommon{ + + + std::ostream& operator<<(std::ostream& output, const Printable& printable){ + + printable.Print(output); + return output; + + } + +} + +} diff --git a/Kommon/Core/Utility/Printable.h b/Kommon/Core/Utility/Printable.h new file mode 100644 index 000000000..1733833df --- /dev/null +++ b/Kommon/Core/Utility/Printable.h @@ -0,0 +1,26 @@ +#ifndef KOMMON_PRINTABLE_COMPONENT_H +#define KOMMON_PRINTABLE_COMPONENT_H + +#include + +namespace katrin{ + +namespace Kommon{ + + class Printable{ + + public: + virtual void Print(std::ostream& output) const = 0; + + protected: + ~Printable() = default; + + }; + + std::ostream& operator<<(std::ostream& output, const Printable& printable); + +} + +} + +#endif diff --git a/Kommon/Root/Utility/KROOTPad.cxx b/Kommon/Root/Utility/KROOTPad.cxx index b549b9604..e66c1f58f 100644 --- a/Kommon/Root/Utility/KROOTPad.cxx +++ b/Kommon/Root/Utility/KROOTPad.cxx @@ -38,7 +38,7 @@ namespace katrin gStyle->SetTitleAlign( 23 ); gStyle->SetTitleSize( 0.08 , "t" ); - fPad = new TPad( fName.c_str() , fName.c_str(), fxlow, fylow, fxup, fyup ); + fPad = new TPad( GetName().c_str() , GetName().c_str(), fxlow, fylow, fxup, fyup ); double tXMin(std::numeric_limits::max()); double tXMax(-1.0*std::numeric_limits::max()); diff --git a/Kommon/Root/Utility/KROOTWindow.cxx b/Kommon/Root/Utility/KROOTWindow.cxx index fa73c069f..2947c6054 100644 --- a/Kommon/Root/Utility/KROOTWindow.cxx +++ b/Kommon/Root/Utility/KROOTWindow.cxx @@ -62,7 +62,7 @@ namespace katrin TQObject::Connect("TCanvas", "Closed()", "TApplication", fApplication, "Terminate()"); TQObject::Connect("TPad", "Closed()", "TApplication", fApplication, "Terminate()"); - fCanvas = new TCanvas( fName.c_str(), fName.c_str() , 10, 10, fCanvasWidth, fCanvasHeight); + fCanvas = new TCanvas( GetName().c_str(), GetName().c_str() , 10, 10, fCanvasWidth, fCanvasHeight); double tXMin(std::numeric_limits::max()); double tXMax(-1.0*std::numeric_limits::max()); diff --git a/Kommon/TBB/Utility/KMathIntegratorThreaded.h b/Kommon/TBB/Utility/KMathIntegratorThreaded.h index a3fd616ce..6c627fa7d 100644 --- a/Kommon/TBB/Utility/KMathIntegratorThreaded.h +++ b/Kommon/TBB/Utility/KMathIntegratorThreaded.h @@ -19,7 +19,7 @@ namespace katrin // forward declarations namespace policies { -struct ThreadedPlainSumming; +struct ThreadedSumming; struct ThreadedKahanSumming; } @@ -27,72 +27,44 @@ struct ThreadedKahanSumming; * A parallel version of KMathIntegrator's summing policy, using Intel's Thread Building Blocks * library to parallelize the iterative evaluation of the sampling points. */ -template -using KMathIntegratorThreaded = KMathIntegrator; -template -using KMathIntegrator2DThreaded = KMathIntegrator2D; +template +using KMathIntegratorThreaded = KMathIntegrator; +template +using KMathIntegrator2DThreaded = KMathIntegrator2D; namespace policies { -struct ThreadedPlainSumming -{ - template - XFloatT SumSamplingPoints(uint32_t n, const XFloatT& xStart, const XFloatT& del, XIntegrandType& integrand) const - { - // don't parallelize for only n <= 2 sampling points - if (n <= 2) { - XFloatT sum = 0.0; - for (uint32_t j = 0; j < n; j++) { - const XFloatT x = xStart + (XFloatT) j * del; - sum += integrand(x); - } - return sum; - } - - return tbb::parallel_reduce( - tbb::blocked_range( 0, n ), - 0.0, - [&](const tbb::blocked_range& r, XFloatT value)->XFloatT { - for (uint32_t j = r.begin(); j != r.end(); ++j) { - const XFloatT x = xStart + (XFloatT) j * del; - value += integrand(x); - } - return value; - }, - std::plus() - ); - } -}; + struct ThreadedSumming + { + template + static Float SumSamplingPoints(uint32_t n, Float xStart, Float del, XIntegrandType&& integrand) + { + // don't parallelize for only n <= 2 sampling points + if (n < 3) { -struct ThreadedKahanSumming : KahanSumming -{ - template - XFloatT SumSamplingPoints(uint32_t n, const XFloatT& xStart, const XFloatT& del, XIntegrandType& integrand) const - { - // don't parallelize for only n <= 2 sampling points - if (n <= 2) { - KMathKahanSum sum; - for (uint32_t j = 0; j < n; j++) { - const XFloatT x = xStart + (XFloatT) j * del; - sum += integrand(x); - } - return sum; - } + Sum sum = 0.0; + for (uint32_t j = 0; j < n; ++j) sum += integrand(xStart + j * del); + return sum; - return tbb::parallel_reduce( - tbb::blocked_range( 0, n ), - KMathKahanSum(), - [&](const tbb::blocked_range& r, KMathKahanSum value)->KMathKahanSum { - for (uint32_t j = r.begin(); j != r.end(); ++j) { - const XFloatT x = xStart + (XFloatT) j * del; - value += integrand(x); - } - return value; - }, - std::plus>() - ); - } -}; + } + else return tbb::parallel_reduce(tbb::blocked_range( 0, n ), 0., + [&](const tbb::blocked_range& range, Sum value){ + for (uint32_t j = range.begin(); j != range.end(); ++j) value += integrand(xStart + j * del); + return value; + }, + std::plus() + ); + } + }; + + struct ThreadedKahanSumming : KahanSumming + { + template + static Float SumSamplingPoints(uint32_t n, Float xStart, Float del, XIntegrandType&& integrand) + { + return ThreadedSumming::SumSamplingPoints>(n, xStart, del, std::forward(integrand)); + } + }; } diff --git a/Kommon/cmake/FindROOT.cmake b/Kommon/cmake/FindROOT.cmake index 2f7d286f4..3b29ba435 100644 --- a/Kommon/cmake/FindROOT.cmake +++ b/Kommon/cmake/FindROOT.cmake @@ -326,7 +326,7 @@ function(ROOT_GENERATE_DICTIONARY dictionary) DEPENDS ${headerfiles} ${linkdefs} ) else() add_custom_command(OUTPUT ${dictionary} - COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR} ROOTSYS=${ROOTSYS} + COMMAND LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH} ROOTSYS=${ROOTSYS} ${ROOT_CINT_EXECUTABLE} -cint -f ${dictionary} -c -p -DHAVE_CONFIG_H ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} DEPENDS ${headerfiles} ${linkdefs} ) endif() diff --git a/Kommon/cmake/FindTBB.cmake b/Kommon/cmake/FindTBB.cmake index f4c29913a..79674ea37 100644 --- a/Kommon/cmake/FindTBB.cmake +++ b/Kommon/cmake/FindTBB.cmake @@ -41,7 +41,7 @@ # which compiler to use (detected automatically on Windows) # This module respects -# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR} +# TBB_INSTALL_DIR or $ENV{TBB21_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR} or $ENV{TBBROOT} # This module defines # TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc. @@ -134,6 +134,9 @@ if (TBB_INSTALL_DIR) endif (TBB_INSTALL_DIR) # second: use environment variable if (NOT _TBB_INSTALL_DIR) + if (NOT "$ENV{TBBROOT}" STREQUAL "") + set (_TBB_INSTALL_DIR $ENV{TBBROOT}) + endif (NOT "$ENV{TBBROOT}" STREQUAL "") if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR}) endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") @@ -157,7 +160,7 @@ endif (NOT _TBB_INSTALL_DIR) # sanity check if (NOT _TBB_INSTALL_DIR) message ("ERROR: Unable to find Intel TBB install directory. ${_TBB_INSTALL_DIR}") -else (NOT _TBB_INSTALL_DIR) +endif (NOT _TBB_INSTALL_DIR) # finally: set the cached CMake variable TBB_INSTALL_DIR if (NOT TBB_INSTALL_DIR) set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory") @@ -260,12 +263,16 @@ if (TBB_INCLUDE_DIR) # Jiri: Self-built TBB stores the debug libraries in a separate directory. set (TBB_DEBUG_LIBRARY_DIRS ${TBB_LIBRARY_DEBUG_DIR} CACHE PATH "TBB debug library directory" FORCE) mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_DEBUG_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES) - # message(STATUS "Found Intel TBB") + message(STATUS "Found Intel TBB include: ${TBB_INCLUDE_DIRS}") + message(STATUS "Found Intel TBB lib: ${TBB_LIBRARY_DIRS}") endif (TBB_LIBRARY) endif (TBB_INCLUDE_DIR) if (NOT TBB_FOUND) message("ERROR: Intel TBB NOT found!") + if (NOT TBB_INSTALL_DIR) + message(STATUS "You may wish to define TBB_INSTALL_DIR") + endif (NOT TBB_INSTALL_DIR) message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}") # do only throw fatal, if this pkg is REQUIRED if (TBB_FIND_REQUIRED) @@ -273,8 +280,6 @@ if (NOT TBB_FOUND) endif (TBB_FIND_REQUIRED) endif (NOT TBB_FOUND) -endif (NOT _TBB_INSTALL_DIR) - if (TBB_FOUND) set(TBB_INTERFACE_VERSION 0) FILE(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _TBB_VERSION_CONTENTS) diff --git a/Kommon/cmake/KasperDefaults.cmake b/Kommon/cmake/KasperDefaults.cmake index 03ce14dcc..289ec13ef 100644 --- a/Kommon/cmake/KasperDefaults.cmake +++ b/Kommon/cmake/KasperDefaults.cmake @@ -8,6 +8,7 @@ endmacro(set_path) include(CMakeDependentOption) include(MacroParseArguments) +include(GNUInstallDirs) if( ${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR} ) @@ -82,10 +83,8 @@ else() set(EXTERNAL_INCLUDE_DIRS) endif() -set(CMAKE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}) -set(MODULE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/modules) -file(RELATIVE_PATH REL_INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_DIR}" "${INCLUDE_INSTALL_DIR}") -file(RELATIVE_PATH REL_MODULE_INSTALL_DIR "${CMAKE_INSTALL_DIR}" "${MODULE_INSTALL_DIR}") +set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) +set(MODULE_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/modules) set_property(GLOBAL PROPERTY MODULE_TARGETS) if( MODULE_VERSION ) @@ -114,9 +113,9 @@ find_package (Sphinx) # mechanism for setting module-specific install paths macro( kasper_module_paths PATH ) - set( ${PROJECT_NAME}_INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_DIR} ) - set( ${PROJECT_NAME}_LIB_INSTALL_DIR ${LIB_INSTALL_DIR} ) - set( ${PROJECT_NAME}_BIN_INSTALL_DIR ${BIN_INSTALL_DIR} ) + set( ${PROJECT_NAME}_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} ) + set( ${PROJECT_NAME}_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} ) + set( ${PROJECT_NAME}_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} ) set( ${PROJECT_NAME}_CONFIG_INSTALL_DIR ${CONFIG_INSTALL_DIR}/${PATH} ) set( ${PROJECT_NAME}_DATA_INSTALL_DIR ${DATA_INSTALL_DIR}/${PATH} ) set( ${PROJECT_NAME}_SCRATCH_INSTALL_DIR ${SCRATCH_INSTALL_DIR}/${PATH} ) @@ -288,7 +287,7 @@ macro(kasper_install_module) get_property(MODULE_TARGETS GLOBAL PROPERTY MODULE_TARGETS) #list(APPEND EXTERNAL_INCLUDE_DIRS ${KASPER_INCLUDE_DIRS}) - set(INSTALLED_INCLUDE_DIRS ${INCLUDE_INSTALL_DIR}) + set(INSTALLED_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR}) foreach(DIR ${EXTERNAL_INCLUDE_DIRS}) if (NOT ${DIR} STREQUAL "SYSTEM") @@ -399,9 +398,9 @@ macro(kasper_export_pkgconfig) endif() set( PC_CONTENTS "prefix=${CMAKE_INSTALL_PREFIX} -exec_prefix=${BIN_INSTALL_DIR} -libdir=${LIB_INSTALL_DIR} -includedir=${INCLUDE_INSTALL_DIR} + exec_prefix=${CMAKE_INSTALL_FULL_BINDIR} + libdir=${CMAKE_INSTALL_FULL_LIBDIR} + includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR} rpath=${PC_RPATH_STR} Name: ${PROJECT_NAME} @@ -413,8 +412,8 @@ Cflags: ${GLOBAL_CXX11_FLAG} ${PC_INCLUDE_DIR_STR} ") string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER ) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc ${PC_CONTENTS}) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig RENAME ${PROJECT_NAME}.pc ) endmacro() diff --git a/Kommon/kasperenv.sh b/Kommon/kasperenv.sh deleted file mode 100755 index 4f25fc575..000000000 --- a/Kommon/kasperenv.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -# To automatically set the KASPER directory on opening a terminal, -# append this line to your ~/.bashrc file: -# source /bin/kasperenv.sh - -if [ -n "$KASPERSYS" ] - then - export OLD_KASPERSYS=$KASPERSYS - OLD_PATH=$OLD_KASPERSYS/bin: - OLD_LDLIBPATH=$OLD_KASPERSYS/lib: - OLD_PKGCFGPATH=$OLD_KASPERSYS/lib/pkgconfig: - OLD_PYTHONPATH=$OLD_KASPERSYS/lib/python: - OLD_CMAKE_PREF=$OLD_KASPERSYS: -fi - -if [ -n "$KASPER_INSTALL" ] - then - export OLD_KASPER_INSTALL=$KASPER_INSTALL - OLD_PATH=$OLD_KASPER_INSTALL/bin: - OLD_LDLIBPATH=$OLD_KASPER_INSTALL/lib: - OLD_PKGCFGPATH=$OLD_KASPER_INSTALL/lib/pkgconfig: - OLD_PYTHONPATH=$OLD_KASPER_INSTALL/lib/python: - OLD_CMAKE_PREF=$OLD_KASPER_INSTALL: -fi - -export KASPER_INSTALL=@CMAKE_INSTALL_PREFIX@ - -if [ $# -eq 0 ] - then - KASPERSYS=$KASPER_INSTALL - else - KASPERSYS=`readlink -f $1` -fi - -export KASPERSYS - -if [ -w $KASPERSYS/cache/KEMField/ ] ; then - KEMFIELD_CACHE=$KASPERSYS/cache/KEMField -else - echo "Directory $KASPERSYS/cache/KEMField/ does not exist or is not writeable, setting KEMField cache to $HOME/.cache/KEMField" - KEMFIELD_CACHE=$HOME/.cache/KEMField -fi - -export KEMFIELD_CACHE -mkdir -p $KEMFIELD_CACHE - -export PATH=$KASPER_INSTALL/bin:${PATH//${OLD_PATH}/} -export LD_LIBRARY_PATH=$KASPER_INSTALL/lib:${LD_LIBRARY_PATH//${OLD_LDLIBPATH}/} -export PKG_CONFIG_PATH=$KASPER_INSTALL/lib/pkgconfig:${PKG_CONFIG_PATH//${OLD_PKGCFGPATH}/} -export PYTHONPATH=$KASPER_INSTALL/lib/python:${PYTHONPATH//${OLD_PYTHONPATH}/} -export CMAKE_PREFIX_PATH=$KASPER_INSTALL:${CMAKE_PREFIX_PATH//${OLD_CMAKE_PREF}/} - -echo -e "\033[32;1mKASPER config directory set to ${KASPERSYS}\033[0m" -echo -e "\033[32;1mKASPER install directory set to ${KASPER_INSTALL}\033[0m" - -_kafit-krypton-auto() -{ - local curr_arg; - curr_arg=${COMP_WORDS[COMP_CWORD]} - COMPREPLY=( $(compgen -W 'DrawData drawdata DrawResponse drawresponse DrawRP drawrp DrawMF drawmf Test test Fit fit DrawFitResult drawfitresult DrawResidual drawresidual FitSummary fitsummary --mode= --num= --ringselection=\" --fitrange=\" --batch= --auto= --average= --relative= --input= --output= true false uniform ring pixel' -- $curr_arg ) ); -} -[ ! -z "$BASH" ] && complete -o nospace -F _kafit-krypton-auto kafit-krypton - -return 0 diff --git a/Kommon/create_kasper_user_directory.sh b/create_kasper_user_directory.sh.in similarity index 100% rename from Kommon/create_kasper_user_directory.sh rename to create_kasper_user_directory.sh.in diff --git a/kasperenv.sh.in b/kasperenv.sh.in new file mode 100755 index 000000000..50f52907c --- /dev/null +++ b/kasperenv.sh.in @@ -0,0 +1,77 @@ +#!/bin/sh + +# To automatically set the KASPER directory on opening a terminal, +# append this line to your ~/.bashrc file: +# source /bin/kasperenv.sh + +if [ -n "${KASPERSYS}" ] + then + export OLD_KASPERSYS=${KASPERSYS} + OLD_PATH=${OLD_KASPERSYS}/bin: + OLD_LDLIBPATH=${OLD_KASPERSYS}/lib: + OLD_PKGCFGPATH=${OLD_KASPERSYS}/lib/pkgconfig: + OLD_PYTHONPATH=${OLD_KASPERSYS}/lib/python: + OLD_CMAKE_PREF=${OLD_KASPERSYS}: +fi + +if [ -n "${KASPER_INSTALL}" ] + then + export OLD_KASPER_INSTALL=${KASPER_INSTALL} + OLD_PATH=${OLD_KASPER_INSTALL}/bin: + OLD_LDLIBPATH=${OLD_KASPER_INSTALL}/lib: + OLD_PKGCFGPATH=${OLD_KASPER_INSTALL}/lib/pkgconfig: + OLD_PYTHONPATH=${OLD_KASPER_INSTALL}/lib/python: + OLD_CMAKE_PREF=${OLD_KASPER_INSTALL}: +fi + +if [ -n "${KASPER_SOURCE}" ] + then + export OLD_KASPER_SOURCE=${KASPER_SOURCE} +fi + +export KASPER_SOURCE=@CMAKE_HOME_DIRECTORY@ +export KASPER_INSTALL=@CMAKE_INSTALL_PREFIX@ +KASPER_INSTALL_BIN=@CMAKE_INSTALL_FULL_BINDIR@ +KASPER_INSTALL_LIB=@CMAKE_INSTALL_FULL_LIBDIR@ + +if [ $# -eq 0 ] + then + KASPERSYS=${KASPER_INSTALL} + else + KASPERSYS=`readlink -f $1` +fi + +export KASPERSYS + +if [ ! -z "${KEMFIELD_CACHE}" -a -w "${KEMFIELD_CACHE}" ] ; then + echo "Using KEMField cache in ${KEMFIELD_CACHE}" +else + if [ -w "${KASPERSYS}/cache/KEMField/" ] ; then + KEMFIELD_CACHE=${KASPERSYS}/cache/KEMField + else + echo "Directory ${KASPERSYS}/cache/KEMField/ does not exist or is not writeable, setting KEMField cache to ${HOME}/.cache/KEMField" + KEMFIELD_CACHE=${HOME}/.cache/KEMField + fi +fi + +export KEMFIELD_CACHE +mkdir -p ${KEMFIELD_CACHE} + +export PATH=${KASPER_INSTALL_BIN}:${PATH//${OLD_PATH}/} +export LD_LIBRARY_PATH=${KASPER_INSTALL_LIB}:${LD_LIBRARY_PATH//${OLD_LDLIBPATH}/} +export PKG_CONFIG_PATH=${KASPER_INSTALL_LIB}/pkgconfig:${PKG_CONFIG_PATH//${OLD_PKGCFGPATH}/} +export PYTHONPATH=${KASPER_INSTALL_LIB}/python:${PYTHONPATH//${OLD_PYTHONPATH}/} +export CMAKE_PREFIX_PATH=${KASPER_INSTALL}:${CMAKE_PREFIX_PATH//${OLD_CMAKE_PREF}/} + +echo -e "\033[32;1mKASPER config directory set to ${KASPERSYS}\033[0m" +echo -e "\033[32;1mKASPER install directory set to ${KASPER_INSTALL}\033[0m" + +function _kafit_krypton_auto() +{ + local curr_arg; + curr_arg=${COMP_WORDS[COMP_CWORD]} + COMPREPLY=( $(compgen -W 'DrawData drawdata DrawResponse drawresponse DrawRP drawrp DrawMF drawmf Test test Fit fit DrawFitResult drawfitresult DrawResidual drawresidual FitSummary fitsummary --mode= --num= --ringselection=\" --fitrange=\" --batch= --auto= --average= --relative= --input= --output= true false uniform ring pixel' -- $curr_arg ) ); +} +[ ! -z "${BASH}" ] && complete -o nospace -F _kafit_krypton_auto kafit-krypton + +return 0