Changeset 15335


Ignore:
Timestamp:
06/26/13 07:22:28 (12 years ago)
Author:
Mathieu Morlighem
Message:

BUG: use Contour constructor instead of xNew otherwise delete contours will crash

Location:
issm/trunk-jpl/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/datastructures/Object.h

    r15067 r15335  
    1515        public:
    1616
    17                 virtual       ~Object() {};
     17                virtual       ~Object(){};
    1818                virtual void  Echo()=0;
    1919                virtual void  DeepEcho()=0;
  • issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.cpp

    r14968 r15335  
    1010#include "./ContourToMeshx.h"
    1111
    12 int ContourToMeshx(double** pin_nod,double** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue) {
     12int ContourToMeshx(double** pin_nod,double** pin_elem, double* index, double* x, double* y,Contours* contours,char* interptype,int nel,int nods, int edgevalue) {
    1313
    1414        /*Contour:*/
  • issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.h

    r15000 r15335  
    1212typedef struct{
    1313
    14         DataSet *contours;
    15         int    nods;
    16         int    edgevalue;
    17         double* in_nod;
    18         double *x;
    19         double *y;
     14        Contours *contours;
     15        int       nods;
     16        int       edgevalue;
     17        double   *in_nod;
     18        double   *x;
     19        double   *y;
    2020
    2121} ContourToMeshxThreadStruct;
    2222
    2323/* local prototypes: */
    24 int ContourToMeshx(double** pin_nods,double** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue);
     24int ContourToMeshx(double** pin_nods,double** pin_elem, double* index, double* x, double* y,Contours* contours,char* interptype,int nel,int nods, int edgevalue);
    2525
    2626void* ContourToMeshxt(void* vContourToMeshxThreadStruct);
  • issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp

    r14965 r15335  
    2626
    2727        /*Contour:*/
    28         DataSet* contours=NULL;
     28        Contours* contours=NULL;
    2929
    3030        /*parameters: */
  • issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp

    r14968 r15335  
    3232}
    3333
    34 int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue){
     34int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, Contours* contours, int edgevalue){
    3535
    3636        /*Contour:*/
  • issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.h

    r15000 r15335  
    1111/* local prototypes: */
    1212int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, Contour<IssmPDouble>** contours,int numcontours,int edgevalue);
    13 int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue);
     13int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, Contours* contours, int edgevalue);
    1414
    1515#endif /* _CONTOURTONODESX_H */
  • issm/trunk-jpl/src/c/modules/EdgeDetectionx/EdgeDetectionx.cpp

    r14999 r15335  
    99/*}}}*/
    1010
    11 void EdgeDetectionx(DataSet* contours, bool* image, int M, int N){
     11void EdgeDetectionx(Contours* contours, bool* image, int M, int N){
    1212
    1313        /*intermediary: */
  • issm/trunk-jpl/src/c/modules/EdgeDetectionx/EdgeDetectionx.h

    r15000 r15335  
    1010
    1111/* local prototypes: */
    12 void EdgeDetectionx(DataSet* contours, bool* image, int M, int N);
     12void EdgeDetectionx(Contours* contours, bool* image, int M, int N);
    1313
    1414#endif  /* _EDGEDETECTIONX_H */
  • issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp

    r14999 r15335  
    1919/*}}}*/
    2020
    21 void TriMeshx(int** pindex,IssmPDouble** px,IssmPDouble** py,int** psegments,int** psegmentmarkerlist,int* pnels,int* pnods, int* pnsegs,DataSet* domain,DataSet* rifts,double area){
     21void TriMeshx(int** pindex,IssmPDouble** px,IssmPDouble** py,int** psegments,int** psegmentmarkerlist,int* pnels,int* pnods, int* pnsegs,Contours* domain,Contours* rifts,double area){
    2222
    2323#if !defined(_HAVE_TRIANGLE_)
  • issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.h

    r15000 r15335  
    1010
    1111/* local prototypes: */
    12 void TriMeshx(int** pindex,IssmPDouble** px,IssmPDouble** py,int** psegments,int** psegmentmarkerlist,int* pnels,int* pnods, int* pnseg,DataSet* domain,DataSet* rifts,double area);
     12void TriMeshx(int** pindex,IssmPDouble** px,IssmPDouble** py,int** psegments,int** psegmentmarkerlist,int* pnels,int* pnods, int* pnseg,Contours* domain,Contours* rifts,double area);
    1313#endif  /* _TRIMESHX_H */
  • issm/trunk-jpl/src/wrappers/ContourToMesh/ContourToMesh.cpp

    r15106 r15335  
    3030
    3131        /* required input: */
    32         int      edgevalue;
    33         int      nel,nods;
    34         double  *index       = NULL;
    35         double  *x           = NULL;
    36         double  *y           = NULL;
    37         char    *interptype  = NULL;
    38         DataSet *contours    = NULL;
     32        int       edgevalue;
     33        int       nel,nods;
     34        double   *index       = NULL;
     35        double   *x           = NULL;
     36        double   *y           = NULL;
     37        char     *interptype  = NULL;
     38        Contours *contours    = NULL;
    3939
    4040        /* output: */
  • issm/trunk-jpl/src/wrappers/ContourToNodes/ContourToNodes.cpp

    r15329 r15335  
    1818
    1919        /* input: */
    20         int      edgevalue,nods;
    21         double  *x           = NULL;
    22         double  *y           = NULL;
    23         char    *contourname = NULL;
    24         DataSet *contours    = NULL;
     20        int       edgevalue,nods;
     21        double   *x           = NULL;
     22        double   *y           = NULL;
     23        char     *contourname = NULL;
     24        Contours *contours    = NULL;
    2525
    2626        /* output: */
     
    4949        xDelete<double>(y);
    5050        xDelete<char>(contourname);
    51         //delete contours;
     51        delete contours;
    5252
    5353        /*end module: */
  • issm/trunk-jpl/src/wrappers/EdgeDetection/EdgeDetection.cpp

    r15106 r15335  
    2525
    2626        /* output: */
    27         DataSet* contours=NULL;
     27        Contours* contours=NULL;
    2828
    2929        /*Boot module: */
     
    3737
    3838        /*Initialize output: */
    39         contours=new DataSet();
     39        contours=new Contours();
    4040
    4141        /* Run core computations: */
  • issm/trunk-jpl/src/wrappers/ExpSimplify/ExpSimplify.cpp

    r15106 r15335  
    183183                if(newnods>=minimumvertices){
    184184                        _printf_("   Final   number of vertices in contour #"<<counter+1<<": "<<newnods << "\n");
    185                         newcontour       = xNew<Contour<double> >(1);
     185                        newcontour       = new Contour<double>();
    186186                        newcontour->nods = newnods;
    187187                        newcontour->x    = xNew<double>(newnods);
  • issm/trunk-jpl/src/wrappers/InterpFromMesh2d/InterpFromMesh2d.cpp

    r15106 r15335  
    101101                for(i=0;i<numcontours;i++){
    102102                        //allocate
    103                         contouri=xNew<Contour<double> >(1);
     103                        contouri=new Contour<double>();
    104104                        //retrieve dimension of this contour.
    105105                        contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
  • issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp

    r15106 r15335  
    3636        /* required input: */
    3737        //mesh
    38         double* double_index=NULL;
    39         int*    index=NULL;
     38        double *double_index = NULL;
     39        int    *index        = NULL;
    4040        int     nel;
    41         double* x=NULL;
    42         double* y=NULL;
     41        double *x            = NULL;
     42        double *y            = NULL;
    4343        int     nods;
    4444        int     dummy;
    4545
    4646        //contours
    47         DataSet          *domain      = NULL;
     47        Contours         *domain      = NULL;
    4848        Contour<double> **contours=NULL;
    4949        int               numcontours;
  • issm/trunk-jpl/src/wrappers/TriMesh/TriMesh.cpp

    r15106 r15335  
    1717
    1818        /*intermediary: */
    19         double   area;
    20         DataSet *domain = NULL;
    21         DataSet *rifts  = NULL;
     19        double    area;
     20        Contours *domain = NULL;
     21        Contours *rifts  = NULL;
    2222
    2323        /* output: */
  • issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp

    r15269 r15335  
    634634}
    635635/*}}}*/
    636 /*FUNCTION FetchData(DataSet** pcontours,const mxArray* dataref){{{*/
    637 void FetchData(DataSet** pcontours,const mxArray* dataref){
    638 
    639         int              numcontours,index,test1,test2;
     636/*FUNCTION FetchData(Contours** pcontours,const mxArray* dataref){{{*/
     637void FetchData(Contours** pcontours,const mxArray* dataref){
     638
     639        int             numcontours,index,test1,test2;
    640640        char            *contourname = NULL;
    641         Contours         *contours    = NULL;
     641        Contours        *contours    = NULL;
    642642        Contour<double> *contouri    = NULL;
    643643
     
    653653                for(int i=0;i<numcontours;i++){
    654654
    655                         contouri=xNew<Contour<double> >(1);
     655                        contouri=new Contour<double>();
    656656
    657657                        index = mxGetFieldNumber(dataref,"nods");
  • issm/trunk-jpl/src/wrappers/matlab/io/WriteMatlabData.cpp

    r15269 r15335  
    360360}
    361361/*}}}*/
    362 /*FUNCTION WriteData(mxArray** pdataref,DataSet* contours){{{*/
    363 void WriteData(mxArray** pdataref,DataSet* contours){
     362/*FUNCTION WriteData(mxArray** pdataref,Contours* contours){{{*/
     363void WriteData(mxArray** pdataref,Contours* contours){
    364364
    365365        /*Intermediary*/
  • issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h

    r15269 r15335  
    3232void WriteData(mxArray** pdataref,BamgMesh* bamgmesh);
    3333void WriteData(mxArray** pdataref,RiftStruct* riftstruct);
    34 void WriteData(mxArray** pdataref,DataSet* contours);
     34void WriteData(mxArray** pdataref,Contours* contours);
    3535
    3636void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
     
    5454void FetchData(BamgOpts** bamgopts,const mxArray* dataref);
    5555void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref);
    56 void FetchData(DataSet** pcontours,const mxArray* dataref);
     56void FetchData(Contours** pcontours,const mxArray* dataref);
    5757
    5858Option* OptionParse(char* name, const mxArray* prhs[]);
  • issm/trunk-jpl/src/wrappers/python/io/FetchPythonData.cpp

    r15105 r15335  
    739739}
    740740/*}}}*/
    741 /*FUNCTION FetchData(DataSet** pcontours,PyObject* py_list){{{*/
    742 void FetchData(DataSet** pcontours,PyObject* py_list){
     741/*FUNCTION FetchData(Contours** pcontours,PyObject* py_list){{{*/
     742void FetchData(Contours** pcontours,PyObject* py_list){
    743743
    744744        int              numcontours,test1,test2;
    745745        char            *contourname = NULL;
    746         DataSet         *contours    = NULL;
     746        Contours         *contours    = NULL;
    747747        Contour<double> *contouri    = NULL;
    748748        PyObject        *py_dicti    = NULL;
     
    755755        else if(PyList_Check(py_list)){
    756756
    757                 contours=new DataSet(0);
     757                contours=new Contours();
    758758                numcontours=(int)PyList_Size(py_list);
    759759
    760760                for(int i=0;i<numcontours;i++){
    761761
    762                         contouri=xNew<Contour<double> >(1);
     762                        contouri=new Contour<double>();
    763763                        py_dicti=PyList_GetItem(py_list,(Py_ssize_t)i);
    764764
  • issm/trunk-jpl/src/wrappers/python/io/pythonio.h

    r15165 r15335  
    4545void FetchData(BamgOpts** bamgopts,PyObject* py_dict);
    4646void FetchData(Options** poptions,int istart, int nrhs,PyObject* py_tuple);
    47 void FetchData(DataSet** pcontours,PyObject* py_list);
     47void FetchData(Contours** pcontours,PyObject* py_list);
    4848
    4949int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void ));
Note: See TracChangeset for help on using the changeset viewer.