Changeset 13038
- Timestamp:
- 08/14/12 17:12:51 (13 years ago)
- Location:
- issm/trunk-jpl/src/modules
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/modules/Chaco/Chaco.cpp
r13036 r13038 54 54 nvtxs = mxGetN(A_IN); 55 55 mwstart = mxGetJc(A_IN); 56 start= (int*)xmalloc((nvtxs+1)*sizeof(int));56 start=xNew<int>((nvtxs+1)); 57 57 for (i=0; i<nvtxs+1;i++)start[i]=(int)mwstart[i]; 58 58 59 59 mwadjacency = mxGetIr(A_IN); 60 adjacency = (int*)xmalloc(mxGetNzmax(A_IN)*sizeof(int));60 adjacency = xNew<int>(mxGetNzmax(A_IN)); 61 61 for (i=0; i<mxGetNzmax(A_IN); i++) adjacency[i]= (int)mwadjacency[i]; 62 62 63 63 nedges = start[nvtxs]; 64 64 if(!mxIsEmpty(EWGTS_IN)){ 65 ewgts = (float*)xcalloc(nedges, sizeof(float));65 ewgts = xNewZeroInit<float>(nedges); 66 66 doublepointer=mxGetPr(A_IN); 67 67 for (i = 0; i < nedges; i++)ewgts[i] = (float)doublepointer[i]; … … 77 77 for (i=0;i<(nterms<10?nterms:10);i++) options[i]=in_options[i]; //copy in_options into default options 78 78 FetchData(&npart,NPARTS_IN); 79 nparts= (int*)xmalloc(sizeof(int)); nparts[0]=npart; //weird Chacox interface ain't it?79 nparts=xNew<int>(1); nparts[0]=npart; //weird Chacox interface ain't it? 80 80 FetchData(&goal,&nterms,GOAL_IN); 81 81 … … 104 104 105 105 /*Allocate output: */ 106 assignment = (short*)xcalloc(nvtxs, sizeof(short));106 assignment = xNewZeroInit<short>(nvtxs); 107 107 108 108 /*Call core: */ … … 110 110 111 111 /*Output data: */ 112 doubleassignment= (double*)xmalloc(nvtxs*sizeof(double));112 doubleassignment=xNew<double>(nvtxs); 113 113 for(i=0;i<nvtxs;i++) doubleassignment[i]=(double)assignment[i]; 114 114 WriteData(ASSGN_OUT,doubleassignment,nvtxs); -
issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp
r12517 r13038 68 68 69 69 numcontours=mxGetNumberOfElements(matlabstructure); 70 contours= (Contour**)xmalloc(numcontours*sizeof(Contour*));70 contours=xNew<Contour*>(numcontours); 71 71 for(i=0;i<numcontours;i++){ 72 72 //allocate 73 contouri= (Contour*)xmalloc(sizeof(Contour));73 contouri=xNew<Contour>(1); 74 74 //retrieve dimension of this contour. 75 75 contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods")); -
issm/trunk-jpl/src/modules/InternalFront/InternalFront.cpp
r13036 r13038 36 36 /*Allocate and initialize all variables*/ 37 37 numberofsegments=0; 38 front= (int*)xmalloc(3*numberofelements*4*sizeof(int));38 front=xNew<int>(3*numberofelements*4); 39 39 40 40 /*Loop over all elements on water*/ … … 81 81 /*Now that we know how many segments there is we can allocate the final matrix*/ 82 82 if(numberofsegments){ 83 front2= (double*)xmalloc(4*numberofsegments*sizeof(double));83 front2=xNew<double>(4*numberofsegments); 84 84 for(i=0;i<4*numberofsegments;i++) front2[i]=(double)front[i]; 85 85 } -
issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp
r13036 r13038 100 100 /*contours: */ 101 101 numcontours=mxGetNumberOfElements(matlabstructure); 102 contours= (Contour**)xmalloc(numcontours*sizeof(Contour*));102 contours=xNew<Contour*>(numcontours); 103 103 for(i=0;i<numcontours;i++){ 104 104 //allocate 105 contouri= (Contour*)xmalloc(sizeof(Contour));105 contouri=xNew<Contour>(1); 106 106 //retrieve dimension of this contour. 107 107 contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods")); -
issm/trunk-jpl/src/modules/KMLMeshWrite/KMLMeshWrite.cpp
r13036 r13038 55 55 if (notesi && mxIsChar(notesi) && mxGetNumberOfElements(notesi)) { 56 56 if (!notes) { 57 notes= (char *) xmalloc((mxGetNumberOfElements(notesi)+1)*sizeof(char));57 notes=xNew<char>(mxGetNumberOfElements(notesi)+1); 58 58 mxGetString(notesi,notes,mxGetNumberOfElements(notesi)+1); 59 59 } -
issm/trunk-jpl/src/modules/MeshPartition/MeshPartition.cpp
r12517 r13038 74 74 75 75 /*Post process node_partitioning and element_partitioning to be in double format. Metis needed them in int* format: */ 76 element_partitioning= (double*)xmalloc(numberofelements*sizeof(double));76 element_partitioning=xNew<double>(numberofelements); 77 77 for (i=0;i<numberofelements;i++){ 78 78 element_partitioning[i]=(double)int_element_partitioning[i]+1; //Metis indexing from 0, matlab from 1. 79 79 } 80 80 81 node_partitioning= (double*)xmalloc(numberofvertices*sizeof(double));81 node_partitioning=xNew<double>(numberofvertices); 82 82 for (i=0;i<numberofvertices;i++){ 83 83 node_partitioning[i]=(double)int_node_partitioning[i]+1; //Metis indexing from 0, matlab from 1. -
issm/trunk-jpl/src/modules/MeshProfileIntersection/MeshProfileIntersection.cpp
r13036 r13038 55 55 FetchData(&double_index,&nel,&dummy,INDEX); 56 56 if(dummy!=3 && dummy!=6)_error_("element triangulation should be of 3 or 6 column width!"); 57 index= (int*)xmalloc(nel*3*sizeof(int));57 index=xNew<int>(nel*3); 58 58 for(i=0;i<nel;i++){ 59 59 for(j=0;j<3;j++){ … … 67 67 //contours 68 68 numcontours=mxGetNumberOfElements(matlabstructure); 69 contours= (Contour**)xmalloc(numcontours*sizeof(Contour*));69 contours=xNew<Contour*>(numcontours); 70 70 for(i=0;i<numcontours;i++){ 71 71 //allocate 72 contouri= (Contour*)xmalloc(sizeof(Contour));72 contouri=xNew<Contour>(1); 73 73 //retrieve dimension of this contour. 74 74 contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods")); -
issm/trunk-jpl/src/modules/TriMeshProcessRifts/TriMeshProcessRifts.cpp
r13036 r13038 73 73 nel=mxGetM(prhs[0]); 74 74 tindex_in=mxGetPr(prhs[0]); 75 index_in= (double*)xmalloc(nel*3*sizeof(double));75 index_in=xNew<double>(nel*3); 76 76 for (i=0;i<nel;i++){ 77 77 for (j=0;j<3;j++){ … … 88 88 nods=mxGetM(prhs[1]); 89 89 x_inm=mxGetPr(prhs[1]); 90 x_in= (double*)xmalloc(nods*sizeof(double));90 x_in=xNew<double>(nods); 91 91 for (i=0;i<nods;i++){ 92 92 x_in[i]=x_inm[i]; … … 100 100 if(mxIsDouble(prhs[2])){ 101 101 y_inm=mxGetPr(prhs[2]); 102 y_in= (double*)xmalloc(nods*sizeof(double));102 y_in=xNew<double>(nods); 103 103 for (i=0;i<nods;i++){ 104 104 y_in[i]=y_inm[i]; … … 113 113 num_seg=mxGetM(prhs[3]); 114 114 tsegments_in=mxGetPr(prhs[3]); 115 segments_in= (double*)xmalloc(num_seg*3*sizeof(double));115 segments_in=xNew<double>(num_seg*3); 116 116 for (i=0;i<num_seg;i++){ 117 117 for (j=0;j<3;j++){ … … 127 127 if(mxIsDouble(prhs[4])){ 128 128 tsegmentmarkers_in=mxGetPr(prhs[4]); 129 segmentmarkers_in= (double*)xmalloc(num_seg*sizeof(double));129 segmentmarkers_in=xNew<double>(num_seg); 130 130 for (i=0;i<num_seg;i++){ 131 131 segmentmarkers_in[i]=tsegmentmarkers_in[i];
Note:
See TracChangeset
for help on using the changeset viewer.