Changeset 7e3fc94


Ignore:
Timestamp:
Aug 6, 2010, 12:21:14 PM (14 years ago)
Author:
Tillmann Crueger <crueger@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
2a76b0
Parents:
2fe971
Message:

Made the element class use strings to store name and symbol

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/element.cpp

    r2fe971 r7e3fc94  
    6363}
    6464
    65 string element::getSymbol() const{
    66   return string(symbol);
     65string &element::getSymbol(){
     66  return symbol;
    6767}
    6868
    69 void element::setSymbol(const std::string &src){
    70   strncpy(symbol,src.c_str(),3);
    71   symbol[2]=0;
     69const string &element::getSymbol() const{
     70  return symbol;
    7271}
    7372
    74 std::string element::getName() const{
    75   return string(name);
     73std::string &element::getName(){
     74  return name;
    7675}
    7776
    78 void element::setName(const std::string &src){
    79   strncpy(name,src.c_str(),63);
    80   name[63]=0;
     77const std::string &element::getName() const{
     78  return name;
    8179}
    8280
  • src/element.hpp

    r2fe971 r7e3fc94  
    4646    // accessor functions
    4747    atomicNumber_t getNumber() const;
    48     std::string getSymbol() const;
    49     void setSymbol(const std::string&);
    50     std::string getName() const;
    51     void setName(const std::string&);
     48    std::string &getSymbol();
     49    const std::string &getSymbol() const;
     50    std::string &getName();
     51    const std::string &getName() const;
    5252
    5353    //> print element entries to screen
     
    5656
    5757  private:
    58     char name[64];  //!< atom name, i.e. "Hydrogren"
    59     char symbol[3]; //!< short form of the atom, i.e. "H"
     58    std::string name;  //!< atom name, i.e. "Hydrogren"
     59    std::string symbol; //!< short form of the atom, i.e. "H"
    6060};
    6161
  • src/periodentafel.cpp

    r2fe971 r7e3fc94  
    168168    cin >> tmp->mass;
    169169    DoLog(0) && (Log() << Verbose(0) << "Name [max 64 chars]: " << endl);
    170     string tmpstring;
    171     cin >> tmpstring;
    172     tmp->setName(tmpstring);
     170    cin >> tmp->getName();
    173171    DoLog(0) && (Log() << Verbose(0) << "Short form [max 3 chars]: " << endl);
    174     cin >> tmpstring;
    175     tmp->setSymbol(tmpstring);
     172    cin >> tmp->getSymbol();
    176173    AddElement(tmp);
    177174    return tmp;
     
    300297    while (!(*input).eof()) {
    301298      element *neues = new element;
    302       string tmpstring;
    303       (*input) >> tmpstring;
    304       neues->setName(tmpstring);
    305       //(*input) >> ws;
    306       (*input) >> tmpstring;
    307       neues->setSymbol(tmpstring);
     299      (*input) >> neues->getName();;
     300      //(*input) >> ws;
     301      (*input) >> neues->getSymbol();
    308302      //(*input) >> ws;
    309303      (*input) >> neues->period;
Note: See TracChangeset for help on using the changeset viewer.