- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

# /home/peifer/diffit/modules/freeMem.cc File Reference

`#include <math.h>`
`#include <stdlib.h>`
`#include <iostream>`
`#include "../def.h"`
`#include "../model.h"`
`#include "../nr.h"`

Go to the source code of this file.

## Functions
void | freeMem (GlobExp *ex, Glob *globs, int simit)

## Function Documentation

void freeMem | ( | GlobExp * | ex,
|  | Glob * | globs,
|  | int | simit
| ) |

| Definition at line 11 of file freeMem.cc. References FALSE, free_d3tensor(), free_dmatrix(), free_dvector(), Glob::gnuFp, GlobExp::me, GlobExp::mg, GlobExp::nMeasure, GlobExp::nobs, Glob::npar, Glob::nrExp, and GlobExp::nvar.
    00012 {
    00013   long nExp,i;
    00014   long nrExp=globs->nrExp;
    00015
    00016
    00017   delete globs->gnuFp;
    00018
    00019   if(simit==FALSE)
    00020     {
    00021       for (nExp=1;nExp<=nrExp;++nExp)
    00022         {
    00023           long nPoints=ex[nExp].nPoints;
    00024           long nP=globs->npar;
    00025           long nvar=ex[nExp].nvar, nobs=ex[nExp].nobs;
    00026           long nMeas=ex[nExp].nMeasure;
    00027           long  me=ex[nExp].me, mg=ex[nExp].mg;
    00028           free_dvector(ex[nExp].errP,1,nP);
    00029           free_dvector(ex[nExp].errY0,1,nvar);
    00030           free_dmatrix(ex[nExp].yTry,1,nPoints,1,nvar);
    00031           free_dmatrix(ex[nExp].yTrySave,1,nPoints,1,nvar);
    00032           free_dmatrix(ex[nExp].yComp,1,nPoints,1,nvar);
    00033           free_dmatrix(ex[nExp].yPred,1,nMeas,1,nobs);
    00034           free_dmatrix(ex[nExp].h,1,nPoints,1,nvar);
    00035           free_dmatrix(ex[nExp].residues,1,nMeas,1,nobs);
    00036           free_d3tensor(ex[nExp].dyds,1,nPoints,1,nvar,1,nvar);
    00037           free_d3tensor(ex[nExp].dydp,1,nPoints,1,nvar,1,nP);
    00038           free_d3tensor(ex[nExp].dmds,1,nMeas,1,nobs,1,nvar);
    00039           free_d3tensor(ex[nExp].dmdp,1,nMeas,1,nobs,1,nP);
    00040           if (me>0)
    00041             {
    00042               free_dvector(ex[nExp].r2,1,me);
    00043               free_d3tensor(ex[nExp].dR2ds,1,me,1,nPoints,1,nvar);
    00044               free_dmatrix(ex[nExp].dR2dp,1,me,1,nP);
    00045             }
    00046           if (mg>0)
    00047             {
    00048               free_dvector(ex[nExp].r3,1,mg);
    00049               free_d3tensor(ex[nExp].dR3ds,1,mg,1,nPoints,1,nvar);
    00050               free_dmatrix(ex[nExp].dR3dp,1,mg,1,nP);
    00051             }
    00052
    00053           free_dvector(ex[nExp].ua,1,nMeas*nobs);
    00054           free_dmatrix(ex[nExp].Ea,1,nMeas*nobs,1,nvar);
    00055           free_dmatrix(ex[nExp].Pa,1,nMeas*nobs,1,nP);
    00056           free_dvector(ex[nExp].ue,1,me);
    00057           free_dmatrix(ex[nExp].Ee,1,me,1,nvar);
    00058           free_dmatrix(ex[nExp].Pe,1,me,1,nP);
    00059           free_dvector(ex[nExp].ug,1,mg);
    00060           free_dmatrix(ex[nExp].Eg,1,mg,1,nvar);
    00061           free_dmatrix(ex[nExp].Pg,1,mg,1,nP);
    00062           free_dmatrix(ex[nExp].dS,1,nPoints,1,nvar);
    00063           free_dvector(ex[nExp].dP,1,nP);
    00064
    00065         }
    00066     }
    00067   for (nExp=1;nExp<=nrExp;++nExp)
    00068     {
    00069       free(ex[nExp].splineNodes);
    00070       free(ex[nExp].splineY);
    00071       free(ex[nExp].splineGam);
    00072       free(ex[nExp].nNodes);
    00073       for(i=1;i<=NSPLINES;i++)
    00074         {
    00075           free(ex[nExp].splineNodes[i]);
    00076           free(ex[nExp].splineY[i]);
    00077           free(ex[nExp].splineGam[i]);
    00078         }
    00079     }
    00080   if(simit==FALSE && globs->covar!=NULL)
    00081     free_dmatrix(globs->covar,1,globs->fitdim,1,globs->fitdim);
    00082 }