Changeset 989bf6


Ignore:
Timestamp:
Jul 9, 2009, 11:01:08 AM (16 years ago)
Author:
Frederik Heber <heber@…>
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:
e72001
Parents:
1c6081
git-author:
Frederik Heber <heber@…> (07/09/09 10:59:00)
git-committer:
Frederik Heber <heber@…> (07/09/09 11:01:08)
Message:

Changed the unsatisfactory PathToDatabases construct, removing warning deprecated conversion from string constant to char *

  • new variable config::databasepath (initialized in config constructor, released in destructor)
  • Store.../LoadPeriodentafel() now have to receive const char *
  • PathToDatabases is removed, instead LocalPath is copied into config::databasepath
Location:
src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/builder.cpp

    r1c6081 r989bf6  
    12081208 * \return exit code (0 - successful, all else - something's wrong)
    12091209 */
    1210 static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, config& configuration, char *&ConfigFileName, char *&PathToDatabases)
     1210static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode, config& configuration, char *&ConfigFileName)
    12111211{
    12121212        Vector x,y,z,n; // coordinates for absolute point in cell volume
     
    12231223        clock_t start,end;
    12241224        int argptr;
    1225         PathToDatabases = LocalPath;
     1225  strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
    12261226
    12271227        // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
     
    12851285                                                } else {
    12861286                                                        cout << "Using " << argv[argptr] << " as elements database." << endl;
    1287                                                         PathToDatabases = argv[argptr];
     1287                                                        strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
    12881288                                                        argptr+=1;
    12891289                                                }
     
    13021302
    13031303                // 2. Parse the element database
    1304                 if (periode->LoadPeriodentafel(PathToDatabases)) {
     1304                if (periode->LoadPeriodentafel(configuration.databasepath)) {
    13051305                        cout << Verbose(0) << "Element list loaded successfully." << endl;
    13061306                        //periode->Output((ofstream *)&cout);
     
    17711771                }
    17721772        } else {        // no arguments, hence scan the elements db
    1773                 if (periode->LoadPeriodentafel(PathToDatabases))
     1773                if (periode->LoadPeriodentafel(configuration.databasepath))
    17741774                        cout << Verbose(0) << "Element list loaded successfully." << endl;
    17751775                else
     
    17941794        string line;
    17951795        char *ConfigFileName = NULL;
    1796         char *ElementsFileName = NULL;
    17971796        int j, count;
    17981797
    17991798        // =========================== PARSE COMMAND LINE OPTIONS ====================================
    1800         j = ParseCommandLineOptions(argc, argv, molecules, periode, configuration, ConfigFileName, ElementsFileName);
     1799        j = ParseCommandLineOptions(argc, argv, molecules, periode, configuration, ConfigFileName);
    18011800        if (j == 1) return 0; // just for -v and -h options
    18021801        if (j) return j;        // something went wrong
     
    18891888
    18901889        // save element data base
    1891         if (periode->StorePeriodentafel(ElementsFileName)) //ElementsFileName
     1890        if (periode->StorePeriodentafel(configuration.databasepath)) //ElementsFileName
    18921891                cout << Verbose(0) << "Saving of elements.db successful." << endl;
    18931892        else
  • src/config.cpp

    r1c6081 r989bf6  
    1414{
    1515        mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    16         defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    17         pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    18         configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    19         configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
     16        defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: defaultpath");
     17        pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: pseudopotpath");
     18  databasepath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: databasepath");
     19        configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configpath");
     20        configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configname");
    2021        strcpy(mainname,"pcp");
    2122        strcpy(defaultpath,"not specified");
     
    9394        Free((void **)&defaultpath, "config::~config: *defaultpath");
    9495        Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
     96  Free((void **)&databasepath, "config::~config: *databasepath");
    9597        Free((void **)&configpath, "config::~config: *configpath");
    9698        Free((void **)&configname, "config::~config: *configname");
  • src/molecules.hpp

    r1c6081 r989bf6  
    410410                string basis;
    411411
    412                 private:
     412    char *databasepath;
     413
     414        private:
    413415                char *mainname;
    414416                char *defaultpath;
  • src/periodentafel.cpp

    r1c6081 r989bf6  
    9292 * \return pointer to element
    9393 */
    94 element * periodentafel::FindElement(char *shorthand) const
     94element * periodentafel::FindElement(const char *shorthand) const
    9595{
    9696        element *walker =       periodentafel::start;
     
    162162 * \param *path to to standard file names
    163163 */
    164 bool periodentafel::LoadPeriodentafel(char *path)
     164bool periodentafel::LoadPeriodentafel(const char *path)
    165165{
    166166        ifstream infile;
     
    301301/** Stores element list to file.
    302302 */
    303 bool periodentafel::StorePeriodentafel(char *path) const
     303bool periodentafel::StorePeriodentafel(const char *path) const
    304304{
    305305        bool result = true;
  • src/periodentafel.hpp

    r1c6081 r989bf6  
    6666        bool CleanupPeriodtable();
    6767        element * FindElement(int Z);
    68         element * FindElement(char *shorthand) const;
     68        element * FindElement(const char *shorthand) const;
    6969        element * AskElement();
    7070        bool Output(ofstream *output) const;
    7171        bool Checkout(ofstream *output, const int *checkliste) const;
    72         bool LoadPeriodentafel(char *path = NULL);
    73         bool StorePeriodentafel(char *path = NULL) const;
     72        bool LoadPeriodentafel(const char *path);
     73        bool StorePeriodentafel(const char *path) const;
    7474
    7575        private:
Note: See TracChangeset for help on using the changeset viewer.