Added userfcn for superconducting screening in an infinite half-space to libTFitPofB
This commit is contained in:
parent
8910a8295f
commit
5f3786330d
22
src/external/TFitPofB-lib/classes/TBofZCalc.cpp
vendored
22
src/external/TFitPofB-lib/classes/TBofZCalc.cpp
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/06/03
|
||||
2008/06/30
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -61,6 +61,26 @@ double TBofZCalc::GetBofZ(double zz) const {
|
||||
|
||||
}
|
||||
|
||||
//------------------
|
||||
// Constructor of the TLondon1D_1L class
|
||||
// 1D-London screening in a superconducting half-space
|
||||
// Parameters: Bext[G], deadlayer[nm], lambda[nm]
|
||||
//------------------
|
||||
|
||||
TLondon1D_HS::TLondon1D_HS(unsigned int steps, const vector<double> ¶m) {
|
||||
|
||||
fDZ = 200.0/double(steps);
|
||||
double ZZ, BBz;
|
||||
|
||||
for (unsigned int j(0); j<steps; j++) {
|
||||
ZZ = param[1] + (double)j*fDZ;
|
||||
fZ.push_back(ZZ);
|
||||
BBz = param[0]*exp(-(ZZ-param[1])/param[2]);
|
||||
fBZ.push_back(BBz);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//------------------
|
||||
// Constructor of the TLondon1D_1L class
|
||||
// 1D-London screening in a thin superconducting film
|
||||
|
151
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
151
src/external/TFitPofB-lib/classes/TLondon1D.cpp
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/06/06
|
||||
2008/06/30
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -16,6 +16,7 @@ using namespace std;
|
||||
#include <TSAXParser.h>
|
||||
#include "TFitPofBStartupHandler.h"
|
||||
|
||||
ClassImp(TLondon1DHS)
|
||||
ClassImp(TLondon1D1L)
|
||||
ClassImp(TLondon1D2L)
|
||||
ClassImp(TLondon1D3L)
|
||||
@ -23,9 +24,21 @@ ClassImp(TLondon1D3LS)
|
||||
|
||||
|
||||
//------------------
|
||||
// Destructor of the TLondon1D1L/2L/3L/3LS classes -- cleaning up
|
||||
// Destructor of the TLondon1DHS/1L/2L/3L/3LS classes -- cleaning up
|
||||
//------------------
|
||||
|
||||
TLondon1DHS::~TLondon1DHS() {
|
||||
cout << "This is the TLondon1DHS-destructor. Jippieh!" << endl;
|
||||
fPar.clear();
|
||||
fParForBofZ.clear();
|
||||
fParForPofB.clear();
|
||||
fParForPofT.clear();
|
||||
delete fImpProfile;
|
||||
fImpProfile = 0;
|
||||
delete fPofT;
|
||||
fPofT = 0;
|
||||
}
|
||||
|
||||
TLondon1D1L::~TLondon1D1L() {
|
||||
cout << "This is the TLondon1D1L-destructor. Jippieh!" << endl;
|
||||
fPar.clear();
|
||||
@ -74,6 +87,140 @@ TLondon1D3LS::~TLondon1D3LS() {
|
||||
fPofT = 0;
|
||||
}
|
||||
|
||||
//------------------
|
||||
// Constructor of the TLondon1DHS class -- reading available implantation profiles and
|
||||
// creates (a pointer to) the TPofTCalc object (with the FFT plan)
|
||||
//------------------
|
||||
|
||||
TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
||||
cout << "This is the TLondon1DHS-constructor. Juhu!" << endl;
|
||||
|
||||
// read startup file
|
||||
string startup_path_name("TFitPofB_startup.xml");
|
||||
|
||||
TSAXParser *saxParser = new TSAXParser();
|
||||
TFitPofBStartupHandler *startupHandler = new TFitPofBStartupHandler();
|
||||
saxParser->ConnectToHandler("TFitPofBStartupHandler", startupHandler);
|
||||
int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||
// check for parse errors
|
||||
if (status) { // error
|
||||
cout << endl << "**WARNING** reading/parsing TFitPofB_startup.xml failed." << endl;
|
||||
}
|
||||
|
||||
fNSteps = startupHandler->GetNSteps();
|
||||
fWisdom = startupHandler->GetWisdomFile();
|
||||
string rge_path(startupHandler->GetDataPath());
|
||||
vector<string> energy_vec(startupHandler->GetEnergyList());
|
||||
|
||||
fParForPofT.push_back(0.0);
|
||||
fParForPofT.push_back(startupHandler->GetDeltat());
|
||||
fParForPofT.push_back(startupHandler->GetDeltaB());
|
||||
|
||||
fParForPofB.push_back(startupHandler->GetDeltat());
|
||||
fParForPofB.push_back(startupHandler->GetDeltaB());
|
||||
fParForPofB.push_back(0.0);
|
||||
|
||||
TTrimSPData *x = new TTrimSPData(rge_path, energy_vec);
|
||||
fImpProfile = x;
|
||||
x = 0;
|
||||
delete x;
|
||||
|
||||
TPofTCalc *y = new TPofTCalc(fWisdom, fParForPofT);
|
||||
fPofT = y;
|
||||
y = 0;
|
||||
delete y;
|
||||
|
||||
// clean up
|
||||
if (saxParser) {
|
||||
delete saxParser;
|
||||
saxParser = 0;
|
||||
}
|
||||
if (startupHandler) {
|
||||
delete startupHandler;
|
||||
startupHandler = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------
|
||||
// TLondon1DHS-Method that calls the procedures to create B(z), p(B) and P(t)
|
||||
// It finally returns P(t) for a given t.
|
||||
// Parameters: all the parameters for the function to be fitted through TLondon1DHS
|
||||
//------------------
|
||||
|
||||
double TLondon1DHS::operator()(double t, const vector<double> &par) const {
|
||||
if(t<0.0)
|
||||
return 0.0;
|
||||
|
||||
// check if the function is called the first time and if yes, read in parameters
|
||||
|
||||
if(fFirstCall){
|
||||
fPar = par;
|
||||
|
||||
for (unsigned int i(0); i<fPar.size(); i++){
|
||||
cout << "fPar[" << i << "] = " << fPar[i] << endl;
|
||||
}
|
||||
|
||||
for (unsigned int i(2); i<fPar.size(); i++){
|
||||
fParForBofZ.push_back(fPar[i]);
|
||||
cout << "fParForBofZ[" << i-2 << "] = " << fParForBofZ[i-2] << endl;
|
||||
}
|
||||
fFirstCall=false;
|
||||
cout << this << endl;
|
||||
}
|
||||
|
||||
// check if any parameter has changed
|
||||
|
||||
bool par_changed(false);
|
||||
bool only_phase_changed(false);
|
||||
|
||||
for (unsigned int i(0); i<fPar.size(); i++) {
|
||||
if( fPar[i]-par[i] ) {
|
||||
fPar[i] = par[i];
|
||||
par_changed = true;
|
||||
if (i == 0) {
|
||||
only_phase_changed = true;
|
||||
} else {
|
||||
only_phase_changed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (par_changed)
|
||||
fCalcNeeded = true;
|
||||
|
||||
// if model parameters have changed, recalculate B(z), P(B) and P(t)
|
||||
|
||||
if (fCalcNeeded) {
|
||||
|
||||
fParForPofT[0] = par[0]; // phase
|
||||
|
||||
if(!only_phase_changed) {
|
||||
|
||||
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
|
||||
|
||||
for (unsigned int i(2); i<fPar.size(); i++)
|
||||
fParForBofZ[i-2] = par[i];
|
||||
|
||||
fParForPofB[2] = par[1]; // energy
|
||||
|
||||
TLondon1D_HS BofZ(fNSteps, fParForBofZ);
|
||||
TPofBCalc PofB(BofZ, *fImpProfile, fParForPofB);
|
||||
fPofT->DoFFT(PofB);
|
||||
|
||||
}/* else {
|
||||
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl;
|
||||
}*/
|
||||
|
||||
fPofT->CalcPol(fParForPofT);
|
||||
|
||||
fCalcNeeded = false;
|
||||
}
|
||||
|
||||
return fPofT->Eval(t);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------
|
||||
// Constructor of the TLondon1D1L class -- reading available implantation profiles and
|
||||
// creates (a pointer to) the TPofTCalc object (with the FFT plan)
|
||||
|
14
src/external/TFitPofB-lib/include/TBofZCalc.h
vendored
14
src/external/TFitPofB-lib/include/TBofZCalc.h
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/06/03
|
||||
2008/06/30
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -44,6 +44,18 @@ protected:
|
||||
double fDZ;
|
||||
};
|
||||
|
||||
//--------------------
|
||||
// Class "for Meissner screening" in a superconducting half-space
|
||||
//--------------------
|
||||
|
||||
class TLondon1D_HS : public TBofZCalc {
|
||||
|
||||
public:
|
||||
|
||||
TLondon1D_HS(unsigned int, const vector<double>& );
|
||||
|
||||
};
|
||||
|
||||
//--------------------
|
||||
// Class "for Meissner screening" in a thin superconducting film
|
||||
//--------------------
|
||||
|
26
src/external/TFitPofB-lib/include/TLondon1D.h
vendored
26
src/external/TFitPofB-lib/include/TLondon1D.h
vendored
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/06/06
|
||||
2008/06/30
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -15,6 +15,30 @@
|
||||
#include "PUserFcnBase.h"
|
||||
#include "TPofTCalc.h"
|
||||
|
||||
class TLondon1DHS : public PUserFcnBase {
|
||||
|
||||
public:
|
||||
// default conctructor
|
||||
TLondon1DHS();
|
||||
~TLondon1DHS();
|
||||
|
||||
double operator()(double, const vector<double>&) const;
|
||||
|
||||
private:
|
||||
mutable vector<double> fPar;
|
||||
TTrimSPData *fImpProfile;
|
||||
TPofTCalc *fPofT;
|
||||
mutable bool fCalcNeeded;
|
||||
mutable bool fFirstCall;
|
||||
mutable vector<double> fParForPofT;
|
||||
mutable vector<double> fParForBofZ;
|
||||
mutable vector<double> fParForPofB;
|
||||
string fWisdom;
|
||||
unsigned int fNSteps;
|
||||
|
||||
ClassDef(TLondon1DHS,1)
|
||||
};
|
||||
|
||||
class TLondon1D1L : public PUserFcnBase {
|
||||
|
||||
public:
|
||||
|
@ -5,7 +5,7 @@
|
||||
Author: Bastian M. Wojek
|
||||
e-mail: bastian.wojek@psi.ch
|
||||
|
||||
2008/05/29
|
||||
2008/06/30
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#pragma link off all classes;
|
||||
#pragma link off all functions;
|
||||
|
||||
#pragma link C++ class TLondon1DHS+;
|
||||
#pragma link C++ class TLondon1D1L+;
|
||||
#pragma link C++ class TLondon1D2L+;
|
||||
#pragma link C++ class TLondon1D3L+;
|
||||
|
Loading…
x
Reference in New Issue
Block a user