Changeset a33931 for src/parser.cpp


Ignore:
Timestamp:
Oct 5, 2009, 4:05:53 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:
c26f44
Parents:
7dea7c (diff), c0917c (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' into ConvexHull

Conflicts:

.gitignore
molecuilder/src/Makefile.am
molecuilder/src/atom.cpp
molecuilder/src/tesselation.cpp

no serious overlaps, just a free Frees that were not present in ConcaveHull were MemoryAllocator class was added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/parser.cpp

    r7dea7c ra33931  
    88
    99#include "helpers.hpp"
     10#include "memoryallocator.hpp"
    1011#include "parser.hpp"
    1112
     
    5657MatrixContainer::MatrixContainer() {
    5758  Indices = NULL;
    58   Header = (char **) Malloc(sizeof(char)*1, "MatrixContainer::MatrixContainer: **Header");
    59   Matrix = (double ***) Malloc(sizeof(double **)*(1), "MatrixContainer::MatrixContainer: ***Matrix"); // one more each for the total molecule
    60   RowCounter = (int *) Malloc(sizeof(int)*(1), "MatrixContainer::MatrixContainer: *RowCounter");
    61   ColumnCounter = (int *) Malloc(sizeof(int)*(1), "MatrixContainer::MatrixContainer: *ColumnCounter");
     59  Header = Malloc<char*>(1, "MatrixContainer::MatrixContainer: **Header");
     60  Matrix = Malloc<double**>(1, "MatrixContainer::MatrixContainer: ***Matrix"); // one more each for the total molecule
     61  RowCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *RowCounter");
     62  ColumnCounter = Malloc<int>(1, "MatrixContainer::MatrixContainer: *ColumnCounter");
    6263  Header[0] = NULL;
    6364  Matrix[0] = NULL;
     
    7475      if ((ColumnCounter != NULL) && (RowCounter != NULL)) {
    7576          for(int j=RowCounter[i]+1;j--;)
    76             Free((void **)&Matrix[i][j], "MatrixContainer::~MatrixContainer: *Matrix[][]");
    77         Free((void **)&Matrix[i], "MatrixContainer::~MatrixContainer: **Matrix[]");
     77            Free(&Matrix[i][j]);
     78        Free(&Matrix[i]);
    7879      }
    7980    }
    8081    if ((ColumnCounter != NULL) && (RowCounter != NULL) && (Matrix[MatrixCounter] != NULL))
    8182      for(int j=RowCounter[MatrixCounter]+1;j--;)
    82         Free((void **)&Matrix[MatrixCounter][j], "MatrixContainer::~MatrixContainer: *Matrix[MatrixCounter][]");
     83        Free(&Matrix[MatrixCounter][j]);
    8384    if (MatrixCounter != 0)
    84       Free((void **)&Matrix[MatrixCounter], "MatrixContainer::~MatrixContainer: **Matrix[MatrixCounter]");
    85     Free((void **)&Matrix, "MatrixContainer::~MatrixContainer: ***Matrix");
     85      Free(&Matrix[MatrixCounter]);
     86    Free(&Matrix);
    8687  }
    8788  if (Indices != NULL)
    8889    for(int i=MatrixCounter+1;i--;) {
    89       Free((void **)&Indices[i], "MatrixContainer::~MatrixContainer: *Indices[]");
    90     }
    91   Free((void **)&Indices, "MatrixContainer::~MatrixContainer: **Indices");
     90      Free(&Indices[i]);
     91    }
     92  Free(&Indices);
    9293 
    9394  if (Header != NULL)
    9495    for(int i=MatrixCounter+1;i--;)
    95       Free((void **)&Header[i], "MatrixContainer::~MatrixContainer: *Header[]");
    96   Free((void **)&Header, "MatrixContainer::~MatrixContainer: **Header");
    97   Free((void **)&RowCounter, "MatrixContainer::~MatrixContainer: *RowCounter");
    98   Free((void **)&ColumnCounter, "MatrixContainer::~MatrixContainer: *RowCounter");
     96      Free(&Header[i]);
     97  Free(&Header);
     98  Free(&RowCounter);
     99  Free(&ColumnCounter);
    99100};
    100101
     
    109110  if (Matrix == NULL) {
    110111    cout << " with trivial mapping." << endl;
    111     Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "MatrixContainer::InitialiseIndices: **Indices");
     112    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    112113    for(int i=MatrixCounter+1;i--;) {
    113       Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
     114      Indices[i] = Malloc<int>(RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
    114115      for(int j=RowCounter[i];j--;)
    115116        Indices[i][j] = j;
     
    119120    if (MatrixCounter != Matrix->MatrixCounter)
    120121      return false;
    121     Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "MatrixContainer::InitialiseIndices: **Indices");
     122    Indices = Malloc<int*>(MatrixCounter + 1, "MatrixContainer::InitialiseIndices: **Indices");
    122123    for(int i=MatrixCounter+1;i--;) {
    123124      if (RowCounter[i] != Matrix->RowCounter[i])
    124125        return false;
    125       Indices[i] = (int *) Malloc(sizeof(int)*Matrix->RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
     126      Indices[i] = Malloc<int>(Matrix->RowCounter[i], "MatrixContainer::InitialiseIndices: *Indices[]");
    126127      for(int j=Matrix->RowCounter[i];j--;) {
    127128        Indices[i][j] = Matrix->Indices[i][j];
     
    162163
    163164  // parse header
    164   Header[MatrixNr] = (char *) Malloc(sizeof(char)*1024, "MatrixContainer::ParseMatrix: *Header[]");
     165  Header[MatrixNr] = Malloc<char>(1024, "MatrixContainer::ParseMatrix: *Header[]");
    165166  for (int m=skiplines+1;m--;)
    166167    input.getline(Header[MatrixNr], 1023);
     
    197198  // allocate matrix if it's not zero dimension in one direction
    198199  if ((ColumnCounter[MatrixNr] > 0) && (RowCounter[MatrixNr] > -1)) {
    199     Matrix[MatrixNr] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixNr]+1), "MatrixContainer::ParseMatrix: **Matrix[]");
     200    Matrix[MatrixNr] = Malloc<double*>(RowCounter[MatrixNr] + 1, "MatrixContainer::ParseMatrix: **Matrix[]");
    200201 
    201202    // parse in each entry for this matrix
     
    209210    strncpy(Header[MatrixNr], line.str().c_str(), 1023); 
    210211    for(int j=0;j<RowCounter[MatrixNr];j++) {
    211       Matrix[MatrixNr][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[][]");
     212      Matrix[MatrixNr][j] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[][]");
    212213      input.getline(filename, 1023);
    213214      stringstream lines(filename);
     
    220221      }
    221222      //cout << endl;
    222       Matrix[MatrixNr][ RowCounter[MatrixNr] ] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
     223      Matrix[MatrixNr][ RowCounter[MatrixNr] ] = Malloc<double>(ColumnCounter[MatrixNr], "MatrixContainer::ParseMatrix: *Matrix[RowCounter[MatrixNr]][]");
    223224      for(int j=ColumnCounter[MatrixNr];j--;)
    224225        Matrix[MatrixNr][ RowCounter[MatrixNr] ][j] = 0.;
     
    274275
    275276  cout << "Parsing through each fragment and retrieving " << prefix << suffix << "." << endl;
    276   Header = (char **) ReAlloc(Header, sizeof(char *)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
    277   Matrix = (double ***) ReAlloc(Matrix, sizeof(double **)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
    278   RowCounter = (int *) ReAlloc(RowCounter, sizeof(int)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: *RowCounter");
    279   ColumnCounter = (int *) ReAlloc(ColumnCounter, sizeof(int)*(MatrixCounter+1), "MatrixContainer::ParseFragmentMatrix: *ColumnCounter");
     277  Header = ReAlloc<char*>(Header, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: **Header"); // one more each for the total molecule
     278  Matrix = ReAlloc<double**>(Matrix, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: ***Matrix"); // one more each for the total molecule
     279  RowCounter = ReAlloc<int>(RowCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *RowCounter");
     280  ColumnCounter = ReAlloc<int>(ColumnCounter, MatrixCounter + 1, "MatrixContainer::ParseFragmentMatrix: *ColumnCounter");
    280281  for(int i=MatrixCounter+1;i--;) {
    281282    Matrix[i] = NULL;
     
    291292    if (!ParseMatrix(file.str().c_str(), skiplines, skipcolumns, i))
    292293      return false;
    293     Free((void **)&FragmentNumber, "MatrixContainer::ParseFragmentMatrix: *FragmentNumber");
     294    Free(&FragmentNumber);
    294295  }
    295296  return true;
     
    306307{
    307308  MatrixCounter = MCounter;
    308   Header = (char **) Malloc(sizeof(char *)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *Header");
    309   Matrix = (double ***) Malloc(sizeof(double **)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: ***Matrix"); // one more each for the total molecule
    310   RowCounter = (int *) Malloc(sizeof(int)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *RowCounter");
    311   ColumnCounter = (int *) Malloc(sizeof(int)*(MatrixCounter+1), "MatrixContainer::AllocateMatrix: *ColumnCounter");
     309  Header = Malloc<char*>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *Header");
     310  Matrix = Malloc<double**>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: ***Matrix"); // one more each for the total molecule
     311  RowCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *RowCounter");
     312  ColumnCounter = Malloc<int>(MatrixCounter + 1, "MatrixContainer::AllocateMatrix: *ColumnCounter");
    312313  for(int i=MatrixCounter+1;i--;) {
    313     Header[i] = (char *) Malloc(sizeof(char)*1024, "MatrixContainer::AllocateMatrix: *Header[i]");
     314    Header[i] = Malloc<char>(1024, "MatrixContainer::AllocateMatrix: *Header[i]");
    314315    strncpy(Header[i], GivenHeader[i], 1023);
    315316    RowCounter[i] = RCounter[i];
    316317    ColumnCounter[i] = CCounter[i];
    317     Matrix[i] = (double **) Malloc(sizeof(double *)*(RowCounter[i]+1), "MatrixContainer::AllocateMatrix: **Matrix[]"); 
     318    Matrix[i] = Malloc<double*>(RowCounter[i] + 1, "MatrixContainer::AllocateMatrix: **Matrix[]");
    318319    for(int j=RowCounter[i]+1;j--;) {
    319       Matrix[i][j] = (double *) Malloc(sizeof(double)*ColumnCounter[i], "MatrixContainer::AllocateMatrix: *Matrix[][]");
     320      Matrix[i][j] = Malloc<double>(ColumnCounter[i], "MatrixContainer::AllocateMatrix: *Matrix[][]");
    320321      for(int k=ColumnCounter[i];k--;)
    321322        Matrix[i][j][k] = 0.;
     
    466467    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    467468    line << name << FRAGMENTPREFIX << FragmentNumber << "/" << prefix;
    468     Free((void **)&FragmentNumber, "*FragmentNumber");
     469    Free(&FragmentNumber);
    469470    output.open(line.str().c_str(), ios::out);
    470471    if (output == NULL) {
     
    520521{
    521522  cout << "Parsing energy indices." << endl;
    522   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "EnergyMatrix::ParseIndices: **Indices");
     523  Indices = Malloc<int*>(MatrixCounter + 1, "EnergyMatrix::ParseIndices: **Indices");
    523524  for(int i=MatrixCounter+1;i--;) {
    524     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "EnergyMatrix::ParseIndices: *Indices[]");
     525    Indices[i] = Malloc<int>(RowCounter[i], "EnergyMatrix::ParseIndices: *Indices[]");
    525526    for(int j=RowCounter[i];j--;)
    526527      Indices[i][j] = j;
     
    579580    // allocate last plus one matrix
    580581    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    581     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     582    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    582583    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    583       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     584      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    584585   
    585586    // try independently to parse global energysuffix file if present
     
    606607
    607608  cout << "Parsing force indices for " << MatrixCounter << " matrices." << endl;
    608   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "ForceMatrix::ParseIndices: **Indices");
     609  Indices = Malloc<int*>(MatrixCounter + 1, "ForceMatrix::ParseIndices: **Indices");
    609610  line << name << FRAGMENTPREFIX << FORCESFILE;
    610611  input.open(line.str().c_str(), ios::in);
     
    619620    line.str(filename);
    620621    // parse the values
    621     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
     622    Indices[i] = Malloc<int>(RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
    622623    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    623624    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    624     Free((void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber");
     625    Free(&FragmentNumber);
    625626    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    626627      line >> Indices[i][j];
     
    629630    //cout << endl;
    630631  }
    631   Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
     632  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
    632633  for(int j=RowCounter[MatrixCounter];j--;) {
    633634    Indices[MatrixCounter][j] = j;
     
    714715    // allocate last plus one matrix
    715716    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    716     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     717    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    717718    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    718       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     719      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    719720
    720721    // try independently to parse global forcesuffix file if present
     
    743744 
    744745  cout << "Parsing hessian indices for " << MatrixCounter << " matrices." << endl;
    745   Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "HessianMatrix::ParseIndices: **Indices");
     746  Indices = Malloc<int*>(MatrixCounter + 1, "HessianMatrix::ParseIndices: **Indices");
    746747  line << name << FRAGMENTPREFIX << FORCESFILE;
    747748  input.open(line.str().c_str(), ios::in);
     
    756757    line.str(filename);
    757758    // parse the values
    758     Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
     759    Indices[i] = Malloc<int>(RowCounter[i], "HessianMatrix::ParseIndices: *Indices[]");
    759760    FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    760761    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    761     Free((void **)&FragmentNumber, "HessianMatrix::ParseIndices: *FragmentNumber");
     762    Free(&FragmentNumber);
    762763    for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    763764      line >> Indices[i][j];
     
    766767    //cout << endl;
    767768  }
    768   Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
     769  Indices[MatrixCounter] = Malloc<int>(RowCounter[MatrixCounter], "HessianMatrix::ParseIndices: *Indices[]");
    769770  for(int j=RowCounter[MatrixCounter];j--;) {
    770771    Indices[MatrixCounter][j] = j;
     
    938939    // allocate last plus one matrix
    939940    cout << "Allocating last plus one matrix with " << (RowCounter[MatrixCounter]+1) << " rows and " << ColumnCounter[MatrixCounter] << " columns." << endl;
    940     Matrix[MatrixCounter] = (double **) Malloc(sizeof(double *)*(RowCounter[MatrixCounter]+1), "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
     941    Matrix[MatrixCounter] = Malloc<double*>(RowCounter[MatrixCounter] + 1, "MatrixContainer::ParseFragmentMatrix: **Matrix[]");
    941942    for(int j=0;j<=RowCounter[MatrixCounter];j++)
    942       Matrix[MatrixCounter][j] = (double *) Malloc(sizeof(double)*ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
     943      Matrix[MatrixCounter][j] = Malloc<double>(ColumnCounter[MatrixCounter], "MatrixContainer::ParseFragmentMatrix: *Matrix[][]");
    943944
    944945    // try independently to parse global forcesuffix file if present
     
    970971KeySetsContainer::~KeySetsContainer() {
    971972  for(int i=FragmentCounter;i--;)
    972     Free((void **)&KeySets[i], "KeySetsContainer::~KeySetsContainer: *KeySets[]");
     973    Free(&KeySets[i]);
    973974  for(int i=Order;i--;)
    974     Free((void **)&OrderSet[i], "KeySetsContainer::~KeySetsContainer: *OrderSet[]");
    975   Free((void **)&KeySets, "KeySetsContainer::~KeySetsContainer: **KeySets");
    976   Free((void **)&OrderSet, "KeySetsContainer::~KeySetsContainer: **OrderSet");
    977   Free((void **)&AtomCounter, "KeySetsContainer::~KeySetsContainer: *AtomCounter");
    978   Free((void **)&FragmentsPerOrder, "KeySetsContainer::~KeySetsContainer: *FragmentsPerOrder");
     975    Free(&OrderSet[i]);
     976  Free(&KeySets);
     977  Free(&OrderSet);
     978  Free(&AtomCounter);
     979  Free(&FragmentsPerOrder);
    979980};
    980981
     
    993994  FragmentCounter = FCounter;
    994995  cout << "Parsing key sets." << endl;
    995   KeySets = (int **) Malloc(sizeof(int *)*FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
     996  KeySets = Malloc<int*>(FragmentCounter, "KeySetsContainer::ParseKeySets: **KeySets");
    996997  for(int i=FragmentCounter;i--;)
    997998    KeySets[i] = NULL;
     
    10031004  }
    10041005
    1005   AtomCounter = (int *) Malloc(sizeof(int)*FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");
     1006  AtomCounter = Malloc<int>(FragmentCounter, "KeySetsContainer::ParseKeySets: *RowCounter");
    10061007  for(int i=0;(i<FragmentCounter) && (!input.eof());i++) {
    10071008    stringstream line;
    10081009    AtomCounter[i] = ACounter[i];
    10091010    // parse the values
    1010     KeySets[i] = (int *) Malloc(sizeof(int)*AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
     1011    KeySets[i] = Malloc<int>(AtomCounter[i], "KeySetsContainer::ParseKeySets: *KeySets[]");
    10111012    for(int j=AtomCounter[i];j--;)
    10121013      KeySets[i][j] = -1;
    10131014    FragmentNumber = FixedDigitNumber(FragmentCounter, i);
    10141015    //cout << FRAGMENTPREFIX << FragmentNumber << "[" << AtomCounter[i] << "]:";
    1015     Free((void **)&FragmentNumber, "KeySetsContainer::ParseKeySets: *FragmentNumber");
     1016    Free(&FragmentNumber);
    10161017    input.getline(filename, 1023);
    10171018    line.str(filename);
     
    10471048
    10481049  // scan through all to determine fragments per order
    1049   FragmentsPerOrder = (int *) Malloc(sizeof(int)*Order, "KeySetsContainer::ParseManyBodyTerms: *FragmentsPerOrder");
     1050  FragmentsPerOrder = Malloc<int>(Order, "KeySetsContainer::ParseManyBodyTerms: *FragmentsPerOrder");
    10501051  for(int i=Order;i--;)
    10511052    FragmentsPerOrder[i] = 0;
     
    10611062
    10621063  // scan through all to gather indices to each order set
    1063   OrderSet = (int **) Malloc(sizeof(int *)*Order, "KeySetsContainer::ParseManyBodyTerms: **OrderSet");
     1064  OrderSet = Malloc<int*>(Order, "KeySetsContainer::ParseManyBodyTerms: **OrderSet");
    10641065  for(int i=Order;i--;)
    1065     OrderSet[i] = (int *) Malloc(sizeof(int)*FragmentsPerOrder[i], "KeySetsContainer::ParseManyBodyTermsKeySetsContainer::ParseManyBodyTerms: *OrderSet[]");
     1066    OrderSet[i] = Malloc<int>(FragmentsPerOrder[i], "KeySetsContainer::ParseManyBodyTermsKeySetsContainer::ParseManyBodyTerms: *OrderSet[]");
    10661067  for(int i=Order;i--;)
    10671068    FragmentsPerOrder[i] = 0;
Note: See TracChangeset for help on using the changeset viewer.