Changeset 14714


Ignore:
Timestamp:
04/23/13 08:09:48 (12 years ago)
Author:
Eric.Larour
Message:

CHG: new EdgeDetection wrapper

Location:
issm/trunk-jpl/src
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r14708 r14714  
    804804                        ./modules/HoleFillerx/HoleFillerx.cpp\
    805805                        ./modules/HoleFillerx/HoleFillerx.h\
     806                        ./modules/EdgeDetectionx/EdgeDetectionx.cpp\
     807                        ./modules/EdgeDetectionx/EdgeDetectionx.h\
    806808                        ./modules/AverageFilterx/AverageFilterx.cpp\
    807809                        ./modules/AverageFilterx/AverageFilterx.h\
  • issm/trunk-jpl/src/c/modules/modules.h

    r14650 r14714  
    2525#include "./DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h"
    2626#include "./ElementConnectivityx/ElementConnectivityx.h"
     27#include "./EdgeDetectionx/EdgeDetectionx.h"
    2728#include "./EnumToStringx/EnumToStringx.h"
    2829#include "./StringToEnumx/StringToEnumx.h"
  • issm/trunk-jpl/src/wrappers/matlab/Makefile.am

    r14656 r14714  
    4646                                                 ContourToMesh.la\
    4747                                                 ContourToNodes.la\
     48                                                 EdgeDetection.la\
    4849                                                 ElementConnectivity.la\
    4950                                                 EnumToString.la\
     
    216217Ll2xy_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
    217218
     219EdgeDetection_la_SOURCES = ../EdgeDetection/EdgeDetection.cpp\
     220                                                        ../EdgeDetection/EdgeDetection.h
     221
    218222ExpSimplify_la_SOURCES = ../ExpSimplify/ExpSimplify.cpp\
    219223                                                        ../ExpSimplify/ExpSimplify.h
  • issm/trunk-jpl/src/wrappers/matlab/io/WriteMatlabData.cpp

    r14673 r14714  
    360360}
    361361/*}}}*/
     362/*FUNCTION WriteData(mxArray** pdataref,DataSet* contours){{{*/
     363void WriteData(mxArray** pdataref,DataSet* contours){
     364
     365        /*Intermediary*/
     366
     367        int         i;
     368        mxArray    *dataref           = NULL;
     369        const int   numfields         = 6;
     370        const char *fnames[numfields];
     371        mwSize      ndim              = 2;
     372        mwSize      dimensions[2]     = {1,1};
     373        char        id[100];
     374
     375
     376        /*Initialize field names*/
     377        i=0;
     378        fnames[i++] = "name";
     379        fnames[i++] = "nods";
     380        fnames[i++] = "density";
     381        fnames[i++] = "x";
     382        fnames[i++] = "y";
     383        fnames[i++] = "closed";
     384        _assert_(i==numfields);
     385
     386        /*Initialize matlab structure of dimension numrifts*/
     387        dimensions[0]=contours->Size();
     388        dataref=mxCreateStructArray(ndim,dimensions,numfields,fnames);
     389
     390        /*set each matlab each field*/
     391        for(int i=0;i<contours->Size();i++){
     392                Contour<IssmPDouble>* contour=(Contour<IssmPDouble>*)contours->GetObjectByOffset(i);
     393               
     394                /*create a name for this contour from the contour id and set it: */
     395                sprintf(id,"%i",contour->id);
     396                SetStructureFieldi(dataref,i,"name",id);
     397
     398                /*number of nods: */
     399                SetStructureFieldi(dataref,i,"nods"         ,contour->nods);
     400               
     401                /*density: */
     402                SetStructureFieldi(dataref,i,"density"            ,1);
     403               
     404                /*x and y: */
     405                SetStructureFieldi(dataref,i,"x"             ,contour->nods, 1,contour->x);
     406                SetStructureFieldi(dataref,i,"y"             ,contour->nods, 1,contour->y);
     407
     408                /*closed: */
     409                SetStructureFieldi(dataref,i,"closed"         ,(int)contour->closed);
     410        }
     411
     412        /*Assign output*/
     413        *pdataref=dataref;
     414}
     415/*}}}*/
    362416
    363417/*Toolkit*/
    364 /*FUNCTION SetStructureField{{{*/
     418/*FUNCTION SetStructureField(mxArray* dataref,const char* fieldname,int M,int N,double* fieldpointer){{{*/
    365419void SetStructureField(mxArray* dataref,const char* fieldname,int M,int N,double* fieldpointer){
    366420
     
    372426        /*Assign to structure*/
    373427        mxSetField(dataref,0,fieldname,field);
     428}
     429/*}}}*/
     430/*FUNCTION SetStructureFieldi(mxArray* dataref,const char* fieldname,char* string) {{{*/
     431void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,char* string){
     432
     433        mxArray* field = NULL;
     434
     435        /*Convert field*/
     436        WriteData(&field,string);
     437
     438        /*Assign to structure*/
     439        mxSetField(dataref,i,fieldname,field);
    374440}
    375441/*}}}*/
  • issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h

    r14673 r14714  
    6969void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,int field);
    7070void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,double field);
     71void SetStructureFieldi(mxArray* dataref,int i,const char* fieldname,char* string);
    7172int CheckNumMatlabArguments(int nlhs,int NLHS, int nrhs,int NRHS, const char* THISFUNCTION, void (*function)( void ));
    7273
Note: See TracChangeset for help on using the changeset viewer.