1 | |
---|
2 | //#include <cstdlib> |
---|
3 | |
---|
4 | #include "sectorParameters.h" |
---|
5 | #include "mixedTools.h" |
---|
6 | |
---|
7 | sectorParameters::sectorParameters() : parametersString_(NULL) |
---|
8 | { |
---|
9 | geometry_= string("CIRCULAR"); |
---|
10 | nCells_ = 0; |
---|
11 | lCell_ = 0.0; |
---|
12 | pc_ = 0.0; |
---|
13 | nbParam_ = 4; |
---|
14 | parametersString_ = new string[nbParam_+1]; |
---|
15 | } |
---|
16 | |
---|
17 | string* sectorParameters::getParametersString() const |
---|
18 | { |
---|
19 | parametersString_[0] = mixedTools::intToString(nbParam_); |
---|
20 | parametersString_[1] = geometry_; |
---|
21 | parametersString_[2] = mixedTools::intToString(nCells_); |
---|
22 | parametersString_[3] = mixedTools::doubleToString(lCell_); |
---|
23 | parametersString_[4] = mixedTools::doubleToString(pc_); |
---|
24 | return parametersString_; |
---|
25 | } |
---|
26 | |
---|
27 | void sectorParameters::setParametersString(string* param) |
---|
28 | { |
---|
29 | geometry_ = param[1].c_str(); |
---|
30 | nCells_ = atoi(param[2].c_str()); |
---|
31 | lCell_ = atof(param[3].c_str()); |
---|
32 | pc_ = atof(param[4].c_str()); |
---|
33 | } |
---|
34 | |
---|
35 | void sectorParameters::raz() |
---|
36 | { |
---|
37 | geometry_= string("CIRCULAR"); |
---|
38 | nCells_ = 0; |
---|
39 | lCell_ = 0.0; |
---|
40 | pc_ = 0.0; |
---|
41 | } |
---|
42 | |
---|
43 | string sectorParameters::FileOutputFlow() const |
---|
44 | { |
---|
45 | ostringstream sortie; |
---|
46 | sortie<<" lattice "<<endl; |
---|
47 | sortie<<geometry_<<" "<<nCells_<<" "<<lCell_<<" "<<pc_<<endl; |
---|
48 | return sortie.str(); |
---|
49 | } |
---|
50 | |
---|
51 | void sectorParameters::FileInput(ifstream& ifs) |
---|
52 | { |
---|
53 | ifs >> geometry_ >> nCells_ >> lCell_ >> pc_; |
---|
54 | } |
---|
55 | |
---|
56 | void sectorParameters::InputRep(UAPNode* root) |
---|
57 | { |
---|
58 | UAPNode* node = root->addChild("lattice"); |
---|
59 | node->addAttribute("name","global_lattice"); |
---|
60 | node->addChild("geometry")->addAttribute("type",geometry_); |
---|
61 | string txt = ""; |
---|
62 | txt = mixedTools::doubleToString(pc_); |
---|
63 | node->addChild("pc")->addAttribute("design",txt); |
---|
64 | |
---|
65 | node = root->addChild("sector"); |
---|
66 | node->addAttribute("name","sect"); |
---|
67 | txt = mixedTools::doubleToString(lCell_); |
---|
68 | node->addAttribute("length",txt); |
---|
69 | txt = mixedTools::intToString(nCells_); |
---|
70 | node->addAttribute("repeat",txt); |
---|
71 | } |
---|
72 | |
---|
73 | int sectorParameters::getNumberOfCells() const { |
---|
74 | return nCells_; |
---|
75 | } |
---|
76 | |
---|
77 | double sectorParameters::getCellLength() const { |
---|
78 | return lCell_; |
---|
79 | } |
---|
80 | |
---|
81 | double sectorParameters::getParticleMomentum() const { |
---|
82 | return pc_; |
---|
83 | } |
---|
84 | |
---|
85 | |
---|