Changeset 13a574 for src/config.cpp


Ignore:
Timestamp:
Oct 5, 2009, 6:45: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, Candidate_v1.7.0, 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:
33f9f7
Parents:
aba92d (diff), fa861b (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 'ConvexHull' into ActOnAll

Conflicts:

molecuilder/src/Makefile.am

Boost implementation commit was overlapping with ActOnAllTest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config.cpp

    raba92d r13a574  
    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
     
    15361537  long file_position = file->tellg(); // mark current position
    15371538  char *dummy1, *dummy, *free_dummy;    // pointers in the line that is read in per step
    1538   dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char), "config::ParseForParameter: *free_dummy");
     1539  dummy1 = free_dummy = Malloc<char>(256, "config::ParseForParameter: *free_dummy");
    15391540
    15401541  //fprintf(stderr,"Parsing for %s\n",name);
     
    15511552      if (file->eof()) {
    15521553        if ((critical) && (found == 0)) {
    1553           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1554          Free(&free_dummy);
    15541555          //Error(InitReading, name);
    15551556          fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    15591560          file->clear();
    15601561          file->seekg(file_position, ios::beg);  // rewind to start position
    1561           Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1562          Free(&free_dummy);
    15621563          return 0;
    15631564        }
     
    16111612              if (file->eof()) {
    16121613                if ((critical) && (found == 0)) {
    1613                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1614                  Free(&free_dummy);
    16141615                  //Error(InitReading, name);
    16151616                  fprintf(stderr,"Error:InitReading, critical %s not found\n", name);
     
    16191620                  file->clear();
    16201621                  file->seekg(file_position, ios::beg);  // rewind to start position
    1621                   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1622                  Free(&free_dummy);
    16221623                  return 0;
    16231624                }
     
    16601661                  if (critical) {
    16611662                    if (verbose) fprintf(stderr,"Error: EoL at %i and still missing %i value(s) for parameter %s\n", line, yth-j, name);
    1662                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1663                    Free(&free_dummy);
    16631664                    //return 0;
    16641665                    exit(255);
     
    16681669                    file->clear();
    16691670                    file->seekg(file_position, ios::beg);  // rewind to start position
    1670                     Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1671                    Free(&free_dummy);
    16711672                    return 0;
    16721673                  }
     
    16811682                  file->seekg(file_position, ios::beg);  // rewind to start position
    16821683                }
    1683                 Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1684                Free(&free_dummy);
    16841685                return 0;
    16851686              }
     
    17351736    }
    17361737  }
    1737   if ((type >= row_int) && (verbose)) fprintf(stderr,"\n");
    1738   Free((void **)&free_dummy, "config::ParseForParameter: *free_dummy");
     1738  if ((type >= row_int) && (verbose))
     1739    fprintf(stderr,"\n");
     1740  Free(&free_dummy);
    17391741  if (!sequential) {
    17401742    file->clear();
     
    18141816        dummy = strchr(dummy1, '\n'); // set on line end then (whole line = keyword)
    18151817        //fprintf(stderr,"Error: Cannot find tabs or spaces on line %i in search for %s\n", line, name);
    1816         //Free((void **)&free_dummy);
     1818        //Free(&free_dummy);
    18171819        //Error(FileOpenParams, NULL);
    18181820      } else {
Note: See TracChangeset for help on using the changeset viewer.