Changeset 41194a for src/config.cpp


Ignore:
Timestamp:
Oct 5, 2009, 2:35:06 PM (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:
c0917c
Parents:
0227a9 (diff), c30180 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ConcaveHull' of ssh://stud64d-02/home/metzler/workspace/espack into ConcaveHull

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    r0227a9 r41194a  
    66
    77#include "config.hpp"
     8#include "memoryallocator.hpp"
    89
    910/******************************** Functions for class ConfigFileBuffer **********************/
     
    8687    return;
    8788  } else
    88     buffer = (char **) Malloc(sizeof(char *)*NoLines, "ConfigFileBuffer::ConfigFileBuffer: **buffer");
     89    buffer = Malloc<char*>(NoLines, "ConfigFileBuffer::ConfigFileBuffer: **buffer");
    8990
    9091  // scan each line and put into buffer
     
    9293  int i;
    9394  do {
    94     buffer[lines] = (char *) Malloc(sizeof(char)*MAXSTRINGSIZE, "ConfigFileBuffer::ConfigFileBuffer: *buffer[]");
     95    buffer[lines] = Malloc<char>(MAXSTRINGSIZE, "ConfigFileBuffer::ConfigFileBuffer: *buffer[]");
    9596    file->getline(buffer[lines], MAXSTRINGSIZE-1);
    9697    i = strlen(buffer[lines]);
     
    112113{
    113114  for(int i=0;i<NoLines;++i)
    114     Free((void **)&buffer[i], "ConfigFileBuffer::~ConfigFileBuffer: *buffer[]");
    115   Free((void **)&buffer, "ConfigFileBuffer::~ConfigFileBuffer: **buffer");
    116   Free((void **)&LineMapping, "ConfigFileBuffer::~ConfigFileBuffer: *LineMapping");
     115    Free(&buffer[i]);
     116  Free(&buffer);
     117  Free(&LineMapping);
    117118}
    118119
     
    122123void ConfigFileBuffer::InitMapping()
    123124{
    124   LineMapping = (int *) Malloc(sizeof(int)*NoLines, "ConfigFileBuffer::InitMapping: *LineMapping");
     125  LineMapping = Malloc<int>(NoLines, "ConfigFileBuffer::InitMapping: *LineMapping");
    125126  for (int i=0;i<NoLines;i++)
    126127    LineMapping[i] = i;
     
    163164config::config()
    164165{
    165   mainname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: mainname");
    166   defaultpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: defaultpath");
    167   pseudopotpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: pseudopotpath");
    168   databasepath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: databasepath");
    169   configpath = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configpath");
    170   configname = (char *) MallocString(sizeof(char)*MAXSTRINGSIZE,"config constructor: configname");
    171   ThermostatImplemented = (int *) Malloc((MaxThermostats)*(sizeof(int)), "config constructor: *ThermostatImplemented");
    172   ThermostatNames = (char **) Malloc((MaxThermostats)*(sizeof(char *)), "config constructor: *ThermostatNames");
     166  mainname = Malloc<char>(MAXSTRINGSIZE,"config constructor: mainname");
     167  defaultpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: defaultpath");
     168  pseudopotpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: pseudopotpath");
     169  databasepath = Malloc<char>(MAXSTRINGSIZE,"config constructor: databasepath");
     170  configpath = Malloc<char>(MAXSTRINGSIZE,"config constructor: configpath");
     171  configname = Malloc<char>(MAXSTRINGSIZE,"config constructor: configname");
     172  ThermostatImplemented = Malloc<int>(MaxThermostats, "config constructor: *ThermostatImplemented");
     173  ThermostatNames = Malloc<char*>(MaxThermostats, "config constructor: *ThermostatNames");
    173174  for (int j=0;j<MaxThermostats;j++)
    174     ThermostatNames[j] = (char *) MallocString(12*(sizeof(char)), "config constructor: ThermostatNames[]");
     175    ThermostatNames[j] = Malloc<char>(12, "config constructor: ThermostatNames[]");
    175176  Thermostat = 4;
    176177  alpha = 0.;
     
    263264config::~config()
    264265{
    265   Free((void **)&mainname, "config::~config: *mainname");
    266   Free((void **)&defaultpath, "config::~config: *defaultpath");
    267   Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
    268   Free((void **)&databasepath, "config::~config: *databasepath");
    269   Free((void **)&configpath, "config::~config: *configpath");
    270   Free((void **)&configname, "config::~config: *configname");
    271   Free((void **)&ThermostatImplemented, "config::~config: *ThermostatImplemented");
     266  Free(&mainname);
     267  Free(&defaultpath);
     268  Free(&pseudopotpath);
     269  Free(&databasepath);
     270  Free(&configpath);
     271  Free(&configname);
     272  Free(&ThermostatImplemented);
    272273  for (int j=0;j<MaxThermostats;j++)
    273     Free((void **)&ThermostatNames[j], "config::~config: *ThermostatNames[]");
    274   Free((void **)&ThermostatNames, "config::~config: **ThermostatNames");
     274    Free(&ThermostatNames[j]);
     275  Free(&ThermostatNames);
    275276};
    276277
     
    280281void config::InitThermostats(class ConfigFileBuffer *fb)
    281282{
    282   char *thermo = MallocString(12, "IonsInitRead: thermo");
     283  char *thermo = Malloc<char>(12, "IonsInitRead: thermo");
    283284  int verbose = 0;
    284285
     
    347348    Thermostat = None;
    348349  }
    349   Free((void **)&thermo, "InitThermostats: thermo");
     350  Free(&thermo);
    350351};
    351352
     
    15331534  long file_position = file->tellg(); // mark current position
    15341535  char *dummy1, *dummy, *free_dummy;    // pointers in the line that is read in per step
    1535   dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char), "config::ParseForParameter: *free_dummy");
     1536  dummy1 = free_dummy = Malloc<char>(256, "config::ParseForParameter: *free_dummy");
    15361537
    15371538  //fprintf(stderr,"Parsing for %s\n",name);
     
    15481549      if (file->eof()) {
    15491550        if ((critical) && (found == 0)) {
    1550           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1551          Free(&free_dummy);
    15511552          //Error(InitReading, name);
    15521553          fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    15561557          file->clear();
    15571558          file->seekg(file_position, ios::beg);  // rewind to start position
    1558           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1559          Free(&free_dummy);
    15591560          return 0;
    15601561        }
     
    16081609              if (file->eof()) {
    16091610                if ((critical) && (found == 0)) {
    1610                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1611                  Free(&free_dummy);
    16111612                  //Error(InitReading, name);
    16121613                  fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    16161617                  file->clear();
    16171618                  file->seekg(file_position, ios::beg);  // rewind to start position
    1618                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1619                  Free(&free_dummy);
    16191620                  return 0;
    16201621                }
     
    16571658                  if (critical) {
    16581659                    if (verbose) fprintf(stderr,"Error: EoL at %i and still missing %i value(s) for parameter %s\n", line, yth-j, name);
    1659                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1660                    Free(&free_dummy);
    16601661                    //return 0;
    16611662                    exit(255);
     
    16651666                    file->clear();
    16661667                    file->seekg(file_position, ios::beg);  // rewind to start position
    1667                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1668                    Free(&free_dummy);
    16681669                    return 0;
    16691670                  }
     
    16781679                  file->seekg(file_position, ios::beg);  // rewind to start position
    16791680                }
    1680                 Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1681                Free(&free_dummy);
    16811682                return 0;
    16821683              }
     
    17321733    }
    17331734  }
    1734   if ((type >= row_int) && (verbose)) fprintf(stderr,"\n");
    1735   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1735  if ((type >= row_int) && (verbose))
     1736    fprintf(stderr,"\n");
     1737  Free(&free_dummy);
    17361738  if (!sequential) {
    17371739    file->clear();
     
    18111813        dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword)
    18121814        //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name);
    1813         //Free((void **)&free_dummy);
     1815        //Free(&free_dummy);
    18141816        //Error(FileOpenParams, NULL);
    18151817      } else {
Note: See TracChangeset for help on using the changeset viewer.