[966] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
[1196] | 26 | // $Id: G4AdjointInterpolator.hh,v 1.4 2009/11/20 10:31:20 ldesorgh Exp $ |
---|
[1337] | 27 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[1196] | 28 | // |
---|
[966] | 29 | ///////////////////////////////////////////////////////////////////////////////// |
---|
[1196] | 30 | // Module: G4AdjointInterpolator |
---|
[966] | 31 | // Author: L. Desorgher |
---|
| 32 | // Organisation: SpaceIT GmbH |
---|
[1196] | 33 | // Contract: ESA contract 21435/08/NL/AT |
---|
[966] | 34 | // Customer: ESA/ESTEC |
---|
| 35 | ///////////////////////////////////////////////////////////////////////////////// |
---|
| 36 | // |
---|
| 37 | // CHANGE HISTORY |
---|
| 38 | // -------------- |
---|
| 39 | // ChangeHistory: |
---|
| 40 | // 1st April 2007 creation by L. Desorgher |
---|
| 41 | // |
---|
| 42 | //------------------------------------------------------------- |
---|
| 43 | // Documentation: |
---|
| 44 | // Used by G4AdjointCSManager for interpolation purpose. |
---|
| 45 | // |
---|
| 46 | #ifndef G4AdjointInterpolator_h |
---|
| 47 | #define G4AdjointInterpolator_h 1 |
---|
| 48 | |
---|
| 49 | #include"globals.hh" |
---|
| 50 | #include<vector> |
---|
| 51 | |
---|
| 52 | //////////////////////////////////////////////////////////////////////////////// |
---|
| 53 | // |
---|
| 54 | class G4AdjointInterpolator |
---|
| 55 | { |
---|
| 56 | |
---|
| 57 | public: |
---|
| 58 | static G4AdjointInterpolator* GetAdjointInterpolator(); |
---|
| 59 | static G4AdjointInterpolator* GetInstance(); |
---|
| 60 | |
---|
| 61 | public: |
---|
| 62 | |
---|
| 63 | //////////////////////////////// |
---|
| 64 | // Constructors and Destructor |
---|
| 65 | //////////////////////////////// |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | ~G4AdjointInterpolator(); |
---|
| 69 | |
---|
| 70 | //////////// |
---|
| 71 | // Methods |
---|
| 72 | //////////// |
---|
| 73 | |
---|
| 74 | //Caution everywher it is considere thta x_vec increase monotically |
---|
| 75 | |
---|
| 76 | G4double LinearInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); |
---|
| 77 | G4double LogarithmicInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); |
---|
| 78 | G4double ExponentialInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); |
---|
| 79 | G4double Interpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double &y2,G4String InterPolMethod="Log"); |
---|
| 80 | |
---|
| 81 | |
---|
[1196] | 82 | size_t FindPosition(G4double& x,std::vector<G4double>& x_vec,size_t ind_min=0, size_t ind_max=0); |
---|
[966] | 83 | |
---|
[1196] | 84 | size_t FindPositionForLogVector(G4double& x,std::vector<G4double>& x_vec); |
---|
[966] | 85 | |
---|
[1196] | 86 | G4double Interpolate(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec,G4String InterPolMethod="Log"); //xvec should monotically increase |
---|
[966] | 87 | |
---|
[1196] | 88 | G4double InterpolateWithIndexVector(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec, |
---|
[966] | 89 | std::vector<size_t>& index_vec, G4double x0,G4double dx); //xvec should monotically increase |
---|
| 90 | |
---|
| 91 | |
---|
[1196] | 92 | G4double InterpolateForLogVector(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec); |
---|
[966] | 93 | |
---|
| 94 | private: |
---|
| 95 | static G4AdjointInterpolator* theInstance; |
---|
| 96 | |
---|
| 97 | private: |
---|
| 98 | G4AdjointInterpolator(); |
---|
| 99 | |
---|
| 100 | }; |
---|
| 101 | #endif |
---|