Changeset 424 in PSPA for Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc
- Timestamp:
- Sep 30, 2013, 5:03:21 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Interface_Web/trunk/pspaWT/sources/controler/src/elementFit.cc
r418 r424 4 4 elementFit::elementFit() : abstractElement() 5 5 { 6 7 8 9 10 11 12 13 14 6 setDefaultValues(); 7 setDefaults(); 8 elementName_ = nomdElements("fit"); 9 nbParam_ = elementName_.getElementNbParameters(); 10 parametersString_ = new string[nbParam_+1]; 11 // transportOk_ = true; 12 // parmelaIgnored_ = true; 13 // registerAcceptableSoftware(nomDeLogiciel::transport, TBoolOk); 14 // registerAcceptableSoftware(nomDeLogiciel::parmela, TBoolIgnore); 15 15 } 16 16 17 17 void elementFit::setDefaultValues() 18 18 { 19 20 21 22 19 defaultSpecificName_ = "fit"; 20 variableNameDef_ = ""; 21 variableValueDef_ = 0.0; 22 toleranceDef_ = 0.0; 23 23 } 24 24 25 25 void elementFit::setDefaults() 26 26 { 27 28 29 30 27 specificName_ = defaultSpecificName_; 28 variableName_ = variableNameDef_; 29 variableValue_ = variableValueDef_; 30 tolerance_ = toleranceDef_; 31 31 } 32 33 34 32 35 33 string* elementFit::getParametersString() const 36 34 { 37 38 39 40 41 42 43 44 45 46 47 35 int compteur = -1; 36 parametersString_[++compteur] = mixedTools::intToString(nbParam_); 37 parametersString_[++compteur] = specificName_; 38 parametersString_[++compteur] = variableName_; 39 parametersString_[++compteur] = mixedTools::doubleToString(variableValue_ ); 40 parametersString_[++compteur] = mixedTools::doubleToString(tolerance_); 41 if ( compteur != nbParam_ ) { 42 cerr << " elementFit::getParametersString() : ERROR nr pf parameters dosnt match " << endl; 43 return NULL; 44 } 45 return parametersString_; 48 46 } 49 47 50 48 void elementFit::setParametersString(string* param) 51 49 { 52 if ( param == NULL ) 53 { 54 cerr << " elementFit::setParametersString parameters empty parameter set"; 55 return; 56 } 57 int compteur = -1; 58 int nbparam = atoi(param[++compteur].c_str()); 59 if ( nbparam != nbParam_ ) 60 { 61 cerr << " elementFit::setParametersString parameters do not match for a BEND" << endl; 62 return; 63 } 64 65 specificName_ = param[++compteur]; 66 variableName_ = param[++compteur]; 67 variableValue_ = atof(param[++compteur].c_str()); 68 tolerance_ = atof(param[++compteur].c_str()); 50 if ( param == NULL ) { 51 cerr << " elementFit::setParametersString parameters empty parameter set"; 52 return; 53 } 54 int compteur = -1; 55 int nbparam = atoi(param[++compteur].c_str()); 56 if ( nbparam != nbParam_ ) { 57 cerr << " elementFit::setParametersString parameters do not match for a BEND" << endl; 58 return; 59 } 60 61 specificName_ = param[++compteur]; 62 variableName_ = param[++compteur]; 63 variableValue_ = atof(param[++compteur].c_str()); 64 tolerance_ = atof(param[++compteur].c_str()); 69 65 } 70 71 66 72 67 // string elementFit::parmelaOutputFlow() const … … 88 83 string elementFit::FileOutputFlow() const 89 84 { 90 91 92 93 94 95 85 ostringstream sortie; 86 // sortie << elementName_.getElementType() << endl; 87 sortie << elementName_.getGenericLabel() << endl; 88 sortie << specificName_ << endl; 89 sortie << variableName_ << " " << variableValue_ << " " << tolerance_ << endl; 90 return sortie.str(); 96 91 } 97 92 98 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const { 93 vector< pair<string, vector<string> > > elementFit::parametersToSoftware () const 94 { 99 95 vector< pair<string, vector<string> > > sortie; 100 96 sortie.push_back( pair<string, vector<string> >("labelsGenericSpecific", vector<string>() ) ); … … 108 104 } 109 105 110 111 106 void elementFit::FileInput(ifstream& ifs) 112 107 { 113 114 108 ifs >> specificName_; 109 ifs >> variableName_ >> variableValue_ >> tolerance_; 115 110 } 116 111 112 string elementFit::print() 113 { 114 string txt = ""; 115 txt += specificName_; 116 return txt; 117 } 117 118 118 string elementFit::print() { 119 string txt = ""; 120 121 txt += specificName_; 122 return txt; 119 void elementFit::InputRep(UAPNode* root) 120 { 121 UAPNode* ele = root->addChild("element"); 122 ele->addAttribute("name",specificName_); 123 124 UAPNode* node = ele->addChild("fit"); 125 string txt = variableName_; 126 node->addAttribute("attribute",txt); 127 txt = mixedTools::doubleToString(variableValue_); 128 node->addAttribute("design",txt); 129 txt = mixedTools::doubleToString(tolerance_); 130 node->addAttribute("err",txt); 123 131 }
Note: See TracChangeset
for help on using the changeset viewer.