Changeset 12435
- Timestamp:
- 06/15/12 16:44:01 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/shared
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/shared/Elements/CoordinateSystemTransform.cpp
r10532 r12435 27 27 28 28 /*Allocate and initialize transform matrix*/ 29 transform= (double*)xmalloc(numdofs*numdofs*sizeof(double));29 transform=xNew<double>(numdofs*numdofs); 30 30 for(i=0;i<numdofs*numdofs;i++) transform[i]=0.0; 31 31 -
issm/trunk-jpl/src/c/shared/Elements/TransformInvStiffnessMatrixCoord.cpp
r10529 r12435 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<double>(Ke->nrows*Ke->ncols); 39 39 for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<double>(transform); 52 xDelete<double>(values); 53 53 } -
issm/trunk-jpl/src/c/shared/Elements/TransformStiffnessMatrixCoord.cpp
r10523 r12435 9 9 10 10 /*All nodes have the same Coordinate System*/ 11 cs_array= (int*)xmalloc(numnodes*sizeof(int));11 cs_array=xNew<int>(numnodes); 12 12 for(int i=0;i<numnodes;i++) cs_array[i]=cs_enum; 13 13 … … 16 16 17 17 /*Clean-up*/ 18 x free((void**)&cs_array);18 xDelete<int>(cs_array); 19 19 } 20 20 … … 36 36 37 37 /*Copy current stiffness matrix*/ 38 values= (double*)xmalloc(Ke->nrows*Ke->ncols*sizeof(double));38 values=xNew<double>(Ke->nrows*Ke->ncols); 39 39 for(i=0;i<Ke->nrows;i++) for(j=0;j<Ke->ncols;j++) values[i*Ke->ncols+j]=Ke->values[i*Ke->ncols+j]; 40 40 … … 49 49 50 50 /*Free Matrix*/ 51 x free((void**)&transform);52 x free((void**)&values);51 xDelete<double>(transform); 52 xDelete<double>(values); 53 53 } -
issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp
r12098 r12435 19 19 20 20 /*I/O: */ 21 FILE * fid=NULL;22 char chardummy[256];21 FILE *fid = NULL; 22 char chardummy[256]; 23 23 double ddummy; 24 24 25 25 /*output: */ 26 int nprof;//number of profiles in the domainname file27 int * profnvertices=NULL; //array holding the number of vertices for the nprof profiles28 double ** pprofx=NULL; //array of profiles x coordinates29 double ** pprofy=NULL; //array of profiles y coordinates30 bool * closed=NULL; //array holding closed flags for the nprof profiles26 int nprof; //number of profiles in the domainname file 27 int *profnvertices = NULL; //array holding the number of vertices for the nprof profiles 28 double **pprofx = NULL; //array of profiles x coordinates 29 double **pprofy = NULL; //array of profiles y coordinates 30 bool *closed = NULL; //array holding closed flags for the nprof profiles 31 31 32 32 /*For each profile: */ 33 int n;34 double * x=NULL;35 double * y=NULL;36 bool cl;33 int n; 34 double *x = NULL; 35 double *y = NULL; 36 bool cl; 37 37 38 38 /*open domain outline file for reading: */ … … 61 61 62 62 /*Allocate and initialize all the profiles: */ 63 profnvertices= (int*)xmalloc(nprof*sizeof(int));64 pprofx= (double**)xmalloc(nprof*sizeof(double*));65 pprofy= (double**)xmalloc(nprof*sizeof(double*));63 profnvertices=xNew<int>(nprof); 64 pprofx=xNew<double*>(nprof); 65 pprofy=xNew<double*>(nprof); 66 66 for (i=0;i<nprof;i++){ 67 67 pprofx[i]=NULL; 68 68 pprofy[i]=NULL; 69 69 } 70 closed= (bool*)xmalloc(nprof*sizeof(bool));70 closed=xNew<bool>(nprof); 71 71 72 72 /*Reaset file pointer to beginning of file: */ … … 91 91 y=(double*)xmalloc(n*sizeof(double)); 92 92 93 94 93 /*Read vertices: */ 95 94 for (i=0;i<n;i++){ … … 118 117 *ppprofx=pprofx; 119 118 *ppprofy=pprofy; 120 if(pclosed)*pclosed=closed; 121 else xfree((void**)&closed); 119 if(pclosed) 120 *pclosed=closed; 121 else 122 xDelete<bool>(closed); 122 123 } 123 124 -
issm/trunk-jpl/src/c/shared/Threads/LaunchThread.cpp
r12292 r12435 20 20 21 21 #include "./issm_threads.h" 22 #include "../Alloc/ alloc.h"22 #include "../Alloc/xNewDelete.h" 23 23 #include "../Exceptions/exceptions.h" 24 24 #include "../../include/include.h" … … 28 28 #ifdef _MULTITHREADING_ 29 29 int i; 30 int* status=NULL; 31 32 pthread_t* threads=NULL; 33 pthread_handle* handles=NULL; 30 int *status = NULL; 31 pthread_t *threads = NULL; 32 pthread_handle *handles = NULL; 34 33 35 34 /*dynamically allocate: */ 36 threads= (pthread_t*)xmalloc(num_threads*sizeof(pthread_t));37 handles= (pthread_handle*)xmalloc(num_threads*sizeof(pthread_handle));35 threads=xNew<pthread_t>(num_threads); 36 handles=xNew<pthread_handle>(num_threads); 38 37 39 38 for(i=0;i<num_threads;i++){ … … 42 41 handles[i].num=num_threads; 43 42 } 44 45 43 for(i=0;i<num_threads;i++){ 46 44 … … 56 54 57 55 /*Free ressources:*/ 58 x free((void**)&threads);59 x free((void**)&handles);56 xDelete<pthread_t>(threads); 57 xDelete<pthread_handle>(handles); 60 58 61 59 #else -
issm/trunk-jpl/src/c/shared/shared.h
r12420 r12435 17 17 #include "Matrix/matrix.h" 18 18 #include "Numerics/numerics.h" 19 #include "Dofs/dofs.h"20 19 #include "Threads/issm_threads.h" 21 20 #include "Bamg/shared.h"
Note:
See TracChangeset
for help on using the changeset viewer.