00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id: G4AdjointInterpolator.hh 69844 2013-05-16 09:19:33Z gcosmo $ 00027 // 00029 // Module: G4AdjointInterpolator 00030 // Author: L. Desorgher 00031 // Organisation: SpaceIT GmbH 00032 // Contract: ESA contract 21435/08/NL/AT 00033 // Customer: ESA/ESTEC 00035 // 00036 // CHANGE HISTORY 00037 // -------------- 00038 // ChangeHistory: 00039 // 1st April 2007 creation by L. Desorgher 00040 // 00041 //------------------------------------------------------------- 00042 // Documentation: 00043 // Used by G4AdjointCSManager for interpolation purpose. 00044 // 00045 #ifndef G4AdjointInterpolator_h 00046 #define G4AdjointInterpolator_h 1 00047 00048 #include"globals.hh" 00049 #include<vector> 00050 00052 // 00053 class G4AdjointInterpolator 00054 { 00055 00056 public: 00057 static G4AdjointInterpolator* GetAdjointInterpolator(); 00058 static G4AdjointInterpolator* GetInstance(); 00059 00060 public: 00061 00063 // Constructors and Destructor 00065 00066 00067 ~G4AdjointInterpolator(); 00068 00070 // Methods 00072 00073 //Caution everywher it is considere thta x_vec increase monotically 00074 00075 G4double LinearInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); 00076 G4double LogarithmicInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); 00077 G4double ExponentialInterpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double& y2); 00078 G4double Interpolation(G4double& x,G4double& x1,G4double& x2,G4double& y1,G4double &y2,G4String InterPolMethod="Log"); 00079 00080 00081 size_t FindPosition(G4double& x,std::vector<G4double>& x_vec,size_t ind_min=0, size_t ind_max=0); 00082 00083 size_t FindPositionForLogVector(G4double& x,std::vector<G4double>& x_vec); 00084 00085 G4double Interpolate(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec,G4String InterPolMethod="Log"); //xvec should monotically increase 00086 00087 G4double InterpolateWithIndexVector(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec, 00088 std::vector<size_t>& index_vec, G4double x0,G4double dx); //xvec should monotically increase 00089 00090 00091 G4double InterpolateForLogVector(G4double& x,std::vector<G4double>& x_vec,std::vector<G4double>& y_vec); 00092 00093 private: 00094 static G4AdjointInterpolator* theInstance; 00095 00096 private: 00097 G4AdjointInterpolator(); 00098 00099 }; 00100 #endif